Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vue/reactivity

Package Overview
Dependencies
Maintainers
1
Versions
237
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vue/reactivity - npm Package Compare versions

Comparing version 3.1.5 to 3.2.0-beta.1

450

dist/reactivity.cjs.js

@@ -7,3 +7,118 @@ 'use strict';

function warn(msg, ...args) {
console.warn(`[Vue warn] ${msg}`, ...args);
}
let activeEffectScope;
const effectScopeStack = [];
class EffectScope {
constructor(detached = false) {
this.active = true;
this.effects = [];
this.cleanups = [];
if (!detached) {
recordEffectScope(this);
}
}
run(fn) {
if (this.active) {
try {
this.on();
return fn();
}
finally {
this.off();
}
}
else {
warn(`cannot run an inactive effect scope.`);
}
}
on() {
if (this.active) {
effectScopeStack.push(this);
activeEffectScope = this;
}
}
off() {
if (this.active) {
effectScopeStack.pop();
activeEffectScope = effectScopeStack[effectScopeStack.length - 1];
}
}
stop() {
if (this.active) {
this.effects.forEach(e => e.stop());
this.cleanups.forEach(cleanup => cleanup());
this.active = false;
}
}
}
function effectScope(detached) {
return new EffectScope(detached);
}
function recordEffectScope(effect, scope) {
scope = scope || activeEffectScope;
if (scope && scope.active) {
scope.effects.push(effect);
}
}
function getCurrentScope() {
return activeEffectScope;
}
function onScopeDispose(fn) {
if (activeEffectScope) {
activeEffectScope.cleanups.push(fn);
}
else {
warn(`onDispose() is called when there is no active effect scope ` +
` to be associated with.`);
}
}
const createDep = (effects) => {
const dep = new Set(effects);
dep.w = 0;
dep.n = 0;
return dep;
};
const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
const newTracked = (dep) => (dep.n & trackOpBit) > 0;
const initDepMarkers = ({ deps }) => {
if (deps.length) {
for (let i = 0; i < deps.length; i++) {
deps[i].w |= trackOpBit; // set was tracked
}
}
};
const finalizeDepMarkers = (effect) => {
const { deps } = effect;
if (deps.length) {
let ptr = 0;
for (let i = 0; i < deps.length; i++) {
const dep = deps[i];
if (wasTracked(dep) && !newTracked(dep)) {
dep.delete(effect);
}
else {
deps[ptr++] = dep;
}
// clear bits
dep.w &= ~trackOpBit;
dep.n &= ~trackOpBit;
}
deps.length = ptr;
}
};
const targetMap = new WeakMap();
// The number of effects currently being tracked recursively.
let effectTrackDepth = 0;
let trackOpBit = 1;
/**
* The bitwise track markers support at most 30 levels op recursion.
* This value is chosen to enable modern JS engines to use a SMI on all platforms.
* When recursion depth is greater, fall back to using a full cleanup.
*/
const maxMarkerBits = 30;
const effectStack = [];

@@ -13,55 +128,50 @@ let activeEffect;

const MAP_KEY_ITERATE_KEY = Symbol('Map key iterate' );
function isEffect(fn) {
return fn && fn._isEffect === true;
}
function effect(fn, options = shared.EMPTY_OBJ) {
if (isEffect(fn)) {
fn = fn.raw;
class ReactiveEffect {
constructor(fn, scheduler = null, scope) {
this.fn = fn;
this.scheduler = scheduler;
this.active = true;
this.deps = [];
recordEffectScope(this, scope);
}
const effect = createReactiveEffect(fn, options);
if (!options.lazy) {
effect();
}
return effect;
}
function stop(effect) {
if (effect.active) {
cleanup(effect);
if (effect.options.onStop) {
effect.options.onStop();
run() {
if (!this.active) {
return this.fn();
}
effect.active = false;
}
}
let uid = 0;
function createReactiveEffect(fn, options) {
const effect = function reactiveEffect() {
if (!effect.active) {
return fn();
}
if (!effectStack.includes(effect)) {
cleanup(effect);
if (!effectStack.includes(this)) {
try {
effectStack.push((activeEffect = this));
enableTracking();
effectStack.push(effect);
activeEffect = effect;
return fn();
trackOpBit = 1 << ++effectTrackDepth;
if (effectTrackDepth <= maxMarkerBits) {
initDepMarkers(this);
}
else {
cleanupEffect(this);
}
return this.fn();
}
finally {
if (effectTrackDepth <= maxMarkerBits) {
finalizeDepMarkers(this);
}
trackOpBit = 1 << --effectTrackDepth;
resetTracking();
effectStack.pop();
resetTracking();
activeEffect = effectStack[effectStack.length - 1];
const n = effectStack.length;
activeEffect = n > 0 ? effectStack[n - 1] : undefined;
}
}
};
effect.id = uid++;
effect.allowRecurse = !!options.allowRecurse;
effect._isEffect = true;
effect.active = true;
effect.raw = fn;
effect.deps = [];
effect.options = options;
return effect;
}
stop() {
if (this.active) {
cleanupEffect(this);
if (this.onStop) {
this.onStop();
}
this.active = false;
}
}
}
function cleanup(effect) {
function cleanupEffect(effect) {
const { deps } = effect;

@@ -75,2 +185,22 @@ if (deps.length) {

}
function effect(fn, options) {
if (fn.effect) {
fn = fn.effect.fn;
}
const _effect = new ReactiveEffect(fn);
if (options) {
shared.extend(_effect, options);
if (options.scope)
recordEffectScope(_effect, options.scope);
}
if (!options || !options.lazy) {
_effect.run();
}
const runner = _effect.run.bind(_effect);
runner.effect = _effect;
return runner;
}
function stop(runner) {
runner.effect.stop();
}
let shouldTrack = true;

@@ -91,3 +221,3 @@ const trackStack = [];

function track(target, type, key) {
if (!shouldTrack || activeEffect === undefined) {
if (!isTracking()) {
return;

@@ -101,14 +231,30 @@ }

if (!dep) {
depsMap.set(key, (dep = new Set()));
depsMap.set(key, (dep = createDep()));
}
if (!dep.has(activeEffect)) {
const eventInfo = { effect: activeEffect, target, type, key }
;
trackEffects(dep, eventInfo);
}
function isTracking() {
return shouldTrack && activeEffect !== undefined;
}
function trackEffects(dep, debuggerEventExtraInfo) {
let shouldTrack = false;
if (effectTrackDepth <= maxMarkerBits) {
if (!newTracked(dep)) {
dep.n |= trackOpBit; // set newly tracked
shouldTrack = !wasTracked(dep);
}
}
else {
// Full cleanup mode.
shouldTrack = !dep.has(activeEffect);
}
if (shouldTrack) {
dep.add(activeEffect);
activeEffect.deps.push(dep);
if (activeEffect.options.onTrack) {
activeEffect.options.onTrack({
effect: activeEffect,
target,
type,
key
});
if (activeEffect.onTrack) {
activeEffect.onTrack(Object.assign({
effect: activeEffect
}, debuggerEventExtraInfo));
}

@@ -123,16 +269,7 @@ }

}
const effects = new Set();
const add = (effectsToAdd) => {
if (effectsToAdd) {
effectsToAdd.forEach(effect => {
if (effect !== activeEffect || effect.allowRecurse) {
effects.add(effect);
}
});
}
};
let deps = [];
if (type === "clear" /* CLEAR */) {
// collection being cleared
// trigger all effects for target
depsMap.forEach(add);
deps = [...depsMap.values()];
}

@@ -142,3 +279,3 @@ else if (key === 'length' && shared.isArray(target)) {

if (key === 'length' || key >= newValue) {
add(dep);
deps.push(dep);
}

@@ -150,3 +287,3 @@ });

if (key !== void 0) {
add(depsMap.get(key));
deps.push(depsMap.get(key));
}

@@ -157,5 +294,5 @@ // also run for iteration key on ADD | DELETE | Map.SET

if (!shared.isArray(target)) {
add(depsMap.get(ITERATE_KEY));
deps.push(depsMap.get(ITERATE_KEY));
if (shared.isMap(target)) {
add(depsMap.get(MAP_KEY_ITERATE_KEY));
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
}

@@ -165,3 +302,3 @@ }

// new index added to array -> length changes
add(depsMap.get('length'));
deps.push(depsMap.get('length'));
}

@@ -171,5 +308,5 @@ break;

if (!shared.isArray(target)) {
add(depsMap.get(ITERATE_KEY));
deps.push(depsMap.get(ITERATE_KEY));
if (shared.isMap(target)) {
add(depsMap.get(MAP_KEY_ITERATE_KEY));
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
}

@@ -180,3 +317,3 @@ }

if (shared.isMap(target)) {
add(depsMap.get(ITERATE_KEY));
deps.push(depsMap.get(ITERATE_KEY));
}

@@ -186,23 +323,39 @@ break;

}
const run = (effect) => {
if (effect.options.onTrigger) {
effect.options.onTrigger({
effect,
target,
key,
type,
newValue,
oldValue,
oldTarget
});
const eventInfo = { target, type, key, newValue, oldValue, oldTarget }
;
if (deps.length === 1) {
if (deps[0]) {
{
triggerEffects(deps[0], eventInfo);
}
}
if (effect.options.scheduler) {
effect.options.scheduler(effect);
}
else {
const effects = [];
for (const dep of deps) {
if (dep) {
effects.push(...dep);
}
}
else {
effect();
{
triggerEffects(createDep(effects), eventInfo);
}
};
effects.forEach(run);
}
}
function triggerEffects(dep, debuggerEventExtraInfo) {
// spread into array for stabilization
for (const effect of shared.isArray(dep) ? dep : [...dep]) {
if (effect !== activeEffect || effect.allowRecurse) {
if (effect.onTrigger) {
effect.onTrigger(shared.extend({ effect }, debuggerEventExtraInfo));
}
if (effect.scheduler) {
effect.scheduler();
}
else {
effect.run();
}
}
}
}

@@ -759,3 +912,4 @@ const isNonTrackableKeys = /*#__PURE__*/ shared.makeMap(`__proto__,__v_isRef,__isVue`);

function toRaw(observed) {
return ((observed && toRaw(observed["__v_raw" /* RAW */])) || observed);
const raw = observed && observed["__v_raw" /* RAW */];
return raw ? toRaw(raw) : observed;
}

@@ -767,2 +921,30 @@ function markRaw(value) {

function trackRefValue(ref) {
if (isTracking()) {
ref = toRaw(ref);
if (!ref.dep) {
ref.dep = createDep();
}
{
trackEffects(ref.dep, {
target: ref,
type: "get" /* GET */,
key: 'value'
});
}
}
}
function triggerRefValue(ref, newVal) {
ref = toRaw(ref);
if (ref.dep) {
{
triggerEffects(ref.dep, {
target: ref,
type: "set" /* SET */,
key: 'value',
newValue: newVal
});
}
}
}
const convert = (val) => shared.isObject(val) ? reactive(val) : val;

@@ -781,2 +963,3 @@ function isRef(r) {

this._shallow = _shallow;
this.dep = undefined;
this.__v_isRef = true;

@@ -787,3 +970,3 @@ this._rawValue = _shallow ? value : toRaw(value);

get value() {
track(toRaw(this), "get" /* GET */, 'value');
trackRefValue(this);
return this._value;

@@ -796,3 +979,3 @@ }

this._value = this._shallow ? newVal : convert(newVal);
trigger(toRaw(this), "set" /* SET */, 'value', newVal);
triggerRefValue(this, newVal);
}

@@ -808,3 +991,3 @@ }

function triggerRef(ref) {
trigger(toRaw(ref), "set" /* SET */, 'value', ref.value );
triggerRefValue(ref, ref.value );
}

@@ -834,4 +1017,5 @@ function unref(ref) {

constructor(factory) {
this.dep = undefined;
this.__v_isRef = true;
const { get, set } = factory(() => track(this, "get" /* GET */, 'value'), () => trigger(this, "set" /* SET */, 'value'));
const { get, set } = factory(() => trackRefValue(this), () => triggerRefValue(this));
this._get = get;

@@ -879,27 +1063,64 @@ this._set = set;

let scheduler;
/**
* Set a scheduler for deferring computed computations
*/
const setComputedScheduler = (s) => {
scheduler = s;
};
class ComputedRefImpl {
constructor(getter, _setter, isReadonly) {
this._setter = _setter;
this.dep = undefined;
this._dirty = true;
this.__v_isRef = true;
this.effect = effect(getter, {
lazy: true,
scheduler: () => {
if (!this._dirty) {
this._dirty = true;
trigger(toRaw(this), "set" /* SET */, 'value');
let compareTarget;
let hasCompareTarget = false;
let scheduled = false;
this.effect = new ReactiveEffect(getter, (computedTrigger) => {
if (scheduler && this.dep) {
if (computedTrigger) {
compareTarget = this._value;
hasCompareTarget = true;
}
else if (!scheduled) {
const valueToCompare = hasCompareTarget ? compareTarget : this._value;
scheduled = true;
hasCompareTarget = false;
scheduler(() => {
if (this._get() !== valueToCompare) {
triggerRefValue(this);
}
scheduled = false;
});
}
// chained upstream computeds are notified synchronously to ensure
// value invalidation in case of sync access; normal effects are
// deferred to be triggered in scheduler.
for (const e of this.dep) {
if (e.computed) {
e.scheduler(true /* computedTrigger */);
}
}
}
if (!this._dirty) {
this._dirty = true;
if (!scheduler)
triggerRefValue(this);
}
});
this.effect.computed = true;
this["__v_isReadonly" /* IS_READONLY */] = isReadonly;
}
_get() {
if (this._dirty) {
this._dirty = false;
return (this._value = this.effect.run());
}
return this._value;
}
get value() {
trackRefValue(this);
// the computed ref may get wrapped by other proxies e.g. readonly() #3376
const self = toRaw(this);
if (self._dirty) {
self._value = this.effect();
self._dirty = false;
}
track(self, "get" /* GET */, 'value');
return self._value;
return toRaw(this)._get();
}

@@ -910,3 +1131,3 @@ set value(newValue) {

}
function computed(getterOrOptions) {
function computed(getterOrOptions, debugOptions) {
let getter;

@@ -925,10 +1146,19 @@ let setter;

}
return new ComputedRefImpl(getter, setter, shared.isFunction(getterOrOptions) || !getterOrOptions.set);
const cRef = new ComputedRefImpl(getter, setter, shared.isFunction(getterOrOptions) || !getterOrOptions.set);
if (debugOptions) {
cRef.effect.onTrack = debugOptions.onTrack;
cRef.effect.onTrigger = debugOptions.onTrigger;
}
return cRef;
}
exports.EffectScope = EffectScope;
exports.ITERATE_KEY = ITERATE_KEY;
exports.ReactiveEffect = ReactiveEffect;
exports.computed = computed;
exports.customRef = customRef;
exports.effect = effect;
exports.effectScope = effectScope;
exports.enableTracking = enableTracking;
exports.getCurrentScope = getCurrentScope;
exports.isProxy = isProxy;

@@ -939,2 +1169,3 @@ exports.isReactive = isReactive;

exports.markRaw = markRaw;
exports.onScopeDispose = onScopeDispose;
exports.pauseTracking = pauseTracking;

@@ -946,2 +1177,3 @@ exports.proxyRefs = proxyRefs;

exports.resetTracking = resetTracking;
exports.setComputedScheduler = setComputedScheduler;
exports.shallowReactive = shallowReactive;

@@ -948,0 +1180,0 @@ exports.shallowReadonly = shallowReadonly;

@@ -7,3 +7,107 @@ 'use strict';

let activeEffectScope;
const effectScopeStack = [];
class EffectScope {
constructor(detached = false) {
this.active = true;
this.effects = [];
this.cleanups = [];
if (!detached) {
recordEffectScope(this);
}
}
run(fn) {
if (this.active) {
try {
this.on();
return fn();
}
finally {
this.off();
}
}
}
on() {
if (this.active) {
effectScopeStack.push(this);
activeEffectScope = this;
}
}
off() {
if (this.active) {
effectScopeStack.pop();
activeEffectScope = effectScopeStack[effectScopeStack.length - 1];
}
}
stop() {
if (this.active) {
this.effects.forEach(e => e.stop());
this.cleanups.forEach(cleanup => cleanup());
this.active = false;
}
}
}
function effectScope(detached) {
return new EffectScope(detached);
}
function recordEffectScope(effect, scope) {
scope = scope || activeEffectScope;
if (scope && scope.active) {
scope.effects.push(effect);
}
}
function getCurrentScope() {
return activeEffectScope;
}
function onScopeDispose(fn) {
if (activeEffectScope) {
activeEffectScope.cleanups.push(fn);
}
}
const createDep = (effects) => {
const dep = new Set(effects);
dep.w = 0;
dep.n = 0;
return dep;
};
const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
const newTracked = (dep) => (dep.n & trackOpBit) > 0;
const initDepMarkers = ({ deps }) => {
if (deps.length) {
for (let i = 0; i < deps.length; i++) {
deps[i].w |= trackOpBit; // set was tracked
}
}
};
const finalizeDepMarkers = (effect) => {
const { deps } = effect;
if (deps.length) {
let ptr = 0;
for (let i = 0; i < deps.length; i++) {
const dep = deps[i];
if (wasTracked(dep) && !newTracked(dep)) {
dep.delete(effect);
}
else {
deps[ptr++] = dep;
}
// clear bits
dep.w &= ~trackOpBit;
dep.n &= ~trackOpBit;
}
deps.length = ptr;
}
};
const targetMap = new WeakMap();
// The number of effects currently being tracked recursively.
let effectTrackDepth = 0;
let trackOpBit = 1;
/**
* The bitwise track markers support at most 30 levels op recursion.
* This value is chosen to enable modern JS engines to use a SMI on all platforms.
* When recursion depth is greater, fall back to using a full cleanup.
*/
const maxMarkerBits = 30;
const effectStack = [];

@@ -13,55 +117,50 @@ let activeEffect;

const MAP_KEY_ITERATE_KEY = Symbol('');
function isEffect(fn) {
return fn && fn._isEffect === true;
}
function effect(fn, options = shared.EMPTY_OBJ) {
if (isEffect(fn)) {
fn = fn.raw;
class ReactiveEffect {
constructor(fn, scheduler = null, scope) {
this.fn = fn;
this.scheduler = scheduler;
this.active = true;
this.deps = [];
recordEffectScope(this, scope);
}
const effect = createReactiveEffect(fn, options);
if (!options.lazy) {
effect();
}
return effect;
}
function stop(effect) {
if (effect.active) {
cleanup(effect);
if (effect.options.onStop) {
effect.options.onStop();
run() {
if (!this.active) {
return this.fn();
}
effect.active = false;
}
}
let uid = 0;
function createReactiveEffect(fn, options) {
const effect = function reactiveEffect() {
if (!effect.active) {
return fn();
}
if (!effectStack.includes(effect)) {
cleanup(effect);
if (!effectStack.includes(this)) {
try {
effectStack.push((activeEffect = this));
enableTracking();
effectStack.push(effect);
activeEffect = effect;
return fn();
trackOpBit = 1 << ++effectTrackDepth;
if (effectTrackDepth <= maxMarkerBits) {
initDepMarkers(this);
}
else {
cleanupEffect(this);
}
return this.fn();
}
finally {
if (effectTrackDepth <= maxMarkerBits) {
finalizeDepMarkers(this);
}
trackOpBit = 1 << --effectTrackDepth;
resetTracking();
effectStack.pop();
resetTracking();
activeEffect = effectStack[effectStack.length - 1];
const n = effectStack.length;
activeEffect = n > 0 ? effectStack[n - 1] : undefined;
}
}
};
effect.id = uid++;
effect.allowRecurse = !!options.allowRecurse;
effect._isEffect = true;
effect.active = true;
effect.raw = fn;
effect.deps = [];
effect.options = options;
return effect;
}
stop() {
if (this.active) {
cleanupEffect(this);
if (this.onStop) {
this.onStop();
}
this.active = false;
}
}
}
function cleanup(effect) {
function cleanupEffect(effect) {
const { deps } = effect;

@@ -75,2 +174,22 @@ if (deps.length) {

}
function effect(fn, options) {
if (fn.effect) {
fn = fn.effect.fn;
}
const _effect = new ReactiveEffect(fn);
if (options) {
shared.extend(_effect, options);
if (options.scope)
recordEffectScope(_effect, options.scope);
}
if (!options || !options.lazy) {
_effect.run();
}
const runner = _effect.run.bind(_effect);
runner.effect = _effect;
return runner;
}
function stop(runner) {
runner.effect.stop();
}
let shouldTrack = true;

@@ -91,3 +210,3 @@ const trackStack = [];

function track(target, type, key) {
if (!shouldTrack || activeEffect === undefined) {
if (!isTracking()) {
return;

@@ -101,5 +220,22 @@ }

if (!dep) {
depsMap.set(key, (dep = new Set()));
depsMap.set(key, (dep = createDep()));
}
if (!dep.has(activeEffect)) {
trackEffects(dep);
}
function isTracking() {
return shouldTrack && activeEffect !== undefined;
}
function trackEffects(dep, debuggerEventExtraInfo) {
let shouldTrack = false;
if (effectTrackDepth <= maxMarkerBits) {
if (!newTracked(dep)) {
dep.n |= trackOpBit; // set newly tracked
shouldTrack = !wasTracked(dep);
}
}
else {
// Full cleanup mode.
shouldTrack = !dep.has(activeEffect);
}
if (shouldTrack) {
dep.add(activeEffect);

@@ -115,16 +251,7 @@ activeEffect.deps.push(dep);

}
const effects = new Set();
const add = (effectsToAdd) => {
if (effectsToAdd) {
effectsToAdd.forEach(effect => {
if (effect !== activeEffect || effect.allowRecurse) {
effects.add(effect);
}
});
}
};
let deps = [];
if (type === "clear" /* CLEAR */) {
// collection being cleared
// trigger all effects for target
depsMap.forEach(add);
deps = [...depsMap.values()];
}

@@ -134,3 +261,3 @@ else if (key === 'length' && shared.isArray(target)) {

if (key === 'length' || key >= newValue) {
add(dep);
deps.push(dep);
}

@@ -142,3 +269,3 @@ });

if (key !== void 0) {
add(depsMap.get(key));
deps.push(depsMap.get(key));
}

@@ -149,5 +276,5 @@ // also run for iteration key on ADD | DELETE | Map.SET

if (!shared.isArray(target)) {
add(depsMap.get(ITERATE_KEY));
deps.push(depsMap.get(ITERATE_KEY));
if (shared.isMap(target)) {
add(depsMap.get(MAP_KEY_ITERATE_KEY));
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
}

@@ -157,3 +284,3 @@ }

// new index added to array -> length changes
add(depsMap.get('length'));
deps.push(depsMap.get('length'));
}

@@ -163,5 +290,5 @@ break;

if (!shared.isArray(target)) {
add(depsMap.get(ITERATE_KEY));
deps.push(depsMap.get(ITERATE_KEY));
if (shared.isMap(target)) {
add(depsMap.get(MAP_KEY_ITERATE_KEY));
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
}

@@ -172,3 +299,3 @@ }

if (shared.isMap(target)) {
add(depsMap.get(ITERATE_KEY));
deps.push(depsMap.get(ITERATE_KEY));
}

@@ -178,12 +305,34 @@ break;

}
const run = (effect) => {
if (effect.options.scheduler) {
effect.options.scheduler(effect);
if (deps.length === 1) {
if (deps[0]) {
{
triggerEffects(deps[0]);
}
}
else {
effect();
}
else {
const effects = [];
for (const dep of deps) {
if (dep) {
effects.push(...dep);
}
}
};
effects.forEach(run);
{
triggerEffects(createDep(effects));
}
}
}
function triggerEffects(dep, debuggerEventExtraInfo) {
// spread into array for stabilization
for (const effect of shared.isArray(dep) ? dep : [...dep]) {
if (effect !== activeEffect || effect.allowRecurse) {
if (effect.scheduler) {
effect.scheduler();
}
else {
effect.run();
}
}
}
}

@@ -706,3 +855,4 @@ const isNonTrackableKeys = /*#__PURE__*/ shared.makeMap(`__proto__,__v_isRef,__isVue`);

function toRaw(observed) {
return ((observed && toRaw(observed["__v_raw" /* RAW */])) || observed);
const raw = observed && observed["__v_raw" /* RAW */];
return raw ? toRaw(raw) : observed;
}

@@ -714,2 +864,21 @@ function markRaw(value) {

function trackRefValue(ref) {
if (isTracking()) {
ref = toRaw(ref);
if (!ref.dep) {
ref.dep = createDep();
}
{
trackEffects(ref.dep);
}
}
}
function triggerRefValue(ref, newVal) {
ref = toRaw(ref);
if (ref.dep) {
{
triggerEffects(ref.dep);
}
}
}
const convert = (val) => shared.isObject(val) ? reactive(val) : val;

@@ -728,2 +897,3 @@ function isRef(r) {

this._shallow = _shallow;
this.dep = undefined;
this.__v_isRef = true;

@@ -734,3 +904,3 @@ this._rawValue = _shallow ? value : toRaw(value);

get value() {
track(toRaw(this), "get" /* GET */, 'value');
trackRefValue(this);
return this._value;

@@ -743,3 +913,3 @@ }

this._value = this._shallow ? newVal : convert(newVal);
trigger(toRaw(this), "set" /* SET */, 'value', newVal);
triggerRefValue(this);
}

@@ -755,3 +925,3 @@ }

function triggerRef(ref) {
trigger(toRaw(ref), "set" /* SET */, 'value', void 0);
triggerRefValue(ref);
}

@@ -781,4 +951,5 @@ function unref(ref) {

constructor(factory) {
this.dep = undefined;
this.__v_isRef = true;
const { get, set } = factory(() => track(this, "get" /* GET */, 'value'), () => trigger(this, "set" /* SET */, 'value'));
const { get, set } = factory(() => trackRefValue(this), () => triggerRefValue(this));
this._get = get;

@@ -823,27 +994,64 @@ this._set = set;

let scheduler;
/**
* Set a scheduler for deferring computed computations
*/
const setComputedScheduler = (s) => {
scheduler = s;
};
class ComputedRefImpl {
constructor(getter, _setter, isReadonly) {
this._setter = _setter;
this.dep = undefined;
this._dirty = true;
this.__v_isRef = true;
this.effect = effect(getter, {
lazy: true,
scheduler: () => {
if (!this._dirty) {
this._dirty = true;
trigger(toRaw(this), "set" /* SET */, 'value');
let compareTarget;
let hasCompareTarget = false;
let scheduled = false;
this.effect = new ReactiveEffect(getter, (computedTrigger) => {
if (scheduler && this.dep) {
if (computedTrigger) {
compareTarget = this._value;
hasCompareTarget = true;
}
else if (!scheduled) {
const valueToCompare = hasCompareTarget ? compareTarget : this._value;
scheduled = true;
hasCompareTarget = false;
scheduler(() => {
if (this._get() !== valueToCompare) {
triggerRefValue(this);
}
scheduled = false;
});
}
// chained upstream computeds are notified synchronously to ensure
// value invalidation in case of sync access; normal effects are
// deferred to be triggered in scheduler.
for (const e of this.dep) {
if (e.computed) {
e.scheduler(true /* computedTrigger */);
}
}
}
if (!this._dirty) {
this._dirty = true;
if (!scheduler)
triggerRefValue(this);
}
});
this.effect.computed = true;
this["__v_isReadonly" /* IS_READONLY */] = isReadonly;
}
_get() {
if (this._dirty) {
this._dirty = false;
return (this._value = this.effect.run());
}
return this._value;
}
get value() {
trackRefValue(this);
// the computed ref may get wrapped by other proxies e.g. readonly() #3376
const self = toRaw(this);
if (self._dirty) {
self._value = this.effect();
self._dirty = false;
}
track(self, "get" /* GET */, 'value');
return self._value;
return toRaw(this)._get();
}

@@ -854,3 +1062,3 @@ set value(newValue) {

}
function computed(getterOrOptions) {
function computed(getterOrOptions, debugOptions) {
let getter;

@@ -866,10 +1074,15 @@ let setter;

}
return new ComputedRefImpl(getter, setter, shared.isFunction(getterOrOptions) || !getterOrOptions.set);
const cRef = new ComputedRefImpl(getter, setter, shared.isFunction(getterOrOptions) || !getterOrOptions.set);
return cRef;
}
exports.EffectScope = EffectScope;
exports.ITERATE_KEY = ITERATE_KEY;
exports.ReactiveEffect = ReactiveEffect;
exports.computed = computed;
exports.customRef = customRef;
exports.effect = effect;
exports.effectScope = effectScope;
exports.enableTracking = enableTracking;
exports.getCurrentScope = getCurrentScope;
exports.isProxy = isProxy;

@@ -880,2 +1093,3 @@ exports.isReactive = isReactive;

exports.markRaw = markRaw;
exports.onScopeDispose = onScopeDispose;
exports.pauseTracking = pauseTracking;

@@ -887,2 +1101,3 @@ exports.proxyRefs = proxyRefs;

exports.resetTracking = resetTracking;
exports.setComputedScheduler = setComputedScheduler;
exports.shallowReactive = shallowReactive;

@@ -889,0 +1104,0 @@ exports.shallowReadonly = shallowReadonly;

@@ -8,5 +8,5 @@

export declare function computed<T>(getter: ComputedGetter<T>): ComputedRef<T>;
export declare function computed<T>(getter: ComputedGetter<T>, debugOptions?: DebuggerOptions): ComputedRef<T>;
export declare function computed<T>(options: WritableComputedOptions<T>): WritableComputedRef<T>;
export declare function computed<T>(options: WritableComputedOptions<T>, debugOptions?: DebuggerOptions): WritableComputedRef<T>;

@@ -19,2 +19,4 @@ export declare type ComputedGetter<T> = (ctx?: any) => T;

declare type ComputedScheduler = (fn: () => void) => void;
export declare type ComputedSetter<T> = (v: T) => void;

@@ -31,11 +33,16 @@

effect: ReactiveEffect;
} & DebuggerEventExtraInfo;
declare type DebuggerEventExtraInfo = {
target: object;
type: TrackOpTypes | TriggerOpTypes;
key: any;
} & DebuggerEventExtraInfo;
declare interface DebuggerEventExtraInfo {
newValue?: any;
oldValue?: any;
oldTarget?: Map<any, any> | Set<any>;
};
export declare interface DebuggerOptions {
onTrack?: (event: DebuggerEvent) => void;
onTrigger?: (event: DebuggerEvent) => void;
}

@@ -47,8 +54,25 @@

declare type Dep = Set<ReactiveEffect>;
declare type Dep = Set<ReactiveEffect> & TrackedMarkers;
export declare function effect<T = any>(fn: () => T, options?: ReactiveEffectOptions): ReactiveEffect<T>;
export declare function effect<T = any>(fn: () => T, options?: ReactiveEffectOptions): ReactiveEffectRunner;
export declare type EffectScheduler = (...args: any[]) => any;
export declare class EffectScope {
active: boolean;
effects: (ReactiveEffect | EffectScope)[];
cleanups: (() => void)[];
constructor(detached?: boolean);
run<T>(fn: () => T): T | undefined;
on(): void;
off(): void;
stop(): void;
}
export declare function effectScope(detached?: boolean): EffectScope;
export declare function enableTracking(): void;
export declare function getCurrentScope(): EffectScope | undefined;
export declare function isProxy(value: unknown): boolean;

@@ -68,2 +92,4 @@

export declare function onScopeDispose(fn: () => void): void;
export declare function pauseTracking(): void;

@@ -99,37 +125,30 @@

export declare interface ReactiveEffect<T = any> {
(): T;
_isEffect: true;
id: number;
export declare class ReactiveEffect<T = any> {
fn: () => T;
scheduler: EffectScheduler | null;
active: boolean;
raw: () => T;
deps: Array<Dep>;
options: ReactiveEffectOptions;
allowRecurse: boolean;
deps: Dep[];
computed?: boolean;
allowRecurse?: boolean;
onStop?: () => void;
onTrack?: (event: DebuggerEvent) => void;
onTrigger?: (event: DebuggerEvent) => void;
constructor(fn: () => T, scheduler?: EffectScheduler | null, scope?: EffectScope | null);
run(): T | undefined;
stop(): void;
}
export declare interface ReactiveEffectOptions {
export declare interface ReactiveEffectOptions extends DebuggerOptions {
lazy?: boolean;
scheduler?: (job: ReactiveEffect) => void;
onTrack?: (event: DebuggerEvent) => void;
onTrigger?: (event: DebuggerEvent) => void;
scheduler?: EffectScheduler;
scope?: EffectScope;
allowRecurse?: boolean;
onStop?: () => void;
/**
* Indicates whether the job is allowed to recursively trigger itself when
* managed by the scheduler.
*
* By default, a job cannot trigger itself because some built-in method calls,
* e.g. Array.prototype.push actually performs reads as well (#1740) which
* can lead to confusing infinite loops.
* The allowed cases are component update functions and watch callbacks.
* Component update functions may update child component props, which in turn
* trigger flush: "pre" watch callbacks that mutates state that the parent
* relies on (#1801). Watch callbacks doesn't track its dependencies so if it
* triggers itself again, it's likely intentional and it is the user's
* responsibility to perform recursive state mutation that eventually
* stabilizes (#1727).
*/
allowRecurse?: boolean;
}
export declare interface ReactiveEffectRunner<T = any> {
(): T;
effect: ReactiveEffect;
}
export declare const enum ReactiveFlags {

@@ -157,2 +176,6 @@ SKIP = "__v_skip",

/* Excluded from this release type: _shallow */
/**
* Deps are maintained locally rather than in depsMap for performance reasons.
*/
dep?: Dep;
}

@@ -191,2 +214,7 @@

/**
* Set a scheduler for deferring computed computations
*/
export declare const setComputedScheduler: (s: ComputedScheduler | undefined) => void;
/**
* Return a shallowly-reactive copy of the original object, where only the root

@@ -218,3 +246,3 @@ * level properties are reactive. It also does not auto-unwrap refs (even at the

declare function stop_2(effect: ReactiveEffect): void;
declare function stop_2(runner: ReactiveEffectRunner): void;
export { stop_2 as stop }

@@ -290,2 +318,18 @@

/**
* wasTracked and newTracked maintain the status for several levels of effect
* tracking recursion. One bit per level is used to define wheter the dependency
* was/is tracked.
*/
declare type TrackedMarkers = {
/**
* wasTracked
*/
w: number;
/**
* newTracked
*/
n: number;
};
export declare const enum TrackOpTypes {

@@ -292,0 +336,0 @@ GET = "get",

@@ -17,3 +17,3 @@ /**

const EMPTY_OBJ = Object.freeze({})
Object.freeze({})
;

@@ -61,3 +61,118 @@ Object.freeze([]) ;

function warn(msg, ...args) {
console.warn(`[Vue warn] ${msg}`, ...args);
}
let activeEffectScope;
const effectScopeStack = [];
class EffectScope {
constructor(detached = false) {
this.active = true;
this.effects = [];
this.cleanups = [];
if (!detached) {
recordEffectScope(this);
}
}
run(fn) {
if (this.active) {
try {
this.on();
return fn();
}
finally {
this.off();
}
}
else {
warn(`cannot run an inactive effect scope.`);
}
}
on() {
if (this.active) {
effectScopeStack.push(this);
activeEffectScope = this;
}
}
off() {
if (this.active) {
effectScopeStack.pop();
activeEffectScope = effectScopeStack[effectScopeStack.length - 1];
}
}
stop() {
if (this.active) {
this.effects.forEach(e => e.stop());
this.cleanups.forEach(cleanup => cleanup());
this.active = false;
}
}
}
function effectScope(detached) {
return new EffectScope(detached);
}
function recordEffectScope(effect, scope) {
scope = scope || activeEffectScope;
if (scope && scope.active) {
scope.effects.push(effect);
}
}
function getCurrentScope() {
return activeEffectScope;
}
function onScopeDispose(fn) {
if (activeEffectScope) {
activeEffectScope.cleanups.push(fn);
}
else {
warn(`onDispose() is called when there is no active effect scope ` +
` to be associated with.`);
}
}
const createDep = (effects) => {
const dep = new Set(effects);
dep.w = 0;
dep.n = 0;
return dep;
};
const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
const newTracked = (dep) => (dep.n & trackOpBit) > 0;
const initDepMarkers = ({ deps }) => {
if (deps.length) {
for (let i = 0; i < deps.length; i++) {
deps[i].w |= trackOpBit; // set was tracked
}
}
};
const finalizeDepMarkers = (effect) => {
const { deps } = effect;
if (deps.length) {
let ptr = 0;
for (let i = 0; i < deps.length; i++) {
const dep = deps[i];
if (wasTracked(dep) && !newTracked(dep)) {
dep.delete(effect);
}
else {
deps[ptr++] = dep;
}
// clear bits
dep.w &= ~trackOpBit;
dep.n &= ~trackOpBit;
}
deps.length = ptr;
}
};
const targetMap = new WeakMap();
// The number of effects currently being tracked recursively.
let effectTrackDepth = 0;
let trackOpBit = 1;
/**
* The bitwise track markers support at most 30 levels op recursion.
* This value is chosen to enable modern JS engines to use a SMI on all platforms.
* When recursion depth is greater, fall back to using a full cleanup.
*/
const maxMarkerBits = 30;
const effectStack = [];

@@ -67,55 +182,50 @@ let activeEffect;

const MAP_KEY_ITERATE_KEY = Symbol('Map key iterate' );
function isEffect(fn) {
return fn && fn._isEffect === true;
}
function effect(fn, options = EMPTY_OBJ) {
if (isEffect(fn)) {
fn = fn.raw;
class ReactiveEffect {
constructor(fn, scheduler = null, scope) {
this.fn = fn;
this.scheduler = scheduler;
this.active = true;
this.deps = [];
recordEffectScope(this, scope);
}
const effect = createReactiveEffect(fn, options);
if (!options.lazy) {
effect();
}
return effect;
}
function stop(effect) {
if (effect.active) {
cleanup(effect);
if (effect.options.onStop) {
effect.options.onStop();
run() {
if (!this.active) {
return this.fn();
}
effect.active = false;
}
}
let uid = 0;
function createReactiveEffect(fn, options) {
const effect = function reactiveEffect() {
if (!effect.active) {
return fn();
}
if (!effectStack.includes(effect)) {
cleanup(effect);
if (!effectStack.includes(this)) {
try {
effectStack.push((activeEffect = this));
enableTracking();
effectStack.push(effect);
activeEffect = effect;
return fn();
trackOpBit = 1 << ++effectTrackDepth;
if (effectTrackDepth <= maxMarkerBits) {
initDepMarkers(this);
}
else {
cleanupEffect(this);
}
return this.fn();
}
finally {
if (effectTrackDepth <= maxMarkerBits) {
finalizeDepMarkers(this);
}
trackOpBit = 1 << --effectTrackDepth;
resetTracking();
effectStack.pop();
resetTracking();
activeEffect = effectStack[effectStack.length - 1];
const n = effectStack.length;
activeEffect = n > 0 ? effectStack[n - 1] : undefined;
}
}
};
effect.id = uid++;
effect.allowRecurse = !!options.allowRecurse;
effect._isEffect = true;
effect.active = true;
effect.raw = fn;
effect.deps = [];
effect.options = options;
return effect;
}
stop() {
if (this.active) {
cleanupEffect(this);
if (this.onStop) {
this.onStop();
}
this.active = false;
}
}
}
function cleanup(effect) {
function cleanupEffect(effect) {
const { deps } = effect;

@@ -129,2 +239,22 @@ if (deps.length) {

}
function effect(fn, options) {
if (fn.effect) {
fn = fn.effect.fn;
}
const _effect = new ReactiveEffect(fn);
if (options) {
extend(_effect, options);
if (options.scope)
recordEffectScope(_effect, options.scope);
}
if (!options || !options.lazy) {
_effect.run();
}
const runner = _effect.run.bind(_effect);
runner.effect = _effect;
return runner;
}
function stop(runner) {
runner.effect.stop();
}
let shouldTrack = true;

@@ -145,3 +275,3 @@ const trackStack = [];

function track(target, type, key) {
if (!shouldTrack || activeEffect === undefined) {
if (!isTracking()) {
return;

@@ -155,14 +285,30 @@ }

if (!dep) {
depsMap.set(key, (dep = new Set()));
depsMap.set(key, (dep = createDep()));
}
if (!dep.has(activeEffect)) {
const eventInfo = { effect: activeEffect, target, type, key }
;
trackEffects(dep, eventInfo);
}
function isTracking() {
return shouldTrack && activeEffect !== undefined;
}
function trackEffects(dep, debuggerEventExtraInfo) {
let shouldTrack = false;
if (effectTrackDepth <= maxMarkerBits) {
if (!newTracked(dep)) {
dep.n |= trackOpBit; // set newly tracked
shouldTrack = !wasTracked(dep);
}
}
else {
// Full cleanup mode.
shouldTrack = !dep.has(activeEffect);
}
if (shouldTrack) {
dep.add(activeEffect);
activeEffect.deps.push(dep);
if (activeEffect.options.onTrack) {
activeEffect.options.onTrack({
effect: activeEffect,
target,
type,
key
});
if (activeEffect.onTrack) {
activeEffect.onTrack(Object.assign({
effect: activeEffect
}, debuggerEventExtraInfo));
}

@@ -177,16 +323,7 @@ }

}
const effects = new Set();
const add = (effectsToAdd) => {
if (effectsToAdd) {
effectsToAdd.forEach(effect => {
if (effect !== activeEffect || effect.allowRecurse) {
effects.add(effect);
}
});
}
};
let deps = [];
if (type === "clear" /* CLEAR */) {
// collection being cleared
// trigger all effects for target
depsMap.forEach(add);
deps = [...depsMap.values()];
}

@@ -196,3 +333,3 @@ else if (key === 'length' && isArray(target)) {

if (key === 'length' || key >= newValue) {
add(dep);
deps.push(dep);
}

@@ -204,3 +341,3 @@ });

if (key !== void 0) {
add(depsMap.get(key));
deps.push(depsMap.get(key));
}

@@ -211,5 +348,5 @@ // also run for iteration key on ADD | DELETE | Map.SET

if (!isArray(target)) {
add(depsMap.get(ITERATE_KEY));
deps.push(depsMap.get(ITERATE_KEY));
if (isMap(target)) {
add(depsMap.get(MAP_KEY_ITERATE_KEY));
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
}

@@ -219,3 +356,3 @@ }

// new index added to array -> length changes
add(depsMap.get('length'));
deps.push(depsMap.get('length'));
}

@@ -225,5 +362,5 @@ break;

if (!isArray(target)) {
add(depsMap.get(ITERATE_KEY));
deps.push(depsMap.get(ITERATE_KEY));
if (isMap(target)) {
add(depsMap.get(MAP_KEY_ITERATE_KEY));
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
}

@@ -234,3 +371,3 @@ }

if (isMap(target)) {
add(depsMap.get(ITERATE_KEY));
deps.push(depsMap.get(ITERATE_KEY));
}

@@ -240,23 +377,39 @@ break;

}
const run = (effect) => {
if (effect.options.onTrigger) {
effect.options.onTrigger({
effect,
target,
key,
type,
newValue,
oldValue,
oldTarget
});
const eventInfo = { target, type, key, newValue, oldValue, oldTarget }
;
if (deps.length === 1) {
if (deps[0]) {
{
triggerEffects(deps[0], eventInfo);
}
}
if (effect.options.scheduler) {
effect.options.scheduler(effect);
}
else {
const effects = [];
for (const dep of deps) {
if (dep) {
effects.push(...dep);
}
}
else {
effect();
{
triggerEffects(createDep(effects), eventInfo);
}
};
effects.forEach(run);
}
}
function triggerEffects(dep, debuggerEventExtraInfo) {
// spread into array for stabilization
for (const effect of isArray(dep) ? dep : [...dep]) {
if (effect !== activeEffect || effect.allowRecurse) {
if (effect.onTrigger) {
effect.onTrigger(extend({ effect }, debuggerEventExtraInfo));
}
if (effect.scheduler) {
effect.scheduler();
}
else {
effect.run();
}
}
}
}

@@ -813,3 +966,4 @@ const isNonTrackableKeys = /*#__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`);

function toRaw(observed) {
return ((observed && toRaw(observed["__v_raw" /* RAW */])) || observed);
const raw = observed && observed["__v_raw" /* RAW */];
return raw ? toRaw(raw) : observed;
}

@@ -821,2 +975,30 @@ function markRaw(value) {

function trackRefValue(ref) {
if (isTracking()) {
ref = toRaw(ref);
if (!ref.dep) {
ref.dep = createDep();
}
{
trackEffects(ref.dep, {
target: ref,
type: "get" /* GET */,
key: 'value'
});
}
}
}
function triggerRefValue(ref, newVal) {
ref = toRaw(ref);
if (ref.dep) {
{
triggerEffects(ref.dep, {
target: ref,
type: "set" /* SET */,
key: 'value',
newValue: newVal
});
}
}
}
const convert = (val) => isObject(val) ? reactive(val) : val;

@@ -835,2 +1017,3 @@ function isRef(r) {

this._shallow = _shallow;
this.dep = undefined;
this.__v_isRef = true;

@@ -841,3 +1024,3 @@ this._rawValue = _shallow ? value : toRaw(value);

get value() {
track(toRaw(this), "get" /* GET */, 'value');
trackRefValue(this);
return this._value;

@@ -850,3 +1033,3 @@ }

this._value = this._shallow ? newVal : convert(newVal);
trigger(toRaw(this), "set" /* SET */, 'value', newVal);
triggerRefValue(this, newVal);
}

@@ -862,3 +1045,3 @@ }

function triggerRef(ref) {
trigger(toRaw(ref), "set" /* SET */, 'value', ref.value );
triggerRefValue(ref, ref.value );
}

@@ -888,4 +1071,5 @@ function unref(ref) {

constructor(factory) {
this.dep = undefined;
this.__v_isRef = true;
const { get, set } = factory(() => track(this, "get" /* GET */, 'value'), () => trigger(this, "set" /* SET */, 'value'));
const { get, set } = factory(() => trackRefValue(this), () => triggerRefValue(this));
this._get = get;

@@ -933,27 +1117,64 @@ this._set = set;

let scheduler;
/**
* Set a scheduler for deferring computed computations
*/
const setComputedScheduler = (s) => {
scheduler = s;
};
class ComputedRefImpl {
constructor(getter, _setter, isReadonly) {
this._setter = _setter;
this.dep = undefined;
this._dirty = true;
this.__v_isRef = true;
this.effect = effect(getter, {
lazy: true,
scheduler: () => {
if (!this._dirty) {
this._dirty = true;
trigger(toRaw(this), "set" /* SET */, 'value');
let compareTarget;
let hasCompareTarget = false;
let scheduled = false;
this.effect = new ReactiveEffect(getter, (computedTrigger) => {
if (scheduler && this.dep) {
if (computedTrigger) {
compareTarget = this._value;
hasCompareTarget = true;
}
else if (!scheduled) {
const valueToCompare = hasCompareTarget ? compareTarget : this._value;
scheduled = true;
hasCompareTarget = false;
scheduler(() => {
if (this._get() !== valueToCompare) {
triggerRefValue(this);
}
scheduled = false;
});
}
// chained upstream computeds are notified synchronously to ensure
// value invalidation in case of sync access; normal effects are
// deferred to be triggered in scheduler.
for (const e of this.dep) {
if (e.computed) {
e.scheduler(true /* computedTrigger */);
}
}
}
if (!this._dirty) {
this._dirty = true;
if (!scheduler)
triggerRefValue(this);
}
});
this.effect.computed = true;
this["__v_isReadonly" /* IS_READONLY */] = isReadonly;
}
_get() {
if (this._dirty) {
this._dirty = false;
return (this._value = this.effect.run());
}
return this._value;
}
get value() {
trackRefValue(this);
// the computed ref may get wrapped by other proxies e.g. readonly() #3376
const self = toRaw(this);
if (self._dirty) {
self._value = this.effect();
self._dirty = false;
}
track(self, "get" /* GET */, 'value');
return self._value;
return toRaw(this)._get();
}

@@ -964,3 +1185,3 @@ set value(newValue) {

}
function computed(getterOrOptions) {
function computed(getterOrOptions, debugOptions) {
let getter;

@@ -979,5 +1200,10 @@ let setter;

}
return new ComputedRefImpl(getter, setter, isFunction(getterOrOptions) || !getterOrOptions.set);
const cRef = new ComputedRefImpl(getter, setter, isFunction(getterOrOptions) || !getterOrOptions.set);
if (debugOptions) {
cRef.effect.onTrack = debugOptions.onTrack;
cRef.effect.onTrigger = debugOptions.onTrigger;
}
return cRef;
}
export { ITERATE_KEY, computed, customRef, effect, enableTracking, isProxy, isReactive, isReadonly, isRef, markRaw, pauseTracking, proxyRefs, reactive, readonly, ref, resetTracking, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, track, trigger, triggerRef, unref };
export { EffectScope, ITERATE_KEY, ReactiveEffect, computed, customRef, effect, effectScope, enableTracking, getCurrentScope, isProxy, isReactive, isReadonly, isRef, markRaw, onScopeDispose, pauseTracking, proxyRefs, reactive, readonly, ref, resetTracking, setComputedScheduler, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, track, trigger, triggerRef, unref };

@@ -1,1 +0,1 @@

function t(t,e){const n=Object.create(null),r=t.split(",");for(let s=0;s<r.length;s++)n[r[s]]=!0;return e?t=>!!n[t.toLowerCase()]:t=>!!n[t]}const e={},n=()=>{},r=Object.assign,s=Object.prototype.hasOwnProperty,i=(t,e)=>s.call(t,e),o=Array.isArray,c=t=>"[object Map]"===h(t),u=t=>"function"==typeof t,a=t=>"symbol"==typeof t,l=t=>null!==t&&"object"==typeof t,f=Object.prototype.toString,h=t=>f.call(t),_=t=>"string"==typeof t&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,d=(t,e)=>t!==e&&(t==t||e==e),v=new WeakMap,g=[];let p;const y=Symbol(""),w=Symbol("");function R(t,n=e){(function(t){return t&&!0===t._isEffect})(t)&&(t=t.raw);const r=function(t,e){const n=function(){if(!n.active)return t();if(!g.includes(n)){E(n);try{return O(),g.push(n),p=n,t()}finally{g.pop(),M(),p=g[g.length-1]}}};return n.id=k++,n.allowRecurse=!!e.allowRecurse,n._isEffect=!0,n.active=!0,n.raw=t,n.deps=[],n.options=e,n}(t,n);return n.lazy||r(),r}function b(t){t.active&&(E(t),t.options.onStop&&t.options.onStop(),t.active=!1)}let k=0;function E(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}let S=!0;const j=[];function m(){j.push(S),S=!1}function O(){j.push(S),S=!0}function M(){const t=j.pop();S=void 0===t||t}function P(t,e,n){if(!S||void 0===p)return;let r=v.get(t);r||v.set(t,r=new Map);let s=r.get(n);s||r.set(n,s=new Set),s.has(p)||(s.add(p),p.deps.push(s))}function x(t,e,n,r,s,i){const u=v.get(t);if(!u)return;const a=new Set,l=t=>{t&&t.forEach((t=>{(t!==p||t.allowRecurse)&&a.add(t)}))};if("clear"===e)u.forEach(l);else if("length"===n&&o(t))u.forEach(((t,e)=>{("length"===e||e>=r)&&l(t)}));else switch(void 0!==n&&l(u.get(n)),e){case"add":o(t)?_(n)&&l(u.get("length")):(l(u.get(y)),c(t)&&l(u.get(w)));break;case"delete":o(t)||(l(u.get(y)),c(t)&&l(u.get(w)));break;case"set":c(t)&&l(u.get(y))}a.forEach((t=>{t.options.scheduler?t.options.scheduler(t):t()}))}const z=t("__proto__,__v_isRef,__isVue"),W=new Set(Object.getOwnPropertyNames(Symbol).map((t=>Symbol[t])).filter(a)),A=C(),N=C(!1,!0),V=C(!0),I=C(!0,!0),K=B();function B(){const t={};return["includes","indexOf","lastIndexOf"].forEach((e=>{t[e]=function(...t){const n=Mt(this);for(let e=0,s=this.length;e<s;e++)P(n,0,e+"");const r=n[e](...t);return-1===r||!1===r?n[e](...t.map(Mt)):r}})),["push","pop","shift","unshift","splice"].forEach((e=>{t[e]=function(...t){m();const n=Mt(this)[e].apply(this,t);return M(),n}})),t}function C(t=!1,e=!1){return function(n,r,s){if("__v_isReactive"===r)return!t;if("__v_isReadonly"===r)return t;if("__v_raw"===r&&s===(t?e?yt:pt:e?gt:vt).get(n))return n;const c=o(n);if(!t&&c&&i(K,r))return Reflect.get(K,r,s);const u=Reflect.get(n,r,s);if(a(r)?W.has(r):z(r))return u;if(t||P(n,0,r),e)return u;if(zt(u)){return!c||!_(r)?u.value:u}return l(u)?t?kt(u):Rt(u):u}}function L(t=!1){return function(e,n,r,s){let c=e[n];if(!t&&(r=Mt(r),c=Mt(c),!o(e)&&zt(c)&&!zt(r)))return c.value=r,!0;const u=o(e)&&_(n)?Number(n)<e.length:i(e,n),a=Reflect.set(e,n,r,s);return e===Mt(s)&&(u?d(r,c)&&x(e,"set",n,r):x(e,"add",n,r)),a}}const q={get:A,set:L(),deleteProperty:function(t,e){const n=i(t,e),r=Reflect.deleteProperty(t,e);return r&&n&&x(t,"delete",e,void 0),r},has:function(t,e){const n=Reflect.has(t,e);return a(e)&&W.has(e)||P(t,0,e),n},ownKeys:function(t){return P(t,0,o(t)?"length":y),Reflect.ownKeys(t)}},D={get:V,set:(t,e)=>!0,deleteProperty:(t,e)=>!0},F=r({},q,{get:N,set:L(!0)}),G=r({},D,{get:I}),H=t=>l(t)?Rt(t):t,J=t=>l(t)?kt(t):t,Q=t=>t,T=t=>Reflect.getPrototypeOf(t);function U(t,e,n=!1,r=!1){const s=Mt(t=t.__v_raw),i=Mt(e);e!==i&&!n&&P(s,0,e),!n&&P(s,0,i);const{has:o}=T(s),c=r?Q:n?J:H;return o.call(s,e)?c(t.get(e)):o.call(s,i)?c(t.get(i)):void(t!==s&&t.get(e))}function X(t,e=!1){const n=this.__v_raw,r=Mt(n),s=Mt(t);return t!==s&&!e&&P(r,0,t),!e&&P(r,0,s),t===s?n.has(t):n.has(t)||n.has(s)}function Y(t,e=!1){return t=t.__v_raw,!e&&P(Mt(t),0,y),Reflect.get(t,"size",t)}function Z(t){t=Mt(t);const e=Mt(this);return T(e).has.call(e,t)||(e.add(t),x(e,"add",t,t)),this}function $(t,e){e=Mt(e);const n=Mt(this),{has:r,get:s}=T(n);let i=r.call(n,t);i||(t=Mt(t),i=r.call(n,t));const o=s.call(n,t);return n.set(t,e),i?d(e,o)&&x(n,"set",t,e):x(n,"add",t,e),this}function tt(t){const e=Mt(this),{has:n,get:r}=T(e);let s=n.call(e,t);s||(t=Mt(t),s=n.call(e,t)),r&&r.call(e,t);const i=e.delete(t);return s&&x(e,"delete",t,void 0),i}function et(){const t=Mt(this),e=0!==t.size,n=t.clear();return e&&x(t,"clear",void 0,void 0),n}function nt(t,e){return function(n,r){const s=this,i=s.__v_raw,o=Mt(i),c=e?Q:t?J:H;return!t&&P(o,0,y),i.forEach(((t,e)=>n.call(r,c(t),c(e),s)))}}function rt(t,e,n){return function(...r){const s=this.__v_raw,i=Mt(s),o=c(i),u="entries"===t||t===Symbol.iterator&&o,a="keys"===t&&o,l=s[t](...r),f=n?Q:e?J:H;return!e&&P(i,0,a?w:y),{next(){const{value:t,done:e}=l.next();return e?{value:t,done:e}:{value:u?[f(t[0]),f(t[1])]:f(t),done:e}},[Symbol.iterator](){return this}}}}function st(t){return function(...e){return"delete"!==t&&this}}function it(){const t={get(t){return U(this,t)},get size(){return Y(this)},has:X,add:Z,set:$,delete:tt,clear:et,forEach:nt(!1,!1)},e={get(t){return U(this,t,!1,!0)},get size(){return Y(this)},has:X,add:Z,set:$,delete:tt,clear:et,forEach:nt(!1,!0)},n={get(t){return U(this,t,!0)},get size(){return Y(this,!0)},has(t){return X.call(this,t,!0)},add:st("add"),set:st("set"),delete:st("delete"),clear:st("clear"),forEach:nt(!0,!1)},r={get(t){return U(this,t,!0,!0)},get size(){return Y(this,!0)},has(t){return X.call(this,t,!0)},add:st("add"),set:st("set"),delete:st("delete"),clear:st("clear"),forEach:nt(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((s=>{t[s]=rt(s,!1,!1),n[s]=rt(s,!0,!1),e[s]=rt(s,!1,!0),r[s]=rt(s,!0,!0)})),[t,n,e,r]}const[ot,ct,ut,at]=it();function lt(t,e){const n=e?t?at:ut:t?ct:ot;return(e,r,s)=>"__v_isReactive"===r?!t:"__v_isReadonly"===r?t:"__v_raw"===r?e:Reflect.get(i(n,r)&&r in e?n:e,r,s)}const ft={get:lt(!1,!1)},ht={get:lt(!1,!0)},_t={get:lt(!0,!1)},dt={get:lt(!0,!0)},vt=new WeakMap,gt=new WeakMap,pt=new WeakMap,yt=new WeakMap;function wt(t){return t.__v_skip||!Object.isExtensible(t)?0:function(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}((t=>h(t).slice(8,-1))(t))}function Rt(t){return t&&t.__v_isReadonly?t:St(t,!1,q,ft,vt)}function bt(t){return St(t,!1,F,ht,gt)}function kt(t){return St(t,!0,D,_t,pt)}function Et(t){return St(t,!0,G,dt,yt)}function St(t,e,n,r,s){if(!l(t))return t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const i=s.get(t);if(i)return i;const o=wt(t);if(0===o)return t;const c=new Proxy(t,2===o?r:n);return s.set(t,c),c}function jt(t){return mt(t)?jt(t.__v_raw):!(!t||!t.__v_isReactive)}function mt(t){return!(!t||!t.__v_isReadonly)}function Ot(t){return jt(t)||mt(t)}function Mt(t){return t&&Mt(t.__v_raw)||t}function Pt(t){return((t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})})(t,"__v_skip",!0),t}const xt=t=>l(t)?Rt(t):t;function zt(t){return Boolean(t&&!0===t.__v_isRef)}function Wt(t){return Vt(t)}function At(t){return Vt(t,!0)}class Nt{constructor(t,e=!1){this._shallow=e,this.__v_isRef=!0,this._rawValue=e?t:Mt(t),this._value=e?t:xt(t)}get value(){return P(Mt(this),0,"value"),this._value}set value(t){t=this._shallow?t:Mt(t),d(t,this._rawValue)&&(this._rawValue=t,this._value=this._shallow?t:xt(t),x(Mt(this),"set","value",t))}}function Vt(t,e=!1){return zt(t)?t:new Nt(t,e)}function It(t){x(Mt(t),"set","value",void 0)}function Kt(t){return zt(t)?t.value:t}const Bt={get:(t,e,n)=>Kt(Reflect.get(t,e,n)),set:(t,e,n,r)=>{const s=t[e];return zt(s)&&!zt(n)?(s.value=n,!0):Reflect.set(t,e,n,r)}};function Ct(t){return jt(t)?t:new Proxy(t,Bt)}class Lt{constructor(t){this.__v_isRef=!0;const{get:e,set:n}=t((()=>P(this,0,"value")),(()=>x(this,"set","value")));this._get=e,this._set=n}get value(){return this._get()}set value(t){this._set(t)}}function qt(t){return new Lt(t)}function Dt(t){const e=o(t)?new Array(t.length):{};for(const n in t)e[n]=Gt(t,n);return e}class Ft{constructor(t,e){this._object=t,this._key=e,this.__v_isRef=!0}get value(){return this._object[this._key]}set value(t){this._object[this._key]=t}}function Gt(t,e){return zt(t[e])?t[e]:new Ft(t,e)}class Ht{constructor(t,e,n){this._setter=e,this._dirty=!0,this.__v_isRef=!0,this.effect=R(t,{lazy:!0,scheduler:()=>{this._dirty||(this._dirty=!0,x(Mt(this),"set","value"))}}),this.__v_isReadonly=n}get value(){const t=Mt(this);return t._dirty&&(t._value=this.effect(),t._dirty=!1),P(t,0,"value"),t._value}set value(t){this._setter(t)}}function Jt(t){let e,r;return u(t)?(e=t,r=n):(e=t.get,r=t.set),new Ht(e,r,u(t)||!t.set)}export{y as ITERATE_KEY,Jt as computed,qt as customRef,R as effect,O as enableTracking,Ot as isProxy,jt as isReactive,mt as isReadonly,zt as isRef,Pt as markRaw,m as pauseTracking,Ct as proxyRefs,Rt as reactive,kt as readonly,Wt as ref,M as resetTracking,bt as shallowReactive,Et as shallowReadonly,At as shallowRef,b as stop,Mt as toRaw,Gt as toRef,Dt as toRefs,P as track,x as trigger,It as triggerRef,Kt as unref};
function t(t,e){const n=Object.create(null),s=t.split(",");for(let r=0;r<s.length;r++)n[s[r]]=!0;return e?t=>!!n[t.toLowerCase()]:t=>!!n[t]}const e=()=>{},n=Object.assign,s=Object.prototype.hasOwnProperty,r=(t,e)=>s.call(t,e),i=Array.isArray,c=t=>"[object Map]"===h(t),o=t=>"function"==typeof t,u=t=>"symbol"==typeof t,l=t=>null!==t&&"object"==typeof t,a=Object.prototype.toString,h=t=>a.call(t),f=t=>"string"==typeof t&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,_=(t,e)=>t!==e&&(t==t||e==e);let d;const p=[];class v{constructor(t=!1){this.active=!0,this.effects=[],this.cleanups=[],t||y(this)}run(t){if(this.active)try{return this.on(),t()}finally{this.off()}}on(){this.active&&(p.push(this),d=this)}off(){this.active&&(p.pop(),d=p[p.length-1])}stop(){this.active&&(this.effects.forEach((t=>t.stop())),this.cleanups.forEach((t=>t())),this.active=!1)}}function g(t){return new v(t)}function y(t,e){(e=e||d)&&e.active&&e.effects.push(t)}function w(){return d}function b(t){d&&d.cleanups.push(t)}const R=t=>{const e=new Set(t);return e.w=0,e.n=0,e},k=t=>(t.w&O)>0,m=t=>(t.n&O)>0,S=new WeakMap;let j=0,O=1;const E=[];let M;const P=Symbol(""),x=Symbol("");class z{constructor(t,e=null,n){this.fn=t,this.scheduler=e,this.active=!0,this.deps=[],y(this,n)}run(){if(!this.active)return this.fn();if(!E.includes(this))try{return E.push(M=this),B(),O=1<<++j,j<=30?(({deps:t})=>{if(t.length)for(let e=0;e<t.length;e++)t[e].w|=O})(this):W(this),this.fn()}finally{j<=30&&(t=>{const{deps:e}=t;if(e.length){let n=0;for(let s=0;s<e.length;s++){const r=e[s];k(r)&&!m(r)?r.delete(t):e[n++]=r,r.w&=~O,r.n&=~O}e.length=n}})(this),O=1<<--j,C(),E.pop();const t=E.length;M=t>0?E[t-1]:void 0}}stop(){this.active&&(W(this),this.onStop&&this.onStop(),this.active=!1)}}function W(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}function A(t,e){t.effect&&(t=t.effect.fn);const s=new z(t);e&&(n(s,e),e.scope&&y(s,e.scope)),e&&e.lazy||s.run();const r=s.run.bind(s);return r.effect=s,r}function N(t){t.effect.stop()}let V=!0;const I=[];function K(){I.push(V),V=!1}function B(){I.push(V),V=!0}function C(){const t=I.pop();V=void 0===t||t}function L(t,e,n){if(!q())return;let s=S.get(t);s||S.set(t,s=new Map);let r=s.get(n);r||s.set(n,r=R()),D(r)}function q(){return V&&void 0!==M}function D(t,e){let n=!1;j<=30?m(t)||(t.n|=O,n=!k(t)):n=!t.has(M),n&&(t.add(M),M.deps.push(t))}function F(t,e,n,s,r,o){const u=S.get(t);if(!u)return;let l=[];if("clear"===e)l=[...u.values()];else if("length"===n&&i(t))u.forEach(((t,e)=>{("length"===e||e>=s)&&l.push(t)}));else switch(void 0!==n&&l.push(u.get(n)),e){case"add":i(t)?f(n)&&l.push(u.get("length")):(l.push(u.get(P)),c(t)&&l.push(u.get(x)));break;case"delete":i(t)||(l.push(u.get(P)),c(t)&&l.push(u.get(x)));break;case"set":c(t)&&l.push(u.get(P))}if(1===l.length)l[0]&&G(l[0]);else{const t=[];for(const e of l)e&&t.push(...e);G(R(t))}}function G(t,e){for(const n of i(t)?t:[...t])(n!==M||n.allowRecurse)&&(n.scheduler?n.scheduler():n.run())}const H=t("__proto__,__v_isRef,__isVue"),J=new Set(Object.getOwnPropertyNames(Symbol).map((t=>Symbol[t])).filter(u)),Q=$(),T=$(!1,!0),U=$(!0),X=$(!0,!0),Y=Z();function Z(){const t={};return["includes","indexOf","lastIndexOf"].forEach((e=>{t[e]=function(...t){const n=Dt(this);for(let e=0,r=this.length;e<r;e++)L(n,0,e+"");const s=n[e](...t);return-1===s||!1===s?n[e](...t.map(Dt)):s}})),["push","pop","shift","unshift","splice"].forEach((e=>{t[e]=function(...t){K();const n=Dt(this)[e].apply(this,t);return C(),n}})),t}function $(t=!1,e=!1){return function(n,s,c){if("__v_isReactive"===s)return!t;if("__v_isReadonly"===s)return t;if("__v_raw"===s&&c===(t?e?Wt:zt:e?xt:Pt).get(n))return n;const o=i(n);if(!t&&o&&r(Y,s))return Reflect.get(Y,s,c);const a=Reflect.get(n,s,c);if(u(s)?J.has(s):H(s))return a;if(t||L(n,0,s),e)return a;if(Qt(a)){return!o||!f(s)?a.value:a}return l(a)?t?It(a):Nt(a):a}}function tt(t=!1){return function(e,n,s,c){let o=e[n];if(!t&&(s=Dt(s),o=Dt(o),!i(e)&&Qt(o)&&!Qt(s)))return o.value=s,!0;const u=i(e)&&f(n)?Number(n)<e.length:r(e,n),l=Reflect.set(e,n,s,c);return e===Dt(c)&&(u?_(s,o)&&F(e,"set",n,s):F(e,"add",n,s)),l}}const et={get:Q,set:tt(),deleteProperty:function(t,e){const n=r(t,e),s=Reflect.deleteProperty(t,e);return s&&n&&F(t,"delete",e,void 0),s},has:function(t,e){const n=Reflect.has(t,e);return u(e)&&J.has(e)||L(t,0,e),n},ownKeys:function(t){return L(t,0,i(t)?"length":P),Reflect.ownKeys(t)}},nt={get:U,set:(t,e)=>!0,deleteProperty:(t,e)=>!0},st=n({},et,{get:T,set:tt(!0)}),rt=n({},nt,{get:X}),it=t=>l(t)?Nt(t):t,ct=t=>l(t)?It(t):t,ot=t=>t,ut=t=>Reflect.getPrototypeOf(t);function lt(t,e,n=!1,s=!1){const r=Dt(t=t.__v_raw),i=Dt(e);e!==i&&!n&&L(r,0,e),!n&&L(r,0,i);const{has:c}=ut(r),o=s?ot:n?ct:it;return c.call(r,e)?o(t.get(e)):c.call(r,i)?o(t.get(i)):void(t!==r&&t.get(e))}function at(t,e=!1){const n=this.__v_raw,s=Dt(n),r=Dt(t);return t!==r&&!e&&L(s,0,t),!e&&L(s,0,r),t===r?n.has(t):n.has(t)||n.has(r)}function ht(t,e=!1){return t=t.__v_raw,!e&&L(Dt(t),0,P),Reflect.get(t,"size",t)}function ft(t){t=Dt(t);const e=Dt(this);return ut(e).has.call(e,t)||(e.add(t),F(e,"add",t,t)),this}function _t(t,e){e=Dt(e);const n=Dt(this),{has:s,get:r}=ut(n);let i=s.call(n,t);i||(t=Dt(t),i=s.call(n,t));const c=r.call(n,t);return n.set(t,e),i?_(e,c)&&F(n,"set",t,e):F(n,"add",t,e),this}function dt(t){const e=Dt(this),{has:n,get:s}=ut(e);let r=n.call(e,t);r||(t=Dt(t),r=n.call(e,t)),s&&s.call(e,t);const i=e.delete(t);return r&&F(e,"delete",t,void 0),i}function pt(){const t=Dt(this),e=0!==t.size,n=t.clear();return e&&F(t,"clear",void 0,void 0),n}function vt(t,e){return function(n,s){const r=this,i=r.__v_raw,c=Dt(i),o=e?ot:t?ct:it;return!t&&L(c,0,P),i.forEach(((t,e)=>n.call(s,o(t),o(e),r)))}}function gt(t,e,n){return function(...s){const r=this.__v_raw,i=Dt(r),o=c(i),u="entries"===t||t===Symbol.iterator&&o,l="keys"===t&&o,a=r[t](...s),h=n?ot:e?ct:it;return!e&&L(i,0,l?x:P),{next(){const{value:t,done:e}=a.next();return e?{value:t,done:e}:{value:u?[h(t[0]),h(t[1])]:h(t),done:e}},[Symbol.iterator](){return this}}}}function yt(t){return function(...e){return"delete"!==t&&this}}function wt(){const t={get(t){return lt(this,t)},get size(){return ht(this)},has:at,add:ft,set:_t,delete:dt,clear:pt,forEach:vt(!1,!1)},e={get(t){return lt(this,t,!1,!0)},get size(){return ht(this)},has:at,add:ft,set:_t,delete:dt,clear:pt,forEach:vt(!1,!0)},n={get(t){return lt(this,t,!0)},get size(){return ht(this,!0)},has(t){return at.call(this,t,!0)},add:yt("add"),set:yt("set"),delete:yt("delete"),clear:yt("clear"),forEach:vt(!0,!1)},s={get(t){return lt(this,t,!0,!0)},get size(){return ht(this,!0)},has(t){return at.call(this,t,!0)},add:yt("add"),set:yt("set"),delete:yt("delete"),clear:yt("clear"),forEach:vt(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((r=>{t[r]=gt(r,!1,!1),n[r]=gt(r,!0,!1),e[r]=gt(r,!1,!0),s[r]=gt(r,!0,!0)})),[t,n,e,s]}const[bt,Rt,kt,mt]=wt();function St(t,e){const n=e?t?mt:kt:t?Rt:bt;return(e,s,i)=>"__v_isReactive"===s?!t:"__v_isReadonly"===s?t:"__v_raw"===s?e:Reflect.get(r(n,s)&&s in e?n:e,s,i)}const jt={get:St(!1,!1)},Ot={get:St(!1,!0)},Et={get:St(!0,!1)},Mt={get:St(!0,!0)},Pt=new WeakMap,xt=new WeakMap,zt=new WeakMap,Wt=new WeakMap;function At(t){return t.__v_skip||!Object.isExtensible(t)?0:function(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}((t=>h(t).slice(8,-1))(t))}function Nt(t){return t&&t.__v_isReadonly?t:Bt(t,!1,et,jt,Pt)}function Vt(t){return Bt(t,!1,st,Ot,xt)}function It(t){return Bt(t,!0,nt,Et,zt)}function Kt(t){return Bt(t,!0,rt,Mt,Wt)}function Bt(t,e,n,s,r){if(!l(t))return t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const i=r.get(t);if(i)return i;const c=At(t);if(0===c)return t;const o=new Proxy(t,2===c?s:n);return r.set(t,o),o}function Ct(t){return Lt(t)?Ct(t.__v_raw):!(!t||!t.__v_isReactive)}function Lt(t){return!(!t||!t.__v_isReadonly)}function qt(t){return Ct(t)||Lt(t)}function Dt(t){const e=t&&t.__v_raw;return e?Dt(e):t}function Ft(t){return((t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})})(t,"__v_skip",!0),t}function Gt(t){q()&&((t=Dt(t)).dep||(t.dep=R()),D(t.dep))}function Ht(t,e){(t=Dt(t)).dep&&G(t.dep)}const Jt=t=>l(t)?Nt(t):t;function Qt(t){return Boolean(t&&!0===t.__v_isRef)}function Tt(t){return Yt(t)}function Ut(t){return Yt(t,!0)}class Xt{constructor(t,e=!1){this._shallow=e,this.dep=void 0,this.__v_isRef=!0,this._rawValue=e?t:Dt(t),this._value=e?t:Jt(t)}get value(){return Gt(this),this._value}set value(t){t=this._shallow?t:Dt(t),_(t,this._rawValue)&&(this._rawValue=t,this._value=this._shallow?t:Jt(t),Ht(this))}}function Yt(t,e=!1){return Qt(t)?t:new Xt(t,e)}function Zt(t){Ht(t)}function $t(t){return Qt(t)?t.value:t}const te={get:(t,e,n)=>$t(Reflect.get(t,e,n)),set:(t,e,n,s)=>{const r=t[e];return Qt(r)&&!Qt(n)?(r.value=n,!0):Reflect.set(t,e,n,s)}};function ee(t){return Ct(t)?t:new Proxy(t,te)}class ne{constructor(t){this.dep=void 0,this.__v_isRef=!0;const{get:e,set:n}=t((()=>Gt(this)),(()=>Ht(this)));this._get=e,this._set=n}get value(){return this._get()}set value(t){this._set(t)}}function se(t){return new ne(t)}function re(t){const e=i(t)?new Array(t.length):{};for(const n in t)e[n]=ce(t,n);return e}class ie{constructor(t,e){this._object=t,this._key=e,this.__v_isRef=!0}get value(){return this._object[this._key]}set value(t){this._object[this._key]=t}}function ce(t,e){return Qt(t[e])?t[e]:new ie(t,e)}let oe;const ue=t=>{oe=t};class le{constructor(t,e,n){let s;this._setter=e,this.dep=void 0,this._dirty=!0,this.__v_isRef=!0;let r=!1,i=!1;this.effect=new z(t,(t=>{if(oe&&this.dep){if(t)s=this._value,r=!0;else if(!i){const t=r?s:this._value;i=!0,r=!1,oe((()=>{this._get()!==t&&Ht(this),i=!1}))}for(const t of this.dep)t.computed&&t.scheduler(!0)}this._dirty||(this._dirty=!0,oe||Ht(this))})),this.effect.computed=!0,this.__v_isReadonly=n}_get(){return this._dirty?(this._dirty=!1,this._value=this.effect.run()):this._value}get value(){return Gt(this),Dt(this)._get()}set value(t){this._setter(t)}}function ae(t,n){let s,r;o(t)?(s=t,r=e):(s=t.get,r=t.set);return new le(s,r,o(t)||!t.set)}export{v as EffectScope,P as ITERATE_KEY,z as ReactiveEffect,ae as computed,se as customRef,A as effect,g as effectScope,B as enableTracking,w as getCurrentScope,qt as isProxy,Ct as isReactive,Lt as isReadonly,Qt as isRef,Ft as markRaw,b as onScopeDispose,K as pauseTracking,ee as proxyRefs,Nt as reactive,It as readonly,Tt as ref,C as resetTracking,ue as setComputedScheduler,Vt as shallowReactive,Kt as shallowReadonly,Ut as shallowRef,N as stop,Dt as toRaw,ce as toRef,re as toRefs,L as track,F as trigger,Zt as triggerRef,$t as unref};

@@ -1,4 +0,119 @@

import { EMPTY_OBJ, isArray, isMap, isIntegerKey, isSymbol, extend, hasOwn, isObject, hasChanged, makeMap, capitalize, toRawType, def, isFunction, NOOP } from '@vue/shared';
import { extend, isArray, isMap, isIntegerKey, isSymbol, hasOwn, isObject, hasChanged, makeMap, capitalize, toRawType, def, isFunction, NOOP } from '@vue/shared';
function warn(msg, ...args) {
console.warn(`[Vue warn] ${msg}`, ...args);
}
let activeEffectScope;
const effectScopeStack = [];
class EffectScope {
constructor(detached = false) {
this.active = true;
this.effects = [];
this.cleanups = [];
if (!detached) {
recordEffectScope(this);
}
}
run(fn) {
if (this.active) {
try {
this.on();
return fn();
}
finally {
this.off();
}
}
else if ((process.env.NODE_ENV !== 'production')) {
warn(`cannot run an inactive effect scope.`);
}
}
on() {
if (this.active) {
effectScopeStack.push(this);
activeEffectScope = this;
}
}
off() {
if (this.active) {
effectScopeStack.pop();
activeEffectScope = effectScopeStack[effectScopeStack.length - 1];
}
}
stop() {
if (this.active) {
this.effects.forEach(e => e.stop());
this.cleanups.forEach(cleanup => cleanup());
this.active = false;
}
}
}
function effectScope(detached) {
return new EffectScope(detached);
}
function recordEffectScope(effect, scope) {
scope = scope || activeEffectScope;
if (scope && scope.active) {
scope.effects.push(effect);
}
}
function getCurrentScope() {
return activeEffectScope;
}
function onScopeDispose(fn) {
if (activeEffectScope) {
activeEffectScope.cleanups.push(fn);
}
else if ((process.env.NODE_ENV !== 'production')) {
warn(`onDispose() is called when there is no active effect scope ` +
` to be associated with.`);
}
}
const createDep = (effects) => {
const dep = new Set(effects);
dep.w = 0;
dep.n = 0;
return dep;
};
const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
const newTracked = (dep) => (dep.n & trackOpBit) > 0;
const initDepMarkers = ({ deps }) => {
if (deps.length) {
for (let i = 0; i < deps.length; i++) {
deps[i].w |= trackOpBit; // set was tracked
}
}
};
const finalizeDepMarkers = (effect) => {
const { deps } = effect;
if (deps.length) {
let ptr = 0;
for (let i = 0; i < deps.length; i++) {
const dep = deps[i];
if (wasTracked(dep) && !newTracked(dep)) {
dep.delete(effect);
}
else {
deps[ptr++] = dep;
}
// clear bits
dep.w &= ~trackOpBit;
dep.n &= ~trackOpBit;
}
deps.length = ptr;
}
};
const targetMap = new WeakMap();
// The number of effects currently being tracked recursively.
let effectTrackDepth = 0;
let trackOpBit = 1;
/**
* The bitwise track markers support at most 30 levels op recursion.
* This value is chosen to enable modern JS engines to use a SMI on all platforms.
* When recursion depth is greater, fall back to using a full cleanup.
*/
const maxMarkerBits = 30;
const effectStack = [];

@@ -8,55 +123,50 @@ let activeEffect;

const MAP_KEY_ITERATE_KEY = Symbol((process.env.NODE_ENV !== 'production') ? 'Map key iterate' : '');
function isEffect(fn) {
return fn && fn._isEffect === true;
}
function effect(fn, options = EMPTY_OBJ) {
if (isEffect(fn)) {
fn = fn.raw;
class ReactiveEffect {
constructor(fn, scheduler = null, scope) {
this.fn = fn;
this.scheduler = scheduler;
this.active = true;
this.deps = [];
recordEffectScope(this, scope);
}
const effect = createReactiveEffect(fn, options);
if (!options.lazy) {
effect();
}
return effect;
}
function stop(effect) {
if (effect.active) {
cleanup(effect);
if (effect.options.onStop) {
effect.options.onStop();
run() {
if (!this.active) {
return this.fn();
}
effect.active = false;
}
}
let uid = 0;
function createReactiveEffect(fn, options) {
const effect = function reactiveEffect() {
if (!effect.active) {
return fn();
}
if (!effectStack.includes(effect)) {
cleanup(effect);
if (!effectStack.includes(this)) {
try {
effectStack.push((activeEffect = this));
enableTracking();
effectStack.push(effect);
activeEffect = effect;
return fn();
trackOpBit = 1 << ++effectTrackDepth;
if (effectTrackDepth <= maxMarkerBits) {
initDepMarkers(this);
}
else {
cleanupEffect(this);
}
return this.fn();
}
finally {
if (effectTrackDepth <= maxMarkerBits) {
finalizeDepMarkers(this);
}
trackOpBit = 1 << --effectTrackDepth;
resetTracking();
effectStack.pop();
resetTracking();
activeEffect = effectStack[effectStack.length - 1];
const n = effectStack.length;
activeEffect = n > 0 ? effectStack[n - 1] : undefined;
}
}
};
effect.id = uid++;
effect.allowRecurse = !!options.allowRecurse;
effect._isEffect = true;
effect.active = true;
effect.raw = fn;
effect.deps = [];
effect.options = options;
return effect;
}
stop() {
if (this.active) {
cleanupEffect(this);
if (this.onStop) {
this.onStop();
}
this.active = false;
}
}
}
function cleanup(effect) {
function cleanupEffect(effect) {
const { deps } = effect;

@@ -70,2 +180,22 @@ if (deps.length) {

}
function effect(fn, options) {
if (fn.effect) {
fn = fn.effect.fn;
}
const _effect = new ReactiveEffect(fn);
if (options) {
extend(_effect, options);
if (options.scope)
recordEffectScope(_effect, options.scope);
}
if (!options || !options.lazy) {
_effect.run();
}
const runner = _effect.run.bind(_effect);
runner.effect = _effect;
return runner;
}
function stop(runner) {
runner.effect.stop();
}
let shouldTrack = true;

@@ -86,3 +216,3 @@ const trackStack = [];

function track(target, type, key) {
if (!shouldTrack || activeEffect === undefined) {
if (!isTracking()) {
return;

@@ -96,14 +226,31 @@ }

if (!dep) {
depsMap.set(key, (dep = new Set()));
depsMap.set(key, (dep = createDep()));
}
if (!dep.has(activeEffect)) {
const eventInfo = (process.env.NODE_ENV !== 'production')
? { effect: activeEffect, target, type, key }
: undefined;
trackEffects(dep, eventInfo);
}
function isTracking() {
return shouldTrack && activeEffect !== undefined;
}
function trackEffects(dep, debuggerEventExtraInfo) {
let shouldTrack = false;
if (effectTrackDepth <= maxMarkerBits) {
if (!newTracked(dep)) {
dep.n |= trackOpBit; // set newly tracked
shouldTrack = !wasTracked(dep);
}
}
else {
// Full cleanup mode.
shouldTrack = !dep.has(activeEffect);
}
if (shouldTrack) {
dep.add(activeEffect);
activeEffect.deps.push(dep);
if ((process.env.NODE_ENV !== 'production') && activeEffect.options.onTrack) {
activeEffect.options.onTrack({
effect: activeEffect,
target,
type,
key
});
if ((process.env.NODE_ENV !== 'production') && activeEffect.onTrack) {
activeEffect.onTrack(Object.assign({
effect: activeEffect
}, debuggerEventExtraInfo));
}

@@ -118,16 +265,7 @@ }

}
const effects = new Set();
const add = (effectsToAdd) => {
if (effectsToAdd) {
effectsToAdd.forEach(effect => {
if (effect !== activeEffect || effect.allowRecurse) {
effects.add(effect);
}
});
}
};
let deps = [];
if (type === "clear" /* CLEAR */) {
// collection being cleared
// trigger all effects for target
depsMap.forEach(add);
deps = [...depsMap.values()];
}

@@ -137,3 +275,3 @@ else if (key === 'length' && isArray(target)) {

if (key === 'length' || key >= newValue) {
add(dep);
deps.push(dep);
}

@@ -145,3 +283,3 @@ });

if (key !== void 0) {
add(depsMap.get(key));
deps.push(depsMap.get(key));
}

@@ -152,5 +290,5 @@ // also run for iteration key on ADD | DELETE | Map.SET

if (!isArray(target)) {
add(depsMap.get(ITERATE_KEY));
deps.push(depsMap.get(ITERATE_KEY));
if (isMap(target)) {
add(depsMap.get(MAP_KEY_ITERATE_KEY));
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
}

@@ -160,3 +298,3 @@ }

// new index added to array -> length changes
add(depsMap.get('length'));
deps.push(depsMap.get('length'));
}

@@ -166,5 +304,5 @@ break;

if (!isArray(target)) {
add(depsMap.get(ITERATE_KEY));
deps.push(depsMap.get(ITERATE_KEY));
if (isMap(target)) {
add(depsMap.get(MAP_KEY_ITERATE_KEY));
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
}

@@ -175,3 +313,3 @@ }

if (isMap(target)) {
add(depsMap.get(ITERATE_KEY));
deps.push(depsMap.get(ITERATE_KEY));
}

@@ -181,23 +319,46 @@ break;

}
const run = (effect) => {
if ((process.env.NODE_ENV !== 'production') && effect.options.onTrigger) {
effect.options.onTrigger({
effect,
target,
key,
type,
newValue,
oldValue,
oldTarget
});
const eventInfo = (process.env.NODE_ENV !== 'production')
? { target, type, key, newValue, oldValue, oldTarget }
: undefined;
if (deps.length === 1) {
if (deps[0]) {
if ((process.env.NODE_ENV !== 'production')) {
triggerEffects(deps[0], eventInfo);
}
else {
triggerEffects(deps[0]);
}
}
if (effect.options.scheduler) {
effect.options.scheduler(effect);
}
else {
const effects = [];
for (const dep of deps) {
if (dep) {
effects.push(...dep);
}
}
if ((process.env.NODE_ENV !== 'production')) {
triggerEffects(createDep(effects), eventInfo);
}
else {
effect();
triggerEffects(createDep(effects));
}
};
effects.forEach(run);
}
}
function triggerEffects(dep, debuggerEventExtraInfo) {
// spread into array for stabilization
for (const effect of isArray(dep) ? dep : [...dep]) {
if (effect !== activeEffect || effect.allowRecurse) {
if ((process.env.NODE_ENV !== 'production') && effect.onTrigger) {
effect.onTrigger(extend({ effect }, debuggerEventExtraInfo));
}
if (effect.scheduler) {
effect.scheduler();
}
else {
effect.run();
}
}
}
}

@@ -755,3 +916,4 @@ const isNonTrackableKeys = /*#__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`);

function toRaw(observed) {
return ((observed && toRaw(observed["__v_raw" /* RAW */])) || observed);
const raw = observed && observed["__v_raw" /* RAW */];
return raw ? toRaw(raw) : observed;
}

@@ -763,2 +925,36 @@ function markRaw(value) {

function trackRefValue(ref) {
if (isTracking()) {
ref = toRaw(ref);
if (!ref.dep) {
ref.dep = createDep();
}
if ((process.env.NODE_ENV !== 'production')) {
trackEffects(ref.dep, {
target: ref,
type: "get" /* GET */,
key: 'value'
});
}
else {
trackEffects(ref.dep);
}
}
}
function triggerRefValue(ref, newVal) {
ref = toRaw(ref);
if (ref.dep) {
if ((process.env.NODE_ENV !== 'production')) {
triggerEffects(ref.dep, {
target: ref,
type: "set" /* SET */,
key: 'value',
newValue: newVal
});
}
else {
triggerEffects(ref.dep);
}
}
}
const convert = (val) => isObject(val) ? reactive(val) : val;

@@ -777,2 +973,3 @@ function isRef(r) {

this._shallow = _shallow;
this.dep = undefined;
this.__v_isRef = true;

@@ -783,3 +980,3 @@ this._rawValue = _shallow ? value : toRaw(value);

get value() {
track(toRaw(this), "get" /* GET */, 'value');
trackRefValue(this);
return this._value;

@@ -792,3 +989,3 @@ }

this._value = this._shallow ? newVal : convert(newVal);
trigger(toRaw(this), "set" /* SET */, 'value', newVal);
triggerRefValue(this, newVal);
}

@@ -804,3 +1001,3 @@ }

function triggerRef(ref) {
trigger(toRaw(ref), "set" /* SET */, 'value', (process.env.NODE_ENV !== 'production') ? ref.value : void 0);
triggerRefValue(ref, (process.env.NODE_ENV !== 'production') ? ref.value : void 0);
}

@@ -830,4 +1027,5 @@ function unref(ref) {

constructor(factory) {
this.dep = undefined;
this.__v_isRef = true;
const { get, set } = factory(() => track(this, "get" /* GET */, 'value'), () => trigger(this, "set" /* SET */, 'value'));
const { get, set } = factory(() => trackRefValue(this), () => triggerRefValue(this));
this._get = get;

@@ -875,27 +1073,64 @@ this._set = set;

let scheduler;
/**
* Set a scheduler for deferring computed computations
*/
const setComputedScheduler = (s) => {
scheduler = s;
};
class ComputedRefImpl {
constructor(getter, _setter, isReadonly) {
this._setter = _setter;
this.dep = undefined;
this._dirty = true;
this.__v_isRef = true;
this.effect = effect(getter, {
lazy: true,
scheduler: () => {
if (!this._dirty) {
this._dirty = true;
trigger(toRaw(this), "set" /* SET */, 'value');
let compareTarget;
let hasCompareTarget = false;
let scheduled = false;
this.effect = new ReactiveEffect(getter, (computedTrigger) => {
if (scheduler && this.dep) {
if (computedTrigger) {
compareTarget = this._value;
hasCompareTarget = true;
}
else if (!scheduled) {
const valueToCompare = hasCompareTarget ? compareTarget : this._value;
scheduled = true;
hasCompareTarget = false;
scheduler(() => {
if (this._get() !== valueToCompare) {
triggerRefValue(this);
}
scheduled = false;
});
}
// chained upstream computeds are notified synchronously to ensure
// value invalidation in case of sync access; normal effects are
// deferred to be triggered in scheduler.
for (const e of this.dep) {
if (e.computed) {
e.scheduler(true /* computedTrigger */);
}
}
}
if (!this._dirty) {
this._dirty = true;
if (!scheduler)
triggerRefValue(this);
}
});
this.effect.computed = true;
this["__v_isReadonly" /* IS_READONLY */] = isReadonly;
}
_get() {
if (this._dirty) {
this._dirty = false;
return (this._value = this.effect.run());
}
return this._value;
}
get value() {
trackRefValue(this);
// the computed ref may get wrapped by other proxies e.g. readonly() #3376
const self = toRaw(this);
if (self._dirty) {
self._value = this.effect();
self._dirty = false;
}
track(self, "get" /* GET */, 'value');
return self._value;
return toRaw(this)._get();
}

@@ -906,3 +1141,3 @@ set value(newValue) {

}
function computed(getterOrOptions) {
function computed(getterOrOptions, debugOptions) {
let getter;

@@ -922,5 +1157,10 @@ let setter;

}
return new ComputedRefImpl(getter, setter, isFunction(getterOrOptions) || !getterOrOptions.set);
const cRef = new ComputedRefImpl(getter, setter, isFunction(getterOrOptions) || !getterOrOptions.set);
if ((process.env.NODE_ENV !== 'production') && debugOptions) {
cRef.effect.onTrack = debugOptions.onTrack;
cRef.effect.onTrigger = debugOptions.onTrigger;
}
return cRef;
}
export { ITERATE_KEY, computed, customRef, effect, enableTracking, isProxy, isReactive, isReadonly, isRef, markRaw, pauseTracking, proxyRefs, reactive, readonly, ref, resetTracking, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, track, trigger, triggerRef, unref };
export { EffectScope, ITERATE_KEY, ReactiveEffect, computed, customRef, effect, effectScope, enableTracking, getCurrentScope, isProxy, isReactive, isReadonly, isRef, markRaw, onScopeDispose, pauseTracking, proxyRefs, reactive, readonly, ref, resetTracking, setComputedScheduler, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, track, trigger, triggerRef, unref };

@@ -20,3 +20,3 @@ var VueReactivity = (function (exports) {

const EMPTY_OBJ = Object.freeze({})
Object.freeze({})
;

@@ -64,3 +64,118 @@ Object.freeze([]) ;

function warn(msg, ...args) {
console.warn(`[Vue warn] ${msg}`, ...args);
}
let activeEffectScope;
const effectScopeStack = [];
class EffectScope {
constructor(detached = false) {
this.active = true;
this.effects = [];
this.cleanups = [];
if (!detached) {
recordEffectScope(this);
}
}
run(fn) {
if (this.active) {
try {
this.on();
return fn();
}
finally {
this.off();
}
}
else {
warn(`cannot run an inactive effect scope.`);
}
}
on() {
if (this.active) {
effectScopeStack.push(this);
activeEffectScope = this;
}
}
off() {
if (this.active) {
effectScopeStack.pop();
activeEffectScope = effectScopeStack[effectScopeStack.length - 1];
}
}
stop() {
if (this.active) {
this.effects.forEach(e => e.stop());
this.cleanups.forEach(cleanup => cleanup());
this.active = false;
}
}
}
function effectScope(detached) {
return new EffectScope(detached);
}
function recordEffectScope(effect, scope) {
scope = scope || activeEffectScope;
if (scope && scope.active) {
scope.effects.push(effect);
}
}
function getCurrentScope() {
return activeEffectScope;
}
function onScopeDispose(fn) {
if (activeEffectScope) {
activeEffectScope.cleanups.push(fn);
}
else {
warn(`onDispose() is called when there is no active effect scope ` +
` to be associated with.`);
}
}
const createDep = (effects) => {
const dep = new Set(effects);
dep.w = 0;
dep.n = 0;
return dep;
};
const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
const newTracked = (dep) => (dep.n & trackOpBit) > 0;
const initDepMarkers = ({ deps }) => {
if (deps.length) {
for (let i = 0; i < deps.length; i++) {
deps[i].w |= trackOpBit; // set was tracked
}
}
};
const finalizeDepMarkers = (effect) => {
const { deps } = effect;
if (deps.length) {
let ptr = 0;
for (let i = 0; i < deps.length; i++) {
const dep = deps[i];
if (wasTracked(dep) && !newTracked(dep)) {
dep.delete(effect);
}
else {
deps[ptr++] = dep;
}
// clear bits
dep.w &= ~trackOpBit;
dep.n &= ~trackOpBit;
}
deps.length = ptr;
}
};
const targetMap = new WeakMap();
// The number of effects currently being tracked recursively.
let effectTrackDepth = 0;
let trackOpBit = 1;
/**
* The bitwise track markers support at most 30 levels op recursion.
* This value is chosen to enable modern JS engines to use a SMI on all platforms.
* When recursion depth is greater, fall back to using a full cleanup.
*/
const maxMarkerBits = 30;
const effectStack = [];

@@ -70,55 +185,50 @@ let activeEffect;

const MAP_KEY_ITERATE_KEY = Symbol('Map key iterate' );
function isEffect(fn) {
return fn && fn._isEffect === true;
}
function effect(fn, options = EMPTY_OBJ) {
if (isEffect(fn)) {
fn = fn.raw;
class ReactiveEffect {
constructor(fn, scheduler = null, scope) {
this.fn = fn;
this.scheduler = scheduler;
this.active = true;
this.deps = [];
recordEffectScope(this, scope);
}
const effect = createReactiveEffect(fn, options);
if (!options.lazy) {
effect();
}
return effect;
}
function stop(effect) {
if (effect.active) {
cleanup(effect);
if (effect.options.onStop) {
effect.options.onStop();
run() {
if (!this.active) {
return this.fn();
}
effect.active = false;
}
}
let uid = 0;
function createReactiveEffect(fn, options) {
const effect = function reactiveEffect() {
if (!effect.active) {
return fn();
}
if (!effectStack.includes(effect)) {
cleanup(effect);
if (!effectStack.includes(this)) {
try {
effectStack.push((activeEffect = this));
enableTracking();
effectStack.push(effect);
activeEffect = effect;
return fn();
trackOpBit = 1 << ++effectTrackDepth;
if (effectTrackDepth <= maxMarkerBits) {
initDepMarkers(this);
}
else {
cleanupEffect(this);
}
return this.fn();
}
finally {
if (effectTrackDepth <= maxMarkerBits) {
finalizeDepMarkers(this);
}
trackOpBit = 1 << --effectTrackDepth;
resetTracking();
effectStack.pop();
resetTracking();
activeEffect = effectStack[effectStack.length - 1];
const n = effectStack.length;
activeEffect = n > 0 ? effectStack[n - 1] : undefined;
}
}
};
effect.id = uid++;
effect.allowRecurse = !!options.allowRecurse;
effect._isEffect = true;
effect.active = true;
effect.raw = fn;
effect.deps = [];
effect.options = options;
return effect;
}
stop() {
if (this.active) {
cleanupEffect(this);
if (this.onStop) {
this.onStop();
}
this.active = false;
}
}
}
function cleanup(effect) {
function cleanupEffect(effect) {
const { deps } = effect;

@@ -132,2 +242,22 @@ if (deps.length) {

}
function effect(fn, options) {
if (fn.effect) {
fn = fn.effect.fn;
}
const _effect = new ReactiveEffect(fn);
if (options) {
extend(_effect, options);
if (options.scope)
recordEffectScope(_effect, options.scope);
}
if (!options || !options.lazy) {
_effect.run();
}
const runner = _effect.run.bind(_effect);
runner.effect = _effect;
return runner;
}
function stop(runner) {
runner.effect.stop();
}
let shouldTrack = true;

@@ -148,3 +278,3 @@ const trackStack = [];

function track(target, type, key) {
if (!shouldTrack || activeEffect === undefined) {
if (!isTracking()) {
return;

@@ -158,14 +288,30 @@ }

if (!dep) {
depsMap.set(key, (dep = new Set()));
depsMap.set(key, (dep = createDep()));
}
if (!dep.has(activeEffect)) {
const eventInfo = { effect: activeEffect, target, type, key }
;
trackEffects(dep, eventInfo);
}
function isTracking() {
return shouldTrack && activeEffect !== undefined;
}
function trackEffects(dep, debuggerEventExtraInfo) {
let shouldTrack = false;
if (effectTrackDepth <= maxMarkerBits) {
if (!newTracked(dep)) {
dep.n |= trackOpBit; // set newly tracked
shouldTrack = !wasTracked(dep);
}
}
else {
// Full cleanup mode.
shouldTrack = !dep.has(activeEffect);
}
if (shouldTrack) {
dep.add(activeEffect);
activeEffect.deps.push(dep);
if (activeEffect.options.onTrack) {
activeEffect.options.onTrack({
effect: activeEffect,
target,
type,
key
});
if (activeEffect.onTrack) {
activeEffect.onTrack(Object.assign({
effect: activeEffect
}, debuggerEventExtraInfo));
}

@@ -180,16 +326,7 @@ }

}
const effects = new Set();
const add = (effectsToAdd) => {
if (effectsToAdd) {
effectsToAdd.forEach(effect => {
if (effect !== activeEffect || effect.allowRecurse) {
effects.add(effect);
}
});
}
};
let deps = [];
if (type === "clear" /* CLEAR */) {
// collection being cleared
// trigger all effects for target
depsMap.forEach(add);
deps = [...depsMap.values()];
}

@@ -199,3 +336,3 @@ else if (key === 'length' && isArray(target)) {

if (key === 'length' || key >= newValue) {
add(dep);
deps.push(dep);
}

@@ -207,3 +344,3 @@ });

if (key !== void 0) {
add(depsMap.get(key));
deps.push(depsMap.get(key));
}

@@ -214,5 +351,5 @@ // also run for iteration key on ADD | DELETE | Map.SET

if (!isArray(target)) {
add(depsMap.get(ITERATE_KEY));
deps.push(depsMap.get(ITERATE_KEY));
if (isMap(target)) {
add(depsMap.get(MAP_KEY_ITERATE_KEY));
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
}

@@ -222,3 +359,3 @@ }

// new index added to array -> length changes
add(depsMap.get('length'));
deps.push(depsMap.get('length'));
}

@@ -228,5 +365,5 @@ break;

if (!isArray(target)) {
add(depsMap.get(ITERATE_KEY));
deps.push(depsMap.get(ITERATE_KEY));
if (isMap(target)) {
add(depsMap.get(MAP_KEY_ITERATE_KEY));
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
}

@@ -237,3 +374,3 @@ }

if (isMap(target)) {
add(depsMap.get(ITERATE_KEY));
deps.push(depsMap.get(ITERATE_KEY));
}

@@ -243,23 +380,39 @@ break;

}
const run = (effect) => {
if (effect.options.onTrigger) {
effect.options.onTrigger({
effect,
target,
key,
type,
newValue,
oldValue,
oldTarget
});
const eventInfo = { target, type, key, newValue, oldValue, oldTarget }
;
if (deps.length === 1) {
if (deps[0]) {
{
triggerEffects(deps[0], eventInfo);
}
}
if (effect.options.scheduler) {
effect.options.scheduler(effect);
}
else {
const effects = [];
for (const dep of deps) {
if (dep) {
effects.push(...dep);
}
}
else {
effect();
{
triggerEffects(createDep(effects), eventInfo);
}
};
effects.forEach(run);
}
}
function triggerEffects(dep, debuggerEventExtraInfo) {
// spread into array for stabilization
for (const effect of isArray(dep) ? dep : [...dep]) {
if (effect !== activeEffect || effect.allowRecurse) {
if (effect.onTrigger) {
effect.onTrigger(extend({ effect }, debuggerEventExtraInfo));
}
if (effect.scheduler) {
effect.scheduler();
}
else {
effect.run();
}
}
}
}

@@ -816,3 +969,4 @@ const isNonTrackableKeys = /*#__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`);

function toRaw(observed) {
return ((observed && toRaw(observed["__v_raw" /* RAW */])) || observed);
const raw = observed && observed["__v_raw" /* RAW */];
return raw ? toRaw(raw) : observed;
}

@@ -824,2 +978,30 @@ function markRaw(value) {

function trackRefValue(ref) {
if (isTracking()) {
ref = toRaw(ref);
if (!ref.dep) {
ref.dep = createDep();
}
{
trackEffects(ref.dep, {
target: ref,
type: "get" /* GET */,
key: 'value'
});
}
}
}
function triggerRefValue(ref, newVal) {
ref = toRaw(ref);
if (ref.dep) {
{
triggerEffects(ref.dep, {
target: ref,
type: "set" /* SET */,
key: 'value',
newValue: newVal
});
}
}
}
const convert = (val) => isObject(val) ? reactive(val) : val;

@@ -838,2 +1020,3 @@ function isRef(r) {

this._shallow = _shallow;
this.dep = undefined;
this.__v_isRef = true;

@@ -844,3 +1027,3 @@ this._rawValue = _shallow ? value : toRaw(value);

get value() {
track(toRaw(this), "get" /* GET */, 'value');
trackRefValue(this);
return this._value;

@@ -853,3 +1036,3 @@ }

this._value = this._shallow ? newVal : convert(newVal);
trigger(toRaw(this), "set" /* SET */, 'value', newVal);
triggerRefValue(this, newVal);
}

@@ -865,3 +1048,3 @@ }

function triggerRef(ref) {
trigger(toRaw(ref), "set" /* SET */, 'value', ref.value );
triggerRefValue(ref, ref.value );
}

@@ -891,4 +1074,5 @@ function unref(ref) {

constructor(factory) {
this.dep = undefined;
this.__v_isRef = true;
const { get, set } = factory(() => track(this, "get" /* GET */, 'value'), () => trigger(this, "set" /* SET */, 'value'));
const { get, set } = factory(() => trackRefValue(this), () => triggerRefValue(this));
this._get = get;

@@ -936,27 +1120,64 @@ this._set = set;

let scheduler;
/**
* Set a scheduler for deferring computed computations
*/
const setComputedScheduler = (s) => {
scheduler = s;
};
class ComputedRefImpl {
constructor(getter, _setter, isReadonly) {
this._setter = _setter;
this.dep = undefined;
this._dirty = true;
this.__v_isRef = true;
this.effect = effect(getter, {
lazy: true,
scheduler: () => {
if (!this._dirty) {
this._dirty = true;
trigger(toRaw(this), "set" /* SET */, 'value');
let compareTarget;
let hasCompareTarget = false;
let scheduled = false;
this.effect = new ReactiveEffect(getter, (computedTrigger) => {
if (scheduler && this.dep) {
if (computedTrigger) {
compareTarget = this._value;
hasCompareTarget = true;
}
else if (!scheduled) {
const valueToCompare = hasCompareTarget ? compareTarget : this._value;
scheduled = true;
hasCompareTarget = false;
scheduler(() => {
if (this._get() !== valueToCompare) {
triggerRefValue(this);
}
scheduled = false;
});
}
// chained upstream computeds are notified synchronously to ensure
// value invalidation in case of sync access; normal effects are
// deferred to be triggered in scheduler.
for (const e of this.dep) {
if (e.computed) {
e.scheduler(true /* computedTrigger */);
}
}
}
if (!this._dirty) {
this._dirty = true;
if (!scheduler)
triggerRefValue(this);
}
});
this.effect.computed = true;
this["__v_isReadonly" /* IS_READONLY */] = isReadonly;
}
_get() {
if (this._dirty) {
this._dirty = false;
return (this._value = this.effect.run());
}
return this._value;
}
get value() {
trackRefValue(this);
// the computed ref may get wrapped by other proxies e.g. readonly() #3376
const self = toRaw(this);
if (self._dirty) {
self._value = this.effect();
self._dirty = false;
}
track(self, "get" /* GET */, 'value');
return self._value;
return toRaw(this)._get();
}

@@ -967,3 +1188,3 @@ set value(newValue) {

}
function computed(getterOrOptions) {
function computed(getterOrOptions, debugOptions) {
let getter;

@@ -982,10 +1203,19 @@ let setter;

}
return new ComputedRefImpl(getter, setter, isFunction(getterOrOptions) || !getterOrOptions.set);
const cRef = new ComputedRefImpl(getter, setter, isFunction(getterOrOptions) || !getterOrOptions.set);
if (debugOptions) {
cRef.effect.onTrack = debugOptions.onTrack;
cRef.effect.onTrigger = debugOptions.onTrigger;
}
return cRef;
}
exports.EffectScope = EffectScope;
exports.ITERATE_KEY = ITERATE_KEY;
exports.ReactiveEffect = ReactiveEffect;
exports.computed = computed;
exports.customRef = customRef;
exports.effect = effect;
exports.effectScope = effectScope;
exports.enableTracking = enableTracking;
exports.getCurrentScope = getCurrentScope;
exports.isProxy = isProxy;

@@ -996,2 +1226,3 @@ exports.isReactive = isReactive;

exports.markRaw = markRaw;
exports.onScopeDispose = onScopeDispose;
exports.pauseTracking = pauseTracking;

@@ -1003,2 +1234,3 @@ exports.proxyRefs = proxyRefs;

exports.resetTracking = resetTracking;
exports.setComputedScheduler = setComputedScheduler;
exports.shallowReactive = shallowReactive;

@@ -1005,0 +1237,0 @@ exports.shallowReadonly = shallowReadonly;

@@ -1,1 +0,1 @@

var VueReactivity=function(t){"use strict";function e(t,e){const n=Object.create(null),r=t.split(",");for(let s=0;s<r.length;s++)n[r[s]]=!0;return e?t=>!!n[t.toLowerCase()]:t=>!!n[t]}const n={},r=()=>{},s=Object.assign,i=Object.prototype.hasOwnProperty,o=(t,e)=>i.call(t,e),c=Array.isArray,u=t=>"[object Map]"===_(t),a=t=>"function"==typeof t,l=t=>"symbol"==typeof t,f=t=>null!==t&&"object"==typeof t,h=Object.prototype.toString,_=t=>h.call(t),d=t=>"string"==typeof t&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,v=(t,e)=>t!==e&&(t==t||e==e),g=new WeakMap,p=[];let y;const w=Symbol(""),R=Symbol("");function b(t,e=n){(function(t){return t&&!0===t._isEffect})(t)&&(t=t.raw);const r=function(t,e){const n=function(){if(!n.active)return t();if(!p.includes(n)){E(n);try{return O(),p.push(n),y=n,t()}finally{p.pop(),P(),y=p[p.length-1]}}};return n.id=k++,n.allowRecurse=!!e.allowRecurse,n._isEffect=!0,n.active=!0,n.raw=t,n.deps=[],n.options=e,n}(t,e);return e.lazy||r(),r}let k=0;function E(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}let m=!0;const S=[];function j(){S.push(m),m=!1}function O(){S.push(m),m=!0}function P(){const t=S.pop();m=void 0===t||t}function M(t,e,n){if(!m||void 0===y)return;let r=g.get(t);r||g.set(t,r=new Map);let s=r.get(n);s||r.set(n,s=new Set),s.has(y)||(s.add(y),y.deps.push(s))}function x(t,e,n,r,s,i){const o=g.get(t);if(!o)return;const a=new Set,l=t=>{t&&t.forEach((t=>{(t!==y||t.allowRecurse)&&a.add(t)}))};if("clear"===e)o.forEach(l);else if("length"===n&&c(t))o.forEach(((t,e)=>{("length"===e||e>=r)&&l(t)}));else switch(void 0!==n&&l(o.get(n)),e){case"add":c(t)?d(n)&&l(o.get("length")):(l(o.get(w)),u(t)&&l(o.get(R)));break;case"delete":c(t)||(l(o.get(w)),u(t)&&l(o.get(R)));break;case"set":u(t)&&l(o.get(w))}a.forEach((t=>{t.options.scheduler?t.options.scheduler(t):t()}))}const z=e("__proto__,__v_isRef,__isVue"),W=new Set(Object.getOwnPropertyNames(Symbol).map((t=>Symbol[t])).filter(l)),A=B(),T=B(!1,!0),V=B(!0),N=B(!0,!0),I=K();function K(){const t={};return["includes","indexOf","lastIndexOf"].forEach((e=>{t[e]=function(...t){const n=St(this);for(let e=0,s=this.length;e<s;e++)M(n,0,e+"");const r=n[e](...t);return-1===r||!1===r?n[e](...t.map(St)):r}})),["push","pop","shift","unshift","splice"].forEach((e=>{t[e]=function(...t){j();const n=St(this)[e].apply(this,t);return P(),n}})),t}function B(t=!1,e=!1){return function(n,r,s){if("__v_isReactive"===r)return!t;if("__v_isReadonly"===r)return t;if("__v_raw"===r&&s===(t?e?yt:pt:e?gt:vt).get(n))return n;const i=c(n);if(!t&&i&&o(I,r))return Reflect.get(I,r,s);const u=Reflect.get(n,r,s);if(l(r)?W.has(r):z(r))return u;if(t||M(n,0,r),e)return u;if(Ot(u)){return!i||!d(r)?u.value:u}return f(u)?t?bt(u):Rt(u):u}}function C(t=!1){return function(e,n,r,s){let i=e[n];if(!t&&(r=St(r),i=St(i),!c(e)&&Ot(i)&&!Ot(r)))return i.value=r,!0;const u=c(e)&&d(n)?Number(n)<e.length:o(e,n),a=Reflect.set(e,n,r,s);return e===St(s)&&(u?v(r,i)&&x(e,"set",n,r):x(e,"add",n,r)),a}}const L={get:A,set:C(),deleteProperty:function(t,e){const n=o(t,e),r=Reflect.deleteProperty(t,e);return r&&n&&x(t,"delete",e,void 0),r},has:function(t,e){const n=Reflect.has(t,e);return l(e)&&W.has(e)||M(t,0,e),n},ownKeys:function(t){return M(t,0,c(t)?"length":w),Reflect.ownKeys(t)}},Y={get:V,set:(t,e)=>!0,deleteProperty:(t,e)=>!0},q=s({},L,{get:T,set:C(!0)}),D=s({},Y,{get:N}),F=t=>f(t)?Rt(t):t,G=t=>f(t)?bt(t):t,H=t=>t,J=t=>Reflect.getPrototypeOf(t);function Q(t,e,n=!1,r=!1){const s=St(t=t.__v_raw),i=St(e);e!==i&&!n&&M(s,0,e),!n&&M(s,0,i);const{has:o}=J(s),c=r?H:n?G:F;return o.call(s,e)?c(t.get(e)):o.call(s,i)?c(t.get(i)):void(t!==s&&t.get(e))}function U(t,e=!1){const n=this.__v_raw,r=St(n),s=St(t);return t!==s&&!e&&M(r,0,t),!e&&M(r,0,s),t===s?n.has(t):n.has(t)||n.has(s)}function X(t,e=!1){return t=t.__v_raw,!e&&M(St(t),0,w),Reflect.get(t,"size",t)}function Z(t){t=St(t);const e=St(this);return J(e).has.call(e,t)||(e.add(t),x(e,"add",t,t)),this}function $(t,e){e=St(e);const n=St(this),{has:r,get:s}=J(n);let i=r.call(n,t);i||(t=St(t),i=r.call(n,t));const o=s.call(n,t);return n.set(t,e),i?v(e,o)&&x(n,"set",t,e):x(n,"add",t,e),this}function tt(t){const e=St(this),{has:n,get:r}=J(e);let s=n.call(e,t);s||(t=St(t),s=n.call(e,t)),r&&r.call(e,t);const i=e.delete(t);return s&&x(e,"delete",t,void 0),i}function et(){const t=St(this),e=0!==t.size,n=t.clear();return e&&x(t,"clear",void 0,void 0),n}function nt(t,e){return function(n,r){const s=this,i=s.__v_raw,o=St(i),c=e?H:t?G:F;return!t&&M(o,0,w),i.forEach(((t,e)=>n.call(r,c(t),c(e),s)))}}function rt(t,e,n){return function(...r){const s=this.__v_raw,i=St(s),o=u(i),c="entries"===t||t===Symbol.iterator&&o,a="keys"===t&&o,l=s[t](...r),f=n?H:e?G:F;return!e&&M(i,0,a?R:w),{next(){const{value:t,done:e}=l.next();return e?{value:t,done:e}:{value:c?[f(t[0]),f(t[1])]:f(t),done:e}},[Symbol.iterator](){return this}}}}function st(t){return function(...e){return"delete"!==t&&this}}function it(){const t={get(t){return Q(this,t)},get size(){return X(this)},has:U,add:Z,set:$,delete:tt,clear:et,forEach:nt(!1,!1)},e={get(t){return Q(this,t,!1,!0)},get size(){return X(this)},has:U,add:Z,set:$,delete:tt,clear:et,forEach:nt(!1,!0)},n={get(t){return Q(this,t,!0)},get size(){return X(this,!0)},has(t){return U.call(this,t,!0)},add:st("add"),set:st("set"),delete:st("delete"),clear:st("clear"),forEach:nt(!0,!1)},r={get(t){return Q(this,t,!0,!0)},get size(){return X(this,!0)},has(t){return U.call(this,t,!0)},add:st("add"),set:st("set"),delete:st("delete"),clear:st("clear"),forEach:nt(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((s=>{t[s]=rt(s,!1,!1),n[s]=rt(s,!0,!1),e[s]=rt(s,!1,!0),r[s]=rt(s,!0,!0)})),[t,n,e,r]}const[ot,ct,ut,at]=it();function lt(t,e){const n=e?t?at:ut:t?ct:ot;return(e,r,s)=>"__v_isReactive"===r?!t:"__v_isReadonly"===r?t:"__v_raw"===r?e:Reflect.get(o(n,r)&&r in e?n:e,r,s)}const ft={get:lt(!1,!1)},ht={get:lt(!1,!0)},_t={get:lt(!0,!1)},dt={get:lt(!0,!0)},vt=new WeakMap,gt=new WeakMap,pt=new WeakMap,yt=new WeakMap;function wt(t){return t.__v_skip||!Object.isExtensible(t)?0:function(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}((t=>_(t).slice(8,-1))(t))}function Rt(t){return t&&t.__v_isReadonly?t:kt(t,!1,L,ft,vt)}function bt(t){return kt(t,!0,Y,_t,pt)}function kt(t,e,n,r,s){if(!f(t))return t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const i=s.get(t);if(i)return i;const o=wt(t);if(0===o)return t;const c=new Proxy(t,2===o?r:n);return s.set(t,c),c}function Et(t){return mt(t)?Et(t.__v_raw):!(!t||!t.__v_isReactive)}function mt(t){return!(!t||!t.__v_isReadonly)}function St(t){return t&&St(t.__v_raw)||t}const jt=t=>f(t)?Rt(t):t;function Ot(t){return Boolean(t&&!0===t.__v_isRef)}class Pt{constructor(t,e=!1){this._shallow=e,this.__v_isRef=!0,this._rawValue=e?t:St(t),this._value=e?t:jt(t)}get value(){return M(St(this),0,"value"),this._value}set value(t){t=this._shallow?t:St(t),v(t,this._rawValue)&&(this._rawValue=t,this._value=this._shallow?t:jt(t),x(St(this),"set","value",t))}}function Mt(t,e=!1){return Ot(t)?t:new Pt(t,e)}function xt(t){return Ot(t)?t.value:t}const zt={get:(t,e,n)=>xt(Reflect.get(t,e,n)),set:(t,e,n,r)=>{const s=t[e];return Ot(s)&&!Ot(n)?(s.value=n,!0):Reflect.set(t,e,n,r)}};class Wt{constructor(t){this.__v_isRef=!0;const{get:e,set:n}=t((()=>M(this,0,"value")),(()=>x(this,"set","value")));this._get=e,this._set=n}get value(){return this._get()}set value(t){this._set(t)}}class At{constructor(t,e){this._object=t,this._key=e,this.__v_isRef=!0}get value(){return this._object[this._key]}set value(t){this._object[this._key]=t}}function Tt(t,e){return Ot(t[e])?t[e]:new At(t,e)}class Vt{constructor(t,e,n){this._setter=e,this._dirty=!0,this.__v_isRef=!0,this.effect=b(t,{lazy:!0,scheduler:()=>{this._dirty||(this._dirty=!0,x(St(this),"set","value"))}}),this.__v_isReadonly=n}get value(){const t=St(this);return t._dirty&&(t._value=this.effect(),t._dirty=!1),M(t,0,"value"),t._value}set value(t){this._setter(t)}}return t.ITERATE_KEY=w,t.computed=function(t){let e,n;return a(t)?(e=t,n=r):(e=t.get,n=t.set),new Vt(e,n,a(t)||!t.set)},t.customRef=function(t){return new Wt(t)},t.effect=b,t.enableTracking=O,t.isProxy=function(t){return Et(t)||mt(t)},t.isReactive=Et,t.isReadonly=mt,t.isRef=Ot,t.markRaw=function(t){return((t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})})(t,"__v_skip",!0),t},t.pauseTracking=j,t.proxyRefs=function(t){return Et(t)?t:new Proxy(t,zt)},t.reactive=Rt,t.readonly=bt,t.ref=function(t){return Mt(t)},t.resetTracking=P,t.shallowReactive=function(t){return kt(t,!1,q,ht,gt)},t.shallowReadonly=function(t){return kt(t,!0,D,dt,yt)},t.shallowRef=function(t){return Mt(t,!0)},t.stop=function(t){t.active&&(E(t),t.options.onStop&&t.options.onStop(),t.active=!1)},t.toRaw=St,t.toRef=Tt,t.toRefs=function(t){const e=c(t)?new Array(t.length):{};for(const n in t)e[n]=Tt(t,n);return e},t.track=M,t.trigger=x,t.triggerRef=function(t){x(St(t),"set","value",void 0)},t.unref=xt,Object.defineProperty(t,"__esModule",{value:!0}),t}({});
var VueReactivity=function(t){"use strict";function e(t,e){const n=Object.create(null),s=t.split(",");for(let r=0;r<s.length;r++)n[s[r]]=!0;return e?t=>!!n[t.toLowerCase()]:t=>!!n[t]}const n=()=>{},s=Object.assign,r=Object.prototype.hasOwnProperty,i=(t,e)=>r.call(t,e),c=Array.isArray,o=t=>"[object Map]"===h(t),u=t=>"function"==typeof t,a=t=>"symbol"==typeof t,l=t=>null!==t&&"object"==typeof t,f=Object.prototype.toString,h=t=>f.call(t),_=t=>"string"==typeof t&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,d=(t,e)=>t!==e&&(t==t||e==e);let p;const v=[];class g{constructor(t=!1){this.active=!0,this.effects=[],this.cleanups=[],t||y(this)}run(t){if(this.active)try{return this.on(),t()}finally{this.off()}}on(){this.active&&(v.push(this),p=this)}off(){this.active&&(v.pop(),p=v[v.length-1])}stop(){this.active&&(this.effects.forEach((t=>t.stop())),this.cleanups.forEach((t=>t())),this.active=!1)}}function y(t,e){(e=e||p)&&e.active&&e.effects.push(t)}const w=t=>{const e=new Set(t);return e.w=0,e.n=0,e},R=t=>(t.w&S)>0,b=t=>(t.n&S)>0,k=new WeakMap;let m=0,S=1;const E=[];let j;const O=Symbol(""),P=Symbol("");class M{constructor(t,e=null,n){this.fn=t,this.scheduler=e,this.active=!0,this.deps=[],y(this,n)}run(){if(!this.active)return this.fn();if(!E.includes(this))try{return E.push(j=this),T(),S=1<<++m,m<=30?(({deps:t})=>{if(t.length)for(let e=0;e<t.length;e++)t[e].w|=S})(this):x(this),this.fn()}finally{m<=30&&(t=>{const{deps:e}=t;if(e.length){let n=0;for(let s=0;s<e.length;s++){const r=e[s];R(r)&&!b(r)?r.delete(t):e[n++]=r,r.w&=~S,r.n&=~S}e.length=n}})(this),S=1<<--m,V(),E.pop();const t=E.length;j=t>0?E[t-1]:void 0}}stop(){this.active&&(x(this),this.onStop&&this.onStop(),this.active=!1)}}function x(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}let z=!0;const W=[];function A(){W.push(z),z=!1}function T(){W.push(z),z=!0}function V(){const t=W.pop();z=void 0===t||t}function N(t,e,n){if(!C())return;let s=k.get(t);s||k.set(t,s=new Map);let r=s.get(n);r||s.set(n,r=w()),I(r)}function C(){return z&&void 0!==j}function I(t,e){let n=!1;m<=30?b(t)||(t.n|=S,n=!R(t)):n=!t.has(j),n&&(t.add(j),j.deps.push(t))}function K(t,e,n,s,r,i){const u=k.get(t);if(!u)return;let a=[];if("clear"===e)a=[...u.values()];else if("length"===n&&c(t))u.forEach(((t,e)=>{("length"===e||e>=s)&&a.push(t)}));else switch(void 0!==n&&a.push(u.get(n)),e){case"add":c(t)?_(n)&&a.push(u.get("length")):(a.push(u.get(O)),o(t)&&a.push(u.get(P)));break;case"delete":c(t)||(a.push(u.get(O)),o(t)&&a.push(u.get(P)));break;case"set":o(t)&&a.push(u.get(O))}if(1===a.length)a[0]&&B(a[0]);else{const t=[];for(const e of a)e&&t.push(...e);B(w(t))}}function B(t,e){for(const n of c(t)?t:[...t])(n!==j||n.allowRecurse)&&(n.scheduler?n.scheduler():n.run())}const D=e("__proto__,__v_isRef,__isVue"),L=new Set(Object.getOwnPropertyNames(Symbol).map((t=>Symbol[t])).filter(a)),Y=Q(),q=Q(!1,!0),F=Q(!0),G=Q(!0,!0),H=J();function J(){const t={};return["includes","indexOf","lastIndexOf"].forEach((e=>{t[e]=function(...t){const n=Vt(this);for(let e=0,r=this.length;e<r;e++)N(n,0,e+"");const s=n[e](...t);return-1===s||!1===s?n[e](...t.map(Vt)):s}})),["push","pop","shift","unshift","splice"].forEach((e=>{t[e]=function(...t){A();const n=Vt(this)[e].apply(this,t);return V(),n}})),t}function Q(t=!1,e=!1){return function(n,s,r){if("__v_isReactive"===s)return!t;if("__v_isReadonly"===s)return t;if("__v_raw"===s&&r===(t?e?Pt:Ot:e?jt:Et).get(n))return n;const o=c(n);if(!t&&o&&i(H,s))return Reflect.get(H,s,r);const u=Reflect.get(n,s,r);if(a(s)?L.has(s):D(s))return u;if(t||N(n,0,s),e)return u;if(Kt(u)){return!o||!_(s)?u.value:u}return l(u)?t?zt(u):xt(u):u}}function U(t=!1){return function(e,n,s,r){let o=e[n];if(!t&&(s=Vt(s),o=Vt(o),!c(e)&&Kt(o)&&!Kt(s)))return o.value=s,!0;const u=c(e)&&_(n)?Number(n)<e.length:i(e,n),a=Reflect.set(e,n,s,r);return e===Vt(r)&&(u?d(s,o)&&K(e,"set",n,s):K(e,"add",n,s)),a}}const X={get:Y,set:U(),deleteProperty:function(t,e){const n=i(t,e),s=Reflect.deleteProperty(t,e);return s&&n&&K(t,"delete",e,void 0),s},has:function(t,e){const n=Reflect.has(t,e);return a(e)&&L.has(e)||N(t,0,e),n},ownKeys:function(t){return N(t,0,c(t)?"length":O),Reflect.ownKeys(t)}},Z={get:F,set:(t,e)=>!0,deleteProperty:(t,e)=>!0},$=s({},X,{get:q,set:U(!0)}),tt=s({},Z,{get:G}),et=t=>l(t)?xt(t):t,nt=t=>l(t)?zt(t):t,st=t=>t,rt=t=>Reflect.getPrototypeOf(t);function it(t,e,n=!1,s=!1){const r=Vt(t=t.__v_raw),i=Vt(e);e!==i&&!n&&N(r,0,e),!n&&N(r,0,i);const{has:c}=rt(r),o=s?st:n?nt:et;return c.call(r,e)?o(t.get(e)):c.call(r,i)?o(t.get(i)):void(t!==r&&t.get(e))}function ct(t,e=!1){const n=this.__v_raw,s=Vt(n),r=Vt(t);return t!==r&&!e&&N(s,0,t),!e&&N(s,0,r),t===r?n.has(t):n.has(t)||n.has(r)}function ot(t,e=!1){return t=t.__v_raw,!e&&N(Vt(t),0,O),Reflect.get(t,"size",t)}function ut(t){t=Vt(t);const e=Vt(this);return rt(e).has.call(e,t)||(e.add(t),K(e,"add",t,t)),this}function at(t,e){e=Vt(e);const n=Vt(this),{has:s,get:r}=rt(n);let i=s.call(n,t);i||(t=Vt(t),i=s.call(n,t));const c=r.call(n,t);return n.set(t,e),i?d(e,c)&&K(n,"set",t,e):K(n,"add",t,e),this}function lt(t){const e=Vt(this),{has:n,get:s}=rt(e);let r=n.call(e,t);r||(t=Vt(t),r=n.call(e,t)),s&&s.call(e,t);const i=e.delete(t);return r&&K(e,"delete",t,void 0),i}function ft(){const t=Vt(this),e=0!==t.size,n=t.clear();return e&&K(t,"clear",void 0,void 0),n}function ht(t,e){return function(n,s){const r=this,i=r.__v_raw,c=Vt(i),o=e?st:t?nt:et;return!t&&N(c,0,O),i.forEach(((t,e)=>n.call(s,o(t),o(e),r)))}}function _t(t,e,n){return function(...s){const r=this.__v_raw,i=Vt(r),c=o(i),u="entries"===t||t===Symbol.iterator&&c,a="keys"===t&&c,l=r[t](...s),f=n?st:e?nt:et;return!e&&N(i,0,a?P:O),{next(){const{value:t,done:e}=l.next();return e?{value:t,done:e}:{value:u?[f(t[0]),f(t[1])]:f(t),done:e}},[Symbol.iterator](){return this}}}}function dt(t){return function(...e){return"delete"!==t&&this}}function pt(){const t={get(t){return it(this,t)},get size(){return ot(this)},has:ct,add:ut,set:at,delete:lt,clear:ft,forEach:ht(!1,!1)},e={get(t){return it(this,t,!1,!0)},get size(){return ot(this)},has:ct,add:ut,set:at,delete:lt,clear:ft,forEach:ht(!1,!0)},n={get(t){return it(this,t,!0)},get size(){return ot(this,!0)},has(t){return ct.call(this,t,!0)},add:dt("add"),set:dt("set"),delete:dt("delete"),clear:dt("clear"),forEach:ht(!0,!1)},s={get(t){return it(this,t,!0,!0)},get size(){return ot(this,!0)},has(t){return ct.call(this,t,!0)},add:dt("add"),set:dt("set"),delete:dt("delete"),clear:dt("clear"),forEach:ht(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((r=>{t[r]=_t(r,!1,!1),n[r]=_t(r,!0,!1),e[r]=_t(r,!1,!0),s[r]=_t(r,!0,!0)})),[t,n,e,s]}const[vt,gt,yt,wt]=pt();function Rt(t,e){const n=e?t?wt:yt:t?gt:vt;return(e,s,r)=>"__v_isReactive"===s?!t:"__v_isReadonly"===s?t:"__v_raw"===s?e:Reflect.get(i(n,s)&&s in e?n:e,s,r)}const bt={get:Rt(!1,!1)},kt={get:Rt(!1,!0)},mt={get:Rt(!0,!1)},St={get:Rt(!0,!0)},Et=new WeakMap,jt=new WeakMap,Ot=new WeakMap,Pt=new WeakMap;function Mt(t){return t.__v_skip||!Object.isExtensible(t)?0:function(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}((t=>h(t).slice(8,-1))(t))}function xt(t){return t&&t.__v_isReadonly?t:Wt(t,!1,X,bt,Et)}function zt(t){return Wt(t,!0,Z,mt,Ot)}function Wt(t,e,n,s,r){if(!l(t))return t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const i=r.get(t);if(i)return i;const c=Mt(t);if(0===c)return t;const o=new Proxy(t,2===c?s:n);return r.set(t,o),o}function At(t){return Tt(t)?At(t.__v_raw):!(!t||!t.__v_isReactive)}function Tt(t){return!(!t||!t.__v_isReadonly)}function Vt(t){const e=t&&t.__v_raw;return e?Vt(e):t}function Nt(t){C()&&((t=Vt(t)).dep||(t.dep=w()),I(t.dep))}function Ct(t,e){(t=Vt(t)).dep&&B(t.dep)}const It=t=>l(t)?xt(t):t;function Kt(t){return Boolean(t&&!0===t.__v_isRef)}class Bt{constructor(t,e=!1){this._shallow=e,this.dep=void 0,this.__v_isRef=!0,this._rawValue=e?t:Vt(t),this._value=e?t:It(t)}get value(){return Nt(this),this._value}set value(t){t=this._shallow?t:Vt(t),d(t,this._rawValue)&&(this._rawValue=t,this._value=this._shallow?t:It(t),Ct(this))}}function Dt(t,e=!1){return Kt(t)?t:new Bt(t,e)}function Lt(t){return Kt(t)?t.value:t}const Yt={get:(t,e,n)=>Lt(Reflect.get(t,e,n)),set:(t,e,n,s)=>{const r=t[e];return Kt(r)&&!Kt(n)?(r.value=n,!0):Reflect.set(t,e,n,s)}};class qt{constructor(t){this.dep=void 0,this.__v_isRef=!0;const{get:e,set:n}=t((()=>Nt(this)),(()=>Ct(this)));this._get=e,this._set=n}get value(){return this._get()}set value(t){this._set(t)}}class Ft{constructor(t,e){this._object=t,this._key=e,this.__v_isRef=!0}get value(){return this._object[this._key]}set value(t){this._object[this._key]=t}}function Gt(t,e){return Kt(t[e])?t[e]:new Ft(t,e)}let Ht;class Jt{constructor(t,e,n){let s;this._setter=e,this.dep=void 0,this._dirty=!0,this.__v_isRef=!0;let r=!1,i=!1;this.effect=new M(t,(t=>{if(Ht&&this.dep){if(t)s=this._value,r=!0;else if(!i){const t=r?s:this._value;i=!0,r=!1,Ht((()=>{this._get()!==t&&Ct(this),i=!1}))}for(const t of this.dep)t.computed&&t.scheduler(!0)}this._dirty||(this._dirty=!0,Ht||Ct(this))})),this.effect.computed=!0,this.__v_isReadonly=n}_get(){return this._dirty?(this._dirty=!1,this._value=this.effect.run()):this._value}get value(){return Nt(this),Vt(this)._get()}set value(t){this._setter(t)}}return t.EffectScope=g,t.ITERATE_KEY=O,t.ReactiveEffect=M,t.computed=function(t,e){let s,r;return u(t)?(s=t,r=n):(s=t.get,r=t.set),new Jt(s,r,u(t)||!t.set)},t.customRef=function(t){return new qt(t)},t.effect=function(t,e){t.effect&&(t=t.effect.fn);const n=new M(t);e&&(s(n,e),e.scope&&y(n,e.scope)),e&&e.lazy||n.run();const r=n.run.bind(n);return r.effect=n,r},t.effectScope=function(t){return new g(t)},t.enableTracking=T,t.getCurrentScope=function(){return p},t.isProxy=function(t){return At(t)||Tt(t)},t.isReactive=At,t.isReadonly=Tt,t.isRef=Kt,t.markRaw=function(t){return((t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})})(t,"__v_skip",!0),t},t.onScopeDispose=function(t){p&&p.cleanups.push(t)},t.pauseTracking=A,t.proxyRefs=function(t){return At(t)?t:new Proxy(t,Yt)},t.reactive=xt,t.readonly=zt,t.ref=function(t){return Dt(t)},t.resetTracking=V,t.setComputedScheduler=t=>{Ht=t},t.shallowReactive=function(t){return Wt(t,!1,$,kt,jt)},t.shallowReadonly=function(t){return Wt(t,!0,tt,St,Pt)},t.shallowRef=function(t){return Dt(t,!0)},t.stop=function(t){t.effect.stop()},t.toRaw=Vt,t.toRef=Gt,t.toRefs=function(t){const e=c(t)?new Array(t.length):{};for(const n in t)e[n]=Gt(t,n);return e},t.track=N,t.trigger=K,t.triggerRef=function(t){Ct(t)},t.unref=Lt,Object.defineProperty(t,"__esModule",{value:!0}),t}({});
{
"name": "@vue/reactivity",
"version": "3.1.5",
"version": "3.2.0-beta.1",
"description": "@vue/reactivity",

@@ -39,4 +39,4 @@ "main": "index.js",

"dependencies": {
"@vue/shared": "3.1.5"
"@vue/shared": "3.2.0-beta.1"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc