var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { Component, ChangeDetectionStrategy, ViewChild } from '@angular/core';
import { RegisterClass, UUIDsEqual } from '@memberjunction/global';
import { BaseResourceComponent } from '@memberjunction/ng-shared';
import { RunView } from '@memberjunction/core';
import { MJNotificationService } from '@memberjunction/ng-notifications';
import * as i0 from "@angular/core";
import * as i1 from "@memberjunction/ng-ui-components";
import * as i2 from "@memberjunction/ng-shared-generic";
import * as i3 from "@memberjunction/ng-credentials";
import * as i4 from "@angular/common";
const _c0 = ["categoryEditPanel"];
function CredentialsCategoriesResourceComponent_Conditional_12_Template(rf, ctx) { if (rf & 1) {
    const _r2 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 15);
    i0.ɵɵlistener("click", function CredentialsCategoriesResourceComponent_Conditional_12_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r2); const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.createNewCategory()); });
    i0.ɵɵelement(1, "i", 16);
    i0.ɵɵelementStart(2, "span", 5);
    i0.ɵɵtext(3, "New Category");
    i0.ɵɵelementEnd()();
} }
function CredentialsCategoriesResourceComponent_Conditional_16_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "mj-loading", 12);
} }
function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_2_For_2_Conditional_2_Template(rf, ctx) { if (rf & 1) {
    const _r6 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 37);
    i0.ɵɵlistener("click", function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_2_For_2_Conditional_2_Template_button_click_0_listener($event) { i0.ɵɵrestoreView(_r6); const node_r5 = i0.ɵɵnextContext().$implicit; const ctx_r2 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r2.toggleExpand(node_r5, $event)); });
    i0.ɵɵelement(1, "i");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const node_r5 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵadvance();
    i0.ɵɵclassMap(node_r5.expanded ? "fa-solid fa-chevron-down" : "fa-solid fa-chevron-right");
} }
function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_2_For_2_Conditional_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "span", 26);
} }
function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_2_For_2_Conditional_9_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 30);
    i0.ɵɵtext(1);
    i0.ɵɵpipe(2, "slice");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const node_r5 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate2(" ", i0.ɵɵpipeBind3(2, 2, node_r5.category.Description, 0, 50), "", node_r5.category.Description.length > 50 ? "..." : "", " ");
} }
function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_2_For_2_Conditional_11_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 32);
    i0.ɵɵelement(1, "i", 38);
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const node_r5 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1(" ", node_r5.typeCount, " ");
} }
function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_2_For_2_Conditional_12_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 33);
    i0.ɵɵelement(1, "i", 39);
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const node_r5 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1(" ", node_r5.children.length, " ");
} }
function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_2_For_2_Conditional_14_Template(rf, ctx) { if (rf & 1) {
    const _r7 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 40);
    i0.ɵɵlistener("click", function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_2_For_2_Conditional_14_Template_button_click_0_listener($event) { i0.ɵɵrestoreView(_r7); const node_r5 = i0.ɵɵnextContext().$implicit; const ctx_r2 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r2.editCategory(node_r5, $event)); });
    i0.ɵɵelement(1, "i", 41);
    i0.ɵɵelementEnd();
} }
function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_2_For_2_Conditional_15_Template(rf, ctx) { if (rf & 1) {
    const _r8 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 42);
    i0.ɵɵlistener("click", function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_2_For_2_Conditional_15_Template_button_click_0_listener($event) { i0.ɵɵrestoreView(_r8); const node_r5 = i0.ɵɵnextContext().$implicit; const ctx_r2 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r2.deleteCategory(node_r5, $event)); });
    i0.ɵɵelement(1, "i", 43);
    i0.ɵɵelementEnd();
} }
function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_2_For_2_Template(rf, ctx) { if (rf & 1) {
    const _r4 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 23);
    i0.ɵɵlistener("click", function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_2_For_2_Template_div_click_0_listener() { const node_r5 = i0.ɵɵrestoreView(_r4).$implicit; const ctx_r2 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r2.selectNode(node_r5)); });
    i0.ɵɵelementStart(1, "div", 24);
    i0.ɵɵconditionalCreate(2, CredentialsCategoriesResourceComponent_Conditional_17_Conditional_2_For_2_Conditional_2_Template, 2, 2, "button", 25);
    i0.ɵɵconditionalCreate(3, CredentialsCategoriesResourceComponent_Conditional_17_Conditional_2_For_2_Conditional_3_Template, 1, 0, "span", 26);
    i0.ɵɵelementStart(4, "div", 27);
    i0.ɵɵelement(5, "i");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(6, "div", 28)(7, "div", 29);
    i0.ɵɵtext(8);
    i0.ɵɵelementEnd();
    i0.ɵɵconditionalCreate(9, CredentialsCategoriesResourceComponent_Conditional_17_Conditional_2_For_2_Conditional_9_Template, 3, 6, "div", 30);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(10, "div", 31);
    i0.ɵɵconditionalCreate(11, CredentialsCategoriesResourceComponent_Conditional_17_Conditional_2_For_2_Conditional_11_Template, 3, 1, "span", 32);
    i0.ɵɵconditionalCreate(12, CredentialsCategoriesResourceComponent_Conditional_17_Conditional_2_For_2_Conditional_12_Template, 3, 1, "span", 33);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(13, "div", 34);
    i0.ɵɵconditionalCreate(14, CredentialsCategoriesResourceComponent_Conditional_17_Conditional_2_For_2_Conditional_14_Template, 2, 0, "button", 35);
    i0.ɵɵconditionalCreate(15, CredentialsCategoriesResourceComponent_Conditional_17_Conditional_2_For_2_Conditional_15_Template, 2, 0, "button", 36);
    i0.ɵɵelementEnd()()();
} if (rf & 2) {
    const node_r5 = ctx.$implicit;
    const ɵ$index_48_r9 = ctx.$index;
    const ctx_r2 = i0.ɵɵnextContext(3);
    i0.ɵɵstyleProp("padding-left", 12 + node_r5.level * 20, "px");
    i0.ɵɵclassProp("selected", ctx_r2.IsNodeSelected(node_r5));
    i0.ɵɵadvance(2);
    i0.ɵɵconditional(node_r5.children.length > 0 ? 2 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional(node_r5.children.length === 0 ? 3 : -1);
    i0.ɵɵadvance();
    i0.ɵɵstyleProp("background-color", ctx_r2.getCategoryColor(ɵ$index_48_r9) + "15")("color", ctx_r2.getCategoryColor(ɵ$index_48_r9));
    i0.ɵɵadvance();
    i0.ɵɵclassMap(node_r5.category.IconClass || "fa-solid fa-folder");
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(node_r5.category.Name);
    i0.ɵɵadvance();
    i0.ɵɵconditional(node_r5.category.Description ? 9 : -1);
    i0.ɵɵadvance(2);
    i0.ɵɵconditional(node_r5.typeCount > 0 ? 11 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional(node_r5.children.length > 0 ? 12 : -1);
    i0.ɵɵadvance(2);
    i0.ɵɵconditional(ctx_r2.UserCanUpdate ? 14 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r2.UserCanDelete && node_r5.children.length === 0 && node_r5.typeCount === 0 ? 15 : -1);
} }
function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 18);
    i0.ɵɵrepeaterCreate(1, CredentialsCategoriesResourceComponent_Conditional_17_Conditional_2_For_2_Template, 16, 18, "div", 22, i0.ɵɵrepeaterTrackByIdentity);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r2 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance();
    i0.ɵɵrepeater(ctx_r2.getFlattenedNodes());
} }
function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_3_Conditional_5_Template(rf, ctx) { if (rf & 1) {
    const _r10 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "p");
    i0.ɵɵtext(1, " No categories match your search. ");
    i0.ɵɵelementStart(2, "button", 47);
    i0.ɵɵlistener("click", function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_3_Conditional_5_Template_button_click_2_listener() { i0.ɵɵrestoreView(_r10); const ctx_r2 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r2.clearSearch()); });
    i0.ɵɵtext(3, "Clear search");
    i0.ɵɵelementEnd()();
} }
function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_3_Conditional_6_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "p");
    i0.ɵɵtext(1, " Get started by creating your first category. ");
    i0.ɵɵelementEnd();
} }
function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_3_Conditional_7_Template(rf, ctx) { if (rf & 1) {
    const _r11 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 48);
    i0.ɵɵlistener("click", function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_3_Conditional_7_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r11); const ctx_r2 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r2.createNewCategory()); });
    i0.ɵɵelement(1, "i", 16);
    i0.ɵɵtext(2, " Create Category ");
    i0.ɵɵelementEnd();
} }
function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 19)(1, "div", 44);
    i0.ɵɵelement(2, "i", 45);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "h3");
    i0.ɵɵtext(4, "No Categories");
    i0.ɵɵelementEnd();
    i0.ɵɵconditionalCreate(5, CredentialsCategoriesResourceComponent_Conditional_17_Conditional_3_Conditional_5_Template, 4, 0, "p");
    i0.ɵɵconditionalCreate(6, CredentialsCategoriesResourceComponent_Conditional_17_Conditional_3_Conditional_6_Template, 2, 0, "p");
    i0.ɵɵconditionalCreate(7, CredentialsCategoriesResourceComponent_Conditional_17_Conditional_3_Conditional_7_Template, 3, 0, "button", 46);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r2 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(5);
    i0.ɵɵconditional(ctx_r2.searchText ? 5 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional(!ctx_r2.searchText ? 6 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r2.UserCanCreate && !ctx_r2.searchText ? 7 : -1);
} }
function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_4_Conditional_7_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 52);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r2 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" Level ", ctx_r2.selectedNode.level + 1, " ");
} }
function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_4_Conditional_9_Template(rf, ctx) { if (rf & 1) {
    const _r13 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 40);
    i0.ɵɵlistener("click", function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_4_Conditional_9_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r13); const ctx_r2 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r2.editCategory(ctx_r2.selectedNode)); });
    i0.ɵɵelement(1, "i", 41);
    i0.ɵɵelementEnd();
} }
function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_4_Conditional_24_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 61)(1, "h3");
    i0.ɵɵelement(2, "i", 66);
    i0.ɵɵtext(3, " Description ");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "p", 67);
    i0.ɵɵtext(5);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r2 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance(5);
    i0.ɵɵtextInterpolate(ctx_r2.selectedNode.category.Description);
} }
function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_4_Conditional_25_For_6_Conditional_6_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 73);
    i0.ɵɵtext(1);
    i0.ɵɵpipe(2, "slice");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const type_r14 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind3(2, 1, type_r14.Description, 0, 60));
} }
function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_4_Conditional_25_For_6_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 69)(1, "div", 70);
    i0.ɵɵelement(2, "i");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "div", 71)(4, "div", 72);
    i0.ɵɵtext(5);
    i0.ɵɵelementEnd();
    i0.ɵɵconditionalCreate(6, CredentialsCategoriesResourceComponent_Conditional_17_Conditional_4_Conditional_25_For_6_Conditional_6_Template, 3, 5, "div", 73);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const type_r14 = ctx.$implicit;
    i0.ɵɵadvance(2);
    i0.ɵɵclassMap(type_r14.IconClass || "fa-solid fa-key");
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(type_r14.Name);
    i0.ɵɵadvance();
    i0.ɵɵconditional(type_r14.Description ? 6 : -1);
} }
function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_4_Conditional_25_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 62)(1, "h3");
    i0.ɵɵelement(2, "i", 38);
    i0.ɵɵtext(3, " Credential Types ");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "div", 68);
    i0.ɵɵrepeaterCreate(5, CredentialsCategoriesResourceComponent_Conditional_17_Conditional_4_Conditional_25_For_6_Template, 7, 4, "div", 69, i0.ɵɵrepeaterTrackByIdentity);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r2 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance(5);
    i0.ɵɵrepeater(ctx_r2.getTypesForCategory(ctx_r2.selectedNode.category.Name));
} }
function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_4_Conditional_26_For_6_Conditional_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 78);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const child_r16 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1("", child_r16.typeCount, " types");
} }
function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_4_Conditional_26_For_6_Template(rf, ctx) { if (rf & 1) {
    const _r15 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 77);
    i0.ɵɵlistener("click", function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_4_Conditional_26_For_6_Template_div_click_0_listener() { const child_r16 = i0.ɵɵrestoreView(_r15).$implicit; const ctx_r2 = i0.ɵɵnextContext(4); return i0.ɵɵresetView(ctx_r2.selectNode(child_r16)); });
    i0.ɵɵelement(1, "i");
    i0.ɵɵelementStart(2, "span");
    i0.ɵɵtext(3);
    i0.ɵɵelementEnd();
    i0.ɵɵconditionalCreate(4, CredentialsCategoriesResourceComponent_Conditional_17_Conditional_4_Conditional_26_For_6_Conditional_4_Template, 2, 1, "span", 78);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const child_r16 = ctx.$implicit;
    i0.ɵɵadvance();
    i0.ɵɵclassMap(child_r16.category.IconClass || "fa-solid fa-folder");
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(child_r16.category.Name);
    i0.ɵɵadvance();
    i0.ɵɵconditional(child_r16.typeCount > 0 ? 4 : -1);
} }
function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_4_Conditional_26_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 63)(1, "h3");
    i0.ɵɵelement(2, "i", 74);
    i0.ɵɵtext(3, " Subcategories ");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "div", 75);
    i0.ɵɵrepeaterCreate(5, CredentialsCategoriesResourceComponent_Conditional_17_Conditional_4_Conditional_26_For_6_Template, 5, 4, "div", 76, i0.ɵɵrepeaterTrackByIdentity);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r2 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance(5);
    i0.ɵɵrepeater(ctx_r2.selectedNode.children);
} }
function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_4_Conditional_28_Template(rf, ctx) { if (rf & 1) {
    const _r17 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 79);
    i0.ɵɵlistener("click", function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_4_Conditional_28_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r17); const ctx_r2 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r2.viewTypesForCategory(ctx_r2.selectedNode.category.Name)); });
    i0.ɵɵelement(1, "i", 38);
    i0.ɵɵtext(2, " View Types ");
    i0.ɵɵelementEnd();
} }
function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_4_Template(rf, ctx) { if (rf & 1) {
    const _r12 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 20)(1, "div", 49)(2, "div", 50);
    i0.ɵɵelement(3, "i");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "div", 51)(5, "h2");
    i0.ɵɵtext(6);
    i0.ɵɵelementEnd();
    i0.ɵɵconditionalCreate(7, CredentialsCategoriesResourceComponent_Conditional_17_Conditional_4_Conditional_7_Template, 2, 1, "span", 52);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(8, "div", 53);
    i0.ɵɵconditionalCreate(9, CredentialsCategoriesResourceComponent_Conditional_17_Conditional_4_Conditional_9_Template, 2, 0, "button", 35);
    i0.ɵɵelementStart(10, "button", 54);
    i0.ɵɵlistener("click", function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_4_Template_button_click_10_listener() { i0.ɵɵrestoreView(_r12); const ctx_r2 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r2.selectedNode = null); });
    i0.ɵɵelement(11, "i", 55);
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(12, "div", 56)(13, "div", 57)(14, "div", 58)(15, "div", 59);
    i0.ɵɵtext(16);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(17, "div", 60);
    i0.ɵɵtext(18, "Credential Types");
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(19, "div", 58)(20, "div", 59);
    i0.ɵɵtext(21);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(22, "div", 60);
    i0.ɵɵtext(23, "Subcategories");
    i0.ɵɵelementEnd()()();
    i0.ɵɵconditionalCreate(24, CredentialsCategoriesResourceComponent_Conditional_17_Conditional_4_Conditional_24_Template, 6, 1, "div", 61);
    i0.ɵɵconditionalCreate(25, CredentialsCategoriesResourceComponent_Conditional_17_Conditional_4_Conditional_25_Template, 7, 0, "div", 62);
    i0.ɵɵconditionalCreate(26, CredentialsCategoriesResourceComponent_Conditional_17_Conditional_4_Conditional_26_Template, 7, 0, "div", 63);
    i0.ɵɵelementStart(27, "div", 64);
    i0.ɵɵconditionalCreate(28, CredentialsCategoriesResourceComponent_Conditional_17_Conditional_4_Conditional_28_Template, 3, 0, "button", 65);
    i0.ɵɵelementStart(29, "button", 48);
    i0.ɵɵlistener("click", function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_4_Template_button_click_29_listener() { i0.ɵɵrestoreView(_r12); const ctx_r2 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r2.createCredentialWithCategory(ctx_r2.selectedNode.category.ID)); });
    i0.ɵɵelement(30, "i", 16);
    i0.ɵɵtext(31, " Create Credential ");
    i0.ɵɵelementEnd()()()();
} if (rf & 2) {
    const ctx_r2 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(2);
    i0.ɵɵstyleProp("background-color", ctx_r2.getCategoryColor(0) + "15")("color", ctx_r2.getCategoryColor(0));
    i0.ɵɵadvance();
    i0.ɵɵclassMap(ctx_r2.selectedNode.category.IconClass || "fa-solid fa-folder");
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(ctx_r2.selectedNode.category.Name);
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r2.selectedNode.level > 0 ? 7 : -1);
    i0.ɵɵadvance(2);
    i0.ɵɵconditional(ctx_r2.UserCanUpdate ? 9 : -1);
    i0.ɵɵadvance(7);
    i0.ɵɵtextInterpolate(ctx_r2.selectedNode.typeCount);
    i0.ɵɵadvance(5);
    i0.ɵɵtextInterpolate(ctx_r2.selectedNode.children.length);
    i0.ɵɵadvance(3);
    i0.ɵɵconditional(ctx_r2.selectedNode.category.Description ? 24 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r2.selectedNode.typeCount > 0 ? 25 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r2.selectedNode.children.length > 0 ? 26 : -1);
    i0.ɵɵadvance(2);
    i0.ɵɵconditional(ctx_r2.selectedNode.typeCount > 0 ? 28 : -1);
} }
function CredentialsCategoriesResourceComponent_Conditional_17_Conditional_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 21)(1, "div", 80);
    i0.ɵɵelement(2, "i", 81);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "h3");
    i0.ɵɵtext(4, "Select a Category");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "p");
    i0.ɵɵtext(6, "Click on a category to view its details and credential types");
    i0.ɵɵelementEnd()();
} }
function CredentialsCategoriesResourceComponent_Conditional_17_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 13)(1, "div", 17);
    i0.ɵɵconditionalCreate(2, CredentialsCategoriesResourceComponent_Conditional_17_Conditional_2_Template, 3, 0, "div", 18);
    i0.ɵɵconditionalCreate(3, CredentialsCategoriesResourceComponent_Conditional_17_Conditional_3_Template, 8, 3, "div", 19);
    i0.ɵɵelementEnd();
    i0.ɵɵconditionalCreate(4, CredentialsCategoriesResourceComponent_Conditional_17_Conditional_4_Template, 32, 15, "div", 20);
    i0.ɵɵconditionalCreate(5, CredentialsCategoriesResourceComponent_Conditional_17_Conditional_5_Template, 7, 0, "div", 21);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r2 = i0.ɵɵnextContext();
    i0.ɵɵadvance(2);
    i0.ɵɵconditional(ctx_r2.categoryTree.length > 0 ? 2 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r2.categoryTree.length === 0 ? 3 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r2.selectedNode ? 4 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional(!ctx_r2.selectedNode && ctx_r2.categoryTree.length > 0 ? 5 : -1);
} }
let CredentialsCategoriesResourceComponent = class CredentialsCategoriesResourceComponent extends BaseResourceComponent {
    cdr;
    isLoading = true;
    categories = [];
    categoryTree = [];
    types = [];
    selectedNode = null;
    searchText = '';
    // Permissions
    _metadata = this.ProviderToUse;
    _permissionCache = new Map();
    categoryEditPanel;
    constructor(cdr) {
        super();
        this.cdr = cdr;
    }
    ngOnInit() {
        super.ngOnInit();
        this.loadData();
    }
    ngOnDestroy() {
        super.ngOnDestroy();
        // Cleanup if needed
    }
    async GetResourceDisplayName(data) {
        return 'Categories';
    }
    async GetResourceIconClass(data) {
        return 'fa-solid fa-folder-tree';
    }
    // === Permission Checks ===
    get UserCanCreate() {
        return this.checkEntityPermission('MJ: Credential Categories', 'Create');
    }
    get UserCanUpdate() {
        return this.checkEntityPermission('MJ: Credential Categories', 'Update');
    }
    get UserCanDelete() {
        return this.checkEntityPermission('MJ: Credential Categories', 'Delete');
    }
    checkEntityPermission(entityName, permissionType) {
        const cacheKey = `${entityName}_${permissionType}`;
        if (this._permissionCache.has(cacheKey)) {
            return this._permissionCache.get(cacheKey);
        }
        try {
            const entityInfo = this._metadata.Entities.find(e => e.Name === entityName);
            if (!entityInfo) {
                this._permissionCache.set(cacheKey, false);
                return false;
            }
            const userPermissions = entityInfo.GetUserPermisions(this._metadata.CurrentUser);
            let hasPermission = false;
            switch (permissionType) {
                case 'Create':
                    hasPermission = userPermissions.CanCreate;
                    break;
                case 'Read':
                    hasPermission = userPermissions.CanRead;
                    break;
                case 'Update':
                    hasPermission = userPermissions.CanUpdate;
                    break;
                case 'Delete':
                    hasPermission = userPermissions.CanDelete;
                    break;
            }
            this._permissionCache.set(cacheKey, hasPermission);
            return hasPermission;
        }
        catch (error) {
            this._permissionCache.set(cacheKey, false);
            return false;
        }
    }
    async loadData() {
        try {
            this.isLoading = true;
            this.cdr.markForCheck();
            const rv = RunView.FromMetadataProvider(this.ProviderToUse);
            const [catResult, typeResult] = await rv.RunViews([
                {
                    EntityName: 'MJ: Credential Categories',
                    OrderBy: 'Name',
                    ResultType: 'entity_object'
                },
                {
                    EntityName: 'MJ: Credential Types',
                    ResultType: 'entity_object'
                }
            ]);
            if (catResult.Success) {
                this.categories = catResult.Results;
            }
            if (typeResult.Success) {
                this.types = typeResult.Results;
            }
            this.buildTree();
        }
        catch (error) {
            console.error('Error loading credential categories:', error);
            MJNotificationService.Instance.CreateSimpleNotification('Error loading categories', 'error', 3000);
        }
        finally {
            this.isLoading = false;
            this.NotifyLoadComplete();
            this.cdr.markForCheck();
        }
    }
    buildTree() {
        const categoryMap = new Map();
        // Create nodes for all categories with stats
        for (const category of this.categories) {
            const typesInCategory = this.types.filter(t => t.Category === category.Name);
            categoryMap.set(category.ID, {
                category,
                children: [],
                expanded: true,
                level: 0,
                typeCount: typesInCategory.length
            });
        }
        // Build tree structure
        const roots = [];
        for (const category of this.categories) {
            const node = categoryMap.get(category.ID);
            if (category.ParentID) {
                const parent = categoryMap.get(category.ParentID);
                if (parent) {
                    node.level = parent.level + 1;
                    parent.children.push(node);
                }
                else {
                    roots.push(node);
                }
            }
            else {
                roots.push(node);
            }
        }
        // Sort children recursively
        const sortNodes = (nodes) => {
            nodes.sort((a, b) => a.category.Name.localeCompare(b.category.Name));
            for (const node of nodes) {
                sortNodes(node.children);
            }
        };
        sortNodes(roots);
        this.categoryTree = roots;
    }
    // === CRUD Operations ===
    createNewCategory() {
        if (this.categoryEditPanel) {
            this.categoryEditPanel.open(null);
        }
    }
    createChildCategory(parentNode, event) {
        if (event) {
            event.stopPropagation();
        }
        if (this.categoryEditPanel) {
            this.categoryEditPanel.open(null, parentNode.category.ID);
        }
    }
    editCategory(node, event) {
        if (event) {
            event.stopPropagation();
        }
        if (this.categoryEditPanel) {
            this.categoryEditPanel.open(node.category);
        }
    }
    async deleteCategory(node, event) {
        if (event) {
            event.stopPropagation();
        }
        if (!this.UserCanDelete) {
            MJNotificationService.Instance.CreateSimpleNotification('You do not have permission to delete categories', 'warning', 3000);
            return;
        }
        if (node.children.length > 0) {
            MJNotificationService.Instance.CreateSimpleNotification(`Cannot delete "${node.category.Name}" - it has ${node.children.length} subcategories`, 'warning', 4000);
            return;
        }
        if (node.typeCount > 0) {
            MJNotificationService.Instance.CreateSimpleNotification(`Cannot delete "${node.category.Name}" - it has ${node.typeCount} credential type(s) using it`, 'warning', 4000);
            return;
        }
        const confirmed = confirm(`Are you sure you want to delete "${node.category.Name}"? This action cannot be undone.`);
        if (!confirmed)
            return;
        try {
            const success = await node.category.Delete();
            if (success) {
                MJNotificationService.Instance.CreateSimpleNotification(`Category "${node.category.Name}" deleted successfully`, 'success', 3000);
                this.categories = this.categories.filter(c => !UUIDsEqual(c.ID, node.category.ID));
                if (UUIDsEqual(this.selectedNode?.category.ID, node.category.ID)) {
                    this.selectedNode = null;
                }
                this.buildTree();
                this.cdr.markForCheck();
            }
            else {
                MJNotificationService.Instance.CreateSimpleNotification('Failed to delete category', 'error', 3000);
            }
        }
        catch (error) {
            console.error('Error deleting category:', error);
            MJNotificationService.Instance.CreateSimpleNotification('Error deleting category', 'error', 3000);
        }
    }
    // === Panel Event Handlers ===
    onCategorySaved(category) {
        const existingIndex = this.categories.findIndex(c => UUIDsEqual(c.ID, category.ID));
        if (existingIndex >= 0) {
            this.categories[existingIndex] = category;
        }
        else {
            this.categories.push(category);
        }
        this.buildTree();
        this.cdr.markForCheck();
    }
    onCategoryDeleted(categoryId) {
        this.categories = this.categories.filter(c => !UUIDsEqual(c.ID, categoryId));
        if (UUIDsEqual(this.selectedNode?.category.ID, categoryId)) {
            this.selectedNode = null;
        }
        this.buildTree();
        this.cdr.markForCheck();
    }
    // === Selection ===
    selectNode(node) {
        this.selectedNode = UUIDsEqual(this.selectedNode?.category.ID, node.category.ID) ? null : node;
        this.cdr.markForCheck();
    }
    toggleExpand(node, event) {
        if (event) {
            event.stopPropagation();
        }
        node.expanded = !node.expanded;
        this.cdr.markForCheck();
    }
    // === Search ===
    onSearchChange(value) {
        this.searchText = value;
        if (value) {
            this.expandAll();
        }
        this.cdr.markForCheck();
    }
    clearSearch() {
        this.searchText = '';
        this.cdr.markForCheck();
    }
    expandAll() {
        const expand = (nodes) => {
            for (const node of nodes) {
                node.expanded = true;
                expand(node.children);
            }
        };
        expand(this.categoryTree);
        this.cdr.markForCheck();
    }
    collapseAll() {
        const collapse = (nodes) => {
            for (const node of nodes) {
                node.expanded = false;
                collapse(node.children);
            }
        };
        collapse(this.categoryTree);
        this.cdr.markForCheck();
    }
    getFlattenedNodes() {
        const result = [];
        const searchLower = this.searchText.toLowerCase().trim();
        const flatten = (nodes) => {
            for (const node of nodes) {
                if (searchLower) {
                    const matches = this.nodeMatchesSearch(node, searchLower);
                    if (matches) {
                        result.push(node);
                    }
                }
                else {
                    result.push(node);
                }
                if (node.expanded && node.children.length > 0) {
                    flatten(node.children);
                }
            }
        };
        flatten(this.categoryTree);
        return result;
    }
    nodeMatchesSearch(node, searchLower) {
        const nameMatch = node.category.Name.toLowerCase().includes(searchLower);
        const descMatch = node.category.Description?.toLowerCase().includes(searchLower);
        return nameMatch || descMatch || false;
    }
    getTotalTypeCount() {
        return this.types.length;
    }
    getTypesForCategory(categoryName) {
        return this.types.filter(t => t.Category === categoryName);
    }
    createCredentialWithCategory(categoryId, event) {
        if (event) {
            event.stopPropagation();
        }
        // Navigate to Credentials nav item with the category pre-selected and create panel open
        this.navigationService.OpenNavItemByName('Credentials', {
            categoryId: categoryId,
            openCreatePanel: true
        });
    }
    viewTypesForCategory(categoryName, event) {
        if (event) {
            event.stopPropagation();
        }
        // Navigate to Types nav item filtered by this category
        this.navigationService.OpenNavItemByName('Types', {
            categoryFilter: categoryName
        });
    }
    /** Case-insensitive UUID check whether a tree node is the currently selected node. */
    IsNodeSelected(node) {
        return UUIDsEqual(this.selectedNode?.category?.ID, node.category.ID);
    }
    getCategoryColor(index) {
        const colors = [
            'var(--mj-brand-primary)',
            'var(--mj-brand-primary)',
            'var(--mj-brand-primary)',
            'var(--mj-status-warning)',
            'var(--mj-status-success)',
            'var(--mj-brand-primary)',
            'var(--mj-brand-primary)'
        ];
        return colors[index % colors.length];
    }
    refresh() {
        this.selectedNode = null;
        this.loadData();
    }
    static ɵfac = function CredentialsCategoriesResourceComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CredentialsCategoriesResourceComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
    static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CredentialsCategoriesResourceComponent, selectors: [["mj-credentials-categories-resource"]], viewQuery: function CredentialsCategoriesResourceComponent_Query(rf, ctx) { if (rf & 1) {
            i0.ɵɵviewQuery(_c0, 5);
        } if (rf & 2) {
            let _t;
            i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.categoryEditPanel = _t.first);
        } }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 20, vars: 5, consts: [["categoryEditPanel", ""], ["Title", "Categories", "Icon", "fa-solid fa-folder-tree"], ["actions", ""], ["mjButton", "", "variant", "secondary", "size", "sm", "title", "Expand all", 3, "click"], [1, "fa-solid", "fa-expand"], [1, "action-btn-label"], ["mjButton", "", "variant", "secondary", "size", "sm", "title", "Collapse all", 3, "click"], [1, "fa-solid", "fa-compress"], [3, "Clicked", "Loading"], ["mjButton", "", "variant", "primary", "size", "sm"], ["toolbar", ""], ["Placeholder", "Search categories...", 3, "ValueChange", "Value"], ["text", "Loading categories..."], [1, "categories-layout"], [3, "saved", "deleted"], ["mjButton", "", "variant", "primary", "size", "sm", 3, "click"], [1, "fa-solid", "fa-plus"], [1, "tree-panel"], [1, "tree-container"], [1, "empty-state"], [1, "detail-panel"], [1, "no-selection"], [1, "tree-node", 3, "selected", "padding-left"], [1, "tree-node", 3, "click"], [1, "node-content"], [1, "expand-btn"], [1, "expand-placeholder"], [1, "node-icon"], [1, "node-info"], [1, "node-name"], [1, "node-description"], [1, "node-badges"], [1, "badge", "types"], [1, "badge", "children"], [1, "node-actions"], ["mjButton", "", "variant", "flat", "size", "sm", "title", "Edit"], ["mjButton", "", "variant", "danger", "size", "sm", "title", "Delete"], [1, "expand-btn", 3, "click"], [1, "fa-solid", "fa-shapes"], [1, "fa-solid", "fa-folder"], ["mjButton", "", "variant", "flat", "size", "sm", "title", "Edit", 3, "click"], [1, "fa-solid", "fa-pen"], ["mjButton", "", "variant", "danger", "size", "sm", "title", "Delete", 3, "click"], [1, "fa-solid", "fa-trash"], [1, "empty-icon"], [1, "fa-solid", "fa-folder-open"], [1, "btn-primary"], [1, "btn-link", 3, "click"], [1, "btn-primary", 3, "click"], [1, "detail-header"], [1, "detail-icon"], [1, "detail-title"], [1, "level-badge"], [1, "detail-actions"], [1, "close-btn", 3, "click"], [1, "fa-solid", "fa-times"], [1, "detail-body"], [1, "detail-stats"], [1, "detail-stat"], [1, "stat-value"], [1, "stat-label"], [1, "description-section"], [1, "types-section"], [1, "subcategories-section"], [1, "detail-quick-actions"], [1, "btn-secondary"], [1, "fa-solid", "fa-align-left"], [1, "description"], [1, "type-list"], [1, "type-item"], [1, "type-icon"], [1, "type-info"], [1, "type-name"], [1, "type-desc"], [1, "fa-solid", "fa-folder-tree"], [1, "subcategory-list"], [1, "subcategory-item"], [1, "subcategory-item", 3, "click"], [1, "sub-type-count"], [1, "btn-secondary", 3, "click"], [1, "no-selection-icon"], [1, "fa-solid", "fa-hand-pointer"]], template: function CredentialsCategoriesResourceComponent_Template(rf, ctx) { if (rf & 1) {
            const _r1 = i0.ɵɵgetCurrentView();
            i0.ɵɵelementStart(0, "mj-page-layout")(1, "mj-page-header", 1)(2, "div", 2)(3, "button", 3);
            i0.ɵɵlistener("click", function CredentialsCategoriesResourceComponent_Template_button_click_3_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.expandAll()); });
            i0.ɵɵelement(4, "i", 4);
            i0.ɵɵelementStart(5, "span", 5);
            i0.ɵɵtext(6, "Expand");
            i0.ɵɵelementEnd()();
            i0.ɵɵelementStart(7, "button", 6);
            i0.ɵɵlistener("click", function CredentialsCategoriesResourceComponent_Template_button_click_7_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.collapseAll()); });
            i0.ɵɵelement(8, "i", 7);
            i0.ɵɵelementStart(9, "span", 5);
            i0.ɵɵtext(10, "Collapse");
            i0.ɵɵelementEnd()();
            i0.ɵɵelementStart(11, "mj-refresh-button", 8);
            i0.ɵɵlistener("Clicked", function CredentialsCategoriesResourceComponent_Template_mj_refresh_button_Clicked_11_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.refresh()); });
            i0.ɵɵelementEnd();
            i0.ɵɵconditionalCreate(12, CredentialsCategoriesResourceComponent_Conditional_12_Template, 4, 0, "button", 9);
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(13, "div", 10)(14, "mj-page-search", 11);
            i0.ɵɵlistener("ValueChange", function CredentialsCategoriesResourceComponent_Template_mj_page_search_ValueChange_14_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.onSearchChange($event)); });
            i0.ɵɵelementEnd()()();
            i0.ɵɵelementStart(15, "mj-page-body");
            i0.ɵɵconditionalCreate(16, CredentialsCategoriesResourceComponent_Conditional_16_Template, 1, 0, "mj-loading", 12);
            i0.ɵɵconditionalCreate(17, CredentialsCategoriesResourceComponent_Conditional_17_Template, 6, 4, "div", 13);
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(18, "mj-credential-category-edit-panel", 14, 0);
            i0.ɵɵlistener("saved", function CredentialsCategoriesResourceComponent_Template_mj_credential_category_edit_panel_saved_18_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.onCategorySaved($event)); })("deleted", function CredentialsCategoriesResourceComponent_Template_mj_credential_category_edit_panel_deleted_18_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.onCategoryDeleted($event)); });
            i0.ɵɵelementEnd()();
        } if (rf & 2) {
            i0.ɵɵadvance(11);
            i0.ɵɵproperty("Loading", ctx.isLoading);
            i0.ɵɵadvance();
            i0.ɵɵconditional(ctx.UserCanCreate ? 12 : -1);
            i0.ɵɵadvance(2);
            i0.ɵɵproperty("Value", ctx.searchText);
            i0.ɵɵadvance(2);
            i0.ɵɵconditional(ctx.isLoading ? 16 : -1);
            i0.ɵɵadvance();
            i0.ɵɵconditional(!ctx.isLoading ? 17 : -1);
        } }, dependencies: [i1.MJButtonDirective, i1.MJPageHeaderComponent, i1.MJPageLayoutComponent, i1.MJPageBodyComponent, i1.MJPageSearchComponent, i1.MJRefreshButtonComponent, i2.LoadingComponent, i3.CredentialCategoryEditPanelComponent, i4.SlicePipe], styles: ["\n\n.categories-layout[_ngcontent-%COMP%] {\n    display: grid;\n    grid-template-columns: 1fr 380px;\n    gap: 20px;\n    min-height: 500px;\n}\n\n\n\n.tree-panel[_ngcontent-%COMP%] {\n    background: var(--mj-bg-surface);\n    border-radius: 12px;\n    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);\n    overflow: hidden;\n}\n\n.tree-container[_ngcontent-%COMP%] {\n    max-height: calc(100vh - 300px);\n    overflow-y: auto;\n}\n\n\n\n.tree-node[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    border-bottom: 1px solid var(--mj-bg-surface-sunken);\n    cursor: pointer;\n    transition: all 0.15s ease;\n}\n\n.tree-node[_ngcontent-%COMP%]:last-child {\n    border-bottom: none;\n}\n\n.tree-node[_ngcontent-%COMP%]:hover {\n    background: var(--mj-bg-surface-card);\n}\n\n.tree-node.selected[_ngcontent-%COMP%] {\n    background: color-mix(in srgb, var(--mj-brand-primary) 6%, var(--mj-bg-surface));\n    border-left: 3px solid var(--mj-brand-primary);\n}\n\n.node-content[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    padding: 12px 16px;\n    width: 100%;\n    gap: 8px;\n}\n\n\n\n.expand-btn[_ngcontent-%COMP%] {\n    width: 24px;\n    height: 24px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    border: none;\n    background: transparent;\n    cursor: pointer;\n    color: var(--mj-text-disabled);\n    border-radius: 4px;\n    transition: all 0.2s ease;\n    flex-shrink: 0;\n}\n\n.expand-btn[_ngcontent-%COMP%]:hover {\n    background: var(--mj-border-default);\n    color: var(--mj-text-primary);\n}\n\n.expand-btn[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n    font-size: 10px;\n    transition: transform 0.2s ease;\n}\n\n.expand-placeholder[_ngcontent-%COMP%] {\n    width: 24px;\n    flex-shrink: 0;\n}\n\n\n\n.node-icon[_ngcontent-%COMP%] {\n    width: 36px;\n    height: 36px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    border-radius: 8px;\n    flex-shrink: 0;\n}\n\n.node-icon[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n    font-size: 14px;\n}\n\n\n\n.node-info[_ngcontent-%COMP%] {\n    flex: 1;\n    min-width: 0;\n}\n\n.node-name[_ngcontent-%COMP%] {\n    font-weight: 600;\n    font-size: 14px;\n    color: var(--mj-text-primary);\n    line-height: 1.3;\n}\n\n.node-description[_ngcontent-%COMP%] {\n    font-size: 12px;\n    color: var(--mj-text-secondary);\n    margin-top: 2px;\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n}\n\n\n\n.node-badges[_ngcontent-%COMP%] {\n    display: flex;\n    gap: 6px;\n    flex-shrink: 0;\n}\n\n.badge[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    gap: 4px;\n    padding: 4px 8px;\n    border-radius: 12px;\n    font-size: 11px;\n    font-weight: 500;\n}\n\n.badge.types[_ngcontent-%COMP%] {\n    background: color-mix(in srgb, var(--mj-brand-primary) 10%, transparent);\n    color: var(--mj-brand-primary);\n}\n\n.badge.children[_ngcontent-%COMP%] {\n    background: var(--mj-bg-surface-sunken);\n    color: var(--mj-text-secondary);\n}\n\n.badge[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n    font-size: 10px;\n}\n\n\n\n.node-actions[_ngcontent-%COMP%] {\n    display: flex;\n    gap: 4px;\n    opacity: 0;\n    transition: opacity 0.2s ease;\n    flex-shrink: 0;\n}\n\n.tree-node[_ngcontent-%COMP%]:hover   .node-actions[_ngcontent-%COMP%] {\n    opacity: 1;\n}\n\n.action-btn[_ngcontent-%COMP%] {\n    width: 28px;\n    height: 28px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    background: var(--mj-bg-surface-sunken);\n    border: none;\n    border-radius: 6px;\n    color: var(--mj-text-secondary);\n    cursor: pointer;\n    transition: all 0.2s ease;\n}\n\n.action-btn[_ngcontent-%COMP%]:hover {\n    background: var(--mj-brand-primary);\n    color: var(--mj-text-inverse);\n}\n\n.action-btn.danger[_ngcontent-%COMP%]:hover {\n    background: var(--mj-status-error);\n    color: var(--mj-text-inverse);\n}\n\n.action-btn[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n    font-size: 12px;\n}\n\n\n\n.detail-panel[_ngcontent-%COMP%] {\n    background: var(--mj-bg-surface);\n    border-radius: 12px;\n    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);\n    overflow: hidden;\n    display: flex;\n    flex-direction: column;\n}\n\n.detail-header[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    gap: 12px;\n    padding: 20px;\n    border-bottom: 1px solid var(--mj-bg-surface-sunken);\n}\n\n.detail-icon[_ngcontent-%COMP%] {\n    width: 48px;\n    height: 48px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    border-radius: 12px;\n    flex-shrink: 0;\n}\n\n.detail-icon[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n    font-size: 20px;\n}\n\n.detail-title[_ngcontent-%COMP%] {\n    flex: 1;\n    min-width: 0;\n}\n\n.detail-title[_ngcontent-%COMP%]   h2[_ngcontent-%COMP%] {\n    font-size: 18px;\n    font-weight: 600;\n    color: var(--mj-text-primary);\n    margin: 0;\n    line-height: 1.3;\n}\n\n.level-badge[_ngcontent-%COMP%] {\n    display: inline-block;\n    margin-top: 4px;\n    padding: 2px 8px;\n    background: var(--mj-bg-surface-sunken);\n    border-radius: 10px;\n    font-size: 11px;\n    color: var(--mj-text-secondary);\n}\n\n.detail-actions[_ngcontent-%COMP%] {\n    display: flex;\n    gap: 8px;\n    flex-shrink: 0;\n}\n\n.close-btn[_ngcontent-%COMP%] {\n    width: 32px;\n    height: 32px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    background: var(--mj-bg-surface-sunken);\n    border: none;\n    border-radius: 8px;\n    color: var(--mj-text-secondary);\n    cursor: pointer;\n    transition: all 0.2s ease;\n}\n\n.close-btn[_ngcontent-%COMP%]:hover {\n    background: var(--mj-border-default);\n    color: var(--mj-text-primary);\n}\n\n\n\n.detail-body[_ngcontent-%COMP%] {\n    padding: 20px;\n    flex: 1;\n    overflow-y: auto;\n}\n\n\n\n.detail-stats[_ngcontent-%COMP%] {\n    display: grid;\n    grid-template-columns: repeat(2, 1fr);\n    gap: 12px;\n    margin-bottom: 20px;\n}\n\n.detail-stat[_ngcontent-%COMP%] {\n    background: var(--mj-bg-surface-card);\n    border-radius: 10px;\n    padding: 16px;\n    text-align: center;\n}\n\n.detail-stat[_ngcontent-%COMP%]   .stat-value[_ngcontent-%COMP%] {\n    font-size: 28px;\n    font-weight: 700;\n    color: var(--mj-brand-primary);\n    line-height: 1;\n}\n\n.detail-stat[_ngcontent-%COMP%]   .stat-label[_ngcontent-%COMP%] {\n    font-size: 12px;\n    color: var(--mj-text-secondary);\n    margin-top: 4px;\n}\n\n\n\n.description-section[_ngcontent-%COMP%] {\n    margin-bottom: 20px;\n}\n\n.description-section[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%], \n.types-section[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%], \n.subcategories-section[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    gap: 8px;\n    font-size: 13px;\n    font-weight: 600;\n    color: var(--mj-text-secondary);\n    text-transform: uppercase;\n    letter-spacing: 0.5px;\n    margin: 0 0 12px 0;\n}\n\n.description-section[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%]   i[_ngcontent-%COMP%], \n.types-section[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%]   i[_ngcontent-%COMP%], \n.subcategories-section[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n    font-size: 12px;\n}\n\n.description[_ngcontent-%COMP%] {\n    font-size: 14px;\n    color: var(--mj-text-primary);\n    line-height: 1.6;\n    margin: 0;\n}\n\n\n\n.types-section[_ngcontent-%COMP%] {\n    margin-bottom: 20px;\n}\n\n.type-list[_ngcontent-%COMP%] {\n    display: flex;\n    flex-direction: column;\n    gap: 8px;\n}\n\n.type-item[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    gap: 10px;\n    padding: 10px 12px;\n    background: var(--mj-bg-surface-card);\n    border-radius: 8px;\n    transition: all 0.2s ease;\n}\n\n.type-item[_ngcontent-%COMP%]:hover {\n    background: var(--mj-bg-surface-sunken);\n}\n\n.type-icon[_ngcontent-%COMP%] {\n    width: 32px;\n    height: 32px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    background: color-mix(in srgb, var(--mj-brand-primary) 10%, transparent);\n    border-radius: 6px;\n    flex-shrink: 0;\n}\n\n.type-icon[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n    font-size: 12px;\n    color: var(--mj-brand-primary);\n}\n\n.type-info[_ngcontent-%COMP%] {\n    flex: 1;\n    min-width: 0;\n}\n\n.type-name[_ngcontent-%COMP%] {\n    font-size: 13px;\n    font-weight: 500;\n    color: var(--mj-text-primary);\n}\n\n.type-desc[_ngcontent-%COMP%] {\n    font-size: 11px;\n    color: var(--mj-text-secondary);\n    margin-top: 2px;\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n}\n\n\n\n.subcategories-section[_ngcontent-%COMP%] {\n    margin-bottom: 20px;\n}\n\n.subcategory-list[_ngcontent-%COMP%] {\n    display: flex;\n    flex-direction: column;\n    gap: 6px;\n}\n\n.subcategory-item[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    gap: 10px;\n    padding: 10px 12px;\n    background: var(--mj-bg-surface-card);\n    border-radius: 8px;\n    cursor: pointer;\n    transition: all 0.2s ease;\n}\n\n.subcategory-item[_ngcontent-%COMP%]:hover {\n    background: var(--mj-bg-surface-sunken);\n}\n\n.subcategory-item[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n    font-size: 14px;\n    color: var(--mj-brand-primary);\n}\n\n.subcategory-item[_ngcontent-%COMP%]   span[_ngcontent-%COMP%] {\n    flex: 1;\n    font-size: 13px;\n    color: var(--mj-text-primary);\n}\n\n.sub-type-count[_ngcontent-%COMP%] {\n    font-size: 11px;\n    color: var(--mj-text-secondary);\n    background: var(--mj-border-default);\n    padding: 2px 8px;\n    border-radius: 10px;\n}\n\n\n\n.detail-quick-actions[_ngcontent-%COMP%] {\n    margin-top: auto;\n    padding-top: 16px;\n    border-top: 1px solid var(--mj-bg-surface-sunken);\n    display: flex;\n    gap: 8px;\n}\n\n.detail-quick-actions[_ngcontent-%COMP%]   .btn-secondary[_ngcontent-%COMP%], \n.detail-quick-actions[_ngcontent-%COMP%]   .btn-primary[_ngcontent-%COMP%] {\n    flex: 1;\n}\n\n.btn-secondary[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    padding: 12px;\n    background: var(--mj-bg-surface-sunken);\n    border: none;\n    border-radius: 8px;\n    font-size: 13px;\n    font-weight: 500;\n    color: var(--mj-text-primary);\n    cursor: pointer;\n    transition: all 0.2s ease;\n}\n\n.btn-secondary[_ngcontent-%COMP%]:hover {\n    background: var(--mj-border-default);\n}\n\n\n\n.no-selection[_ngcontent-%COMP%] {\n    background: var(--mj-bg-surface);\n    border-radius: 12px;\n    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    justify-content: center;\n    padding: 40px;\n    text-align: center;\n}\n\n.no-selection-icon[_ngcontent-%COMP%] {\n    width: 64px;\n    height: 64px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    background: var(--mj-bg-surface-sunken);\n    border-radius: 50%;\n    margin-bottom: 16px;\n}\n\n.no-selection-icon[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n    font-size: 24px;\n    color: var(--mj-text-disabled);\n}\n\n.no-selection[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%] {\n    font-size: 16px;\n    font-weight: 600;\n    color: var(--mj-text-primary);\n    margin: 0 0 8px 0;\n}\n\n.no-selection[_ngcontent-%COMP%]   p[_ngcontent-%COMP%] {\n    font-size: 13px;\n    color: var(--mj-text-secondary);\n    margin: 0;\n}\n\n\n\n.empty-state[_ngcontent-%COMP%] {\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    justify-content: center;\n    padding: 64px 24px;\n    background: var(--mj-bg-surface);\n    border-radius: 12px;\n    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);\n    text-align: center;\n}\n\n.empty-icon[_ngcontent-%COMP%] {\n    width: 80px;\n    height: 80px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    background: var(--mj-bg-surface-sunken);\n    border-radius: 50%;\n    margin-bottom: 20px;\n}\n\n.empty-icon[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n    font-size: 32px;\n    color: var(--mj-border-strong);\n}\n\n.empty-state[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%] {\n    font-size: 18px;\n    font-weight: 600;\n    color: var(--mj-text-primary);\n    margin: 0 0 8px 0;\n}\n\n.empty-state[_ngcontent-%COMP%]   p[_ngcontent-%COMP%] {\n    font-size: 14px;\n    color: var(--mj-text-secondary);\n    margin: 0 0 20px 0;\n}\n\n.btn-link[_ngcontent-%COMP%] {\n    background: none;\n    border: none;\n    color: var(--mj-brand-primary);\n    cursor: pointer;\n    font-size: inherit;\n    padding: 0;\n    text-decoration: underline;\n}\n\n.btn-link[_ngcontent-%COMP%]:hover {\n    color: var(--mj-brand-primary-hover);\n}\n\n\n\n@media (max-width: 1024px) {\n    .categories-layout[_ngcontent-%COMP%] {\n        grid-template-columns: 1fr;\n    }\n\n    .detail-panel[_ngcontent-%COMP%], \n   .no-selection[_ngcontent-%COMP%] {\n        display: none;\n    }\n}\n\n@media (max-width: 768px) {\n    .categories-container[_ngcontent-%COMP%] {\n        padding: 16px;\n    }\n\n    .categories-header[_ngcontent-%COMP%] {\n        flex-direction: column;\n        align-items: flex-start;\n        gap: 16px;\n    }\n\n    .toolbar[_ngcontent-%COMP%] {\n        flex-direction: column;\n        gap: 12px;\n    }\n\n    .toolbar-left[_ngcontent-%COMP%], \n   .toolbar-right[_ngcontent-%COMP%] {\n        width: 100%;\n    }\n\n    .search-container[_ngcontent-%COMP%] {\n        max-width: none;\n    }\n\n    .toolbar-right[_ngcontent-%COMP%] {\n        justify-content: flex-end;\n    }\n}"], changeDetection: 0 });
};
CredentialsCategoriesResourceComponent = __decorate([
    RegisterClass(BaseResourceComponent, 'CredentialsCategoriesResource')
], CredentialsCategoriesResourceComponent);
export { CredentialsCategoriesResourceComponent };
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CredentialsCategoriesResourceComponent, [{
        type: Component,
        args: [{ standalone: false, selector: 'mj-credentials-categories-resource', changeDetection: ChangeDetectionStrategy.OnPush, template: "<mj-page-layout>\n  <mj-page-header\n    Title=\"Categories\"\n    Icon=\"fa-solid fa-folder-tree\">\n    <!-- [meta] intentionally omitted \u2014 chrome slot discipline audit Task B.\n         The categories count mirrored the visible tree; the cross-entity\n         types count belongs on the Types page, not here. -->\n\n    <div actions>\n      <button mjButton variant=\"secondary\" size=\"sm\" (click)=\"expandAll()\" title=\"Expand all\">\n        <i class=\"fa-solid fa-expand\"></i> <span class=\"action-btn-label\">Expand</span>\n      </button>\n      <button mjButton variant=\"secondary\" size=\"sm\" (click)=\"collapseAll()\" title=\"Collapse all\">\n        <i class=\"fa-solid fa-compress\"></i> <span class=\"action-btn-label\">Collapse</span>\n      </button>\n      <mj-refresh-button [Loading]=\"isLoading\" (Clicked)=\"refresh()\"></mj-refresh-button>\n      @if (UserCanCreate) {\n        <button mjButton variant=\"primary\" size=\"sm\" (click)=\"createNewCategory()\">\n          <i class=\"fa-solid fa-plus\"></i> <span class=\"action-btn-label\">New Category</span>\n        </button>\n      }\n    </div>\n    <div toolbar>\n      <mj-page-search\n        Placeholder=\"Search categories...\"\n        [Value]=\"searchText\"\n        (ValueChange)=\"onSearchChange($event)\">\n      </mj-page-search>\n    </div>\n  </mj-page-header>\n\n  <mj-page-body>\n  @if (isLoading) {\n    <mj-loading text=\"Loading categories...\"></mj-loading>\n  }\n\n  @if (!isLoading) {\n    <div class=\"categories-layout\">\n      <!-- Tree Container -->\n      <div class=\"tree-panel\">\n        @if (categoryTree.length > 0) {\n          <div class=\"tree-container\">\n            @for (node of getFlattenedNodes(); track node; let i = $index) {\n              <div\n                class=\"tree-node\"\n                [class.selected]=\"IsNodeSelected(node)\"\n                [style.padding-left.px]=\"12 + (node.level * 20)\"\n                (click)=\"selectNode(node)\"\n                >\n                <div class=\"node-content\">\n                  @if (node.children.length > 0) {\n                    <button\n                      class=\"expand-btn\"\n                      (click)=\"toggleExpand(node, $event)\"\n                      >\n                      <i [class]=\"node.expanded ? 'fa-solid fa-chevron-down' : 'fa-solid fa-chevron-right'\"></i>\n                    </button>\n                  }\n                  @if (node.children.length === 0) {\n                    <span class=\"expand-placeholder\"></span>\n                  }\n                  <div class=\"node-icon\" [style.backgroundColor]=\"getCategoryColor(i) + '15'\" [style.color]=\"getCategoryColor(i)\">\n                    <i [class]=\"node.category.IconClass || 'fa-solid fa-folder'\"></i>\n                  </div>\n                  <div class=\"node-info\">\n                    <div class=\"node-name\">{{node.category.Name}}</div>\n                    @if (node.category.Description) {\n                      <div class=\"node-description\">\n                        {{node.category.Description | slice:0:50}}{{node.category.Description.length > 50 ? '...' : ''}}\n                      </div>\n                    }\n                  </div>\n                  <div class=\"node-badges\">\n                    @if (node.typeCount > 0) {\n                      <span class=\"badge types\">\n                        <i class=\"fa-solid fa-shapes\"></i>\n                        {{node.typeCount}}\n                      </span>\n                    }\n                    @if (node.children.length > 0) {\n                      <span class=\"badge children\">\n                        <i class=\"fa-solid fa-folder\"></i>\n                        {{node.children.length}}\n                      </span>\n                    }\n                  </div>\n                  <div class=\"node-actions\">\n                    @if (UserCanUpdate) {\n                      <button mjButton variant=\"flat\" size=\"sm\"\n                        (click)=\"editCategory(node, $event)\"\n                        title=\"Edit\">\n                        <i class=\"fa-solid fa-pen\"></i>\n                      </button>\n                    }\n                    @if (UserCanDelete && node.children.length === 0 && node.typeCount === 0) {\n                      <button mjButton variant=\"danger\" size=\"sm\"\n                        (click)=\"deleteCategory(node, $event)\"\n                        title=\"Delete\">\n                        <i class=\"fa-solid fa-trash\"></i>\n                      </button>\n                    }\n                  </div>\n                </div>\n              </div>\n            }\n          </div>\n        }\n        @if (categoryTree.length === 0) {\n          <div class=\"empty-state\">\n            <div class=\"empty-icon\">\n              <i class=\"fa-solid fa-folder-open\"></i>\n            </div>\n            <h3>No Categories</h3>\n            @if (searchText) {\n              <p>\n                No categories match your search.\n                <button class=\"btn-link\" (click)=\"clearSearch()\">Clear search</button>\n              </p>\n            }\n            @if (!searchText) {\n              <p>\n                Get started by creating your first category.\n              </p>\n            }\n            @if (UserCanCreate && !searchText) {\n              <button class=\"btn-primary\" (click)=\"createNewCategory()\">\n                <i class=\"fa-solid fa-plus\"></i>\n                Create Category\n              </button>\n            }\n          </div>\n        }\n      </div>\n      <!-- Detail Panel -->\n      @if (selectedNode) {\n        <div class=\"detail-panel\">\n          <div class=\"detail-header\">\n            <div class=\"detail-icon\" [style.backgroundColor]=\"getCategoryColor(0) + '15'\" [style.color]=\"getCategoryColor(0)\">\n              <i [class]=\"selectedNode.category.IconClass || 'fa-solid fa-folder'\"></i>\n            </div>\n            <div class=\"detail-title\">\n              <h2>{{selectedNode.category.Name}}</h2>\n              @if (selectedNode.level > 0) {\n                <span class=\"level-badge\">\n                  Level {{selectedNode.level + 1}}\n                </span>\n              }\n            </div>\n            <div class=\"detail-actions\">\n              @if (UserCanUpdate) {\n                <button mjButton variant=\"flat\" size=\"sm\" (click)=\"editCategory(selectedNode)\" title=\"Edit\">\n                  <i class=\"fa-solid fa-pen\"></i>\n                </button>\n              }\n              <button class=\"close-btn\" (click)=\"selectedNode = null\">\n                <i class=\"fa-solid fa-times\"></i>\n              </button>\n            </div>\n          </div>\n          <div class=\"detail-body\">\n            <!-- Stats -->\n            <div class=\"detail-stats\">\n              <div class=\"detail-stat\">\n                <div class=\"stat-value\">{{selectedNode.typeCount}}</div>\n                <div class=\"stat-label\">Credential Types</div>\n              </div>\n              <div class=\"detail-stat\">\n                <div class=\"stat-value\">{{selectedNode.children.length}}</div>\n                <div class=\"stat-label\">Subcategories</div>\n              </div>\n            </div>\n            <!-- Description -->\n            @if (selectedNode.category.Description) {\n              <div class=\"description-section\">\n                <h3>\n                  <i class=\"fa-solid fa-align-left\"></i>\n                  Description\n                </h3>\n                <p class=\"description\">{{selectedNode.category.Description}}</p>\n              </div>\n            }\n            <!-- Types in Category -->\n            @if (selectedNode.typeCount > 0) {\n              <div class=\"types-section\">\n                <h3>\n                  <i class=\"fa-solid fa-shapes\"></i>\n                  Credential Types\n                </h3>\n                <div class=\"type-list\">\n                  @for (type of getTypesForCategory(selectedNode.category.Name); track type) {\n                    <div class=\"type-item\">\n                      <div class=\"type-icon\">\n                        <i [class]=\"type.IconClass || 'fa-solid fa-key'\"></i>\n                      </div>\n                      <div class=\"type-info\">\n                        <div class=\"type-name\">{{type.Name}}</div>\n                        @if (type.Description) {\n                          <div class=\"type-desc\">{{type.Description | slice:0:60}}</div>\n                        }\n                      </div>\n                    </div>\n                  }\n                </div>\n              </div>\n            }\n            <!-- Subcategories -->\n            @if (selectedNode.children.length > 0) {\n              <div class=\"subcategories-section\">\n                <h3>\n                  <i class=\"fa-solid fa-folder-tree\"></i>\n                  Subcategories\n                </h3>\n                <div class=\"subcategory-list\">\n                  @for (child of selectedNode.children; track child) {\n                    <div class=\"subcategory-item\" (click)=\"selectNode(child)\">\n                      <i [class]=\"child.category.IconClass || 'fa-solid fa-folder'\"></i>\n                      <span>{{child.category.Name}}</span>\n                      @if (child.typeCount > 0) {\n                        <span class=\"sub-type-count\">{{child.typeCount}} types</span>\n                      }\n                    </div>\n                  }\n                </div>\n              </div>\n            }\n            <!-- Quick Actions -->\n            <div class=\"detail-quick-actions\">\n              @if (selectedNode.typeCount > 0) {\n                <button\n                  class=\"btn-secondary\"\n                  (click)=\"viewTypesForCategory(selectedNode.category.Name)\"\n                  >\n                  <i class=\"fa-solid fa-shapes\"></i>\n                  View Types\n                </button>\n              }\n              <button\n                class=\"btn-primary\"\n                (click)=\"createCredentialWithCategory(selectedNode.category.ID)\"\n                >\n                <i class=\"fa-solid fa-plus\"></i>\n                Create Credential\n              </button>\n            </div>\n          </div>\n        </div>\n      }\n      <!-- No Selection -->\n      @if (!selectedNode && categoryTree.length > 0) {\n        <div class=\"no-selection\">\n          <div class=\"no-selection-icon\">\n            <i class=\"fa-solid fa-hand-pointer\"></i>\n          </div>\n          <h3>Select a Category</h3>\n          <p>Click on a category to view its details and credential types</p>\n        </div>\n      }\n    </div>\n  }\n  </mj-page-body>\n\n  <!-- Category Edit Panel -->\n  <mj-credential-category-edit-panel\n    #categoryEditPanel\n    (saved)=\"onCategorySaved($any($event))\"\n    (deleted)=\"onCategoryDeleted($any($event))\"\n  ></mj-credential-category-edit-panel>\n</mj-page-layout>\n", styles: ["/* Layout */\n.categories-layout {\n    display: grid;\n    grid-template-columns: 1fr 380px;\n    gap: 20px;\n    min-height: 500px;\n}\n\n/* Tree Panel */\n.tree-panel {\n    background: var(--mj-bg-surface);\n    border-radius: 12px;\n    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);\n    overflow: hidden;\n}\n\n.tree-container {\n    max-height: calc(100vh - 300px);\n    overflow-y: auto;\n}\n\n/* Tree Node */\n.tree-node {\n    display: flex;\n    align-items: center;\n    border-bottom: 1px solid var(--mj-bg-surface-sunken);\n    cursor: pointer;\n    transition: all 0.15s ease;\n}\n\n.tree-node:last-child {\n    border-bottom: none;\n}\n\n.tree-node:hover {\n    background: var(--mj-bg-surface-card);\n}\n\n.tree-node.selected {\n    background: color-mix(in srgb, var(--mj-brand-primary) 6%, var(--mj-bg-surface));\n    border-left: 3px solid var(--mj-brand-primary);\n}\n\n.node-content {\n    display: flex;\n    align-items: center;\n    padding: 12px 16px;\n    width: 100%;\n    gap: 8px;\n}\n\n/* Expand Button */\n.expand-btn {\n    width: 24px;\n    height: 24px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    border: none;\n    background: transparent;\n    cursor: pointer;\n    color: var(--mj-text-disabled);\n    border-radius: 4px;\n    transition: all 0.2s ease;\n    flex-shrink: 0;\n}\n\n.expand-btn:hover {\n    background: var(--mj-border-default);\n    color: var(--mj-text-primary);\n}\n\n.expand-btn i {\n    font-size: 10px;\n    transition: transform 0.2s ease;\n}\n\n.expand-placeholder {\n    width: 24px;\n    flex-shrink: 0;\n}\n\n/* Node Icon */\n.node-icon {\n    width: 36px;\n    height: 36px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    border-radius: 8px;\n    flex-shrink: 0;\n}\n\n.node-icon i {\n    font-size: 14px;\n}\n\n/* Node Info */\n.node-info {\n    flex: 1;\n    min-width: 0;\n}\n\n.node-name {\n    font-weight: 600;\n    font-size: 14px;\n    color: var(--mj-text-primary);\n    line-height: 1.3;\n}\n\n.node-description {\n    font-size: 12px;\n    color: var(--mj-text-secondary);\n    margin-top: 2px;\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n}\n\n/* Node Badges */\n.node-badges {\n    display: flex;\n    gap: 6px;\n    flex-shrink: 0;\n}\n\n.badge {\n    display: flex;\n    align-items: center;\n    gap: 4px;\n    padding: 4px 8px;\n    border-radius: 12px;\n    font-size: 11px;\n    font-weight: 500;\n}\n\n.badge.types {\n    background: color-mix(in srgb, var(--mj-brand-primary) 10%, transparent);\n    color: var(--mj-brand-primary);\n}\n\n.badge.children {\n    background: var(--mj-bg-surface-sunken);\n    color: var(--mj-text-secondary);\n}\n\n.badge i {\n    font-size: 10px;\n}\n\n/* Node Actions */\n.node-actions {\n    display: flex;\n    gap: 4px;\n    opacity: 0;\n    transition: opacity 0.2s ease;\n    flex-shrink: 0;\n}\n\n.tree-node:hover .node-actions {\n    opacity: 1;\n}\n\n.action-btn {\n    width: 28px;\n    height: 28px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    background: var(--mj-bg-surface-sunken);\n    border: none;\n    border-radius: 6px;\n    color: var(--mj-text-secondary);\n    cursor: pointer;\n    transition: all 0.2s ease;\n}\n\n.action-btn:hover {\n    background: var(--mj-brand-primary);\n    color: var(--mj-text-inverse);\n}\n\n.action-btn.danger:hover {\n    background: var(--mj-status-error);\n    color: var(--mj-text-inverse);\n}\n\n.action-btn i {\n    font-size: 12px;\n}\n\n/* Detail Panel */\n.detail-panel {\n    background: var(--mj-bg-surface);\n    border-radius: 12px;\n    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);\n    overflow: hidden;\n    display: flex;\n    flex-direction: column;\n}\n\n.detail-header {\n    display: flex;\n    align-items: center;\n    gap: 12px;\n    padding: 20px;\n    border-bottom: 1px solid var(--mj-bg-surface-sunken);\n}\n\n.detail-icon {\n    width: 48px;\n    height: 48px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    border-radius: 12px;\n    flex-shrink: 0;\n}\n\n.detail-icon i {\n    font-size: 20px;\n}\n\n.detail-title {\n    flex: 1;\n    min-width: 0;\n}\n\n.detail-title h2 {\n    font-size: 18px;\n    font-weight: 600;\n    color: var(--mj-text-primary);\n    margin: 0;\n    line-height: 1.3;\n}\n\n.level-badge {\n    display: inline-block;\n    margin-top: 4px;\n    padding: 2px 8px;\n    background: var(--mj-bg-surface-sunken);\n    border-radius: 10px;\n    font-size: 11px;\n    color: var(--mj-text-secondary);\n}\n\n.detail-actions {\n    display: flex;\n    gap: 8px;\n    flex-shrink: 0;\n}\n\n.close-btn {\n    width: 32px;\n    height: 32px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    background: var(--mj-bg-surface-sunken);\n    border: none;\n    border-radius: 8px;\n    color: var(--mj-text-secondary);\n    cursor: pointer;\n    transition: all 0.2s ease;\n}\n\n.close-btn:hover {\n    background: var(--mj-border-default);\n    color: var(--mj-text-primary);\n}\n\n/* Detail Body */\n.detail-body {\n    padding: 20px;\n    flex: 1;\n    overflow-y: auto;\n}\n\n/* Detail Stats */\n.detail-stats {\n    display: grid;\n    grid-template-columns: repeat(2, 1fr);\n    gap: 12px;\n    margin-bottom: 20px;\n}\n\n.detail-stat {\n    background: var(--mj-bg-surface-card);\n    border-radius: 10px;\n    padding: 16px;\n    text-align: center;\n}\n\n.detail-stat .stat-value {\n    font-size: 28px;\n    font-weight: 700;\n    color: var(--mj-brand-primary);\n    line-height: 1;\n}\n\n.detail-stat .stat-label {\n    font-size: 12px;\n    color: var(--mj-text-secondary);\n    margin-top: 4px;\n}\n\n/* Description Section */\n.description-section {\n    margin-bottom: 20px;\n}\n\n.description-section h3,\n.types-section h3,\n.subcategories-section h3 {\n    display: flex;\n    align-items: center;\n    gap: 8px;\n    font-size: 13px;\n    font-weight: 600;\n    color: var(--mj-text-secondary);\n    text-transform: uppercase;\n    letter-spacing: 0.5px;\n    margin: 0 0 12px 0;\n}\n\n.description-section h3 i,\n.types-section h3 i,\n.subcategories-section h3 i {\n    font-size: 12px;\n}\n\n.description {\n    font-size: 14px;\n    color: var(--mj-text-primary);\n    line-height: 1.6;\n    margin: 0;\n}\n\n/* Types Section */\n.types-section {\n    margin-bottom: 20px;\n}\n\n.type-list {\n    display: flex;\n    flex-direction: column;\n    gap: 8px;\n}\n\n.type-item {\n    display: flex;\n    align-items: center;\n    gap: 10px;\n    padding: 10px 12px;\n    background: var(--mj-bg-surface-card);\n    border-radius: 8px;\n    transition: all 0.2s ease;\n}\n\n.type-item:hover {\n    background: var(--mj-bg-surface-sunken);\n}\n\n.type-icon {\n    width: 32px;\n    height: 32px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    background: color-mix(in srgb, var(--mj-brand-primary) 10%, transparent);\n    border-radius: 6px;\n    flex-shrink: 0;\n}\n\n.type-icon i {\n    font-size: 12px;\n    color: var(--mj-brand-primary);\n}\n\n.type-info {\n    flex: 1;\n    min-width: 0;\n}\n\n.type-name {\n    font-size: 13px;\n    font-weight: 500;\n    color: var(--mj-text-primary);\n}\n\n.type-desc {\n    font-size: 11px;\n    color: var(--mj-text-secondary);\n    margin-top: 2px;\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n}\n\n/* Subcategories Section */\n.subcategories-section {\n    margin-bottom: 20px;\n}\n\n.subcategory-list {\n    display: flex;\n    flex-direction: column;\n    gap: 6px;\n}\n\n.subcategory-item {\n    display: flex;\n    align-items: center;\n    gap: 10px;\n    padding: 10px 12px;\n    background: var(--mj-bg-surface-card);\n    border-radius: 8px;\n    cursor: pointer;\n    transition: all 0.2s ease;\n}\n\n.subcategory-item:hover {\n    background: var(--mj-bg-surface-sunken);\n}\n\n.subcategory-item i {\n    font-size: 14px;\n    color: var(--mj-brand-primary);\n}\n\n.subcategory-item span {\n    flex: 1;\n    font-size: 13px;\n    color: var(--mj-text-primary);\n}\n\n.sub-type-count {\n    font-size: 11px;\n    color: var(--mj-text-secondary);\n    background: var(--mj-border-default);\n    padding: 2px 8px;\n    border-radius: 10px;\n}\n\n/* Quick Actions */\n.detail-quick-actions {\n    margin-top: auto;\n    padding-top: 16px;\n    border-top: 1px solid var(--mj-bg-surface-sunken);\n    display: flex;\n    gap: 8px;\n}\n\n.detail-quick-actions .btn-secondary,\n.detail-quick-actions .btn-primary {\n    flex: 1;\n}\n\n.btn-secondary {\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    padding: 12px;\n    background: var(--mj-bg-surface-sunken);\n    border: none;\n    border-radius: 8px;\n    font-size: 13px;\n    font-weight: 500;\n    color: var(--mj-text-primary);\n    cursor: pointer;\n    transition: all 0.2s ease;\n}\n\n.btn-secondary:hover {\n    background: var(--mj-border-default);\n}\n\n/* No Selection State */\n.no-selection {\n    background: var(--mj-bg-surface);\n    border-radius: 12px;\n    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    justify-content: center;\n    padding: 40px;\n    text-align: center;\n}\n\n.no-selection-icon {\n    width: 64px;\n    height: 64px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    background: var(--mj-bg-surface-sunken);\n    border-radius: 50%;\n    margin-bottom: 16px;\n}\n\n.no-selection-icon i {\n    font-size: 24px;\n    color: var(--mj-text-disabled);\n}\n\n.no-selection h3 {\n    font-size: 16px;\n    font-weight: 600;\n    color: var(--mj-text-primary);\n    margin: 0 0 8px 0;\n}\n\n.no-selection p {\n    font-size: 13px;\n    color: var(--mj-text-secondary);\n    margin: 0;\n}\n\n/* Empty State */\n.empty-state {\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    justify-content: center;\n    padding: 64px 24px;\n    background: var(--mj-bg-surface);\n    border-radius: 12px;\n    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);\n    text-align: center;\n}\n\n.empty-icon {\n    width: 80px;\n    height: 80px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    background: var(--mj-bg-surface-sunken);\n    border-radius: 50%;\n    margin-bottom: 20px;\n}\n\n.empty-icon i {\n    font-size: 32px;\n    color: var(--mj-border-strong);\n}\n\n.empty-state h3 {\n    font-size: 18px;\n    font-weight: 600;\n    color: var(--mj-text-primary);\n    margin: 0 0 8px 0;\n}\n\n.empty-state p {\n    font-size: 14px;\n    color: var(--mj-text-secondary);\n    margin: 0 0 20px 0;\n}\n\n.btn-link {\n    background: none;\n    border: none;\n    color: var(--mj-brand-primary);\n    cursor: pointer;\n    font-size: inherit;\n    padding: 0;\n    text-decoration: underline;\n}\n\n.btn-link:hover {\n    color: var(--mj-brand-primary-hover);\n}\n\n/* Responsive */\n@media (max-width: 1024px) {\n    .categories-layout {\n        grid-template-columns: 1fr;\n    }\n\n    .detail-panel,\n    .no-selection {\n        display: none;\n    }\n}\n\n@media (max-width: 768px) {\n    .categories-container {\n        padding: 16px;\n    }\n\n    .categories-header {\n        flex-direction: column;\n        align-items: flex-start;\n        gap: 16px;\n    }\n\n    .toolbar {\n        flex-direction: column;\n        gap: 12px;\n    }\n\n    .toolbar-left,\n    .toolbar-right {\n        width: 100%;\n    }\n\n    .search-container {\n        max-width: none;\n    }\n\n    .toolbar-right {\n        justify-content: flex-end;\n    }\n}\n"] }]
    }], () => [{ type: i0.ChangeDetectorRef }], { categoryEditPanel: [{
            type: ViewChild,
            args: ['categoryEditPanel']
        }] }); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CredentialsCategoriesResourceComponent, { className: "CredentialsCategoriesResourceComponent", filePath: "src/Credentials/components/credentials-categories-resource.component.ts", lineNumber: 24 }); })();
//# sourceMappingURL=credentials-categories-resource.component.js.map