Files
discord-decomp/_bundle/Comparator.js
T
2026-11-01 12:12:55 +02:00

138 lines
4.2 KiB
JavaScript

// Metro module 12933 (f12934).
import * as _classCallCheck from "./_classCallCheck";
import * as __createClass from "./_createClass";
import * as _Module12906 from "./Module12906";
import * as _Module12908 from "./Module12908";
import { safeRe, t } from "./Module12909";
import * as _SemVer from "./SemVer";
import * as _Module12931 from "./Module12931";
import * as _Range from "./Range";
let env8921 = {};
const c8921_3 = Symbol("SemVer ANY");
const Comparator = function Comparator(a0, a1) {
"use strict";
_classCallCheck(this, Comparator);
const options = _Module12906(a1);
const r1 = a0 instanceof Comparator;
let r16 = a0;
if (r1) {
if (a0.loose === !!options.loose) {
return a0;
}
r16 = a0.value;
}
const r27 = r16.trim().split(/\s+/).join(" ");
_Module12908("comparator", r27, options);
this.options = options;
this.loose = !!options.loose;
this.parse(r27);
if (this.semver === c8921_3) {
this.value = "";
} else {
this.value = this.operator + this.semver.version;
}
_Module12908("comp", this);
};
module.exports = __createClass(Comparator, [{
key: "parse",
value: function parse(a0) {
"use strict";
let r4, r6, r19;
if (this.options.loose) {
r6 = safeRe[t.COMPARATORLOOSE];
r19 = dependencyMap;
r4 = require;
} else {
r6 = safeRe[t.COMPARATOR];
r19 = dependencyMap;
r4 = require;
}
const r23 = a0.match(r6);
if (r23) {
this.operator = r23[1] !== void 0 ? r23[1] : "";
if (this.operator === "=") {
this.operator = "";
}
if (r23[2]) {
this.semver = new (r4(r19[5]))(r23[2], this.options.loose);
} else {
this.semver = c8921_3;
}
return void 0;
}
throw new TypeError(`Invalid comparator: ${a0}`);
}
}, {
key: "toString",
value: function toString() {
"use strict";
return this.value;
}
}, {
key: "test",
value: function test(a0) {
"use strict";
let r1 = a0;
_Module12908("Comparator.test", a0, this.options.loose);
const semver = this.semver;
if (semver !== c8921_3 && a0 !== c8921_3) {
if (typeof a0 === "string") {
try {
r1 = new _SemVer(a0, this.options);
} catch ($e) {
return false;
}
}
return _Module12931(r1, this.operator, this.semver, this.options);
}
return true;
}
}, {
key: "intersects",
value: function intersects(a0, a1) {
"use strict";
let r35;
if (a0 instanceof Comparator) {
if (this.operator === "") {
r35 = this.value === "" || new _Range(a0.value, a1).test(this.value);
} else if (a0.operator === "") {
r35 = a0.value === "" || new _Range(this.value, a1).test(a0.semver);
} else {
const r16 = _Module12906(a1);
const includePrerelease = r16.includePrerelease;
r35 = includePrerelease ? this.value !== "<0.0.0-0" && a0.value !== "<0.0.0-0" : !includePrerelease;
if (r35) {
const includePrerelease2 = r16.includePrerelease;
const r40 = includePrerelease2 ? !includePrerelease2 : this.value.startsWith("<0.0.0") || a0.value.startsWith("<0.0.0");
let r44 = !r40;
if (!r40) {
const r48 = this.operator.startsWith(">");
const r3 = r48 ? !a0.operator.startsWith(">") : !r48;
let r5 = !r3;
if (r3) {
const r55 = this.operator.startsWith("<");
const r2 = r55 ? !a0.operator.startsWith("<") : !r55;
let r59 = !r2;
if (r2) {
const r0 = this.semver.version !== a0.semver.version || !this.operator.includes("=") || !a0.operator.includes("=");
r59 = r0 ? !!(_Module12931(this.semver, "<", a0.semver, r16) && this.operator.startsWith(">") && a0.operator.startsWith("<")) || !!(_Module12931(this.semver, ">", a0.semver, r16) && this.operator.startsWith("<") && a0.operator.startsWith(">")) : !r0;
}
r5 = r59;
}
r44 = r5;
}
r35 = r44;
}
}
return r35;
}
throw new TypeError("a Comparator is required");
}
}], [{
key: "ANY",
get: function get() {
"use strict";
return c8921_3;
}
}]);