/*
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, markType } from "igniteui-angular-core";
import { StringBuilder } from "igniteui-angular-core";
import { intDivide } from "igniteui-angular-core";
/**
 * @hidden
 */
export class DBNumHelper extends Base {
    static k(a) {
        return 1 <= a && a <= 4;
    }
    static l(a) {
        return DBNumHelper.c(a, 1) != null;
    }
    static c(a, b) {
        if (b == 3) {
            return DBNumHelper.j;
        }
        if (b == 1 || b == 2) {
            switch (a) {
                case 30724:
                case 2052:
                case 4:
                case 4100: return b == 1 ? DBNumHelper.a : DBNumHelper.b;
                case 31748:
                case 3076:
                case 1028:
                case 5124: return b == 1 ? DBNumHelper.h : DBNumHelper.i;
                case 18:
                case 1042: return b == 1 ? DBNumHelper.f : DBNumHelper.g;
                case 17:
                case 1041: return b == 1 ? DBNumHelper.d : DBNumHelper.e;
            }
        }
        return null;
    }
    static o(a, b) {
        if (1 <= b && b <= 3) {
            switch (a) {
                case 30724:
                case 2052:
                case 4:
                case 4100: return b == 2 ? "壹拾佰仟万亿兆" : "一十百千万亿兆";
                case 31748:
                case 3076:
                case 5124:
                case 1028: return b == 2 ? "壹拾佰仟萬億兆" : "一十百千萬億兆";
                case 18:
                case 1042: return b == 2 ? "壹拾百阡萬億兆" : "一十百千万億兆";
                case 17:
                case 1041: return b == 2 ? "壱拾百阡萬億兆" : "一十百千万億兆";
            }
        }
        return null;
    }
    static v(a, b, c, d = 0) {
        let e = DBNumHelper.c(a, b);
        let f = DBNumHelper.o(a, b);
        if (f == null || e == null) {
            return null;
        }
        let g = e == DBNumHelper.j || e == DBNumHelper.d;
        let h = b == 2;
        let i = new StringBuilder(0);
        let j = 1;
        let k = 0;
        if (c == 0) {
            return "" + e[0];
        }
        let l = false;
        while (c != 0) {
            let m = (c % 10);
            if (j >= 17 || (j == 13 && c >= 10000)) {
                l = true;
            }
            if (l) {
                if (k != 6) {
                    k = 6;
                    i.w(0, f.charAt(6));
                }
                i.x(0, e[m]);
            }
            else if (m > 0) {
                if (j >= 5) {
                    let n = intDivide((j - 5), 4) + 4;
                    if (n != k) {
                        i.w(0, f.charAt(n));
                        k = n;
                    }
                    let o = (j - 5) % 4;
                    if (o > 0 || (!h && m == 1)) {
                        i.w(0, f.charAt(o));
                    }
                }
                else if (j == 2) {
                    i.w(0, f.charAt(1));
                }
                else if (j == 3) {
                    i.w(0, f.charAt(2));
                }
                else if (j == 4) {
                    i.w(0, f.charAt(3));
                }
                if (j == 1 || !g || m > 1) {
                    i.x(0, e[m]);
                }
            }
            j++;
            c = intDivide((c - m), 10);
        }
        while (j <= d) {
            i.x(0, e[0]);
            j++;
        }
        return i.toString();
    }
}
DBNumHelper.$t = markType(DBNumHelper, 'DBNumHelper');
DBNumHelper.f = ["０", "一", "二", "三", "四", "五", "六", "七", "八", "九"];
DBNumHelper.a = ["○", "一", "二", "三", "四", "五", "六", "七", "八", "九"];
DBNumHelper.h = ["○", "一", "二", "三", "四", "五", "六", "七", "八", "九"];
DBNumHelper.d = ["〇", "一", "二", "三", "四", "五", "六", "七", "八", "九"];
DBNumHelper.g = ["零", "壹", "貳", "參", "四", "伍", "六", "七", "八", "九"];
DBNumHelper.b = ["零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"];
DBNumHelper.i = ["零", "壹", "貳", "參", "肆", "伍", "陸", "柒", "捌", "玖"];
DBNumHelper.e = ["〇", "壱", "弐", "参", "四", "伍", "六", "七", "八", "九"];
DBNumHelper.j = ["０", "１", "２", "３", "４", "５", "６", "７", "８", "９"];
//# sourceMappingURL=DBNumHelper.js.map