/**
* PDA v1.1.2
* (c) 2024 Product Designer App
* @license GPLv3
* Dashboard
* Free version
* Unminify code for Dev
**/
var pdappAPI = {
    tool: {
        getData: function (r) {
            return new Promise(function (t, e) {
                let o = {
                    method: "GET",
                    url: r,
                    dataType: "json",
                    success: function (r) {
                        0 == r
                            ? e({ msg: "403 Forbidden", error: 1 })
                            : (void 0 === r.error && (r.error = 1),
                              0 === r.error ? t({ msg: r.msg, data: r.data }) : e({ msg: r.msg, error: r.error }));
                    },
                    error: function (r, t, o) {
                        e({ msg: o, error: 1 });
                    },
                };
                jQuery.ajax(o);
            });
        },
        postData: function (r, t) {
            return new Promise(function (e, o) {
                let a = {
                    method: "POST",
                    url: r,
                    dataType: "json",
                    data: t,
                    success: function (r) {
                        0 == r
                            ? o({ msg: "403 Forbidden", error: 1 })
                            : (void 0 === r.error && (r.error = 1),
                              0 === r.error ? e({ msg: r.msg, data: r.data }) : o({ msg: r.msg, error: r.error }));
                    },
                    error: function (r, t, e) {
                        o({ msg: e, error: 1 });
                    },
                };
                jQuery.ajax(a);
            });
        },
        chart: null,
        chartJS: function (r, t) {
            null != this.chart && this.chart.destroy();
            let e = r.getContext("2d");
            this.chart = new Chart(e, { type: "bar", data: t, options: { scales: { y: { beginAtZero: !0 } } } });
        },
        setLocalVar: function (r, t) {
            localStorage.setItem(r, t);
        },
        getLocalVar: function (r, t) {
            let e = localStorage.getItem(r);
            return null != e ? e : (void 0 === t && (t = ""), t);
        },
    },
};