import { Component, Input, Output, EventEmitter } from '@angular/core';
import * as i0 from "@angular/core";
import * as i1 from "@angular/forms";
import * as i2 from "@progress/kendo-angular-buttons";
import * as i3 from "@progress/kendo-angular-inputs";
import * as i4 from "@progress/kendo-angular-dialog";
function SaveVersionDialogComponent_Conditional_0_Conditional_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 4);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1("Current: v", ctx_r1.CurrentVersion);
} }
function SaveVersionDialogComponent_Conditional_0_Conditional_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 5);
    i0.ɵɵtext(1, "First version");
    i0.ɵɵelementEnd();
} }
function SaveVersionDialogComponent_Conditional_0_Conditional_9_Template(rf, ctx) { if (rf & 1) {
    const _r3 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 9)(1, "label", 12)(2, "input", 13);
    i0.ɵɵtwoWayListener("ngModelChange", function SaveVersionDialogComponent_Conditional_0_Conditional_9_Template_input_ngModelChange_2_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r1 = i0.ɵɵnextContext(2); i0.ɵɵtwoWayBindingSet(ctx_r1.Mode, $event) || (ctx_r1.Mode = $event); return i0.ɵɵresetView($event); });
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "div", 14)(4, "span", 15);
    i0.ɵɵtext(5, "Save as new version");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(6, "span", 16);
    i0.ɵɵtext(7);
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(8, "label", 12)(9, "input", 17);
    i0.ɵɵtwoWayListener("ngModelChange", function SaveVersionDialogComponent_Conditional_0_Conditional_9_Template_input_ngModelChange_9_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r1 = i0.ɵɵnextContext(2); i0.ɵɵtwoWayBindingSet(ctx_r1.Mode, $event) || (ctx_r1.Mode = $event); return i0.ɵɵresetView($event); });
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(10, "div", 14)(11, "span", 15);
    i0.ɵɵtext(12, "Update current version");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(13, "span", 16);
    i0.ɵɵtext(14);
    i0.ɵɵelementEnd()()()();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance();
    i0.ɵɵclassProp("selected", ctx_r1.Mode === "new");
    i0.ɵɵadvance();
    i0.ɵɵtwoWayProperty("ngModel", ctx_r1.Mode);
    i0.ɵɵadvance(5);
    i0.ɵɵtextInterpolate1("Creates v", ctx_r1.CurrentVersion + 1);
    i0.ɵɵadvance();
    i0.ɵɵclassProp("selected", ctx_r1.Mode === "update");
    i0.ɵɵadvance();
    i0.ɵɵtwoWayProperty("ngModel", ctx_r1.Mode);
    i0.ɵɵadvance(5);
    i0.ɵɵtextInterpolate1("Overwrites v", ctx_r1.CurrentVersion);
} }
function SaveVersionDialogComponent_Conditional_0_Template(rf, ctx) { if (rf & 1) {
    const _r1 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "kendo-dialog", 1);
    i0.ɵɵlistener("close", function SaveVersionDialogComponent_Conditional_0_Template_kendo_dialog_close_0_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.OnCancel()); });
    i0.ɵɵelementStart(1, "div", 2)(2, "div", 3);
    i0.ɵɵconditionalCreate(3, SaveVersionDialogComponent_Conditional_0_Conditional_3_Template, 2, 1, "span", 4)(4, SaveVersionDialogComponent_Conditional_0_Conditional_4_Template, 2, 0, "span", 5);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "div", 6)(6, "label", 7);
    i0.ɵɵtext(7, "Comment");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(8, "input", 8);
    i0.ɵɵtwoWayListener("ngModelChange", function SaveVersionDialogComponent_Conditional_0_Template_input_ngModelChange_8_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); i0.ɵɵtwoWayBindingSet(ctx_r1.Comment, $event) || (ctx_r1.Comment = $event); return i0.ɵɵresetView($event); });
    i0.ɵɵelementEnd()();
    i0.ɵɵconditionalCreate(9, SaveVersionDialogComponent_Conditional_0_Conditional_9_Template, 15, 8, "div", 9);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(10, "kendo-dialog-actions")(11, "button", 10);
    i0.ɵɵlistener("click", function SaveVersionDialogComponent_Conditional_0_Template_button_click_11_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.OnSave()); });
    i0.ɵɵelement(12, "i", 11);
    i0.ɵɵtext(13, " Save ");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(14, "button", 10);
    i0.ɵɵlistener("click", function SaveVersionDialogComponent_Conditional_0_Template_button_click_14_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.OnCancel()); });
    i0.ɵɵtext(15, " Cancel ");
    i0.ɵɵelementEnd()()();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵproperty("title", "Save Version")("width", 420);
    i0.ɵɵadvance(3);
    i0.ɵɵconditional(ctx_r1.CurrentVersion > 0 ? 3 : 4);
    i0.ɵɵadvance(5);
    i0.ɵɵtwoWayProperty("ngModel", ctx_r1.Comment);
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r1.CurrentVersion > 0 ? 9 : -1);
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("themeColor", "primary");
    i0.ɵɵadvance(3);
    i0.ɵɵproperty("themeColor", "base");
} }
export class SaveVersionDialogComponent {
    Visible = false;
    CurrentVersion = 0;
    Save = new EventEmitter();
    Cancel = new EventEmitter();
    Comment = '';
    Mode = 'new';
    OnSave() {
        this.Save.emit({
            Comment: this.Comment,
            Mode: this.Mode
        });
        this.ResetForm();
    }
    OnCancel() {
        this.Cancel.emit();
        this.ResetForm();
    }
    ResetForm() {
        this.Comment = '';
        this.Mode = 'new';
    }
    static ɵfac = function SaveVersionDialogComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || SaveVersionDialogComponent)(); };
    static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: SaveVersionDialogComponent, selectors: [["mj-save-version-dialog"]], inputs: { Visible: "Visible", CurrentVersion: "CurrentVersion" }, outputs: { Save: "Save", Cancel: "Cancel" }, standalone: false, decls: 1, vars: 1, consts: [[3, "title", "width"], [3, "close", "title", "width"], [1, "dialog-body"], [1, "version-context"], [1, "version-badge"], [1, "version-badge", "new-badge"], [1, "form-field"], ["for", "versionComment", 1, "field-label"], ["kendoTextBox", "", "id", "versionComment", "placeholder", "Describe what changed...", 1, "comment-input", 3, "ngModelChange", "ngModel"], [1, "save-mode"], ["kendoButton", "", 3, "click", "themeColor"], [1, "fa-solid", "fa-save"], [1, "radio-option"], ["type", "radio", "name", "saveMode", "value", "new", 3, "ngModelChange", "ngModel"], [1, "radio-content"], [1, "radio-label"], [1, "radio-desc"], ["type", "radio", "name", "saveMode", "value", "update", 3, "ngModelChange", "ngModel"]], template: function SaveVersionDialogComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵconditionalCreate(0, SaveVersionDialogComponent_Conditional_0_Template, 16, 7, "kendo-dialog", 0);
        } if (rf & 2) {
            i0.ɵɵconditional(ctx.Visible ? 0 : -1);
        } }, dependencies: [i1.DefaultValueAccessor, i1.RadioControlValueAccessor, i1.NgControlStatus, i1.NgModel, i2.ButtonComponent, i3.TextBoxDirective, i4.DialogComponent, i4.DialogActionsComponent], styles: [".dialog-body[_ngcontent-%COMP%] {\n      display: flex;\n      flex-direction: column;\n      gap: 16px;\n      padding: 4px 0;\n    }\n\n    .version-context[_ngcontent-%COMP%] {\n      display: flex;\n      align-items: center;\n    }\n\n    .version-badge[_ngcontent-%COMP%] {\n      display: inline-flex;\n      align-items: center;\n      padding: 3px 10px;\n      border-radius: 12px;\n      font-size: 12px;\n      font-weight: 600;\n      background: color-mix(in srgb, var(--mj-brand-primary) 15%, var(--mj-bg-surface));\n      color: var(--mj-brand-primary);\n    }\n\n    .new-badge[_ngcontent-%COMP%] {\n      background: color-mix(in srgb, var(--mj-brand-primary) 10%, var(--mj-bg-surface));\n      color: var(--mj-brand-primary);\n    }\n\n    .form-field[_ngcontent-%COMP%] {\n      display: flex;\n      flex-direction: column;\n      gap: 6px;\n    }\n\n    .field-label[_ngcontent-%COMP%] {\n      font-size: 13px;\n      font-weight: 500;\n      color: var(--mj-text-primary);\n    }\n\n    .comment-input[_ngcontent-%COMP%] {\n      width: 100%;\n    }\n\n    .save-mode[_ngcontent-%COMP%] {\n      display: flex;\n      flex-direction: column;\n      gap: 8px;\n    }\n\n    .radio-option[_ngcontent-%COMP%] {\n      display: flex;\n      align-items: flex-start;\n      gap: 10px;\n      padding: 10px 12px;\n      border: 1px solid var(--mj-border-default);\n      border-radius: 8px;\n      cursor: pointer;\n      transition: all 0.15s ease;\n    }\n\n    .radio-option[_ngcontent-%COMP%]:hover {\n      background: var(--mj-bg-surface-sunken);\n    }\n\n    .radio-option.selected[_ngcontent-%COMP%] {\n      border-color: var(--mj-brand-primary);\n      background: color-mix(in srgb, var(--mj-brand-primary) 15%, var(--mj-bg-surface));\n    }\n\n    .radio-option[_ngcontent-%COMP%]   input[type=\"radio\"][_ngcontent-%COMP%] {\n      margin-top: 2px;\n      accent-color: var(--mj-brand-primary);\n    }\n\n    .radio-content[_ngcontent-%COMP%] {\n      display: flex;\n      flex-direction: column;\n      gap: 2px;\n    }\n\n    .radio-label[_ngcontent-%COMP%] {\n      font-size: 13px;\n      font-weight: 500;\n      color: var(--mj-text-primary);\n    }\n\n    .radio-desc[_ngcontent-%COMP%] {\n      font-size: 11px;\n      color: var(--mj-text-secondary);\n    }"] });
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SaveVersionDialogComponent, [{
        type: Component,
        args: [{ standalone: false, selector: 'mj-save-version-dialog', template: `
    @if (Visible) {
      <kendo-dialog
        [title]="'Save Version'"
        [width]="420"
        (close)="OnCancel()">

        <div class="dialog-body">
          <div class="version-context">
            @if (CurrentVersion > 0) {
              <span class="version-badge">Current: v{{ CurrentVersion }}</span>
            } @else {
              <span class="version-badge new-badge">First version</span>
            }
          </div>

          <div class="form-field">
            <label class="field-label" for="versionComment">Comment</label>
            <input
              kendoTextBox
              id="versionComment"
              [(ngModel)]="Comment"
              placeholder="Describe what changed..."
              class="comment-input" />
          </div>

          @if (CurrentVersion > 0) {
            <div class="save-mode">
              <label class="radio-option" [class.selected]="Mode === 'new'">
                <input type="radio" name="saveMode" value="new" [(ngModel)]="Mode" />
                <div class="radio-content">
                  <span class="radio-label">Save as new version</span>
                  <span class="radio-desc">Creates v{{ CurrentVersion + 1 }}</span>
                </div>
              </label>
              <label class="radio-option" [class.selected]="Mode === 'update'">
                <input type="radio" name="saveMode" value="update" [(ngModel)]="Mode" />
                <div class="radio-content">
                  <span class="radio-label">Update current version</span>
                  <span class="radio-desc">Overwrites v{{ CurrentVersion }}</span>
                </div>
              </label>
            </div>
          }
        </div>

        <kendo-dialog-actions>
          <button kendoButton [themeColor]="'primary'" (click)="OnSave()">
            <i class="fa-solid fa-save"></i> Save
          </button>
          <button kendoButton [themeColor]="'base'" (click)="OnCancel()">
            Cancel
          </button>
        </kendo-dialog-actions>
      </kendo-dialog>
    }
  `, styles: ["\n    .dialog-body {\n      display: flex;\n      flex-direction: column;\n      gap: 16px;\n      padding: 4px 0;\n    }\n\n    .version-context {\n      display: flex;\n      align-items: center;\n    }\n\n    .version-badge {\n      display: inline-flex;\n      align-items: center;\n      padding: 3px 10px;\n      border-radius: 12px;\n      font-size: 12px;\n      font-weight: 600;\n      background: color-mix(in srgb, var(--mj-brand-primary) 15%, var(--mj-bg-surface));\n      color: var(--mj-brand-primary);\n    }\n\n    .new-badge {\n      background: color-mix(in srgb, var(--mj-brand-primary) 10%, var(--mj-bg-surface));\n      color: var(--mj-brand-primary);\n    }\n\n    .form-field {\n      display: flex;\n      flex-direction: column;\n      gap: 6px;\n    }\n\n    .field-label {\n      font-size: 13px;\n      font-weight: 500;\n      color: var(--mj-text-primary);\n    }\n\n    .comment-input {\n      width: 100%;\n    }\n\n    .save-mode {\n      display: flex;\n      flex-direction: column;\n      gap: 8px;\n    }\n\n    .radio-option {\n      display: flex;\n      align-items: flex-start;\n      gap: 10px;\n      padding: 10px 12px;\n      border: 1px solid var(--mj-border-default);\n      border-radius: 8px;\n      cursor: pointer;\n      transition: all 0.15s ease;\n    }\n\n    .radio-option:hover {\n      background: var(--mj-bg-surface-sunken);\n    }\n\n    .radio-option.selected {\n      border-color: var(--mj-brand-primary);\n      background: color-mix(in srgb, var(--mj-brand-primary) 15%, var(--mj-bg-surface));\n    }\n\n    .radio-option input[type=\"radio\"] {\n      margin-top: 2px;\n      accent-color: var(--mj-brand-primary);\n    }\n\n    .radio-content {\n      display: flex;\n      flex-direction: column;\n      gap: 2px;\n    }\n\n    .radio-label {\n      font-size: 13px;\n      font-weight: 500;\n      color: var(--mj-text-primary);\n    }\n\n    .radio-desc {\n      font-size: 11px;\n      color: var(--mj-text-secondary);\n    }\n  "] }]
    }], null, { Visible: [{
            type: Input
        }], CurrentVersion: [{
            type: Input
        }], Save: [{
            type: Output
        }], Cancel: [{
            type: Output
        }] }); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(SaveVersionDialogComponent, { className: "SaveVersionDialogComponent", filePath: "src/ComponentStudio/components/save-version-dialog/save-version-dialog.component.ts", lineNumber: 162 }); })();
//# sourceMappingURL=save-version-dialog.component.js.map