igniteui-react-core
Version:
Ignite UI React Core.
1,498 lines • 96.5 kB
JavaScript
//
// System.Xml.XmlTextReader
//
// Author:
// Jason Diamond (jason@injektilo.org)
// Adam Treat (manyoso@yahoo.com)
// Atsushi Enomoto (ginga@kit.hi-ho.ne.jp)
//
// (C) 2001, 2002 Jason Diamond http://injektilo.org/
// Copyright (C) 2005-2006 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//#define USE_NAME_BUFFER
//
// Optimization TODOs:
//
// - support PushbackChar() which reverts one character read.
// - ReadTextReader() should always keep one pushback buffer
// as pushback safety net.
// - Replace (peek,read) * n -> read * n + pushback
//
import { Base, markType, Stream, typeCast, enumGetBox } from "./type";
import { DTDObjectModel } from "./DTDObjectModel";
import { Encoding } from "./Encoding";
import { XmlNamespaceManager } from "./XmlNamespaceManager";
import { TextReader } from "./TextReader";
import { arrayListCreate, arrayCopyTo } from "./array";
import { XmlParserContext_ContextItem } from "./XmlParserContext_ContextItem";
import { XmlException } from "./XmlException";
import { stringEmpty, stringCreateFromCharArraySlice, stringReplace, stringIsNullOrEmpty, charMaxValue, stringToLocaleLower, stringCreateFromCharArray, stringConcat } from "./string";
import { XmlReader } from "./XmlReader";
import { XmlNodeType_$type } from "./xml";
import { InvalidOperationException } from "./InvalidOperationException";
import { XmlTextReader_DtdInputStateStack } from "./XmlTextReader_DtdInputStateStack";
import { XmlUrlResolver } from "./XmlUrlResolver";
import { XmlStreamReader } from "./XmlStreamReader";
import { NameTable } from "./NameTable";
import { StringReader } from "./StringReader";
import { Uri } from "./Uri";
import { ArgumentOutOfRangeException } from "./ArgumentOutOfRangeException";
import { IXmlLineInfo_$type } from "./IXmlLineInfo";
import { XmlTextReader_TagName } from "./XmlTextReader_TagName";
import { StringBuilder } from "./StringBuilder";
import { XmlChar } from "./XmlChar";
import { CultureInfo } from "./culture";
import { intDivide } from "./number";
import { stringFormat, stringFormat2, stringCompare1 } from "./stringExtended";
import { arrayCopy1 } from "./arrayExtended";
/**
* @hidden
*/
export let XmlParserContext = /*@__PURE__*/ (() => {
class XmlParserContext extends Base {
constructor(a, ..._rest) {
super();
this.c = stringEmpty();
this.e = stringEmpty();
this.o = null;
this.g = stringEmpty();
this.u = null;
this.w = null;
this.i = stringEmpty();
this.k = stringEmpty();
this.m = stringEmpty();
this.y = 0;
this.a = null;
this.b = 0;
this.s = null;
a = (a == void 0) ? 0 : a;
switch (a) {
case 0:
{
let c = _rest[0];
let d = _rest[1];
let e = _rest[2];
let f = _rest[3];
let g = [c, d, null, null, null, null, null, e, f, null];
{
let i = g[0];
let j = g[1];
let k = g[2];
let l = g[3];
let m = g[4];
let n = g[5];
let o = g[6];
let p = g[7];
let q = g[8];
let r = g[9];
let s = [i, j, (k != null && k != stringEmpty()) ? new XmlTextReader(9, TextReader.e, i).d8(k, l, m, n) : null, o, p, q, r];
{
let u = s[0];
let v = s[1];
let w = s[2];
let x = s[3];
let y = s[4];
let z = s[5];
let aa = s[6];
this.u = v;
this.w = u != null ? u : v != null ? v.ag : null;
if (w != null) {
this.f = w.b;
this.j = w.c;
this.l = w.d;
this.h = w.a;
this.s = w;
}
this.o = aa;
this.d = x;
this.n = y;
this.y = z;
this.a = arrayListCreate();
}
}
}
break;
case 1:
{
let c = _rest[0];
let d = _rest[1];
let e = _rest[2];
let f = _rest[3];
let g = _rest[4];
let h = [c, d, null, null, null, null, null, e, f, g];
{
let j = h[0];
let k = h[1];
let l = h[2];
let m = h[3];
let n = h[4];
let o = h[5];
let p = h[6];
let q = h[7];
let r = h[8];
let s = h[9];
let t = [j, k, (l != null && l != stringEmpty()) ? new XmlTextReader(9, TextReader.e, j).d8(l, m, n, o) : null, p, q, r, s];
{
let v = t[0];
let w = t[1];
let x = t[2];
let y = t[3];
let z = t[4];
let aa = t[5];
let ab = t[6];
this.u = w;
this.w = v != null ? v : w != null ? w.ag : null;
if (x != null) {
this.f = x.b;
this.j = x.c;
this.l = x.d;
this.h = x.a;
this.s = x;
}
this.o = ab;
this.d = y;
this.n = z;
this.y = aa;
this.a = arrayListCreate();
}
}
}
break;
case 2:
{
let c = _rest[0];
let d = _rest[1];
let e = _rest[2];
let f = _rest[3];
let g = _rest[4];
let h = _rest[5];
let i = _rest[6];
let j = _rest[7];
let k = _rest[8];
let l = [c, d, e, f, g, h, i, j, k, null];
{
let n = l[0];
let o = l[1];
let p = l[2];
let q = l[3];
let r = l[4];
let s = l[5];
let t = l[6];
let u = l[7];
let v = l[8];
let w = l[9];
let x = [n, o, (p != null && p != stringEmpty()) ? new XmlTextReader(9, TextReader.e, n).d8(p, q, r, s) : null, t, u, v, w];
{
let z = x[0];
let aa = x[1];
let ab = x[2];
let ac = x[3];
let ad = x[4];
let ae = x[5];
let af = x[6];
this.u = aa;
this.w = z != null ? z : aa != null ? aa.ag : null;
if (ab != null) {
this.f = ab.b;
this.j = ab.c;
this.l = ab.d;
this.h = ab.a;
this.s = ab;
}
this.o = af;
this.d = ac;
this.n = ad;
this.y = ae;
this.a = arrayListCreate();
}
}
}
break;
case 3:
{
let c = _rest[0];
let d = _rest[1];
let e = _rest[2];
let f = _rest[3];
let g = _rest[4];
let h = _rest[5];
let i = _rest[6];
let j = _rest[7];
let k = _rest[8];
let l = _rest[9];
let m = [c, d, (e != null && e != stringEmpty()) ? new XmlTextReader(9, TextReader.e, c).d8(e, f, g, h) : null, i, j, k, l];
{
let o = m[0];
let p = m[1];
let q = m[2];
let r = m[3];
let s = m[4];
let t = m[5];
let u = m[6];
this.u = p;
this.w = o != null ? o : p != null ? p.ag : null;
if (q != null) {
this.f = q.b;
this.j = q.c;
this.l = q.d;
this.h = q.a;
this.s = q;
}
this.o = u;
this.d = r;
this.n = s;
this.y = t;
this.a = arrayListCreate();
}
}
break;
case 4:
{
let c = _rest[0];
let d = _rest[1];
let e = _rest[2];
let f = _rest[3];
let g = _rest[4];
let h = _rest[5];
let i = _rest[6];
this.u = d;
this.w = c != null ? c : d != null ? d.ag : null;
if (e != null) {
this.f = e.b;
this.j = e.c;
this.l = e.d;
this.h = e.a;
this.s = e;
}
this.o = i;
this.d = f;
this.n = g;
this.y = h;
this.a = arrayListCreate();
}
break;
}
}
get d() {
return this.c;
}
set d(a) {
this.c = a != null ? a : stringEmpty();
}
get f() {
return this.e != null ? this.e : this.s != null ? this.s.b : null;
}
set f(a) {
this.e = a != null ? a : stringEmpty();
}
get t() {
return this.s;
}
set t(a) {
this.s = a;
}
get p() {
return this.o;
}
set p(a) {
this.o = a;
}
get h() {
return this.g != null ? this.g : this.s != null ? this.s.a : null;
}
set h(a) {
this.g = a != null ? a : stringEmpty();
}
get v() {
return this.u;
}
set v(a) {
this.u = a;
}
get x() {
return this.w;
}
set x(a) {
this.w = a;
}
get j() {
return this.i != null ? this.i : this.s != null ? this.s.c : null;
}
set j(a) {
this.i = a != null ? a : stringEmpty();
}
get l() {
return this.k != null ? this.k : this.s != null ? this.s.d : null;
}
set l(a) {
this.k = a != null ? a : stringEmpty();
}
get n() {
return this.m;
}
set n(a) {
this.m = a != null ? a : stringEmpty();
}
get z() {
return this.y;
}
set z(a) {
this.y = a;
}
r() {
let a = null;
if (this.a.count == this.b) {
a = new XmlParserContext_ContextItem();
this.a.add(a);
}
else {
a = this.a.item(this.b);
}
a.a = this.d;
a.b = this.n;
a.c = this.z;
this.b++;
}
q() {
if (this.b == 0) {
throw new XmlException(3, "Unexpected end of element scope.");
}
this.b--;
let a = this.a.item(this.b);
this.c = a.a;
this.m = a.b;
this.y = a.c;
}
}
XmlParserContext.$t = /*@__PURE__*/ markType(XmlParserContext, 'XmlParserContext');
return XmlParserContext;
})();
/**
* @hidden
*/
export let XmlTextReader = /*@__PURE__*/ (() => {
class XmlTextReader extends XmlReader {
constructor(a, ..._rest) {
super();
this.es = null;
this.er = null;
this.ep = null;
this.eq = null;
this.a9 = new Array(10);
this.ba = new Array(10);
this.b6 = 0;
this.b7 = 0;
this.b3 = 0;
this.ej = null;
this.eg = null;
this.ef = null;
this.eb = 0;
this.bk = false;
this.ca = 0;
this.cb = 0;
this.bj = false;
this.bq = false;
this.bb = null;
this.cc = 0;
this.be = false;
this.bl = false;
this.bz = false;
this.c0 = null;
this.c7 = null;
this.cy = null;
this.bc = null;
this.ck = 0;
this.cl = 0;
this.b5 = 0;
this.br = false;
this.ce = 0;
this.b4 = 0;
this.b8 = 0;
this.b9 = 0;
this.b2 = false;
this.ei = 0;
this.eh = 0;
this.ch = 0;
this.bu = false;
this.bm = true;
this.ec = 0;
this.ek = new XmlUrlResolver();
this.bo = false;
this.bg = false;
this.bs = false;
this.bh = true;
this.d9 = 0;
this.ea = null;
this.bd = null;
this.eo = new XmlTextReader_DtdInputStateStack();
a = (a == void 0) ? 0 : a;
switch (a) {
case 0: break;
case 1:
{
let c = _rest[0];
let d = [new XmlStreamReader(1, c)];
{
let f = d[0];
let g = [f, new NameTable()];
{
let i = g[0];
let j = g[1];
let k = [stringEmpty(), i, j];
{
let m = k[0];
let n = k[1];
let o = k[2];
let p = [m, n, 9, null];
{
let r = p[0];
let s = p[1];
let t = p[2];
let u = p[3];
this.dn(r, u, s, t);
}
}
}
}
}
break;
case 2:
{
let c = _rest[0];
let d = [c, new NameTable()];
{
let f = d[0];
let g = d[1];
let h;
let i = ((() => { let j = this.cw(f, h); h = j.p1; return j.ret; })());
let j = new XmlParserContext(0, g, new XmlNamespaceManager(g), stringEmpty(), 0);
this.dn(h, j, new XmlStreamReader(1, i), 9);
}
}
break;
case 3:
{
let c = _rest[0];
let d = [c, new NameTable()];
{
let f = d[0];
let g = d[1];
let h = [stringEmpty(), f, g];
{
let j = h[0];
let k = h[1];
let l = h[2];
let m = [j, k, 9, null];
{
let o = m[0];
let p = m[1];
let q = m[2];
let r = m[3];
this.dn(o, r, p, q);
}
}
}
}
break;
case 4:
{
let c = _rest[0];
let d = [stringEmpty(), null, 0, null];
{
let f = d[0];
let g = d[1];
let h = d[2];
let i = d[3];
this.dn(f, i, g, h);
}
}
break;
case 5:
{
let c = _rest[0];
let d = _rest[1];
let e = [new XmlStreamReader(1, c), d];
{
let g = e[0];
let h = e[1];
let i = [stringEmpty(), g, h];
{
let k = i[0];
let l = i[1];
let m = i[2];
let n = [k, l, 9, null];
{
let p = n[0];
let q = n[1];
let r = n[2];
let s = n[3];
this.dn(p, s, q, r);
}
}
}
}
break;
case 6:
{
let c = _rest[0];
let d = _rest[1];
let e = [c, new XmlStreamReader(1, d)];
{
let g = e[0];
let h = e[1];
let i = [g, h, new NameTable()];
{
let k = i[0];
let l = i[1];
let m = i[2];
let n = [k, l, 9, null];
{
let p = n[0];
let q = n[1];
let r = n[2];
let s = n[3];
this.dn(p, s, q, r);
}
}
}
}
break;
case 7:
{
let c = _rest[0];
let d = _rest[1];
let e = [c, d, new NameTable()];
{
let g = e[0];
let h = e[1];
let i = e[2];
let j = [g, h, 9, null];
{
let l = j[0];
let m = j[1];
let n = j[2];
let o = j[3];
this.dn(l, o, m, n);
}
}
}
break;
case 8:
{
let c = _rest[0];
let d = _rest[1];
let e;
let f = ((() => { let g = this.cw(c, e); e = g.p1; return g.ret; })());
let g = new XmlParserContext(0, d, new XmlNamespaceManager(d), stringEmpty(), 0);
this.dn(e, g, new XmlStreamReader(1, f), 9);
}
break;
case 9:
{
let c = _rest[0];
let d = _rest[1];
let e = [stringEmpty(), c, d];
{
let g = e[0];
let h = e[1];
let i = e[2];
let j = [g, h, 9, null];
{
let l = j[0];
let m = j[1];
let n = j[2];
let o = j[3];
this.dn(l, o, m, n);
}
}
}
break;
case 10:
{
let c = _rest[0];
let d = _rest[1];
let e = _rest[2];
let f = _rest[3];
let g = _rest[4];
if (d == null) {
d = new XmlUrlResolver();
}
this.em = d;
let h;
let i = ((() => { let j = this.cw(e, h); h = j.p1; return j.ret; })());
this.dn(h, g, new XmlStreamReader(1, i), f);
}
break;
case 11:
{
let c = _rest[0];
let d = _rest[1];
let e = _rest[2];
let f = [e != null ? e.d : stringEmpty(), new XmlStreamReader(1, c), d, e];
{
let h = f[0];
let i = f[1];
let j = f[2];
let k = f[3];
this.dn(h, k, i, j);
}
this.bk = true;
}
break;
case 12:
{
let c = _rest[0];
let d = _rest[1];
let e = _rest[2];
let f = [c, d, e, null];
{
let h = f[0];
let i = f[1];
let j = f[2];
let k = f[3];
this.dn(h, k, i, j);
}
}
break;
case 13:
{
let c = _rest[0];
let d = _rest[1];
let e = _rest[2];
let f = [c, new XmlStreamReader(1, d), e];
{
let h = f[0];
let i = f[1];
let j = f[2];
let k = [h, i, 9, null];
{
let m = k[0];
let n = k[1];
let o = k[2];
let p = k[3];
this.dn(m, p, n, o);
}
}
}
break;
case 14:
{
let c = _rest[0];
let d = _rest[1];
let e = _rest[2];
let f = [c, d, 9, null];
{
let h = f[0];
let i = f[1];
let j = f[2];
let k = f[3];
this.dn(h, k, i, j);
}
}
break;
case 15:
{
let c = _rest[0];
let d = _rest[1];
let e = _rest[2];
let f = [e != null ? e.d : stringEmpty(), new StringReader(c), d, e];
{
let h = f[0];
let i = f[1];
let j = f[2];
let k = f[3];
this.dn(h, k, i, j);
}
this.bk = true;
}
break;
case 16:
{
let c = _rest[0];
let d = _rest[1];
let e = _rest[2];
let f = _rest[3];
this.dn(c, f, d, e);
}
break;
}
}
cw(a, b) {
let c = this.ek.d(null, a);
b = c != null ? c.toString() : stringEmpty();
return {
ret: typeCast(Stream.$, this.ek.b(c, null, Stream.$)),
p1: b
};
}
get_w() {
return this.b3;
}
get w() {
return this.get_w();
}
get_z() {
return this.ej.d;
}
get z() {
return this.get_z();
}
get_a() {
return true;
}
get_b() {
return true;
}
get bf() {
return this.bg;
}
set bf(a) {
this.bg = a;
}
get bi() {
return this.bh;
}
set bi(a) {
this.bh = a;
}
get_x() {
let a = this.er.n == 1 ? 0 : -1;
if (this.b7 >= 0) {
return a + this.cb + 2;
}
else if (this.b6 >= 0) {
return a + this.cb + 1;
}
return this.cb;
}
get x() {
return this.get_x();
}
get c6() {
return this.ej.p || Encoding.uTF8;
}
get_d() {
return this.eb == 3;
}
get d() {
return this.get_d();
}
get_f() {
return this.es.k != null;
}
get f() {
return this.get_f();
}
get_h() {
return false;
}
get h() {
return this.get_h();
}
get_i() {
return this.es.a;
}
get i() {
return this.get_i();
}
item(a) {
return this.aa(a);
}
item1(a) {
return this.ab(a);
}
item2(a, b) {
return this.ac(a, b);
}
get cf() {
if (this.b2) {
return this.ce;
}
else {
return this.es.c;
}
}
get cg() {
if (this.b2) {
return this.b4;
}
else {
return this.es.d;
}
}
get_ag() {
return this.es.g;
}
get ag() {
return this.get_ag();
}
get_ai() {
return this.es.h;
}
get ai() {
return this.get_ai();
}
get bn() {
return this.bm;
}
set bn(a) {
if (this.eb != 0) {
throw new InvalidOperationException(1, "Namespaces have to be set before reading.");
}
this.bm = a;
}
get_aj() {
return this.es.i;
}
get aj() {
return this.get_aj();
}
get_a5() {
return this.eg;
}
get a5() {
return this.get_a5();
}
get_a7() {
return this.es.n;
}
get a7() {
return this.get_a7();
}
get bp() {
return this.bo;
}
set bp(a) {
this.bo = a;
}
get_ak() {
return this.es.j;
}
get ak() {
return this.get_ak();
}
get bt() {
return this.bs;
}
set bt(a) {
this.bs = a;
}
get_v() {
return this.es.b;
}
get v() {
return this.get_v();
}
get_a3() {
return this.eb;
}
get a3() {
return this.get_a3();
}
get_ar() {
return this.es.k != null ? this.es.k : stringEmpty();
}
get ar() {
return this.get_ar();
}
get ed() {
return this.ec;
}
set ed(a) {
this.ec = a;
}
get_as() {
return this.ej.n;
}
get as() {
return this.get_as();
}
set em(a) {
this.ek = a;
}
get_a8() {
return this.ej.z;
}
get a8() {
return this.get_a8();
}
au() {
this.eb = 4;
this.es.m();
this.er.m();
this.b3 = 0;
if (this.bh && this.cy != null) {
this.cy.i();
}
}
aa(a) {
if (a >= this.b3) {
throw new ArgumentOutOfRangeException(1, "i is smaller than AttributeCount");
}
else {
return this.a9[a].k;
}
}
ab(a) {
for (let b = 0; b < this.b3; b++) {
if (this.a9[b].h == a) {
return this.a9[b].k;
}
}
return null;
}
cd(a, b) {
b = b != null ? b : stringEmpty();
for (let c = 0; c < this.b3; c++) {
let d = this.a9[c];
if (d.g == a && d.i == b) {
return c;
}
}
return -1;
}
ac(a, b) {
let c = this.cd(a, b);
if (c < 0) {
return null;
}
return this.a9[c].k;
}
cx() {
if (this.cl < 0) {
return this.cy;
}
return new StringReader(stringCreateFromCharArraySlice(this.bc, this.ck, this.cl - this.ck) + this.cy.h());
}
ah(a) {
return this.c1(a, false);
}
c1(a, b) {
let c = this.ef.lookupNamespace1(a, b);
return c == stringEmpty() ? null : c;
}
aw(a) {
if (a >= this.b3) {
throw new ArgumentOutOfRangeException(1, "attribute index out of range.");
}
this.b6 = a;
this.b7 = -1;
this.es = this.a9[a];
}
o(a) {
for (let b = 0; b < this.b3; b++) {
let c = this.a9[b];
if (c.h == a) {
this.aw(b);
return true;
}
}
return false;
}
p(a, b) {
let c = this.cd(a, b);
if (c < 0) {
return false;
}
this.aw(c);
return true;
}
q() {
if (this.er == null) {
return false;
}
if (this.es == this.er) {
return false;
}
if (this.b6 >= 0) {
this.b6 = -1;
this.b7 = -1;
this.es = this.er;
return true;
}
else {
return false;
}
}
r() {
if (this.b3 == 0) {
return false;
}
this.q();
return this.s();
}
s() {
if (this.b6 == 0 && this.b3 == 0) {
return false;
}
if (this.b6 + 1 < this.b3) {
this.b6++;
this.b7 = -1;
this.es = this.a9[this.b6];
return true;
}
else {
return false;
}
}
t() {
if (this.eb == 4) {
return false;
}
this.b5 = this.ck;
this.br = true;
this.ch = 0;
this.df();
if (this.ei == 2) {
if (this.b6 == 0) {
return false;
}
this.d6();
this.de();
this.dk();
this.ds('\"'.charCodeAt(0));
this.es = this.a9[0];
this.b7 = -1;
this.eb = 1;
return true;
}
if (this.eb == 0 && this.eh == 1) {
this.d6();
}
let a = false;
this.eb = 1;
this.b8 = this.ce;
this.b9 = this.b4;
this.b2 = true;
this.es = this.er;
this.b3 = 0;
this.b6 = this.b7 = -1;
this.er.m();
if (this.bj) {
++this.ca;
this.bj = false;
}
if (this.bu) {
this.bu = false;
return this.bx();
}
a = this.bv();
if (!a && this.ei == 9 && this.eh != 15) {
throw this.ee("Document element did not appear.");
}
this.b2 = false;
return a;
}
u() {
if (this.eb == 0 && this.ei == 2) {
this.t();
}
if (this.b6 < 0) {
return false;
}
let a = this.a9[this.b6];
if (this.b7 < 0) {
this.b7 = a.q - 1;
}
if (this.b7 < a.p) {
this.b7++;
this.es = this.ba[this.b7];
return true;
}
else {
return false;
}
}
cn(a, b, c) {
return 0;
}
co(a, b, c) {
return 0;
}
cr(a, b, c) {
if (b < 0) {
throw new ArgumentOutOfRangeException(3, "offset", b, "Offset must be non-negative integer.");
}
else if (c < 0) {
throw new ArgumentOutOfRangeException(3, "length", c, "Length must be non-negative integer.");
}
else if (a.length < b + c) {
throw new ArgumentOutOfRangeException(1, "buffer length is smaller than the sum of offset and length.");
}
if (this.i) {
this.t();
return 0;
}
if (!this.bu && this.a7 != 1) {
return 0;
}
this.br = false;
this.bu = true;
this.b2 = true;
return this.cs(a, b, c);
}
d2() {
if (this.bk) {
throw new InvalidOperationException(1, "Cannot call ResetState when parsing an XML fragment.");
}
this.dd();
}
a1() {
throw new InvalidOperationException(1, "XmlTextReader cannot resolve external entities.");
}
get el() {
return this.ek;
}
ee(a) {
return new XmlException(2, typeCast(IXmlLineInfo_$type, this), this.z, a);
}
initXmlTextReader() {
this.be = false;
this.bb = new Array(10);
this.c7 = new StringBuilder(0);
this.bg = true;
this.bs = false;
this.bh = true;
this.d9 = 2;
this.ck = 0;
if (this.bc == null) {
this.bc = new Array(1024);
}
this.cl = -1;
this.b5 = -1;
this.ce = 1;
this.b4 = 1;
this.b8 = this.b9 = 0;
this.dd();
}
dd() {
this.er = new XmlTextReader_XmlTokenInfo(this);
this.es = this.er;
this.b6 = -1;
this.b7 = -1;
this.b3 = 0;
this.eb = 0;
this.ca = 0;
this.cb = 0;
this.bj = false;
this.bq = this.be = false;
this.cc = 0;
this.bl = false;
this.bz = false;
this.c0 = stringEmpty();
this.b2 = false;
this.eh = 0;
this.bu = false;
}
dn(a, b, c, d) {
this.ei = d;
this.ej = b;
if (b == null) {
let e = new NameTable();
this.ej = new XmlParserContext(0, e, new XmlNamespaceManager(e), stringEmpty(), 0);
}
this.eg = this.ej.x;
this.eg = this.eg != null ? this.eg : new NameTable();
this.ef = this.ej.v;
this.ef = this.ef != null ? this.ef : new XmlNamespaceManager(this.eg);
if (a != null && a.length > 0) {
let f = null;
try {
f = new Uri(0, a);
}
catch (g) {
throw g;
}
this.ej.d = f.toString();
}
this.initXmlTextReader();
this.cy = c;
switch (d) {
case 2:
this.cy = new StringReader(stringReplace(c.h(), "\"", """));
break;
case 1:
this.eh = 1;
this.be = true;
break;
case 9: break;
default: throw new XmlException(3, stringFormat("NodeType {0} is not allowed to create XmlTextReader.", enumGetBox(XmlNodeType_$type, d)));
}
}
d4(a, b, c, d, e, f, g) {
this.d5(this.er, a, b, c, d, e, f, g);
this.er.c = this.b8;
this.er.d = this.b9;
}
d5(a, b, c, d, e, f, g, h) {
a.n = b;
a.h = c;
a.j = d;
a.g = e;
a.a = f;
a.k = g;
this.cb = this.ca;
if (h) {
this.de();
}
}
de() {
this.b3 = 0;
this.b6 = -1;
this.b7 = -1;
}
cm(a) {
if (this.cl <= this.ck + 1) {
if (!this.bw(a)) {
return a;
}
}
let b = this.bc[this.ck].charCodeAt(0);
let c = this.bc[this.ck + 1].charCodeAt(0);
if (((b & 64512) != 55296) || ((c & 64512) != 56320)) {
return b;
}
return 65536 + (b - 55296) * 1024 + (c - 56320);
}
ci() {
if (this.ck < this.cl) {
let a = this.bc[this.ck].charCodeAt(0);
if (a == 0) {
return -1;
}
if (a < 55296 || a >= 57343) {
return a;
}
return this.cm(a);
}
else {
if (!this.bw(-1)) {
return -1;
}
return this.ci();
}
}
cp() {
let a = this.ci();
this.ck++;
if (a >= 65536) {
this.ck++;
}
if (a == '\n'.charCodeAt(0)) {
this.ce++;
this.b4 = 1;
}
else if (a != -1) {
this.b4++;
}
return a;
}
c9(a) {
this.ck++;
if (a >= 65536) {
this.ck++;
}
if (a == '\n'.charCodeAt(0)) {
this.ce++;
this.b4 = 1;
}
else if (a != -1) {
this.b4++;
}
}
bw(a) {
if (this.cl < 0) {
this.cl = this.cy.c(this.bc, 0, this.bc.length);
return this.cl > 0;
}
let b = a >= 0 ? 1 : 0;
let c = this.cl - this.b5;
if (!this.br) {
this.b5 = 0;
this.ck = 0;
}
else if (this.cl < this.bc.length) {
}
else if (this.b5 <= (this.cl >> 1)) {
let d = new Array(this.bc.length * 2);
arrayCopy1(this.bc, this.b5, d, 0, c);
this.bc = d;
this.b5 = 0;
this.ck = c;
}
else {
arrayCopy1(this.bc, this.b5, this.bc, 0, c);
this.b5 = 0;
this.ck = c;
}
if (a >= 0) {
this.bc[this.ck] = String.fromCharCode(a);
}
let e = this.bc.length - this.ck - b;
if (e > 1024) {
e = 1024;
}
let f = this.cy.c(this.bc, this.ck + b, e);
let g = b + f;
this.cl = this.ck + g;
return (g != 0);
}
bv() {
if (this.bq) {
this.ef.h();
this.ej.q();
this.bq = false;
}
if (this.bz) {
this.d3();
}
else {
let a = this.ci();
if (a == -1) {
this.eb = 3;
this.df();
this.d4(0, stringEmpty(), stringEmpty(), stringEmpty(), false, null, true);
if (this.ca > 0) {
throw this.ee("unexpected end of file. Current depth is " + this.ca);
}
return false;
}
else {
switch (a) {
case 60:
this.c9(a);
switch (this.ci()) {
case 47:
this.c9(47);
this.dx();
break;
case 63:
this.c9(63);
this.dz();
break;
case 33:
this.c9(33);
this.dv();
break;
default:
this.d0();
break;
}
break;
case 13:
case 10:
case 9:
case 32:
if (!this.by()) {
return this.bv();
}
break;
default:
this.d1(true);
break;
}
}
}
return this.a3 != 3;
}
d3() {
this.df();
this.d4(5, this.c0, stringEmpty(), this.c0, false, null, true);
this.bz = false;
this.c0 = stringEmpty();
}
d0() {
if (this.eh == 15) {
throw this.ee("Multiple document element was detected.");
}
this.eh = 1;
this.ef.ac();
this.b8 = this.ce;
this.b9 = this.b4;
let a, b;
let c = ((() => { let d = this.c3(a, b); a = d.p0; b = d.p1; return d.ret; })());
if (this.eh == 15) {
throw this.ee("document has terminated, cannot open new element");
}
let d = false;
this.de();
this.b0();
if (XmlChar.e(this.ci())) {
this.dr(false);
}
this.es = this.er;
for (let e = 0; e < this.b3; e++) {
this.a9[e].u();
}
for (let f = 0; f < this.b3; f++) {
this.a9[f].t();
}
if (this.bm) {
for (let g = 0; g < this.b3; g++) {
if (this.a9[g].j == "xmlns" && this.a9[g].k == stringEmpty()) {
throw this.ee("Empty namespace URI cannot be mapped to non-empty prefix.");
}
}
}
for (let h = 0; h < this.b3; h++) {
for (let i = h + 1; i < this.b3; i++) {
if (Base.referenceEquals(this.a9[h].h, this.a9[i].h) || (Base.referenceEquals(this.a9[h].g, this.a9[i].g) && Base.referenceEquals(this.a9[h].i, this.a9[i].i))) {
throw this.ee("Attribute name and qualified name must be identical.");
}
}
}
if (this.ci() == '/'.charCodeAt(0)) {
this.c9('/'.charCodeAt(0));
d = true;
this.bq = true;
}
else {
this.bj = true;
this.dq(c, b, a);
}
this.ej.r();
this.dg('>'.charCodeAt(0));
this.d4(1, c, a, b, d, null, false);
if (a.length > 0) {
this.er.i = this.c1(a, true);
}
else if (this.bm) {
this.er.i = this.ef.n;
}
if (this.bm) {
if (this.aj == null) {
throw this.ee(stringFormat("'{0}' is undeclared namespace.", this.ak));
}
try {
for (let j = 0; j < this.b3; j++) {
this.aw(j);
if (this.aj == null) {
throw this.ee(stringFormat("'{0}' is undeclared namespace.", this.ak));
}
}
}
finally {
this.q();
}
}
for (let k = 0; k < this.b3; k++) {
if (!Base.referenceEquals(this.a9[k].j, "xml"