/**
* PDA v1.1.2
* (c) 2024 Product Designer App
* @license GPLv3
* Addon
* Free version
* Unminify code for Dev
**/
const { createApp: createApp } = Vue;
var pdappVueApp = createApp({
    data: () => ({
        loadingPage: !0,
        uploadUrl: pdappUploadUrl,
        pluginUrl: pdappPluginUrl,
        modal: { show: !1 },
        toast: { show: !1, type: "success", text: "" },
        themes: [],
        stores: {},
        langs: {},
        version: pdappVersion,
        loading: "",
        addons: { searchMobile: !1, search: "", lists: [] },
    }),
    created() {
        jQuery("#productdesignerapp-app").show(), this.getAddonSetting();
    },
    computed: {
        breadcrumbs() {
            let t = { title: "", pages: [] };
            return (
                void 0 === this.langs.menu ||
                    ((t.title = this.langs.menu.addons), (t.pages = [{ to: "", title: t.title }])),
                t
            );
        },
        listAddons() {
            let t = [];
            for (let s = 0; s < this.addons.lists.length; s++)
                (this.addons.lists[s].upgrade = ""),
                    "" != this.addons.search
                        ? -1 != this.addons.lists[s].title.toLowerCase().indexOf(this.addons.search.toLowerCase()) &&
                          t.push(this.addons.lists[s])
                        : t.push(this.addons.lists[s]);
            return t;
        },
    },
    methods: {
        async getAddonSetting() {
            let t = this,
                s =
                    pdappAdminUrl +
                    "admin-ajax.php?action=pdapp-load-setting&langs=1&admin=1&pdapp-nonce=" +
                    pdappNonce;
            try {
                let a = await pdappAPI.tool.getData(s);
                (t.langs = a.data.langs), t.showListAddons();
            } catch (t) {}
        },
        async showListAddons() {
            let t = this;
            if (((t.loadingPage = !0), 0 == t.addons.lists.length))
                try {
                    let s = await pdappAPI.tool.getData(pdappAPIUrl + "/info.php?type=list-addon-releases-wp");
                    t.addons.lists = s.data;
                } catch (s) {
                    (t.toast = { show: !0, type: "warning", text: s.msg }),
                        setTimeout(() => {
                            t.toast.show = !1;
                        }, 5e3);
                }
            t.loadingPage = !1;
        },
        showAddonStore() {
            this.modal = { show: !0 };
        },
    },
}).mount("#productdesignerapp-app");