exports.id = 957;
exports.ids = [957];
exports.modules = {

/***/ 8287:
/***/ ((module) => {

// Exports
module.exports = {
	"wiggler": "wiggler_wiggler__ONAuj",
	"wiggle1": "wiggler_wiggle1__MWdKX",
	"wiggle2": "wiggler_wiggle2__2Hr80"
};


/***/ }),

/***/ 4255:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, {
  "yR": () => (/* binding */ DashboardContextProvider),
  "QU": () => (/* binding */ useDashboard)
});

// UNUSED EXPORTS: getThirdPartyWidget

// EXTERNAL MODULE: ../../node_modules/react/jsx-runtime.js
var jsx_runtime = __webpack_require__(2322);
// EXTERNAL MODULE: external "react"
var external_react_ = __webpack_require__(6689);
var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
// EXTERNAL MODULE: ../core/frontend/dist/_index.js
var _index = __webpack_require__(4536);
;// CONCATENATED MODULE: ./src/helpers/WidgetErrorBoundary.tsx


class WidgetErrorBoundary_WidgetErrorBoundary extends (external_react_default()).Component {
    constructor(props){
        super(props);
        this.state = {
            hasError: false,
            errorMessage: ""
        };
    }
    static getDerivedStateFromError(error) {
        return {
            hasError: true,
            errorMessage: JSON.stringify(error?.error ?? error?.message)
        };
    }
    componentDidCatch(error, errorInfo) {
        console.error(error, errorInfo);
    }
    render() {
        if (this.state.hasError) {
            return /*#__PURE__*/ _jsxs("div", {
                children: [
                    /*#__PURE__*/ _jsxs("p", {
                        children: [
                            "Widget ",
                            this.props.widgetName,
                            " crashed"
                        ]
                    }),
                    /*#__PURE__*/ _jsx("p", {
                        children: this.state.errorMessage
                    })
                ]
            });
        }
        return this.props.children;
    }
}

;// CONCATENATED MODULE: ./src/hooks/useDashboard.tsx




const getThirdPartyWidget = (widgetName, widgetProps)=>{
    const widgets = getWidgets(widgetName) ?? {};
    return Object.keys(widgets).map((pluginName)=>{
        const Comp = widgets[pluginName];
        if (!Comp) return null;
        return /*#__PURE__*/ _jsx(WidgetErrorBoundary, {
            widgetName: pluginName,
            children: /*#__PURE__*/ _jsx(Comp, {
                ...typeof widgetProps !== "object" ? {} : widgetProps
            })
        }, pluginName);
    }).filter(Boolean);
};
const defaultWidgetList = [
    {
        id: "productRating",
        title: "Avg. Product Rating"
    },
    {
        id: "salesValue",
        title: "Total Sales"
    },
    {
        id: "pageViews",
        title: "Total Page Views"
    },
    {
        id: "salesValueLastWeek",
        title: "Weekly Sales Chart"
    },
    {
        id: "ordersLastWeek",
        title: "Weekly Orders Chart"
    },
    {
        id: "productReviews",
        title: "Latest Product Reviews"
    },
    {
        id: "pageViewsStats",
        title: "Top Page Views"
    }
];
const getDefaultLayout = (widgetKey)=>{
    return {
        h: 4,
        i: widgetKey,
        minH: 2,
        minW: 2,
        moved: false,
        static: false,
        w: 4,
        x: 100,
        y: 100
    };
};
const useDashboardContext = ()=>{
    const cstore = (0,_index.getCStore)();
    const [stats, setStats] = (0,external_react_.useState)();
    const [reviews, setReviews] = (0,external_react_.useState)([]);
    const [isLoadingStats, setLoadingStats] = (0,external_react_.useState)(true);
    const [isLoadingReviews, setLoadingReviews] = (0,external_react_.useState)(true);
    const [layout, setLayout] = (0,external_react_.useState)();
    const [lastSnapshot, setLastSnapshot] = (0,external_react_.useState)();
    const [isLoadingLayout, setLoading] = (0,external_react_.useState)(true);
    const [customWidgets, setCustomWidgets] = (0,external_react_.useState)([]);
    const [widgetList, setWidgetList] = (0,external_react_.useState)(defaultWidgetList);
    (0,external_react_.useEffect)(()=>{
        (0,_index.onWidgetRegister)("Dashboard", (pluginName)=>{
            // console.log("PLUGIN WIDGET", pluginName);
            setWidgetList((o)=>[
                    ...o,
                    {
                        id: pluginName,
                        title: pluginName
                    }
                ]);
            setCustomWidgets((0,_index.getWidgetsForPlace)("Dashboard", {
                stats,
                setSize: ()=>{}
            }));
        });
    }, []);
    const getReviews = (0,external_react_.useCallback)(async ()=>{
        setLoadingReviews(true);
        try {
            const nReviews = await (0,_index.getGraphQLClient)()?.getProductReviews({
                pagedParams: {
                    pageSize: 10
                }
            });
            if (nReviews?.elements) {
                setReviews(nReviews.elements);
            }
        } catch (e) {}
        setLoadingReviews(false);
    }, []);
    const getStats = (0,external_react_.useCallback)(async ()=>{
        setLoadingStats(true);
        const client = (0,_index.getRestApiClient)();
        try {
            const nStats = await client?.getCmsStats();
            if (nStats) {
                nStats.salesPerDay = nStats.salesPerDay.map((p)=>({
                        ...p,
                        date: new Date(p.date)
                    })).reverse();
                setStats(nStats);
            }
        } catch (e) {}
        setLoadingStats(false);
    }, []);
    const getLayout = (0,external_react_.useCallback)(async ()=>{
        const client = (0,_index.getRestApiClient)();
        const settings = await client.getDashboardLayout();
        setLayout(settings.layout);
        setLastSnapshot(JSON.parse(JSON.stringify(settings.layout)));
        setLoading(false);
    }, []);
    const deleteWidget = (0,external_react_.useCallback)(async (widgetKey)=>{
        if (!widgetKey || widgetKey === "") return;
        setLayout((oldLayout)=>({
                xxs: oldLayout?.xxs?.filter((l)=>l.i !== widgetKey),
                xs: oldLayout?.xs?.filter((l)=>l.i !== widgetKey),
                sm: oldLayout?.sm?.filter((l)=>l.i !== widgetKey),
                md: oldLayout?.md?.filter((l)=>l.i !== widgetKey),
                lg: oldLayout?.lg?.filter((l)=>l.i !== widgetKey)
            }));
    }, []);
    const addWidget = (0,external_react_.useCallback)(async (widgetKey)=>{
        setLayout((oldLayout)=>{
            if (oldLayout.lg.find((k)=>k.i === widgetKey)) {
                return oldLayout;
            }
            return {
                xxs: [
                    ...oldLayout?.xxs ?? [],
                    getDefaultLayout(widgetKey)
                ],
                xs: [
                    ...oldLayout?.xs ?? [],
                    getDefaultLayout(widgetKey)
                ],
                sm: [
                    ...oldLayout?.sm ?? [],
                    getDefaultLayout(widgetKey)
                ],
                md: [
                    ...oldLayout?.md ?? [],
                    getDefaultLayout(widgetKey)
                ],
                lg: [
                    ...oldLayout?.lg ?? [],
                    getDefaultLayout(widgetKey)
                ]
            };
        });
        setTimeout(()=>{
            const element = document.getElementById(widgetKey);
            if (element) {
                element.scrollIntoView({
                    behavior: "smooth",
                    block: "center",
                    inline: "center"
                });
            }
        }, 100);
    }, []);
    const saveLayout = (0,external_react_.useCallback)(async ()=>{
        const client = (0,_index.getRestApiClient)();
        await client.saveDashboardLayout({
            type: "user",
            layout
        });
        setLastSnapshot(layout);
    }, [
        layout
    ]);
    const resetToSnapshot = (0,external_react_.useCallback)(async ()=>{
        setLayout(lastSnapshot);
    }, [
        lastSnapshot
    ]);
    (0,external_react_.useEffect)(()=>{
        getLayout();
    }, [
        getLayout
    ]);
    const isLoading = isLoadingLayout || isLoadingReviews || isLoadingStats;
    return {
        layout,
        isLoadingLayout,
        isLoading,
        stats,
        reviews,
        getStats,
        getReviews,
        deleteWidget,
        getLayout,
        setLayout,
        addWidget,
        widgetList,
        saveLayout,
        resetToSnapshot,
        isLoadingReviews,
        isLoadingStats,
        customWidgets,
        cstore
    };
};
const useDashboard = ()=>{
    return external_react_default().useContext(DashboardContext);
};
const Empty = {};
const DashboardContext = /*#__PURE__*/ external_react_default().createContext(Empty);
const DashboardContextProvider = ({ children  })=>{
    const value = useDashboardContext();
    return /*#__PURE__*/ jsx_runtime.jsx(DashboardContext.Provider, {
        value: value,
        children: children
    });
};


/***/ }),

/***/ 266:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* unused harmony export useLongPress */
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6689);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);

const useLongPress = (onLongPress, onClick, { shouldPreventDefault =true , delay =300  } = {})=>{
    const [longPressTriggered, setLongPressTriggered] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
    const timeout = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
    const target = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
    const start = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((event)=>{
        if (shouldPreventDefault && event.target) {
            event.target.addEventListener("touchend", preventDefault, {
                passive: false
            });
            target.current = event.target;
        }
        timeout.current = setTimeout(()=>{
            onLongPress(event);
            setLongPressTriggered(true);
        }, delay);
    }, [
        onLongPress,
        delay,
        shouldPreventDefault
    ]);
    const clear = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((event, shouldTriggerClick = true)=>{
        timeout.current && clearTimeout(timeout.current);
        shouldTriggerClick && !longPressTriggered && onClick();
        setLongPressTriggered(false);
        if (shouldPreventDefault && target.current) {
            target.current.removeEventListener("touchend", preventDefault);
        }
    }, [
        shouldPreventDefault,
        onClick,
        longPressTriggered
    ]);
    return {
        onMouseDown: (e)=>start(e),
        onTouchStart: (e)=>start(e),
        onMouseUp: (e)=>clear(e),
        onMouseLeave: (e)=>clear(e, false),
        onTouchEnd: (e)=>clear(e)
    };
};
const isTouchEvent = (event)=>{
    return "touches" in event;
};
const preventDefault = (event)=>{
    if (!isTouchEvent(event)) return;
    if (event.touches.length < 2 && event.preventDefault) {
        event.preventDefault();
    }
};
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (useLongPress);


/***/ }),

/***/ 6957:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "DashboardWrapper": () => (/* binding */ DashboardWrapper),
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2322);
/* harmony import */ var _components_buttons_TextButton__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2789);
/* harmony import */ var _components_sideNav_ResponsiveSideNav__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8031);
/* harmony import */ var _heroicons_react_24_outline__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2135);
/* harmony import */ var _heroicons_react_24_outline__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_heroicons_react_24_outline__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _hooks_useDashboard__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(4255);
/* harmony import */ var _hooks_useLongPress__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(266);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(6689);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var react_grid_layout__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(1050);
/* harmony import */ var react_grid_layout__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(react_grid_layout__WEBPACK_IMPORTED_MODULE_7__);
/* harmony import */ var _components_addWidgetMenu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(4870);
/* harmony import */ var _widgets_ordersLastWeek__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(1345);
/* harmony import */ var _widgets_pageViews__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(566);
/* harmony import */ var _widgets_pageViewsList__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(2938);
/* harmony import */ var _widgets_productRating__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(9855);
/* harmony import */ var _widgets_productReviews__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(2978);
/* harmony import */ var _widgets_salesLastWeek__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(3039);
/* harmony import */ var _widgets_salesValue__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(2990);
/* harmony import */ var _widgets_widgetPanel__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(5167);
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_components_sideNav_ResponsiveSideNav__WEBPACK_IMPORTED_MODULE_2__, _components_addWidgetMenu__WEBPACK_IMPORTED_MODULE_8__]);
([_components_sideNav_ResponsiveSideNav__WEBPACK_IMPORTED_MODULE_2__, _components_addWidgetMenu__WEBPACK_IMPORTED_MODULE_8__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);

















const ResponsiveGridLayout = (0,react_grid_layout__WEBPACK_IMPORTED_MODULE_7__.WidthProvider)(react_grid_layout__WEBPACK_IMPORTED_MODULE_7__.Responsive);
const Dashboard = ()=>{
    const [isEditing, setEditing] = (0,react__WEBPACK_IMPORTED_MODULE_6__.useState)(false);
    const { isLoadingLayout , layout , saveLayout , setLayout , getReviews , getStats , resetToSnapshot , customWidgets  } = (0,_hooks_useDashboard__WEBPACK_IMPORTED_MODULE_4__/* .useDashboard */ .QU)();
    const longPressEvent = (0,_hooks_useLongPress__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z)(()=>{
        setEditing(true);
    }, ()=>{}, {
        shouldPreventDefault: false,
        delay: 2000
    });
    (0,react__WEBPACK_IMPORTED_MODULE_6__.useEffect)(()=>{
        getReviews();
        getStats();
    }, [
        getReviews
    ]);
    if (isLoadingLayout) {
        return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(DashboardLoader, {});
    }
    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
        className: "relative",
        children: [
            /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                className: `${isEditing ? "bg-white shadow-md top-2 rounded-lg " : ""} sticky top-0 backdrop-filter backdrop-blur-xl z-[40] flex flex-row py-3 px-4 justify-between transform transition-all items-center`,
                children: [
                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_sideNav_ResponsiveSideNav__WEBPACK_IMPORTED_MODULE_2__/* .SideNavMobileButton */ .im, {}),
                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("h1", {
                        className: "font-bold text-2xl inline-block",
                        children: isEditing ? "Edit" : "Dashboard"
                    }),
                    isEditing && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_addWidgetMenu__WEBPACK_IMPORTED_MODULE_8__/* .AddWidgetMenu */ .z, {}),
                    isEditing && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                        className: "flex self-center",
                        children: [
                            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_buttons_TextButton__WEBPACK_IMPORTED_MODULE_1__/* .TextButton */ .A, {
                                variant: "outlined",
                                className: "mx-1 text-xs py-1 mr-2",
                                onClick: ()=>{
                                    resetToSnapshot();
                                    setEditing(false);
                                },
                                children: "Cancel"
                            }),
                            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_buttons_TextButton__WEBPACK_IMPORTED_MODULE_1__/* .TextButton */ .A, {
                                onClick: async ()=>{
                                    await saveLayout();
                                    setEditing(false);
                                },
                                children: "Save"
                            })
                        ]
                    }),
                    !isEditing && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("button", {
                        onClick: ()=>{
                            setEditing(true);
                        },
                        className: "bg-none bg-transparent text-xs px-4 text-indigo-500 self-center",
                        children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_heroicons_react_24_outline__WEBPACK_IMPORTED_MODULE_3__.CogIcon, {
                            className: "h-4 w-4"
                        })
                    })
                ]
            }),
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                className: "",
                ...longPressEvent,
                children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(ResponsiveGridLayout, {
                    margin: [
                        15,
                        15
                    ],
                    layouts: layout,
                    isDraggable: isEditing,
                    isResizable: isEditing,
                    onLayoutChange: (current, nextLayout)=>{
                        setLayout(nextLayout);
                    },
                    breakpoints: {
                        lg: 1200,
                        md: 996,
                        sm: 768,
                        xs: 480,
                        xxs: 0
                    },
                    cols: {
                        lg: 12,
                        md: 9,
                        sm: 6,
                        xs: 4,
                        xxs: 2
                    },
                    rowHeight: 30,
                    children: layout?.lg?.map((item)=>{
                        let content;
                        if (item.i === "productRating") {
                            content = /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_widgets_productRating__WEBPACK_IMPORTED_MODULE_12__/* .ProductRatingWidget */ .S, {
                                id: "productRating",
                                isEditing: isEditing
                            });
                        }
                        if (item.i === "salesValue") {
                            content = /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_widgets_salesValue__WEBPACK_IMPORTED_MODULE_15__/* .SalesValueWidget */ .H, {
                                id: "salesValue",
                                isEditing: isEditing
                            });
                        }
                        if (item.i === "pageViews") {
                            content = /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_widgets_pageViews__WEBPACK_IMPORTED_MODULE_10__/* .PageViewsWidget */ .t, {
                                id: "pageViews",
                                isEditing: isEditing
                            });
                        }
                        if (item.i === "salesValueLastWeek") {
                            content = /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_widgets_salesLastWeek__WEBPACK_IMPORTED_MODULE_14__/* .SalesLastWeekWidget */ .m, {
                                id: "salesValueLastWeek",
                                isEditing: isEditing
                            });
                        }
                        if (item.i === "pageViewsStats") {
                            content = /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_widgets_pageViewsList__WEBPACK_IMPORTED_MODULE_11__/* .PageViewsList */ .t, {
                                id: "pageViewsStats",
                                isEditing: isEditing
                            });
                        }
                        if (item.i === "productReviews") {
                            content = /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_widgets_productReviews__WEBPACK_IMPORTED_MODULE_13__/* .ProductReviewsList */ .B, {
                                id: "productReviews",
                                isEditing: isEditing
                            });
                        }
                        if (item.i === "ordersLastWeek") {
                            content = /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_widgets_ordersLastWeek__WEBPACK_IMPORTED_MODULE_9__/* .OrdersLastWeekWidget */ .x, {
                                id: "ordersLastWeek",
                                isEditing: isEditing
                            });
                        }
                        if (!content) {
                            const widgetName = item.i?.replace("$widget_", "");
                            const widget = customWidgets.find((k)=>k.key === widgetName);
                            if (widgetName && widget) {
                                content = /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_widgets_widgetPanel__WEBPACK_IMPORTED_MODULE_16__/* .WidgetPanel */ .y, {
                                    isEditing: isEditing,
                                    id: widgetName,
                                    children: widget
                                });
                            }
                        }
                        return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                            id: item.i?.replace("$widget_", ""),
                            className: "h-full w-full",
                            children: content
                        }, item.i);
                    }).filter(Boolean)
                })
            })
        ]
    });
};
const DashboardLoader = ()=>{
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
        className: "grid gap-6 grid-cols-1 md:grid-cols-2 lg:grid-cols-3",
        children: Array(6).fill(0).map((k, id)=>/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                className: "bg-white flex flex-col rounded-2xl shadow-lg p-2 gap-5 select-none sm:flex-row sm:h-64 sm:p-4 ",
                children: [
                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                        className: "rounded-xl bg-gray-200 h-52 animate-pulse sm:h-full sm:w-72"
                    }),
                    /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                        className: "flex flex-col flex-1 gap-5 sm:p-2",
                        children: [
                            /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                                className: "flex flex-col flex-1 gap-3",
                                children: [
                                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                                        className: "bg-gray-200 rounded-2xl h-14 w-full animate-pulse"
                                    }),
                                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                                        className: "bg-gray-200 rounded-2xl h-3 w-full animate-pulse"
                                    }),
                                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                                        className: "bg-gray-200 rounded-2xl h-3 w-full animate-pulse"
                                    }),
                                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                                        className: "bg-gray-200 rounded-2xl h-3 w-full animate-pulse"
                                    }),
                                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                                        className: "bg-gray-200 rounded-2xl h-3 w-full animate-pulse"
                                    })
                                ]
                            }),
                            /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                                className: "flex mt-auto gap-3",
                                children: [
                                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                                        className: "rounded-full bg-gray-200 h-8 animate-pulse w-20"
                                    }),
                                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                                        className: "rounded-full bg-gray-200 h-8 animate-pulse w-20"
                                    }),
                                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                                        className: "rounded-full ml-auto bg-gray-200 h-8 animate-pulse w-20"
                                    })
                                ]
                            })
                        ]
                    })
                ]
            }, id))
    });
};
const DashboardWrapper = ()=>{
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_hooks_useDashboard__WEBPACK_IMPORTED_MODULE_4__/* .DashboardContextProvider */ .yR, {
        children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
            className: "p-4",
            children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(Dashboard, {})
        })
    });
};
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (DashboardWrapper);

__webpack_async_result__();
} catch(e) { __webpack_async_result__(e); } });

/***/ }),

/***/ 4241:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (/* binding */ StarRating)
/* harmony export */ });
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2322);
/* harmony import */ var _heroicons_react_24_outline__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2135);
/* harmony import */ var _heroicons_react_24_outline__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_heroicons_react_24_outline__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _heroicons_react_24_solid__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8802);
/* harmony import */ var _heroicons_react_24_solid__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_heroicons_react_24_solid__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6689);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);




const StarRating = ({ value =0 , maxValue =5 , className =""  })=>{
    const fillValue = value / maxValue;
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
        className: `block relative h-4 ${className}`,
        children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
            className: "relative",
            children: [
                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                    style: {
                        width: `${maxValue * 1.5}rem`
                    },
                    className: "top-0 left-0 absolute",
                    children: Array(maxValue).fill(0).map((star, idx)=>/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_heroicons_react_24_outline__WEBPACK_IMPORTED_MODULE_1__.StarIcon, {
                            className: "h-4 text-orange-500 w-4 inline-block"
                        }, idx))
                }),
                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                    style: {
                        width: `${fillValue * maxValue * 1.5}rem`
                    },
                    className: `absolute left-0 top-0 w-full overflow-x-hidden whitespace-nowrap`,
                    children: Array(maxValue).fill(0).map((star, idx)=>/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_heroicons_react_24_solid__WEBPACK_IMPORTED_MODULE_2__.StarIcon, {
                            className: "h-4 text-orange-500 w-4 inline"
                        }, idx))
                })
            ]
        })
    });
};


/***/ }),

/***/ 4870:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "z": () => (/* binding */ AddWidgetMenu)
/* harmony export */ });
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2322);
/* harmony import */ var _headlessui_react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1185);
/* harmony import */ var _heroicons_react_24_outline__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2135);
/* harmony import */ var _heroicons_react_24_outline__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_heroicons_react_24_outline__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _hooks_useDashboard__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4255);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6689);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__);
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_headlessui_react__WEBPACK_IMPORTED_MODULE_1__]);
_headlessui_react__WEBPACK_IMPORTED_MODULE_1__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];





const AddWidgetMenu = ()=>{
    const { widgetList , addWidget  } = (0,_hooks_useDashboard__WEBPACK_IMPORTED_MODULE_3__/* .useDashboard */ .QU)();
    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_1__.Menu, {
        as: "div",
        className: "text-left relative inline-block",
        children: [
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_1__.Menu.Button, {
                    className: " rounded-md font-medium text-sm w-full py-2 px-4 text-indigo-600 inline-flex justify-center hover:bg-indigo-100 focus:outline-none focus-visible:ring-white focus-visible:ring-2 focus-visible:ring-opacity-75",
                    children: [
                        "Add",
                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_heroicons_react_24_outline__WEBPACK_IMPORTED_MODULE_2__.ChevronDownIcon, {
                            className: "h-5 -mr-1 ml-2 text-violet-400 w-5 hover:text-violet-300",
                            "aria-hidden": "true"
                        })
                    ]
                })
            }),
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_headlessui_react__WEBPACK_IMPORTED_MODULE_1__.Transition, {
                as: react__WEBPACK_IMPORTED_MODULE_4__.Fragment,
                enter: "transition ease-out duration-100",
                enterFrom: "transform opacity-0 scale-95",
                enterTo: "transform opacity-100 scale-100",
                leave: "transition ease-in duration-75",
                leaveFrom: "transform opacity-100 scale-100",
                leaveTo: "transform opacity-0 scale-95",
                children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_headlessui_react__WEBPACK_IMPORTED_MODULE_1__.Menu.Items, {
                    className: "divide-y bg-white rounded-md divide-gray-100 shadow-lg ring-black mt-2 transform origin-top right-0 ring-1 ring-opacity-5 w-56 translate-x-1/2 absolute focus:outline-none",
                    children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                        className: "py-1 px-1 ",
                        children: widgetList.map((wdgt, idx)=>/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_headlessui_react__WEBPACK_IMPORTED_MODULE_1__.Menu.Item, {
                                children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("button", {
                                    onClick: ()=>addWidget(wdgt.id),
                                    className: `text-gray-900 group hover:bg-indigo-200 flex rounded-md items-center w-full px-2 py-2 text-sm`,
                                    children: wdgt.title
                                })
                            }, idx))
                    })
                })
            })
        ]
    });
};

__webpack_async_result__();
} catch(e) { __webpack_async_result__(e); } });

/***/ }),

/***/ 1345:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "x": () => (/* binding */ OrdersLastWeekWidget)
/* harmony export */ });
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2322);
/* harmony import */ var _hooks_useDashboard__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4255);
/* harmony import */ var _visx_gradient__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8519);
/* harmony import */ var _visx_gradient__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_visx_gradient__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _visx_xychart__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5273);
/* harmony import */ var _visx_xychart__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_visx_xychart__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(4146);
/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(date_fns__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6689);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var react_resize_detector__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(6105);
/* harmony import */ var react_resize_detector__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(react_resize_detector__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var _widgetPanel__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(5167);








function numFormat(num, digits) {
    const lookup = [
        {
            value: 1,
            symbol: ""
        },
        {
            value: 1e3,
            symbol: "k"
        },
        {
            value: 1e6,
            symbol: "M"
        },
        {
            value: 1e9,
            symbol: "G"
        },
        {
            value: 1e12,
            symbol: "T"
        },
        {
            value: 1e15,
            symbol: "P"
        },
        {
            value: 1e18,
            symbol: "E"
        }
    ];
    const rx = /\.0+$|(\.[0-9]*[1-9])0+$/;
    const item = lookup.slice().reverse().find(function(item) {
        return num >= item.value;
    });
    return item ? (num / item.value).toFixed(digits).replace(rx, "$1") + item.symbol : "0";
}
const OrdersLastWeekWidget = ({ isEditing =false , id ="ordersLastWeek"  })=>{
    const { stats , isLoadingStats  } = (0,_hooks_useDashboard__WEBPACK_IMPORTED_MODULE_1__/* .useDashboard */ .QU)();
    const { width , height , ref  } = (0,react_resize_detector__WEBPACK_IMPORTED_MODULE_6__.useResizeDetector)();
    const accessors = {
        xAccessor: (d)=>d?.date,
        yAccessor: (d)=>d?.orders
    };
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_widgetPanel__WEBPACK_IMPORTED_MODULE_7__/* .WidgetPanel */ .y, {
        isEditing: isEditing,
        id: id,
        children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
            className: "h-full w-full",
            children: [
                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                    className: "col-span-2" + " draggableCancel",
                    children: [
                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("h3", {
                            className: "block text-xl",
                            children: "Orders last week"
                        }),
                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("p", {
                            className: `${isLoadingStats ? "animate-pulse w-full rounded-md h-6 bg-gray-200" : "font-bold text-2xl"}`,
                            id: "ordersLastWeek",
                            children: isLoadingStats ? "" : stats?.salesPerDay?.reduce((prev, curr)=>curr.orders + prev, 0) ?? 0
                        })
                    ]
                }),
                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                    ref: ref,
                    className: "h-[calc(100%-4rem)] text-xs text-black grid w-[calc(100%-2rem)] chart",
                    children: !isLoadingStats && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_visx_xychart__WEBPACK_IMPORTED_MODULE_3__.XYChart, {
                        width: width,
                        height: height,
                        xScale: {
                            type: "band",
                            clamp: true,
                            paddingInner: 0.4
                        },
                        yScale: {
                            type: "linear"
                        },
                        children: [
                            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_visx_gradient__WEBPACK_IMPORTED_MODULE_2__.LinearGradient, {
                                id: "order-bg",
                                from: "rgba(128, 255, 165, .4)",
                                to: "rgba(1, 191, 236, .8)"
                            }),
                            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_visx_xychart__WEBPACK_IMPORTED_MODULE_3__.AnimatedGrid, {
                                columns: false,
                                numTicks: 4,
                                lineStyle: {
                                    stroke: "#e1e1e1",
                                    strokeLinecap: "round",
                                    strokeWidth: 1
                                },
                                strokeDasharray: "0, 4"
                            }),
                            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_visx_xychart__WEBPACK_IMPORTED_MODULE_3__.AnimatedAxis, {
                                hideAxisLine: true,
                                // hideTicks
                                orientation: "bottom",
                                // tickLabelProps={() => ({
                                //   dy: 10,
                                //   // dx: 0
                                // })}
                                // left={80}
                                numTicks: 7,
                                tickFormat: (v)=>(0,date_fns__WEBPACK_IMPORTED_MODULE_4__.format)(v, "EEE")
                            }),
                            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_visx_xychart__WEBPACK_IMPORTED_MODULE_3__.AnimatedAxis, {
                                hideAxisLine: true,
                                hideTicks: true,
                                orientation: "left",
                                numTicks: 7
                            }),
                            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_visx_xychart__WEBPACK_IMPORTED_MODULE_3__.AnimatedBarSeries, {
                                // fill="url(#order-bg)"
                                colorAccessor: ()=>"url(#order-bg)",
                                dataKey: "orderWeekBar",
                                barPadding: 0.5,
                                data: stats?.salesPerDay,
                                radius: 10,
                                radiusTop: true,
                                ...accessors
                            }),
                            !isEditing && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_visx_xychart__WEBPACK_IMPORTED_MODULE_3__.Tooltip, {
                                showVerticalCrosshair: true,
                                showHorizontalCrosshair: true,
                                glyphStyle: {
                                    fill: "#3398DB",
                                    strokeWidth: 2
                                },
                                renderTooltip: ({ tooltipData  })=>{
                                    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                                        className: "rounded-lg text-xs py-4 px-2 text-indigo-500",
                                        children: Object.entries(tooltipData.datumByKey).map((lineDataArray)=>{
                                            const [key, value] = lineDataArray;
                                            return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                                                className: "row",
                                                children: [
                                                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                                                        className: "font-bold text-xs text-black mb-2",
                                                        children: (0,date_fns__WEBPACK_IMPORTED_MODULE_4__.format)(accessors.xAccessor(value.datum), "MMM d")
                                                    }),
                                                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("p", {
                                                        className: "font-light mt-2 text-xs text-gray-600",
                                                        children: "Orders"
                                                    }),
                                                    /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                                                        className: "flex font-semibold items-center",
                                                        children: [
                                                            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                                                                className: "rounded bg-[#3398DB] h-3 mr-2 w-3 inline-block"
                                                            }),
                                                            numFormat(accessors.yAccessor(value.datum), 2)
                                                        ]
                                                    })
                                                ]
                                            }, key);
                                        })
                                    });
                                }
                            })
                        ]
                    })
                })
            ]
        })
    });
};


/***/ }),

/***/ 566:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "t": () => (/* binding */ PageViewsWidget)
/* harmony export */ });
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2322);
/* harmony import */ var _hooks_useDashboard__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4255);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6689);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _widgetPanel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5167);




const PageViewsWidget = ({ isEditing =false , id ="pageViews"  })=>{
    const { stats , isLoadingStats  } = (0,_hooks_useDashboard__WEBPACK_IMPORTED_MODULE_1__/* .useDashboard */ .QU)();
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_widgetPanel__WEBPACK_IMPORTED_MODULE_3__/* .WidgetPanel */ .y, {
        isEditing: isEditing,
        id: id,
        children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
            className: "grid grid-cols-3 md:grid-cols-3",
            children: [
                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                    className: "bg-cover mx-auto h-12 w-12 self-center",
                    style: {
                        backgroundImage: "url(/admin/static/dashboard-views.png)"
                    }
                }),
                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                    className: "col-span-2" + " draggableCancel",
                    children: [
                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("h3", {
                            className: "block text-xl",
                            children: "Page views"
                        }),
                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("p", {
                            className: `${isLoadingStats ? "animate-pulse w-full rounded-md h-6 bg-gray-200" : "font-bold text-2xl"}`,
                            id: "pageViews",
                            children: isLoadingStats ? "" : stats?.pageViews
                        }),
                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("p", {
                            className: `${isLoadingStats ? "animate-pulse w-full rounded-md h-6 bg-gray-200" : ""} text-xs text-gray-500 m-0`,
                            children: !isLoadingStats && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("span", {
                                children: [
                                    "for ",
                                    stats?.pages ?? 0,
                                    " pages"
                                ]
                            })
                        })
                    ]
                })
            ]
        })
    });
};


/***/ }),

/***/ 2938:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "t": () => (/* binding */ PageViewsList)
/* harmony export */ });
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2322);
/* harmony import */ var _heroicons_react_24_solid__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8802);
/* harmony import */ var _heroicons_react_24_solid__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_heroicons_react_24_solid__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _hooks_useDashboard__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4255);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6689);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _widgetPanel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(5167);





const PageViewsList = ({ isEditing =false , id ="pageViewsStats"  })=>{
    const { stats , isLoadingStats  } = (0,_hooks_useDashboard__WEBPACK_IMPORTED_MODULE_2__/* .useDashboard */ .QU)();
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_widgetPanel__WEBPACK_IMPORTED_MODULE_4__/* .WidgetPanel */ .y, {
        isEditing: isEditing,
        id: id,
        children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
            className: "h-full flex flex-col",
            children: [
                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("h3", {
                    className: "bg-white pb-2 w-[calc(100%-10px)] block text-xl",
                    children: "Page views"
                }),
                !isLoadingStats && !stats?.topPageViews?.length && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                    className: "flex center h-full",
                    children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("p", {
                        className: "text-lg",
                        children: "no data yet"
                    })
                }),
                !isLoadingStats && !!stats?.topPageViews?.length && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                    className: "h-[calc(100%-26px)] grid grid-cols-1 relative overflow-y-auto scrollbar-slim",
                    children: stats?.topPageViews?.map((pageView, idx)=>/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                            className: "rounded-lg space-y-2 text-xs grid transform transition-colors gap-4 grid-cols-6 group hover:bg-indigo-100",
                            children: [
                                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("h4", {
                                    className: "text-xs px-2 text-gray-400 col-span-3 self-center hover:text-indigo-800",
                                    children: pageView?.pageRoute
                                }),
                                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
                                    className: "font-bold text-gray-600 col-span-1 self-center",
                                    children: pageView?.views
                                }),
                                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("a", {
                                    href: `${pageView?.pageRoute}`,
                                    target: "_blank",
                                    rel: "noreferrer",
                                    className: "mr-4 col-span-2 justify-self-end",
                                    children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_heroicons_react_24_solid__WEBPACK_IMPORTED_MODULE_1__.ArrowTopRightOnSquareIcon, {
                                        className: "h-4 text-indigo-600 w-4 hover:text-indigo:-400"
                                    })
                                })
                            ]
                        }, idx))
                })
            ]
        })
    });
};


/***/ }),

/***/ 9855:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "S": () => (/* binding */ ProductRatingWidget)
/* harmony export */ });
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2322);
/* harmony import */ var _hooks_useDashboard__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4255);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6689);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _components_StarRating__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4241);
/* harmony import */ var _widgetPanel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(5167);





const ProductRatingWidget = ({ isEditing =false , id ="productRating"  })=>{
    const { stats , isLoadingStats  } = (0,_hooks_useDashboard__WEBPACK_IMPORTED_MODULE_1__/* .useDashboard */ .QU)();
    const avgRating = stats?.averageRating ?? 0;
    const reviewCount = stats?.reviews ?? 0;
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_widgetPanel__WEBPACK_IMPORTED_MODULE_4__/* .WidgetPanel */ .y, {
        isEditing: isEditing,
        id: id,
        children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
            className: "grid grid-cols-3 md:grid-cols-3",
            children: [
                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                    className: "bg-cover mx-auto h-12 w-12 self-center",
                    style: {
                        backgroundImage: "url(/admin/static/dashboard-rating.png)"
                    }
                }),
                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                    className: "col-span-2" + " draggableCancel",
                    children: [
                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("h3", {
                            className: "block text-xl",
                            children: "Product rating"
                        }),
                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_StarRating__WEBPACK_IMPORTED_MODULE_3__/* .StarRating */ .Z, {
                            value: avgRating,
                            className: "my-1 -ml-1",
                            maxValue: 5
                        }),
                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("p", {
                            className: `${isLoadingStats ? "animate-pulse w-full rounded-md h-6 bg-gray-200" : ""} text-xs font-bold`,
                            children: !isLoadingStats && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("span", {
                                children: [
                                    avgRating.toFixed(2),
                                    " - ",
                                    reviewCount,
                                    " ",
                                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
                                        className: "font-normal text-gray-600",
                                        children: "reviews"
                                    })
                                ]
                            })
                        })
                    ]
                })
            ]
        })
    });
};


/***/ }),

/***/ 2978:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "B": () => (/* binding */ ProductReviewsList)
/* harmony export */ });
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2322);
/* harmony import */ var _hooks_useDashboard__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4255);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6689);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _components_StarRating__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4241);
/* harmony import */ var _widgetPanel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(5167);





const ProductReviewsList = ({ isEditing =false , id ="productReviews"  })=>{
    const { reviews , isLoadingReviews  } = (0,_hooks_useDashboard__WEBPACK_IMPORTED_MODULE_1__/* .useDashboard */ .QU)();
    // console.log(stats);
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_widgetPanel__WEBPACK_IMPORTED_MODULE_4__/* .WidgetPanel */ .y, {
        isEditing: isEditing,
        id: id,
        children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
            className: "h-full",
            children: [
                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("h3", {
                    className: "bg-white pb-2 w-[calc(100%-10px)] block text-xl",
                    children: "Recent reviews"
                }),
                !isLoadingReviews && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                    className: "h-[calc(100%-26px)] grid grid-cols-1 relative overflow-y-auto scrollbar-slim",
                    children: reviews?.map((review, idx)=>/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                            className: "rounded-lg space-y-2 text-xs grid transform transition-colors gap-4 grid-cols-6 group hover:bg-indigo-100",
                            children: [
                                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("h4", {
                                    className: "text-xs px-2 text-gray-400 col-span-2 self-center hover:text-indigo-800",
                                    children: review?.userName ?? ""
                                }),
                                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("p", {
                                    className: `font-bold ${review.approved ? "text-green-800" : "text-orange-600"} h-full flex items-center col-span-2 self-center`,
                                    children: review?.approved ? "Approved" : "Pending"
                                }),
                                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                                    className: "space-y-1 grid py-1 grid-cols-1 col-span-1",
                                    children: [
                                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
                                            className: "",
                                            children: review.title ?? "-"
                                        }),
                                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_StarRating__WEBPACK_IMPORTED_MODULE_3__/* .StarRating */ .Z, {
                                            value: review.rating,
                                            maxValue: 5
                                        })
                                    ]
                                })
                            ]
                        }, idx))
                })
            ]
        })
    });
};


/***/ }),

/***/ 3039:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "m": () => (/* binding */ SalesLastWeekWidget)
/* harmony export */ });
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2322);
/* harmony import */ var _hooks_useDashboard__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4255);
/* harmony import */ var _visx_curve__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(9919);
/* harmony import */ var _visx_curve__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_visx_curve__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _visx_gradient__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8519);
/* harmony import */ var _visx_gradient__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_visx_gradient__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _visx_xychart__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(5273);
/* harmony import */ var _visx_xychart__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_visx_xychart__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(4146);
/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(date_fns__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(6689);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var react_resize_detector__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(6105);
/* harmony import */ var react_resize_detector__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(react_resize_detector__WEBPACK_IMPORTED_MODULE_7__);
/* harmony import */ var _widgetPanel__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(5167);









function numFormat(num, digits) {
    const lookup = [
        {
            value: 1,
            symbol: ""
        },
        {
            value: 1e3,
            symbol: "k"
        },
        {
            value: 1e6,
            symbol: "M"
        },
        {
            value: 1e9,
            symbol: "G"
        },
        {
            value: 1e12,
            symbol: "T"
        },
        {
            value: 1e15,
            symbol: "P"
        },
        {
            value: 1e18,
            symbol: "E"
        }
    ];
    const rx = /\.0+$|(\.[0-9]*[1-9])0+$/;
    const item = lookup.slice().reverse().find(function(item) {
        return num >= item.value;
    });
    return item ? (num / item.value).toFixed(digits).replace(rx, "$1") + item.symbol : "0";
}
const SalesLastWeekWidget = ({ isEditing =false , id ="salesValueLastWeek"  })=>{
    const { stats , isLoadingStats , cstore  } = (0,_hooks_useDashboard__WEBPACK_IMPORTED_MODULE_1__/* .useDashboard */ .QU)();
    const { width , ref  } = (0,react_resize_detector__WEBPACK_IMPORTED_MODULE_7__.useResizeDetector)();
    const accessors = {
        // getX: (d) => new Date(d?.date),
        xAccessor: (d)=>d?.date,
        // getY: (d) => d?.salesValue,
        yAccessor: (d)=>d?.salesValue
    };
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_widgetPanel__WEBPACK_IMPORTED_MODULE_8__/* .WidgetPanel */ .y, {
        isEditing: isEditing,
        id: id,
        children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
            className: "h-full w-full flex flex-col",
            children: [
                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                    className: "col-span-2" + " draggableCancel",
                    children: [
                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("h3", {
                            className: "block text-xl",
                            children: "Sales value last week"
                        }),
                        /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("p", {
                            className: `${isLoadingStats ? "animate-pulse w-full rounded-md h-6 bg-gray-200" : "font-bold text-2xl"}`,
                            id: "pageViews",
                            children: [
                                cstore.getActiveCurrencySymbol(),
                                isLoadingStats ? "" : stats?.salesPerDay?.reduce((prev, curr)=>curr.salesValue + prev, 0) ?? 0
                            ]
                        })
                    ]
                }),
                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                    ref: ref,
                    className: "h-full w-full text-xs text-black grid chart min-h-0 overflow-hidden relative",
                    children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                        className: "absolute top-[-30px] bottom-[-30px]",
                        children: !isLoadingStats && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_visx_xychart__WEBPACK_IMPORTED_MODULE_4__.XYChart, {
                            width: width,
                            xScale: {
                                type: "time",
                                clamp: true
                            },
                            yScale: {
                                type: "linear"
                            },
                            children: [
                                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_visx_gradient__WEBPACK_IMPORTED_MODULE_3__.LinearGradient, {
                                    id: "order-bg",
                                    from: "rgba(128, 255, 165, .4)",
                                    to: "rgba(1, 191, 236, .8)"
                                }),
                                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_visx_xychart__WEBPACK_IMPORTED_MODULE_4__.AnimatedGrid, {
                                    columns: false,
                                    numTicks: 4,
                                    lineStyle: {
                                        stroke: "#e1e1e1",
                                        strokeLinecap: "round",
                                        strokeWidth: 1
                                    },
                                    strokeDasharray: "0, 4"
                                }),
                                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_visx_xychart__WEBPACK_IMPORTED_MODULE_4__.AnimatedAxis, {
                                    hideAxisLine: true,
                                    // hideTicks
                                    orientation: "bottom",
                                    // tickLabelProps={() => ({
                                    //   dy: 10,
                                    //   dx: 0
                                    // })}
                                    // left={10}
                                    numTicks: 7,
                                    tickFormat: (v)=>(0,date_fns__WEBPACK_IMPORTED_MODULE_5__.format)(v, "EEE")
                                }),
                                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_visx_xychart__WEBPACK_IMPORTED_MODULE_4__.AnimatedAxis, {
                                    hideAxisLine: true,
                                    hideTicks: true,
                                    orientation: "left",
                                    numTicks: 7
                                }),
                                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_visx_xychart__WEBPACK_IMPORTED_MODULE_4__.AnimatedAreaSeries, {
                                    fill: "url(#order-bg)",
                                    enableEvents: true,
                                    curve: _visx_curve__WEBPACK_IMPORTED_MODULE_2__.curveMonotoneX,
                                    dataKey: "dataLine",
                                    data: stats?.salesPerDay,
                                    ...accessors
                                }),
                                !isEditing && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_visx_xychart__WEBPACK_IMPORTED_MODULE_4__.Tooltip, {
                                    showVerticalCrosshair: true,
                                    showHorizontalCrosshair: true,
                                    showDatumGlyph: true,
                                    showSeriesGlyphs: true,
                                    glyphStyle: {
                                        fill: "#3398DB",
                                        strokeWidth: 2
                                    },
                                    renderTooltip: ({ tooltipData  })=>{
                                        return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                                            className: "rounded-lg text-xs py-4 px-2 text-indigo-500",
                                            children: Object.entries(tooltipData.datumByKey).map((lineDataArray)=>{
                                                const [key, value] = lineDataArray;
                                                return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                                                    className: "row",
                                                    children: [
                                                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                                                            className: "font-bold text-xs text-black mb-2",
                                                            children: (0,date_fns__WEBPACK_IMPORTED_MODULE_5__.format)(accessors.xAccessor(value.datum), "MMM d")
                                                        }),
                                                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("p", {
                                                            className: "font-light mt-2 text-xs text-gray-600",
                                                            children: "Sales value"
                                                        }),
                                                        /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                                                            className: "flex font-semibold items-center",
                                                            children: [
                                                                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                                                                    className: "rounded bg-[#3398DB] h-3 mr-2 w-3 inline-block"
                                                                }),
                                                                cstore.getActiveCurrencySymbol(),
                                                                " ",
                                                                numFormat(accessors.yAccessor(value.datum), 2)
                                                            ]
                                                        })
                                                    ]
                                                }, key);
                                            })
                                        });
                                    }
                                })
                            ]
                        })
                    })
                })
            ]
        })
    });
};


/***/ }),

/***/ 2990:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "H": () => (/* binding */ SalesValueWidget)
/* harmony export */ });
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2322);
/* harmony import */ var _hooks_useDashboard__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4255);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6689);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _widgetPanel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5167);




const SalesValueWidget = ({ isEditing =false , id ="salesValue"  })=>{
    const { stats , isLoadingStats , cstore  } = (0,_hooks_useDashboard__WEBPACK_IMPORTED_MODULE_1__/* .useDashboard */ .QU)();
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_widgetPanel__WEBPACK_IMPORTED_MODULE_3__/* .WidgetPanel */ .y, {
        isEditing: isEditing,
        id: id,
        children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
            className: "grid grid-cols-3 md:grid-cols-3",
            children: [
                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                    className: "bg-cover mx-auto h-12 w-12 self-center",
                    style: {
                        backgroundImage: "url(/admin/static/dashboard-sales.png)"
                    }
                }),
                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                    className: "col-span-2" + " draggableCancel",
                    children: [
                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("h3", {
                            className: "block text-xl",
                            children: "Sales value"
                        }),
                        /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("p", {
                            className: `${isLoadingStats ? "animate-pulse w-full rounded-md h-6 bg-gray-200" : "font-bold text-xl"}`,
                            id: "pageViews",
                            children: [
                                cstore.getActiveCurrencySymbol(),
                                isLoadingStats ? "" : stats?.salesValue
                            ]
                        }),
                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("p", {
                            className: `${isLoadingStats ? "animate-pulse w-full rounded-md h-6 bg-gray-200" : ""} text-xs text-gray-500 m-0`,
                            children: !isLoadingStats && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("span", {
                                children: [
                                    "from ",
                                    stats?.orders ?? 0,
                                    " orders"
                                ]
                            })
                        })
                    ]
                })
            ]
        })
    });
};


/***/ }),

/***/ 5167:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "y": () => (/* binding */ WidgetPanel)
/* harmony export */ });
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2322);
/* harmony import */ var _heroicons_react_24_solid__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8802);
/* harmony import */ var _heroicons_react_24_solid__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_heroicons_react_24_solid__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6689);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _hooks_useDashboard__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4255);
/* harmony import */ var _wiggler_module_scss__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8287);
/* harmony import */ var _wiggler_module_scss__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wiggler_module_scss__WEBPACK_IMPORTED_MODULE_4__);





const randomNumber = (min, max, fixed = 2)=>{
    return (Math.random() * (max - min) + min).toFixed(fixed);
};
const WidgetPanel = ({ isEditing =false , id , children , style  })=>{
    const { deleteWidget  } = (0,_hooks_useDashboard__WEBPACK_IMPORTED_MODULE_3__/* .useDashboard */ .QU)();
    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
        style: {
            animationDelay: `${randomNumber(-1, 0)}s`,
            animationDuration: `${randomNumber(0.3, 0.5)}s`,
            ...style
        },
        className: `bg-white relative rounded-xl h-full w-full p-4 shadow-md ${isEditing ? (_wiggler_module_scss__WEBPACK_IMPORTED_MODULE_4___default().wiggler) + " shadow-indigo-300" : ""}`,
        children: [
            isEditing && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("button", {
                className: "top-3 right-3 absolute",
                onClick: ()=>deleteWidget(id),
                children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_heroicons_react_24_solid__WEBPACK_IMPORTED_MODULE_1__.XMarkIcon, {
                    className: "h-4 text-gray-400 w-4 hover:text-red-600"
                })
            }),
            children
        ]
    });
};


/***/ })

};
;