| 1176 | const e = /\s+/g; |
| 1177 | class t { |
| 1178 | constructor(n, o) { |
| 1179 | if (((o = r(o)), n instanceof t)) |
| 1180 | return n.loose === !!o.loose && |
| 1181 | n.includePrerelease === !!o.includePrerelease |
| 1182 | ? n |
| 1183 | : new t(n.raw, o); |
| 1184 | if (n instanceof i) |
| 1185 | return ( |
| 1186 | (this.raw = n.value), |
| 1187 | (this.set = [[n]]), |
| 1188 | (this.formatted = void 0), |
| 1189 | this |
| 1190 | ); |
| 1191 | if ( |
| 1192 | ((this.options = o), |
| 1193 | (this.loose = !!o.loose), |
| 1194 | (this.includePrerelease = !!o.includePrerelease), |
| 1195 | (this.raw = n.trim().replace(e, " ")), |
| 1196 | (this.set = this.raw |
| 1197 | .split("||") |
| 1198 | .map((e) => this.parseRange(e.trim())) |
| 1199 | .filter((e) => e.length)), |
| 1200 | !this.set.length) |
| 1201 | ) |
| 1202 | throw new TypeError(`Invalid SemVer Range: ${this.raw}`); |
| 1203 | if (this.set.length > 1) { |
| 1204 | const e = this.set[0]; |
| 1205 | if ( |
| 1206 | ((this.set = this.set.filter((e) => !h(e[0]))), |
| 1207 | 0 === this.set.length) |
| 1208 | ) |
| 1209 | this.set = [e]; |
| 1210 | else if (this.set.length > 1) |
| 1211 | for (const e of this.set) |
| 1212 | if (1 === e.length && g(e[0])) { |
| 1213 | this.set = [e]; |
| 1214 | break; |
| 1215 | } |
| 1216 | } |
| 1217 | this.formatted = void 0; |
| 1218 | } |
| 1219 | get range() { |
| 1220 | if (void 0 === this.formatted) { |
| 1221 | this.formatted = ""; |