/**
 * @fileoverview MCP Server Dialog Component
 *
 * Dialog for creating and editing MCP server configurations.
 */
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { Validators } from '@angular/forms';
import { Metadata, CompositeKey } from '@memberjunction/core';
import * as i0 from "@angular/core";
import * as i1 from "@angular/forms";
import * as i2 from "@memberjunction/ng-ui-components";
const _c0 = () => ["Active", "Inactive"];
const _c1 = () => ({ standalone: true });
function MCPServerDialogComponent_Conditional_0_Conditional_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 4);
    i0.ɵɵelement(1, "i", 34);
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1(" ", ctx_r1.ErrorMessage, " ");
} }
function MCPServerDialogComponent_Conditional_0_Conditional_13_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 11);
    i0.ɵɵtext(1, "Name is required");
    i0.ɵɵelementEnd();
} }
function MCPServerDialogComponent_Conditional_0_ng_template_32_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 35)(1, "span", 36);
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "span", 37);
    i0.ɵɵtext(4);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const dataItem_r3 = ctx.$implicit;
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(dataItem_r3.label);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(dataItem_r3.description);
} }
function MCPServerDialogComponent_Conditional_0_Conditional_34_Conditional_6_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 11);
    i0.ɵɵtext(1, "Server URL is required for this transport type");
    i0.ɵɵelementEnd();
} }
function MCPServerDialogComponent_Conditional_0_Conditional_34_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 7)(1, "label", 38);
    i0.ɵɵtext(2, "Server URL ");
    i0.ɵɵelementStart(3, "span", 9);
    i0.ɵɵtext(4, "*");
    i0.ɵɵelementEnd()();
    i0.ɵɵelement(5, "input", 39);
    i0.ɵɵconditionalCreate(6, MCPServerDialogComponent_Conditional_0_Conditional_34_Conditional_6_Template, 2, 0, "span", 11);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(6);
    i0.ɵɵconditional(ctx_r1.hasError("ServerURL", "required") ? 6 : -1);
} }
function MCPServerDialogComponent_Conditional_0_Conditional_35_Conditional_6_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 11);
    i0.ɵɵtext(1, "Command is required for Stdio transport");
    i0.ɵɵelementEnd();
} }
function MCPServerDialogComponent_Conditional_0_Conditional_35_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 7)(1, "label", 40);
    i0.ɵɵtext(2, "Command ");
    i0.ɵɵelementStart(3, "span", 9);
    i0.ɵɵtext(4, "*");
    i0.ɵɵelementEnd()();
    i0.ɵɵelement(5, "input", 41);
    i0.ɵɵconditionalCreate(6, MCPServerDialogComponent_Conditional_0_Conditional_35_Conditional_6_Template, 2, 0, "span", 11);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(7, "div", 7)(8, "label", 42);
    i0.ɵɵtext(9, "Command Arguments (JSON array)");
    i0.ɵɵelementEnd();
    i0.ɵɵelement(10, "input", 43);
    i0.ɵɵelementStart(11, "span", 30);
    i0.ɵɵtext(12, "JSON array of command line arguments");
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(6);
    i0.ɵɵconditional(ctx_r1.hasError("Command", "required") ? 6 : -1);
} }
function MCPServerDialogComponent_Conditional_0_ng_template_44_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 44)(1, "span", 45);
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "span", 46);
    i0.ɵɵtext(4);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const dataItem_r4 = ctx.$implicit;
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(dataItem_r4.label);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(dataItem_r4.description);
} }
function MCPServerDialogComponent_Conditional_0_Conditional_46_Conditional_10_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 11);
    i0.ɵɵtext(1, "OAuth Issuer URL is required for OAuth 2.0 authentication");
    i0.ɵɵelementEnd();
} }
function MCPServerDialogComponent_Conditional_0_Conditional_46_Template(rf, ctx) { if (rf & 1) {
    const _r5 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 21)(1, "h3");
    i0.ɵɵelement(2, "i", 47);
    i0.ɵɵtext(3, " OAuth 2.0 Configuration");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "div", 7)(5, "label", 48);
    i0.ɵɵtext(6, "OAuth Issuer URL ");
    i0.ɵɵelementStart(7, "span", 9);
    i0.ɵɵtext(8, "*");
    i0.ɵɵelementEnd()();
    i0.ɵɵelement(9, "input", 49);
    i0.ɵɵconditionalCreate(10, MCPServerDialogComponent_Conditional_0_Conditional_46_Conditional_10_Template, 2, 0, "span", 11);
    i0.ɵɵelementStart(11, "span", 30);
    i0.ɵɵtext(12, "The authorization server's issuer URL (e.g., https://login.microsoftonline.com/tenant-id or https://your-domain.auth0.com)");
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(13, "div", 7)(14, "label", 50);
    i0.ɵɵtext(15, "OAuth Scopes");
    i0.ɵɵelementEnd();
    i0.ɵɵelement(16, "input", 51);
    i0.ɵɵelementStart(17, "span", 30);
    i0.ɵɵtext(18, "Space-separated list of OAuth scopes to request");
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(19, "div", 7)(20, "label", 52);
    i0.ɵɵtext(21, "Metadata Cache TTL (minutes)");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(22, "mj-numeric-input", 53);
    i0.ɵɵlistener("ngModelChange", function MCPServerDialogComponent_Conditional_0_Conditional_46_Template_mj_numeric_input_ngModelChange_22_listener($event) { let tmp_5_0; i0.ɵɵrestoreView(_r5); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView((tmp_5_0 = ctx_r1.serverForm.get("OAuthMetadataCacheTTLMinutes")) == null ? null : tmp_5_0.setValue($event)); });
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(23, "span", 30);
    i0.ɵɵtext(24, "How long to cache OAuth metadata (default: 1440 minutes = 24 hours)");
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(25, "div", 54)(26, "h4");
    i0.ɵɵtext(27, "Pre-configured Client (Optional)");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(28, "p", 55);
    i0.ɵɵtext(29, "Leave blank to use Dynamic Client Registration (DCR). If the auth server doesn't support DCR, configure your client credentials here.");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(30, "div", 7)(31, "label", 56);
    i0.ɵɵtext(32, "Client ID");
    i0.ɵɵelementEnd();
    i0.ɵɵelement(33, "input", 57);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(34, "div", 7)(35, "label", 58);
    i0.ɵɵtext(36, "Client Secret");
    i0.ɵɵelementEnd();
    i0.ɵɵelement(37, "input", 59);
    i0.ɵɵelementStart(38, "span", 30);
    i0.ɵɵtext(39, "The secret will be encrypted before storage");
    i0.ɵɵelementEnd()()()();
} if (rf & 2) {
    let tmp_7_0;
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(10);
    i0.ɵɵconditional(ctx_r1.hasError("OAuthIssuerURL", "required") ? 10 : -1);
    i0.ɵɵadvance(12);
    i0.ɵɵproperty("Min", 5)("ngModelOptions", i0.ɵɵpureFunction0(4, _c1))("ngModel", (tmp_7_0 = ctx_r1.serverForm.get("OAuthMetadataCacheTTLMinutes")) == null ? null : tmp_7_0.value);
} }
function MCPServerDialogComponent_Conditional_0_Conditional_68_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 32);
} }
function MCPServerDialogComponent_Conditional_0_Template(rf, ctx) { if (rf & 1) {
    const _r1 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "mj-dialog", 2);
    i0.ɵɵlistener("Close", function MCPServerDialogComponent_Conditional_0_Template_mj_dialog_Close_0_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.cancel()); });
    i0.ɵɵelementStart(1, "form", 3);
    i0.ɵɵconditionalCreate(2, MCPServerDialogComponent_Conditional_0_Conditional_2_Template, 3, 1, "div", 4);
    i0.ɵɵelementStart(3, "div", 5)(4, "h3");
    i0.ɵɵelement(5, "i", 6);
    i0.ɵɵtext(6, " Basic Information");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(7, "div", 7)(8, "label", 8);
    i0.ɵɵtext(9, "Name ");
    i0.ɵɵelementStart(10, "span", 9);
    i0.ɵɵtext(11, "*");
    i0.ɵɵelementEnd()();
    i0.ɵɵelement(12, "input", 10);
    i0.ɵɵconditionalCreate(13, MCPServerDialogComponent_Conditional_0_Conditional_13_Template, 2, 0, "span", 11);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(14, "div", 7)(15, "label", 12);
    i0.ɵɵtext(16, "Description");
    i0.ɵɵelementEnd();
    i0.ɵɵelement(17, "textarea", 13);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(18, "div", 7)(19, "label", 14);
    i0.ɵɵtext(20, "Status");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(21, "mj-dropdown", 15);
    i0.ɵɵlistener("ValueChange", function MCPServerDialogComponent_Conditional_0_Template_mj_dropdown_ValueChange_21_listener($event) { let tmp_4_0; i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView((tmp_4_0 = ctx_r1.serverForm.get("Status")) == null ? null : tmp_4_0.setValue($event)); });
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(22, "div", 5)(23, "h3");
    i0.ɵɵelement(24, "i", 16);
    i0.ɵɵtext(25, " Transport Configuration");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(26, "div", 7)(27, "label", 17);
    i0.ɵɵtext(28, "Transport Type ");
    i0.ɵɵelementStart(29, "span", 9);
    i0.ɵɵtext(30, "*");
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(31, "mj-dropdown", 18);
    i0.ɵɵlistener("ValueChange", function MCPServerDialogComponent_Conditional_0_Template_mj_dropdown_ValueChange_31_listener($event) { let tmp_4_0; i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); (tmp_4_0 = ctx_r1.serverForm.get("TransportType")) == null ? null : tmp_4_0.setValue($event); return i0.ɵɵresetView(ctx_r1.onTransportTypeChange()); });
    i0.ɵɵtemplate(32, MCPServerDialogComponent_Conditional_0_ng_template_32_Template, 5, 2, "ng-template", null, 0, i0.ɵɵtemplateRefExtractor);
    i0.ɵɵelementEnd()();
    i0.ɵɵconditionalCreate(34, MCPServerDialogComponent_Conditional_0_Conditional_34_Template, 7, 1, "div", 7);
    i0.ɵɵconditionalCreate(35, MCPServerDialogComponent_Conditional_0_Conditional_35_Template, 13, 1);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(36, "div", 5)(37, "h3");
    i0.ɵɵelement(38, "i", 19);
    i0.ɵɵtext(39, " Authentication");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(40, "div", 7)(41, "label", 20);
    i0.ɵɵtext(42, "Default Auth Type");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(43, "mj-dropdown", 18);
    i0.ɵɵlistener("ValueChange", function MCPServerDialogComponent_Conditional_0_Template_mj_dropdown_ValueChange_43_listener($event) { let tmp_4_0; i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); (tmp_4_0 = ctx_r1.serverForm.get("DefaultAuthType")) == null ? null : tmp_4_0.setValue($event); return i0.ɵɵresetView(ctx_r1.onAuthTypeChange()); });
    i0.ɵɵtemplate(44, MCPServerDialogComponent_Conditional_0_ng_template_44_Template, 5, 2, "ng-template", null, 0, i0.ɵɵtemplateRefExtractor);
    i0.ɵɵelementEnd()()();
    i0.ɵɵconditionalCreate(46, MCPServerDialogComponent_Conditional_0_Conditional_46_Template, 40, 5, "div", 21);
    i0.ɵɵelementStart(47, "div", 5)(48, "h3");
    i0.ɵɵelement(49, "i", 22);
    i0.ɵɵtext(50, " Rate Limiting");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(51, "div", 23)(52, "div", 24)(53, "label", 25);
    i0.ɵɵtext(54, "Requests per Minute");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(55, "mj-numeric-input", 26);
    i0.ɵɵlistener("ngModelChange", function MCPServerDialogComponent_Conditional_0_Template_mj_numeric_input_ngModelChange_55_listener($event) { let tmp_4_0; i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView((tmp_4_0 = ctx_r1.serverForm.get("RateLimitPerMinute")) == null ? null : tmp_4_0.setValue($event)); });
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(56, "div", 24)(57, "label", 27);
    i0.ɵɵtext(58, "Requests per Hour");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(59, "mj-numeric-input", 26);
    i0.ɵɵlistener("ngModelChange", function MCPServerDialogComponent_Conditional_0_Template_mj_numeric_input_ngModelChange_59_listener($event) { let tmp_4_0; i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView((tmp_4_0 = ctx_r1.serverForm.get("RateLimitPerHour")) == null ? null : tmp_4_0.setValue($event)); });
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(60, "div", 7)(61, "label", 28);
    i0.ɵɵtext(62, "Request Timeout (ms)");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(63, "mj-numeric-input", 29);
    i0.ɵɵlistener("ngModelChange", function MCPServerDialogComponent_Conditional_0_Template_mj_numeric_input_ngModelChange_63_listener($event) { let tmp_4_0; i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView((tmp_4_0 = ctx_r1.serverForm.get("RequestTimeoutMs")) == null ? null : tmp_4_0.setValue($event)); });
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(64, "span", 30);
    i0.ɵɵtext(65, "Timeout for individual tool calls (1000-600000ms)");
    i0.ɵɵelementEnd()()()();
    i0.ɵɵelementStart(66, "mj-dialog-actions")(67, "button", 31);
    i0.ɵɵlistener("click", function MCPServerDialogComponent_Conditional_0_Template_button_click_67_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.save()); });
    i0.ɵɵconditionalCreate(68, MCPServerDialogComponent_Conditional_0_Conditional_68_Template, 1, 0, "i", 32);
    i0.ɵɵtext(69);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(70, "button", 33);
    i0.ɵɵlistener("click", function MCPServerDialogComponent_Conditional_0_Template_button_click_70_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.cancel()); });
    i0.ɵɵtext(71, "Cancel");
    i0.ɵɵelementEnd()()();
} if (rf & 2) {
    let tmp_12_0;
    let tmp_16_0;
    let tmp_22_0;
    let tmp_26_0;
    let tmp_29_0;
    let tmp_34_0;
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵproperty("Visible", true)("Title", ctx_r1.DialogTitle)("Width", 600);
    i0.ɵɵadvance();
    i0.ɵɵproperty("formGroup", ctx_r1.serverForm);
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r1.ErrorMessage ? 2 : -1);
    i0.ɵɵadvance(11);
    i0.ɵɵconditional(ctx_r1.hasError("Name", "required") ? 13 : -1);
    i0.ɵɵadvance(4);
    i0.ɵɵproperty("rows", 3);
    i0.ɵɵadvance(4);
    i0.ɵɵproperty("Data", i0.ɵɵpureFunction0(35, _c0))("ngModelOptions", i0.ɵɵpureFunction0(36, _c1))("ngModel", (tmp_12_0 = ctx_r1.serverForm.get("Status")) == null ? null : tmp_12_0.value);
    i0.ɵɵadvance(10);
    i0.ɵɵproperty("Data", ctx_r1.transportTypes)("ValuePrimitive", true)("ngModelOptions", i0.ɵɵpureFunction0(37, _c1))("ngModel", (tmp_16_0 = ctx_r1.serverForm.get("TransportType")) == null ? null : tmp_16_0.value);
    i0.ɵɵadvance(3);
    i0.ɵɵconditional(ctx_r1.RequiresURL ? 34 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r1.RequiresCommand ? 35 : -1);
    i0.ɵɵadvance(8);
    i0.ɵɵproperty("Data", ctx_r1.authTypes)("ValuePrimitive", true)("ngModelOptions", i0.ɵɵpureFunction0(38, _c1))("ngModel", (tmp_22_0 = ctx_r1.serverForm.get("DefaultAuthType")) == null ? null : tmp_22_0.value);
    i0.ɵɵadvance(3);
    i0.ɵɵconditional(ctx_r1.IsOAuth2 ? 46 : -1);
    i0.ɵɵadvance(9);
    i0.ɵɵproperty("Min", 0)("ngModelOptions", i0.ɵɵpureFunction0(39, _c1))("ngModel", (tmp_26_0 = ctx_r1.serverForm.get("RateLimitPerMinute")) == null ? null : tmp_26_0.value);
    i0.ɵɵadvance(4);
    i0.ɵɵproperty("Min", 0)("ngModelOptions", i0.ɵɵpureFunction0(40, _c1))("ngModel", (tmp_29_0 = ctx_r1.serverForm.get("RateLimitPerHour")) == null ? null : tmp_29_0.value);
    i0.ɵɵadvance(4);
    i0.ɵɵproperty("Min", 1000)("Max", 600000)("Step", 1000)("ngModelOptions", i0.ɵɵpureFunction0(41, _c1))("ngModel", (tmp_34_0 = ctx_r1.serverForm.get("RequestTimeoutMs")) == null ? null : tmp_34_0.value);
    i0.ɵɵadvance(4);
    i0.ɵɵproperty("disabled", ctx_r1.IsSaving);
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r1.IsSaving ? 68 : -1);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", ctx_r1.IsEditMode ? "Update" : "Create", " ");
} }
/**
 * Transport type options
 */
export const TRANSPORT_TYPES = [
    { value: 'StreamableHTTP', label: 'Streamable HTTP', description: 'HTTP-based transport with streaming support' },
    { value: 'SSE', label: 'Server-Sent Events', description: 'SSE-based transport for real-time updates' },
    { value: 'Stdio', label: 'Standard I/O', description: 'For local subprocess communication' },
    { value: 'WebSocket', label: 'WebSocket', description: 'Full-duplex WebSocket connection' }
];
/**
 * Auth type options
 */
export const AUTH_TYPES = [
    { value: 'None', label: 'None', description: 'No authentication required' },
    { value: 'Bearer', label: 'Bearer Token', description: 'Authorization header with Bearer token' },
    { value: 'APIKey', label: 'API Key', description: 'API key in custom header' },
    { value: 'OAuth2', label: 'OAuth 2.0', description: 'OAuth 2.0 authentication flow' },
    { value: 'Basic', label: 'Basic Auth', description: 'Username and password authentication' },
    { value: 'Custom', label: 'Custom', description: 'Custom authentication scheme' }
];
/**
 * MCP Server Dialog Component
 */
export class MCPServerDialogComponent {
    fb;
    cdr;
    server = null;
    visible = false;
    close = new EventEmitter();
    serverForm;
    transportTypes = TRANSPORT_TYPES;
    authTypes = AUTH_TYPES;
    IsSaving = false;
    ErrorMessage = null;
    get IsEditMode() {
        return !!this.server?.ID;
    }
    get DialogTitle() {
        return this.IsEditMode ? 'Edit MCP Server' : 'Add MCP Server';
    }
    get SelectedTransportType() {
        return this.serverForm?.get('TransportType')?.value ?? 'StreamableHTTP';
    }
    get RequiresURL() {
        const transport = this.SelectedTransportType;
        return transport === 'StreamableHTTP' || transport === 'SSE' || transport === 'WebSocket';
    }
    get RequiresCommand() {
        return this.SelectedTransportType === 'Stdio';
    }
    get SelectedAuthType() {
        return this.serverForm?.get('DefaultAuthType')?.value ?? 'None';
    }
    get IsOAuth2() {
        return this.SelectedAuthType === 'OAuth2';
    }
    constructor(fb, cdr) {
        this.fb = fb;
        this.cdr = cdr;
        this.serverForm = this.createForm();
    }
    ngOnInit() {
        this.initializeForm();
    }
    ngOnChanges(changes) {
        if (changes['server'] || changes['visible']) {
            if (this.visible) {
                this.initializeForm();
            }
        }
    }
    createForm() {
        return this.fb.group({
            Name: ['', [Validators.required, Validators.maxLength(200)]],
            Description: ['', Validators.maxLength(2000)],
            TransportType: ['StreamableHTTP', Validators.required],
            ServerURL: [''],
            Command: [''],
            CommandArgs: [''],
            DefaultAuthType: ['None', Validators.required],
            RateLimitPerMinute: [null, [Validators.min(0)]],
            RateLimitPerHour: [null, [Validators.min(0)]],
            RequestTimeoutMs: [60000, [Validators.min(1000), Validators.max(600000)]],
            Status: ['Active'],
            // OAuth configuration fields
            OAuthIssuerURL: [''],
            OAuthScopes: [''],
            OAuthMetadataCacheTTLMinutes: [1440, [Validators.min(5)]],
            OAuthClientID: [''],
            OAuthClientSecretEncrypted: ['']
        });
    }
    initializeForm() {
        if (this.server) {
            this.serverForm.patchValue({
                Name: this.server.Name,
                Description: this.server.Description ?? '',
                TransportType: this.server.TransportType,
                ServerURL: this.server.ServerURL ?? '',
                Command: this.server.Command ?? '',
                CommandArgs: '', // Would need to load from entity
                DefaultAuthType: this.server.DefaultAuthType,
                RateLimitPerMinute: this.server.RateLimitPerMinute,
                RateLimitPerHour: this.server.RateLimitPerHour,
                RequestTimeoutMs: 60000,
                Status: this.server.Status,
                // OAuth configuration fields
                OAuthIssuerURL: this.server.OAuthIssuerURL ?? '',
                OAuthScopes: this.server.OAuthScopes ?? '',
                OAuthMetadataCacheTTLMinutes: this.server.OAuthMetadataCacheTTLMinutes ?? 1440,
                OAuthClientID: this.server.OAuthClientID ?? '',
                OAuthClientSecretEncrypted: this.server.OAuthClientSecretEncrypted ?? ''
            });
        }
        else {
            this.serverForm.reset({
                Name: '',
                Description: '',
                TransportType: 'StreamableHTTP',
                ServerURL: '',
                Command: '',
                CommandArgs: '',
                DefaultAuthType: 'None',
                RateLimitPerMinute: null,
                RateLimitPerHour: null,
                RequestTimeoutMs: 60000,
                Status: 'Active',
                // OAuth configuration fields
                OAuthIssuerURL: '',
                OAuthScopes: '',
                OAuthMetadataCacheTTLMinutes: 1440,
                OAuthClientID: '',
                OAuthClientSecretEncrypted: ''
            });
        }
        this.ErrorMessage = null;
        this.updateValidators();
        this.cdr.detectChanges();
    }
    updateValidators() {
        const urlControl = this.serverForm.get('ServerURL');
        const commandControl = this.serverForm.get('Command');
        const oauthIssuerControl = this.serverForm.get('OAuthIssuerURL');
        if (this.RequiresURL) {
            urlControl?.setValidators([Validators.required]);
            commandControl?.clearValidators();
        }
        else if (this.RequiresCommand) {
            commandControl?.setValidators([Validators.required]);
            urlControl?.clearValidators();
        }
        else {
            urlControl?.clearValidators();
            commandControl?.clearValidators();
        }
        // OAuth2 requires an issuer URL
        if (this.IsOAuth2) {
            oauthIssuerControl?.setValidators([Validators.required]);
        }
        else {
            oauthIssuerControl?.clearValidators();
        }
        urlControl?.updateValueAndValidity();
        commandControl?.updateValueAndValidity();
        oauthIssuerControl?.updateValueAndValidity();
    }
    onTransportTypeChange() {
        this.updateValidators();
    }
    onAuthTypeChange() {
        this.updateValidators();
    }
    async save() {
        if (this.serverForm.invalid) {
            this.serverForm.markAllAsTouched();
            return;
        }
        this.IsSaving = true;
        this.ErrorMessage = null;
        this.cdr.detectChanges();
        try {
            const md = new Metadata();
            const entity = await md.GetEntityObject('MJ: MCP Servers');
            if (this.IsEditMode && this.server) {
                await entity.InnerLoad(new CompositeKey([{ FieldName: 'ID', Value: this.server.ID }]));
            }
            else {
                entity.NewRecord();
            }
            // Apply form values
            const formValue = this.serverForm.value;
            entity.Name = formValue.Name;
            entity.Description = formValue.Description || null;
            entity.TransportType = formValue.TransportType;
            entity.ServerURL = formValue.ServerURL || null;
            entity.Command = formValue.Command || null;
            entity.CommandArgs = formValue.CommandArgs || null;
            entity.DefaultAuthType = formValue.DefaultAuthType;
            entity.RateLimitPerMinute = formValue.RateLimitPerMinute || null;
            entity.RateLimitPerHour = formValue.RateLimitPerHour || null;
            entity.RequestTimeoutMs = formValue.RequestTimeoutMs || 60000;
            entity.Status = formValue.Status;
            // OAuth configuration fields (only set if OAuth2 is selected)
            if (formValue.DefaultAuthType === 'OAuth2') {
                entity.OAuthIssuerURL = formValue.OAuthIssuerURL || null;
                entity.OAuthScopes = formValue.OAuthScopes || null;
                entity.OAuthMetadataCacheTTLMinutes = formValue.OAuthMetadataCacheTTLMinutes || 1440;
                entity.OAuthClientID = formValue.OAuthClientID || null;
                entity.OAuthClientSecretEncrypted = formValue.OAuthClientSecretEncrypted || null;
            }
            else {
                // Clear OAuth fields when not using OAuth2
                entity.OAuthIssuerURL = null;
                entity.OAuthScopes = null;
                entity.OAuthMetadataCacheTTLMinutes = null;
                entity.OAuthClientID = null;
                entity.OAuthClientSecretEncrypted = null;
            }
            const saved = await entity.Save();
            if (!saved) {
                throw new Error('Failed to save server');
            }
            this.close.emit({ saved: true });
        }
        catch (error) {
            this.ErrorMessage = `Failed to save: ${error instanceof Error ? error.message : String(error)}`;
            this.cdr.detectChanges();
        }
        finally {
            this.IsSaving = false;
            this.cdr.detectChanges();
        }
    }
    cancel() {
        this.close.emit({ saved: false });
    }
    hasError(controlName, errorType) {
        const control = this.serverForm.get(controlName);
        return control?.hasError(errorType) && control?.touched || false;
    }
    static ɵfac = function MCPServerDialogComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MCPServerDialogComponent)(i0.ɵɵdirectiveInject(i1.FormBuilder), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
    static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: MCPServerDialogComponent, selectors: [["mj-mcp-server-dialog"]], inputs: { server: "server", visible: "visible" }, outputs: { close: "close" }, standalone: false, features: [i0.ɵɵNgOnChangesFeature], decls: 1, vars: 1, consts: [["mjDropdownItem", ""], [3, "Visible", "Title", "Width"], [3, "Close", "Visible", "Title", "Width"], [1, "server-form", 3, "formGroup"], [1, "error-banner"], [1, "form-section"], [1, "fa-solid", "fa-info-circle"], [1, "form-group"], ["for", "name"], [1, "required"], ["id", "name", "formControlName", "Name", "placeholder", "e.g., GitHub MCP Server", 1, "mj-input"], [1, "error-text"], ["for", "description"], ["id", "description", "formControlName", "Description", "placeholder", "Optional description of this server", 1, "mj-textarea", 3, "rows"], ["for", "status"], [3, "ValueChange", "Data", "ngModelOptions", "ngModel"], [1, "fa-solid", "fa-network-wired"], ["for", "transportType"], ["TextField", "label", "ValueField", "value", 3, "ValueChange", "Data", "ValuePrimitive", "ngModelOptions", "ngModel"], [1, "fa-solid", "fa-shield-halved"], ["for", "authType"], [1, "form-section", "oauth-section"], [1, "fa-solid", "fa-gauge-high"], [1, "form-row"], [1, "form-group", "half"], ["for", "rateLimitMinute"], ["Placeholder", "No limit", 3, "ngModelChange", "Min", "ngModelOptions", "ngModel"], ["for", "rateLimitHour"], ["for", "requestTimeout"], [3, "ngModelChange", "Min", "Max", "Step", "ngModelOptions", "ngModel"], [1, "hint"], ["mjButton", "", "variant", "primary", 3, "click", "disabled"], [1, "fa-solid", "fa-spinner", "fa-spin"], ["mjButton", "", 3, "click"], [1, "fa-solid", "fa-exclamation-triangle"], [1, "transport-option"], [1, "transport-label"], [1, "transport-desc"], ["for", "serverUrl"], ["id", "serverUrl", "formControlName", "ServerURL", "placeholder", "https://api.example.com/mcp", 1, "mj-input"], ["for", "command"], ["id", "command", "formControlName", "Command", "placeholder", "e.g., npx or /usr/local/bin/mcp-server", 1, "mj-input"], ["for", "commandArgs"], ["id", "commandArgs", "formControlName", "CommandArgs", "placeholder", "[\"arg1\", \"arg2\"]", 1, "mj-input"], [1, "auth-option"], [1, "auth-label"], [1, "auth-desc"], [1, "fa-solid", "fa-key"], ["for", "oauthIssuerUrl"], ["id", "oauthIssuerUrl", "formControlName", "OAuthIssuerURL", "placeholder", "https://auth.example.com", 1, "mj-input"], ["for", "oauthScopes"], ["id", "oauthScopes", "formControlName", "OAuthScopes", "placeholder", "openid profile email", 1, "mj-input"], ["for", "oauthCacheTtl"], ["Placeholder", "1440", 3, "ngModelChange", "Min", "ngModelOptions", "ngModel"], [1, "oauth-client-section"], [1, "section-hint"], ["for", "oauthClientId"], ["id", "oauthClientId", "formControlName", "OAuthClientID", "placeholder", "your-client-id", 1, "mj-input"], ["for", "oauthClientSecret"], ["id", "oauthClientSecret", "formControlName", "OAuthClientSecretEncrypted", "type", "password", "placeholder", "your-client-secret", 1, "mj-input"]], template: function MCPServerDialogComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵconditionalCreate(0, MCPServerDialogComponent_Conditional_0_Template, 72, 42, "mj-dialog", 1);
        } if (rf & 2) {
            i0.ɵɵconditional(ctx.visible ? 0 : -1);
        } }, dependencies: [i1.ɵNgNoValidate, i1.DefaultValueAccessor, i1.NgControlStatus, i1.NgControlStatusGroup, i1.NgModel, i1.FormGroupDirective, i1.FormControlName, i2.MJButtonDirective, i2.MJDialogComponent, i2.MJDialogActionsComponent, i2.MJDropdownComponent, i2.MJNumericInputComponent], styles: [".server-form[_ngcontent-%COMP%] {\n    display: flex;\n    flex-direction: column;\n    gap: 20px;\n}\n\n.error-banner[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    gap: 8px;\n    padding: 12px;\n    background: color-mix(in srgb, var(--mj-status-error) 10%, var(--mj-bg-surface));\n    border: 1px solid var(--mj-status-error);\n    border-radius: 6px;\n    color: var(--mj-status-error);\n    font-size: 14px;\n}\n\n.form-section[_ngcontent-%COMP%] {\n    border: 1px solid var(--mj-border-default);\n    border-radius: 8px;\n    padding: 16px;\n}\n\n.form-section[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    gap: 8px;\n    margin: 0 0 16px 0;\n    font-size: 14px;\n    font-weight: 600;\n    color: var(--mj-text-primary);\n}\n\n.form-section[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n    color: var(--mj-brand-primary);\n}\n\n.form-group[_ngcontent-%COMP%] {\n    margin-bottom: 16px;\n}\n\n.form-group[_ngcontent-%COMP%]:last-child {\n    margin-bottom: 0;\n}\n\n.form-group[_ngcontent-%COMP%]   label[_ngcontent-%COMP%] {\n    display: block;\n    margin-bottom: 6px;\n    font-size: 13px;\n    font-weight: 500;\n    color: var(--mj-text-primary);\n}\n\n.form-group[_ngcontent-%COMP%]   label[_ngcontent-%COMP%]   .required[_ngcontent-%COMP%] {\n    color: var(--mj-status-error);\n}\n\n.form-group[_ngcontent-%COMP%]   input[_ngcontent-%COMP%], \n.form-group[_ngcontent-%COMP%]   textarea[_ngcontent-%COMP%] {\n    width: 100%;\n}\n\n.form-group[_ngcontent-%COMP%]   .hint[_ngcontent-%COMP%] {\n    display: block;\n    margin-top: 4px;\n    font-size: 12px;\n    color: var(--mj-text-disabled);\n}\n\n.form-group[_ngcontent-%COMP%]   .error-text[_ngcontent-%COMP%] {\n    display: block;\n    margin-top: 4px;\n    font-size: 12px;\n    color: var(--mj-status-error);\n}\n\n.form-row[_ngcontent-%COMP%] {\n    display: flex;\n    gap: 16px;\n}\n\n.form-group.half[_ngcontent-%COMP%] {\n    flex: 1;\n}\n\n.transport-option[_ngcontent-%COMP%], \n.auth-option[_ngcontent-%COMP%] {\n    display: flex;\n    flex-direction: column;\n    padding: 4px 0;\n}\n\n.transport-label[_ngcontent-%COMP%], \n.auth-label[_ngcontent-%COMP%] {\n    font-weight: 500;\n    font-size: 14px;\n}\n\n.transport-desc[_ngcontent-%COMP%], \n.auth-desc[_ngcontent-%COMP%] {\n    font-size: 12px;\n    color: var(--mj-text-muted);\n}\n\n\n\n.oauth-section[_ngcontent-%COMP%] {\n    background-color: color-mix(in srgb, var(--mj-brand-primary) 4%, transparent);\n    border-color: color-mix(in srgb, var(--mj-brand-primary) 30%, transparent);\n}\n\n.oauth-section[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n    color: var(--mj-status-warning);\n}\n\n.oauth-client-section[_ngcontent-%COMP%] {\n    margin-top: 20px;\n    padding-top: 16px;\n    border-top: 1px dashed var(--mj-border-strong);\n}\n\n.oauth-client-section[_ngcontent-%COMP%]   h4[_ngcontent-%COMP%] {\n    margin: 0 0 8px 0;\n    font-size: 13px;\n    font-weight: 600;\n    color: var(--mj-text-primary);\n}\n\n.section-hint[_ngcontent-%COMP%] {\n    margin: 0 0 16px 0;\n    font-size: 12px;\n    color: var(--mj-text-muted);\n    font-style: italic;\n}\n\n\n\n[_nghost-%COMP%]     .k-dialog-actions {\n    padding: 16px;\n    border-top: 1px solid var(--mj-border-default);\n}\n\n[_nghost-%COMP%]     .k-dialog-content {\n    padding: 20px;\n    max-height: 70vh;\n    overflow-y: auto;\n}\n\n[_nghost-%COMP%]     .k-textbox, \n[_nghost-%COMP%]     .k-textarea, \n[_nghost-%COMP%]     .k-numerictextbox, \n[_nghost-%COMP%]     .k-dropdownlist {\n    width: 100%;\n}"] });
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MCPServerDialogComponent, [{
        type: Component,
        args: [{ standalone: false, selector: 'mj-mcp-server-dialog', template: "@if (visible) {\n  <mj-dialog\n    [Visible]=\"true\"\n    [Title]=\"DialogTitle\"\n    (Close)=\"cancel()\"\n    [Width]=\"600\">\n    <form [formGroup]=\"serverForm\" class=\"server-form\">\n      <!-- Error Message -->\n      @if (ErrorMessage) {\n        <div class=\"error-banner\">\n          <i class=\"fa-solid fa-exclamation-triangle\"></i>\n          {{ ErrorMessage }}\n        </div>\n      }\n      <!-- Basic Info Section -->\n      <div class=\"form-section\">\n        <h3><i class=\"fa-solid fa-info-circle\"></i> Basic Information</h3>\n        <div class=\"form-group\">\n          <label for=\"name\">Name <span class=\"required\">*</span></label>\n          <input class=\"mj-input\"\n            id=\"name\"\n            formControlName=\"Name\"\n            placeholder=\"e.g., GitHub MCP Server\" />\n          @if (hasError('Name', 'required')) {\n            <span class=\"error-text\">Name is required</span>\n          }\n        </div>\n        <div class=\"form-group\">\n          <label for=\"description\">Description</label>\n          <textarea class=\"mj-textarea\"\n            id=\"description\"\n            formControlName=\"Description\"\n            placeholder=\"Optional description of this server\"\n          [rows]=\"3\"></textarea>\n        </div>\n        <div class=\"form-group\">\n          <label for=\"status\">Status</label>\n          <mj-dropdown\n            [Data]=\"['Active', 'Inactive']\"\n            [ngModelOptions]=\"{standalone: true}\" [ngModel]=\"serverForm.get('Status')?.value\"\n            (ValueChange)=\"serverForm.get('Status')?.setValue($any($event))\">\n          </mj-dropdown>\n        </div>\n      </div>\n      <!-- Transport Section -->\n      <div class=\"form-section\">\n        <h3><i class=\"fa-solid fa-network-wired\"></i> Transport Configuration</h3>\n        <div class=\"form-group\">\n          <label for=\"transportType\">Transport Type <span class=\"required\">*</span></label>\n          <mj-dropdown\n            [Data]=\"transportTypes\"\n            TextField=\"label\"\n            ValueField=\"value\"\n            [ValuePrimitive]=\"true\"\n            [ngModelOptions]=\"{standalone: true}\" [ngModel]=\"serverForm.get('TransportType')?.value\"\n            (ValueChange)=\"serverForm.get('TransportType')?.setValue($any($event)); onTransportTypeChange()\">\n            <ng-template #mjDropdownItem let-dataItem>\n              <div class=\"transport-option\">\n                <span class=\"transport-label\">{{ dataItem.label }}</span>\n                <span class=\"transport-desc\">{{ dataItem.description }}</span>\n              </div>\n            </ng-template>\n          </mj-dropdown>\n        </div>\n        @if (RequiresURL) {\n          <div class=\"form-group\">\n            <label for=\"serverUrl\">Server URL <span class=\"required\">*</span></label>\n            <input class=\"mj-input\"\n              id=\"serverUrl\"\n              formControlName=\"ServerURL\"\n              placeholder=\"https://api.example.com/mcp\" />\n            @if (hasError('ServerURL', 'required')) {\n              <span class=\"error-text\">Server URL is required for this transport type</span>\n            }\n          </div>\n        }\n        @if (RequiresCommand) {\n          <div class=\"form-group\">\n            <label for=\"command\">Command <span class=\"required\">*</span></label>\n            <input class=\"mj-input\"\n              id=\"command\"\n              formControlName=\"Command\"\n              placeholder=\"e.g., npx or /usr/local/bin/mcp-server\" />\n            @if (hasError('Command', 'required')) {\n              <span class=\"error-text\">Command is required for Stdio transport</span>\n            }\n          </div>\n          <div class=\"form-group\">\n            <label for=\"commandArgs\">Command Arguments (JSON array)</label>\n            <input class=\"mj-input\"\n              id=\"commandArgs\"\n              formControlName=\"CommandArgs\"\n              placeholder='[\"arg1\", \"arg2\"]' />\n            <span class=\"hint\">JSON array of command line arguments</span>\n          </div>\n        }\n      </div>\n      <!-- Authentication Section -->\n      <div class=\"form-section\">\n        <h3><i class=\"fa-solid fa-shield-halved\"></i> Authentication</h3>\n        <div class=\"form-group\">\n          <label for=\"authType\">Default Auth Type</label>\n          <mj-dropdown\n            [Data]=\"authTypes\"\n            TextField=\"label\"\n            ValueField=\"value\"\n            [ValuePrimitive]=\"true\"\n            [ngModelOptions]=\"{standalone: true}\" [ngModel]=\"serverForm.get('DefaultAuthType')?.value\"\n            (ValueChange)=\"serverForm.get('DefaultAuthType')?.setValue($any($event)); onAuthTypeChange()\">\n            <ng-template #mjDropdownItem let-dataItem>\n              <div class=\"auth-option\">\n                <span class=\"auth-label\">{{ dataItem.label }}</span>\n                <span class=\"auth-desc\">{{ dataItem.description }}</span>\n              </div>\n            </ng-template>\n          </mj-dropdown>\n        </div>\n      </div>\n      <!-- OAuth 2.0 Configuration Section -->\n      @if (IsOAuth2) {\n        <div class=\"form-section oauth-section\">\n          <h3><i class=\"fa-solid fa-key\"></i> OAuth 2.0 Configuration</h3>\n          <div class=\"form-group\">\n            <label for=\"oauthIssuerUrl\">OAuth Issuer URL <span class=\"required\">*</span></label>\n            <input class=\"mj-input\"\n              id=\"oauthIssuerUrl\"\n              formControlName=\"OAuthIssuerURL\"\n              placeholder=\"https://auth.example.com\" />\n            @if (hasError('OAuthIssuerURL', 'required')) {\n              <span class=\"error-text\">OAuth Issuer URL is required for OAuth 2.0 authentication</span>\n            }\n            <span class=\"hint\">The authorization server's issuer URL (e.g., https://login.microsoftonline.com/tenant-id or https://your-domain.auth0.com)</span>\n          </div>\n          <div class=\"form-group\">\n            <label for=\"oauthScopes\">OAuth Scopes</label>\n            <input class=\"mj-input\"\n              id=\"oauthScopes\"\n              formControlName=\"OAuthScopes\"\n              placeholder=\"openid profile email\" />\n            <span class=\"hint\">Space-separated list of OAuth scopes to request</span>\n          </div>\n          <div class=\"form-group\">\n            <label for=\"oauthCacheTtl\">Metadata Cache TTL (minutes)</label>\n            <mj-numeric-input\n              [Min]=\"5\"\n              Placeholder=\"1440\"\n              [ngModelOptions]=\"{standalone: true}\" [ngModel]=\"serverForm.get('OAuthMetadataCacheTTLMinutes')?.value\"\n              (ngModelChange)=\"serverForm.get('OAuthMetadataCacheTTLMinutes')?.setValue($event)\">\n            </mj-numeric-input>\n            <span class=\"hint\">How long to cache OAuth metadata (default: 1440 minutes = 24 hours)</span>\n          </div>\n          <div class=\"oauth-client-section\">\n            <h4>Pre-configured Client (Optional)</h4>\n            <p class=\"section-hint\">Leave blank to use Dynamic Client Registration (DCR). If the auth server doesn't support DCR, configure your client credentials here.</p>\n            <div class=\"form-group\">\n              <label for=\"oauthClientId\">Client ID</label>\n              <input class=\"mj-input\"\n                id=\"oauthClientId\"\n                formControlName=\"OAuthClientID\"\n                placeholder=\"your-client-id\" />\n            </div>\n            <div class=\"form-group\">\n              <label for=\"oauthClientSecret\">Client Secret</label>\n              <input class=\"mj-input\"\n                id=\"oauthClientSecret\"\n                formControlName=\"OAuthClientSecretEncrypted\"\n                type=\"password\"\n                placeholder=\"your-client-secret\" />\n              <span class=\"hint\">The secret will be encrypted before storage</span>\n            </div>\n          </div>\n        </div>\n      }\n      <!-- Rate Limiting Section -->\n      <div class=\"form-section\">\n        <h3><i class=\"fa-solid fa-gauge-high\"></i> Rate Limiting</h3>\n        <div class=\"form-row\">\n          <div class=\"form-group half\">\n            <label for=\"rateLimitMinute\">Requests per Minute</label>\n            <mj-numeric-input\n              [Min]=\"0\"\n              Placeholder=\"No limit\"\n              [ngModelOptions]=\"{standalone: true}\" [ngModel]=\"serverForm.get('RateLimitPerMinute')?.value\"\n              (ngModelChange)=\"serverForm.get('RateLimitPerMinute')?.setValue($event)\">\n            </mj-numeric-input>\n          </div>\n          <div class=\"form-group half\">\n            <label for=\"rateLimitHour\">Requests per Hour</label>\n            <mj-numeric-input\n              [Min]=\"0\"\n              Placeholder=\"No limit\"\n              [ngModelOptions]=\"{standalone: true}\" [ngModel]=\"serverForm.get('RateLimitPerHour')?.value\"\n              (ngModelChange)=\"serverForm.get('RateLimitPerHour')?.setValue($event)\">\n            </mj-numeric-input>\n          </div>\n        </div>\n        <div class=\"form-group\">\n          <label for=\"requestTimeout\">Request Timeout (ms)</label>\n          <mj-numeric-input\n            [Min]=\"1000\"\n            [Max]=\"600000\"\n            [Step]=\"1000\"\n            [ngModelOptions]=\"{standalone: true}\" [ngModel]=\"serverForm.get('RequestTimeoutMs')?.value\"\n            (ngModelChange)=\"serverForm.get('RequestTimeoutMs')?.setValue($event)\">\n          </mj-numeric-input>\n          <span class=\"hint\">Timeout for individual tool calls (1000-600000ms)</span>\n        </div>\n      </div>\n    </form>\n    <mj-dialog-actions>\n      <button mjButton variant=\"primary\" (click)=\"save()\" [disabled]=\"IsSaving\">\n        @if (IsSaving) {\n          <i class=\"fa-solid fa-spinner fa-spin\"></i>\n        }\n        {{ IsEditMode ? 'Update' : 'Create' }}\n      </button>\n      <button mjButton (click)=\"cancel()\">Cancel</button>\n    </mj-dialog-actions>\n  </mj-dialog>\n}\n", styles: [".server-form {\n    display: flex;\n    flex-direction: column;\n    gap: 20px;\n}\n\n.error-banner {\n    display: flex;\n    align-items: center;\n    gap: 8px;\n    padding: 12px;\n    background: color-mix(in srgb, var(--mj-status-error) 10%, var(--mj-bg-surface));\n    border: 1px solid var(--mj-status-error);\n    border-radius: 6px;\n    color: var(--mj-status-error);\n    font-size: 14px;\n}\n\n.form-section {\n    border: 1px solid var(--mj-border-default);\n    border-radius: 8px;\n    padding: 16px;\n}\n\n.form-section h3 {\n    display: flex;\n    align-items: center;\n    gap: 8px;\n    margin: 0 0 16px 0;\n    font-size: 14px;\n    font-weight: 600;\n    color: var(--mj-text-primary);\n}\n\n.form-section h3 i {\n    color: var(--mj-brand-primary);\n}\n\n.form-group {\n    margin-bottom: 16px;\n}\n\n.form-group:last-child {\n    margin-bottom: 0;\n}\n\n.form-group label {\n    display: block;\n    margin-bottom: 6px;\n    font-size: 13px;\n    font-weight: 500;\n    color: var(--mj-text-primary);\n}\n\n.form-group label .required {\n    color: var(--mj-status-error);\n}\n\n.form-group input,\n.form-group textarea {\n    width: 100%;\n}\n\n.form-group .hint {\n    display: block;\n    margin-top: 4px;\n    font-size: 12px;\n    color: var(--mj-text-disabled);\n}\n\n.form-group .error-text {\n    display: block;\n    margin-top: 4px;\n    font-size: 12px;\n    color: var(--mj-status-error);\n}\n\n.form-row {\n    display: flex;\n    gap: 16px;\n}\n\n.form-group.half {\n    flex: 1;\n}\n\n.transport-option,\n.auth-option {\n    display: flex;\n    flex-direction: column;\n    padding: 4px 0;\n}\n\n.transport-label,\n.auth-label {\n    font-weight: 500;\n    font-size: 14px;\n}\n\n.transport-desc,\n.auth-desc {\n    font-size: 12px;\n    color: var(--mj-text-muted);\n}\n\n/* OAuth Section Styles */\n.oauth-section {\n    background-color: color-mix(in srgb, var(--mj-brand-primary) 4%, transparent);\n    border-color: color-mix(in srgb, var(--mj-brand-primary) 30%, transparent);\n}\n\n.oauth-section h3 i {\n    color: var(--mj-status-warning);\n}\n\n.oauth-client-section {\n    margin-top: 20px;\n    padding-top: 16px;\n    border-top: 1px dashed var(--mj-border-strong);\n}\n\n.oauth-client-section h4 {\n    margin: 0 0 8px 0;\n    font-size: 13px;\n    font-weight: 600;\n    color: var(--mj-text-primary);\n}\n\n.section-hint {\n    margin: 0 0 16px 0;\n    font-size: 12px;\n    color: var(--mj-text-muted);\n    font-style: italic;\n}\n\n/* Kendo overrides */\n:host ::ng-deep .k-dialog-actions {\n    padding: 16px;\n    border-top: 1px solid var(--mj-border-default);\n}\n\n:host ::ng-deep .k-dialog-content {\n    padding: 20px;\n    max-height: 70vh;\n    overflow-y: auto;\n}\n\n:host ::ng-deep .k-textbox,\n:host ::ng-deep .k-textarea,\n:host ::ng-deep .k-numerictextbox,\n:host ::ng-deep .k-dropdownlist {\n    width: 100%;\n}\n"] }]
    }], () => [{ type: i1.FormBuilder }, { type: i0.ChangeDetectorRef }], { server: [{
            type: Input
        }], visible: [{
            type: Input
        }], close: [{
            type: Output
        }] }); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MCPServerDialogComponent, { className: "MCPServerDialogComponent", filePath: "src/MCP/components/mcp-server-dialog.component.ts", lineNumber: 52 }); })();
//# sourceMappingURL=mcp-server-dialog.component.js.map