Files
discord-decomp/lib/Record.tsx
T
2026-11-01 12:12:55 +02:00

139 lines
2.8 KiB
TypeScript

// Metro module 1883 (f1884).
class Record {
constructor() {
return {
__proto__: new.target.prototype
};
}
toJS() {
return {
...this
};
}
set(a0, a1) {
let r16;
L6: {
const r3 = this[a0];
if (a1 instanceof Date && r3 instanceof Date) {
const time = a1.getTime();
const time2 = r3.getTime();
r16 = this;
if (time === time2) {
break L6;
}
}
let r17 = this;
if (r3 !== a1) {
const constructor = this.constructor;
const r19 = {
...this
};
r19[a0] = a1;
r17 = new constructor(r19);
}
r16 = r17;
}
return r16;
}
merge(a0) {
let r15;
let r5 = null;
let r8 = null;
for (const key in a0) {
r15 = r5;
r8 = r15;
const hasOwnProperty = a0.hasOwnProperty(key);
r5 = r15;
if (hasOwnProperty) {
const r17 = this[key];
const r14 = a0[key];
const r2 = r14 instanceof Date && r17 instanceof Date && r14.getTime() === r17.getTime();
r5 = r15;
if (!r2) {
let r28 = r15;
if (r17 !== r14) {
const r29 = r15 == null ? {
...this
} : r15;
r29[key] = a0[key];
r28 = r29;
}
r5 = r28;
}
}
}
r15 = r5;
r8 = r15;
return r8 != null ? new this.constructor(r8) : this;
}
update(a0, a1, a2) {
let r6 = a2;
let r3 = a1;
if (a2 == null) {
r3 = void 0;
r6 = a1;
}
const r9 = this[a0];
let r17 = r9 instanceof Record ? r9 : r9 instanceof Array ? [...r9] : r9 instanceof Object ? {
...r9
} : r9;
if (r17 === void 0) {
r17 = r3;
}
return this.set(a0, r6(r17));
}
}
export default Record;
export class TypedRecord {
constructor() {
return {
__proto__: new.target.prototype
};
}
toJS() {
return {
...this
};
}
set(a0, a1) {
const merge2 = this.merge;
const r0 = {};
r0[a0] = a1;
return merge2.call(this, r0);
}
merge(a0) {
let r11;
let r3 = null;
let r6 = null;
for (const key in a0) {
r11 = r3;
r6 = r11;
const hasOwnProperty = a0.hasOwnProperty(key);
r3 = r11;
if (hasOwnProperty) {
const r13 = a0[key];
const r17 = this[key];
r3 = r11;
if (r17 !== r13) {
const r18 = r11 == null ? this.toJS() : r11;
r18[key] = a0[key];
r3 = r18;
}
}
}
r11 = r3;
r6 = r11;
return r6 != null ? new this.constructor(r6) : this;
}
update(a0, a1, a2) {
const r7 = this[a0];
let r6 = r7 instanceof Record ? r7 : r7 instanceof Array ? [...r7] : r7 instanceof Object ? {
...r7
} : r7;
if (r6 === void 0) {
r6 = a1;
}
return this.set(a0, a2(r6));
}
}