| 1121 | } |
| 1122 | } |
| 1123 | class MutableReactiveHandler extends BaseReactiveHandler { |
| 1124 | constructor(isShallow2 = false) { |
| 1125 | super(false, isShallow2); |
| 1126 | } |
| 1127 | set(target, key, value, receiver) { |
| 1128 | let oldValue = target[key]; |
| 1129 | const isArrayWithIntegerKey = isArray(target) && isIntegerKey(key); |
| 1130 | if (!this._isShallow) { |
| 1131 | const isOldValueReadonly = /* @__PURE__ */ isReadonly(oldValue); |
| 1132 | if (!/* @__PURE__ */ isShallow(value) && !/* @__PURE__ */ isReadonly(value)) { |
| 1133 | oldValue = /* @__PURE__ */ toRaw(oldValue); |
| 1134 | value = /* @__PURE__ */ toRaw(value); |
| 1135 | } |
| 1136 | if (!isArrayWithIntegerKey && /* @__PURE__ */ isRef(oldValue) && !/* @__PURE__ */ isRef(value)) { |
| 1137 | if (isOldValueReadonly) { |
| 1138 | return true; |
| 1139 | } else { |
| 1140 | oldValue.value = value; |
| 1141 | return true; |
| 1142 | } |
| 1143 | } |
| 1144 | } |
| 1145 | const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : hasOwn(target, key); |
| 1146 | const result = Reflect.set( |
| 1147 | target, |
| 1148 | key, |
| 1149 | value, |
| 1150 | /* @__PURE__ */ isRef(target) ? target : receiver |
| 1151 | ); |
| 1152 | if (target === /* @__PURE__ */ toRaw(receiver)) { |
| 1153 | if (!hadKey) { |
| 1154 | trigger(target, "add", key, value); |
| 1155 | } else if (hasChanged(value, oldValue)) { |
| 1156 | trigger(target, "set", key, value); |
| 1157 | } |
| 1158 | } |
| 1159 | return result; |
| 1160 | } |
| 1161 | deleteProperty(target, key) { |
| 1162 | const hadKey = hasOwn(target, key); |
| 1163 | target[key]; |
| 1164 | const result = Reflect.deleteProperty(target, key); |
| 1165 | if (result && hadKey) { |
| 1166 | trigger(target, "delete", key, void 0); |
| 1167 | } |
| 1168 | return result; |
| 1169 | } |
| 1170 | has(target, key) { |
| 1171 | const result = Reflect.has(target, key); |
| 1172 | if (!isSymbol(key) || !builtInSymbols.has(key)) { |
| 1173 | track(target, "has", key); |
| 1174 | } |
| 1175 | return result; |
| 1176 | } |
| 1177 | ownKeys(target) { |
| 1178 | track( |
| 1179 | target, |
| 1180 | "iterate", |
nothing calls this directly
no outgoing calls
no test coverage detected