package o; import com.adobe.internal.xmp.XMPException; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import org.w3c.dom.Attr; import org.w3c.dom.Node; /* loaded from: classes.dex */ public final class Eli { /* JADX INFO: Access modifiers changed from: package-private */ public static void a(C16814rTK c16814rTK, sfI sfi, Node node, boolean z, khW khw) throws XMPException { int e = e(node); if (e != 8 && e != 0) { throw new XMPException("Node element must be rdf:Description or typed node", 202); } if (z && e == 0) { throw new XMPException("Top level typed node not allowed", 203); } int i = 0; for (int i2 = 0; i2 < node.getAttributes().getLength(); i2++) { Node item = node.getAttributes().item(i2); if (!"xmlns".equals(item.getPrefix()) && (item.getPrefix() != null || !"xmlns".equals(item.getNodeName()))) { int e2 = e(item); if (e2 == 0) { a(c16814rTK, sfi, item, item.getNodeValue(), z); } else { if (e2 != 6 && e2 != 2 && e2 != 3) { throw new XMPException("Invalid nodeElement attribute", 202); } if (i > 0) { throw new XMPException("Mutally exclusive about, ID, nodeID attributes", 202); } i++; if (z && e2 == 3) { if (sfi.f == null || sfi.f.length() <= 0) { sfi.f = item.getNodeValue(); } else if (!sfi.f.equals(item.getNodeValue())) { throw new XMPException("Mismatched top level rdf:about values", 203); } } } } } e(c16814rTK, sfi, node, z, khw); } private static void e(C16814rTK c16814rTK, sfI sfi, Node node, boolean z, khW khw) throws XMPException { for (int i = 0; i < node.getChildNodes().getLength(); i++) { Node item = node.getChildNodes().item(i); if (!d(item)) { if (item.getNodeType() != 1) { throw new XMPException("Expected property element node not found", 202); } if (sfi.g == null) { sfi.g = new C14373frw(); } if (sfi.g.e != -1) { if (sfi.g == null) { sfi.g = new C14373frw(); } if (i > sfi.g.e) { return; } } d(c16814rTK, sfi, item, z, khw); } } } /* JADX WARN: Removed duplicated region for block: B:251:0x0449 */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private static void d(o.C16814rTK r16, o.sfI r17, org.w3c.dom.Node r18, boolean r19, o.khW r20) throws com.adobe.internal.xmp.XMPException { /* Method dump skipped, instructions count: 1191 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: o.Eli.d(o.rTK, o.sfI, org.w3c.dom.Node, boolean, o.khW):void"); } private static void e(C16814rTK c16814rTK, sfI sfi, Node node, boolean z) throws XMPException { sfI a = a(c16814rTK, sfi, node, (String) null, z); for (int i = 0; i < node.getAttributes().getLength(); i++) { Node item = node.getAttributes().item(i); if (!"xmlns".equals(item.getPrefix()) && (item.getPrefix() != null || !"xmlns".equals(item.getNodeName()))) { String namespaceURI = item.getNamespaceURI(); String localName = item.getLocalName(); if ("xml:lang".equals(item.getNodeName())) { c(a, "xml:lang", item.getNodeValue()); } else if (!"http://www.w3.org/1999/02/22-rdf-syntax-ns#".equals(namespaceURI) || (!"ID".equals(localName) && !"datatype".equals(localName))) { throw new XMPException("Invalid attribute for literal property element", 202); } } } String str = ""; for (int i2 = 0; i2 < node.getChildNodes().getLength(); i2++) { Node item2 = node.getChildNodes().item(i2); if (item2.getNodeType() == 3) { StringBuilder sb = new StringBuilder(); sb.append(str); sb.append(item2.getNodeValue()); str = sb.toString(); } else { throw new XMPException("Invalid child of literal property element", 202); } } a.i = str; } /* JADX WARN: Removed duplicated region for block: B:71:0x0107 */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private static void b(o.C16814rTK r17, o.sfI r18, org.w3c.dom.Node r19, boolean r20) throws com.adobe.internal.xmp.XMPException { /* Method dump skipped, instructions count: 382 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: o.Eli.b(o.rTK, o.sfI, org.w3c.dom.Node, boolean):void"); } /* JADX WARN: Removed duplicated region for block: B:20:0x006f */ /* JADX WARN: Removed duplicated region for block: B:37:0x009f */ /* JADX WARN: Removed duplicated region for block: B:39:0x00a8 */ /* JADX WARN: Removed duplicated region for block: B:51:0x00cc */ /* JADX WARN: Removed duplicated region for block: B:54:0x00db */ /* JADX WARN: Removed duplicated region for block: B:67:0x00a3 */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private static o.sfI a(o.C16814rTK r7, o.sfI r8, org.w3c.dom.Node r9, java.lang.String r10, boolean r11) throws com.adobe.internal.xmp.XMPException { /* Method dump skipped, instructions count: 264 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: o.Eli.a(o.rTK, o.sfI, org.w3c.dom.Node, java.lang.String, boolean):o.sfI"); } private static sfI c(sfI sfi, String str, String str2) throws XMPException { if ("xml:lang".equals(str)) { str2 = C15974jzn.d(str2); } sfI sfi2 = new sfI(str, str2, null); sfi.d(sfi2); return sfi2; } /* JADX INFO: Access modifiers changed from: package-private */ public static boolean d(Node node) { if (node.getNodeType() != 3) { return false; } String nodeValue = node.getNodeValue(); for (int i = 0; i < nodeValue.length(); i++) { if (!Character.isWhitespace(nodeValue.charAt(i))) { return false; } } return true; } private static int e(Node node) { String localName = node.getLocalName(); String namespaceURI = node.getNamespaceURI(); if (namespaceURI == null && (("about".equals(localName) || "ID".equals(localName)) && (node instanceof Attr) && "http://www.w3.org/1999/02/22-rdf-syntax-ns#".equals(((Attr) node).getOwnerElement().getNamespaceURI()))) { namespaceURI = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"; } if (!"http://www.w3.org/1999/02/22-rdf-syntax-ns#".equals(namespaceURI)) { return 0; } if ("li".equals(localName)) { return 9; } if ("parseType".equals(localName)) { return 4; } if ("Description".equals(localName)) { return 8; } if ("about".equals(localName)) { return 3; } if ("resource".equals(localName)) { return 5; } if ("RDF".equals(localName)) { return 1; } if ("ID".equals(localName)) { return 2; } if ("nodeID".equals(localName)) { return 6; } if ("datatype".equals(localName)) { return 7; } if ("aboutEach".equals(localName)) { return 10; } if ("aboutEachPrefix".equals(localName)) { return 11; } return "bagID".equals(localName) ? 12 : 0; } private static void e(sfI sfi) throws XMPException { Iterator listIterator; if (sfi.e == null) { sfi.e = new ArrayList(0); } sfI sfi2 = (sfI) sfi.e.get(0); if (sfi2.g == null) { sfi2.g = new C14373frw(); } int i = 1; if ((sfi2.g.a & 64) != 0) { if (sfi.g == null) { sfi.g = new C14373frw(); } if ((sfi.g.a & 64) != 0) { throw new XMPException("Redundant xml:lang for rdf:value element", 203); } if (sfi2.h == null) { sfi2.h = new ArrayList(0); } sfI sfi3 = (sfI) sfi2.h.get(0); sfi2.b(sfi3); sfi.d(sfi3); } while (true) { List list = sfi2.h; if (i > (list != null ? list.size() : 0)) { break; } if (sfi2.h == null) { sfi2.h = new ArrayList(0); } sfi.d((sfI) sfi2.h.get(i - 1)); i++; } int i2 = 2; while (true) { List list2 = sfi.e; if (i2 > (list2 != null ? list2.size() : 0)) { break; } if (sfi.e == null) { sfi.e = new ArrayList(0); } sfi.d((sfI) sfi.e.get(i2 - 1)); i2++; } sfi.d = false; if (sfi.g == null) { sfi.g = new C14373frw(); } sfi.g.a &= -257; if (sfi.g == null) { sfi.g = new C14373frw(); } C14373frw c14373frw = sfi.g; if (sfi2.g == null) { sfi2.g = new C14373frw(); } C14373frw c14373frw2 = sfi2.g; if (c14373frw2 != null) { c14373frw.a(c14373frw2.a | c14373frw.a); } sfi.i = sfi2.i; sfi.e = null; if (sfi2.e != null) { if (sfi2.e == null) { sfi2.e = new ArrayList(0); } listIterator = sfi2.e.iterator(); } else { listIterator = Collections.EMPTY_LIST.listIterator(); } while (listIterator.hasNext()) { sfi.c((sfI) listIterator.next()); } } }