package com.ifpdos.udi.sdk.kotlin.comment.parser;

import com.seewo.vcommons.utils.ShellCommandUtils;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import kotlin.Metadata;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt;

/* JADX INFO: compiled from: CommentDetails.kt */
/* JADX INFO: loaded from: classes.dex */
@Metadata(d1 = {"\u0000.\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0004\n\u0002\u0010$\n\u0002\u0010 \n\u0002\b\u000f\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0003\b\u0086\b\u0018\u0000 \u001e2\u00020\u0001:\u0001\u001eB?\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0003\u0012\u0006\u0010\u0005\u001a\u00020\u0003\u0012\u0006\u0010\u0006\u001a\u00020\u0003\u0012\u0018\u0010\u0007\u001a\u0014\u0012\u0004\u0012\u00020\u0003\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00030\t0\b¢\u0006\u0002\u0010\nJ\t\u0010\u0012\u001a\u00020\u0003HÆ\u0003J\t\u0010\u0013\u001a\u00020\u0003HÆ\u0003J\t\u0010\u0014\u001a\u00020\u0003HÆ\u0003J\t\u0010\u0015\u001a\u00020\u0003HÆ\u0003J\u001b\u0010\u0016\u001a\u0014\u0012\u0004\u0012\u00020\u0003\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00030\t0\bHÆ\u0003JM\u0010\u0017\u001a\u00020\u00002\b\b\u0002\u0010\u0002\u001a\u00020\u00032\b\b\u0002\u0010\u0004\u001a\u00020\u00032\b\b\u0002\u0010\u0005\u001a\u00020\u00032\b\b\u0002\u0010\u0006\u001a\u00020\u00032\u001a\b\u0002\u0010\u0007\u001a\u0014\u0012\u0004\u0012\u00020\u0003\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00030\t0\bHÆ\u0001J\u0013\u0010\u0018\u001a\u00020\u00192\b\u0010\u001a\u001a\u0004\u0018\u00010\u0001HÖ\u0003J\t\u0010\u001b\u001a\u00020\u001cHÖ\u0001J\t\u0010\u001d\u001a\u00020\u0003HÖ\u0001R#\u0010\u0007\u001a\u0014\u0012\u0004\u0012\u00020\u0003\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00030\t0\b¢\u0006\b\n\u0000\u001a\u0004\b\u000b\u0010\fR\u0011\u0010\u0006\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\r\u0010\u000eR\u0011\u0010\u0002\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\u000f\u0010\u000eR\u0011\u0010\u0005\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\u0010\u0010\u000eR\u0011\u0010\u0004\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\u0011\u0010\u000e¨\u0006\u001f"}, d2 = {"Lcom/ifpdos/udi/sdk/kotlin/comment/parser/CommentDetails;", "", "raw", "", "total", "summary", "description", "annotations", "", "", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;)V", "getAnnotations", "()Ljava/util/Map;", "getDescription", "()Ljava/lang/String;", "getRaw", "getSummary", "getTotal", "component1", "component2", "component3", "component4", "component5", "copy", "equals", "", "other", "hashCode", "", "toString", "Companion", "kotlin-comment-parser"}, k = 1, mv = {1, 6, 0}, xi = 48)
public final /* data */ class CommentDetails {

    /* JADX INFO: renamed from: Companion, reason: from kotlin metadata */
    public static final Companion INSTANCE = new Companion(null);
    private final Map<String, List<String>> annotations;
    private final String description;
    private final String raw;
    private final String summary;
    private final String total;

    /* JADX WARN: Multi-variable type inference failed */
    public static /* synthetic */ CommentDetails copy$default(CommentDetails commentDetails, String str, String str2, String str3, String str4, Map map, int i, Object obj) {
        if ((i & 1) != 0) {
            str = commentDetails.raw;
        }
        if ((i & 2) != 0) {
            str2 = commentDetails.total;
        }
        String str5 = str2;
        if ((i & 4) != 0) {
            str3 = commentDetails.summary;
        }
        String str6 = str3;
        if ((i & 8) != 0) {
            str4 = commentDetails.description;
        }
        String str7 = str4;
        if ((i & 16) != 0) {
            map = commentDetails.annotations;
        }
        return commentDetails.copy(str, str5, str6, str7, map);
    }

    /* JADX INFO: renamed from: component1, reason: from getter */
    public final String getRaw() {
        return this.raw;
    }

    /* JADX INFO: renamed from: component2, reason: from getter */
    public final String getTotal() {
        return this.total;
    }

    /* JADX INFO: renamed from: component3, reason: from getter */
    public final String getSummary() {
        return this.summary;
    }

    /* JADX INFO: renamed from: component4, reason: from getter */
    public final String getDescription() {
        return this.description;
    }

    public final Map<String, List<String>> component5() {
        return this.annotations;
    }

    public final CommentDetails copy(String raw, String total, String summary, String description, Map<String, ? extends List<String>> annotations) {
        Intrinsics.checkNotNullParameter(raw, "raw");
        Intrinsics.checkNotNullParameter(total, "total");
        Intrinsics.checkNotNullParameter(summary, "summary");
        Intrinsics.checkNotNullParameter(description, "description");
        Intrinsics.checkNotNullParameter(annotations, "annotations");
        return new CommentDetails(raw, total, summary, description, annotations);
    }

    public boolean equals(Object other) {
        if (this == other) {
            return true;
        }
        if (!(other instanceof CommentDetails)) {
            return false;
        }
        CommentDetails commentDetails = (CommentDetails) other;
        return Intrinsics.areEqual(this.raw, commentDetails.raw) && Intrinsics.areEqual(this.total, commentDetails.total) && Intrinsics.areEqual(this.summary, commentDetails.summary) && Intrinsics.areEqual(this.description, commentDetails.description) && Intrinsics.areEqual(this.annotations, commentDetails.annotations);
    }

    public int hashCode() {
        return (((((((this.raw.hashCode() * 31) + this.total.hashCode()) * 31) + this.summary.hashCode()) * 31) + this.description.hashCode()) * 31) + this.annotations.hashCode();
    }

    public String toString() {
        return "CommentDetails(raw=" + this.raw + ", total=" + this.total + ", summary=" + this.summary + ", description=" + this.description + ", annotations=" + this.annotations + ')';
    }

    /* JADX WARN: Multi-variable type inference failed */
    public CommentDetails(String raw, String total, String summary, String description, Map<String, ? extends List<String>> annotations) {
        Intrinsics.checkNotNullParameter(raw, "raw");
        Intrinsics.checkNotNullParameter(total, "total");
        Intrinsics.checkNotNullParameter(summary, "summary");
        Intrinsics.checkNotNullParameter(description, "description");
        Intrinsics.checkNotNullParameter(annotations, "annotations");
        this.raw = raw;
        this.total = total;
        this.summary = summary;
        this.description = description;
        this.annotations = annotations;
    }

    public final String getRaw() {
        return this.raw;
    }

    public final String getTotal() {
        return this.total;
    }

    public final String getSummary() {
        return this.summary;
    }

    public final String getDescription() {
        return this.description;
    }

    public final Map<String, List<String>> getAnnotations() {
        return this.annotations;
    }

    /* JADX INFO: compiled from: CommentDetails.kt */
    @Metadata(d1 = {"\u0000*\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0010%\n\u0002\u0010!\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u000e\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0006J*\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\u00062\u0018\u0010\n\u001a\u0014\u0012\u0004\u0012\u00020\u0006\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00060\f0\u000bH\u0002¨\u0006\r"}, d2 = {"Lcom/ifpdos/udi/sdk/kotlin/comment/parser/CommentDetails$Companion;", "", "()V", "parseComment", "Lcom/ifpdos/udi/sdk/kotlin/comment/parser/CommentDetails;", "comment", "", "parserAnnotations", "", "line", "receiver", "", "", "kotlin-comment-parser"}, k = 1, mv = {1, 6, 0}, xi = 48)
    public static final class Companion {
        public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }

        private Companion() {
        }

        public final CommentDetails parseComment(String comment) {
            Intrinsics.checkNotNullParameter(comment, "comment");
            StringBuilder sb = new StringBuilder();
            StringBuilder sb2 = new StringBuilder();
            LinkedHashMap linkedHashMap = new LinkedHashMap();
            String str = comment;
            boolean z = false;
            StringBuilder sb3 = sb;
            for (String str2 : StringsKt.split$default((CharSequence) StringsKt.trim((CharSequence) str).toString(), new String[]{ShellCommandUtils.COMMAND_LINE_END}, false, 0, 6, (Object) null)) {
                String str3 = str2;
                if (StringsKt.startsWith$default(StringsKt.trim((CharSequence) str3).toString(), "@", z, 2, (Object) null)) {
                    Companion companion = CommentDetails.INSTANCE;
                    String strSubstring = str2.substring(StringsKt.indexOf$default((CharSequence) str3, "@", 0, false, 6, (Object) null) + 1);
                    Intrinsics.checkNotNullExpressionValue(strSubstring, "this as java.lang.String).substring(startIndex)");
                    companion.parserAnnotations(strSubstring, linkedHashMap);
                } else if (str3.length() == 0 && sb.length() > 0) {
                    sb2.append(ShellCommandUtils.COMMAND_LINE_END);
                    sb3 = sb2;
                } else {
                    sb3.append(str2).append(ShellCommandUtils.COMMAND_LINE_END);
                }
                z = false;
            }
            String string = sb.toString();
            Intrinsics.checkNotNullExpressionValue(string, "summaryBuilder.toString()");
            String string2 = StringsKt.trim((CharSequence) string).toString();
            String string3 = sb2.toString();
            Intrinsics.checkNotNullExpressionValue(string3, "descriptionBuilder.toString()");
            String string4 = StringsKt.trim((CharSequence) string3).toString();
            return new CommentDetails(StringsKt.trim((CharSequence) str).toString(), string4.length() > 0 ? string2 + '\n' + string4 : string2, string2, string4, linkedHashMap);
        }

        private final void parserAnnotations(String line, Map<String, List<String>> receiver) {
            String str = line;
            if (StringsKt.contains$default((CharSequence) str, (CharSequence) " ", false, 2, (Object) null)) {
                List listSplit$default = StringsKt.split$default((CharSequence) str, new String[]{" "}, false, 2, 2, (Object) null);
                String str2 = (String) listSplit$default.get(0);
                String str3 = (String) listSplit$default.get(1);
                ArrayList arrayList = receiver.get(str2);
                if (arrayList == null) {
                    arrayList = new ArrayList();
                    receiver.put(str2, arrayList);
                }
                arrayList.add(str3);
                return;
            }
            ArrayList arrayList2 = receiver.get(line);
            if (arrayList2 == null) {
                arrayList2 = new ArrayList();
                receiver.put(line, arrayList2);
            }
            arrayList2.add("");
        }
    }
}
