@geodaoyu/accessor
Version:
mini @arcgis/core/core/Accessor & @arcgis/core/core/reactiveUtils
934 lines (933 loc) • 25.2 kB
JavaScript
// @__NO_SIDE_EFFECTS__
function $t(t) {
const e = /* @__PURE__ */ Object.create(null);
for (const n of t.split(",")) e[n] = 1;
return (n) => n in e;
}
const Ct = process.env.NODE_ENV !== "production" ? Object.freeze({}) : {};
process.env.NODE_ENV !== "production" && Object.freeze([]);
const Bt = () => {
}, ot = Object.assign, zt = Object.prototype.hasOwnProperty, ct = (t, e) => zt.call(t, e), j = Array.isArray, P = (t) => et(t) === "[object Map]", Yt = (t) => et(t) === "[object Set]", Et = (t) => typeof t == "function", Ft = (t) => typeof t == "string", F = (t) => typeof t == "symbol", K = (t) => t !== null && typeof t == "object", Gt = Object.prototype.toString, et = (t) => Gt.call(t), Nt = (t) => et(t).slice(8, -1), Ut = (t) => et(t) === "[object Object]", ht = (t) => Ft(t) && t !== "NaN" && t[0] !== "-" && "" + parseInt(t, 10) === t, Jt = (t) => {
const e = /* @__PURE__ */ Object.create(null);
return ((n) => e[n] || (e[n] = t(n)));
}, Qt = Jt((t) => t.charAt(0).toUpperCase() + t.slice(1)), T = (t, e) => !Object.is(t, e);
function S(t, ...e) {
console.warn(`[Vue warn] ${t}`, ...e);
}
let u;
const rt = /* @__PURE__ */ new WeakSet();
class qt {
constructor(e) {
this.fn = e, this.deps = void 0, this.depsTail = void 0, this.flags = 5, this.next = void 0, this.cleanup = void 0, this.scheduler = void 0;
}
pause() {
this.flags |= 64;
}
resume() {
this.flags & 64 && (this.flags &= -65, rt.has(this) && (rt.delete(this), this.trigger()));
}
/**
* @internal
*/
notify() {
this.flags & 2 && !(this.flags & 32) || this.flags & 8 || Xt(this);
}
run() {
if (!(this.flags & 1))
return this.fn();
this.flags |= 2, St(this), mt(this);
const e = u, n = g;
u = this, g = !0;
try {
return this.fn();
} finally {
process.env.NODE_ENV !== "production" && u !== this && S(
"Active effect was not restored correctly - this is likely a Vue internal bug."
), Tt(this), u = e, g = n, this.flags &= -3;
}
}
stop() {
if (this.flags & 1) {
for (let e = this.deps; e; e = e.nextDep)
_t(e);
this.deps = this.depsTail = void 0, St(this), this.onStop && this.onStop(), this.flags &= -2;
}
}
trigger() {
this.flags & 64 ? rt.add(this) : this.scheduler ? this.scheduler() : this.runIfDirty();
}
/**
* @internal
*/
runIfDirty() {
at(this) && this.run();
}
get dirty() {
return at(this);
}
}
let xt = 0, $, C;
function Xt(t, e = !1) {
if (t.flags |= 8, e) {
t.next = C, C = t;
return;
}
t.next = $, $ = t;
}
function dt() {
xt++;
}
function vt() {
if (--xt > 0)
return;
if (C) {
let e = C;
for (C = void 0; e; ) {
const n = e.next;
e.next = void 0, e.flags &= -9, e = n;
}
}
let t;
for (; $; ) {
let e = $;
for ($ = void 0; e; ) {
const n = e.next;
if (e.next = void 0, e.flags &= -9, e.flags & 1)
try {
e.trigger();
} catch (s) {
t || (t = s);
}
e = n;
}
}
if (t) throw t;
}
function mt(t) {
for (let e = t.deps; e; e = e.nextDep)
e.version = -1, e.prevActiveLink = e.dep.activeLink, e.dep.activeLink = e;
}
function Tt(t) {
let e, n = t.depsTail, s = n;
for (; s; ) {
const r = s.prevDep;
s.version === -1 ? (s === n && (n = r), _t(s), kt(s)) : e = s, s.dep.activeLink = s.prevActiveLink, s.prevActiveLink = void 0, s = r;
}
t.deps = e, t.depsTail = n;
}
function at(t) {
for (let e = t.deps; e; e = e.nextDep)
if (e.dep.version !== e.version || e.dep.computed && (Zt(e.dep.computed) || e.dep.version !== e.version))
return !0;
return !!t._dirty;
}
function Zt(t) {
if (t.flags & 4 && !(t.flags & 16) || (t.flags &= -17, t.globalVersion === k) || (t.globalVersion = k, !t.isSSR && t.flags & 128 && (!t.deps && !t._dirty || !at(t))))
return;
t.flags |= 2;
const e = t.dep, n = u, s = g;
u = t, g = !0;
try {
mt(t);
const r = t.fn(t._value);
(e.version === 0 || T(r, t._value)) && (t.flags |= 128, t._value = r, e.version++);
} catch (r) {
throw e.version++, r;
} finally {
u = n, g = s, Tt(t), t.flags &= -3;
}
}
function _t(t, e = !1) {
const { dep: n, prevSub: s, nextSub: r } = t;
if (s && (s.nextSub = r, t.prevSub = void 0), r && (r.prevSub = s, t.nextSub = void 0), process.env.NODE_ENV !== "production" && n.subsHead === t && (n.subsHead = r), n.subs === t && (n.subs = s, !s && n.computed)) {
n.computed.flags &= -5;
for (let i = n.computed.deps; i; i = i.nextDep)
_t(i, !0);
}
!e && !--n.sc && n.map && n.map.delete(n.key);
}
function kt(t) {
const { prevDep: e, nextDep: n } = t;
e && (e.nextDep = n, t.prevDep = void 0), n && (n.prevDep = e, t.nextDep = void 0);
}
let g = !0;
const Rt = [];
function jt() {
Rt.push(g), g = !1;
}
function Vt() {
const t = Rt.pop();
g = t === void 0 ? !0 : t;
}
function St(t) {
const { cleanup: e } = t;
if (t.cleanup = void 0, e) {
const n = u;
u = void 0;
try {
e();
} finally {
u = n;
}
}
}
let k = 0;
class te {
constructor(e, n) {
this.sub = e, this.dep = n, this.version = n.version, this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
}
}
class ee {
// TODO isolatedDeclarations "__v_skip"
constructor(e) {
this.computed = e, this.version = 0, this.activeLink = void 0, this.subs = void 0, this.map = void 0, this.key = void 0, this.sc = 0, this.__v_skip = !0, process.env.NODE_ENV !== "production" && (this.subsHead = void 0);
}
track(e) {
if (!u || !g || u === this.computed)
return;
let n = this.activeLink;
if (n === void 0 || n.sub !== u)
n = this.activeLink = new te(u, this), u.deps ? (n.prevDep = u.depsTail, u.depsTail.nextDep = n, u.depsTail = n) : u.deps = u.depsTail = n, It(n);
else if (n.version === -1 && (n.version = this.version, n.nextDep)) {
const s = n.nextDep;
s.prevDep = n.prevDep, n.prevDep && (n.prevDep.nextDep = s), n.prevDep = u.depsTail, n.nextDep = void 0, u.depsTail.nextDep = n, u.depsTail = n, u.deps === n && (u.deps = s);
}
return process.env.NODE_ENV !== "production" && u.onTrack && u.onTrack(
ot(
{
effect: u
},
e
)
), n;
}
trigger(e) {
this.version++, k++, this.notify(e);
}
notify(e) {
dt();
try {
if (process.env.NODE_ENV !== "production")
for (let n = this.subsHead; n; n = n.nextSub)
n.sub.onTrigger && !(n.sub.flags & 8) && n.sub.onTrigger(
ot(
{
effect: n.sub
},
e
)
);
for (let n = this.subs; n; n = n.prevSub)
n.sub.notify() && n.sub.dep.notify();
} finally {
vt();
}
}
}
function It(t) {
if (t.dep.sc++, t.sub.flags & 4) {
const e = t.dep.computed;
if (e && !t.dep.subs) {
e.flags |= 20;
for (let s = e.deps; s; s = s.nextDep)
It(s);
}
const n = t.dep.subs;
n !== t && (t.prevSub = n, n && (n.nextSub = t)), process.env.NODE_ENV !== "production" && t.dep.subsHead === void 0 && (t.dep.subsHead = t), t.dep.subs = t;
}
}
const ft = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ Symbol(
process.env.NODE_ENV !== "production" ? "Object iterate" : ""
), lt = /* @__PURE__ */ Symbol(
process.env.NODE_ENV !== "production" ? "Map keys iterate" : ""
), z = /* @__PURE__ */ Symbol(
process.env.NODE_ENV !== "production" ? "Array iterate" : ""
);
function _(t, e, n) {
if (g && u) {
let s = ft.get(t);
s || ft.set(t, s = /* @__PURE__ */ new Map());
let r = s.get(n);
r || (s.set(n, r = new ee()), r.map = s, r.key = n), process.env.NODE_ENV !== "production" ? r.track({
target: t,
type: e,
key: n
}) : r.track();
}
}
function O(t, e, n, s, r, i) {
const o = ft.get(t);
if (!o) {
k++;
return;
}
const c = (a) => {
a && (process.env.NODE_ENV !== "production" ? a.trigger({
target: t,
type: e,
key: n,
newValue: s,
oldValue: r,
oldTarget: i
}) : a.trigger());
};
if (dt(), e === "clear")
o.forEach(c);
else {
const a = j(t), p = a && ht(n);
if (a && n === "length") {
const v = Number(s);
o.forEach((f, d) => {
(d === "length" || d === z || !F(d) && d >= v) && c(f);
});
} else
switch ((n !== void 0 || o.has(void 0)) && c(o.get(n)), p && c(o.get(z)), e) {
case "add":
a ? p && c(o.get("length")) : (c(o.get(R)), P(t) && c(o.get(lt)));
break;
case "delete":
a || (c(o.get(R)), P(t) && c(o.get(lt)));
break;
case "set":
P(t) && c(o.get(R));
break;
}
}
vt();
}
function A(t) {
const e = h(t);
return e === t ? e : (_(e, "iterate", z), w(t) ? e : e.map(I));
}
function gt(t) {
return _(t = h(t), "iterate", z), t;
}
function y(t, e) {
return V(t) ? B(t) ? Y(I(e)) : Y(e) : I(e);
}
const ne = {
__proto__: null,
[Symbol.iterator]() {
return st(this, Symbol.iterator, (t) => y(this, t));
},
concat(...t) {
return A(this).concat(
...t.map((e) => j(e) ? A(e) : e)
);
},
entries() {
return st(this, "entries", (t) => (t[1] = y(this, t[1]), t));
},
every(t, e) {
return E(this, "every", t, e, void 0, arguments);
},
filter(t, e) {
return E(
this,
"filter",
t,
e,
(n) => n.map((s) => y(this, s)),
arguments
);
},
find(t, e) {
return E(
this,
"find",
t,
e,
(n) => y(this, n),
arguments
);
},
findIndex(t, e) {
return E(this, "findIndex", t, e, void 0, arguments);
},
findLast(t, e) {
return E(
this,
"findLast",
t,
e,
(n) => y(this, n),
arguments
);
},
findLastIndex(t, e) {
return E(this, "findLastIndex", t, e, void 0, arguments);
},
// flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
forEach(t, e) {
return E(this, "forEach", t, e, void 0, arguments);
},
includes(...t) {
return it(this, "includes", t);
},
indexOf(...t) {
return it(this, "indexOf", t);
},
join(t) {
return A(this).join(t);
},
// keys() iterator only reads `length`, no optimization required
lastIndexOf(...t) {
return it(this, "lastIndexOf", t);
},
map(t, e) {
return E(this, "map", t, e, void 0, arguments);
},
pop() {
return H(this, "pop");
},
push(...t) {
return H(this, "push", t);
},
reduce(t, ...e) {
return yt(this, "reduce", t, e);
},
reduceRight(t, ...e) {
return yt(this, "reduceRight", t, e);
},
shift() {
return H(this, "shift");
},
// slice could use ARRAY_ITERATE but also seems to beg for range tracking
some(t, e) {
return E(this, "some", t, e, void 0, arguments);
},
splice(...t) {
return H(this, "splice", t);
},
toReversed() {
return A(this).toReversed();
},
toSorted(t) {
return A(this).toSorted(t);
},
toSpliced(...t) {
return A(this).toSpliced(...t);
},
unshift(...t) {
return H(this, "unshift", t);
},
values() {
return st(this, "values", (t) => y(this, t));
}
};
function st(t, e, n) {
const s = gt(t), r = s[e]();
return s !== t && !w(t) && (r._next = r.next, r.next = () => {
const i = r._next();
return i.done || (i.value = n(i.value)), i;
}), r;
}
const re = Array.prototype;
function E(t, e, n, s, r, i) {
const o = gt(t), c = o !== t && !w(t), a = o[e];
if (a !== re[e]) {
const f = a.apply(t, i);
return c ? I(f) : f;
}
let p = n;
o !== t && (c ? p = function(f, d) {
return n.call(this, y(t, f), d, t);
} : n.length > 2 && (p = function(f, d) {
return n.call(this, f, d, t);
}));
const v = a.call(o, p, s);
return c && r ? r(v) : v;
}
function yt(t, e, n, s) {
const r = gt(t);
let i = n;
return r !== t && (w(t) ? n.length > 3 && (i = function(o, c, a) {
return n.call(this, o, c, a, t);
}) : i = function(o, c, a) {
return n.call(this, o, y(t, c), a, t);
}), r[e](i, ...s);
}
function it(t, e, n) {
const s = h(t);
_(s, "iterate", z);
const r = s[e](...n);
return (r === -1 || r === !1) && we(n[0]) ? (n[0] = h(n[0]), s[e](...n)) : r;
}
function H(t, e, n = []) {
jt(), dt();
const s = h(t)[e].apply(t, n);
return vt(), Vt(), s;
}
const se = /* @__PURE__ */ $t("__proto__,__v_isRef,__isVue"), Mt = new Set(
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((t) => t !== "arguments" && t !== "caller").map((t) => Symbol[t]).filter(F)
);
function ie(t) {
F(t) || (t = String(t));
const e = h(this);
return _(e, "has", t), e.hasOwnProperty(t);
}
class At {
constructor(e = !1, n = !1) {
this._isReadonly = e, this._isShallow = n;
}
get(e, n, s) {
if (n === "__v_skip") return e.__v_skip;
const r = this._isReadonly, i = this._isShallow;
if (n === "__v_isReactive")
return !r;
if (n === "__v_isReadonly")
return r;
if (n === "__v_isShallow")
return i;
if (n === "__v_raw")
return s === (r ? i ? ve : Wt : i ? Lt : Kt).get(e) || // receiver is not the reactive proxy, but has the same prototype
// this means the receiver is a user proxy of the reactive proxy
Object.getPrototypeOf(e) === Object.getPrototypeOf(s) ? e : void 0;
const o = j(e);
if (!r) {
let a;
if (o && (a = ne[n]))
return a;
if (n === "hasOwnProperty")
return ie;
}
const c = Reflect.get(
e,
n,
// if this is a proxy wrapping a ref, return methods using the raw ref
// as receiver so that we don't have to call `toRaw` on the ref in all
// its class methods
N(e) ? e : s
);
if ((F(n) ? Mt.has(n) : se(n)) || (r || _(e, "get", n), i))
return c;
if (N(c)) {
const a = o && ht(n) ? c : c.value;
return r && K(a) ? pt(a) : a;
}
return K(c) ? r ? pt(c) : Ht(c) : c;
}
}
class Pt extends At {
constructor(e = !1) {
super(!1, e);
}
set(e, n, s, r) {
let i = e[n];
const o = j(e) && ht(n);
if (!this._isShallow) {
const p = V(i);
if (!w(s) && !V(s) && (i = h(i), s = h(s)), !o && N(i) && !N(s))
return p ? (process.env.NODE_ENV !== "production" && S(
`Set operation on key "${String(n)}" failed: target is readonly.`,
e[n]
), !0) : (i.value = s, !0);
}
const c = o ? Number(n) < e.length : ct(e, n), a = Reflect.set(
e,
n,
s,
N(e) ? e : r
);
return e === h(r) && (c ? T(s, i) && O(e, "set", n, s, i) : O(e, "add", n, s)), a;
}
deleteProperty(e, n) {
const s = ct(e, n), r = e[n], i = Reflect.deleteProperty(e, n);
return i && s && O(e, "delete", n, void 0, r), i;
}
has(e, n) {
const s = Reflect.has(e, n);
return (!F(n) || !Mt.has(n)) && _(e, "has", n), s;
}
ownKeys(e) {
return _(
e,
"iterate",
j(e) ? "length" : R
), Reflect.ownKeys(e);
}
}
class oe extends At {
constructor(e = !1) {
super(!0, e);
}
set(e, n) {
return process.env.NODE_ENV !== "production" && S(
`Set operation on key "${String(n)}" failed: target is readonly.`,
e
), !0;
}
deleteProperty(e, n) {
return process.env.NODE_ENV !== "production" && S(
`Delete operation on key "${String(n)}" failed: target is readonly.`,
e
), !0;
}
}
const ce = /* @__PURE__ */ new Pt(), ae = /* @__PURE__ */ new oe(), fe = /* @__PURE__ */ new Pt(!0), ut = (t) => t, q = (t) => Reflect.getPrototypeOf(t);
function le(t, e, n) {
return function(...s) {
const r = this.__v_raw, i = h(r), o = P(i), c = t === "entries" || t === Symbol.iterator && o, a = t === "keys" && o, p = r[t](...s), v = n ? ut : e ? Y : I;
return !e && _(
i,
"iterate",
a ? lt : R
), {
// iterator protocol
next() {
const { value: f, done: d } = p.next();
return d ? { value: f, done: d } : {
value: c ? [v(f[0]), v(f[1])] : v(f),
done: d
};
},
// iterable protocol
[Symbol.iterator]() {
return this;
}
};
};
}
function X(t) {
return function(...e) {
if (process.env.NODE_ENV !== "production") {
const n = e[0] ? `on key "${e[0]}" ` : "";
S(
`${Qt(t)} operation ${n}failed: target is readonly.`,
h(this)
);
}
return t === "delete" ? !1 : t === "clear" ? void 0 : this;
};
}
function ue(t, e) {
const n = {
get(r) {
const i = this.__v_raw, o = h(i), c = h(r);
t || (T(r, c) && _(o, "get", r), _(o, "get", c));
const { has: a } = q(o), p = e ? ut : t ? Y : I;
if (a.call(o, r))
return p(i.get(r));
if (a.call(o, c))
return p(i.get(c));
i !== o && i.get(r);
},
get size() {
const r = this.__v_raw;
return !t && _(h(r), "iterate", R), r.size;
},
has(r) {
const i = this.__v_raw, o = h(i), c = h(r);
return t || (T(r, c) && _(o, "has", r), _(o, "has", c)), r === c ? i.has(r) : i.has(r) || i.has(c);
},
forEach(r, i) {
const o = this, c = o.__v_raw, a = h(c), p = e ? ut : t ? Y : I;
return !t && _(a, "iterate", R), c.forEach((v, f) => r.call(i, p(v), p(f), o));
}
};
return ot(
n,
t ? {
add: X("add"),
set: X("set"),
delete: X("delete"),
clear: X("clear")
} : {
add(r) {
!e && !w(r) && !V(r) && (r = h(r));
const i = h(this);
return q(i).has.call(i, r) || (i.add(r), O(i, "add", r, r)), this;
},
set(r, i) {
!e && !w(i) && !V(i) && (i = h(i));
const o = h(this), { has: c, get: a } = q(o);
let p = c.call(o, r);
p ? process.env.NODE_ENV !== "production" && Ot(o, c, r) : (r = h(r), p = c.call(o, r));
const v = a.call(o, r);
return o.set(r, i), p ? T(i, v) && O(o, "set", r, i, v) : O(o, "add", r, i), this;
},
delete(r) {
const i = h(this), { has: o, get: c } = q(i);
let a = o.call(i, r);
a ? process.env.NODE_ENV !== "production" && Ot(i, o, r) : (r = h(r), a = o.call(i, r));
const p = c ? c.call(i, r) : void 0, v = i.delete(r);
return a && O(i, "delete", r, void 0, p), v;
},
clear() {
const r = h(this), i = r.size !== 0, o = process.env.NODE_ENV !== "production" ? P(r) ? new Map(r) : new Set(r) : void 0, c = r.clear();
return i && O(
r,
"clear",
void 0,
void 0,
o
), c;
}
}
), [
"keys",
"values",
"entries",
Symbol.iterator
].forEach((r) => {
n[r] = le(r, t, e);
}), n;
}
function bt(t, e) {
const n = ue(t, e);
return (s, r, i) => r === "__v_isReactive" ? !t : r === "__v_isReadonly" ? t : r === "__v_raw" ? s : Reflect.get(
ct(n, r) && r in s ? n : s,
r,
i
);
}
const pe = {
get: /* @__PURE__ */ bt(!1, !1)
}, he = {
get: /* @__PURE__ */ bt(!1, !0)
}, de = {
get: /* @__PURE__ */ bt(!0, !1)
};
function Ot(t, e, n) {
const s = h(n);
if (s !== n && e.call(t, s)) {
const r = Nt(t);
S(
`Reactive ${r} contains both the raw and reactive versions of the same object${r === "Map" ? " as keys" : ""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`
);
}
}
const Kt = /* @__PURE__ */ new WeakMap(), Lt = /* @__PURE__ */ new WeakMap(), Wt = /* @__PURE__ */ new WeakMap(), ve = /* @__PURE__ */ new WeakMap();
function _e(t) {
switch (t) {
case "Object":
case "Array":
return 1;
case "Map":
case "Set":
case "WeakMap":
case "WeakSet":
return 2;
default:
return 0;
}
}
function ge(t) {
return t.__v_skip || !Object.isExtensible(t) ? 0 : _e(Nt(t));
}
function Ht(t) {
return V(t) ? t : wt(
t,
!1,
ce,
pe,
Kt
);
}
function be(t) {
return wt(
t,
!1,
fe,
he,
Lt
);
}
function pt(t) {
return wt(
t,
!0,
ae,
de,
Wt
);
}
function wt(t, e, n, s, r) {
if (!K(t))
return process.env.NODE_ENV !== "production" && S(
`value cannot be made ${e ? "readonly" : "reactive"}: ${String(
t
)}`
), t;
if (t.__v_raw && !(e && t.__v_isReactive))
return t;
const i = ge(t);
if (i === 0)
return t;
const o = r.get(t);
if (o)
return o;
const c = new Proxy(
t,
i === 2 ? s : n
);
return r.set(t, c), c;
}
function B(t) {
return V(t) ? B(t.__v_raw) : !!(t && t.__v_isReactive);
}
function V(t) {
return !!(t && t.__v_isReadonly);
}
function w(t) {
return !!(t && t.__v_isShallow);
}
function we(t) {
return t ? !!t.__v_raw : !1;
}
function h(t) {
const e = t && t.__v_raw;
return e ? h(e) : t;
}
const I = (t) => K(t) ? Ht(t) : t, Y = (t) => K(t) ? pt(t) : t;
function N(t) {
return t ? t.__v_isRef === !0 : !1;
}
const Z = {}, tt = /* @__PURE__ */ new WeakMap();
let m;
function Ee(t, e = !1, n = m) {
if (n) {
let s = tt.get(n);
s || tt.set(n, s = []), s.push(t);
} else process.env.NODE_ENV !== "production" && !e && S(
"onWatcherCleanup() was called when there was no active watcher to associate with."
);
}
function Dt(t, e, n = Ct) {
const { immediate: s, deep: r, once: i, scheduler: o, augmentJob: c, call: a } = n, p = (l) => {
(n.onWarn || S)(
"Invalid watch source: ",
l,
"A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types."
);
}, v = (l) => r ? l : w(l) || r === !1 || r === 0 ? D(l, 1) : D(l);
let f, d, L, G, U = !1, J = !1;
if (N(t) ? (d = () => t.value, U = w(t)) : B(t) ? (d = () => v(t), U = !0) : j(t) ? (J = !0, U = t.some((l) => B(l) || w(l)), d = () => t.map((l) => {
if (N(l))
return l.value;
if (B(l))
return v(l);
if (Et(l))
return a ? a(l, 2) : l();
process.env.NODE_ENV !== "production" && p(l);
})) : Et(t) ? e ? d = a ? () => a(t, 2) : t : d = () => {
if (L) {
jt();
try {
L();
} finally {
Vt();
}
}
const l = m;
m = f;
try {
return a ? a(t, 3, [G]) : t(G);
} finally {
m = l;
}
} : (d = Bt, process.env.NODE_ENV !== "production" && p(t)), e && r) {
const l = d, b = r === !0 ? 1 / 0 : r;
d = () => D(l(), b);
}
const M = () => {
f.stop();
};
if (i && e) {
const l = e;
e = (...b) => {
l(...b), M();
};
}
let x = J ? new Array(t.length).fill(Z) : Z;
const W = (l) => {
if (!(!(f.flags & 1) || !f.dirty && !l))
if (e) {
const b = f.run();
if (r || U || (J ? b.some((nt, Q) => T(nt, x[Q])) : T(b, x))) {
L && L();
const nt = m;
m = f;
try {
const Q = [
b,
// pass undefined as the old value when it's changed for the first time
x === Z ? void 0 : J && x[0] === Z ? [] : x,
G
];
x = b, a ? a(e, 3, Q) : (
// @ts-expect-error
e(...Q)
);
} finally {
m = nt;
}
}
} else
f.run();
};
return c && c(W), f = new qt(d), f.scheduler = o ? () => o(W, !1) : W, G = (l) => Ee(l, !1, f), L = f.onStop = () => {
const l = tt.get(f);
if (l) {
if (a)
a(l, 4);
else
for (const b of l) b();
tt.delete(f);
}
}, process.env.NODE_ENV !== "production" && (f.onTrack = n.onTrack, f.onTrigger = n.onTrigger), e ? s ? W(!0) : x = f.run() : o ? o(W.bind(null, !0), !0) : f.run(), M.pause = f.pause.bind(f), M.resume = f.resume.bind(f), M.stop = M, M;
}
function D(t, e = 1 / 0, n) {
if (e <= 0 || !K(t) || t.__v_skip || (n = n || /* @__PURE__ */ new Map(), (n.get(t) || 0) >= e))
return t;
if (n.set(t, e), e--, N(t))
D(t.value, e, n);
else if (j(t))
for (let s = 0; s < t.length; s++)
D(t[s], e, n);
else if (Yt(t) || P(t))
t.forEach((s) => {
D(s, e, n);
});
else if (Ut(t)) {
for (const s in t)
D(t[s], e, n);
for (const s of Object.getOwnPropertySymbols(t))
Object.prototype.propertyIsEnumerable.call(t, s) && D(t[s], e, n);
}
return t;
}
class Se {
constructor(e) {
return e && Object.assign(this, e), be(this);
}
set(e, n) {
const s = (o, c) => {
this[o] = c;
};
return typeof e == "string" ? ((o, c) => {
const [a, ...p] = o.split(".");
p.length === 0 ? s(a, c) : this[a]?.set(p.join("."), c);
})(e, n) : typeof e == "object" && ((o) => {
Object.entries(o).forEach(([c, a]) => s(c, a));
})(e), this;
}
}
const ye = {
watch: (...t) => {
const e = Dt(...t);
return {
...e,
remove: e.stop
};
},
once: (t) => new Promise((e) => {
const n = Dt(t, (s) => {
s && (e(s), n.stop());
});
})
};
export {
Se as Accessor,
ye as reactiveUtils
};