igniteui-react-core
Version:
Ignite UI React Core.
223 lines (222 loc) • 6.87 kB
JavaScript
/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { Base, ICollection_$type, IEnumerable_$type, markType, getEnumeratorObject } from "./type";
import { Group } from "./Group";
import { arrayCopyTo } from "./array";
import { StringBuilder } from "./StringBuilder";
import { netRegexToJS } from "./stringExtended";
/**
* @hidden
*/
export let GroupCollection = /*@__PURE__*/ (() => {
class GroupCollection extends Base {
constructor(a) {
super();
this.f = null;
this.a = null;
this.f = a;
let b = this.f.j;
let c = this.f.p.a;
this.a = new Array((c.length));
for (let d = 0; d < this.a.length; d++) {
let e = (c[d]);
for (let f = 0; f < e.length; f++) {
let g = (b[e[f]]);
if (g != null) {
this.a[d] = new Group(true, -1, g.length, g);
}
}
}
}
get count() {
return this.a.length;
}
get b() {
return true;
}
get isSynchronized() {
return false;
}
get syncRoot() {
return null;
}
item(a) {
return this.a[a] || GroupCollection.c;
}
item1(a) {
return this.item((this.f.p.e[a]));
}
copyTo(a, b) {
arrayCopyTo(this.a, a, b);
}
getEnumeratorObject() {
return getEnumeratorObject(this.a);
}
}
GroupCollection.$t = /*@__PURE__*/ markType(GroupCollection, 'GroupCollection', Base.$, [ICollection_$type, IEnumerable_$type]);
GroupCollection.c = /*@__PURE__*/ new Group(false, -1, 0, "");
return GroupCollection;
})();
/**
* @hidden
*/
export let Match = /*@__PURE__*/ (() => {
class Match extends Group {
constructor(a, b, c) {
super(c != null, c == null ? 0 : (c.index), c == null ? 0 : c[0].length, c == null ? "" : c[0]);
this.j = null;
this.p = null;
this.k = null;
this.l = null;
this.j = c;
this.p = a;
this.k = b;
}
static get n() {
return new Match(null, null, null);
}
get_m() {
if (this.l == null) {
this.l = new GroupCollection(this);
}
return this.l;
}
get m() {
return this.get_m();
}
o() {
if (this.i == false) {
return this;
}
return this.p.j(this.k, this.b + this.d);
}
}
Match.$t = /*@__PURE__*/ markType(Match, 'Match', Group.$);
return Match;
})();
/**
* @hidden
*/
export let Regex = /*@__PURE__*/ (() => {
class Regex extends Base {
constructor(a, b) {
super();
this.d = null;
this.e = null;
this.a = null;
this.c = false;
let c = "g";
if ((b & 1) != 0) {
c += "i";
}
if ((b & 2) != 0) {
c += "m";
}
if ((b & 32) != 0) {
a = a.replace(/\s/g, "");
}
if ((b & 4) != 0) {
let d = a.indexOf('(');
while (d >= 0 && d < a.length) {
let e = (d > 0 && a.charAt(d - 1) == '\\') || (d < a.length - 1 && a.charAt(d + 1) == '?');
if (!e) {
a = a.substr(0, d) + "(?:" + a.substr(d + 1);
}
d = a.indexOf('(', d + 1);
}
}
let f = (netRegexToJS(a));
this.e = f.nameToNetGroupIndexMap;
this.a = (f.netToJSGroupIndexMap);
this.c = (f.matchMustStartAtCurrentPosition);
this.d = new RegExp(f.pattern, c);
}
static f(a) {
for (let b = 0; b < a.length; b++) {
if (Regex.b(a.charAt(b)) == false) {
continue;
}
let c = new StringBuilder(0);
let d = a.charAt(b);
c.m(a, 0, b);
do {
c.h('\\');
switch (d) {
case '\t':
d = 't';
break;
case '\n':
d = 'n';
break;
case '\f':
d = 'f';
break;
case '\r':
d = 'r';
break;
}
c.h(d);
b++;
let e = b;
while (b < a.length) {
d = a.charAt(b);
if (Regex.b(d)) {
break;
}
b++;
}
c.m(a, e, b - e);
} while (b < a.length);
return c.toString();
}
return a;
}
static b(a) {
switch (a.charCodeAt(0)) {
case 9:
case 10:
case 12:
case 13:
case 32:
case 35:
case 36:
case 40:
case 41:
case 42:
case 43:
case 46:
case 63:
case 91:
case 92:
case 94:
case 123:
case 124: return true;
default: return false;
}
}
i(a) {
return this.j(a, 0);
}
j(a, b) {
this.d.lastIndex = b;
let c = (this.d.exec(a));
if (c != null && this.c && b != (c.index)) {
c = null;
}
return new Match(this, a, c);
}
g(a, b) {
return (a.replace(this.d, b));
}
static h(a, b, c, d) {
let e = new Regex(b, d);
return e.g(a, c);
}
}
Regex.$t = /*@__PURE__*/ markType(Regex, 'Regex');
return Regex;
})();