package p138.p329.p362.p368;

import com.hierynomus.smbj.paths.PathResolveException;
import java.util.ArrayList;
import p138.p139.p143.p144.C2803;
import p138.p329.p341.EnumC6158;
import p138.p329.p346.C6223;
import p138.p329.p346.C6229;
import p138.p329.p346.C6237;
import p138.p329.p351.p352.C6288;
import p138.p329.p362.p364.C6353;
import p138.p329.p362.p369.C6386;
import p138.p329.p362.p370.InterfaceC6411;

/* JADX INFO: renamed from: ދ.ށ.މ.އ.ހ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C6381 implements InterfaceC6379 {

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public InterfaceC6379 f17812;

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public InterfaceC6411 f17813;

    /* JADX INFO: renamed from: ދ.ށ.މ.އ.ހ$֏, reason: contains not printable characters */
    public class C6382 implements InterfaceC6411 {

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public final /* synthetic */ InterfaceC6379 f17814;

        public C6382(C6381 c6381, InterfaceC6379 interfaceC6379) {
            this.f17814 = interfaceC6379;
        }

        @Override // p138.p329.p362.p370.InterfaceC6411
        /* JADX INFO: renamed from: ֏ */
        public boolean mo9604(long j) {
            return j == EnumC6158.STATUS_STOPPED_ON_SYMLINK.f17193 || this.f17814.mo9600().mo9604(j);
        }
    }

    public C6381(InterfaceC6379 interfaceC6379) {
        this.f17812 = interfaceC6379;
        this.f17813 = new C6382(this, interfaceC6379);
    }

    @Override // p138.p329.p362.p368.InterfaceC6379
    /* JADX INFO: renamed from: ֏ */
    public C6353 mo9596(C6386 c6386, C6237 c6237, C6353 c6353) throws PathResolveException {
        C6223.C6227 c6227;
        String strM4884;
        if (c6237.mo9556().f17394 != EnumC6158.STATUS_STOPPED_ON_SYMLINK.f17193) {
            return this.f17812.mo9596(c6386, c6237, c6353);
        }
        C6223 c6223 = c6237.f17439;
        if (c6223 != null) {
            for (C6223.InterfaceC6226 interfaceC6226 : c6223.f17368) {
                if (interfaceC6226 instanceof C6223.C6227) {
                    c6227 = (C6223.C6227) interfaceC6226;
                    break;
                }
            }
            c6227 = null;
        } else {
            c6227 = null;
        }
        if (c6227 == null) {
            throw new PathResolveException(c6237.mo9556().f17394, "Create failed for " + c6353 + ": missing symlink data");
        }
        String str = c6353.f17736;
        int i = c6227.f17370;
        byte[] bArrM9502 = C6229.m9502(str);
        String str2 = new String(bArrM9502, bArrM9502.length - i, i, C6288.f17629);
        String str3 = c6227.f17371;
        if (c6227.f17369) {
            strM4884 = C2803.m4879(str3, str2);
        } else {
            byte[] bArrM95022 = C6229.m9502(str);
            String str4 = new String(bArrM95022, 0, bArrM95022.length - i, C6288.f17629);
            StringBuilder sb = new StringBuilder();
            int iLastIndexOf = str4.lastIndexOf("\\");
            if (iLastIndexOf != -1) {
                sb.append((CharSequence) str4, 0, iLastIndexOf);
                sb.append('\\');
            }
            strM4884 = C2803.m4884(sb, str3, str2);
        }
        ArrayList arrayList = new ArrayList();
        int i2 = 0;
        while (true) {
            int iIndexOf = strM4884.indexOf(92, i2);
            if (iIndexOf == -1) {
                break;
            }
            arrayList.add(strM4884.substring(i2, iIndexOf));
            i2 = iIndexOf + 1;
        }
        arrayList.add(strM4884.substring(i2));
        int i3 = 0;
        while (i3 < arrayList.size()) {
            String str5 = (String) arrayList.get(i3);
            if (".".equals(str5)) {
                arrayList.remove(i3);
            } else if ("..".equals(str5)) {
                if (i3 > 0) {
                    arrayList.remove(i3);
                    i3--;
                }
                arrayList.remove(i3);
            } else {
                i3++;
            }
        }
        StringBuilder sb2 = new StringBuilder();
        for (int i4 = 0; i4 < arrayList.size(); i4++) {
            if (i4 > 0) {
                sb2.append('\\');
            }
            sb2.append((String) arrayList.get(i4));
        }
        return new C6353(c6353.f17734, c6353.f17735, sb2.toString());
    }

    @Override // p138.p329.p362.p368.InterfaceC6379
    /* JADX INFO: renamed from: ֏ */
    public C6353 mo9597(C6386 c6386, C6353 c6353) {
        return this.f17812.mo9597(c6386, c6353);
    }

    @Override // p138.p329.p362.p368.InterfaceC6379
    /* JADX INFO: renamed from: ֏ */
    public InterfaceC6411 mo9600() {
        return this.f17813;
    }
}
