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 } from '@angular/core';
import { CompositeKey, RunView, LogError } from '@memberjunction/core';
import { RegisterClass, UUIDsEqual } from '@memberjunction/global';
import { BaseResourceComponent } from '@memberjunction/ng-shared';
import { Subject, BehaviorSubject, combineLatest } from 'rxjs';
import { debounceTime, takeUntil, distinctUntilChanged } from 'rxjs/operators';
import { validateEnumParam, boundNameList } from '../../shared/agent-tool-validation';
import { findByIdOrError, findByIdOrNameOrError } from '../agent-tool-helpers';
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 "@angular/common";
const _forTrack0 = ($index, $item) => $item.date;
const _forTrack1 = ($index, $item) => $item.ID;
function ActionExecutionMonitoringComponent_Conditional_69_For_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 38)(1, "div", 43);
    i0.ɵɵelement(2, "div", 44)(3, "div", 45);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "div", 46);
    i0.ɵɵtext(5);
    i0.ɵɵpipe(6, "date");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(7, "div", 47);
    i0.ɵɵtext(8);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const trend_r1 = ctx.$implicit;
    i0.ɵɵadvance(2);
    i0.ɵɵstyleProp("height", trend_r1.total > 0 ? trend_r1.successful / trend_r1.total * 100 : 0, "%");
    i0.ɵɵadvance();
    i0.ɵɵstyleProp("height", trend_r1.total > 0 ? trend_r1.failed / trend_r1.total * 100 : 0, "%");
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind2(6, 6, trend_r1.date, "MMM d"));
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(trend_r1.total);
} }
function ActionExecutionMonitoringComponent_Conditional_69_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 37);
    i0.ɵɵrepeaterCreate(1, ActionExecutionMonitoringComponent_Conditional_69_For_2_Template, 9, 9, "div", 38, _forTrack0);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "div", 39)(4, "div", 40);
    i0.ɵɵelement(5, "div", 41);
    i0.ɵɵelementStart(6, "span");
    i0.ɵɵtext(7, "Successful");
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(8, "div", 40);
    i0.ɵɵelement(9, "div", 42);
    i0.ɵɵelementStart(10, "span");
    i0.ɵɵtext(11, "Failed");
    i0.ɵɵelementEnd()()();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵadvance();
    i0.ɵɵrepeater(ctx_r1.executionTrends);
} }
function ActionExecutionMonitoringComponent_Conditional_70_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "mj-empty-state", 30);
} }
function ActionExecutionMonitoringComponent_Conditional_79_For_1_Template(rf, ctx) { if (rf & 1) {
    const _r3 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 49);
    i0.ɵɵlistener("click", function ActionExecutionMonitoringComponent_Conditional_79_For_1_Template_div_click_0_listener() { const execution_r4 = i0.ɵɵrestoreView(_r3).$implicit; const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.openExecution(execution_r4)); });
    i0.ɵɵelementStart(1, "div", 50);
    i0.ɵɵelement(2, "i");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "div", 51)(4, "div", 52);
    i0.ɵɵlistener("click", function ActionExecutionMonitoringComponent_Conditional_79_For_1_Template_div_click_4_listener($event) { const execution_r4 = i0.ɵɵrestoreView(_r3).$implicit; const ctx_r1 = i0.ɵɵnextContext(2); ctx_r1.openAction(execution_r4.ActionID); return i0.ɵɵresetView($event.stopPropagation()); });
    i0.ɵɵtext(5);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(6, "div", 53)(7, "span", 54);
    i0.ɵɵtext(8);
    i0.ɵɵpipe(9, "date");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(10, "span", 55);
    i0.ɵɵtext(11);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(12, "span", 56);
    i0.ɵɵtext(13);
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(14, "div", 57)(15, "span", 58);
    i0.ɵɵtext(16);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(17, "div", 59)(18, "button", 60);
    i0.ɵɵlistener("click", function ActionExecutionMonitoringComponent_Conditional_79_For_1_Template_button_click_18_listener($event) { i0.ɵɵrestoreView(_r3); return i0.ɵɵresetView($event.stopPropagation()); });
    i0.ɵɵelement(19, "i", 61);
    i0.ɵɵelementEnd()()();
} if (rf & 2) {
    const execution_r4 = ctx.$implicit;
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(2);
    i0.ɵɵclassMap(ctx_r1.getResultIcon(execution_r4.ResultCode));
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate1(" ", ctx_r1.getActionName(execution_r4.ActionID), " ");
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind2(9, 8, execution_r4.StartedAt, "MMM d, HH:mm:ss"));
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(execution_r4.UserID);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(ctx_r1.getDuration(execution_r4));
    i0.ɵɵadvance(2);
    i0.ɵɵattribute("data-color", ctx_r1.getResultColor(execution_r4.ResultCode));
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", execution_r4.ResultCode || "Unknown", " ");
} }
function ActionExecutionMonitoringComponent_Conditional_79_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵrepeaterCreate(0, ActionExecutionMonitoringComponent_Conditional_79_For_1_Template, 20, 11, "div", 48, _forTrack1);
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵrepeater(ctx_r1.filteredExecutions);
} }
function ActionExecutionMonitoringComponent_Conditional_80_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "mj-empty-state", 35);
} }
function ActionExecutionMonitoringComponent_Conditional_81_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 36);
    i0.ɵɵelement(1, "mj-loading", 62);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    i0.ɵɵadvance();
    i0.ɵɵproperty("showText", false);
} }
/**
 * Execution Monitoring Resource - displays action execution logs and metrics
 */
let ActionExecutionMonitoringComponent = class ActionExecutionMonitoringComponent extends BaseResourceComponent {
    cdr;
    isLoading = true;
    executions = [];
    filteredExecutions = [];
    actions = new Map();
    metrics = {
        totalExecutions: 0,
        successfulExecutions: 0,
        failedExecutions: 0,
        averageDuration: 0,
        executionsToday: 0,
        executionsThisWeek: 0,
        currentlyRunning: 0
    };
    executionTrends = [];
    searchTerm$ = new BehaviorSubject('');
    selectedResult$ = new BehaviorSubject('all');
    selectedTimeRange$ = new BehaviorSubject('7days');
    selectedAction$ = new BehaviorSubject('all');
    timeRangeOptions = [
        { text: 'Last 24 Hours', value: '24hours' },
        { text: 'Last 7 Days', value: '7days' },
        { text: 'Last 30 Days', value: '30days' },
        { text: 'Last 90 Days', value: '90days' }
    ];
    resultOptions = [
        { text: 'All Results', value: 'all' },
        { text: 'Success', value: 'Success' },
        { text: 'Failed', value: 'Failed' },
        { text: 'Error', value: 'Error' },
        { text: 'Running', value: 'Running' }
    ];
    actionOptions = [
        { text: 'All Actions', value: 'all' }
    ];
    /** Allowed result-filter values (mirrors `resultOptions`). */
    resultFilterValues = ['all', 'Success', 'Failed', 'Error', 'Running'];
    /** Allowed time-range values (mirrors `timeRangeOptions`). */
    timeRangeValues = ['24hours', '7days', '30days', '90days'];
    /** The currently selected execution (set when the agent/user opens one) — surfaced in context + drives the tool mode. */
    selectedExecution = null;
    /**
     * Tracks which mode's tool set is currently registered so {@link syncAgentToolsForMode}
     * only calls into NavigationService on the list↔detail transition, not on every filter change.
     */
    lastRegisteredToolMode = null;
    destroy$ = new Subject();
    constructor(cdr) {
        super();
        this.cdr = cdr;
    }
    ngOnInit() {
        super.ngOnInit();
        this.setupFilters();
        this.syncAgentToolsForMode();
        this.loadData();
    }
    ngOnDestroy() {
        super.ngOnDestroy();
        this.destroy$.next();
        this.destroy$.complete();
    }
    setupFilters() {
        combineLatest([
            this.searchTerm$.pipe(debounceTime(300), distinctUntilChanged()),
            this.selectedResult$.pipe(distinctUntilChanged()),
            this.selectedTimeRange$.pipe(distinctUntilChanged()),
            this.selectedAction$.pipe(distinctUntilChanged())
        ]).pipe(takeUntil(this.destroy$)).subscribe(() => {
            this.applyFilters();
            this.syncAgentToolsForMode();
            this.publishAgentContext();
        });
    }
    // ================================================================
    // AI Agent context + client tools
    //
    // 🚨 SAFETY BOUNDARY: This is the Actions app. Executing an action has real
    // side effects. This monitor is VIEW-ONLY run history — it exposes only
    // search / filter / sort / navigate / select / refresh tools to the agent. No
    // action execution (RunAction / re-run) is wired anywhere. Every Handler is
    // tolerant (never throws; returns a structured failure on bad input).
    //
    // MODE-SCOPED TOOLS: the monitor has two contexts — the LOG LIST (no execution
    // selected) and a SELECTED EXECUTION (detail). Detail-only tools (open the
    // selected execution, jump to its action, clear the selection) are only
    // registered while an execution is selected, so the agent never sees a tool
    // that can't apply. COMMON tools (search/filter/refresh) are always present.
    // ================================================================
    /** Publish the current monitor state to the agent. Called on load and on every filter change.
     *  Deep context: execution metrics, success rate, all filter state, the selected execution
     *  (id + action NAME + result), and the bounded list of filtered action names in view. */
    publishAgentContext() {
        this.navigationService.SetAgentContext(this, {
            // Execution metrics
            TotalExecutionCount: this.metrics.totalExecutions,
            SuccessfulExecutionCount: this.metrics.successfulExecutions,
            FailedExecutionCount: this.metrics.failedExecutions,
            CurrentlyRunningCount: this.metrics.currentlyRunning,
            ExecutionsTodayCount: this.metrics.executionsToday,
            ExecutionsThisWeekCount: this.metrics.executionsThisWeek,
            AverageDurationSeconds: this.metrics.averageDuration,
            OverallSuccessRate: this.getSuccessRate(),
            // What's in view after filtering
            FilteredExecutionCount: this.filteredExecutions.length,
            VisibleActionNames: boundNameList(this.distinctVisibleActionNames()),
            // Filter / search state
            CurrentSearchTerm: this.searchTerm$.value,
            CurrentResultFilter: this.selectedResult$.value,
            CurrentTimeRangeFilter: this.selectedTimeRange$.value,
            CurrentActionFilter: this.selectedAction$.value,
            // Mode + selection (id + action NAME + result)
            ToolMode: this.currentToolMode(),
            SelectedExecutionId: this.selectedExecution?.ID ?? null,
            SelectedExecutionActionName: this.selectedExecution ? this.getActionName(this.selectedExecution.ActionID) : null,
            SelectedExecutionResult: this.selectedExecution?.ResultCode ?? null,
        });
    }
    /** Distinct action names among the currently-filtered executions (for context). */
    distinctVisibleActionNames() {
        const seen = new Set();
        const names = [];
        for (const e of this.filteredExecutions) {
            const name = this.actions.get(e.ActionID)?.Name;
            if (name && !seen.has(name)) {
                seen.add(name);
                names.push(name);
            }
        }
        return names;
    }
    /** The current tool mode: 'detail' when an execution is selected, else 'list'. */
    currentToolMode() {
        return this.selectedExecution ? 'detail' : 'list';
    }
    /**
     * Re-scope the agent's client tools to the CURRENT mode (list vs. selected-execution
     * detail). Guarded on {@link lastRegisteredToolMode} so it only calls NavigationService on
     * the mode flip — `publishAgentContext` fires on every filter change but the tool set only
     * changes when an execution is selected/deselected.
     */
    syncAgentToolsForMode() {
        const mode = this.currentToolMode();
        if (mode === this.lastRegisteredToolMode) {
            return;
        }
        this.lastRegisteredToolMode = mode;
        this.navigationService.SetAgentClientTools(this, [
            ...this.buildCommonTools(),
            ...(mode === 'detail' ? this.buildDetailTools() : this.buildListTools()),
        ]);
    }
    /** COMMON tools — available in BOTH modes (search, filter, sort, refresh, select-by-id/name). */
    buildCommonTools() {
        return [
            {
                Name: 'SearchExecutions',
                Description: 'Search the execution log by a free-text term (matches action name, result code, user).',
                ParameterSchema: { type: 'object', properties: { searchTerm: { type: 'string' } }, required: ['searchTerm'] },
                Handler: async (params) => {
                    const term = typeof params['searchTerm'] === 'string' ? params['searchTerm'] : '';
                    this.onSearchChange(term);
                    return { Success: true };
                },
            },
            {
                Name: 'FilterExecutionsByResult',
                Description: 'Filter executions by result. Allowed: all, Success, Failed, Error, Running.',
                ParameterSchema: { type: 'object', properties: { result: { type: 'string', enum: [...this.resultFilterValues] } }, required: ['result'] },
                Handler: async (params) => {
                    const v = validateEnumParam(params['result'], this.resultFilterValues, 'result');
                    if (!v.ok)
                        return v.result;
                    this.onResultFilterChange(v.value);
                    return { Success: true };
                },
            },
            {
                Name: 'FilterExecutionsByTimeRange',
                Description: 'Filter executions by time range. Allowed: 24hours, 7days, 30days, 90days.',
                ParameterSchema: { type: 'object', properties: { timeRange: { type: 'string', enum: [...this.timeRangeValues] } }, required: ['timeRange'] },
                Handler: async (params) => {
                    const v = validateEnumParam(params['timeRange'], this.timeRangeValues, 'timeRange');
                    if (!v.ok)
                        return v.result;
                    this.onTimeRangeChange(v.value);
                    return { Success: true };
                },
            },
            {
                Name: 'FilterExecutionsByAction',
                Description: 'Filter executions to a single action by its id OR name (case-insensitive), or "all" to clear the action filter.',
                ParameterSchema: { type: 'object', properties: { action: { type: 'string' } }, required: ['action'] },
                Handler: async (params) => {
                    const raw = params['action'];
                    if (typeof raw !== 'string' || raw.trim() === '') {
                        return { Success: false, ErrorMessage: 'A non-empty action id or name is required (use "all" to clear).' };
                    }
                    if (raw.trim().toLowerCase() === 'all') {
                        this.onActionFilterChange('all');
                        return { Success: true };
                    }
                    const found = findByIdOrNameOrError(raw, Array.from(this.actions.values()), 'action');
                    if (!found.ok)
                        return found.result;
                    this.onActionFilterChange(found.value.ID);
                    return { Success: true, Data: { Id: found.value.ID, Name: found.value.Name } };
                },
            },
            {
                Name: 'ClearMonitorFilters',
                Description: 'Reset all execution-monitor filters (result, time range, action) to their defaults.',
                ParameterSchema: { type: 'object', properties: {} },
                Handler: async () => {
                    this.resetFilters();
                    return { Success: true };
                },
            },
            {
                Name: 'RefreshMonitorData',
                Description: 'Reload the execution monitoring data (logs, metrics, trends).',
                ParameterSchema: { type: 'object', properties: {} },
                Handler: async () => {
                    this.refreshData();
                    return { Success: true };
                },
            },
        ];
    }
    /** LIST-mode tools — only when NO execution is selected: select an execution (which flips to detail mode). */
    buildListTools() {
        return [
            {
                Name: 'SelectExecution',
                Description: 'Select an execution-log entry by its id and open its detail record (view-only run history). Selecting it reveals the detail tools.',
                ParameterSchema: { type: 'object', properties: { executionId: { type: 'string' } }, required: ['executionId'] },
                Handler: async (params) => {
                    const found = findByIdOrError(params['executionId'], this.filteredExecutions.length ? this.filteredExecutions : this.executions, 'execution');
                    if (!found.ok)
                        return found.result;
                    this.selectExecution(found.value);
                    return { Success: true, Data: { Id: found.value.ID, ActionName: this.getActionName(found.value.ActionID) } };
                },
            },
        ];
    }
    /** DETAIL-mode tools — only when an execution IS selected: open it, jump to its action, clear the selection. */
    buildDetailTools() {
        return [
            {
                Name: 'OpenSelectedExecutionLog',
                Description: 'Open the detail record for the currently selected execution (view-only run history).',
                ParameterSchema: { type: 'object', properties: {} },
                Handler: async () => {
                    if (!this.selectedExecution)
                        return { Success: false, ErrorMessage: 'No execution is currently selected.' };
                    this.openExecution(this.selectedExecution);
                    return { Success: true };
                },
            },
            {
                Name: 'OpenSelectedExecutionAction',
                Description: 'Open the action record that the currently selected execution ran (related-record navigation — does NOT run the action).',
                ParameterSchema: { type: 'object', properties: {} },
                Handler: async () => {
                    const actionId = this.selectedExecution?.ActionID;
                    if (!actionId)
                        return { Success: false, ErrorMessage: 'No execution is selected, or it has no associated action.' };
                    this.openAction(actionId);
                    return { Success: true, Data: { ActionName: this.getActionName(actionId) } };
                },
            },
            {
                Name: 'ClearExecutionSelection',
                Description: 'Clear the current execution selection and return to the log-list tools.',
                ParameterSchema: { type: 'object', properties: {} },
                Handler: async () => {
                    this.clearExecutionSelection();
                    return { Success: true };
                },
            },
        ];
    }
    /** Select an execution (sets selection, re-scopes tools to detail mode, re-publishes context). */
    selectExecution(execution) {
        this.selectedExecution = execution;
        this.syncAgentToolsForMode();
        this.publishAgentContext();
        this.openExecution(execution);
    }
    /** Clear the execution selection (re-scopes tools back to list mode). */
    clearExecutionSelection() {
        this.selectedExecution = null;
        this.syncAgentToolsForMode();
        this.publishAgentContext();
    }
    async loadData() {
        try {
            this.isLoading = true;
            const rv = RunView.FromMetadataProvider(this.ProviderToUse);
            const [executionsResult, actionsResult] = await rv.RunViews([
                {
                    EntityName: 'MJ: Action Execution Logs',
                    OrderBy: 'StartedAt DESC'
                },
                {
                    EntityName: 'MJ: Actions',
                    OrderBy: 'Name'
                }
            ]);
            if (!executionsResult.Success || !actionsResult.Success) {
                throw new Error('Failed to load data');
            }
            const executions = executionsResult.Results;
            const actions = actionsResult.Results;
            this.executions = executions;
            this.populateActionsMap(actions);
            this.buildActionOptions(actions);
            this.calculateMetrics();
            this.generateExecutionTrends();
            this.applyFilters();
            this.publishAgentContext();
        }
        catch (error) {
            LogError('Failed to load execution monitoring data', undefined, error);
        }
        finally {
            this.isLoading = false;
            this.NotifyLoadComplete();
            this.cdr.detectChanges();
        }
    }
    populateActionsMap(actions) {
        this.actions.clear();
        actions.forEach(action => {
            this.actions.set(action.ID, action);
        });
    }
    buildActionOptions(actions) {
        this.actionOptions = [
            { text: 'All Actions', value: 'all' },
            ...actions.map(action => ({
                text: action.Name,
                value: action.ID
            }))
        ];
    }
    calculateMetrics() {
        const now = new Date();
        const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
        const weekAgo = new Date(today.getTime() - 7 * 24 * 60 * 60 * 1000);
        this.metrics = {
            totalExecutions: this.executions.length,
            successfulExecutions: this.executions.filter(e => e.ResultCode === 'Success').length,
            failedExecutions: this.executions.filter(e => e.ResultCode && ['Failed', 'Error'].includes(e.ResultCode)).length,
            averageDuration: this.calculateAverageDuration(),
            executionsToday: this.executions.filter(e => new Date(e.StartedAt) >= today).length,
            executionsThisWeek: this.executions.filter(e => new Date(e.StartedAt) >= weekAgo).length,
            currentlyRunning: this.executions.filter(e => e.ResultCode === 'Running' || !e.EndedAt).length
        };
    }
    calculateAverageDuration() {
        const completedExecutions = this.executions.filter(e => e.StartedAt && e.EndedAt);
        if (completedExecutions.length === 0)
            return 0;
        const totalDuration = completedExecutions.reduce((sum, execution) => {
            const start = new Date(execution.StartedAt).getTime();
            const end = new Date(execution.EndedAt).getTime();
            return sum + (end - start);
        }, 0);
        return Math.round(totalDuration / completedExecutions.length / 1000); // Average in seconds
    }
    generateExecutionTrends() {
        const trends = new Map();
        const last7Days = Array.from({ length: 7 }, (_, i) => {
            const date = new Date();
            date.setDate(date.getDate() - i);
            return date.toISOString().split('T')[0];
        }).reverse();
        // Initialize trends for last 7 days
        last7Days.forEach(date => {
            trends.set(date, {
                date,
                successful: 0,
                failed: 0,
                total: 0
            });
        });
        // Populate trends with execution data
        this.executions.forEach(execution => {
            if (!execution.StartedAt)
                return;
            const date = new Date(execution.StartedAt).toISOString().split('T')[0];
            const trend = trends.get(date);
            if (trend) {
                trend.total++;
                if (execution.ResultCode === 'Success') {
                    trend.successful++;
                }
                else if (execution.ResultCode && ['Failed', 'Error'].includes(execution.ResultCode)) {
                    trend.failed++;
                }
            }
        });
        this.executionTrends = Array.from(trends.values());
    }
    applyFilters() {
        let filtered = [...this.executions];
        // Apply time range filter
        const timeRange = this.selectedTimeRange$.value;
        if (timeRange !== 'all') {
            const cutoffDate = this.getTimeRangeCutoff(timeRange);
            filtered = filtered.filter(e => e.StartedAt && new Date(e.StartedAt) >= cutoffDate);
        }
        // Apply result filter
        const result = this.selectedResult$.value;
        if (result !== 'all') {
            if (result === 'Running') {
                filtered = filtered.filter(e => !e.EndedAt || e.ResultCode === 'Running');
            }
            else {
                filtered = filtered.filter(e => e.ResultCode === result);
            }
        }
        // Apply action filter
        const actionId = this.selectedAction$.value;
        if (actionId !== 'all') {
            filtered = filtered.filter(e => UUIDsEqual(e.ActionID, actionId));
        }
        // Apply search filter
        const searchTerm = this.searchTerm$.value.toLowerCase();
        if (searchTerm) {
            filtered = filtered.filter(e => {
                const action = this.actions.get(e.ActionID);
                return (action?.Name.toLowerCase().includes(searchTerm) ||
                    e.ResultCode?.toLowerCase().includes(searchTerm) ||
                    e.UserID?.toLowerCase().includes(searchTerm));
            });
        }
        this.filteredExecutions = filtered;
    }
    getTimeRangeCutoff(timeRange) {
        const now = new Date();
        switch (timeRange) {
            case '24hours':
                return new Date(now.getTime() - 24 * 60 * 60 * 1000);
            case '7days':
                return new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000);
            case '30days':
                return new Date(now.getTime() - 30 * 24 * 60 * 60 * 1000);
            case '90days':
                return new Date(now.getTime() - 90 * 24 * 60 * 60 * 1000);
            default:
                return new Date(0);
        }
    }
    onSearchChange(searchTerm) {
        this.searchTerm$.next(searchTerm);
    }
    onResultFilterChange(result) {
        this.selectedResult$.next(result);
    }
    onTimeRangeChange(timeRange) {
        this.selectedTimeRange$.next(timeRange);
    }
    onActionFilterChange(actionId) {
        this.selectedAction$.next(actionId);
    }
    // ───── Filter-popover plumbing for the [actions] slot ─────
    get FilterFields() {
        return [
            {
                key: 'timeRange',
                type: 'dropdown',
                label: 'Time range',
                icon: 'fa-solid fa-clock',
                options: this.timeRangeOptions
            },
            {
                key: 'result',
                type: 'dropdown',
                label: 'Result',
                icon: 'fa-solid fa-circle-info',
                options: this.resultOptions
            },
            {
                key: 'action',
                type: 'dropdown',
                label: 'Action',
                icon: 'fa-solid fa-bolt',
                filterable: true,
                options: this.actionOptions
            }
        ];
    }
    get FilterValues() {
        return {
            timeRange: this.selectedTimeRange$.value,
            result: this.selectedResult$.value,
            action: this.selectedAction$.value
        };
    }
    get ActiveFilterCount() {
        let n = 0;
        if (this.selectedTimeRange$.value !== '7days')
            n++;
        if (this.selectedResult$.value !== 'all')
            n++;
        if (this.selectedAction$.value !== 'all')
            n++;
        return n;
    }
    onFilterValuesChange(v) {
        const next = (v ?? {});
        if ((next.timeRange ?? '7days') !== this.selectedTimeRange$.value) {
            this.onTimeRangeChange(next.timeRange ?? '7days');
        }
        if ((next.result ?? 'all') !== this.selectedResult$.value) {
            this.onResultFilterChange(next.result ?? 'all');
        }
        if ((next.action ?? 'all') !== this.selectedAction$.value) {
            this.onActionFilterChange(next.action ?? 'all');
        }
    }
    resetFilters() {
        if (this.selectedTimeRange$.value !== '7days')
            this.onTimeRangeChange('7days');
        if (this.selectedResult$.value !== 'all')
            this.onResultFilterChange('all');
        if (this.selectedAction$.value !== 'all')
            this.onActionFilterChange('all');
    }
    openExecution(execution) {
        const key = new CompositeKey([{ FieldName: 'ID', Value: execution.ID }]);
        this.navigationService.OpenEntityRecord('MJ: Action Execution Logs', key);
    }
    openAction(actionId) {
        const key = new CompositeKey([{ FieldName: 'ID', Value: actionId }]);
        this.navigationService.OpenEntityRecord('MJ: Actions', key);
    }
    getActionName(actionId) {
        return this.actions.get(actionId)?.Name || `Action ${actionId}`;
    }
    getResultColor(resultCode) {
        if (!resultCode)
            return 'info';
        switch (resultCode.toLowerCase()) {
            case 'success': return 'success';
            case 'failed':
            case 'error': return 'error';
            case 'running': return 'warning';
            default: return 'info';
        }
    }
    getResultIcon(resultCode) {
        if (!resultCode)
            return 'fa-solid fa-question';
        switch (resultCode.toLowerCase()) {
            case 'success': return 'fa-solid fa-check-circle';
            case 'failed':
            case 'error': return 'fa-solid fa-exclamation-circle';
            case 'running': return 'fa-solid fa-spinner fa-spin';
            default: return 'fa-solid fa-info-circle';
        }
    }
    getDuration(execution) {
        if (!execution.StartedAt || !execution.EndedAt) {
            return execution.EndedAt ? 'Unknown' : 'Running';
        }
        const start = new Date(execution.StartedAt).getTime();
        const end = new Date(execution.EndedAt).getTime();
        const duration = Math.round((end - start) / 1000);
        if (duration < 60)
            return `${duration}s`;
        if (duration < 3600)
            return `${Math.round(duration / 60)}m`;
        return `${Math.round(duration / 3600)}h`;
    }
    getSuccessRate() {
        if (this.metrics.totalExecutions === 0)
            return 0;
        return Math.round((this.metrics.successfulExecutions / this.metrics.totalExecutions) * 100);
    }
    refreshData() {
        this.loadData();
    }
    // Metric card click handlers
    onTotalExecutionsClick() {
        // Reset filters to show all executions
        this.selectedResult$.next('all');
        this.selectedTimeRange$.next('7days');
        this.selectedAction$.next('all');
    }
    onSuccessRateClick() {
        this.selectedResult$.next('Success');
    }
    onFailedExecutionsClick() {
        this.selectedResult$.next('Failed');
    }
    onRunningExecutionsClick() {
        this.selectedResult$.next('Running');
    }
    async GetResourceDisplayName(data) {
        return 'Execution Monitoring';
    }
    async GetResourceIconClass(data) {
        return 'fa-solid fa-chart-line';
    }
    static ɵfac = function ActionExecutionMonitoringComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ActionExecutionMonitoringComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
    static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ActionExecutionMonitoringComponent, selectors: [["mj-execution-monitoring"]], standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 82, vars: 18, consts: [["Title", "Execution Monitor", "Icon", "fa-solid fa-chart-line", "Subtitle", "Action execution history, latency, and error rates"], ["actions", ""], [3, "Clicked"], ["toolbar", ""], ["Placeholder", "Search executions...", 3, "ValueChange", "Value"], [3, "ClearAllRequested", "ActiveCount", "ShowClearAll"], [3, "ValuesChange", "Reset", "Fields", "Values"], [1, "execution-monitoring"], [1, "metrics-summary"], [1, "metric-card", "total", "clickable", 3, "click"], [1, "metric-icon"], [1, "fa-solid", "fa-play-circle"], [1, "metric-content"], [1, "metric-value"], [1, "metric-label"], [1, "metric-card", "success", "clickable", 3, "click"], [1, "fa-solid", "fa-check-circle"], [1, "metric-detail"], [1, "metric-card", "error", "clickable", 3, "click"], [1, "fa-solid", "fa-exclamation-circle"], [1, "metric-card", "duration"], [1, "fa-solid", "fa-clock"], [1, "metric-card", "activity"], [1, "fa-solid", "fa-calendar-day"], [1, "metric-card", "running", "clickable", 3, "click"], [1, "fa-solid", "fa-spinner", "fa-spin"], [1, "trends-section"], [1, "section-header"], [1, "fa-solid", "fa-chart-area"], [1, "trends-chart"], ["Size", "compact", "Icon", "fa-solid fa-chart-area", "Title", "No execution trends available", 1, "empty-chart"], [1, "executions-section"], [1, "fa-solid", "fa-list"], [1, "results-count"], [1, "executions-list"], ["Variant", "no-results", "Title", "No executions found", "Message", "Try adjusting your filters or search terms"], [1, "loading-overlay"], [1, "trend-bars"], [1, "trend-bar"], [1, "chart-legend"], [1, "legend-item"], [1, "legend-color", "success"], [1, "legend-color", "failed"], [1, "bar-container"], [1, "bar-success"], [1, "bar-failed"], [1, "bar-label"], [1, "bar-total"], [1, "execution-item"], [1, "execution-item", 3, "click"], [1, "execution-status"], [1, "execution-main"], [1, "execution-action", 3, "click"], [1, "execution-details"], [1, "execution-time"], [1, "execution-user"], [1, "execution-duration"], [1, "execution-result"], [1, "status-chip"], [1, "execution-actions"], ["mjButton", "", "variant", "flat", 3, "click"], [1, "fa-solid", "fa-ellipsis-vertical"], ["size", "medium", 3, "showText"]], template: function ActionExecutionMonitoringComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelementStart(0, "mj-page-layout")(1, "mj-page-header", 0)(2, "div", 1)(3, "mj-refresh-button", 2);
            i0.ɵɵlistener("Clicked", function ActionExecutionMonitoringComponent_Template_mj_refresh_button_Clicked_3_listener() { return ctx.refreshData(); });
            i0.ɵɵelementEnd()();
            i0.ɵɵelementStart(4, "div", 3)(5, "mj-page-search", 4);
            i0.ɵɵlistener("ValueChange", function ActionExecutionMonitoringComponent_Template_mj_page_search_ValueChange_5_listener($event) { return ctx.onSearchChange($event); });
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(6, "mj-filter-popover", 5);
            i0.ɵɵlistener("ClearAllRequested", function ActionExecutionMonitoringComponent_Template_mj_filter_popover_ClearAllRequested_6_listener() { return ctx.resetFilters(); });
            i0.ɵɵelementStart(7, "mj-filter-panel", 6);
            i0.ɵɵlistener("ValuesChange", function ActionExecutionMonitoringComponent_Template_mj_filter_panel_ValuesChange_7_listener($event) { return ctx.onFilterValuesChange($event); })("Reset", function ActionExecutionMonitoringComponent_Template_mj_filter_panel_Reset_7_listener() { return ctx.resetFilters(); });
            i0.ɵɵelementEnd()()()();
            i0.ɵɵelementStart(8, "mj-page-body")(9, "div", 7)(10, "div", 8)(11, "div", 9);
            i0.ɵɵlistener("click", function ActionExecutionMonitoringComponent_Template_div_click_11_listener() { return ctx.onTotalExecutionsClick(); });
            i0.ɵɵelementStart(12, "div", 10);
            i0.ɵɵelement(13, "i", 11);
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(14, "div", 12)(15, "div", 13);
            i0.ɵɵtext(16);
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(17, "div", 14);
            i0.ɵɵtext(18, "Total Executions");
            i0.ɵɵelementEnd()()();
            i0.ɵɵelementStart(19, "div", 15);
            i0.ɵɵlistener("click", function ActionExecutionMonitoringComponent_Template_div_click_19_listener() { return ctx.onSuccessRateClick(); });
            i0.ɵɵelementStart(20, "div", 10);
            i0.ɵɵelement(21, "i", 16);
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(22, "div", 12)(23, "div", 13);
            i0.ɵɵtext(24);
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(25, "div", 14);
            i0.ɵɵtext(26, "Success Rate");
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(27, "div", 17);
            i0.ɵɵtext(28);
            i0.ɵɵelementEnd()()();
            i0.ɵɵelementStart(29, "div", 18);
            i0.ɵɵlistener("click", function ActionExecutionMonitoringComponent_Template_div_click_29_listener() { return ctx.onFailedExecutionsClick(); });
            i0.ɵɵelementStart(30, "div", 10);
            i0.ɵɵelement(31, "i", 19);
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(32, "div", 12)(33, "div", 13);
            i0.ɵɵtext(34);
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(35, "div", 14);
            i0.ɵɵtext(36, "Failed Executions");
            i0.ɵɵelementEnd()()();
            i0.ɵɵelementStart(37, "div", 20)(38, "div", 10);
            i0.ɵɵelement(39, "i", 21);
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(40, "div", 12)(41, "div", 13);
            i0.ɵɵtext(42);
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(43, "div", 14);
            i0.ɵɵtext(44, "Avg Duration");
            i0.ɵɵelementEnd()()();
            i0.ɵɵelementStart(45, "div", 22)(46, "div", 10);
            i0.ɵɵelement(47, "i", 23);
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(48, "div", 12)(49, "div", 13);
            i0.ɵɵtext(50);
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(51, "div", 14);
            i0.ɵɵtext(52, "Today");
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(53, "div", 17);
            i0.ɵɵtext(54);
            i0.ɵɵelementEnd()()();
            i0.ɵɵelementStart(55, "div", 24);
            i0.ɵɵlistener("click", function ActionExecutionMonitoringComponent_Template_div_click_55_listener() { return ctx.onRunningExecutionsClick(); });
            i0.ɵɵelementStart(56, "div", 10);
            i0.ɵɵelement(57, "i", 25);
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(58, "div", 12)(59, "div", 13);
            i0.ɵɵtext(60);
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(61, "div", 14);
            i0.ɵɵtext(62, "Currently Running");
            i0.ɵɵelementEnd()()()();
            i0.ɵɵelementStart(63, "div", 26)(64, "div", 27)(65, "h4");
            i0.ɵɵelement(66, "i", 28);
            i0.ɵɵtext(67, " 7-Day Execution Trends");
            i0.ɵɵelementEnd()();
            i0.ɵɵelementStart(68, "div", 29);
            i0.ɵɵconditionalCreate(69, ActionExecutionMonitoringComponent_Conditional_69_Template, 12, 0)(70, ActionExecutionMonitoringComponent_Conditional_70_Template, 1, 0, "mj-empty-state", 30);
            i0.ɵɵelementEnd()();
            i0.ɵɵelementStart(71, "div", 31)(72, "div", 27)(73, "h4");
            i0.ɵɵelement(74, "i", 32);
            i0.ɵɵtext(75, " Recent Executions");
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(76, "div", 33);
            i0.ɵɵtext(77);
            i0.ɵɵelementEnd()();
            i0.ɵɵelementStart(78, "div", 34);
            i0.ɵɵconditionalCreate(79, ActionExecutionMonitoringComponent_Conditional_79_Template, 2, 0)(80, ActionExecutionMonitoringComponent_Conditional_80_Template, 1, 0, "mj-empty-state", 35);
            i0.ɵɵelementEnd()();
            i0.ɵɵconditionalCreate(81, ActionExecutionMonitoringComponent_Conditional_81_Template, 2, 1, "div", 36);
            i0.ɵɵelementEnd()()();
        } if (rf & 2) {
            i0.ɵɵadvance(5);
            i0.ɵɵproperty("Value", ctx.searchTerm$.value);
            i0.ɵɵadvance();
            i0.ɵɵproperty("ActiveCount", ctx.ActiveFilterCount)("ShowClearAll", ctx.ActiveFilterCount > 0);
            i0.ɵɵadvance();
            i0.ɵɵproperty("Fields", ctx.FilterFields)("Values", ctx.FilterValues);
            i0.ɵɵadvance(9);
            i0.ɵɵtextInterpolate(ctx.metrics.totalExecutions);
            i0.ɵɵadvance(8);
            i0.ɵɵtextInterpolate1("", ctx.getSuccessRate(), "%");
            i0.ɵɵadvance(4);
            i0.ɵɵtextInterpolate2("", ctx.metrics.successfulExecutions, "/", ctx.metrics.totalExecutions);
            i0.ɵɵadvance(6);
            i0.ɵɵtextInterpolate(ctx.metrics.failedExecutions);
            i0.ɵɵadvance(8);
            i0.ɵɵtextInterpolate1("", ctx.metrics.averageDuration, "s");
            i0.ɵɵadvance(8);
            i0.ɵɵtextInterpolate(ctx.metrics.executionsToday);
            i0.ɵɵadvance(4);
            i0.ɵɵtextInterpolate1("", ctx.metrics.executionsThisWeek, " this week");
            i0.ɵɵadvance(6);
            i0.ɵɵtextInterpolate(ctx.metrics.currentlyRunning);
            i0.ɵɵadvance(9);
            i0.ɵɵconditional(ctx.executionTrends.length > 0 ? 69 : 70);
            i0.ɵɵadvance(8);
            i0.ɵɵtextInterpolate1("", ctx.filteredExecutions.length, " executions");
            i0.ɵɵadvance(2);
            i0.ɵɵconditional(ctx.filteredExecutions.length > 0 ? 79 : 80);
            i0.ɵɵadvance(2);
            i0.ɵɵconditional(ctx.isLoading ? 81 : -1);
        } }, dependencies: [i1.MJButtonDirective, i1.MJPageBodyComponent, i1.MJPageHeaderComponent, i1.MJPageLayoutComponent, i1.MJPageSearchComponent, i1.MJFilterPopoverComponent, i1.MJFilterPanelComponent, i1.MJRefreshButtonComponent, i1.MJEmptyStateComponent, i2.LoadingComponent, i3.DatePipe], styles: [".execution-monitoring[_ngcontent-%COMP%] {\n  display: flex;\n  flex-direction: column;\n  gap: 1.5rem;\n  color: var(--mj-text-primary);\n}\n.execution-monitoring[_ngcontent-%COMP%]   .metrics-summary[_ngcontent-%COMP%] {\n  display: grid;\n  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));\n  gap: 1rem;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .metrics-summary[_ngcontent-%COMP%]   .metric-card[_ngcontent-%COMP%] {\n  display: flex;\n  align-items: center;\n  gap: 1rem;\n  padding: 1.25rem;\n  border-radius: 0.75rem;\n  background: var(--mj-bg-surface-card);\n  border: 1px solid var(--mj-border-default);\n  box-shadow: 0 2px 4px color-mix(in srgb, var(--mj-text-primary) 10%, transparent);\n  transition: all 0.2s ease;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .metrics-summary[_ngcontent-%COMP%]   .metric-card.clickable[_ngcontent-%COMP%] {\n  cursor: pointer;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .metrics-summary[_ngcontent-%COMP%]   .metric-card.clickable[_ngcontent-%COMP%]:hover {\n  transform: translateY(-2px);\n  box-shadow: 0 4px 8px color-mix(in srgb, var(--mj-text-primary) 15%, transparent);\n}\n.execution-monitoring[_ngcontent-%COMP%]   .metrics-summary[_ngcontent-%COMP%]   .metric-card[_ngcontent-%COMP%]   .metric-icon[_ngcontent-%COMP%] {\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  width: 2.5rem;\n  height: 2.5rem;\n  border-radius: 0.5rem;\n  font-size: 1rem;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .metrics-summary[_ngcontent-%COMP%]   .metric-card[_ngcontent-%COMP%]   .metric-icon[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n  color: var(--mj-text-inverse);\n}\n.execution-monitoring[_ngcontent-%COMP%]   .metrics-summary[_ngcontent-%COMP%]   .metric-card[_ngcontent-%COMP%]   .metric-content[_ngcontent-%COMP%] {\n  flex: 1;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .metrics-summary[_ngcontent-%COMP%]   .metric-card[_ngcontent-%COMP%]   .metric-content[_ngcontent-%COMP%]   .metric-value[_ngcontent-%COMP%] {\n  font-size: 1.5rem;\n  font-weight: 700;\n  line-height: 1;\n  margin-bottom: 0.25rem;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .metrics-summary[_ngcontent-%COMP%]   .metric-card[_ngcontent-%COMP%]   .metric-content[_ngcontent-%COMP%]   .metric-label[_ngcontent-%COMP%] {\n  font-size: 0.75rem;\n  font-weight: 600;\n  color: var(--mj-text-muted);\n  margin-bottom: 0.125rem;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .metrics-summary[_ngcontent-%COMP%]   .metric-card[_ngcontent-%COMP%]   .metric-content[_ngcontent-%COMP%]   .metric-detail[_ngcontent-%COMP%] {\n  font-size: 0.625rem;\n  color: var(--mj-text-muted);\n}\n.execution-monitoring[_ngcontent-%COMP%]   .metrics-summary[_ngcontent-%COMP%]   .metric-card.total[_ngcontent-%COMP%]   .metric-icon[_ngcontent-%COMP%] {\n  background: var(--mj-brand-primary);\n}\n.execution-monitoring[_ngcontent-%COMP%]   .metrics-summary[_ngcontent-%COMP%]   .metric-card.success[_ngcontent-%COMP%]   .metric-icon[_ngcontent-%COMP%] {\n  background: var(--mj-status-success);\n}\n.execution-monitoring[_ngcontent-%COMP%]   .metrics-summary[_ngcontent-%COMP%]   .metric-card.error[_ngcontent-%COMP%]   .metric-icon[_ngcontent-%COMP%] {\n  background: var(--mj-status-error);\n}\n.execution-monitoring[_ngcontent-%COMP%]   .metrics-summary[_ngcontent-%COMP%]   .metric-card.duration[_ngcontent-%COMP%]   .metric-icon[_ngcontent-%COMP%] {\n  background: var(--mj-brand-primary);\n}\n.execution-monitoring[_ngcontent-%COMP%]   .metrics-summary[_ngcontent-%COMP%]   .metric-card.activity[_ngcontent-%COMP%]   .metric-icon[_ngcontent-%COMP%] {\n  background: var(--mj-status-warning);\n}\n.execution-monitoring[_ngcontent-%COMP%]   .metrics-summary[_ngcontent-%COMP%]   .metric-card.running[_ngcontent-%COMP%]   .metric-icon[_ngcontent-%COMP%] {\n  background: var(--mj-brand-primary);\n}\n.execution-monitoring[_ngcontent-%COMP%]   .trends-section[_ngcontent-%COMP%] {\n  background: var(--mj-bg-surface-card);\n  border: 1px solid var(--mj-border-default);\n  border-radius: 0.75rem;\n  padding: 1.5rem;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .trends-section[_ngcontent-%COMP%]   .section-header[_ngcontent-%COMP%] {\n  margin-bottom: 1.5rem;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .trends-section[_ngcontent-%COMP%]   .section-header[_ngcontent-%COMP%]   h4[_ngcontent-%COMP%] {\n  margin: 0;\n  font-size: 1rem;\n  font-weight: 600;\n  display: flex;\n  align-items: center;\n  gap: 0.5rem;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .trends-section[_ngcontent-%COMP%]   .section-header[_ngcontent-%COMP%]   h4[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n  color: var(--mj-brand-primary);\n}\n.execution-monitoring[_ngcontent-%COMP%]   .trends-section[_ngcontent-%COMP%]   .trends-chart[_ngcontent-%COMP%]   .trend-bars[_ngcontent-%COMP%] {\n  display: flex;\n  align-items: end;\n  gap: 1rem;\n  height: 120px;\n  margin-bottom: 1rem;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .trends-section[_ngcontent-%COMP%]   .trends-chart[_ngcontent-%COMP%]   .trend-bars[_ngcontent-%COMP%]   .trend-bar[_ngcontent-%COMP%] {\n  flex: 1;\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  gap: 0.5rem;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .trends-section[_ngcontent-%COMP%]   .trends-chart[_ngcontent-%COMP%]   .trend-bars[_ngcontent-%COMP%]   .trend-bar[_ngcontent-%COMP%]   .bar-container[_ngcontent-%COMP%] {\n  display: flex;\n  flex-direction: column;\n  width: 100%;\n  min-height: 80px;\n  border-radius: 0.25rem;\n  overflow: hidden;\n  background: var(--mj-border-default);\n  position: relative;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .trends-section[_ngcontent-%COMP%]   .trends-chart[_ngcontent-%COMP%]   .trend-bars[_ngcontent-%COMP%]   .trend-bar[_ngcontent-%COMP%]   .bar-container[_ngcontent-%COMP%]   .bar-success[_ngcontent-%COMP%] {\n  background: var(--mj-status-success);\n  width: 100%;\n  min-height: 2px;\n  transition: height 0.3s ease;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .trends-section[_ngcontent-%COMP%]   .trends-chart[_ngcontent-%COMP%]   .trend-bars[_ngcontent-%COMP%]   .trend-bar[_ngcontent-%COMP%]   .bar-container[_ngcontent-%COMP%]   .bar-failed[_ngcontent-%COMP%] {\n  background: var(--mj-status-error);\n  width: 100%;\n  min-height: 2px;\n  transition: height 0.3s ease;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .trends-section[_ngcontent-%COMP%]   .trends-chart[_ngcontent-%COMP%]   .trend-bars[_ngcontent-%COMP%]   .trend-bar[_ngcontent-%COMP%]   .bar-label[_ngcontent-%COMP%] {\n  font-size: 0.625rem;\n  color: var(--mj-text-muted);\n  font-weight: 600;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .trends-section[_ngcontent-%COMP%]   .trends-chart[_ngcontent-%COMP%]   .trend-bars[_ngcontent-%COMP%]   .trend-bar[_ngcontent-%COMP%]   .bar-total[_ngcontent-%COMP%] {\n  font-size: 0.75rem;\n  font-weight: 600;\n  color: var(--mj-text-primary);\n}\n.execution-monitoring[_ngcontent-%COMP%]   .trends-section[_ngcontent-%COMP%]   .trends-chart[_ngcontent-%COMP%]   .chart-legend[_ngcontent-%COMP%] {\n  display: flex;\n  justify-content: center;\n  gap: 1.5rem;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .trends-section[_ngcontent-%COMP%]   .trends-chart[_ngcontent-%COMP%]   .chart-legend[_ngcontent-%COMP%]   .legend-item[_ngcontent-%COMP%] {\n  display: flex;\n  align-items: center;\n  gap: 0.5rem;\n  font-size: 0.75rem;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .trends-section[_ngcontent-%COMP%]   .trends-chart[_ngcontent-%COMP%]   .chart-legend[_ngcontent-%COMP%]   .legend-item[_ngcontent-%COMP%]   .legend-color[_ngcontent-%COMP%] {\n  width: 12px;\n  height: 12px;\n  border-radius: 2px;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .trends-section[_ngcontent-%COMP%]   .trends-chart[_ngcontent-%COMP%]   .chart-legend[_ngcontent-%COMP%]   .legend-item[_ngcontent-%COMP%]   .legend-color.success[_ngcontent-%COMP%] {\n  background: var(--mj-status-success);\n}\n.execution-monitoring[_ngcontent-%COMP%]   .trends-section[_ngcontent-%COMP%]   .trends-chart[_ngcontent-%COMP%]   .chart-legend[_ngcontent-%COMP%]   .legend-item[_ngcontent-%COMP%]   .legend-color.failed[_ngcontent-%COMP%] {\n  background: var(--mj-status-error);\n}\n.execution-monitoring[_ngcontent-%COMP%]   .trends-section[_ngcontent-%COMP%]   .trends-chart[_ngcontent-%COMP%]   .empty-chart[_ngcontent-%COMP%] {\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  justify-content: center;\n  height: 120px;\n  color: var(--mj-text-muted);\n}\n.execution-monitoring[_ngcontent-%COMP%]   .trends-section[_ngcontent-%COMP%]   .trends-chart[_ngcontent-%COMP%]   .empty-chart[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n  font-size: 2rem;\n  margin-bottom: 0.5rem;\n  opacity: 0.5;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .trends-section[_ngcontent-%COMP%]   .trends-chart[_ngcontent-%COMP%]   .empty-chart[_ngcontent-%COMP%]   p[_ngcontent-%COMP%] {\n  margin: 0;\n  font-size: 0.875rem;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .executions-section[_ngcontent-%COMP%] {\n  flex: 1;\n  min-height: 0;\n  background: var(--mj-bg-surface-card);\n  border: 1px solid var(--mj-border-default);\n  border-radius: 0.75rem;\n  display: flex;\n  flex-direction: column;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .executions-section[_ngcontent-%COMP%]   .section-header[_ngcontent-%COMP%] {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  padding: 1.5rem 1.5rem 0;\n  margin-bottom: 1rem;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .executions-section[_ngcontent-%COMP%]   .section-header[_ngcontent-%COMP%]   h4[_ngcontent-%COMP%] {\n  margin: 0;\n  font-size: 1rem;\n  font-weight: 600;\n  display: flex;\n  align-items: center;\n  gap: 0.5rem;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .executions-section[_ngcontent-%COMP%]   .section-header[_ngcontent-%COMP%]   h4[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n  color: var(--mj-brand-primary);\n}\n.execution-monitoring[_ngcontent-%COMP%]   .executions-section[_ngcontent-%COMP%]   .section-header[_ngcontent-%COMP%]   .results-count[_ngcontent-%COMP%] {\n  font-size: 0.75rem;\n  color: var(--mj-text-muted);\n  font-weight: 600;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .executions-section[_ngcontent-%COMP%]   .executions-list[_ngcontent-%COMP%] {\n  flex: 1;\n  min-height: 0;\n  overflow-y: auto;\n  padding: 0 1.5rem 1.5rem;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .executions-section[_ngcontent-%COMP%]   .executions-list[_ngcontent-%COMP%]   .execution-item[_ngcontent-%COMP%] {\n  display: flex;\n  align-items: center;\n  gap: 1rem;\n  padding: 1rem;\n  border: 1px solid var(--mj-border-default);\n  border-radius: 0.5rem;\n  margin-bottom: 0.75rem;\n  cursor: pointer;\n  transition: all 0.2s ease;\n  background: var(--mj-bg-surface-elevated);\n}\n.execution-monitoring[_ngcontent-%COMP%]   .executions-section[_ngcontent-%COMP%]   .executions-list[_ngcontent-%COMP%]   .execution-item[_ngcontent-%COMP%]:hover {\n  background: var(--mj-bg-surface-hover);\n  border-color: var(--mj-brand-primary);\n  transform: translateY(-1px);\n  box-shadow: 0 2px 4px color-mix(in srgb, var(--mj-text-primary) 10%, transparent);\n}\n.execution-monitoring[_ngcontent-%COMP%]   .executions-section[_ngcontent-%COMP%]   .executions-list[_ngcontent-%COMP%]   .execution-item[_ngcontent-%COMP%]   .execution-status[_ngcontent-%COMP%] {\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  width: 2rem;\n  height: 2rem;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .executions-section[_ngcontent-%COMP%]   .executions-list[_ngcontent-%COMP%]   .execution-item[_ngcontent-%COMP%]   .execution-status[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n  font-size: 1rem;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .executions-section[_ngcontent-%COMP%]   .executions-list[_ngcontent-%COMP%]   .execution-item[_ngcontent-%COMP%]   .execution-status[_ngcontent-%COMP%]   i.fa-check-circle[_ngcontent-%COMP%] {\n  color: var(--mj-status-success);\n}\n.execution-monitoring[_ngcontent-%COMP%]   .executions-section[_ngcontent-%COMP%]   .executions-list[_ngcontent-%COMP%]   .execution-item[_ngcontent-%COMP%]   .execution-status[_ngcontent-%COMP%]   i.fa-exclamation-circle[_ngcontent-%COMP%] {\n  color: var(--mj-status-error);\n}\n.execution-monitoring[_ngcontent-%COMP%]   .executions-section[_ngcontent-%COMP%]   .executions-list[_ngcontent-%COMP%]   .execution-item[_ngcontent-%COMP%]   .execution-status[_ngcontent-%COMP%]   i.fa-spinner[_ngcontent-%COMP%] {\n  color: var(--mj-status-warning);\n}\n.execution-monitoring[_ngcontent-%COMP%]   .executions-section[_ngcontent-%COMP%]   .executions-list[_ngcontent-%COMP%]   .execution-item[_ngcontent-%COMP%]   .execution-status[_ngcontent-%COMP%]   i.fa-info-circle[_ngcontent-%COMP%], .execution-monitoring[_ngcontent-%COMP%]   .executions-section[_ngcontent-%COMP%]   .executions-list[_ngcontent-%COMP%]   .execution-item[_ngcontent-%COMP%]   .execution-status[_ngcontent-%COMP%]   i.fa-question[_ngcontent-%COMP%] {\n  color: var(--mj-brand-primary);\n}\n.execution-monitoring[_ngcontent-%COMP%]   .executions-section[_ngcontent-%COMP%]   .executions-list[_ngcontent-%COMP%]   .execution-item[_ngcontent-%COMP%]   .execution-main[_ngcontent-%COMP%] {\n  flex: 1;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .executions-section[_ngcontent-%COMP%]   .executions-list[_ngcontent-%COMP%]   .execution-item[_ngcontent-%COMP%]   .execution-main[_ngcontent-%COMP%]   .execution-action[_ngcontent-%COMP%] {\n  font-weight: 600;\n  margin-bottom: 0.25rem;\n  color: var(--mj-brand-primary);\n  cursor: pointer;\n  transition: color 0.2s ease;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .executions-section[_ngcontent-%COMP%]   .executions-list[_ngcontent-%COMP%]   .execution-item[_ngcontent-%COMP%]   .execution-main[_ngcontent-%COMP%]   .execution-action[_ngcontent-%COMP%]:hover {\n  color: var(--mj-brand-primary-hover);\n  text-decoration: underline;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .executions-section[_ngcontent-%COMP%]   .executions-list[_ngcontent-%COMP%]   .execution-item[_ngcontent-%COMP%]   .execution-main[_ngcontent-%COMP%]   .execution-details[_ngcontent-%COMP%] {\n  display: flex;\n  gap: 1rem;\n  font-size: 0.75rem;\n  color: var(--mj-text-muted);\n}\n.execution-monitoring[_ngcontent-%COMP%]   .executions-section[_ngcontent-%COMP%]   .executions-list[_ngcontent-%COMP%]   .execution-item[_ngcontent-%COMP%]   .execution-main[_ngcontent-%COMP%]   .execution-details[_ngcontent-%COMP%]   .execution-time[_ngcontent-%COMP%] {\n  font-weight: 600;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .executions-section[_ngcontent-%COMP%]   .executions-list[_ngcontent-%COMP%]   .execution-item[_ngcontent-%COMP%]   .execution-main[_ngcontent-%COMP%]   .execution-details[_ngcontent-%COMP%]   .execution-user[_ngcontent-%COMP%] {\n  color: var(--mj-brand-primary);\n}\n.execution-monitoring[_ngcontent-%COMP%]   .executions-section[_ngcontent-%COMP%]   .executions-list[_ngcontent-%COMP%]   .execution-item[_ngcontent-%COMP%]   .execution-main[_ngcontent-%COMP%]   .execution-details[_ngcontent-%COMP%]   .execution-duration[_ngcontent-%COMP%] {\n  font-weight: 600;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .executions-section[_ngcontent-%COMP%]   .executions-list[_ngcontent-%COMP%]   .execution-item[_ngcontent-%COMP%]   .execution-result[_ngcontent-%COMP%] {\n  flex-shrink: 0;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .executions-section[_ngcontent-%COMP%]   .executions-list[_ngcontent-%COMP%]   .execution-item[_ngcontent-%COMP%]   .execution-actions[_ngcontent-%COMP%] {\n  flex-shrink: 0;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .executions-section[_ngcontent-%COMP%]   .executions-list[_ngcontent-%COMP%]   .execution-item[_ngcontent-%COMP%]   .execution-actions[_ngcontent-%COMP%]   button[_ngcontent-%COMP%] {\n  opacity: 0;\n  transition: opacity 0.2s ease;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .executions-section[_ngcontent-%COMP%]   .executions-list[_ngcontent-%COMP%]   .execution-item[_ngcontent-%COMP%]:hover   .execution-actions[_ngcontent-%COMP%]   button[_ngcontent-%COMP%] {\n  opacity: 1;\n}\n.execution-monitoring[_ngcontent-%COMP%]   .loading-overlay[_ngcontent-%COMP%] {\n  position: absolute;\n  top: 0;\n  left: 0;\n  right: 0;\n  bottom: 0;\n  background: color-mix(in srgb, var(--mj-bg-surface) 80%, transparent);\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  z-index: 1000;\n}\n\n@media (max-width: 1200px) {\n  .execution-monitoring[_ngcontent-%COMP%]   .metrics-summary[_ngcontent-%COMP%] {\n    grid-template-columns: repeat(3, 1fr);\n  }\n  .execution-monitoring[_ngcontent-%COMP%]   .monitoring-header[_ngcontent-%COMP%]   .filters-row[_ngcontent-%COMP%]   .filter-group[_ngcontent-%COMP%] {\n    flex-wrap: wrap;\n  }\n}\n@media (max-width: 768px) {\n  .execution-monitoring[_ngcontent-%COMP%] {\n    padding: 1rem;\n    gap: 1rem;\n  }\n  .execution-monitoring[_ngcontent-%COMP%]   .metrics-summary[_ngcontent-%COMP%] {\n    grid-template-columns: repeat(2, 1fr);\n    gap: 0.75rem;\n  }\n  .execution-monitoring[_ngcontent-%COMP%]   .metrics-summary[_ngcontent-%COMP%]   .metric-card[_ngcontent-%COMP%] {\n    padding: 1rem;\n  }\n  .execution-monitoring[_ngcontent-%COMP%]   .metrics-summary[_ngcontent-%COMP%]   .metric-card[_ngcontent-%COMP%]   .metric-content[_ngcontent-%COMP%]   .metric-value[_ngcontent-%COMP%] {\n    font-size: 1.25rem;\n  }\n  .execution-monitoring[_ngcontent-%COMP%]   .monitoring-header[_ngcontent-%COMP%]   .header-title[_ngcontent-%COMP%] {\n    flex-direction: column;\n    align-items: stretch;\n    gap: 1rem;\n  }\n  .execution-monitoring[_ngcontent-%COMP%]   .monitoring-header[_ngcontent-%COMP%]   .filters-row[_ngcontent-%COMP%] {\n    flex-direction: column;\n    align-items: stretch;\n  }\n  .execution-monitoring[_ngcontent-%COMP%]   .monitoring-header[_ngcontent-%COMP%]   .filters-row[_ngcontent-%COMP%]   .search-container[_ngcontent-%COMP%], \n   .execution-monitoring[_ngcontent-%COMP%]   .monitoring-header[_ngcontent-%COMP%]   .filters-row[_ngcontent-%COMP%]   .filter-group[_ngcontent-%COMP%] {\n    min-width: unset;\n  }\n  .execution-monitoring[_ngcontent-%COMP%]   .monitoring-header[_ngcontent-%COMP%]   .filters-row[_ngcontent-%COMP%]   .filter-group[_ngcontent-%COMP%] {\n    display: grid;\n    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));\n    gap: 0.5rem;\n  }\n  .execution-monitoring[_ngcontent-%COMP%]   .trends-section[_ngcontent-%COMP%]   .trends-chart[_ngcontent-%COMP%]   .trend-bars[_ngcontent-%COMP%] {\n    gap: 0.5rem;\n  }\n}"] });
};
ActionExecutionMonitoringComponent = __decorate([
    RegisterClass(BaseResourceComponent, 'ActionsMonitorResource')
], ActionExecutionMonitoringComponent);
export { ActionExecutionMonitoringComponent };
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ActionExecutionMonitoringComponent, [{
        type: Component,
        args: [{ standalone: false, selector: 'mj-execution-monitoring', template: "<mj-page-layout>\n  <mj-page-header\n    Title=\"Execution Monitor\"\n    Icon=\"fa-solid fa-chart-line\"\n    Subtitle=\"Action execution history, latency, and error rates\">\n    <!-- [meta] intentionally omitted \u2014 chrome slot discipline audit Task B.\n         totalExecutions was a single inventory count duplicated by the\n         body's metrics cards. -->\n    <div actions>\n      <mj-refresh-button (Clicked)=\"refreshData()\"></mj-refresh-button>\n    </div>\n    <div toolbar>\n      <mj-page-search\n        Placeholder=\"Search executions...\"\n        [Value]=\"searchTerm$.value\"\n        (ValueChange)=\"onSearchChange($event)\">\n      </mj-page-search>\n      <mj-filter-popover\n        [ActiveCount]=\"ActiveFilterCount\"\n        [ShowClearAll]=\"ActiveFilterCount > 0\"\n        (ClearAllRequested)=\"resetFilters()\">\n        <mj-filter-panel\n          [Fields]=\"FilterFields\"\n          [Values]=\"FilterValues\"\n          (ValuesChange)=\"onFilterValuesChange($event)\"\n          (Reset)=\"resetFilters()\">\n        </mj-filter-panel>\n      </mj-filter-popover>\n    </div>\n  </mj-page-header>\n\n  <mj-page-body>\n  <div class=\"execution-monitoring\" >\n\n  <!-- Metrics Summary -->\n  <div class=\"metrics-summary\">\n    <div class=\"metric-card total clickable\" (click)=\"onTotalExecutionsClick()\">\n      <div class=\"metric-icon\">\n        <i class=\"fa-solid fa-play-circle\"></i>\n      </div>\n      <div class=\"metric-content\">\n        <div class=\"metric-value\">{{ metrics.totalExecutions }}</div>\n        <div class=\"metric-label\">Total Executions</div>\n      </div>\n    </div>\n\n    <div class=\"metric-card success clickable\" (click)=\"onSuccessRateClick()\">\n      <div class=\"metric-icon\">\n        <i class=\"fa-solid fa-check-circle\"></i>\n      </div>\n      <div class=\"metric-content\">\n        <div class=\"metric-value\">{{ getSuccessRate() }}%</div>\n        <div class=\"metric-label\">Success Rate</div>\n        <div class=\"metric-detail\">{{ metrics.successfulExecutions }}/{{ metrics.totalExecutions }}</div>\n      </div>\n    </div>\n\n    <div class=\"metric-card error clickable\" (click)=\"onFailedExecutionsClick()\">\n      <div class=\"metric-icon\">\n        <i class=\"fa-solid fa-exclamation-circle\"></i>\n      </div>\n      <div class=\"metric-content\">\n        <div class=\"metric-value\">{{ metrics.failedExecutions }}</div>\n        <div class=\"metric-label\">Failed Executions</div>\n      </div>\n    </div>\n\n    <div class=\"metric-card duration\">\n      <div class=\"metric-icon\">\n        <i class=\"fa-solid fa-clock\"></i>\n      </div>\n      <div class=\"metric-content\">\n        <div class=\"metric-value\">{{ metrics.averageDuration }}s</div>\n        <div class=\"metric-label\">Avg Duration</div>\n      </div>\n    </div>\n\n    <div class=\"metric-card activity\">\n      <div class=\"metric-icon\">\n        <i class=\"fa-solid fa-calendar-day\"></i>\n      </div>\n      <div class=\"metric-content\">\n        <div class=\"metric-value\">{{ metrics.executionsToday }}</div>\n        <div class=\"metric-label\">Today</div>\n        <div class=\"metric-detail\">{{ metrics.executionsThisWeek }} this week</div>\n      </div>\n    </div>\n\n    <div class=\"metric-card running clickable\" (click)=\"onRunningExecutionsClick()\">\n      <div class=\"metric-icon\">\n        <i class=\"fa-solid fa-spinner fa-spin\"></i>\n      </div>\n      <div class=\"metric-content\">\n        <div class=\"metric-value\">{{ metrics.currentlyRunning }}</div>\n        <div class=\"metric-label\">Currently Running</div>\n      </div>\n    </div>\n  </div>\n\n  <!-- Execution Trends Chart -->\n  <div class=\"trends-section\">\n    <div class=\"section-header\">\n      <h4><i class=\"fa-solid fa-chart-area\"></i> 7-Day Execution Trends</h4>\n    </div>\n    <div class=\"trends-chart\">\n      @if (executionTrends.length > 0) {\n        <div class=\"trend-bars\">\n          @for (trend of executionTrends; track trend.date) {\n            <div class=\"trend-bar\">\n              <div class=\"bar-container\">\n                <div class=\"bar-success\" [style.height.%]=\"trend.total > 0 ? (trend.successful / trend.total) * 100 : 0\"></div>\n                <div class=\"bar-failed\" [style.height.%]=\"trend.total > 0 ? (trend.failed / trend.total) * 100 : 0\"></div>\n              </div>\n              <div class=\"bar-label\">{{ trend.date | date:'MMM d' }}</div>\n              <div class=\"bar-total\">{{ trend.total }}</div>\n            </div>\n          }\n        </div>\n        <div class=\"chart-legend\">\n          <div class=\"legend-item\">\n            <div class=\"legend-color success\"></div>\n            <span>Successful</span>\n          </div>\n          <div class=\"legend-item\">\n            <div class=\"legend-color failed\"></div>\n            <span>Failed</span>\n          </div>\n        </div>\n      } @else {\n        <mj-empty-state class=\"empty-chart\" Size=\"compact\"\n          Icon=\"fa-solid fa-chart-area\"\n          Title=\"No execution trends available\" />\n      }\n    </div>\n  </div>\n\n  <!-- Execution List -->\n  <div class=\"executions-section\">\n    <div class=\"section-header\">\n      <h4><i class=\"fa-solid fa-list\"></i> Recent Executions</h4>\n      <div class=\"results-count\">{{ filteredExecutions.length }} executions</div>\n    </div>\n    \n    <div class=\"executions-list\">\n      @if (filteredExecutions.length > 0) {\n        @for (execution of filteredExecutions; track execution.ID) {\n          <div class=\"execution-item\" (click)=\"openExecution(execution)\">\n            <div class=\"execution-status\">\n              <i [class]=\"getResultIcon(execution.ResultCode)\"></i>\n            </div>\n            \n            <div class=\"execution-main\">\n              <div class=\"execution-action\" (click)=\"openAction(execution.ActionID!); $event.stopPropagation()\">\n                {{ getActionName(execution.ActionID!) }}\n              </div>\n              <div class=\"execution-details\">\n                <span class=\"execution-time\">{{ execution.StartedAt | date:'MMM d, HH:mm:ss' }}</span>\n                <span class=\"execution-user\">{{ execution.UserID }}</span>\n                <span class=\"execution-duration\">{{ getDuration(execution) }}</span>\n              </div>\n            </div>\n            \n            <div class=\"execution-result\">\n              <span class=\"status-chip\" [attr.data-color]=\"getResultColor(execution.ResultCode)\">\n                {{ execution.ResultCode || 'Unknown' }}\n              </span>\n            </div>\n            \n            <div class=\"execution-actions\">\n              <button mjButton\n                variant=\"flat\"\n                (click)=\"$event.stopPropagation()\">\n                <i class=\"fa-solid fa-ellipsis-vertical\"></i>\n              </button>\n            </div>\n          </div>\n        }\n      } @else {\n        <mj-empty-state Variant=\"no-results\"\n          Title=\"No executions found\"\n          Message=\"Try adjusting your filters or search terms\" />\n      }\n    </div>\n  </div>\n\n  @if (isLoading) {\n    <div class=\"loading-overlay\">\n      <mj-loading [showText]=\"false\" size=\"medium\"></mj-loading>\n    </div>\n  }\n</div>\n  </mj-page-body>\n</mj-page-layout>", styles: [".execution-monitoring {\n  display: flex;\n  flex-direction: column;\n  gap: 1.5rem;\n  color: var(--mj-text-primary);\n}\n.execution-monitoring .metrics-summary {\n  display: grid;\n  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));\n  gap: 1rem;\n}\n.execution-monitoring .metrics-summary .metric-card {\n  display: flex;\n  align-items: center;\n  gap: 1rem;\n  padding: 1.25rem;\n  border-radius: 0.75rem;\n  background: var(--mj-bg-surface-card);\n  border: 1px solid var(--mj-border-default);\n  box-shadow: 0 2px 4px color-mix(in srgb, var(--mj-text-primary) 10%, transparent);\n  transition: all 0.2s ease;\n}\n.execution-monitoring .metrics-summary .metric-card.clickable {\n  cursor: pointer;\n}\n.execution-monitoring .metrics-summary .metric-card.clickable:hover {\n  transform: translateY(-2px);\n  box-shadow: 0 4px 8px color-mix(in srgb, var(--mj-text-primary) 15%, transparent);\n}\n.execution-monitoring .metrics-summary .metric-card .metric-icon {\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  width: 2.5rem;\n  height: 2.5rem;\n  border-radius: 0.5rem;\n  font-size: 1rem;\n}\n.execution-monitoring .metrics-summary .metric-card .metric-icon i {\n  color: var(--mj-text-inverse);\n}\n.execution-monitoring .metrics-summary .metric-card .metric-content {\n  flex: 1;\n}\n.execution-monitoring .metrics-summary .metric-card .metric-content .metric-value {\n  font-size: 1.5rem;\n  font-weight: 700;\n  line-height: 1;\n  margin-bottom: 0.25rem;\n}\n.execution-monitoring .metrics-summary .metric-card .metric-content .metric-label {\n  font-size: 0.75rem;\n  font-weight: 600;\n  color: var(--mj-text-muted);\n  margin-bottom: 0.125rem;\n}\n.execution-monitoring .metrics-summary .metric-card .metric-content .metric-detail {\n  font-size: 0.625rem;\n  color: var(--mj-text-muted);\n}\n.execution-monitoring .metrics-summary .metric-card.total .metric-icon {\n  background: var(--mj-brand-primary);\n}\n.execution-monitoring .metrics-summary .metric-card.success .metric-icon {\n  background: var(--mj-status-success);\n}\n.execution-monitoring .metrics-summary .metric-card.error .metric-icon {\n  background: var(--mj-status-error);\n}\n.execution-monitoring .metrics-summary .metric-card.duration .metric-icon {\n  background: var(--mj-brand-primary);\n}\n.execution-monitoring .metrics-summary .metric-card.activity .metric-icon {\n  background: var(--mj-status-warning);\n}\n.execution-monitoring .metrics-summary .metric-card.running .metric-icon {\n  background: var(--mj-brand-primary);\n}\n.execution-monitoring .trends-section {\n  background: var(--mj-bg-surface-card);\n  border: 1px solid var(--mj-border-default);\n  border-radius: 0.75rem;\n  padding: 1.5rem;\n}\n.execution-monitoring .trends-section .section-header {\n  margin-bottom: 1.5rem;\n}\n.execution-monitoring .trends-section .section-header h4 {\n  margin: 0;\n  font-size: 1rem;\n  font-weight: 600;\n  display: flex;\n  align-items: center;\n  gap: 0.5rem;\n}\n.execution-monitoring .trends-section .section-header h4 i {\n  color: var(--mj-brand-primary);\n}\n.execution-monitoring .trends-section .trends-chart .trend-bars {\n  display: flex;\n  align-items: end;\n  gap: 1rem;\n  height: 120px;\n  margin-bottom: 1rem;\n}\n.execution-monitoring .trends-section .trends-chart .trend-bars .trend-bar {\n  flex: 1;\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  gap: 0.5rem;\n}\n.execution-monitoring .trends-section .trends-chart .trend-bars .trend-bar .bar-container {\n  display: flex;\n  flex-direction: column;\n  width: 100%;\n  min-height: 80px;\n  border-radius: 0.25rem;\n  overflow: hidden;\n  background: var(--mj-border-default);\n  position: relative;\n}\n.execution-monitoring .trends-section .trends-chart .trend-bars .trend-bar .bar-container .bar-success {\n  background: var(--mj-status-success);\n  width: 100%;\n  min-height: 2px;\n  transition: height 0.3s ease;\n}\n.execution-monitoring .trends-section .trends-chart .trend-bars .trend-bar .bar-container .bar-failed {\n  background: var(--mj-status-error);\n  width: 100%;\n  min-height: 2px;\n  transition: height 0.3s ease;\n}\n.execution-monitoring .trends-section .trends-chart .trend-bars .trend-bar .bar-label {\n  font-size: 0.625rem;\n  color: var(--mj-text-muted);\n  font-weight: 600;\n}\n.execution-monitoring .trends-section .trends-chart .trend-bars .trend-bar .bar-total {\n  font-size: 0.75rem;\n  font-weight: 600;\n  color: var(--mj-text-primary);\n}\n.execution-monitoring .trends-section .trends-chart .chart-legend {\n  display: flex;\n  justify-content: center;\n  gap: 1.5rem;\n}\n.execution-monitoring .trends-section .trends-chart .chart-legend .legend-item {\n  display: flex;\n  align-items: center;\n  gap: 0.5rem;\n  font-size: 0.75rem;\n}\n.execution-monitoring .trends-section .trends-chart .chart-legend .legend-item .legend-color {\n  width: 12px;\n  height: 12px;\n  border-radius: 2px;\n}\n.execution-monitoring .trends-section .trends-chart .chart-legend .legend-item .legend-color.success {\n  background: var(--mj-status-success);\n}\n.execution-monitoring .trends-section .trends-chart .chart-legend .legend-item .legend-color.failed {\n  background: var(--mj-status-error);\n}\n.execution-monitoring .trends-section .trends-chart .empty-chart {\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  justify-content: center;\n  height: 120px;\n  color: var(--mj-text-muted);\n}\n.execution-monitoring .trends-section .trends-chart .empty-chart i {\n  font-size: 2rem;\n  margin-bottom: 0.5rem;\n  opacity: 0.5;\n}\n.execution-monitoring .trends-section .trends-chart .empty-chart p {\n  margin: 0;\n  font-size: 0.875rem;\n}\n.execution-monitoring .executions-section {\n  flex: 1;\n  min-height: 0;\n  background: var(--mj-bg-surface-card);\n  border: 1px solid var(--mj-border-default);\n  border-radius: 0.75rem;\n  display: flex;\n  flex-direction: column;\n}\n.execution-monitoring .executions-section .section-header {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  padding: 1.5rem 1.5rem 0;\n  margin-bottom: 1rem;\n}\n.execution-monitoring .executions-section .section-header h4 {\n  margin: 0;\n  font-size: 1rem;\n  font-weight: 600;\n  display: flex;\n  align-items: center;\n  gap: 0.5rem;\n}\n.execution-monitoring .executions-section .section-header h4 i {\n  color: var(--mj-brand-primary);\n}\n.execution-monitoring .executions-section .section-header .results-count {\n  font-size: 0.75rem;\n  color: var(--mj-text-muted);\n  font-weight: 600;\n}\n.execution-monitoring .executions-section .executions-list {\n  flex: 1;\n  min-height: 0;\n  overflow-y: auto;\n  padding: 0 1.5rem 1.5rem;\n}\n.execution-monitoring .executions-section .executions-list .execution-item {\n  display: flex;\n  align-items: center;\n  gap: 1rem;\n  padding: 1rem;\n  border: 1px solid var(--mj-border-default);\n  border-radius: 0.5rem;\n  margin-bottom: 0.75rem;\n  cursor: pointer;\n  transition: all 0.2s ease;\n  background: var(--mj-bg-surface-elevated);\n}\n.execution-monitoring .executions-section .executions-list .execution-item:hover {\n  background: var(--mj-bg-surface-hover);\n  border-color: var(--mj-brand-primary);\n  transform: translateY(-1px);\n  box-shadow: 0 2px 4px color-mix(in srgb, var(--mj-text-primary) 10%, transparent);\n}\n.execution-monitoring .executions-section .executions-list .execution-item .execution-status {\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  width: 2rem;\n  height: 2rem;\n}\n.execution-monitoring .executions-section .executions-list .execution-item .execution-status i {\n  font-size: 1rem;\n}\n.execution-monitoring .executions-section .executions-list .execution-item .execution-status i.fa-check-circle {\n  color: var(--mj-status-success);\n}\n.execution-monitoring .executions-section .executions-list .execution-item .execution-status i.fa-exclamation-circle {\n  color: var(--mj-status-error);\n}\n.execution-monitoring .executions-section .executions-list .execution-item .execution-status i.fa-spinner {\n  color: var(--mj-status-warning);\n}\n.execution-monitoring .executions-section .executions-list .execution-item .execution-status i.fa-info-circle, .execution-monitoring .executions-section .executions-list .execution-item .execution-status i.fa-question {\n  color: var(--mj-brand-primary);\n}\n.execution-monitoring .executions-section .executions-list .execution-item .execution-main {\n  flex: 1;\n}\n.execution-monitoring .executions-section .executions-list .execution-item .execution-main .execution-action {\n  font-weight: 600;\n  margin-bottom: 0.25rem;\n  color: var(--mj-brand-primary);\n  cursor: pointer;\n  transition: color 0.2s ease;\n}\n.execution-monitoring .executions-section .executions-list .execution-item .execution-main .execution-action:hover {\n  color: var(--mj-brand-primary-hover);\n  text-decoration: underline;\n}\n.execution-monitoring .executions-section .executions-list .execution-item .execution-main .execution-details {\n  display: flex;\n  gap: 1rem;\n  font-size: 0.75rem;\n  color: var(--mj-text-muted);\n}\n.execution-monitoring .executions-section .executions-list .execution-item .execution-main .execution-details .execution-time {\n  font-weight: 600;\n}\n.execution-monitoring .executions-section .executions-list .execution-item .execution-main .execution-details .execution-user {\n  color: var(--mj-brand-primary);\n}\n.execution-monitoring .executions-section .executions-list .execution-item .execution-main .execution-details .execution-duration {\n  font-weight: 600;\n}\n.execution-monitoring .executions-section .executions-list .execution-item .execution-result {\n  flex-shrink: 0;\n}\n.execution-monitoring .executions-section .executions-list .execution-item .execution-actions {\n  flex-shrink: 0;\n}\n.execution-monitoring .executions-section .executions-list .execution-item .execution-actions button {\n  opacity: 0;\n  transition: opacity 0.2s ease;\n}\n.execution-monitoring .executions-section .executions-list .execution-item:hover .execution-actions button {\n  opacity: 1;\n}\n.execution-monitoring .loading-overlay {\n  position: absolute;\n  top: 0;\n  left: 0;\n  right: 0;\n  bottom: 0;\n  background: color-mix(in srgb, var(--mj-bg-surface) 80%, transparent);\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  z-index: 1000;\n}\n\n@media (max-width: 1200px) {\n  .execution-monitoring .metrics-summary {\n    grid-template-columns: repeat(3, 1fr);\n  }\n  .execution-monitoring .monitoring-header .filters-row .filter-group {\n    flex-wrap: wrap;\n  }\n}\n@media (max-width: 768px) {\n  .execution-monitoring {\n    padding: 1rem;\n    gap: 1rem;\n  }\n  .execution-monitoring .metrics-summary {\n    grid-template-columns: repeat(2, 1fr);\n    gap: 0.75rem;\n  }\n  .execution-monitoring .metrics-summary .metric-card {\n    padding: 1rem;\n  }\n  .execution-monitoring .metrics-summary .metric-card .metric-content .metric-value {\n    font-size: 1.25rem;\n  }\n  .execution-monitoring .monitoring-header .header-title {\n    flex-direction: column;\n    align-items: stretch;\n    gap: 1rem;\n  }\n  .execution-monitoring .monitoring-header .filters-row {\n    flex-direction: column;\n    align-items: stretch;\n  }\n  .execution-monitoring .monitoring-header .filters-row .search-container,\n  .execution-monitoring .monitoring-header .filters-row .filter-group {\n    min-width: unset;\n  }\n  .execution-monitoring .monitoring-header .filters-row .filter-group {\n    display: grid;\n    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));\n    gap: 0.5rem;\n  }\n  .execution-monitoring .trends-section .trends-chart .trend-bars {\n    gap: 0.5rem;\n  }\n}\n"] }]
    }], () => [{ type: i0.ChangeDetectorRef }], null); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ActionExecutionMonitoringComponent, { className: "ActionExecutionMonitoringComponent", filePath: "src/Actions/components/execution-monitoring.component.ts", lineNumber: 50 }); })();
//# sourceMappingURL=execution-monitoring.component.js.map