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 { ChangeDetectorRef, Component, inject } from '@angular/core';
import { RegisterClass, UUIDsEqual } from '@memberjunction/global';
import { BaseResourceComponent } from '@memberjunction/ng-shared';
import { RunView } from '@memberjunction/core';
import { IntegrationDataService, } from '../../services/integration-data.service';
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.ID;
const _forTrack1 = ($index, $item) => $item.EntityID;
function ActivityComponent_Conditional_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 1);
    i0.ɵɵelement(1, "mj-stat-badge", 13)(2, "mj-stat-badge", 14)(3, "mj-stat-badge", 15);
    i0.ɵɵpipe(4, "number");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance();
    i0.ɵɵproperty("Count", ctx_r0.SuccessfulRuns);
    i0.ɵɵadvance();
    i0.ɵɵproperty("Count", ctx_r0.FailedRuns);
    i0.ɵɵadvance();
    i0.ɵɵproperty("Count", i0.ɵɵpipeBind1(4, 3, ctx_r0.TotalRecordsProcessed));
} }
function ActivityComponent_Conditional_11_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 10);
    i0.ɵɵelement(1, "mj-loading", 16);
    i0.ɵɵelementEnd();
} }
function ActivityComponent_Conditional_12_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 11);
    i0.ɵɵelement(1, "i", 17);
    i0.ɵɵelementStart(2, "p");
    i0.ɵɵtext(3, "No runs found for the selected filters.");
    i0.ɵɵelementEnd()();
} }
function ActivityComponent_Conditional_13_For_3_Conditional_17_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 31);
} }
function ActivityComponent_Conditional_13_For_3_Conditional_22_Conditional_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 37);
    i0.ɵɵelement(1, "mj-loading", 41);
    i0.ɵɵelementEnd();
} }
function ActivityComponent_Conditional_13_For_3_Conditional_22_Conditional_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 38);
    i0.ɵɵelement(1, "i", 42);
    i0.ɵɵtext(2, " No entity details for this run. ");
    i0.ɵɵelementEnd();
} }
function ActivityComponent_Conditional_13_For_3_Conditional_22_Conditional_3_For_19_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "tr")(1, "td");
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "td", 43);
    i0.ɵɵtext(4);
    i0.ɵɵpipe(5, "number");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(6, "td", 45);
    i0.ɵɵtext(7);
    i0.ɵɵpipe(8, "number");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(9, "td", 46);
    i0.ɵɵtext(10);
    i0.ɵɵpipe(11, "number");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(12, "td", 43);
    i0.ɵɵtext(13);
    i0.ɵɵpipe(14, "number");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(15, "td", 47);
    i0.ɵɵtext(16);
    i0.ɵɵpipe(17, "number");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(18, "td", 43);
    i0.ɵɵtext(19);
    i0.ɵɵpipe(20, "number");
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const detail_r5 = ctx.$implicit;
    i0.ɵɵclassProp("error-row", detail_r5.RecordsErrored > 0);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(detail_r5.Entity);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(5, 9, detail_r5.RecordsProcessed));
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(8, 11, detail_r5.RecordsCreated));
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(11, 13, detail_r5.RecordsUpdated));
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(14, 15, detail_r5.RecordsDeleted));
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(17, 17, detail_r5.RecordsErrored));
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(20, 19, detail_r5.RecordsSkipped));
} }
function ActivityComponent_Conditional_13_For_3_Conditional_22_Conditional_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "table", 39)(1, "thead")(2, "tr")(3, "th");
    i0.ɵɵtext(4, "Entity");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "th", 43);
    i0.ɵɵtext(6, "Processed");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(7, "th", 43);
    i0.ɵɵtext(8, "Created");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(9, "th", 43);
    i0.ɵɵtext(10, "Updated");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(11, "th", 43);
    i0.ɵɵtext(12, "Deleted");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(13, "th", 43);
    i0.ɵɵtext(14, "Errored");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(15, "th", 43);
    i0.ɵɵtext(16, "Skipped");
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(17, "tbody");
    i0.ɵɵrepeaterCreate(18, ActivityComponent_Conditional_13_For_3_Conditional_22_Conditional_3_For_19_Template, 21, 21, "tr", 44, _forTrack1);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext(4);
    i0.ɵɵadvance(18);
    i0.ɵɵrepeater(ctx_r0.GetExpandedDetails());
} }
function ActivityComponent_Conditional_13_For_3_Conditional_22_Conditional_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 40)(1, "div", 48);
    i0.ɵɵelement(2, "i", 31);
    i0.ɵɵtext(3, " Error Log ");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "pre", 49);
    i0.ɵɵtext(5);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const run_r3 = i0.ɵɵnextContext(2).$implicit;
    i0.ɵɵadvance(5);
    i0.ɵɵtextInterpolate(run_r3.ErrorLog);
} }
function ActivityComponent_Conditional_13_For_3_Conditional_22_Template(rf, ctx) { if (rf & 1) {
    const _r4 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 36);
    i0.ɵɵlistener("click", function ActivityComponent_Conditional_13_For_3_Conditional_22_Template_div_click_0_listener($event) { i0.ɵɵrestoreView(_r4); return i0.ɵɵresetView($event.stopPropagation()); });
    i0.ɵɵconditionalCreate(1, ActivityComponent_Conditional_13_For_3_Conditional_22_Conditional_1_Template, 2, 0, "div", 37)(2, ActivityComponent_Conditional_13_For_3_Conditional_22_Conditional_2_Template, 3, 0, "div", 38)(3, ActivityComponent_Conditional_13_For_3_Conditional_22_Conditional_3_Template, 20, 0, "table", 39);
    i0.ɵɵconditionalCreate(4, ActivityComponent_Conditional_13_For_3_Conditional_22_Conditional_4_Template, 6, 1, "div", 40);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const run_r3 = i0.ɵɵnextContext().$implicit;
    const ctx_r0 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r0.IsLoadingExpandedDetails() ? 1 : ctx_r0.GetExpandedDetails().length === 0 ? 2 : 3);
    i0.ɵɵadvance(3);
    i0.ɵɵconditional(run_r3.ErrorLog ? 4 : -1);
} }
function ActivityComponent_Conditional_13_For_3_Template(rf, ctx) { if (rf & 1) {
    const _r2 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 21);
    i0.ɵɵlistener("click", function ActivityComponent_Conditional_13_For_3_Template_div_click_0_listener() { const run_r3 = i0.ɵɵrestoreView(_r2).$implicit; const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.SelectRun(run_r3.ID)); });
    i0.ɵɵelementStart(1, "div", 22);
    i0.ɵɵelement(2, "span")(3, "i", 23);
    i0.ɵɵelementStart(4, "div", 24)(5, "span", 25);
    i0.ɵɵtext(6);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(7, "span", 26);
    i0.ɵɵtext(8);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(9, "div", 27);
    i0.ɵɵtext(10);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(11, "div", 28);
    i0.ɵɵtext(12);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(13, "div", 29);
    i0.ɵɵtext(14);
    i0.ɵɵpipe(15, "number");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(16, "div", 30);
    i0.ɵɵconditionalCreate(17, ActivityComponent_Conditional_13_For_3_Conditional_17_Template, 1, 0, "i", 31);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(18, "div", 32);
    i0.ɵɵtext(19);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(20, "button", 33);
    i0.ɵɵlistener("click", function ActivityComponent_Conditional_13_For_3_Template_button_click_20_listener($event) { const run_r3 = i0.ɵɵrestoreView(_r2).$implicit; const ctx_r0 = i0.ɵɵnextContext(2); ctx_r0.ToggleExpand(run_r3.ID); return i0.ɵɵresetView($event.stopPropagation()); });
    i0.ɵɵelement(21, "i", 34);
    i0.ɵɵelementEnd()();
    i0.ɵɵconditionalCreate(22, ActivityComponent_Conditional_13_For_3_Conditional_22_Template, 5, 2, "div", 35);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const run_r3 = ctx.$implicit;
    const ctx_r0 = i0.ɵɵnextContext(2);
    i0.ɵɵclassProp("selected", ctx_r0.IsSelectedRun(run_r3.ID));
    i0.ɵɵadvance(2);
    i0.ɵɵclassMap(ctx_r0.GetStatusDotClass(run_r3.Status));
    i0.ɵɵadvance();
    i0.ɵɵclassMap(ctx_r0.GetStatusIcon(run_r3.Status));
    i0.ɵɵclassProp("icon-green", run_r3.Status === "Success")("icon-red", run_r3.Status === "Failed")("icon-amber", run_r3.Status === "In Progress")("icon-gray", run_r3.Status === "Pending");
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(run_r3.Integration);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(run_r3.Company);
    i0.ɵɵadvance();
    i0.ɵɵproperty("title", ctx_r0.FormatAbsoluteDate(run_r3.StartedAt));
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", ctx_r0.GetRelativeTime(run_r3.StartedAt), " ");
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1(" ", ctx_r0.FormatDuration(run_r3.StartedAt, run_r3.EndedAt), " ");
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(15, 27, run_r3.TotalRecords), " ");
    i0.ɵɵadvance(2);
    i0.ɵɵclassProp("has-errors", run_r3.ErrorLog);
    i0.ɵɵadvance();
    i0.ɵɵconditional(run_r3.ErrorLog ? 17 : -1);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1(" ", run_r3.RunByUser || "Scheduled", " ");
    i0.ɵɵadvance(2);
    i0.ɵɵclassProp("rotated", ctx_r0.IsExpanded(run_r3.ID));
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r0.IsExpanded(run_r3.ID) ? 22 : -1);
} }
function ActivityComponent_Conditional_13_Conditional_4_Conditional_12_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 55)(1, "div", 61);
    i0.ɵɵelement(2, "div", 62);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "div", 63)(4, "span");
    i0.ɵɵtext(5);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(6, "span", 64);
    i0.ɵɵtext(7);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(8, "span");
    i0.ɵɵtext(9);
    i0.ɵɵelementEnd()()();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance(2);
    i0.ɵɵstyleProp("width", ctx_r0.GetDurationBarWidth(ctx_r0.GetSelectedRun()), "%");
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(ctx_r0.FormatDate(ctx_r0.GetSelectedRun().StartedAt));
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(ctx_r0.GetDurationBarLabel(ctx_r0.GetSelectedRun()));
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(ctx_r0.FormatDate(ctx_r0.GetSelectedRun().EndedAt));
} }
function ActivityComponent_Conditional_13_Conditional_4_Conditional_21_Conditional_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 65);
    i0.ɵɵelement(1, "mj-loading", 69);
    i0.ɵɵelementEnd();
} }
function ActivityComponent_Conditional_13_Conditional_4_Conditional_21_Conditional_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 66);
    i0.ɵɵelement(1, "i", 42);
    i0.ɵɵelementStart(2, "p");
    i0.ɵɵtext(3, "No entity detail records for this run.");
    i0.ɵɵelementEnd()();
} }
function ActivityComponent_Conditional_13_Conditional_4_Conditional_21_Conditional_2_For_19_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "tr")(1, "td");
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "td", 43);
    i0.ɵɵtext(4);
    i0.ɵɵpipe(5, "number");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(6, "td", 45);
    i0.ɵɵtext(7);
    i0.ɵɵpipe(8, "number");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(9, "td", 46);
    i0.ɵɵtext(10);
    i0.ɵɵpipe(11, "number");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(12, "td", 43);
    i0.ɵɵtext(13);
    i0.ɵɵpipe(14, "number");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(15, "td", 47);
    i0.ɵɵtext(16);
    i0.ɵɵpipe(17, "number");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(18, "td", 43);
    i0.ɵɵtext(19);
    i0.ɵɵpipe(20, "number");
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const detail_r7 = ctx.$implicit;
    i0.ɵɵclassProp("error-row", detail_r7.RecordsErrored > 0);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(detail_r7.Entity);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(5, 9, detail_r7.RecordsProcessed));
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(8, 11, detail_r7.RecordsCreated));
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(11, 13, detail_r7.RecordsUpdated));
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(14, 15, detail_r7.RecordsDeleted));
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(17, 17, detail_r7.RecordsErrored));
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(20, 19, detail_r7.RecordsSkipped));
} }
function ActivityComponent_Conditional_13_Conditional_4_Conditional_21_Conditional_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "table", 67)(1, "thead")(2, "tr")(3, "th");
    i0.ɵɵtext(4, "Entity");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "th", 43);
    i0.ɵɵtext(6, "Processed");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(7, "th", 43);
    i0.ɵɵtext(8, "Created");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(9, "th", 43);
    i0.ɵɵtext(10, "Updated");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(11, "th", 43);
    i0.ɵɵtext(12, "Deleted");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(13, "th", 43);
    i0.ɵɵtext(14, "Errors");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(15, "th", 43);
    i0.ɵɵtext(16, "Skipped");
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(17, "tbody");
    i0.ɵɵrepeaterCreate(18, ActivityComponent_Conditional_13_Conditional_4_Conditional_21_Conditional_2_For_19_Template, 21, 21, "tr", 44, _forTrack1);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext(4);
    i0.ɵɵadvance(18);
    i0.ɵɵrepeater(ctx_r0.SelectedRunDetails);
} }
function ActivityComponent_Conditional_13_Conditional_4_Conditional_21_Conditional_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 68)(1, "div", 48);
    i0.ɵɵelement(2, "i", 31);
    i0.ɵɵtext(3, " Error Log ");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "pre", 49);
    i0.ɵɵtext(5);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext(4);
    i0.ɵɵadvance(5);
    i0.ɵɵtextInterpolate(ctx_r0.GetSelectedRun().ErrorLog);
} }
function ActivityComponent_Conditional_13_Conditional_4_Conditional_21_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵconditionalCreate(0, ActivityComponent_Conditional_13_Conditional_4_Conditional_21_Conditional_0_Template, 2, 0, "div", 65)(1, ActivityComponent_Conditional_13_Conditional_4_Conditional_21_Conditional_1_Template, 4, 0, "div", 66)(2, ActivityComponent_Conditional_13_Conditional_4_Conditional_21_Conditional_2_Template, 20, 0, "table", 67);
    i0.ɵɵconditionalCreate(3, ActivityComponent_Conditional_13_Conditional_4_Conditional_21_Conditional_3_Template, 6, 1, "div", 68);
} if (rf & 2) {
    let tmp_4_0;
    const ctx_r0 = i0.ɵɵnextContext(3);
    i0.ɵɵconditional(ctx_r0.IsLoadingDetail ? 0 : ctx_r0.SelectedRunDetails.length === 0 ? 1 : 2);
    i0.ɵɵadvance(3);
    i0.ɵɵconditional(((tmp_4_0 = ctx_r0.GetSelectedRun()) == null ? null : tmp_4_0.ErrorLog) ? 3 : -1);
} }
function ActivityComponent_Conditional_13_Conditional_4_Conditional_22_Conditional_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 65);
    i0.ɵɵelement(1, "mj-loading", 70);
    i0.ɵɵelementEnd();
} }
function ActivityComponent_Conditional_13_Conditional_4_Conditional_22_Conditional_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 66);
    i0.ɵɵelement(1, "i", 71);
    i0.ɵɵelementStart(2, "p");
    i0.ɵɵtext(3, "No watermarks recorded for this integration.");
    i0.ɵɵelementEnd()();
} }
function ActivityComponent_Conditional_13_Conditional_4_Conditional_22_Conditional_2_For_13_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "tr")(1, "td");
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "td")(4, "span", 72);
    i0.ɵɵtext(5);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(6, "td", 73);
    i0.ɵɵtext(7);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(8, "td");
    i0.ɵɵtext(9);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const wm_r8 = ctx.$implicit;
    const ctx_r0 = i0.ɵɵnextContext(5);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(wm_r8.EntityMap);
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(wm_r8.WatermarkType);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(ctx_r0.FormatWatermark(wm_r8.WatermarkValue));
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(ctx_r0.FormatDate(wm_r8.LastSyncAt));
} }
function ActivityComponent_Conditional_13_Conditional_4_Conditional_22_Conditional_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "table", 67)(1, "thead")(2, "tr")(3, "th");
    i0.ɵɵtext(4, "Entity Map");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "th");
    i0.ɵɵtext(6, "Type");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(7, "th");
    i0.ɵɵtext(8, "Current Value");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(9, "th");
    i0.ɵɵtext(10, "Last Applied");
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(11, "tbody");
    i0.ɵɵrepeaterCreate(12, ActivityComponent_Conditional_13_Conditional_4_Conditional_22_Conditional_2_For_13_Template, 10, 4, "tr", null, _forTrack0);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext(4);
    i0.ɵɵadvance(12);
    i0.ɵɵrepeater(ctx_r0.WatermarkData);
} }
function ActivityComponent_Conditional_13_Conditional_4_Conditional_22_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵconditionalCreate(0, ActivityComponent_Conditional_13_Conditional_4_Conditional_22_Conditional_0_Template, 2, 0, "div", 65)(1, ActivityComponent_Conditional_13_Conditional_4_Conditional_22_Conditional_1_Template, 4, 0, "div", 66)(2, ActivityComponent_Conditional_13_Conditional_4_Conditional_22_Conditional_2_Template, 14, 0, "table", 67);
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext(3);
    i0.ɵɵconditional(ctx_r0.IsLoadingWatermarks ? 0 : ctx_r0.WatermarkData.length === 0 ? 1 : 2);
} }
function ActivityComponent_Conditional_13_Conditional_4_Template(rf, ctx) { if (rf & 1) {
    const _r6 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 20)(1, "div", 50)(2, "div", 51)(3, "h3");
    i0.ɵɵtext(4);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "span");
    i0.ɵɵelement(6, "i");
    i0.ɵɵtext(7);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(8, "span", 52);
    i0.ɵɵtext(9);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(10, "button", 53);
    i0.ɵɵlistener("click", function ActivityComponent_Conditional_13_Conditional_4_Template_button_click_10_listener() { i0.ɵɵrestoreView(_r6); const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.SelectRun(ctx_r0.SelectedRunID)); });
    i0.ɵɵelement(11, "i", 54);
    i0.ɵɵelementEnd()();
    i0.ɵɵconditionalCreate(12, ActivityComponent_Conditional_13_Conditional_4_Conditional_12_Template, 10, 5, "div", 55);
    i0.ɵɵelementStart(13, "div", 56)(14, "button", 57);
    i0.ɵɵlistener("click", function ActivityComponent_Conditional_13_Conditional_4_Template_button_click_14_listener() { i0.ɵɵrestoreView(_r6); const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.SetDetailTab("entities")); });
    i0.ɵɵelement(15, "i", 58);
    i0.ɵɵtext(16, " Entity Breakdown ");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(17, "button", 57);
    i0.ɵɵlistener("click", function ActivityComponent_Conditional_13_Conditional_4_Template_button_click_17_listener() { i0.ɵɵrestoreView(_r6); const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.SetDetailTab("watermarks")); });
    i0.ɵɵelement(18, "i", 59);
    i0.ɵɵtext(19, " Watermarks ");
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(20, "div", 60);
    i0.ɵɵconditionalCreate(21, ActivityComponent_Conditional_13_Conditional_4_Conditional_21_Template, 4, 2);
    i0.ɵɵconditionalCreate(22, ActivityComponent_Conditional_13_Conditional_4_Conditional_22_Template, 3, 1);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate(ctx_r0.GetSelectedRun().Integration);
    i0.ɵɵadvance();
    i0.ɵɵclassMap(ctx_r0.StatusChipClass(ctx_r0.GetSelectedRun().Status));
    i0.ɵɵadvance();
    i0.ɵɵclassMap(ctx_r0.GetStatusIcon(ctx_r0.GetSelectedRun().Status));
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", ctx_r0.GetSelectedRun().Status, " ");
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(ctx_r0.FormatDate(ctx_r0.GetSelectedRun().StartedAt));
    i0.ɵɵadvance(3);
    i0.ɵɵconditional(ctx_r0.GetSelectedRun().StartedAt && ctx_r0.GetSelectedRun().EndedAt ? 12 : -1);
    i0.ɵɵadvance(2);
    i0.ɵɵclassProp("active", ctx_r0.ActiveDetailTab === "entities");
    i0.ɵɵadvance(3);
    i0.ɵɵclassProp("active", ctx_r0.ActiveDetailTab === "watermarks");
    i0.ɵɵadvance(4);
    i0.ɵɵconditional(ctx_r0.ActiveDetailTab === "entities" ? 21 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r0.ActiveDetailTab === "watermarks" ? 22 : -1);
} }
function ActivityComponent_Conditional_13_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 12)(1, "div", 18);
    i0.ɵɵrepeaterCreate(2, ActivityComponent_Conditional_13_For_3_Template, 23, 29, "div", 19, _forTrack0);
    i0.ɵɵelementEnd();
    i0.ɵɵconditionalCreate(4, ActivityComponent_Conditional_13_Conditional_4_Template, 23, 14, "div", 20);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance(2);
    i0.ɵɵrepeater(ctx_r0.FilteredRuns);
    i0.ɵɵadvance(2);
    i0.ɵɵconditional(ctx_r0.SelectedRunID && ctx_r0.GetSelectedRun() ? 4 : -1);
} }
let ActivityComponent = class ActivityComponent extends BaseResourceComponent {
    // Data
    AllRuns = [];
    FilteredRuns = [];
    Integrations = [];
    SelectedRunID = null;
    SelectedRunDetails = [];
    WatermarkData = [];
    IsLoading = true;
    IsLoadingDetail = false;
    // Filters
    StatusFilter = 'All';
    IntegrationFilter = null;
    DateFilter = '7d';
    SearchQuery = '';
    ExpandedRunID = null;
    // Expanded row details cache
    expandedDetails = [];
    isLoadingExpanded = false;
    // Detail panel tab
    ActiveDetailTab = 'entities';
    IsLoadingWatermarks = false;
    StatusOptions = ['All', 'Success', 'Failed', 'In Progress', 'Pending'];
    DateOptions = [
        { Value: 'all', Label: 'All' },
        { Value: 'today', Label: 'Today' },
        { Value: '7d', Label: '7 Days' },
        { Value: '30d', Label: '30 Days' }
    ];
    dataService = inject(IntegrationDataService);
    cdr = inject(ChangeDetectorRef);
    async ngOnInit() {
        super.ngOnInit();
        this.dataService.Provider = this.ProviderToUse;
        await this.LoadData();
        this.NotifyLoadComplete();
    }
    // ── Data Loading ──────────────────────────────────────────
    async LoadData() {
        this.IsLoading = true;
        this.cdr.detectChanges();
        try {
            const provider = this.RunViewToUse;
            const [summaries, runs] = await Promise.all([
                this.dataService.LoadIntegrationSummaries(provider),
                this.loadAllRuns(provider)
            ]);
            this.Integrations = this.buildIntegrationOptions(summaries);
            this.AllRuns = runs;
            this.ApplyFilters();
        }
        catch (err) {
            console.error('[IntegrationActivity] Failed to load data:', err);
        }
        finally {
            this.IsLoading = false;
            this.cdr.detectChanges();
        }
    }
    async loadAllRuns(provider) {
        const rv = new RunView(provider ?? null);
        const result = await rv.RunView({
            EntityName: 'MJ: Company Integration Runs',
            ExtraFilter: '',
            OrderBy: 'StartedAt DESC',
            MaxRows: 200,
            Fields: ['ID', 'CompanyIntegrationID', 'StartedAt', 'EndedAt', 'TotalRecords',
                'Status', 'ErrorLog', 'Integration', 'Company', 'RunByUser'],
            ResultType: 'simple'
        });
        return result.Results;
    }
    buildIntegrationOptions(summaries) {
        return summaries.map(s => ({
            ID: s.Integration.ID,
            Name: `${s.Integration.Integration} (${s.Integration.Company})`
        }));
    }
    async LoadRunDetails(runID) {
        try {
            return await this.dataService.LoadRunDetails(runID, this.RunViewToUse);
        }
        catch (err) {
            console.error('[IntegrationActivity] Failed to load run details:', err);
            return [];
        }
    }
    async LoadWatermarks(companyIntegrationID) {
        this.IsLoadingWatermarks = true;
        this.cdr.detectChanges();
        try {
            this.WatermarkData = await this.loadWatermarkData(companyIntegrationID);
        }
        catch (err) {
            console.error('[IntegrationActivity] Failed to load watermarks:', err);
        }
        finally {
            this.IsLoadingWatermarks = false;
            this.cdr.detectChanges();
        }
    }
    async loadWatermarkData(companyIntegrationID) {
        const entityMaps = await this.dataService.LoadEntityMaps(companyIntegrationID, this.RunViewToUse);
        if (entityMaps.length === 0)
            return [];
        const entityMapIDs = entityMaps.map(m => `'${m.ID}'`).join(',');
        const rv = new RunView(this.RunViewToUse ?? null);
        const result = await rv.RunView({
            EntityName: 'MJ: Company Integration Sync Watermarks',
            ExtraFilter: `EntityMapID IN (${entityMapIDs})`,
            OrderBy: 'LastSyncAt DESC',
            Fields: ['ID', 'EntityMapID', 'WatermarkType', 'WatermarkValue', 'LastSyncAt'],
            ResultType: 'simple'
        });
        return this.mergeWatermarksWithEntityMaps(result.Results, entityMaps);
    }
    mergeWatermarksWithEntityMaps(watermarks, entityMaps) {
        const mapLookup = new Map(entityMaps.map(m => [m.ID.toLowerCase(), m]));
        return watermarks.map(w => ({
            ...w,
            EntityMap: mapLookup.get(w.EntityMapID?.toLowerCase())?.ExternalObjectName ?? w.EntityMapID
        }));
    }
    // ── Filtering ─────────────────────────────────────────────
    ApplyFilters() {
        let filtered = this.AllRuns;
        filtered = this.filterByStatus(filtered);
        filtered = this.filterByIntegration(filtered);
        filtered = this.filterByDate(filtered);
        filtered = this.filterBySearch(filtered);
        this.FilteredRuns = filtered;
    }
    filterByStatus(runs) {
        if (this.StatusFilter === 'All')
            return runs;
        return runs.filter(r => r.Status === this.StatusFilter);
    }
    filterByIntegration(runs) {
        if (!this.IntegrationFilter)
            return runs;
        return runs.filter(r => UUIDsEqual(r.CompanyIntegrationID, this.IntegrationFilter));
    }
    filterByDate(runs) {
        const cutoff = this.getDateCutoff(this.DateFilter);
        if (!cutoff)
            return runs;
        return runs.filter(r => r.StartedAt && new Date(r.StartedAt) >= cutoff);
    }
    filterBySearch(runs) {
        if (!this.SearchQuery.trim())
            return runs;
        const query = this.SearchQuery.toLowerCase().trim();
        return runs.filter(r => r.Integration?.toLowerCase().includes(query) ||
            r.Company?.toLowerCase().includes(query));
    }
    getDateCutoff(range) {
        if (range === 'all')
            return null;
        const now = new Date();
        if (range === 'today') {
            const today = new Date(now);
            today.setHours(0, 0, 0, 0);
            return today;
        }
        const days = range === '7d' ? 7 : 30;
        const cutoff = new Date(now);
        cutoff.setDate(cutoff.getDate() - days);
        return cutoff;
    }
    SetStatusFilter(status) {
        this.StatusFilter = status;
        this.ApplyFilters();
    }
    SetDateFilter(range) {
        this.DateFilter = range;
        this.ApplyFilters();
    }
    SetIntegrationFilter(id) {
        this.IntegrationFilter = id;
        this.ApplyFilters();
    }
    OnSearchChange() {
        this.ApplyFilters();
    }
    /** Bridge for <mj-page-search> which emits a plain string. */
    OnSearchValueChange(value) {
        this.SearchQuery = value;
        this.ApplyFilters();
    }
    // ---- Integration filter popover wiring ---------------------------------
    get ActivityFilterFields() {
        return [
            {
                key: 'dateRange',
                type: 'chips',
                label: 'Date range',
                chipOptions: this.DateOptions.map(d => ({ text: d.Label, value: d.Value })),
            },
            {
                key: 'status',
                type: 'chips',
                label: 'Status',
                chipOptions: this.StatusOptions.map(s => ({ text: s, value: s })),
            },
            {
                key: 'integration',
                type: 'dropdown',
                label: 'Integration',
                icon: 'fa-solid fa-plug',
                placeholder: 'All Integrations',
                filterable: this.Integrations.length > 10,
                options: [
                    { text: 'All Integrations', value: '' },
                    ...this.Integrations.map(i => ({ text: i.Name, value: i.ID })),
                ],
            },
        ];
    }
    get ActivityFilterValues() {
        return {
            dateRange: this.DateFilter,
            status: this.StatusFilter,
            integration: this.IntegrationFilter ?? ''
        };
    }
    get ActiveFilterCount() {
        let count = 0;
        if (this.DateFilter !== '7d')
            count++;
        if (this.StatusFilter !== 'All')
            count++;
        if (this.IntegrationFilter)
            count++;
        return count;
    }
    OnFilterValuesChange(values) {
        const next = (values ?? {});
        if (next.dateRange && next.dateRange !== this.DateFilter) {
            this.SetDateFilter(next.dateRange);
        }
        if (next.status && next.status !== this.StatusFilter) {
            this.SetStatusFilter(next.status);
        }
        const integ = next.integration ?? '';
        if ((integ || null) !== this.IntegrationFilter) {
            this.SetIntegrationFilter(integ || null);
        }
    }
    ResetIntegrationFilter() {
        if (this.DateFilter !== '7d')
            this.SetDateFilter('7d');
        if (this.StatusFilter !== 'All')
            this.SetStatusFilter('All');
        if (this.IntegrationFilter)
            this.SetIntegrationFilter(null);
    }
    async Refresh() {
        await this.LoadData();
    }
    // ── Run Selection & Expansion ─────────────────────────────
    async SelectRun(runID) {
        if (UUIDsEqual(this.SelectedRunID, runID)) {
            this.SelectedRunID = null;
            this.SelectedRunDetails = [];
            this.WatermarkData = [];
            return;
        }
        this.SelectedRunID = runID;
        this.ActiveDetailTab = 'entities';
        this.IsLoadingDetail = true;
        this.cdr.detectChanges();
        const run = this.findRunByID(runID);
        try {
            this.SelectedRunDetails = await this.LoadRunDetails(runID);
            if (run) {
                await this.LoadWatermarks(run.CompanyIntegrationID);
            }
        }
        finally {
            this.IsLoadingDetail = false;
            this.cdr.detectChanges();
        }
    }
    async ToggleExpand(runID) {
        if (UUIDsEqual(this.ExpandedRunID, runID)) {
            this.ExpandedRunID = null;
            this.expandedDetails = [];
            return;
        }
        this.ExpandedRunID = runID;
        this.isLoadingExpanded = true;
        this.cdr.detectChanges();
        try {
            this.expandedDetails = await this.LoadRunDetails(runID);
        }
        finally {
            this.isLoadingExpanded = false;
            this.cdr.detectChanges();
        }
    }
    IsExpanded(runID) {
        return UUIDsEqual(this.ExpandedRunID, runID);
    }
    IsSelectedRun(runID) {
        return UUIDsEqual(this.SelectedRunID, runID);
    }
    GetExpandedDetails() {
        return this.expandedDetails;
    }
    IsLoadingExpandedDetails() {
        return this.isLoadingExpanded;
    }
    GetSelectedRun() {
        return this.findRunByID(this.SelectedRunID);
    }
    SetDetailTab(tab) {
        this.ActiveDetailTab = tab;
    }
    findRunByID(runID) {
        if (!runID)
            return null;
        return this.AllRuns.find(r => UUIDsEqual(r.ID, runID)) ?? null;
    }
    // ── Formatting Helpers ────────────────────────────────────
    FormatDuration(startedAt, endedAt) {
        if (!startedAt || !endedAt)
            return '--';
        const ms = new Date(endedAt).getTime() - new Date(startedAt).getTime();
        return this.dataService.FormatDuration(ms);
    }
    GetRelativeTime(dateStr) {
        return this.dataService.ComputeRelativeTime(dateStr);
    }
    FormatAbsoluteDate(dateStr) {
        if (!dateStr)
            return '';
        return new Date(dateStr).toLocaleString(undefined, {
            year: 'numeric', month: 'short', day: 'numeric',
            hour: '2-digit', minute: '2-digit', second: '2-digit'
        });
    }
    FormatWatermark(value) {
        if (!value)
            return 'Not set';
        if (value.length > 40)
            return value.substring(0, 37) + '...';
        return value;
    }
    FormatDate(dateStr) {
        if (!dateStr)
            return '--';
        return new Date(dateStr).toLocaleString(undefined, {
            month: 'short', day: 'numeric',
            hour: '2-digit', minute: '2-digit'
        });
    }
    GetStatusIcon(status) {
        if (status === 'Success')
            return 'fa-solid fa-circle-check';
        if (status === 'Failed')
            return 'fa-solid fa-circle-xmark';
        if (status === 'In Progress')
            return 'fa-solid fa-spinner fa-spin';
        return 'fa-solid fa-clock';
    }
    GetStatusColor(status) {
        if (status === 'Success')
            return 'green';
        if (status === 'Failed')
            return 'red';
        if (status === 'In Progress')
            return 'amber';
        return 'gray';
    }
    GetStatusDotClass(status) {
        return `status-dot dot-${this.GetStatusColor(status)}`;
    }
    StatusChipClass(status) {
        return `chip chip-${this.GetStatusColor(status)}`;
    }
    GetErrorCount(run) {
        return run.ErrorLog ? 1 : 0;
    }
    // ── Summary Computed Properties ───────────────────────────
    get TotalRuns() {
        return this.FilteredRuns.length;
    }
    get SuccessfulRuns() {
        return this.FilteredRuns.filter(r => r.Status === 'Success').length;
    }
    get FailedRuns() {
        return this.FilteredRuns.filter(r => r.Status === 'Failed').length;
    }
    get TotalRecordsProcessed() {
        return this.FilteredRuns.reduce((acc, r) => acc + r.TotalRecords, 0);
    }
    // ── Duration Bar (detail panel) ───────────────────────────
    GetDurationBarWidth(run) {
        if (!run.StartedAt || !run.EndedAt)
            return 0;
        return 100;
    }
    GetDurationBarLabel(run) {
        return this.FormatDuration(run.StartedAt, run.EndedAt);
    }
    // ── Resource overrides ────────────────────────────────────
    async GetResourceDisplayName(_data) {
        return 'Activity';
    }
    async GetResourceIconClass(_data) {
        return 'fa-solid fa-clock-rotate-left';
    }
    static ɵfac = /*@__PURE__*/ (() => { let ɵActivityComponent_BaseFactory; return function ActivityComponent_Factory(__ngFactoryType__) { return (ɵActivityComponent_BaseFactory || (ɵActivityComponent_BaseFactory = i0.ɵɵgetInheritedFactory(ActivityComponent)))(__ngFactoryType__ || ActivityComponent); }; })();
    static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ActivityComponent, selectors: [["app-integration-activity"]], standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 14, vars: 11, consts: [["Title", "Integration Activity", "Icon", "fa-solid fa-clock-rotate-left", "Subtitle", "Sync run history and outcomes"], ["meta", ""], ["actions", ""], [3, "Clicked", "Loading"], ["toolbar", ""], ["Placeholder", "Search integrations...", 3, "ValueChange", "Value"], [3, "ClearAllRequested", "ActiveCount", "ShowClearAll"], [3, "ValuesChange", "Reset", "Fields", "Values"], [3, "Flex"], [1, "activity-container"], [1, "loading-area"], [1, "empty-state"], [1, "split-view"], ["Label", "succeeded", "Variant", "success", 3, "Count"], ["Label", "failed", "Variant", "error", 3, "Count"], ["Label", "records", 3, "Count"], ["text", "Loading activity...", "size", "medium"], [1, "fa-solid", "fa-inbox"], [1, "run-list-panel"], [1, "run-row", 3, "selected"], [1, "detail-panel"], [1, "run-row", 3, "click"], [1, "run-row-main"], [1, "status-icon"], [1, "run-info"], [1, "run-integration"], [1, "run-company"], [1, "run-meta", 3, "title"], [1, "run-meta", "run-duration"], [1, "run-meta", "run-records"], [1, "run-meta", "run-errors"], [1, "fa-solid", "fa-triangle-exclamation"], [1, "run-meta", "run-user"], ["title", "Show entity breakdown", 1, "expand-btn", 3, "click"], [1, "fa-solid", "fa-chevron-down"], [1, "expanded-section"], [1, "expanded-section", 3, "click"], [1, "expanded-loading"], [1, "expanded-empty"], [1, "entity-table"], [1, "error-log-block"], ["text", "Loading breakdown...", "size", "small"], [1, "fa-solid", "fa-circle-info"], [1, "num-col"], [3, "error-row"], [1, "num-col", "created-col"], [1, "num-col", "updated-col"], [1, "num-col", "error-col"], [1, "error-log-label"], [1, "error-log-content"], [1, "detail-header"], [1, "detail-header-info"], [1, "detail-time"], ["title", "Close", 1, "close-detail-btn", 3, "click"], [1, "fa-solid", "fa-xmark"], [1, "duration-bar-container"], [1, "detail-tabs"], [1, "tab-btn", 3, "click"], [1, "fa-solid", "fa-table"], [1, "fa-solid", "fa-droplet"], [1, "detail-content"], [1, "duration-bar-track"], [1, "duration-bar-fill"], [1, "duration-bar-labels"], [1, "duration-bar-value"], [1, "detail-loading"], [1, "detail-empty"], [1, "detail-table"], [1, "error-log-block", "detail-error-log"], ["text", "Loading details...", "size", "small"], ["text", "Loading watermarks...", "size", "small"], [1, "fa-solid", "fa-droplet-slash"], [1, "type-badge"], [1, "mono-cell", "watermark-value"]], template: function ActivityComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelementStart(0, "mj-page-layout")(1, "mj-page-header", 0);
            i0.ɵɵconditionalCreate(2, ActivityComponent_Conditional_2_Template, 5, 5, "div", 1);
            i0.ɵɵelementStart(3, "div", 2)(4, "mj-refresh-button", 3);
            i0.ɵɵlistener("Clicked", function ActivityComponent_Template_mj_refresh_button_Clicked_4_listener() { return ctx.Refresh(); });
            i0.ɵɵelementEnd()();
            i0.ɵɵelementStart(5, "div", 4)(6, "mj-page-search", 5);
            i0.ɵɵlistener("ValueChange", function ActivityComponent_Template_mj_page_search_ValueChange_6_listener($event) { return ctx.OnSearchValueChange($event); });
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(7, "mj-filter-popover", 6);
            i0.ɵɵlistener("ClearAllRequested", function ActivityComponent_Template_mj_filter_popover_ClearAllRequested_7_listener() { return ctx.ResetIntegrationFilter(); });
            i0.ɵɵelementStart(8, "mj-filter-panel", 7);
            i0.ɵɵlistener("ValuesChange", function ActivityComponent_Template_mj_filter_panel_ValuesChange_8_listener($event) { return ctx.OnFilterValuesChange($event); })("Reset", function ActivityComponent_Template_mj_filter_panel_Reset_8_listener() { return ctx.ResetIntegrationFilter(); });
            i0.ɵɵelementEnd()()()();
            i0.ɵɵelementStart(9, "mj-page-body", 8)(10, "div", 9);
            i0.ɵɵconditionalCreate(11, ActivityComponent_Conditional_11_Template, 2, 0, "div", 10);
            i0.ɵɵconditionalCreate(12, ActivityComponent_Conditional_12_Template, 4, 0, "div", 11);
            i0.ɵɵconditionalCreate(13, ActivityComponent_Conditional_13_Template, 5, 1, "div", 12);
            i0.ɵɵelementEnd()()();
        } if (rf & 2) {
            i0.ɵɵadvance(2);
            i0.ɵɵconditional(!ctx.IsLoading && ctx.AllRuns.length > 0 ? 2 : -1);
            i0.ɵɵadvance(2);
            i0.ɵɵproperty("Loading", ctx.IsLoading);
            i0.ɵɵadvance(2);
            i0.ɵɵproperty("Value", ctx.SearchQuery);
            i0.ɵɵadvance();
            i0.ɵɵproperty("ActiveCount", ctx.ActiveFilterCount)("ShowClearAll", ctx.ActiveFilterCount > 0);
            i0.ɵɵadvance();
            i0.ɵɵproperty("Fields", ctx.ActivityFilterFields)("Values", ctx.ActivityFilterValues);
            i0.ɵɵadvance();
            i0.ɵɵproperty("Flex", true);
            i0.ɵɵadvance(2);
            i0.ɵɵconditional(ctx.IsLoading ? 11 : -1);
            i0.ɵɵadvance();
            i0.ɵɵconditional(!ctx.IsLoading && ctx.FilteredRuns.length === 0 ? 12 : -1);
            i0.ɵɵadvance();
            i0.ɵɵconditional(!ctx.IsLoading && ctx.FilteredRuns.length > 0 ? 13 : -1);
        } }, dependencies: [i1.MJPageLayoutComponent, i1.MJPageHeaderComponent, i1.MJPageBodyComponent, i1.MJPageSearchComponent, i1.MJFilterPopoverComponent, i1.MJFilterPanelComponent, i1.MJStatBadgeComponent, i1.MJRefreshButtonComponent, i2.LoadingComponent, i3.DecimalPipe], styles: ["[_nghost-%COMP%] {\n  display: block;\n  height: 100%;\n}\n\n.activity-container[_ngcontent-%COMP%] {\n  \n\n\n  display: flex;\n  flex-direction: column;\n  flex: 1;\n  min-height: 0;\n  gap: 14px;\n}\n\n\n\n\n\n\n\n\n.toolbar-divider[_ngcontent-%COMP%] {\n  display: inline-block;\n  width: 1px;\n  height: 18px;\n  background: var(--mj-border-default);\n  margin: 0 4px;\n}\n\n\n\n\n.loading-area[_ngcontent-%COMP%] {\n  display: flex;\n  justify-content: center;\n  padding: 48px;\n}\n\n.empty-state[_ngcontent-%COMP%] {\n  text-align: center;\n  padding: 48px;\n  color: var(--mj-text-disabled);\n}\n\n.empty-state[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n  font-size: 32px;\n  margin-bottom: 12px;\n  display: block;\n}\n\n.empty-state[_ngcontent-%COMP%]   p[_ngcontent-%COMP%] {\n  margin: 0;\n  font-size: 14px;\n}\n\n\n\n\n.split-view[_ngcontent-%COMP%] {\n  display: flex;\n  gap: 16px;\n  flex: 1;\n  min-height: 0;\n  overflow: hidden;\n}\n\n\n\n\n.run-list-panel[_ngcontent-%COMP%] {\n  flex: 7;\n  overflow-y: auto;\n  display: flex;\n  flex-direction: column;\n}\n\n.run-row[_ngcontent-%COMP%] {\n  border-bottom: 1px solid var(--mj-border-subtle);\n  cursor: pointer;\n  transition: background 0.1s;\n}\n\n.run-row[_ngcontent-%COMP%]:hover {\n  background: var(--mj-bg-page);\n}\n\n.run-row.selected[_ngcontent-%COMP%] {\n  background: var(--mj-status-info-bg);\n}\n\n.run-row-main[_ngcontent-%COMP%] {\n  display: flex;\n  align-items: center;\n  gap: 10px;\n  padding: 10px 14px;\n}\n\n\n\n.status-dot[_ngcontent-%COMP%] {\n  width: 8px;\n  height: 8px;\n  border-radius: 50%;\n  flex-shrink: 0;\n}\n\n.status-icon[_ngcontent-%COMP%] {\n  font-size: 14px;\n  width: 16px;\n  text-align: center;\n  flex-shrink: 0;\n}\n\n.icon-green[_ngcontent-%COMP%] { color: var(--mj-color-success-600); }\n.icon-red[_ngcontent-%COMP%] { color: var(--mj-status-error); }\n.icon-amber[_ngcontent-%COMP%] { color: var(--mj-status-warning); }\n.icon-gray[_ngcontent-%COMP%] { color: var(--mj-text-disabled); }\n\n\n\n.run-info[_ngcontent-%COMP%] {\n  flex: 2;\n  min-width: 0;\n  display: flex;\n  flex-direction: column;\n  gap: 1px;\n}\n\n.run-integration[_ngcontent-%COMP%] {\n  font-weight: 600;\n  font-size: 13px;\n  color: var(--mj-text-primary);\n  white-space: nowrap;\n  overflow: hidden;\n  text-overflow: ellipsis;\n}\n\n.run-company[_ngcontent-%COMP%] {\n  font-size: 11px;\n  color: var(--mj-text-disabled);\n}\n\n\n\n.run-meta[_ngcontent-%COMP%] {\n  flex-shrink: 0;\n  font-size: 12px;\n  color: var(--mj-text-muted);\n  white-space: nowrap;\n  min-width: 60px;\n  text-align: right;\n}\n\n.run-duration[_ngcontent-%COMP%] {\n  font-variant-numeric: tabular-nums;\n  min-width: 56px;\n}\n\n.run-records[_ngcontent-%COMP%] {\n  font-variant-numeric: tabular-nums;\n  min-width: 48px;\n}\n\n.run-errors[_ngcontent-%COMP%] {\n  min-width: 24px;\n  text-align: center;\n}\n\n.run-errors.has-errors[_ngcontent-%COMP%] {\n  color: var(--mj-status-error);\n}\n\n.run-user[_ngcontent-%COMP%] {\n  min-width: 80px;\n  overflow: hidden;\n  text-overflow: ellipsis;\n}\n\n.expand-btn[_ngcontent-%COMP%] {\n  background: none;\n  border: none;\n  cursor: pointer;\n  width: 28px;\n  height: 28px;\n  border-radius: 4px;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  color: var(--mj-text-disabled);\n  font-size: 11px;\n  transition: background 0.15s, transform 0.2s;\n  flex-shrink: 0;\n}\n\n.expand-btn[_ngcontent-%COMP%]:hover {\n  background: var(--mj-bg-surface-hover);\n  color: var(--mj-text-secondary);\n}\n\n.expand-btn[_ngcontent-%COMP%]   i.rotated[_ngcontent-%COMP%] {\n  transform: rotate(180deg);\n}\n\n\n\n\n.expanded-section[_ngcontent-%COMP%] {\n  padding: 8px 14px 14px 48px;\n  background: var(--mj-bg-page);\n  border-top: 1px solid var(--mj-border-subtle);\n}\n\n.expanded-loading[_ngcontent-%COMP%], \n.expanded-empty[_ngcontent-%COMP%] {\n  padding: 16px;\n  text-align: center;\n  color: var(--mj-text-disabled);\n  font-size: 12px;\n}\n\n.expanded-empty[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n  margin-right: 6px;\n}\n\n.entity-table[_ngcontent-%COMP%] {\n  width: 100%;\n  border-collapse: collapse;\n  font-size: 12px;\n}\n\n.entity-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%] {\n  text-align: left;\n  padding: 6px 8px;\n  color: var(--mj-text-disabled);\n  font-weight: 600;\n  font-size: 11px;\n  border-bottom: 1px solid var(--mj-border-default);\n  text-transform: uppercase;\n  letter-spacing: 0.5px;\n}\n\n.entity-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%] {\n  padding: 5px 8px;\n  border-bottom: 1px solid var(--mj-border-subtle);\n}\n\n.entity-table[_ngcontent-%COMP%]   .num-col[_ngcontent-%COMP%], \n.detail-table[_ngcontent-%COMP%]   .num-col[_ngcontent-%COMP%] {\n  text-align: right;\n  font-variant-numeric: tabular-nums;\n}\n\n.entity-table[_ngcontent-%COMP%]   .created-col[_ngcontent-%COMP%], \n.detail-table[_ngcontent-%COMP%]   .created-col[_ngcontent-%COMP%] {\n  color: var(--mj-color-success-600);\n  font-weight: 600;\n}\n\n.entity-table[_ngcontent-%COMP%]   .updated-col[_ngcontent-%COMP%], \n.detail-table[_ngcontent-%COMP%]   .updated-col[_ngcontent-%COMP%] {\n  color: var(--mj-brand-primary);\n  font-weight: 600;\n}\n\n.entity-table[_ngcontent-%COMP%]   .error-col[_ngcontent-%COMP%], \n.detail-table[_ngcontent-%COMP%]   .error-col[_ngcontent-%COMP%] {\n  color: var(--mj-color-error-600);\n  font-weight: 600;\n}\n\n.error-row[_ngcontent-%COMP%] {\n  background: var(--mj-status-error-bg);\n}\n\n\n\n\n.error-log-block[_ngcontent-%COMP%] {\n  margin-top: 10px;\n}\n\n.error-log-label[_ngcontent-%COMP%] {\n  font-size: 12px;\n  font-weight: 600;\n  color: var(--mj-color-error-600);\n  margin-bottom: 6px;\n  display: flex;\n  align-items: center;\n  gap: 6px;\n}\n\n.error-log-content[_ngcontent-%COMP%] {\n  margin: 0;\n  padding: 10px 12px;\n  background: var(--mj-text-primary);\n  color: var(--mj-bg-surface-sunken);\n  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;\n  font-size: 11px;\n  border-radius: 8px;\n  white-space: pre-wrap;\n  word-break: break-word;\n  max-height: 200px;\n  overflow-y: auto;\n  line-height: 1.5;\n}\n\n.detail-error-log[_ngcontent-%COMP%] {\n  padding: 12px 16px;\n  border-top: 1px solid var(--mj-border-subtle);\n}\n\n\n\n\n.detail-panel[_ngcontent-%COMP%] {\n  flex: 3;\n  min-width: 340px;\n  background: var(--mj-bg-surface);\n  border: 1px solid var(--mj-border-default);\n  border-radius: 8px;\n  display: flex;\n  flex-direction: column;\n  overflow: hidden;\n}\n\n.detail-header[_ngcontent-%COMP%] {\n  display: flex;\n  align-items: flex-start;\n  justify-content: space-between;\n  padding: 14px 16px;\n  border-bottom: 1px solid var(--mj-border-subtle);\n  gap: 12px;\n}\n\n.detail-header-info[_ngcontent-%COMP%] {\n  display: flex;\n  flex-direction: column;\n  gap: 6px;\n  min-width: 0;\n}\n\n.detail-header-info[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%] {\n  margin: 0;\n  font-size: 15px;\n  font-weight: 700;\n  color: var(--mj-text-primary);\n  white-space: nowrap;\n  overflow: hidden;\n  text-overflow: ellipsis;\n}\n\n.detail-time[_ngcontent-%COMP%] {\n  font-size: 12px;\n  color: var(--mj-text-disabled);\n}\n\n.close-detail-btn[_ngcontent-%COMP%] {\n  background: none;\n  border: none;\n  cursor: pointer;\n  color: var(--mj-text-disabled);\n  font-size: 16px;\n  width: 28px;\n  height: 28px;\n  border-radius: 4px;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  flex-shrink: 0;\n}\n\n.close-detail-btn[_ngcontent-%COMP%]:hover {\n  background: var(--mj-bg-surface-hover);\n  color: var(--mj-text-secondary);\n}\n\n\n\n.duration-bar-container[_ngcontent-%COMP%] {\n  padding: 12px 16px;\n  border-bottom: 1px solid var(--mj-border-subtle);\n}\n\n.duration-bar-track[_ngcontent-%COMP%] {\n  height: 6px;\n  background: var(--mj-bg-surface-active);\n  border-radius: 3px;\n  overflow: hidden;\n}\n\n.duration-bar-fill[_ngcontent-%COMP%] {\n  height: 100%;\n  background: linear-gradient(90deg, var(--mj-brand-primary), var(--mj-color-accent-400));\n  border-radius: 3px;\n  transition: width 0.3s;\n}\n\n.duration-bar-labels[_ngcontent-%COMP%] {\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n  margin-top: 4px;\n  font-size: 10px;\n  color: var(--mj-text-disabled);\n}\n\n.duration-bar-value[_ngcontent-%COMP%] {\n  font-weight: 700;\n  color: var(--mj-brand-primary);\n  font-size: 12px;\n}\n\n\n\n.detail-tabs[_ngcontent-%COMP%] {\n  display: flex;\n  border-bottom: 1px solid var(--mj-border-subtle);\n  padding: 0 16px;\n  gap: 2px;\n}\n\n.tab-btn[_ngcontent-%COMP%] {\n  background: none;\n  border: none;\n  border-bottom: 2px solid transparent;\n  cursor: pointer;\n  padding: 10px 12px;\n  font-size: 12px;\n  font-weight: 600;\n  color: var(--mj-text-disabled);\n  display: flex;\n  align-items: center;\n  gap: 5px;\n  transition: color 0.15s, border-color 0.15s;\n}\n\n.tab-btn[_ngcontent-%COMP%]:hover {\n  color: var(--mj-brand-primary);\n}\n\n.tab-btn.active[_ngcontent-%COMP%] {\n  color: var(--mj-brand-primary);\n  border-bottom-color: var(--mj-brand-primary);\n}\n\n\n\n.detail-content[_ngcontent-%COMP%] {\n  flex: 1;\n  overflow-y: auto;\n}\n\n.detail-loading[_ngcontent-%COMP%], \n.detail-empty[_ngcontent-%COMP%] {\n  padding: 24px;\n  text-align: center;\n  color: var(--mj-text-disabled);\n}\n\n.detail-empty[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n  font-size: 24px;\n  margin-bottom: 8px;\n  display: block;\n}\n\n.detail-empty[_ngcontent-%COMP%]   p[_ngcontent-%COMP%] {\n  margin: 0;\n  font-size: 13px;\n}\n\n.detail-table[_ngcontent-%COMP%] {\n  width: 100%;\n  border-collapse: collapse;\n  font-size: 12px;\n}\n\n.detail-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%] {\n  text-align: left;\n  padding: 8px 10px;\n  color: var(--mj-text-disabled);\n  font-weight: 600;\n  border-bottom: 1px solid var(--mj-border-subtle);\n  background: var(--mj-bg-page);\n  font-size: 11px;\n}\n\n.detail-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%] {\n  padding: 7px 10px;\n  border-bottom: 1px solid var(--mj-bg-page);\n}\n\n.mono-cell[_ngcontent-%COMP%] {\n  font-variant-numeric: tabular-nums;\n  color: var(--mj-text-muted);\n}\n\n.watermark-value[_ngcontent-%COMP%] {\n  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;\n  font-size: 11px;\n}\n\n\n\n.chip[_ngcontent-%COMP%] {\n  font-size: 11px;\n  font-weight: 600;\n  padding: 3px 8px;\n  border-radius: 10px;\n  display: inline-flex;\n  align-items: center;\n  gap: 4px;\n  white-space: nowrap;\n}\n\n.chip-green[_ngcontent-%COMP%] { background: var(--mj-color-success-100); color: var(--mj-color-success-600); }\n.chip-red[_ngcontent-%COMP%] { background: var(--mj-color-error-100); color: var(--mj-color-error-600); }\n.chip-amber[_ngcontent-%COMP%] { background: var(--mj-color-warning-100); color: var(--mj-color-warning-600); }\n.chip-gray[_ngcontent-%COMP%] { background: var(--mj-bg-surface-hover); color: var(--mj-text-muted); }\n\n\n\n.type-badge[_ngcontent-%COMP%] {\n  display: inline-flex;\n  padding: 2px 8px;\n  border-radius: 10px;\n  font-size: 10px;\n  font-weight: 600;\n  background: var(--mj-status-info-bg);\n  color: var(--mj-brand-primary);\n}\n\n\n\n\n@media (max-width: 900px) {\n  .split-view[_ngcontent-%COMP%] {\n    flex-direction: column;\n  }\n\n  .detail-panel[_ngcontent-%COMP%] {\n    min-width: 0;\n    max-height: 50vh;\n  }\n\n  .run-user[_ngcontent-%COMP%] {\n    display: none;\n  }\n}"] });
};
ActivityComponent = __decorate([
    RegisterClass(BaseResourceComponent, 'IntegrationActivity')
], ActivityComponent);
export { ActivityComponent };
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ActivityComponent, [{
        type: Component,
        args: [{ standalone: false, selector: 'app-integration-activity', template: "<mj-page-layout>\n  <mj-page-header\n    Title=\"Integration Activity\"\n    Icon=\"fa-solid fa-clock-rotate-left\"\n    Subtitle=\"Sync run history and outcomes\">\n    <!-- [meta] retains the succeeded/failed status pills (genuine variant\n         signal \u2014 error rate at a glance) and the records aggregate\n         (non-trivially derived: count of records across all runs).\n         \"Total runs\" dropped per chrome slot discipline audit Task B \u2014\n         that count equals the visible list's row count. -->\n    @if (!IsLoading && AllRuns.length > 0) {\n      <div meta>\n        <mj-stat-badge [Count]=\"SuccessfulRuns\" Label=\"succeeded\" Variant=\"success\"></mj-stat-badge>\n        <mj-stat-badge [Count]=\"FailedRuns\" Label=\"failed\" Variant=\"error\"></mj-stat-badge>\n        <mj-stat-badge [Count]=\"TotalRecordsProcessed | number\" Label=\"records\"></mj-stat-badge>\n      </div>\n    }\n    <div actions>\n      <mj-refresh-button [Loading]=\"IsLoading\" (Clicked)=\"Refresh()\"></mj-refresh-button>\n    </div>\n    <div toolbar>\n      <mj-page-search\n        Placeholder=\"Search integrations...\"\n        [Value]=\"SearchQuery\"\n        (ValueChange)=\"OnSearchValueChange($event)\">\n      </mj-page-search>\n      <mj-filter-popover\n        [ActiveCount]=\"ActiveFilterCount\"\n        [ShowClearAll]=\"ActiveFilterCount > 0\"\n        (ClearAllRequested)=\"ResetIntegrationFilter()\">\n        <mj-filter-panel\n          [Fields]=\"ActivityFilterFields\"\n          [Values]=\"ActivityFilterValues\"\n          (ValuesChange)=\"OnFilterValuesChange($event)\"\n          (Reset)=\"ResetIntegrationFilter()\">\n        </mj-filter-panel>\n      </mj-filter-popover>\n    </div>\n  </mj-page-header>\n\n  <mj-page-body [Flex]=\"true\">\n<div class=\"activity-container\">\n\n  <!-- Loading state -->\n  @if (IsLoading) {\n    <div class=\"loading-area\">\n      <mj-loading text=\"Loading activity...\" size=\"medium\"></mj-loading>\n    </div>\n  }\n\n  <!-- Empty state -->\n  @if (!IsLoading && FilteredRuns.length === 0) {\n    <div class=\"empty-state\">\n      <i class=\"fa-solid fa-inbox\"></i>\n      <p>No runs found for the selected filters.</p>\n    </div>\n  }\n\n  <!-- Split View: Run List + Detail Panel -->\n  @if (!IsLoading && FilteredRuns.length > 0) {\n    <div class=\"split-view\">\n\n      <!-- Left panel: Run list -->\n      <div class=\"run-list-panel\">\n        @for (run of FilteredRuns; track run.ID) {\n          <!-- Run row -->\n          <div class=\"run-row\"\n               [class.selected]=\"IsSelectedRun(run.ID)\"\n               (click)=\"SelectRun(run.ID)\">\n            <div class=\"run-row-main\">\n              <!-- Status indicator -->\n              <span [class]=\"GetStatusDotClass(run.Status)\"></span>\n              <i [class]=\"GetStatusIcon(run.Status)\"\n                 [class.icon-green]=\"run.Status === 'Success'\"\n                 [class.icon-red]=\"run.Status === 'Failed'\"\n                 [class.icon-amber]=\"run.Status === 'In Progress'\"\n                 [class.icon-gray]=\"run.Status === 'Pending'\"\n                 class=\"status-icon\"></i>\n\n              <!-- Integration info -->\n              <div class=\"run-info\">\n                <span class=\"run-integration\">{{ run.Integration }}</span>\n                <span class=\"run-company\">{{ run.Company }}</span>\n              </div>\n\n              <!-- Started time -->\n              <div class=\"run-meta\" [title]=\"FormatAbsoluteDate(run.StartedAt)\">\n                {{ GetRelativeTime(run.StartedAt) }}\n              </div>\n\n              <!-- Duration -->\n              <div class=\"run-meta run-duration\">\n                {{ FormatDuration(run.StartedAt, run.EndedAt) }}\n              </div>\n\n              <!-- Records -->\n              <div class=\"run-meta run-records\">\n                {{ run.TotalRecords | number }}\n              </div>\n\n              <!-- Errors -->\n              <div class=\"run-meta run-errors\" [class.has-errors]=\"run.ErrorLog\">\n                @if (run.ErrorLog) {\n                  <i class=\"fa-solid fa-triangle-exclamation\"></i>\n                }\n              </div>\n\n              <!-- Triggered by -->\n              <div class=\"run-meta run-user\">\n                {{ run.RunByUser || 'Scheduled' }}\n              </div>\n\n              <!-- Expand chevron -->\n              <button class=\"expand-btn\"\n                      (click)=\"ToggleExpand(run.ID); $event.stopPropagation()\"\n                      title=\"Show entity breakdown\">\n                <i class=\"fa-solid fa-chevron-down\"\n                   [class.rotated]=\"IsExpanded(run.ID)\"></i>\n              </button>\n            </div>\n\n            <!-- Expanded section: entity breakdown -->\n            @if (IsExpanded(run.ID)) {\n              <div class=\"expanded-section\" (click)=\"$event.stopPropagation()\">\n                @if (IsLoadingExpandedDetails()) {\n                  <div class=\"expanded-loading\">\n                    <mj-loading text=\"Loading breakdown...\" size=\"small\"></mj-loading>\n                  </div>\n                } @else if (GetExpandedDetails().length === 0) {\n                  <div class=\"expanded-empty\">\n                    <i class=\"fa-solid fa-circle-info\"></i>\n                    No entity details for this run.\n                  </div>\n                } @else {\n                  <table class=\"entity-table\">\n                    <thead>\n                      <tr>\n                        <th>Entity</th>\n                        <th class=\"num-col\">Processed</th>\n                        <th class=\"num-col\">Created</th>\n                        <th class=\"num-col\">Updated</th>\n                        <th class=\"num-col\">Deleted</th>\n                        <th class=\"num-col\">Errored</th>\n                        <th class=\"num-col\">Skipped</th>\n                      </tr>\n                    </thead>\n                    <tbody>\n                      @for (detail of GetExpandedDetails(); track detail.EntityID) {\n                        <tr [class.error-row]=\"detail.RecordsErrored > 0\">\n                          <td>{{ detail.Entity }}</td>\n                          <td class=\"num-col\">{{ detail.RecordsProcessed | number }}</td>\n                          <td class=\"num-col created-col\">{{ detail.RecordsCreated | number }}</td>\n                          <td class=\"num-col updated-col\">{{ detail.RecordsUpdated | number }}</td>\n                          <td class=\"num-col\">{{ detail.RecordsDeleted | number }}</td>\n                          <td class=\"num-col error-col\">{{ detail.RecordsErrored | number }}</td>\n                          <td class=\"num-col\">{{ detail.RecordsSkipped | number }}</td>\n                        </tr>\n                      }\n                    </tbody>\n                  </table>\n                }\n\n                <!-- Error log in expanded view -->\n                @if (run.ErrorLog) {\n                  <div class=\"error-log-block\">\n                    <div class=\"error-log-label\">\n                      <i class=\"fa-solid fa-triangle-exclamation\"></i> Error Log\n                    </div>\n                    <pre class=\"error-log-content\">{{ run.ErrorLog }}</pre>\n                  </div>\n                }\n              </div>\n            }\n          </div>\n        }\n      </div>\n\n      <!-- Right panel: Detail -->\n      @if (SelectedRunID && GetSelectedRun()) {\n        <div class=\"detail-panel\">\n          <div class=\"detail-header\">\n            <div class=\"detail-header-info\">\n              <h3>{{ GetSelectedRun()!.Integration }}</h3>\n              <span [class]=\"StatusChipClass(GetSelectedRun()!.Status)\">\n                <i [class]=\"GetStatusIcon(GetSelectedRun()!.Status)\"></i>\n                {{ GetSelectedRun()!.Status }}\n              </span>\n              <span class=\"detail-time\">{{ FormatDate(GetSelectedRun()!.StartedAt) }}</span>\n            </div>\n            <button class=\"close-detail-btn\" (click)=\"SelectRun(SelectedRunID!)\" title=\"Close\">\n              <i class=\"fa-solid fa-xmark\"></i>\n            </button>\n          </div>\n\n          <!-- Duration bar -->\n          @if (GetSelectedRun()!.StartedAt && GetSelectedRun()!.EndedAt) {\n            <div class=\"duration-bar-container\">\n              <div class=\"duration-bar-track\">\n                <div class=\"duration-bar-fill\"\n                     [style.width.%]=\"GetDurationBarWidth(GetSelectedRun()!)\"></div>\n              </div>\n              <div class=\"duration-bar-labels\">\n                <span>{{ FormatDate(GetSelectedRun()!.StartedAt) }}</span>\n                <span class=\"duration-bar-value\">{{ GetDurationBarLabel(GetSelectedRun()!) }}</span>\n                <span>{{ FormatDate(GetSelectedRun()!.EndedAt) }}</span>\n              </div>\n            </div>\n          }\n\n          <!-- Tabs -->\n          <div class=\"detail-tabs\">\n            <button class=\"tab-btn\" [class.active]=\"ActiveDetailTab === 'entities'\"\n                    (click)=\"SetDetailTab('entities')\">\n              <i class=\"fa-solid fa-table\"></i> Entity Breakdown\n            </button>\n            <button class=\"tab-btn\" [class.active]=\"ActiveDetailTab === 'watermarks'\"\n                    (click)=\"SetDetailTab('watermarks')\">\n              <i class=\"fa-solid fa-droplet\"></i> Watermarks\n            </button>\n          </div>\n\n          <div class=\"detail-content\">\n            <!-- Entity breakdown tab -->\n            @if (ActiveDetailTab === 'entities') {\n              @if (IsLoadingDetail) {\n                <div class=\"detail-loading\">\n                  <mj-loading text=\"Loading details...\" size=\"small\"></mj-loading>\n                </div>\n              } @else if (SelectedRunDetails.length === 0) {\n                <div class=\"detail-empty\">\n                  <i class=\"fa-solid fa-circle-info\"></i>\n                  <p>No entity detail records for this run.</p>\n                </div>\n              } @else {\n                <table class=\"detail-table\">\n                  <thead>\n                    <tr>\n                      <th>Entity</th>\n                      <th class=\"num-col\">Processed</th>\n                      <th class=\"num-col\">Created</th>\n                      <th class=\"num-col\">Updated</th>\n                      <th class=\"num-col\">Deleted</th>\n                      <th class=\"num-col\">Errors</th>\n                      <th class=\"num-col\">Skipped</th>\n                    </tr>\n                  </thead>\n                  <tbody>\n                    @for (detail of SelectedRunDetails; track detail.EntityID) {\n                      <tr [class.error-row]=\"detail.RecordsErrored > 0\">\n                        <td>{{ detail.Entity }}</td>\n                        <td class=\"num-col\">{{ detail.RecordsProcessed | number }}</td>\n                        <td class=\"num-col created-col\">{{ detail.RecordsCreated | number }}</td>\n                        <td class=\"num-col updated-col\">{{ detail.RecordsUpdated | number }}</td>\n                        <td class=\"num-col\">{{ detail.RecordsDeleted | number }}</td>\n                        <td class=\"num-col error-col\">{{ detail.RecordsErrored | number }}</td>\n                        <td class=\"num-col\">{{ detail.RecordsSkipped | number }}</td>\n                      </tr>\n                    }\n                  </tbody>\n                </table>\n              }\n\n              <!-- Error log -->\n              @if (GetSelectedRun()?.ErrorLog) {\n                <div class=\"error-log-block detail-error-log\">\n                  <div class=\"error-log-label\">\n                    <i class=\"fa-solid fa-triangle-exclamation\"></i> Error Log\n                  </div>\n                  <pre class=\"error-log-content\">{{ GetSelectedRun()!.ErrorLog }}</pre>\n                </div>\n              }\n            }\n\n            <!-- Watermarks tab -->\n            @if (ActiveDetailTab === 'watermarks') {\n              @if (IsLoadingWatermarks) {\n                <div class=\"detail-loading\">\n                  <mj-loading text=\"Loading watermarks...\" size=\"small\"></mj-loading>\n                </div>\n              } @else if (WatermarkData.length === 0) {\n                <div class=\"detail-empty\">\n                  <i class=\"fa-solid fa-droplet-slash\"></i>\n                  <p>No watermarks recorded for this integration.</p>\n                </div>\n              } @else {\n                <table class=\"detail-table\">\n                  <thead>\n                    <tr>\n                      <th>Entity Map</th>\n                      <th>Type</th>\n                      <th>Current Value</th>\n                      <th>Last Applied</th>\n                    </tr>\n                  </thead>\n                  <tbody>\n                    @for (wm of WatermarkData; track wm.ID) {\n                      <tr>\n                        <td>{{ wm.EntityMap }}</td>\n                        <td><span class=\"type-badge\">{{ wm.WatermarkType }}</span></td>\n                        <td class=\"mono-cell watermark-value\">{{ FormatWatermark(wm.WatermarkValue) }}</td>\n                        <td>{{ FormatDate(wm.LastSyncAt) }}</td>\n                      </tr>\n                    }\n                  </tbody>\n                </table>\n              }\n            }\n          </div>\n        </div>\n      }\n\n    </div>\n  }\n\n</div>\n  </mj-page-body>\n</mj-page-layout>\n", styles: [":host {\n  display: block;\n  height: 100%;\n}\n\n.activity-container {\n  /* padding / scroll now owned by <mj-page-body>; flex sizing keeps the\n     inner split-view (flex: 1 + min-height: 0) able to fill remaining height. */\n  display: flex;\n  flex-direction: column;\n  flex: 1;\n  min-height: 0;\n  gap: 14px;\n}\n\n/* Slot passthrough now lives in <mj-page-header>'s SCSS; per-section\n   .integration-header-* rules deleted. Stat badge styling now lives in\n   <mj-stat-badge>; per-section .integration-stat-badge* rules deleted. */\n\n/* Vertical separator between distinct chip groups in the toolbar slot. */\n.toolbar-divider {\n  display: inline-block;\n  width: 1px;\n  height: 18px;\n  background: var(--mj-border-default);\n  margin: 0 4px;\n}\n\n/* \u2500\u2500 Loading / Empty \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\n.loading-area {\n  display: flex;\n  justify-content: center;\n  padding: 48px;\n}\n\n.empty-state {\n  text-align: center;\n  padding: 48px;\n  color: var(--mj-text-disabled);\n}\n\n.empty-state i {\n  font-size: 32px;\n  margin-bottom: 12px;\n  display: block;\n}\n\n.empty-state p {\n  margin: 0;\n  font-size: 14px;\n}\n\n/* \u2500\u2500 Split View \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\n.split-view {\n  display: flex;\n  gap: 16px;\n  flex: 1;\n  min-height: 0;\n  overflow: hidden;\n}\n\n/* \u2500\u2500 Run List Panel (left 70%) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\n.run-list-panel {\n  flex: 7;\n  overflow-y: auto;\n  display: flex;\n  flex-direction: column;\n}\n\n.run-row {\n  border-bottom: 1px solid var(--mj-border-subtle);\n  cursor: pointer;\n  transition: background 0.1s;\n}\n\n.run-row:hover {\n  background: var(--mj-bg-page);\n}\n\n.run-row.selected {\n  background: var(--mj-status-info-bg);\n}\n\n.run-row-main {\n  display: flex;\n  align-items: center;\n  gap: 10px;\n  padding: 10px 14px;\n}\n\n/* Status indicator */\n.status-dot {\n  width: 8px;\n  height: 8px;\n  border-radius: 50%;\n  flex-shrink: 0;\n}\n\n.status-icon {\n  font-size: 14px;\n  width: 16px;\n  text-align: center;\n  flex-shrink: 0;\n}\n\n.icon-green { color: var(--mj-color-success-600); }\n.icon-red { color: var(--mj-status-error); }\n.icon-amber { color: var(--mj-status-warning); }\n.icon-gray { color: var(--mj-text-disabled); }\n\n/* Run info */\n.run-info {\n  flex: 2;\n  min-width: 0;\n  display: flex;\n  flex-direction: column;\n  gap: 1px;\n}\n\n.run-integration {\n  font-weight: 600;\n  font-size: 13px;\n  color: var(--mj-text-primary);\n  white-space: nowrap;\n  overflow: hidden;\n  text-overflow: ellipsis;\n}\n\n.run-company {\n  font-size: 11px;\n  color: var(--mj-text-disabled);\n}\n\n/* Meta columns */\n.run-meta {\n  flex-shrink: 0;\n  font-size: 12px;\n  color: var(--mj-text-muted);\n  white-space: nowrap;\n  min-width: 60px;\n  text-align: right;\n}\n\n.run-duration {\n  font-variant-numeric: tabular-nums;\n  min-width: 56px;\n}\n\n.run-records {\n  font-variant-numeric: tabular-nums;\n  min-width: 48px;\n}\n\n.run-errors {\n  min-width: 24px;\n  text-align: center;\n}\n\n.run-errors.has-errors {\n  color: var(--mj-status-error);\n}\n\n.run-user {\n  min-width: 80px;\n  overflow: hidden;\n  text-overflow: ellipsis;\n}\n\n.expand-btn {\n  background: none;\n  border: none;\n  cursor: pointer;\n  width: 28px;\n  height: 28px;\n  border-radius: 4px;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  color: var(--mj-text-disabled);\n  font-size: 11px;\n  transition: background 0.15s, transform 0.2s;\n  flex-shrink: 0;\n}\n\n.expand-btn:hover {\n  background: var(--mj-bg-surface-hover);\n  color: var(--mj-text-secondary);\n}\n\n.expand-btn i.rotated {\n  transform: rotate(180deg);\n}\n\n/* \u2500\u2500 Expanded Section \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\n.expanded-section {\n  padding: 8px 14px 14px 48px;\n  background: var(--mj-bg-page);\n  border-top: 1px solid var(--mj-border-subtle);\n}\n\n.expanded-loading,\n.expanded-empty {\n  padding: 16px;\n  text-align: center;\n  color: var(--mj-text-disabled);\n  font-size: 12px;\n}\n\n.expanded-empty i {\n  margin-right: 6px;\n}\n\n.entity-table {\n  width: 100%;\n  border-collapse: collapse;\n  font-size: 12px;\n}\n\n.entity-table th {\n  text-align: left;\n  padding: 6px 8px;\n  color: var(--mj-text-disabled);\n  font-weight: 600;\n  font-size: 11px;\n  border-bottom: 1px solid var(--mj-border-default);\n  text-transform: uppercase;\n  letter-spacing: 0.5px;\n}\n\n.entity-table td {\n  padding: 5px 8px;\n  border-bottom: 1px solid var(--mj-border-subtle);\n}\n\n.entity-table .num-col,\n.detail-table .num-col {\n  text-align: right;\n  font-variant-numeric: tabular-nums;\n}\n\n.entity-table .created-col,\n.detail-table .created-col {\n  color: var(--mj-color-success-600);\n  font-weight: 600;\n}\n\n.entity-table .updated-col,\n.detail-table .updated-col {\n  color: var(--mj-brand-primary);\n  font-weight: 600;\n}\n\n.entity-table .error-col,\n.detail-table .error-col {\n  color: var(--mj-color-error-600);\n  font-weight: 600;\n}\n\n.error-row {\n  background: var(--mj-status-error-bg);\n}\n\n/* \u2500\u2500 Error Log Block \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\n.error-log-block {\n  margin-top: 10px;\n}\n\n.error-log-label {\n  font-size: 12px;\n  font-weight: 600;\n  color: var(--mj-color-error-600);\n  margin-bottom: 6px;\n  display: flex;\n  align-items: center;\n  gap: 6px;\n}\n\n.error-log-content {\n  margin: 0;\n  padding: 10px 12px;\n  background: var(--mj-text-primary);\n  color: var(--mj-bg-surface-sunken);\n  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;\n  font-size: 11px;\n  border-radius: 8px;\n  white-space: pre-wrap;\n  word-break: break-word;\n  max-height: 200px;\n  overflow-y: auto;\n  line-height: 1.5;\n}\n\n.detail-error-log {\n  padding: 12px 16px;\n  border-top: 1px solid var(--mj-border-subtle);\n}\n\n/* \u2500\u2500 Detail Panel (right 30%) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\n.detail-panel {\n  flex: 3;\n  min-width: 340px;\n  background: var(--mj-bg-surface);\n  border: 1px solid var(--mj-border-default);\n  border-radius: 8px;\n  display: flex;\n  flex-direction: column;\n  overflow: hidden;\n}\n\n.detail-header {\n  display: flex;\n  align-items: flex-start;\n  justify-content: space-between;\n  padding: 14px 16px;\n  border-bottom: 1px solid var(--mj-border-subtle);\n  gap: 12px;\n}\n\n.detail-header-info {\n  display: flex;\n  flex-direction: column;\n  gap: 6px;\n  min-width: 0;\n}\n\n.detail-header-info h3 {\n  margin: 0;\n  font-size: 15px;\n  font-weight: 700;\n  color: var(--mj-text-primary);\n  white-space: nowrap;\n  overflow: hidden;\n  text-overflow: ellipsis;\n}\n\n.detail-time {\n  font-size: 12px;\n  color: var(--mj-text-disabled);\n}\n\n.close-detail-btn {\n  background: none;\n  border: none;\n  cursor: pointer;\n  color: var(--mj-text-disabled);\n  font-size: 16px;\n  width: 28px;\n  height: 28px;\n  border-radius: 4px;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  flex-shrink: 0;\n}\n\n.close-detail-btn:hover {\n  background: var(--mj-bg-surface-hover);\n  color: var(--mj-text-secondary);\n}\n\n/* Duration bar */\n.duration-bar-container {\n  padding: 12px 16px;\n  border-bottom: 1px solid var(--mj-border-subtle);\n}\n\n.duration-bar-track {\n  height: 6px;\n  background: var(--mj-bg-surface-active);\n  border-radius: 3px;\n  overflow: hidden;\n}\n\n.duration-bar-fill {\n  height: 100%;\n  background: linear-gradient(90deg, var(--mj-brand-primary), var(--mj-color-accent-400));\n  border-radius: 3px;\n  transition: width 0.3s;\n}\n\n.duration-bar-labels {\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n  margin-top: 4px;\n  font-size: 10px;\n  color: var(--mj-text-disabled);\n}\n\n.duration-bar-value {\n  font-weight: 700;\n  color: var(--mj-brand-primary);\n  font-size: 12px;\n}\n\n/* Tabs */\n.detail-tabs {\n  display: flex;\n  border-bottom: 1px solid var(--mj-border-subtle);\n  padding: 0 16px;\n  gap: 2px;\n}\n\n.tab-btn {\n  background: none;\n  border: none;\n  border-bottom: 2px solid transparent;\n  cursor: pointer;\n  padding: 10px 12px;\n  font-size: 12px;\n  font-weight: 600;\n  color: var(--mj-text-disabled);\n  display: flex;\n  align-items: center;\n  gap: 5px;\n  transition: color 0.15s, border-color 0.15s;\n}\n\n.tab-btn:hover {\n  color: var(--mj-brand-primary);\n}\n\n.tab-btn.active {\n  color: var(--mj-brand-primary);\n  border-bottom-color: var(--mj-brand-primary);\n}\n\n/* Detail content area */\n.detail-content {\n  flex: 1;\n  overflow-y: auto;\n}\n\n.detail-loading,\n.detail-empty {\n  padding: 24px;\n  text-align: center;\n  color: var(--mj-text-disabled);\n}\n\n.detail-empty i {\n  font-size: 24px;\n  margin-bottom: 8px;\n  display: block;\n}\n\n.detail-empty p {\n  margin: 0;\n  font-size: 13px;\n}\n\n.detail-table {\n  width: 100%;\n  border-collapse: collapse;\n  font-size: 12px;\n}\n\n.detail-table th {\n  text-align: left;\n  padding: 8px 10px;\n  color: var(--mj-text-disabled);\n  font-weight: 600;\n  border-bottom: 1px solid var(--mj-border-subtle);\n  background: var(--mj-bg-page);\n  font-size: 11px;\n}\n\n.detail-table td {\n  padding: 7px 10px;\n  border-bottom: 1px solid var(--mj-bg-page);\n}\n\n.mono-cell {\n  font-variant-numeric: tabular-nums;\n  color: var(--mj-text-muted);\n}\n\n.watermark-value {\n  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;\n  font-size: 11px;\n}\n\n/* Status chips */\n.chip {\n  font-size: 11px;\n  font-weight: 600;\n  padding: 3px 8px;\n  border-radius: 10px;\n  display: inline-flex;\n  align-items: center;\n  gap: 4px;\n  white-space: nowrap;\n}\n\n.chip-green { background: var(--mj-color-success-100); color: var(--mj-color-success-600); }\n.chip-red { background: var(--mj-color-error-100); color: var(--mj-color-error-600); }\n.chip-amber { background: var(--mj-color-warning-100); color: var(--mj-color-warning-600); }\n.chip-gray { background: var(--mj-bg-surface-hover); color: var(--mj-text-muted); }\n\n/* Watermark type badge */\n.type-badge {\n  display: inline-flex;\n  padding: 2px 8px;\n  border-radius: 10px;\n  font-size: 10px;\n  font-weight: 600;\n  background: var(--mj-status-info-bg);\n  color: var(--mj-brand-primary);\n}\n\n/* \u2500\u2500 Responsive \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\n@media (max-width: 900px) {\n  .split-view {\n    flex-direction: column;\n  }\n\n  .detail-panel {\n    min-width: 0;\n    max-height: 50vh;\n  }\n\n  .run-user {\n    display: none;\n  }\n}\n"] }]
    }], null, null); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ActivityComponent, { className: "ActivityComponent", filePath: "src/Integration/components/activity/activity.component.ts", lineNumber: 39 }); })();
export function LoadActivityComponent() {
    // Tree-shaking prevention: importing this module causes
    // @RegisterClass decorators to fire, registering components.
}
//# sourceMappingURL=activity.component.js.map