"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.d = (exports1, definition)=>{
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
(()=>{
    __webpack_require__.r = (exports1)=>{
        if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
    CategoryTreeAdapter: ()=>CategoryTreeAdapter
});
class CategoryTreeAdapter {
    constructor(tree){
        this.tree = tree;
    }
    toListItems() {
        const convertNodeManifest = (node)=>({
                id: node.nodeType,
                name: node.display.label,
                description: node.description,
                data: {
                    type: node.nodeType,
                    category: node.category,
                    version: node.version
                },
                ...node.display.icon ? {
                    icon: {
                        name: node.display.icon
                    }
                } : {},
                color: node.display.iconBackground,
                colorDark: node.display.iconBackgroundDark
            });
        const convertCategories = (categoryNodes)=>{
            const result = [];
            for (const category of categoryNodes){
                const children = [];
                const nestedCategoryItems = convertCategories(category.nestedCategories);
                children.push(...nestedCategoryItems);
                const nodeItems = category.nodes.map(convertNodeManifest);
                children.push(...nodeItems);
                if (0 === children.length) continue;
                const categoryItem = {
                    id: category.id,
                    name: category.name,
                    description: category.description,
                    data: null,
                    ...category.icon ? {
                        icon: {
                            name: category.icon
                        }
                    } : {},
                    color: category.color,
                    colorDark: category.colorDark,
                    children
                };
                result.push(categoryItem);
            }
            return result;
        };
        const items = [];
        const categoryItems = convertCategories(this.tree.getRootCategories());
        items.push(...categoryItems);
        const rootNodes = this.tree.getRootNodes();
        const rootNodeItems = rootNodes.map(convertNodeManifest);
        items.push(...rootNodeItems);
        return items;
    }
}
exports.CategoryTreeAdapter = __webpack_exports__.CategoryTreeAdapter;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "CategoryTreeAdapter"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
