let clockInterval = setInterval(() => {
    // document.getElementById("clock-widget").innerText = (new Date).toLocaleTimeString()
}, 1e3);
window.addEventListener("beforeunload", () => {
    // clearInterval(clockInterval)
}), new CustomApexChart({
    selector: "#total-sales-chart",
    options: () => ({
        chart: {
            height: 210,
            type: "donut"
        },
        legend: {
            show: !1
        },
        stroke: {
            width: 0
        },
        plotOptions: {
            pie: {
                donut: {
                    size: "75%",
                    labels: {
                        show: !0,
                        total: {
                            showAlways: !0,
                            show: !0,
                            formatter: function (e) {
                                return e.globals.seriesTotals.reduce((e, t) => e + t, 0) + "k"
                            }
                        }
                    }
                }
            }
        },
        series: [44, 55, 41],
        labels: ["Direct", "Affiliate", "Sponsored"],
        colors: [theme("chart-primary"), theme("chart-gamma"), theme("chart-gray")],
        dataLabels: {
            enabled: !1
        },
        responsive: [{
            breakpoint: 480,
            options: {
                chart: {
                    width: 180
                }
            }
        }]
    })
}), new CustomApexChart({
    selector: "#weekly-performance-chart",
    options: () => ({
        series: [{
            data: [{
                x: "Mon",
                y: [28, 45]
            }, {
                x: "Tue",
                y: [32, 41]
            }, {
                x: "Wed",
                y: [29, 78]
            }, {
                x: "Thu",
                y: [30, 46]
            }, {
                x: "Fri",
                y: [35, 41]
            }, {
                x: "Sat",
                y: [45, 65]
            }, {
                x: "Sun",
                y: [41, 56]
            }]
        }],
        chart: {
            height: 247,
            type: "rangeBar",
            toolbar: {
                show: !1
            },
            zoom: {
                enabled: !1
            }
        },
        plotOptions: {
            bar: {
                horizontal: !0,
                isDumbbell: !0,
                dumbbellColors: [
                    [theme("chart-primary"), theme("chart-primary")]
                ]
            }
        },
        legend: {
            show: !1
        },
        fill: {
            type: "gradient",
            gradient: {
                gradientToColors: [theme("chart-primary"), theme("chart-gamma"), theme("chart-gray")],
                inverseColors: !1,
                stops: [0, 100]
            }
        },
        xaxis: {
            type: "string",
            axisBorder: {
                show: !1
            }
        },
        yaxis: {
            axisBorder: {
                show: !1
            },
            labels: {
                offsetX: 10
            }
        },
        grid: {
            borderColor: [theme("chart-order-color")],
            padding: {
                top: -20,
                right: 0,
                bottom: -10,
                left: 0
            }
        }
    })
}), new CustomApexChart({
    selector: "#sales-report-chart",
    options: () => ({
        series: [{
            name: "Total Revenue",
            type: "area",
            data: [21, 21, 21, 35, 35, 35, 44, 44, 44, 54, 54, 54, 48, 48, 76, 76, 95, 95, 76, 76, 32, 32, 46, 48, 48]
        }, {
            name: "Orders",
            type: "line",
            data: [40, 40, 40, 50, 50, 35, 27, 27, 27, 15, 15, 27, 27, 36, 36, 33, 33, 34, 35, 33, 50, 50, 55, 55, 55]
        }],
        chart: {
            type: "line",
            height: 342,
            toolbar: {
                show: !1
            },
            offsetX: 0
        },
        stroke: {
            width: [3, 2],
            curve: "smooth",
            dashArray: [0, 8]
        },
        colors: [theme("chart-secondary"), theme("chart-alpha")],
        grid: {
            strokeDashArray: 7
        },
        zoom: {
            enabled: !1
        },
        xaxis: {
            type: "string",
            axisBorder: {
                show: !1
            },
            labels: {
                offsetY: 2
            }
        },
        yaxis: {
            tickAmount: 4,
            min: 0,
            max: 100,
            labels: {
                show: !0,
                formatter: function (e) {
                    return e + "k"
                },
                offsetX: -10
            },
            axisBorder: {
                show: !1
            }
        },
        dataLabels: {
            enabled: !1
        },
        markers: {
            size: 0,
            style: "hollow"
        },
        tooltip: {
            x: {
                format: "dd MMM yyyy"
            },
            y: {
                formatter: function (e) {
                    return "$" + e + "k"
                }
            }
        },
        fill: {
            opacity: [1, .5],
            type: ["gradient", "solid"],
            gradient: {
                type: "vertical",
                inverseColors: !1,
                opacityFrom: .5,
                opacityTo: 0,
                stops: [0, 70]
            }
        },
        legend: {
            offsetY: 15
        }
    })
});
class VectorMap {
    currentResizeHandler = null;
    init() {
        this.initWorldMarkerLine()
    }
    initVectorMap(t, r = {}) {
        let o = null;
        if (o = t instanceof Element ? t : document.querySelector(t)) {
            o.querySelector("svg") && ((t = o.jsVectorMap) && "function" == typeof t.destroy ? t.destroy() : o.innerHTML = ""), this.currentResizeHandler && (window.removeEventListener("resize", this.currentResizeHandler), this.currentResizeHandler = null);
            let e = new jsVectorMap({
                selector: o,
                ...r
            });
            t = debounce(() => {
                e.updateSize()
            }, 200);
            this.currentResizeHandler = t, window.addEventListener("resize", this.currentResizeHandler)
        }
    }
    initWorldMarkerLine() {
        this.initVectorMap("#revenue-by-location", {
            map: "world_merc",
            zoomOnScroll: !1,
            zoomButtons: !1,
            markers: [{
                name: "Australia",
                coords: [-25.2744, 133.7751]
            }, {
                name: "India",
                coords: [20.5937, 78.9629]
            }, {
                name: "Japan",
                coords: [36.2048, 138.2529]
            }, {
                name: "South Africa",
                coords: [-30.5595, 22.9375]
            }, {
                name: "Germany",
                coords: [51.1657, 10.4515]
            }, {
                name: "United Kingdom",
                coords: [55.3781, -3.436]
            }, {
                name: "Mexico",
                coords: [23.6345, -102.5528]
            }, {
                name: "Argentina",
                coords: [-38.4161, -63.6167]
            }, {
                name: "Saudi Arabia",
                coords: [23.8859, 45.0792]
            }, {
                name: "Indonesia",
                coords: [-.7893, 113.9213]
            }],
            lines: [{
                from: "India",
                to: "Australia"
            }, {
                from: "Japan",
                to: "Germany"
            }, {
                from: "Mexico",
                to: "United Kingdom"
            }, {
                from: "Argentina",
                to: "South Africa"
            }, {
                from: "Saudi Arabia",
                to: "India"
            }, {
                from: "Indonesia",
                to: "Japan"
            }, {
                from: "United Kingdom",
                to: "Germany"
            }, {
                from: "Australia",
                to: "Indonesia"
            }],
            regionStyle: {
                initial: {
                    stroke: "#aab9d14d",
                    strokeWidth: .25,
                    fill: "#aab9d14d",
                    fillOpacity: 1
                }
            },
            markerStyle: {
                initial: {
                    fill: theme("secondary")
                },
                selected: {
                    fill: theme("secondary")
                }
            },
            lineStyle: {
                animation: !0,
                strokeDasharray: "1 2 3 4 5 6"
            }
        })
    }
}
document.addEventListener("DOMContentLoaded", function (e) {
    (new VectorMap).init()
});
let mapObserver = new MutationObserver(() => {
    (new VectorMap).init()
});
mapObserver.observe(document.documentElement, {
    attributes: !0,
    attributeFilter: ["data-skin", "data-bs-theme"]
});
