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 { ChangeDetectionStrategy, ChangeDetectorRef, Component, inject } from '@angular/core';
import { RegisterClass } from '@memberjunction/global';
import { LogError } from '@memberjunction/core';
import { MJEnvironmentEntityExtended } from '@memberjunction/core-entities';
import { AIEngineBase } from '@memberjunction/ai-engine-base';
import { BaseResourceComponent } from '@memberjunction/ng-shared';
import { PSResourceBase } from './ps-resource-base';
import { STUDIO_SECTIONS, sectionGroups, sectionsInGroup, sectionLabel, sectionIcon, hasSection, routeHomeNavigate, } from '../predictive-studio.nav';
import * as i0 from "@angular/core";
import * as i1 from "@memberjunction/ng-ui-components";
import * as i2 from "@memberjunction/ng-shared-generic";
import * as i3 from "@memberjunction/ng-conversations";
import * as i4 from "../components/ps-home.component";
import * as i5 from "../components/ps-catalog.component";
import * as i6 from "../components/ps-pipelines.component";
import * as i7 from "../components/ps-experiments.component";
import * as i8 from "../components/ps-compare.component";
const _forTrack0 = ($index, $item) => $item.key;
function PSStudioResourceComponent_Conditional_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "mj-loading", 1);
} }
function PSStudioResourceComponent_Conditional_3_For_3_Conditional_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 9);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const group_r1 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate(group_r1);
} }
function PSStudioResourceComponent_Conditional_3_For_3_For_2_Template(rf, ctx) { if (rf & 1) {
    const _r2 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 11);
    i0.ɵɵlistener("click", function PSStudioResourceComponent_Conditional_3_For_3_For_2_Template_button_click_0_listener() { const item_r3 = i0.ɵɵrestoreView(_r2).$implicit; const ctx_r3 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r3.selectSection(item_r3.key)); });
    i0.ɵɵelement(1, "i");
    i0.ɵɵelementStart(2, "span");
    i0.ɵɵtext(3);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const item_r3 = ctx.$implicit;
    const ctx_r3 = i0.ɵɵnextContext(3);
    i0.ɵɵclassProp("active", ctx_r3.activeSection === item_r3.key);
    i0.ɵɵattribute("data-testid", "ps-nav-" + item_r3.key);
    i0.ɵɵadvance();
    i0.ɵɵclassMap(item_r3.icon);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(item_r3.label);
} }
function PSStudioResourceComponent_Conditional_3_For_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵconditionalCreate(0, PSStudioResourceComponent_Conditional_3_For_3_Conditional_0_Template, 2, 1, "div", 9);
    i0.ɵɵrepeaterCreate(1, PSStudioResourceComponent_Conditional_3_For_3_For_2_Template, 4, 6, "button", 10, _forTrack0);
} if (rf & 2) {
    const group_r1 = ctx.$implicit;
    const ctx_r3 = i0.ɵɵnextContext(2);
    i0.ɵɵconditional(group_r1 ? 0 : -1);
    i0.ɵɵadvance();
    i0.ɵɵrepeater(ctx_r3.itemsForGroup(group_r1));
} }
function PSStudioResourceComponent_Conditional_3_Case_5_Template(rf, ctx) { if (rf & 1) {
    const _r5 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "ps-home", 12);
    i0.ɵɵlistener("navigate", function PSStudioResourceComponent_Conditional_3_Case_5_Template_ps_home_navigate_0_listener($event) { i0.ɵɵrestoreView(_r5); const ctx_r3 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r3.mapNavigate($event)); })("askAgent", function PSStudioResourceComponent_Conditional_3_Case_5_Template_ps_home_askAgent_0_listener($event) { i0.ɵɵrestoreView(_r5); const ctx_r3 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r3.onAskAgent($event)); });
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r3 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("engine", ctx_r3.engine)("provider", ctx_r3.ProviderToUse)("currentUser", ctx_r3.ProviderToUse.CurrentUser);
} }
function PSStudioResourceComponent_Conditional_3_Case_6_Template(rf, ctx) { if (rf & 1) {
    const _r6 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "ps-pipelines", 13);
    i0.ɵɵlistener("askAgent", function PSStudioResourceComponent_Conditional_3_Case_6_Template_ps_pipelines_askAgent_0_listener($event) { i0.ɵɵrestoreView(_r6); const ctx_r3 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r3.onAskAgent($event)); });
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r3 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("engine", ctx_r3.engine)("provider", ctx_r3.ProviderToUse)("currentUser", ctx_r3.ProviderToUse.CurrentUser);
} }
function PSStudioResourceComponent_Conditional_3_Case_7_Template(rf, ctx) { if (rf & 1) {
    const _r7 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "ps-catalog", 14);
    i0.ɵɵlistener("askAgent", function PSStudioResourceComponent_Conditional_3_Case_7_Template_ps_catalog_askAgent_0_listener($event) { i0.ɵɵrestoreView(_r7); const ctx_r3 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r3.onAskAgent($event)); });
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r3 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("engine", ctx_r3.engine);
} }
function PSStudioResourceComponent_Conditional_3_Case_8_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "ps-experiments", 6);
} if (rf & 2) {
    const ctx_r3 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("engine", ctx_r3.engine)("provider", ctx_r3.ProviderToUse)("currentUser", ctx_r3.ProviderToUse.CurrentUser);
} }
function PSStudioResourceComponent_Conditional_3_Case_9_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "ps-compare", 7);
} if (rf & 2) {
    const ctx_r3 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("engine", ctx_r3.engine);
} }
function PSStudioResourceComponent_Conditional_3_Conditional_10_Conditional_8_Template(rf, ctx) { if (rf & 1) {
    const _r9 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "mj-conversation-chat-area", 23);
    i0.ɵɵlistener("conversationCreated", function PSStudioResourceComponent_Conditional_3_Conditional_10_Conditional_8_Template_mj_conversation_chat_area_conversationCreated_0_listener($event) { i0.ɵɵrestoreView(_r9); const ctx_r3 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r3.onChatConversationCreated($event)); })("pendingMessageConsumed", function PSStudioResourceComponent_Conditional_3_Conditional_10_Conditional_8_Template_mj_conversation_chat_area_pendingMessageConsumed_0_listener() { i0.ɵɵrestoreView(_r9); const ctx_r3 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r3.onChatPendingMessageConsumed()); });
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r3 = i0.ɵɵnextContext(3);
    i0.ɵɵproperty("Provider", ctx_r3.Provider)("environmentId", ctx_r3.chatEnvironmentId)("currentUser", ctx_r3.currentUser)("conversation", ctx_r3.chatConversation)("conversationId", ctx_r3.chatConversationId)("isNewConversation", ctx_r3.chatIsNewConversation)("suppressNewConversationEmptyState", true)("allowMentions", false)("overlayMode", true)("showExportButton", false)("showShareButton", false)("showArtifactIndicator", false)("showAgentPicker", false)("showAgentModePicker", false)("defaultAgentId", ctx_r3.modelDevAgentId)("pendingMessage", ctx_r3.pendingPrompt)("applicationScope", "Application")("applicationId", ctx_r3.applicationId)("appContext", ctx_r3.chatAppContext);
} }
function PSStudioResourceComponent_Conditional_3_Conditional_10_Conditional_9_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 22);
    i0.ɵɵelement(1, "mj-loading", 24);
    i0.ɵɵelementEnd();
} }
function PSStudioResourceComponent_Conditional_3_Conditional_10_Template(rf, ctx) { if (rf & 1) {
    const _r8 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "aside", 8)(1, "div", 15)(2, "div", 16);
    i0.ɵɵelement(3, "i", 17);
    i0.ɵɵtext(4, " Model Dev Agent");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "button", 18);
    i0.ɵɵlistener("click", function PSStudioResourceComponent_Conditional_3_Conditional_10_Template_button_click_5_listener() { i0.ɵɵrestoreView(_r8); const ctx_r3 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r3.closeChat()); });
    i0.ɵɵelement(6, "i", 19);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(7, "div", 20);
    i0.ɵɵconditionalCreate(8, PSStudioResourceComponent_Conditional_3_Conditional_10_Conditional_8_Template, 1, 19, "mj-conversation-chat-area", 21)(9, PSStudioResourceComponent_Conditional_3_Conditional_10_Conditional_9_Template, 2, 0, "div", 22);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r3 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(8);
    i0.ɵɵconditional(ctx_r3.currentUser ? 8 : 9);
} }
function PSStudioResourceComponent_Conditional_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 3)(1, "aside", 4);
    i0.ɵɵrepeaterCreate(2, PSStudioResourceComponent_Conditional_3_For_3_Template, 3, 1, null, null, i0.ɵɵrepeaterTrackByIdentity);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "section", 5);
    i0.ɵɵconditionalCreate(5, PSStudioResourceComponent_Conditional_3_Case_5_Template, 1, 3, "ps-home", 6)(6, PSStudioResourceComponent_Conditional_3_Case_6_Template, 1, 3, "ps-pipelines", 6)(7, PSStudioResourceComponent_Conditional_3_Case_7_Template, 1, 1, "ps-catalog", 7)(8, PSStudioResourceComponent_Conditional_3_Case_8_Template, 1, 3, "ps-experiments", 6)(9, PSStudioResourceComponent_Conditional_3_Case_9_Template, 1, 1, "ps-compare", 7);
    i0.ɵɵelementEnd();
    i0.ɵɵconditionalCreate(10, PSStudioResourceComponent_Conditional_3_Conditional_10_Template, 10, 1, "aside", 8);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    let tmp_4_0;
    const ctx_r3 = i0.ɵɵnextContext();
    i0.ɵɵclassProp("chat-open", ctx_r3.chatOpen);
    i0.ɵɵadvance(2);
    i0.ɵɵrepeater(ctx_r3.groups);
    i0.ɵɵadvance(2);
    i0.ɵɵattribute("data-testid", "ps-panel-" + ctx_r3.activeSection);
    i0.ɵɵadvance();
    i0.ɵɵconditional((tmp_4_0 = ctx_r3.activeSection) === "home" ? 5 : tmp_4_0 === "pipelines" ? 6 : tmp_4_0 === "catalog" ? 7 : tmp_4_0 === "experiments" ? 8 : tmp_4_0 === "compare" ? 9 : -1);
    i0.ɵɵadvance(5);
    i0.ɵɵconditional(ctx_r3.chatOpen ? 10 : -1);
} }
/** Predictive Studio application ID (from `metadata/applications/.predictive-studio-application.json`). */
const PREDICTIVE_STUDIO_APP_ID = '299C9272-8D38-40CA-85D4-0980F2C9FAD1';
const MODEL_DEV_AGENT_NAME = 'Model Development Agent';
/**
 * **Studio** — the analyst workbench door (one of Predictive Studio's three consolidated nav items,
 * alongside `Predictions` and `Models`). Hosts the build/run section panels (`ps-home`, `ps-pipelines`,
 * `ps-catalog`, `ps-experiments`, `ps-compare`) behind an internal left-nav grouped by lifecycle
 * (Overview · Build · Run), so the outer app nav stays quiet while analysts get all the depth one click
 * in. The active section round-trips through the `section` query param (deep links + back/forward). A
 * single docked **Model Development Agent** copilot is shared by every section's "Ask the agent" CTA —
 * wired with the full conversation lifecycle (`isNewConversation` → `conversationCreated`) so the first
 * message actually creates + sends. Cross-door navigation (to a Models section) routes via the nav
 * service; see {@link routeHomeNavigate}.
 */
let PSStudioResourceComponent = class PSStudioResourceComponent extends PSResourceBase {
    SectionKey = 'studio';
    SectionLabel = 'Studio';
    SectionIcon = 'fa-solid fa-flask-vial';
    cdrLocal = inject(ChangeDetectorRef);
    /** The active workbench section (which panel renders). Round-trips through the `section` query param. */
    activeSection = 'home';
    sections = STUDIO_SECTIONS;
    // ── docked Model Dev Agent copilot ───────────────────────────────
    chatOpen = false;
    pendingPrompt = null;
    _modelDevAgentId = null;
    /** Conversation lifecycle (see {@link onChatConversationCreated}) — without it the first send no-ops. */
    chatConversation = null;
    chatConversationId = null;
    chatIsNewConversation = true;
    ngOnInit() {
        super.ngOnInit();
        const initial = this.GetQueryParams()['section'];
        if (initial && hasSection(this.sections, initial))
            this.activeSection = initial;
    }
    /** React to deep-link / back-forward `section` changes after the initial mount. */
    OnQueryParamsChanged(params, _source) {
        const next = params['section'];
        if (next && next !== this.activeSection && hasSection(this.sections, next)) {
            this.activeSection = next;
            this.cdrLocal.detectChanges();
        }
    }
    extraAgentContext() {
        return { ActiveSection: sectionLabel(this.sections, this.activeSection) };
    }
    // ── left-nav ─────────────────────────────────────────────────────
    get groups() { return sectionGroups(this.sections); }
    itemsForGroup(group) { return sectionsInGroup(this.sections, group); }
    get activeLabel() { return sectionLabel(this.sections, this.activeSection); }
    get activeIcon() { return sectionIcon(this.sections, this.activeSection); }
    selectSection(key) {
        if (this.activeSection === key)
            return;
        this.activeSection = key;
        this.UpdateQueryParams({ section: key });
        this.publishAgentContext();
        this.cdrLocal.detectChanges();
    }
    /** The Overview panel's in-app navigation: switch section in-place, or cross to the Models door. */
    mapNavigate(key) {
        const target = routeHomeNavigate(key);
        if (target.kind === 'section') {
            this.selectSection(target.key);
        }
        else if (target.kind === 'app') {
            void this.navigationService.SwitchToApp(PREDICTIVE_STUDIO_APP_ID, target.navLabel, { section: target.section });
        }
    }
    // ── copilot ──────────────────────────────────────────────────────
    get currentUser() { return this.ProviderToUse.CurrentUser ?? null; }
    get chatEnvironmentId() {
        return this.Data?.Configuration?.['environmentId'] || MJEnvironmentEntityExtended.DefaultEnvironmentID;
    }
    get applicationId() { return this.Data?.Configuration?.['applicationId'] ?? null; }
    get modelDevAgentId() { return this._modelDevAgentId; }
    get chatAppContext() {
        return { app: 'Predictive Studio', section: this.activeSection, publishedModels: this.engine.Models.filter((m) => m.Status === 'Published').length };
    }
    onAskAgent(starterPrompt) {
        this.pendingPrompt = starterPrompt;
        this.chatOpen = true;
        void this.ensureModelDevAgentResolved();
        this.cdrLocal.detectChanges();
    }
    closeChat() {
        this.chatOpen = false;
        this.pendingPrompt = null;
        this.cdrLocal.detectChanges();
    }
    /** Chat-area created its backing conversation on the first send — capture it + leave new-mode so the thread renders. */
    onChatConversationCreated(event) {
        this.pendingPrompt = event.pendingMessage ?? null;
        this.chatConversation = event.conversation;
        this.chatConversationId = event.conversation.ID;
        this.chatIsNewConversation = false;
        this.cdrLocal.detectChanges();
    }
    /** Chat-area delivered the seeded prompt — clear the buffer so a re-render doesn't resend it. */
    onChatPendingMessageConsumed() {
        this.pendingPrompt = null;
        this.cdrLocal.detectChanges();
    }
    async ensureModelDevAgentResolved() {
        if (this._modelDevAgentId)
            return;
        try {
            await AIEngineBase.Instance.Config(false, this.ProviderToUse.CurrentUser ?? undefined);
            this._modelDevAgentId =
                AIEngineBase.Instance.Agents?.find((a) => a.Name?.trim().toLowerCase() === MODEL_DEV_AGENT_NAME.toLowerCase())?.ID ?? null;
            if (!this._modelDevAgentId)
                LogError(`PSStudioResource: '${MODEL_DEV_AGENT_NAME}' not found — chat uses default-agent routing.`);
            this.cdrLocal.detectChanges();
        }
        catch (err) {
            LogError(`PSStudioResource.ensureModelDevAgentResolved: ${err instanceof Error ? err.message : String(err)}`);
        }
    }
    static ɵfac = /*@__PURE__*/ (() => { let ɵPSStudioResourceComponent_BaseFactory; return function PSStudioResourceComponent_Factory(__ngFactoryType__) { return (ɵPSStudioResourceComponent_BaseFactory || (ɵPSStudioResourceComponent_BaseFactory = i0.ɵɵgetInheritedFactory(PSStudioResourceComponent)))(__ngFactoryType__ || PSStudioResourceComponent); }; })();
    static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PSStudioResourceComponent, selectors: [["mj-ps-studio-resource"]], standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 4, vars: 2, consts: [["Subtitle", "Assemble features, train from the algorithm catalog, and run experiments", 3, "Title"], ["text", "Loading Studio\u2026", "size", "medium"], ["data-testid", "ps-studio-shell", 1, "ps-studio-host", 3, "chat-open"], ["data-testid", "ps-studio-shell", 1, "ps-studio-host"], [1, "ps-leftnav"], [1, "ps-content"], [3, "engine", "provider", "currentUser"], [3, "engine"], ["data-testid", "ps-studio-copilot", 1, "ps-copilot"], [1, "ps-nav-group"], [1, "ps-nav-item", 3, "active"], [1, "ps-nav-item", 3, "click"], [3, "navigate", "askAgent", "engine", "provider", "currentUser"], [3, "askAgent", "engine", "provider", "currentUser"], [3, "askAgent", "engine"], [1, "ps-copilot-head"], [1, "ps-copilot-title"], [1, "fa-solid", "fa-robot"], ["aria-label", "Close agent chat", 1, "ps-copilot-close", 3, "click"], [1, "fa-solid", "fa-xmark"], [1, "ps-copilot-body"], ["emptyStateGreeting", "Describe a prediction goal and I'll design the pipeline.", 3, "Provider", "environmentId", "currentUser", "conversation", "conversationId", "isNewConversation", "suppressNewConversationEmptyState", "allowMentions", "overlayMode", "showExportButton", "showShareButton", "showArtifactIndicator", "showAgentPicker", "showAgentModePicker", "defaultAgentId", "pendingMessage", "applicationScope", "applicationId", "appContext"], [1, "ps-copilot-empty"], ["emptyStateGreeting", "Describe a prediction goal and I'll design the pipeline.", 3, "conversationCreated", "pendingMessageConsumed", "Provider", "environmentId", "currentUser", "conversation", "conversationId", "isNewConversation", "suppressNewConversationEmptyState", "allowMentions", "overlayMode", "showExportButton", "showShareButton", "showArtifactIndicator", "showAgentPicker", "showAgentModePicker", "defaultAgentId", "pendingMessage", "applicationScope", "applicationId", "appContext"], ["text", "Connecting\u2026", "size", "small"]], template: function PSStudioResourceComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelement(0, "mj-page-header-interior", 0);
            i0.ɵɵelementStart(1, "mj-page-body-interior");
            i0.ɵɵconditionalCreate(2, PSStudioResourceComponent_Conditional_2_Template, 1, 0, "mj-loading", 1)(3, PSStudioResourceComponent_Conditional_3_Template, 11, 5, "div", 2);
            i0.ɵɵelementEnd();
        } if (rf & 2) {
            i0.ɵɵproperty("Title", ctx.activeLabel);
            i0.ɵɵadvance(2);
            i0.ɵɵconditional(ctx.isLoading ? 2 : 3);
        } }, dependencies: [i1.MJPageHeaderInteriorComponent, i1.MJPageBodyInteriorComponent, i2.LoadingComponent, i3.ConversationChatAreaComponent, i4.PSHomeComponent, i5.PSCatalogComponent, i6.PSPipelinesComponent, i7.PSExperimentsComponent, i8.PSCompareComponent], styles: ["[_nghost-%COMP%] { display: flex; flex-direction: column; width: 100%; height: 100%; min-height: 0; }\n      .ps-studio-host[_ngcontent-%COMP%] { display: flex; flex: 1; min-height: 0; overflow: hidden; }\n      .ps-leftnav[_ngcontent-%COMP%] { width: 210px; flex: none; border-right: 1px solid var(--mj-border-default); background: var(--mj-bg-surface-card); overflow-y: auto; padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }\n      .ps-nav-group[_ngcontent-%COMP%] { font-size: var(--mj-text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--mj-text-muted); padding: 12px 10px 4px; }\n      .ps-nav-item[_ngcontent-%COMP%] { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border: none; background: transparent; border-radius: var(--mj-radius-md); cursor: pointer; color: var(--mj-text-secondary); font-size: var(--mj-text-sm); font-weight: 500; transition: background .12s, color .12s; }\n      .ps-nav-item[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] { width: 18px; text-align: center; color: var(--mj-text-muted); }\n      .ps-nav-item[_ngcontent-%COMP%]:hover { background: var(--mj-bg-surface-hover); color: var(--mj-text-primary); }\n      .ps-nav-item.active[_ngcontent-%COMP%] { background: color-mix(in srgb, var(--mj-brand-primary) 12%, transparent); color: var(--mj-brand-primary); font-weight: 600; }\n      .ps-nav-item.active[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] { color: var(--mj-brand-primary); }\n      .ps-content[_ngcontent-%COMP%] { flex: 1; min-width: 0; overflow-y: auto; padding: 8px 14px 24px; }\n      .ps-copilot[_ngcontent-%COMP%] { width: 420px; max-width: 42vw; flex: none; border-left: 1px solid var(--mj-border-default); background: var(--mj-bg-surface); display: flex; flex-direction: column; min-height: 0; }\n      .ps-copilot-head[_ngcontent-%COMP%] { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--mj-border-default); }\n      .ps-copilot-title[_ngcontent-%COMP%] { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--mj-text-primary); }\n      .ps-copilot-title[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] { color: var(--mj-brand-primary); }\n      .ps-copilot-close[_ngcontent-%COMP%] { background: transparent; border: none; cursor: pointer; padding: 6px 8px; border-radius: 6px; color: var(--mj-text-muted); }\n      .ps-copilot-close[_ngcontent-%COMP%]:hover { background: var(--mj-bg-surface-hover); color: var(--mj-text-secondary); }\n      .ps-copilot-body[_ngcontent-%COMP%] { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }\n      .ps-copilot-body[_ngcontent-%COMP%]   mj-conversation-chat-area[_ngcontent-%COMP%] { flex: 1; min-height: 0; display: block; }\n      .ps-copilot-empty[_ngcontent-%COMP%] { display: flex; align-items: center; justify-content: center; flex: 1; }\n      @media (max-width: 1100px) { .ps-studio-host.chat-open[_ngcontent-%COMP%]   .ps-content[_ngcontent-%COMP%], .ps-studio-host.chat-open[_ngcontent-%COMP%]   .ps-leftnav[_ngcontent-%COMP%] { display: none; } .ps-copilot[_ngcontent-%COMP%] { width: 100%; max-width: none; border-left: none; } }"], changeDetection: 0 });
};
PSStudioResourceComponent = __decorate([
    RegisterClass(BaseResourceComponent, 'PredictiveStudioStudioResource')
], PSStudioResourceComponent);
export { PSStudioResourceComponent };
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PSStudioResourceComponent, [{
        type: Component,
        args: [{ standalone: false, selector: 'mj-ps-studio-resource', template: `
    <mj-page-header-interior [Title]="activeLabel"
      Subtitle="Assemble features, train from the algorithm catalog, and run experiments">
    </mj-page-header-interior>
    <mj-page-body-interior>
      @if (isLoading) {
        <mj-loading text="Loading Studio…" size="medium"></mj-loading>
      } @else {
        <div class="ps-studio-host" [class.chat-open]="chatOpen" data-testid="ps-studio-shell">
          <aside class="ps-leftnav">
            @for (group of groups; track group) {
              @if (group) { <div class="ps-nav-group">{{ group }}</div> }
              @for (item of itemsForGroup(group); track item.key) {
                <button class="ps-nav-item" [class.active]="activeSection === item.key"
                  [attr.data-testid]="'ps-nav-' + item.key" (click)="selectSection(item.key)">
                  <i [class]="item.icon"></i> <span>{{ item.label }}</span>
                </button>
              }
            }
          </aside>

          <section class="ps-content" [attr.data-testid]="'ps-panel-' + activeSection">
            @switch (activeSection) {
              @case ('home') { <ps-home [engine]="engine" [provider]="ProviderToUse" [currentUser]="ProviderToUse.CurrentUser" (navigate)="mapNavigate($event)" (askAgent)="onAskAgent($event)"></ps-home> }
              @case ('pipelines') { <ps-pipelines [engine]="engine" [provider]="ProviderToUse" [currentUser]="ProviderToUse.CurrentUser" (askAgent)="onAskAgent($event)"></ps-pipelines> }
              @case ('catalog') { <ps-catalog [engine]="engine" (askAgent)="onAskAgent($event)"></ps-catalog> }
              @case ('experiments') { <ps-experiments [engine]="engine" [provider]="ProviderToUse" [currentUser]="ProviderToUse.CurrentUser"></ps-experiments> }
              @case ('compare') { <ps-compare [engine]="engine"></ps-compare> }
            }
          </section>

          @if (chatOpen) {
            <aside class="ps-copilot" data-testid="ps-studio-copilot">
              <div class="ps-copilot-head">
                <div class="ps-copilot-title"><i class="fa-solid fa-robot"></i> Model Dev Agent</div>
                <button class="ps-copilot-close" (click)="closeChat()" aria-label="Close agent chat"><i class="fa-solid fa-xmark"></i></button>
              </div>
              <div class="ps-copilot-body">
                @if (currentUser) {
                  <mj-conversation-chat-area
                    [Provider]="Provider" [environmentId]="chatEnvironmentId" [currentUser]="currentUser"
                    [conversation]="chatConversation" [conversationId]="chatConversationId" [isNewConversation]="chatIsNewConversation"
                    [suppressNewConversationEmptyState]="true" [allowMentions]="false" [overlayMode]="true"
                    [showExportButton]="false" [showShareButton]="false" [showArtifactIndicator]="false"
                    [showAgentPicker]="false" [showAgentModePicker]="false"
                    [defaultAgentId]="modelDevAgentId" [pendingMessage]="pendingPrompt"
                    [applicationScope]="'Application'" [applicationId]="applicationId" [appContext]="chatAppContext"
                    (conversationCreated)="onChatConversationCreated($event)"
                    (pendingMessageConsumed)="onChatPendingMessageConsumed()"
                    emptyStateGreeting="Describe a prediction goal and I'll design the pipeline.">
                  </mj-conversation-chat-area>
                } @else { <div class="ps-copilot-empty"><mj-loading text="Connecting…" size="small"></mj-loading></div> }
              </div>
            </aside>
          }
        </div>
      }
    </mj-page-body-interior>
  `, changeDetection: ChangeDetectionStrategy.OnPush, styles: ["\n      :host { display: flex; flex-direction: column; width: 100%; height: 100%; min-height: 0; }\n      .ps-studio-host { display: flex; flex: 1; min-height: 0; overflow: hidden; }\n      .ps-leftnav { width: 210px; flex: none; border-right: 1px solid var(--mj-border-default); background: var(--mj-bg-surface-card); overflow-y: auto; padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }\n      .ps-nav-group { font-size: var(--mj-text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--mj-text-muted); padding: 12px 10px 4px; }\n      .ps-nav-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border: none; background: transparent; border-radius: var(--mj-radius-md); cursor: pointer; color: var(--mj-text-secondary); font-size: var(--mj-text-sm); font-weight: 500; transition: background .12s, color .12s; }\n      .ps-nav-item i { width: 18px; text-align: center; color: var(--mj-text-muted); }\n      .ps-nav-item:hover { background: var(--mj-bg-surface-hover); color: var(--mj-text-primary); }\n      .ps-nav-item.active { background: color-mix(in srgb, var(--mj-brand-primary) 12%, transparent); color: var(--mj-brand-primary); font-weight: 600; }\n      .ps-nav-item.active i { color: var(--mj-brand-primary); }\n      .ps-content { flex: 1; min-width: 0; overflow-y: auto; padding: 8px 14px 24px; }\n      .ps-copilot { width: 420px; max-width: 42vw; flex: none; border-left: 1px solid var(--mj-border-default); background: var(--mj-bg-surface); display: flex; flex-direction: column; min-height: 0; }\n      .ps-copilot-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--mj-border-default); }\n      .ps-copilot-title { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--mj-text-primary); }\n      .ps-copilot-title i { color: var(--mj-brand-primary); }\n      .ps-copilot-close { background: transparent; border: none; cursor: pointer; padding: 6px 8px; border-radius: 6px; color: var(--mj-text-muted); }\n      .ps-copilot-close:hover { background: var(--mj-bg-surface-hover); color: var(--mj-text-secondary); }\n      .ps-copilot-body { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }\n      .ps-copilot-body mj-conversation-chat-area { flex: 1; min-height: 0; display: block; }\n      .ps-copilot-empty { display: flex; align-items: center; justify-content: center; flex: 1; }\n      @media (max-width: 1100px) { .ps-studio-host.chat-open .ps-content, .ps-studio-host.chat-open .ps-leftnav { display: none; } .ps-copilot { width: 100%; max-width: none; border-left: none; } }\n    "] }]
    }], null, null); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PSStudioResourceComponent, { className: "PSStudioResourceComponent", filePath: "src/PredictiveStudio/resources/ps-studio-resource.component.ts", lineNumber: 124 }); })();
/** Tree-shaking prevention — called from the subpath module so the @RegisterClass survives bundling. */
export function LoadPSStudioResource() {
    // intentionally empty
}
//# sourceMappingURL=ps-studio-resource.component.js.map