import { Component, ViewChild } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import { Subject, BehaviorSubject, takeUntil } from 'rxjs';
import { Metadata, RunView } from '@memberjunction/core';
import { MJNotificationService } from '@memberjunction/ng-notifications';
import * as i0 from "@angular/core";
import * as i1 from "@progress/kendo-angular-dialog";
import * as i2 from "../AIPrompts/ai-prompt-management.service";
import * as i3 from "@angular/forms";
import * as i4 from "@progress/kendo-angular-inputs";
import * as i5 from "@progress/kendo-angular-dropdowns";
import * as i6 from "@progress/kendo-angular-buttons";
import * as i7 from "../../shared/components/template-editor.component";
import * as i8 from "@angular/common";
const _c0 = ["templateEditor"];
const _c1 = () => ["Pending", "Active", "Disabled"];
const _c2 = () => ["string", "object"];
function CreatePromptDialogComponent_Conditional_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 2)(1, "div", 11);
    i0.ɵɵelement(2, "i", 12);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "p");
    i0.ɵɵtext(4, "Loading prompt creation form...");
    i0.ɵɵelementEnd()();
} }
function CreatePromptDialogComponent_Conditional_3_Conditional_11_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 20);
    i0.ɵɵelement(1, "i", 48);
    i0.ɵɵtext(2, " Name is required ");
    i0.ɵɵelementEnd();
} }
function CreatePromptDialogComponent_Conditional_3_Conditional_18_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 20);
    i0.ɵɵelement(1, "i", 48);
    i0.ɵɵtext(2, " Type is required ");
    i0.ɵɵelementEnd();
} }
function CreatePromptDialogComponent_Conditional_3_Conditional_53_Conditional_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "p", 51);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate(ctx_r1.templateEntity.Description);
} }
function CreatePromptDialogComponent_Conditional_3_Conditional_53_Template(rf, ctx) { if (rf & 1) {
    const _r1 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 46)(1, "div", 49)(2, "h5", 50);
    i0.ɵɵelement(3, "i", 28);
    i0.ɵɵtext(4);
    i0.ɵɵelementEnd();
    i0.ɵɵtemplate(5, CreatePromptDialogComponent_Conditional_3_Conditional_53_Conditional_5_Template, 2, 1, "p", 51);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(6, "div", 52)(7, "mj-template-editor", 53, 0);
    i0.ɵɵlistener("contentChange", function CreatePromptDialogComponent_Conditional_3_Conditional_53_Template_mj_template_editor_contentChange_7_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.onTemplateContentChange($event)); });
    i0.ɵɵelementEnd()()();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate1(" ", ctx_r1.templateEntity.Name, " ");
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r1.templateEntity.Description ? 5 : -1);
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("template", ctx_r1.templateEntity)("config", ctx_r1.templateEditorConfig);
} }
function CreatePromptDialogComponent_Conditional_3_Conditional_54_Conditional_9_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "p", 51);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate(ctx_r1.templateEntity.Description);
} }
function CreatePromptDialogComponent_Conditional_3_Conditional_54_Template(rf, ctx) { if (rf & 1) {
    const _r3 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 47)(1, "div", 54)(2, "div", 55)(3, "h5", 50);
    i0.ɵɵelement(4, "i", 45);
    i0.ɵɵtext(5);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(6, "span", 56);
    i0.ɵɵelement(7, "i", 18);
    i0.ɵɵtext(8, " Existing Template ");
    i0.ɵɵelementEnd()();
    i0.ɵɵtemplate(9, CreatePromptDialogComponent_Conditional_3_Conditional_54_Conditional_9_Template, 2, 1, "p", 51);
    i0.ɵɵelementStart(10, "div", 57)(11, "button", 58);
    i0.ɵɵlistener("click", function CreatePromptDialogComponent_Conditional_3_Conditional_54_Template_button_click_11_listener() { i0.ɵɵrestoreView(_r3); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.handleTemplateModeChange("existing")); });
    i0.ɵɵelement(12, "i", 59);
    i0.ɵɵtext(13, " Change Template ");
    i0.ɵɵelementEnd()()()();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(5);
    i0.ɵɵtextInterpolate1(" ", ctx_r1.templateEntity.Name, " ");
    i0.ɵɵadvance(4);
    i0.ɵɵconditional(ctx_r1.templateEntity.Description ? 9 : -1);
} }
function CreatePromptDialogComponent_Conditional_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "form", 3)(1, "div", 13)(2, "h4", 14);
    i0.ɵɵelement(3, "i", 7);
    i0.ɵɵtext(4, " Basic Information ");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "div", 15)(6, "div", 16)(7, "label", 17);
    i0.ɵɵelement(8, "i", 18);
    i0.ɵɵtext(9, " Name ");
    i0.ɵɵelementEnd();
    i0.ɵɵelement(10, "kendo-textbox", 19);
    i0.ɵɵtemplate(11, CreatePromptDialogComponent_Conditional_3_Conditional_11_Template, 3, 0, "div", 20);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(12, "div", 16)(13, "label", 21);
    i0.ɵɵelement(14, "i", 22);
    i0.ɵɵtext(15, " Type ");
    i0.ɵɵelementEnd();
    i0.ɵɵelement(16, "kendo-dropdownlist", 23);
    i0.ɵɵpipe(17, "async");
    i0.ɵɵtemplate(18, CreatePromptDialogComponent_Conditional_3_Conditional_18_Template, 3, 0, "div", 20);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(19, "div", 16)(20, "label", 24);
    i0.ɵɵelement(21, "i", 25);
    i0.ɵɵtext(22, " Status ");
    i0.ɵɵelementEnd();
    i0.ɵɵelement(23, "kendo-dropdownlist", 26);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(24, "div", 16)(25, "label", 27);
    i0.ɵɵelement(26, "i", 28);
    i0.ɵɵtext(27, " Output Type ");
    i0.ɵɵelementEnd();
    i0.ɵɵelement(28, "kendo-dropdownlist", 29);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(29, "div", 30)(30, "label", 31);
    i0.ɵɵelement(31, "i", 32);
    i0.ɵɵtext(32, " Description ");
    i0.ɵɵelementEnd();
    i0.ɵɵelement(33, "kendo-textarea", 33);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(34, "div", 13)(35, "h4", 14);
    i0.ɵɵelement(36, "i", 34);
    i0.ɵɵtext(37, " Template Configuration ");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(38, "div", 35)(39, "label", 36);
    i0.ɵɵelement(40, "i", 37);
    i0.ɵɵtext(41, " Template Mode ");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(42, "div", 38)(43, "div", 39);
    i0.ɵɵelement(44, "input", 40);
    i0.ɵɵelementStart(45, "label", 41);
    i0.ɵɵelement(46, "i", 42);
    i0.ɵɵtext(47, " Create New Template ");
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(48, "div", 39);
    i0.ɵɵelement(49, "input", 43);
    i0.ɵɵelementStart(50, "label", 44);
    i0.ɵɵelement(51, "i", 45);
    i0.ɵɵtext(52, " Link Existing Template ");
    i0.ɵɵelementEnd()()()();
    i0.ɵɵtemplate(53, CreatePromptDialogComponent_Conditional_3_Conditional_53_Template, 9, 4, "div", 46)(54, CreatePromptDialogComponent_Conditional_3_Conditional_54_Template, 14, 2, "div", 47);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    let tmp_2_0;
    let tmp_5_0;
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵproperty("formGroup", ctx_r1.promptForm);
    i0.ɵɵadvance(11);
    i0.ɵɵconditional(((tmp_2_0 = ctx_r1.promptForm.get("name")) == null ? null : tmp_2_0.invalid) && ((tmp_2_0 = ctx_r1.promptForm.get("name")) == null ? null : tmp_2_0.touched) ? 11 : -1);
    i0.ɵɵadvance(5);
    i0.ɵɵproperty("data", i0.ɵɵpipeBind1(17, 12, ctx_r1.availablePromptTypes$))("valuePrimitive", true);
    i0.ɵɵadvance(2);
    i0.ɵɵconditional(((tmp_5_0 = ctx_r1.promptForm.get("typeID")) == null ? null : tmp_5_0.invalid) && ((tmp_5_0 = ctx_r1.promptForm.get("typeID")) == null ? null : tmp_5_0.touched) ? 18 : -1);
    i0.ɵɵadvance(5);
    i0.ɵɵproperty("data", i0.ɵɵpureFunction0(14, _c1))("valuePrimitive", true);
    i0.ɵɵadvance(5);
    i0.ɵɵproperty("data", i0.ɵɵpureFunction0(15, _c2))("valuePrimitive", true);
    i0.ɵɵadvance(5);
    i0.ɵɵproperty("rows", 3);
    i0.ɵɵadvance(20);
    i0.ɵɵconditional(ctx_r1.showTemplateEditor && ctx_r1.templateEntity && ctx_r1.templateMode === "new" ? 53 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r1.templateEntity && ctx_r1.templateMode === "existing" ? 54 : -1);
} }
function CreatePromptDialogComponent_Conditional_8_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵtext(0, " Created prompts and templates will be saved when you save the AI Agent ");
} }
function CreatePromptDialogComponent_Conditional_9_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵtext(0, " Created prompt will be linked to existing template when you save the AI Agent ");
} }
function CreatePromptDialogComponent_Conditional_16_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 60);
    i0.ɵɵtext(1, " Creating... ");
} }
function CreatePromptDialogComponent_Conditional_18_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 61);
    i0.ɵɵtext(1, " Create Prompt ");
} }
/**
 * Dialog for creating new AI Prompts with essential fields and basic template editing.
 * Creates entities but does not save them - returns entities for parent to add to PendingRecords.
 * This ensures atomicity with the parent form's save operation.
 */
export class CreatePromptDialogComponent {
    constructor(dialogRef, cdr, aiPromptManagementService) {
        this.dialogRef = dialogRef;
        this.cdr = cdr;
        this.aiPromptManagementService = aiPromptManagementService;
        // Configuration
        this.config = {};
        // State management
        this.destroy$ = new Subject();
        this.result = new Subject();
        this.isLoading$ = new BehaviorSubject(false);
        this.isSaving$ = new BehaviorSubject(false);
        // Data
        this.availablePromptTypes$ = new BehaviorSubject([]);
        // Entities (not saved to database)
        this.promptEntity = null;
        this.templateEntity = null;
        this.templateContents = [];
        this.showTemplateEditor = false;
        this.templateEditorConfig = {
            allowEdit: true,
            showRunButton: false,
            compactMode: true // Compact mode for dialog
        };
        // Template state
        this.templateMode = 'new';
        this.promptForm = this.createForm();
    }
    ngOnInit() {
        this.loadInitialData();
        this.setupFormWatching();
    }
    ngOnDestroy() {
        this.destroy$.next();
        this.destroy$.complete();
    }
    createForm() {
        return new FormGroup({
            name: new FormControl(this.config.initialName || '', [Validators.required]),
            description: new FormControl(''),
            typeID: new FormControl(this.config.initialTypeID || '', [Validators.required]),
            status: new FormControl('Pending'),
            outputType: new FormControl('string'),
            templateMode: new FormControl('new')
        });
    }
    setupFormWatching() {
        // Watch template mode changes
        this.promptForm.get('templateMode')?.valueChanges
            .pipe(takeUntil(this.destroy$))
            .subscribe(mode => {
            this.templateMode = mode;
            this.handleTemplateModeChange(mode);
        });
    }
    async loadInitialData() {
        this.isLoading$.next(true);
        try {
            // Load prompt types
            const rv = new RunView();
            const typesResult = await rv.RunView({
                EntityName: 'AI Prompt Types',
                OrderBy: 'Name ASC',
                ResultType: 'entity_object'
            });
            if (typesResult.Success && typesResult.Results) {
                this.availablePromptTypes$.next(typesResult.Results);
                // Set default type if not specified
                if (!this.config.initialTypeID && typesResult.Results.length > 0) {
                    this.promptForm.patchValue({ typeID: typesResult.Results[0].ID });
                }
            }
            // Create the prompt entity
            const md = new Metadata();
            this.promptEntity = await md.GetEntityObject('AI Prompts');
            this.promptEntity.NewRecord();
            // Set default values
            this.promptEntity.Status = 'Pending';
            this.promptEntity.OutputType = 'string';
            this.promptEntity.ValidationBehavior = 'None';
            this.promptEntity.EnableCaching = false;
            // Create default template since it's required
            await this.createNewTemplate();
            this.showTemplateEditor = true;
        }
        catch (error) {
            console.error('Error loading prompt creation data:', error);
            MJNotificationService.Instance.CreateSimpleNotification('Error loading data for prompt creation', 'error', 3000);
        }
        finally {
            this.isLoading$.next(false);
        }
    }
    async handleTemplateModeChange(mode) {
        if (mode === 'new') {
            await this.createNewTemplate();
            this.showTemplateEditor = true;
        }
        else if (mode === 'existing') {
            await this.openTemplateSelector();
        }
        this.cdr.detectChanges();
    }
    async createNewTemplate() {
        if (!this.promptEntity)
            return;
        try {
            const md = new Metadata();
            // Create template entity
            this.templateEntity = await md.GetEntityObject('Templates');
            this.templateEntity.NewRecord();
            const promptName = this.promptForm.get('name')?.value || 'New Prompt';
            this.templateEntity.Name = `${promptName} Template`;
            this.templateEntity.Description = `Template for ${promptName}`;
            // Set UserID on template (required field)
            this.templateEntity.UserID = md.CurrentUser.ID;
            // Link template to prompt
            this.promptEntity.TemplateID = this.templateEntity.ID;
        }
        catch (error) {
            console.error('Error creating new template:', error);
            MJNotificationService.Instance.CreateSimpleNotification('Error creating template', 'error', 3000);
        }
    }
    onTemplateContentChange(contents) {
        this.templateContents = contents || [];
    }
    async save() {
        if (!this.promptForm.valid || !this.promptEntity) {
            MJNotificationService.Instance.CreateSimpleNotification('Please fill in all required fields', 'warning', 3000);
            return;
        }
        this.isSaving$.next(true);
        try {
            // Update prompt entity with form values
            const formValue = this.promptForm.value;
            this.promptEntity.Name = formValue.name;
            this.promptEntity.Description = formValue.description || '';
            this.promptEntity.TypeID = formValue.typeID;
            this.promptEntity.Status = formValue.status;
            this.promptEntity.OutputType = formValue.outputType;
            // Get template contents if template editor is active
            if (this.templateEditor && this.showTemplateEditor) {
                // Get the template contents from the editor without saving
                // The parent form will handle saving in the proper order
                this.templateContents = this.templateEditor.templateContents || [];
                // Ensure the template contents have the correct TemplateID
                if (this.templateContents && this.templateEntity) {
                    this.templateContents.forEach(content => {
                        content.TemplateID = this.templateEntity.ID;
                    });
                }
            }
            // Return the created entities (not saved to database)
            const result = {
                prompt: this.promptEntity,
                template: this.templateEntity || undefined,
                templateContents: this.templateContents.length > 0 ? this.templateContents : undefined
            };
            this.result.next(result);
            this.dialogRef.close();
        }
        catch (error) {
            console.error('Error preparing prompt for creation:', error);
            MJNotificationService.Instance.CreateSimpleNotification('Error preparing prompt for creation', 'error', 3000);
        }
        finally {
            this.isSaving$.next(false);
        }
    }
    cancel() {
        this.result.next(null);
        this.dialogRef.close();
    }
    /**
     * Opens the template selector dialog to link an existing template
     */
    async openTemplateSelector() {
        const config = {
            title: 'Select Template for AI Prompt',
            showCreateNew: false,
            multiSelect: false,
            showActiveOnly: true
        };
        try {
            const result = await this.aiPromptManagementService.openTemplateSelectorDialog(config).toPromise();
            if (result && result.selectedTemplates && result.selectedTemplates.length > 0) {
                // Link the selected template
                this.templateEntity = result.selectedTemplates[0];
                this.promptEntity.TemplateID = this.templateEntity.ID;
                // Update UI to show selected template info
                this.showTemplateEditor = false;
                MJNotificationService.Instance.CreateSimpleNotification(`Template "${this.templateEntity.Name}" linked successfully`, 'success', 3000);
            }
            else {
                // User cancelled, revert to new template mode
                this.promptForm.patchValue({ templateMode: 'new' });
                await this.createNewTemplate();
                this.showTemplateEditor = true;
            }
        }
        catch (error) {
            console.error('Error opening template selector:', error);
            MJNotificationService.Instance.CreateSimpleNotification('Error opening template selector', 'error', 3000);
            // Revert to new template mode
            this.promptForm.patchValue({ templateMode: 'new' });
            await this.createNewTemplate();
            this.showTemplateEditor = true;
        }
    }
    // Getter for template debugging
    get currentTemplate() {
        return this.templateEntity;
    }
    static { this.ɵfac = function CreatePromptDialogComponent_Factory(t) { return new (t || CreatePromptDialogComponent)(i0.ɵɵdirectiveInject(i1.WindowRef), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(i2.AIPromptManagementService)); }; }
    static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CreatePromptDialogComponent, selectors: [["mj-create-prompt-dialog"]], viewQuery: function CreatePromptDialogComponent_Query(rf, ctx) { if (rf & 1) {
            i0.ɵɵviewQuery(_c0, 5);
        } if (rf & 2) {
            let _t;
            i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.templateEditor = _t.first);
        } }, decls: 19, vars: 13, consts: [["templateEditor", ""], [1, "create-prompt-dialog"], [1, "loading-state"], [1, "dialog-content", 3, "formGroup"], [1, "dialog-footer"], [1, "footer-left"], [1, "form-hint"], [1, "fa-solid", "fa-info-circle"], [1, "footer-right"], ["kendoButton", "", "look", "outline", 3, "click", "disabled"], ["kendoButton", "", "themeColor", "primary", 3, "click", "disabled"], [1, "loading-spinner"], [1, "fa-solid", "fa-spinner", "fa-spin", "fa-2x"], [1, "form-section"], [1, "section-title"], [1, "form-grid"], [1, "form-field"], ["for", "promptName", 1, "field-label", "required"], [1, "fa-solid", "fa-tag"], ["id", "promptName", "formControlName", "name", "placeholder", "Enter prompt name...", 1, "full-width"], [1, "field-error"], ["for", "promptType", 1, "field-label", "required"], [1, "fa-solid", "fa-category"], ["id", "promptType", "formControlName", "typeID", "textField", "Name", "valueField", "ID", "placeholder", "Select prompt type...", 1, "full-width", 3, "data", "valuePrimitive"], ["for", "promptStatus", 1, "field-label"], [1, "fa-solid", "fa-toggle-on"], ["id", "promptStatus", "formControlName", "status", 1, "full-width", 3, "data", "valuePrimitive"], ["for", "outputType", 1, "field-label"], [1, "fa-solid", "fa-file-code"], ["id", "outputType", "formControlName", "outputType", 1, "full-width", 3, "data", "valuePrimitive"], [1, "form-field", "full-width"], ["for", "promptDescription", 1, "field-label"], [1, "fa-solid", "fa-align-left"], ["id", "promptDescription", "formControlName", "description", "placeholder", "Enter prompt description (optional)...", 1, "full-width", 3, "rows"], [1, "fa-solid", "fa-file-alt"], [1, "template-mode-section"], [1, "field-label"], [1, "fa-solid", "fa-cog"], [1, "template-mode-options"], [1, "radio-option"], ["type", "radio", "id", "templateNew", "value", "new", "formControlName", "templateMode", 1, "radio-input"], ["for", "templateNew", 1, "radio-label"], [1, "fa-solid", "fa-plus-circle"], ["type", "radio", "id", "templateExisting", "value", "existing", "formControlName", "templateMode", 1, "radio-input"], ["for", "templateExisting", 1, "radio-label"], [1, "fa-solid", "fa-link"], [1, "template-editor-section"], [1, "existing-template-section"], [1, "fa-solid", "fa-exclamation-triangle"], [1, "template-info"], [1, "template-name"], [1, "template-description"], [1, "template-editor-container"], [3, "contentChange", "template", "config"], [1, "existing-template-info"], [1, "template-header"], [1, "template-type-badge"], [1, "template-actions"], ["kendoButton", "", "look", "outline", "size", "small", 3, "click"], [1, "fa-solid", "fa-sync"], [1, "fa-solid", "fa-spinner", "fa-spin"], [1, "fa-solid", "fa-plus"]], template: function CreatePromptDialogComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelementStart(0, "div", 1);
            i0.ɵɵtemplate(1, CreatePromptDialogComponent_Conditional_1_Template, 5, 0, "div", 2);
            i0.ɵɵpipe(2, "async");
            i0.ɵɵtemplate(3, CreatePromptDialogComponent_Conditional_3_Template, 55, 16, "form", 3);
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(4, "div", 4)(5, "div", 5)(6, "span", 6);
            i0.ɵɵelement(7, "i", 7);
            i0.ɵɵtemplate(8, CreatePromptDialogComponent_Conditional_8_Template, 1, 0)(9, CreatePromptDialogComponent_Conditional_9_Template, 1, 0);
            i0.ɵɵelementEnd()();
            i0.ɵɵelementStart(10, "div", 8)(11, "button", 9);
            i0.ɵɵpipe(12, "async");
            i0.ɵɵlistener("click", function CreatePromptDialogComponent_Template_button_click_11_listener() { return ctx.cancel(); });
            i0.ɵɵtext(13, " Cancel ");
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(14, "button", 10);
            i0.ɵɵpipe(15, "async");
            i0.ɵɵlistener("click", function CreatePromptDialogComponent_Template_button_click_14_listener() { return ctx.save(); });
            i0.ɵɵtemplate(16, CreatePromptDialogComponent_Conditional_16_Template, 2, 0);
            i0.ɵɵpipe(17, "async");
            i0.ɵɵtemplate(18, CreatePromptDialogComponent_Conditional_18_Template, 2, 0);
            i0.ɵɵelementEnd()()();
        } if (rf & 2) {
            i0.ɵɵadvance();
            i0.ɵɵconditional(i0.ɵɵpipeBind1(2, 5, ctx.isLoading$) ? 1 : 3);
            i0.ɵɵadvance(7);
            i0.ɵɵconditional(ctx.templateMode === "new" ? 8 : 9);
            i0.ɵɵadvance(3);
            i0.ɵɵproperty("disabled", i0.ɵɵpipeBind1(12, 7, ctx.isSaving$) || false);
            i0.ɵɵadvance(3);
            i0.ɵɵproperty("disabled", !ctx.promptForm.valid || (i0.ɵɵpipeBind1(15, 9, ctx.isSaving$) || false));
            i0.ɵɵadvance(2);
            i0.ɵɵconditional(i0.ɵɵpipeBind1(17, 11, ctx.isSaving$) ? 16 : 18);
        } }, dependencies: [i3.ɵNgNoValidate, i3.DefaultValueAccessor, i3.RadioControlValueAccessor, i3.NgControlStatus, i3.NgControlStatusGroup, i3.FormGroupDirective, i3.FormControlName, i4.TextAreaComponent, i4.TextBoxComponent, i5.DropDownListComponent, i6.ButtonComponent, i7.TemplateEditorComponent, i8.AsyncPipe], styles: ["\n\n.create-prompt-dialog[_ngcontent-%COMP%] {\n  padding: 0;\n  min-height: 400px;\n  display: flex;\n  flex-direction: column;\n}\n\n\n\n[_nghost-%COMP%]     .k-dialog, \n[_nghost-%COMP%]     .k-window {\n  z-index: 10000 !important;\n}\n\n[_nghost-%COMP%]     .k-overlay {\n  z-index: 9999 !important;\n}\n\n\n\n.loading-state[_ngcontent-%COMP%] {\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  justify-content: center;\n  padding: 60px 20px;\n  text-align: center;\n}\n\n.loading-spinner[_ngcontent-%COMP%] {\n  margin-bottom: 16px;\n  color: var(--kendo-color-primary, #0078d4);\n}\n\n\n\n.dialog-content[_ngcontent-%COMP%] {\n  flex: 1;\n  padding: 20px;\n  overflow-y: auto;\n  max-height: 70vh;\n}\n\n\n\n.form-section[_ngcontent-%COMP%] {\n  margin-bottom: 24px;\n  border: 1px solid var(--kendo-color-border, #e0e0e0);\n  border-radius: 6px;\n  padding: 16px;\n  background: var(--kendo-color-surface-alt, #fafafa);\n}\n\n.section-title[_ngcontent-%COMP%] {\n  margin: 0 0 16px 0;\n  font-size: 14px;\n  font-weight: 600;\n  color: var(--kendo-color-on-app-surface, #323130);\n  display: flex;\n  align-items: center;\n  gap: 8px;\n}\n\n.section-title[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n  color: var(--kendo-color-primary, #0078d4);\n}\n\n\n\n.form-grid[_ngcontent-%COMP%] {\n  display: grid;\n  grid-template-columns: 1fr 1fr;\n  gap: 16px;\n  margin-bottom: 16px;\n}\n\n.form-field[_ngcontent-%COMP%] {\n  display: flex;\n  flex-direction: column;\n  gap: 6px;\n}\n\n.form-field.full-width[_ngcontent-%COMP%] {\n  grid-column: 1 / -1;\n}\n\n\n\n.field-label[_ngcontent-%COMP%] {\n  font-size: 13px;\n  font-weight: 500;\n  color: var(--kendo-color-on-app-surface, #323130);\n  display: flex;\n  align-items: center;\n  gap: 6px;\n}\n\n.field-label.required[_ngcontent-%COMP%]::after {\n  content: '*';\n  color: var(--kendo-color-error, #d13438);\n  margin-left: 2px;\n}\n\n.field-label[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n  font-size: 11px;\n  color: var(--kendo-color-subtle, #605e5c);\n}\n\n\n\n.full-width[_ngcontent-%COMP%] {\n  width: 100%;\n}\n\n\n\n.field-error[_ngcontent-%COMP%] {\n  display: flex;\n  align-items: center;\n  gap: 4px;\n  font-size: 12px;\n  color: var(--kendo-color-error, #d13438);\n  margin-top: 4px;\n}\n\n.field-error[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n  font-size: 11px;\n}\n\n\n\n.template-mode-section[_ngcontent-%COMP%] {\n  margin-bottom: 16px;\n}\n\n.template-mode-options[_ngcontent-%COMP%] {\n  display: flex;\n  gap: 16px;\n  margin-top: 8px;\n  flex-wrap: wrap;\n}\n\n.radio-option[_ngcontent-%COMP%] {\n  display: flex;\n  align-items: center;\n  gap: 6px;\n}\n\n.radio-input[_ngcontent-%COMP%] {\n  margin: 0;\n}\n\n.radio-label[_ngcontent-%COMP%] {\n  font-size: 13px;\n  cursor: pointer;\n  display: flex;\n  align-items: center;\n  gap: 6px;\n  padding: 4px 8px;\n  border-radius: 4px;\n  transition: background-color 0.2s ease;\n}\n\n.radio-label[_ngcontent-%COMP%]:hover {\n  background-color: var(--kendo-color-base-hover, #f3f2f1);\n}\n\n.radio-label[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n  font-size: 12px;\n  color: var(--kendo-color-subtle, #605e5c);\n}\n\n\n\n.template-editor-section[_ngcontent-%COMP%] {\n  margin-top: 16px;\n  padding: 16px;\n  border: 1px solid var(--kendo-color-border, #e0e0e0);\n  border-radius: 4px;\n  background: var(--kendo-color-app-surface, #ffffff);\n}\n\n.template-info[_ngcontent-%COMP%] {\n  margin-bottom: 12px;\n}\n\n.template-name[_ngcontent-%COMP%] {\n  margin: 0 0 4px 0;\n  font-size: 14px;\n  font-weight: 600;\n  color: var(--kendo-color-on-app-surface, #323130);\n  display: flex;\n  align-items: center;\n  gap: 6px;\n}\n\n.template-description[_ngcontent-%COMP%] {\n  margin: 0;\n  font-size: 12px;\n  color: var(--kendo-color-subtle, #605e5c);\n}\n\n.template-editor-container[_ngcontent-%COMP%] {\n  border: 1px solid var(--kendo-color-border, #e0e0e0);\n  border-radius: 4px;\n  overflow: hidden;\n  min-height: 200px;\n}\n\n\n\n.existing-template-section[_ngcontent-%COMP%] {\n  margin-top: 16px;\n  padding: 16px;\n  border: 1px solid var(--kendo-color-border, #e0e0e0);\n  border-radius: 4px;\n  background: var(--kendo-color-app-surface, #ffffff);\n}\n\n.existing-template-info[_ngcontent-%COMP%] {\n  display: flex;\n  flex-direction: column;\n  gap: 12px;\n}\n\n.template-header[_ngcontent-%COMP%] {\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n  gap: 12px;\n}\n\n.template-type-badge[_ngcontent-%COMP%] {\n  display: inline-flex;\n  align-items: center;\n  gap: 4px;\n  padding: 4px 8px;\n  background-color: var(--kendo-color-primary, #0078d4);\n  color: white;\n  border-radius: 12px;\n  font-size: 11px;\n  font-weight: 500;\n}\n\n.template-actions[_ngcontent-%COMP%] {\n  display: flex;\n  gap: 8px;\n}\n\n\n\n.dialog-footer[_ngcontent-%COMP%] {\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n  padding: 16px 20px;\n  border-top: 1px solid var(--kendo-color-border, #e0e0e0);\n  background: var(--kendo-color-surface-alt, #fafafa);\n  gap: 16px;\n}\n\n.footer-left[_ngcontent-%COMP%] {\n  flex: 1;\n}\n\n.footer-right[_ngcontent-%COMP%] {\n  display: flex;\n  gap: 8px;\n}\n\n.form-hint[_ngcontent-%COMP%] {\n  display: flex;\n  align-items: center;\n  gap: 6px;\n  font-size: 12px;\n  color: var(--kendo-color-subtle, #605e5c);\n}\n\n.form-hint[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n  color: var(--kendo-color-primary, #0078d4);\n}\n\n\n\n@media (max-width: 768px) {\n  .form-grid[_ngcontent-%COMP%] {\n    grid-template-columns: 1fr;\n  }\n  \n  .template-mode-options[_ngcontent-%COMP%] {\n    flex-direction: column;\n    gap: 8px;\n  }\n  \n  .dialog-footer[_ngcontent-%COMP%] {\n    flex-direction: column;\n    align-items: stretch;\n    gap: 12px;\n  }\n  \n  .footer-right[_ngcontent-%COMP%] {\n    justify-content: stretch;\n  }\n  \n  .footer-right[_ngcontent-%COMP%]   button[_ngcontent-%COMP%] {\n    flex: 1;\n  }\n}\n\n\n\n[_nghost-%COMP%]     .template-editor-container mj-template-editor {\n  --template-editor-min-height: 200px;\n}\n\n[_nghost-%COMP%]     .template-editor-container .template-editor-help {\n  display: none; \n\n}"] }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CreatePromptDialogComponent, [{
        type: Component,
        args: [{ selector: 'mj-create-prompt-dialog', template: "<!-- Create Prompt Dialog -->\n<div class=\"create-prompt-dialog\">\n  \n  <!-- Loading State -->\n  @if (isLoading$ | async) {\n    <div class=\"loading-state\">\n      <div class=\"loading-spinner\">\n        <i class=\"fa-solid fa-spinner fa-spin fa-2x\"></i>\n      </div>\n      <p>Loading prompt creation form...</p>\n    </div>\n  } @else {\n    \n    <!-- Form Content -->\n    <form [formGroup]=\"promptForm\" class=\"dialog-content\">\n      \n      <!-- Basic Prompt Information -->\n      <div class=\"form-section\">\n        <h4 class=\"section-title\">\n          <i class=\"fa-solid fa-info-circle\"></i>\n          Basic Information\n        </h4>\n        \n        <div class=\"form-grid\">\n          \n          <!-- Name Field -->\n          <div class=\"form-field\">\n            <label for=\"promptName\" class=\"field-label required\">\n              <i class=\"fa-solid fa-tag\"></i>\n              Name\n            </label>\n            <kendo-textbox \n              id=\"promptName\"\n              formControlName=\"name\"\n              placeholder=\"Enter prompt name...\"\n              class=\"full-width\">\n            </kendo-textbox>\n            @if (promptForm.get('name')?.invalid && promptForm.get('name')?.touched) {\n              <div class=\"field-error\">\n                <i class=\"fa-solid fa-exclamation-triangle\"></i>\n                Name is required\n              </div>\n            }\n          </div>\n\n          <!-- Type Field -->\n          <div class=\"form-field\">\n            <label for=\"promptType\" class=\"field-label required\">\n              <i class=\"fa-solid fa-category\"></i>\n              Type\n            </label>\n            <kendo-dropdownlist \n              id=\"promptType\"\n              formControlName=\"typeID\"\n              [data]=\"availablePromptTypes$ | async\"\n              textField=\"Name\"\n              valueField=\"ID\"\n              [valuePrimitive]=\"true\"\n              placeholder=\"Select prompt type...\"\n              class=\"full-width\">\n            </kendo-dropdownlist>\n            @if (promptForm.get('typeID')?.invalid && promptForm.get('typeID')?.touched) {\n              <div class=\"field-error\">\n                <i class=\"fa-solid fa-exclamation-triangle\"></i>\n                Type is required\n              </div>\n            }\n          </div>\n\n          <!-- Status Field -->\n          <div class=\"form-field\">\n            <label for=\"promptStatus\" class=\"field-label\">\n              <i class=\"fa-solid fa-toggle-on\"></i>\n              Status\n            </label>\n            <kendo-dropdownlist \n              id=\"promptStatus\"\n              formControlName=\"status\"\n              [data]=\"['Pending', 'Active', 'Disabled']\"\n              [valuePrimitive]=\"true\"\n              class=\"full-width\">\n            </kendo-dropdownlist>\n          </div>\n\n          <!-- Output Type Field -->\n          <div class=\"form-field\">\n            <label for=\"outputType\" class=\"field-label\">\n              <i class=\"fa-solid fa-file-code\"></i>\n              Output Type\n            </label>\n            <kendo-dropdownlist \n              id=\"outputType\"\n              formControlName=\"outputType\"\n              [data]=\"['string', 'object']\"\n              [valuePrimitive]=\"true\"\n              class=\"full-width\">\n            </kendo-dropdownlist>\n          </div>\n\n        </div>\n\n        <!-- Description Field -->\n        <div class=\"form-field full-width\">\n          <label for=\"promptDescription\" class=\"field-label\">\n            <i class=\"fa-solid fa-align-left\"></i>\n            Description\n          </label>\n          <kendo-textarea \n            id=\"promptDescription\"\n            formControlName=\"description\"\n            placeholder=\"Enter prompt description (optional)...\"\n            [rows]=\"3\"\n            class=\"full-width\">\n          </kendo-textarea>\n        </div>\n\n      </div>\n\n      <!-- Template Configuration -->\n      <div class=\"form-section\">\n        <h4 class=\"section-title\">\n          <i class=\"fa-solid fa-file-alt\"></i>\n          Template Configuration\n        </h4>\n        \n        <div class=\"template-mode-section\">\n          <label class=\"field-label\">\n            <i class=\"fa-solid fa-cog\"></i>\n            Template Mode\n          </label>\n          \n          <div class=\"template-mode-options\">\n            <div class=\"radio-option\">\n              <input type=\"radio\" \n                     id=\"templateNew\" \n                     value=\"new\" \n                     formControlName=\"templateMode\"\n                     class=\"radio-input\">\n              <label for=\"templateNew\" class=\"radio-label\">\n                <i class=\"fa-solid fa-plus-circle\"></i>\n                Create New Template\n              </label>\n            </div>\n            \n            <div class=\"radio-option\">\n              <input type=\"radio\" \n                     id=\"templateExisting\" \n                     value=\"existing\" \n                     formControlName=\"templateMode\"\n                     class=\"radio-input\">\n              <label for=\"templateExisting\" class=\"radio-label\">\n                <i class=\"fa-solid fa-link\"></i>\n                Link Existing Template\n              </label>\n            </div>\n          </div>\n        </div>\n\n        <!-- Template Editor Section (New Template) -->\n        @if (showTemplateEditor && templateEntity && templateMode === 'new') {\n          <div class=\"template-editor-section\">\n            <div class=\"template-info\">\n              <h5 class=\"template-name\">\n                <i class=\"fa-solid fa-file-code\"></i>\n                {{ templateEntity.Name }}\n              </h5>\n              @if (templateEntity.Description) {\n                <p class=\"template-description\">{{ templateEntity.Description }}</p>\n              }\n            </div>\n            \n            <div class=\"template-editor-container\">\n              <mj-template-editor \n                #templateEditor\n                [template]=\"templateEntity\"\n                [config]=\"templateEditorConfig\"\n                (contentChange)=\"onTemplateContentChange($event)\">\n              </mj-template-editor>\n            </div>\n          </div>\n        }\n        \n        <!-- Existing Template Display -->\n        @if (templateEntity && templateMode === 'existing') {\n          <div class=\"existing-template-section\">\n            <div class=\"existing-template-info\">\n              <div class=\"template-header\">\n                <h5 class=\"template-name\">\n                  <i class=\"fa-solid fa-link\"></i>\n                  {{ templateEntity.Name }}\n                </h5>\n                <span class=\"template-type-badge\">\n                  <i class=\"fa-solid fa-tag\"></i>\n                  Existing Template\n                </span>\n              </div>\n              \n              @if (templateEntity.Description) {\n                <p class=\"template-description\">{{ templateEntity.Description }}</p>\n              }\n              \n              <div class=\"template-actions\">\n                <button kendoButton \n                        look=\"outline\" \n                        size=\"small\"\n                        (click)=\"handleTemplateModeChange('existing')\">\n                  <i class=\"fa-solid fa-sync\"></i>\n                  Change Template\n                </button>\n              </div>\n            </div>\n          </div>\n        }\n\n      </div>\n\n    </form>\n\n  }\n\n</div>\n\n<!-- Dialog Footer -->\n<div class=\"dialog-footer\">\n  <div class=\"footer-left\">\n    <span class=\"form-hint\">\n      <i class=\"fa-solid fa-info-circle\"></i>\n      @if (templateMode === 'new') {\n        Created prompts and templates will be saved when you save the AI Agent\n      } @else {\n        Created prompt will be linked to existing template when you save the AI Agent\n      }\n    </span>\n  </div>\n  \n  <div class=\"footer-right\">\n    <button kendoButton \n            look=\"outline\"\n            (click)=\"cancel()\"\n            [disabled]=\"(isSaving$ | async) || false\">\n      Cancel\n    </button>\n    \n    <button kendoButton \n            themeColor=\"primary\"\n            (click)=\"save()\"\n            [disabled]=\"!promptForm.valid || ((isSaving$ | async) || false)\">\n      @if (isSaving$ | async) {\n        <i class=\"fa-solid fa-spinner fa-spin\"></i>\n        Creating...\n      } @else {\n        <i class=\"fa-solid fa-plus\"></i>\n        Create Prompt\n      }\n    </button>\n  </div>\n</div>", styles: ["/* Create Prompt Dialog Styles */\n.create-prompt-dialog {\n  padding: 0;\n  min-height: 400px;\n  display: flex;\n  flex-direction: column;\n}\n\n/* Ensure dialog appears above banner and other elements */\n:host ::ng-deep .k-dialog,\n:host ::ng-deep .k-window {\n  z-index: 10000 !important;\n}\n\n:host ::ng-deep .k-overlay {\n  z-index: 9999 !important;\n}\n\n/* Loading State */\n.loading-state {\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  justify-content: center;\n  padding: 60px 20px;\n  text-align: center;\n}\n\n.loading-spinner {\n  margin-bottom: 16px;\n  color: var(--kendo-color-primary, #0078d4);\n}\n\n/* Dialog Content */\n.dialog-content {\n  flex: 1;\n  padding: 20px;\n  overflow-y: auto;\n  max-height: 70vh;\n}\n\n/* Form Sections */\n.form-section {\n  margin-bottom: 24px;\n  border: 1px solid var(--kendo-color-border, #e0e0e0);\n  border-radius: 6px;\n  padding: 16px;\n  background: var(--kendo-color-surface-alt, #fafafa);\n}\n\n.section-title {\n  margin: 0 0 16px 0;\n  font-size: 14px;\n  font-weight: 600;\n  color: var(--kendo-color-on-app-surface, #323130);\n  display: flex;\n  align-items: center;\n  gap: 8px;\n}\n\n.section-title i {\n  color: var(--kendo-color-primary, #0078d4);\n}\n\n/* Form Grid Layout */\n.form-grid {\n  display: grid;\n  grid-template-columns: 1fr 1fr;\n  gap: 16px;\n  margin-bottom: 16px;\n}\n\n.form-field {\n  display: flex;\n  flex-direction: column;\n  gap: 6px;\n}\n\n.form-field.full-width {\n  grid-column: 1 / -1;\n}\n\n/* Field Labels */\n.field-label {\n  font-size: 13px;\n  font-weight: 500;\n  color: var(--kendo-color-on-app-surface, #323130);\n  display: flex;\n  align-items: center;\n  gap: 6px;\n}\n\n.field-label.required::after {\n  content: '*';\n  color: var(--kendo-color-error, #d13438);\n  margin-left: 2px;\n}\n\n.field-label i {\n  font-size: 11px;\n  color: var(--kendo-color-subtle, #605e5c);\n}\n\n/* Form Controls */\n.full-width {\n  width: 100%;\n}\n\n/* Field Errors */\n.field-error {\n  display: flex;\n  align-items: center;\n  gap: 4px;\n  font-size: 12px;\n  color: var(--kendo-color-error, #d13438);\n  margin-top: 4px;\n}\n\n.field-error i {\n  font-size: 11px;\n}\n\n/* Template Mode Section */\n.template-mode-section {\n  margin-bottom: 16px;\n}\n\n.template-mode-options {\n  display: flex;\n  gap: 16px;\n  margin-top: 8px;\n  flex-wrap: wrap;\n}\n\n.radio-option {\n  display: flex;\n  align-items: center;\n  gap: 6px;\n}\n\n.radio-input {\n  margin: 0;\n}\n\n.radio-label {\n  font-size: 13px;\n  cursor: pointer;\n  display: flex;\n  align-items: center;\n  gap: 6px;\n  padding: 4px 8px;\n  border-radius: 4px;\n  transition: background-color 0.2s ease;\n}\n\n.radio-label:hover {\n  background-color: var(--kendo-color-base-hover, #f3f2f1);\n}\n\n.radio-label i {\n  font-size: 12px;\n  color: var(--kendo-color-subtle, #605e5c);\n}\n\n/* Template Editor Section */\n.template-editor-section {\n  margin-top: 16px;\n  padding: 16px;\n  border: 1px solid var(--kendo-color-border, #e0e0e0);\n  border-radius: 4px;\n  background: var(--kendo-color-app-surface, #ffffff);\n}\n\n.template-info {\n  margin-bottom: 12px;\n}\n\n.template-name {\n  margin: 0 0 4px 0;\n  font-size: 14px;\n  font-weight: 600;\n  color: var(--kendo-color-on-app-surface, #323130);\n  display: flex;\n  align-items: center;\n  gap: 6px;\n}\n\n.template-description {\n  margin: 0;\n  font-size: 12px;\n  color: var(--kendo-color-subtle, #605e5c);\n}\n\n.template-editor-container {\n  border: 1px solid var(--kendo-color-border, #e0e0e0);\n  border-radius: 4px;\n  overflow: hidden;\n  min-height: 200px;\n}\n\n/* Existing Template Section */\n.existing-template-section {\n  margin-top: 16px;\n  padding: 16px;\n  border: 1px solid var(--kendo-color-border, #e0e0e0);\n  border-radius: 4px;\n  background: var(--kendo-color-app-surface, #ffffff);\n}\n\n.existing-template-info {\n  display: flex;\n  flex-direction: column;\n  gap: 12px;\n}\n\n.template-header {\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n  gap: 12px;\n}\n\n.template-type-badge {\n  display: inline-flex;\n  align-items: center;\n  gap: 4px;\n  padding: 4px 8px;\n  background-color: var(--kendo-color-primary, #0078d4);\n  color: white;\n  border-radius: 12px;\n  font-size: 11px;\n  font-weight: 500;\n}\n\n.template-actions {\n  display: flex;\n  gap: 8px;\n}\n\n/* Dialog Footer */\n.dialog-footer {\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n  padding: 16px 20px;\n  border-top: 1px solid var(--kendo-color-border, #e0e0e0);\n  background: var(--kendo-color-surface-alt, #fafafa);\n  gap: 16px;\n}\n\n.footer-left {\n  flex: 1;\n}\n\n.footer-right {\n  display: flex;\n  gap: 8px;\n}\n\n.form-hint {\n  display: flex;\n  align-items: center;\n  gap: 6px;\n  font-size: 12px;\n  color: var(--kendo-color-subtle, #605e5c);\n}\n\n.form-hint i {\n  color: var(--kendo-color-primary, #0078d4);\n}\n\n/* Responsive Design */\n@media (max-width: 768px) {\n  .form-grid {\n    grid-template-columns: 1fr;\n  }\n  \n  .template-mode-options {\n    flex-direction: column;\n    gap: 8px;\n  }\n  \n  .dialog-footer {\n    flex-direction: column;\n    align-items: stretch;\n    gap: 12px;\n  }\n  \n  .footer-right {\n    justify-content: stretch;\n  }\n  \n  .footer-right button {\n    flex: 1;\n  }\n}\n\n/* Compact Template Editor Styles */\n:host ::ng-deep .template-editor-container mj-template-editor {\n  --template-editor-min-height: 200px;\n}\n\n:host ::ng-deep .template-editor-container .template-editor-help {\n  display: none; /* Hide help section in compact mode */\n}"] }]
    }], () => [{ type: i1.WindowRef }, { type: i0.ChangeDetectorRef }, { type: i2.AIPromptManagementService }], { templateEditor: [{
            type: ViewChild,
            args: ['templateEditor']
        }] }); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CreatePromptDialogComponent, { className: "CreatePromptDialogComponent", filePath: "src/lib/custom/AIAgents/create-prompt-dialog.component.ts", lineNumber: 40 }); })();
//# sourceMappingURL=create-prompt-dialog.component.js.map