import { Component } from "@angular/core";
import StiRectangleGeometryLayout from "../../computed/StiRectangleGeometryLayout";
import { StiTextElement } from "../../elements/StiTextElement";
import { UsedFont } from "../../services/objects";
import * as i0 from "@angular/core";
import * as i1 from "../../services/model.service";
import * as i2 from "../../services/sti-helper.service";
import * as i3 from "../../services/sti-draggable.service";
import * as i4 from "../../services/theme.service";
import * as i5 from "../../services/sti-form-events-service";
import * as i6 from "../../services/sti-editable-content.service";
import * as i7 from "../../services/sti-localization.service";
import * as i8 from "../../services/sti-rich-text.service";
import * as i9 from "../../services/sti-undo-service";
import * as i10 from "../../services/sti-name.service";
import * as i11 from "../../services/sti-color-dialog.service";
import * as i12 from "../../services/sti-clipboard-sevice";
import * as i13 from "@angular/common";
import * as i14 from "../sti-dropdown-component/sti-dropdown-component";
import * as i15 from "../sti-tooltip/sti-tooltip.directive";
import * as i16 from "../sti-select-button/sti-select-button.component";
export class StiHomeRibbonComponent {
    constructor(model, helper, draggableService, theme, render, formEvents, editableContentService, loc, richTextService, undoService, nameService, colorService, clipboardService) {
        this.model = model;
        this.helper = helper;
        this.draggableService = draggableService;
        this.theme = theme;
        this.render = render;
        this.formEvents = formEvents;
        this.editableContentService = editableContentService;
        this.loc = loc;
        this.richTextService = richTextService;
        this.undoService = undoService;
        this.nameService = nameService;
        this.colorService = colorService;
        this.clipboardService = clipboardService;
    }
    get alignment() {
        return this.editableContentService.editableContent["horizontalAlignment"]
            ? this.editableContentService.editableContent["horizontalAlignment"]
            : null;
    }
    haveBackgroundColor() {
        return (this.editableContentService.editableContent != null &&
            this.editableContentService.editableContent.haveBackgoundColor());
    }
    haveContentAlignment() {
        return (this.editableContentService.editableContent != null &&
            this.editableContentService.editableContent.haveContentAlignment());
    }
    haveVerticalAlignment() {
        return (this.editableContentService.editableContent != null &&
            this.editableContentService.editableContent.haveVerticalAlignment());
    }
    showColorPicker(element, object, isRichText = false) {
        this.colorService.openDialog(element, object, isRichText);
    }
    changeEvent() {
        let currentChangableFont = new UsedFont(this.editableContentService.editableContent.eFont.family, this.model.arrayOfStylesToString(this.editableContentService.editableContent.eFont.style), this.editableContentService.editableContent.eFont.size);
        this.model.form.formEvents.next({ name: "UpdateFonts", value: currentChangableFont });
    }
    setStyle(value) {
        if (value == "Bold") {
            this.richTextService.insertBold();
        }
        else if (value == "Italic") {
            this.richTextService.insertItalic();
        }
        else {
            this.richTextService.insertUnderline();
        }
    }
    setAlignment(value) {
        if (value == 1) {
            this.richTextService.setLeftAlignment();
        }
        else if (value == 2) {
            this.richTextService.setCenterAlignment();
        }
        else {
            this.richTextService.setRightAlignment();
        }
    }
    get fontSize() {
        return this.editableContentService.editableContent?.eFont.size;
    }
    set fontSize(value) {
        if (this.editableContentService.editableContent) {
            this.editableContentService.editableContent.eFont.size = value;
        }
    }
    get fontFamily() {
        return this.editableContentService.editableContent?.eFont.family;
    }
    set fontFamily(value) {
        if (this.editableContentService.editableContent) {
            this.editableContentService.editableContent.eFont.family = value;
        }
    }
    get fontStyle() {
        return this.editableContentService.editableContent?.eFont.style;
    }
    set fontStyle(value) {
        if (this.editableContentService.editableContent) {
            this.editableContentService.editableContent.eFont.style = value;
        }
    }
    get foreColor() {
        return this.editableContentService.editableContent?.eColor;
    }
    get backColor() {
        return this.editableContentService.editableContent.eBackgroundColor;
    }
    get canDelete() {
        return this.model.selectedComponent ? true : false;
    }
    get isRichText() {
        return this.model.selectedComponent?.element instanceof StiTextElement ? true : false;
    }
    ngOnInit() { }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: StiHomeRibbonComponent, deps: [{ token: i1.StiModelService }, { token: i2.StiHelperService }, { token: i3.StiDraggableService }, { token: i4.StiThemeService }, { token: StiRectangleGeometryLayout }, { token: i5.FormEventsService }, { token: i6.StiEditableContentService }, { token: i7.StiLocalizationService }, { token: i8.StiRichTextService }, { token: i9.StiUndoService }, { token: i10.StiNameService }, { token: i11.StiColorDialogService }, { token: i12.StiClipboardService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: StiHomeRibbonComponent, selector: "sti-home-ribbon-component", ngImport: i0, template: `<div
    class="home"
    style="-moz-user-select: none;-webkit-touch-callout: none;-webkit-user-select: none;-ms-user-select: none;user-select: none"
  >
    <div
      [style.margin-left]="'10px'"
      class="container {{ undoService?.undos?.length < 2 ? 'disabled' : '' }}"
      [stiTooltip]="loc.get2('HelpDesigner', 'Undo').replace('.', '')"
      tooltipPosition="bottom"
      showDelay="500"
      (click)="undoService.undo()"
    >
      <div class="button"><img [src]="model.getImage('images.Ribbon.Undo.png')" alt="" /></div>
    </div>
    <div
      class="container {{ undoService?.redos?.length < 1 ? 'disabled' : '' }}"
      [stiTooltip]="loc.get2('HelpDesigner', 'Redo').replace('.', '')"
      tooltipPosition="bottom"
      showDelay="500"
      (click)="undoService.redo()"
    >
      <div class="button"><img [src]="model.getImage('images.Ribbon.Redo.png')" alt="" /></div>
    </div>
    <!-- <div
      *ngIf="isRichText"
      [style.margin-left]="'10px'"
      class="container"
      [stiTooltip]="loc.getP('Undo')"
      tooltipPosition="bottom" showDelay="500"
      (click)="richTextService.useUndo()"
    >
      <div class="button"><img [src]="getIcon('Undo')" alt="" /></div>
    </div>
    <div
      *ngIf="isRichText"
      class="container"
      [stiTooltip]="loc.getP('Redo')"
      tooltipPosition="bottom" showDelay="500"
      (click)="richTextService.useRedo()"
    >
      <div class="button"><img [src]="getIcon('Redo')" alt="" /></div>
    </div> -->
    <div class="vertical-line"></div>
    <div
      class="container {{ !clipboardService.hasCopy ? 'disabled' : '' }}"
      [stiTooltip]="loc.get2('MainMenu', 'menuEditPaste').replace('&amp', '').replace(';', '')"
      tooltipPosition="bottom"
      showDelay="500"
      (click)="clipboardService.pasteElement($event)"
    >
      <div class="button"><img [src]="model.getImage('images.Ribbon.Paste.png')" alt="" /></div>
    </div>
    <div
      class="container {{ clipboardService.canCopy ? 'disabled' : '' }}"
      [stiTooltip]="loc.get2('MainMenu', 'menuEditCopy').replace('&amp', '').replace(';', '')"
      tooltipPosition="bottom"
      showDelay="500"
      (click)="clipboardService.copyElement()"
    >
      <div class="button"><img [src]="model.getImage('images.Ribbon.Copy.png')" alt="" /></div>
    </div>
    <div
      class="container {{ clipboardService.canCopy ? 'disabled' : '' }}"
      [stiTooltip]="loc.get2('MainMenu', 'menuEditCut').replace('&amp', '').replace(';', '')"
      tooltipPosition="bottom"
      showDelay="500"
      (click)="clipboardService.cutElement()"
    >
      <div class="button"><img [src]="model.getImage('images.Ribbon.Cut.png')" alt="" /></div>
    </div>
    <div
      class="container {{ !canDelete ? 'disabled' : '' }}"
      [stiTooltip]="loc.get2('Buttons', 'Delete')"
      tooltipPosition="bottom"
      showDelay="500"
      (click)="formEvents.deleteComponent()"
    >
      <div class="button"><img [src]="model.getImage('images.Ribbon.Delete.png')" alt="" /></div>
    </div>
    <div class="vertical-line"></div>
    <sti-dropdown-component
      *ngIf="!isRichText"
      [id]="0"
      [options]="model.fontFamilies"
      [(value)]="fontFamily"
      [disabled]="editableContentService.editableContent == null"
      [tooltip]="loc.get2('HelpDesigner', 'FontName')"
      [optionLabel]="'name'"
      [optionValue]="'name'"
      [style]="{
        width: '150px',
        height: '32px',
        alignItems: 'center',
        margin: '1px 2px',
        marginTop: '10px',
        fontSize: '12px'
      }"
      (mousedown)="$event.preventDefault()"
      (mouseup)="editableContentService.startEdit()"
      (valueChange)="changeEvent()"
    ></sti-dropdown-component>
    <!-- <p-dropdown
      *ngIf="!isRichText"
      [options]="model.fontFamilies"
      [(ngModel)]="fontFamily"
      optionLabel="name"
      optionValue="name"
      [style]="{
        width: '150px',
        height: '32px',
        alignItems: 'center',
        margin: '1px 2px',
        marginTop: '10px',
        fontSize: '12px'
      }"
      [disabled]="editableContentService.editableContent == null"
      [tooltip]="loc.get2('HelpDesigner', 'FontName')"
      tooltipPosition="bottom"
      showDelay="500"
      (mousedown)="$event.preventDefault()"
      (mouseup)="editableContentService.startEdit()"
      (onChange)="changeEvent()"
    ></p-dropdown> -->
    <sti-dropdown-component
      *ngIf="isRichText"
      [id]="1"
      [options]="model.fontFamilies"
      [(value)]="richTextService.activeFontFamily"
      [tooltip]="loc.get2('HelpDesigner', 'FontName')"
      [optionLabel]="'name'"
      [optionValue]="'name'"
      [style]="{
        width: '150px',
        height: '32px',
        alignItems: 'center',
        margin: '1px 2px',
        marginTop: '10px',
        fontSize: '12px'
      }"
      (mousedown)="$event.preventDefault()"
      (mouseup)="editableContentService.startEdit()"
      (valueChange)="richTextService.insertFontFamily(richTextService.activeFontFamily)"
    ></sti-dropdown-component>
    <!-- <p-dropdown
      *ngIf="isRichText"
      [options]="model.fontFamilies"
      [(ngModel)]="richTextService.activeFontFamily"
      optionLabel="name"
      optionValue="name"
      [style]="{
        width: '150px',
        height: '32px',
        alignItems: 'center',
        margin: '1px 2px',
        marginTop: '10px',
        fontSize: '12px'
      }"
      [tooltip]="loc.get2('HelpDesigner', 'FontName')"
      tooltipPosition="bottom"
      showDelay="500"
      (mousedown)="$event.preventDefault()"
      (onChange)="richTextService.insertFontFamily(richTextService.activeFontFamily)"
      (mouseup)="editableContentService.startEdit()"
    ></p-dropdown> -->
    <sti-dropdown-component
      *ngIf="!isRichText"
      [id]="2"
      [options]="helper.fontSizes"
      [(value)]="fontSize"
      [tooltip]="loc.getP('FontSize')"
      [style]="{
        width: '60px',
        height: '32px',
        alignItems: 'center',
        margin: '10px 10px 1px 2px',
        fontSize: '12px'
      }"
      [disabled]="editableContentService.editableContent == null"
      (mousedown)="$event.preventDefault()"
      (mouseup)="editableContentService.startEdit()"
      (valueChange)="changeEvent()"
    ></sti-dropdown-component>
    <!-- <p-dropdown
      *ngIf="!isRichText"
      [options]="helper.fontSizes"
      [(ngModel)]="fontSize"
      [style]="{ width: '60px', height: '32px', alignItems: 'center', margin: '10px 10px 1px 2px', fontSize: '12px' }"
      [tooltip]="loc.getP('FontSize')"
      tooltipPosition="bottom"
      showDelay="500"
      [disabled]="editableContentService.editableContent == null"
      (mousedown)="$event.preventDefault()"
      (mouseup)="editableContentService.startEdit()"
      (onChange)="changeEvent()"
    ></p-dropdown> -->
    <sti-dropdown-component
      *ngIf="isRichText"
      [id]="3"
      [options]="helper.richTextFontSizes"
      [(value)]="richTextService.activeFontSize"
      [tooltip]="loc.getP('FontSize')"
      [optionLabel]="'name'"
      [optionValue]="'value'"
      [style]="{
        width: '60px',
        height: '32px',
        alignItems: 'center',
        margin: '10px 10px 1px 2px',
        fontSize: '12px'
      }"
      (mousedown)="$event.preventDefault()"
      (mouseup)="editableContentService.startEdit()"
      (valueChange)="richTextService.insertFontSize()"
    ></sti-dropdown-component>
    <!-- <p-dropdown
      *ngIf="isRichText"
      [options]="helper.richTextFontSizes"
      [(ngModel)]="richTextService.activeFontSize"
      optionLabel="name"
      optionValue="value"
      [style]="{ width: '60px', height: '32px', alignItems: 'center', margin: '10px 10px 1px 2px', fontSize: '12px' }"
      [tooltip]="loc.getP('FontSize')"
      tooltipPosition="bottom"
      showDelay="500"
      (mousedown)="$event.preventDefault()"
      (onChange)="richTextService.insertFontSize()"
      (mouseup)="editableContentService.startEdit()"
    ></p-dropdown> -->
    <sti-selectButton
      *ngIf="!isRichText"
      [options]="helper.styleOptions"
      [(value)]="fontStyle"
      [multiple]="true"
      optionValue="value"
      [style]="{ margin: '11px 10px 1px 1px', height: '32px', minWidth: '94px' }"
      [disabled]="editableContentService.editableContent == null"
      (mousedown)="$event.preventDefault()"
      (onChange)="changeEvent()"
      ><ng-template let-item>
        <img
          [src]="model.getImage(item.image)"
          [stiTooltip]="loc.getP(item.value)"
          tooltipPosition="bottom"
          showDelay="500"
        /> </ng-template
    ></sti-selectButton>
    <sti-selectButton
      *ngIf="isRichText"
      [options]="helper.styleOptions"
      [(value)]="richTextService.activeTextStyles"
      [multiple]="true"
      optionValue="value"
      (onOptionClick)="setStyle($event.option.value)"
      [style]="{ margin: '11px 10px 1px 1px', height: '32px', minWidth: '94px' }"
      ><ng-template let-item>
        <img
          [src]="model.getImage(item.image)"
          [stiTooltip]="loc.getP(item.value)"
          tooltipPosition="bottom"
          showDelay="500"
        /> </ng-template
    ></sti-selectButton>
    <div class="vertical-line"></div>
    <div
      *ngIf="!isRichText"
      class="button-container"
      [stiTooltip]="loc.getP('ForeColor')"
      tooltipPosition="bottom"
      showDelay="500"
      [style.opacity]="editableContentService.editableContent != null ? '1' : '0.5'"
      [class]="editableContentService.editableContent != null ? 'enabled' : 'disabled'"
      (click)="showColorPicker(fontColorEditor, foreColor)"
      (mousedown)="$event.preventDefault()"
      #fontColorEditor
    >
      <div class="prev">
        <div class="foreground" [style]="{ backgroundPosition: 'center', backgroundRepeat: 'no-repeat' }">
          <img [src]="model.getImage('images.Brush.png')" alt="" />
        </div>
        <span
          class="color-preview"
          [style.background-color]="
            editableContentService.editableContent != null
              ? editableContentService.editableContent?.eColor?.toHtmlColor()
              : 'rgb(182, 181, 180)'
          "
        ></span>
      </div>
      <div [style]="{ position: 'relative', alignSelf: 'center' }">
        <i class="pi pi-chevron-down"></i>
      </div>
    </div>
    <div
      *ngIf="isRichText"
      class="button-container"
      [stiTooltip]="loc.getP('ForeColor')"
      tooltipPosition="bottom"
      showDelay="500"
      [style.opacity]="1"
      [class]="'enabled'"
      (click)="showColorPicker(richTextColorEditor, richTextService.activeColor, true)"
      (mousedown)="$event.preventDefault()"
      #richTextColorEditor
    >
      <div class="prev">
        <div class="foreground" [style]="{ backgroundPosition: 'center', backgroundRepeat: 'no-repeat' }">
          <img [src]="model.getImage('images.Brush.png')" alt="" />
        </div>
        <span class="color-preview" [style.background-color]="richTextService.activeColor.toHtmlColor()"></span>
      </div>
      <div [style]="{ position: 'relative', alignSelf: 'center' }">
        <i class="pi pi-chevron-down"></i>
      </div>
    </div>
    <div
      class="button-container"
      [stiTooltip]="loc.getP('BackColor')"
      tooltipPosition="bottom"
      showDelay="500"
      [style.opacity]="haveBackgroundColor() ? '1' : '0.5'"
      [class]="haveBackgroundColor() ? 'enabled' : 'disabled'"
      (click)="showColorPicker(backColorEditor, backColor)"
      (mousedown)="$event.preventDefault()"
      (mouseup)="editableContentService.startEdit()"
      #backColorEditor
    >
      <div class="prev">
        <div class="background" [style]="{ backgroundPosition: 'center', backgroundRepeat: 'no-repeat' }">
          <img [src]="model.getImage('images.Fill.png')" alt="" />
        </div>
        <span
          class="color-preview"
          [style.background-color]="
            editableContentService.editableContent != null
              ? editableContentService.editableContent?.eBackgroundColor?.toHtmlColor()
              : 'rgb(182, 181, 180)'
          "
        ></span>
      </div>
      <div [style]="{ position: 'relative', alignSelf: 'center' }">
        <i class="pi pi-chevron-down"></i>
      </div>
    </div>
    <sti-selectButton
      *ngIf="haveContentAlignment()"
      [options]="helper.justifyOptions"
      [(value)]="editableContentService.editableContent.eContentAlignment"
      optionValue="value"
      [style]="{ margin: '11px 10px 1px 1px', height: '32px', minWidth: '94px' }"
      (mousedown)="editableContentService.startEdit()"
    >
      <ng-template let-item>
        <img
          [src]="model.getImage(item.image)"
          [stiTooltip]="loc.getP(item.name)"
          tooltipPosition="bottom"
          showDelay="500"
          [style]="{ height: '16px', width: '16px' }"
        />
      </ng-template>
    </sti-selectButton>
    <sti-selectButton
      *ngIf="!haveContentAlignment() && !isRichText"
      [options]="helper.justifyOptions"
      optionValue="value"
      [style]="{ margin: '11px 10px 1px 1px', height: '32px', minWidth: '94px' }"
      [disabled]="true"
    >
      <ng-template let-item>
        <img
          [src]="model.getImage(item.image)"
          [stiTooltip]="loc.getP(item.name)"
          tooltipPosition="bottom"
          showDelay="500"
          [style]="{ height: '16px', width: '16px' }"
        />
      </ng-template>
    </sti-selectButton>
    <sti-selectButton
      *ngIf="isRichText"
      [options]="helper.justifyOptions"
      [(value)]="richTextService.activeAlignment"
      optionValue="value"
      [style]="{ margin: '11px 10px 1px 1px', height: '32px', minWidth: '94px' }"
      (onOptionClick)="setAlignment($event.option.value)"
    >
      <ng-template let-item>
        <img
          [src]="model.getImage(item.image)"
          [stiTooltip]="loc.getP(item.name)"
          tooltipPosition="bottom"
          showDelay="500"
          [style]="{ height: '16px', width: '16px' }"
        />
      </ng-template>
    </sti-selectButton>
    <sti-selectButton
      *ngIf="haveVerticalAlignment()"
      [options]="helper.verticalAlignment"
      [(value)]="editableContentService.editableContent.eVerticalAlignment"
      optionValue="value"
      [style]="{ margin: '11px 10px 1px 1px', height: '32px', minWidth: '94px' }"
      (mousedown)="editableContentService.startEdit()"
    >
      <ng-template let-item>
        <img
          [src]="model.getImage(item.image)"
          [stiTooltip]="loc.getP(item.name)"
          tooltipPosition="bottom"
          showDelay="500"
          [style]="{ height: '16px', width: '16px' }"
        />
      </ng-template>
    </sti-selectButton>
    <sti-selectButton
      *ngIf="!haveVerticalAlignment()"
      [options]="helper.verticalAlignment"
      optionValue="value"
      [disabled]="true"
      [style]="{ margin: '11px 10px 1px 1px', height: '32px', minWidth: '90px' }"
    >
      <ng-template let-item>
        <img
          [src]="model.getImage(item.image)"
          [stiTooltip]="loc.getP(item.name)"
          tooltipPosition="bottom"
          showDelay="500"
          [style]="{ height: '16px', width: '16px' }"
        />
      </ng-template>
    </sti-selectButton>
    <!-- <div class="vertical-line"></div>
    <div
      class="container"
      [stiTooltip]="loc.getP('ToggleElementCorners')"
      tooltipPosition="bottom"
      showDelay="500"
      (click)="model.showCornerRadius = !model.showCornerRadius"
    >
      <div class="button {{ model.showCornerRadius ? 'active' : '' }}"><img [src]="getIcon('Corners')" alt="" /></div>
    </div> -->
  </div>`, isInline: true, styles: [".active{background-color:var(--active-color)!important}.disabled{opacity:.5;pointer-events:none}.container{width:40px;display:flex;align-items:center;justify-content:center}.button{height:32px;width:32px;background-color:var(--back-color);border-radius:3px;display:flex;align-items:center;justify-content:center}.button:hover{background-color:var(--hover-color)!important}.button:active{background-color:var(--columnDeleteHover-color)!important}img{max-width:18px}.prev{display:flex;width:100%;position:relative;flex-direction:column}.button-container{display:flex;margin-top:11px;height:32px;width:48px;position:relative;margin-right:10px;border-radius:3px}.button-container:hover{background-color:var(--hover-color)}.button-container:active{background-color:var(--columnDeleteHover-color)}.color-preview{width:20px;height:5px;margin-left:6px}i{height:12px;width:12px;right:3px;top:50%;vertical-align:middle;color:var(--text-color)}i:hover{color:#fff}.home{height:55px;color:var(--text-color);width:100%;display:flex;border-bottom:1px solid var(--formBorder-color);vertical-align:-webkit-baseline-middle;background-color:var(--back-color);font-family:Segoe UI;overflow-x:auto;overflow-y:hidden}*{scrollbar-width:thin;scrollbar-color:var(--thumb-color),var(--back-color)}*::-webkit-scrollbar{-webkit-appearance:none;background-color:var(--back-color);height:10px;width:10px;outline:none}*::-webkit-scrollbar-button{-webkit-appearance:none;height:3px;width:3px}*::-webkit-scrollbar-thumb{-webkit-appearance:none;background-color:var(--thumb-color);height:10px;min-width:25px;max-width:80%;border-radius:4px;border:2px solid var(--back-color)}*::-webkit-scrollbar-thumb:hover{background-color:var(--trackHover-color);height:10px}*::-webkit-scrollbar-track{-webkit-appearance:none;background-color:var(--back-color);border:1px solid var(--back-color)}*::-webkit-scrollbar-corner{background-color:var(--back-color)}.home input{margin-top:12.5px;vertical-align:-webkit-baseline-middle}.vertical-line{margin-top:10px;width:0px;height:32px;border-right:1px solid rgb(195,195,195);margin-right:5px}.Bold{background:var(--navbarBold-icon)}.Italic{background:var(--navbarItalic-icon)}.Underline{background:var(--navbarUnder-icon)}.foreground{margin-left:10px;margin-top:5px;width:16px;height:18px}.background{margin-left:8px;margin-top:5px;width:16px;height:18px}\n"], dependencies: [{ kind: "directive", type: i13.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i14.StiDropdownComponent, selector: "sti-dropdown-component", inputs: ["id", "options", "value", "disabled", "optionLabel", "optionValue", "isMinVersion", "tooltip"], outputs: ["valueChange"] }, { kind: "directive", type: i15.StiTooltipDirective, selector: "[stiTooltip]", inputs: ["tooltipPosition", "stiTooltip", "showDelay"] }, { kind: "component", type: i16.StiSelectButtonComponent, selector: "sti-selectButton", inputs: ["options", "value", "optionLabel", "optionValue", "multiple", "disabled"], outputs: ["onOptionClick", "onChange", "valueChange"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: StiHomeRibbonComponent, decorators: [{
            type: Component,
            args: [{ selector: "sti-home-ribbon-component", template: `<div
    class="home"
    style="-moz-user-select: none;-webkit-touch-callout: none;-webkit-user-select: none;-ms-user-select: none;user-select: none"
  >
    <div
      [style.margin-left]="'10px'"
      class="container {{ undoService?.undos?.length < 2 ? 'disabled' : '' }}"
      [stiTooltip]="loc.get2('HelpDesigner', 'Undo').replace('.', '')"
      tooltipPosition="bottom"
      showDelay="500"
      (click)="undoService.undo()"
    >
      <div class="button"><img [src]="model.getImage('images.Ribbon.Undo.png')" alt="" /></div>
    </div>
    <div
      class="container {{ undoService?.redos?.length < 1 ? 'disabled' : '' }}"
      [stiTooltip]="loc.get2('HelpDesigner', 'Redo').replace('.', '')"
      tooltipPosition="bottom"
      showDelay="500"
      (click)="undoService.redo()"
    >
      <div class="button"><img [src]="model.getImage('images.Ribbon.Redo.png')" alt="" /></div>
    </div>
    <!-- <div
      *ngIf="isRichText"
      [style.margin-left]="'10px'"
      class="container"
      [stiTooltip]="loc.getP('Undo')"
      tooltipPosition="bottom" showDelay="500"
      (click)="richTextService.useUndo()"
    >
      <div class="button"><img [src]="getIcon('Undo')" alt="" /></div>
    </div>
    <div
      *ngIf="isRichText"
      class="container"
      [stiTooltip]="loc.getP('Redo')"
      tooltipPosition="bottom" showDelay="500"
      (click)="richTextService.useRedo()"
    >
      <div class="button"><img [src]="getIcon('Redo')" alt="" /></div>
    </div> -->
    <div class="vertical-line"></div>
    <div
      class="container {{ !clipboardService.hasCopy ? 'disabled' : '' }}"
      [stiTooltip]="loc.get2('MainMenu', 'menuEditPaste').replace('&amp', '').replace(';', '')"
      tooltipPosition="bottom"
      showDelay="500"
      (click)="clipboardService.pasteElement($event)"
    >
      <div class="button"><img [src]="model.getImage('images.Ribbon.Paste.png')" alt="" /></div>
    </div>
    <div
      class="container {{ clipboardService.canCopy ? 'disabled' : '' }}"
      [stiTooltip]="loc.get2('MainMenu', 'menuEditCopy').replace('&amp', '').replace(';', '')"
      tooltipPosition="bottom"
      showDelay="500"
      (click)="clipboardService.copyElement()"
    >
      <div class="button"><img [src]="model.getImage('images.Ribbon.Copy.png')" alt="" /></div>
    </div>
    <div
      class="container {{ clipboardService.canCopy ? 'disabled' : '' }}"
      [stiTooltip]="loc.get2('MainMenu', 'menuEditCut').replace('&amp', '').replace(';', '')"
      tooltipPosition="bottom"
      showDelay="500"
      (click)="clipboardService.cutElement()"
    >
      <div class="button"><img [src]="model.getImage('images.Ribbon.Cut.png')" alt="" /></div>
    </div>
    <div
      class="container {{ !canDelete ? 'disabled' : '' }}"
      [stiTooltip]="loc.get2('Buttons', 'Delete')"
      tooltipPosition="bottom"
      showDelay="500"
      (click)="formEvents.deleteComponent()"
    >
      <div class="button"><img [src]="model.getImage('images.Ribbon.Delete.png')" alt="" /></div>
    </div>
    <div class="vertical-line"></div>
    <sti-dropdown-component
      *ngIf="!isRichText"
      [id]="0"
      [options]="model.fontFamilies"
      [(value)]="fontFamily"
      [disabled]="editableContentService.editableContent == null"
      [tooltip]="loc.get2('HelpDesigner', 'FontName')"
      [optionLabel]="'name'"
      [optionValue]="'name'"
      [style]="{
        width: '150px',
        height: '32px',
        alignItems: 'center',
        margin: '1px 2px',
        marginTop: '10px',
        fontSize: '12px'
      }"
      (mousedown)="$event.preventDefault()"
      (mouseup)="editableContentService.startEdit()"
      (valueChange)="changeEvent()"
    ></sti-dropdown-component>
    <!-- <p-dropdown
      *ngIf="!isRichText"
      [options]="model.fontFamilies"
      [(ngModel)]="fontFamily"
      optionLabel="name"
      optionValue="name"
      [style]="{
        width: '150px',
        height: '32px',
        alignItems: 'center',
        margin: '1px 2px',
        marginTop: '10px',
        fontSize: '12px'
      }"
      [disabled]="editableContentService.editableContent == null"
      [tooltip]="loc.get2('HelpDesigner', 'FontName')"
      tooltipPosition="bottom"
      showDelay="500"
      (mousedown)="$event.preventDefault()"
      (mouseup)="editableContentService.startEdit()"
      (onChange)="changeEvent()"
    ></p-dropdown> -->
    <sti-dropdown-component
      *ngIf="isRichText"
      [id]="1"
      [options]="model.fontFamilies"
      [(value)]="richTextService.activeFontFamily"
      [tooltip]="loc.get2('HelpDesigner', 'FontName')"
      [optionLabel]="'name'"
      [optionValue]="'name'"
      [style]="{
        width: '150px',
        height: '32px',
        alignItems: 'center',
        margin: '1px 2px',
        marginTop: '10px',
        fontSize: '12px'
      }"
      (mousedown)="$event.preventDefault()"
      (mouseup)="editableContentService.startEdit()"
      (valueChange)="richTextService.insertFontFamily(richTextService.activeFontFamily)"
    ></sti-dropdown-component>
    <!-- <p-dropdown
      *ngIf="isRichText"
      [options]="model.fontFamilies"
      [(ngModel)]="richTextService.activeFontFamily"
      optionLabel="name"
      optionValue="name"
      [style]="{
        width: '150px',
        height: '32px',
        alignItems: 'center',
        margin: '1px 2px',
        marginTop: '10px',
        fontSize: '12px'
      }"
      [tooltip]="loc.get2('HelpDesigner', 'FontName')"
      tooltipPosition="bottom"
      showDelay="500"
      (mousedown)="$event.preventDefault()"
      (onChange)="richTextService.insertFontFamily(richTextService.activeFontFamily)"
      (mouseup)="editableContentService.startEdit()"
    ></p-dropdown> -->
    <sti-dropdown-component
      *ngIf="!isRichText"
      [id]="2"
      [options]="helper.fontSizes"
      [(value)]="fontSize"
      [tooltip]="loc.getP('FontSize')"
      [style]="{
        width: '60px',
        height: '32px',
        alignItems: 'center',
        margin: '10px 10px 1px 2px',
        fontSize: '12px'
      }"
      [disabled]="editableContentService.editableContent == null"
      (mousedown)="$event.preventDefault()"
      (mouseup)="editableContentService.startEdit()"
      (valueChange)="changeEvent()"
    ></sti-dropdown-component>
    <!-- <p-dropdown
      *ngIf="!isRichText"
      [options]="helper.fontSizes"
      [(ngModel)]="fontSize"
      [style]="{ width: '60px', height: '32px', alignItems: 'center', margin: '10px 10px 1px 2px', fontSize: '12px' }"
      [tooltip]="loc.getP('FontSize')"
      tooltipPosition="bottom"
      showDelay="500"
      [disabled]="editableContentService.editableContent == null"
      (mousedown)="$event.preventDefault()"
      (mouseup)="editableContentService.startEdit()"
      (onChange)="changeEvent()"
    ></p-dropdown> -->
    <sti-dropdown-component
      *ngIf="isRichText"
      [id]="3"
      [options]="helper.richTextFontSizes"
      [(value)]="richTextService.activeFontSize"
      [tooltip]="loc.getP('FontSize')"
      [optionLabel]="'name'"
      [optionValue]="'value'"
      [style]="{
        width: '60px',
        height: '32px',
        alignItems: 'center',
        margin: '10px 10px 1px 2px',
        fontSize: '12px'
      }"
      (mousedown)="$event.preventDefault()"
      (mouseup)="editableContentService.startEdit()"
      (valueChange)="richTextService.insertFontSize()"
    ></sti-dropdown-component>
    <!-- <p-dropdown
      *ngIf="isRichText"
      [options]="helper.richTextFontSizes"
      [(ngModel)]="richTextService.activeFontSize"
      optionLabel="name"
      optionValue="value"
      [style]="{ width: '60px', height: '32px', alignItems: 'center', margin: '10px 10px 1px 2px', fontSize: '12px' }"
      [tooltip]="loc.getP('FontSize')"
      tooltipPosition="bottom"
      showDelay="500"
      (mousedown)="$event.preventDefault()"
      (onChange)="richTextService.insertFontSize()"
      (mouseup)="editableContentService.startEdit()"
    ></p-dropdown> -->
    <sti-selectButton
      *ngIf="!isRichText"
      [options]="helper.styleOptions"
      [(value)]="fontStyle"
      [multiple]="true"
      optionValue="value"
      [style]="{ margin: '11px 10px 1px 1px', height: '32px', minWidth: '94px' }"
      [disabled]="editableContentService.editableContent == null"
      (mousedown)="$event.preventDefault()"
      (onChange)="changeEvent()"
      ><ng-template let-item>
        <img
          [src]="model.getImage(item.image)"
          [stiTooltip]="loc.getP(item.value)"
          tooltipPosition="bottom"
          showDelay="500"
        /> </ng-template
    ></sti-selectButton>
    <sti-selectButton
      *ngIf="isRichText"
      [options]="helper.styleOptions"
      [(value)]="richTextService.activeTextStyles"
      [multiple]="true"
      optionValue="value"
      (onOptionClick)="setStyle($event.option.value)"
      [style]="{ margin: '11px 10px 1px 1px', height: '32px', minWidth: '94px' }"
      ><ng-template let-item>
        <img
          [src]="model.getImage(item.image)"
          [stiTooltip]="loc.getP(item.value)"
          tooltipPosition="bottom"
          showDelay="500"
        /> </ng-template
    ></sti-selectButton>
    <div class="vertical-line"></div>
    <div
      *ngIf="!isRichText"
      class="button-container"
      [stiTooltip]="loc.getP('ForeColor')"
      tooltipPosition="bottom"
      showDelay="500"
      [style.opacity]="editableContentService.editableContent != null ? '1' : '0.5'"
      [class]="editableContentService.editableContent != null ? 'enabled' : 'disabled'"
      (click)="showColorPicker(fontColorEditor, foreColor)"
      (mousedown)="$event.preventDefault()"
      #fontColorEditor
    >
      <div class="prev">
        <div class="foreground" [style]="{ backgroundPosition: 'center', backgroundRepeat: 'no-repeat' }">
          <img [src]="model.getImage('images.Brush.png')" alt="" />
        </div>
        <span
          class="color-preview"
          [style.background-color]="
            editableContentService.editableContent != null
              ? editableContentService.editableContent?.eColor?.toHtmlColor()
              : 'rgb(182, 181, 180)'
          "
        ></span>
      </div>
      <div [style]="{ position: 'relative', alignSelf: 'center' }">
        <i class="pi pi-chevron-down"></i>
      </div>
    </div>
    <div
      *ngIf="isRichText"
      class="button-container"
      [stiTooltip]="loc.getP('ForeColor')"
      tooltipPosition="bottom"
      showDelay="500"
      [style.opacity]="1"
      [class]="'enabled'"
      (click)="showColorPicker(richTextColorEditor, richTextService.activeColor, true)"
      (mousedown)="$event.preventDefault()"
      #richTextColorEditor
    >
      <div class="prev">
        <div class="foreground" [style]="{ backgroundPosition: 'center', backgroundRepeat: 'no-repeat' }">
          <img [src]="model.getImage('images.Brush.png')" alt="" />
        </div>
        <span class="color-preview" [style.background-color]="richTextService.activeColor.toHtmlColor()"></span>
      </div>
      <div [style]="{ position: 'relative', alignSelf: 'center' }">
        <i class="pi pi-chevron-down"></i>
      </div>
    </div>
    <div
      class="button-container"
      [stiTooltip]="loc.getP('BackColor')"
      tooltipPosition="bottom"
      showDelay="500"
      [style.opacity]="haveBackgroundColor() ? '1' : '0.5'"
      [class]="haveBackgroundColor() ? 'enabled' : 'disabled'"
      (click)="showColorPicker(backColorEditor, backColor)"
      (mousedown)="$event.preventDefault()"
      (mouseup)="editableContentService.startEdit()"
      #backColorEditor
    >
      <div class="prev">
        <div class="background" [style]="{ backgroundPosition: 'center', backgroundRepeat: 'no-repeat' }">
          <img [src]="model.getImage('images.Fill.png')" alt="" />
        </div>
        <span
          class="color-preview"
          [style.background-color]="
            editableContentService.editableContent != null
              ? editableContentService.editableContent?.eBackgroundColor?.toHtmlColor()
              : 'rgb(182, 181, 180)'
          "
        ></span>
      </div>
      <div [style]="{ position: 'relative', alignSelf: 'center' }">
        <i class="pi pi-chevron-down"></i>
      </div>
    </div>
    <sti-selectButton
      *ngIf="haveContentAlignment()"
      [options]="helper.justifyOptions"
      [(value)]="editableContentService.editableContent.eContentAlignment"
      optionValue="value"
      [style]="{ margin: '11px 10px 1px 1px', height: '32px', minWidth: '94px' }"
      (mousedown)="editableContentService.startEdit()"
    >
      <ng-template let-item>
        <img
          [src]="model.getImage(item.image)"
          [stiTooltip]="loc.getP(item.name)"
          tooltipPosition="bottom"
          showDelay="500"
          [style]="{ height: '16px', width: '16px' }"
        />
      </ng-template>
    </sti-selectButton>
    <sti-selectButton
      *ngIf="!haveContentAlignment() && !isRichText"
      [options]="helper.justifyOptions"
      optionValue="value"
      [style]="{ margin: '11px 10px 1px 1px', height: '32px', minWidth: '94px' }"
      [disabled]="true"
    >
      <ng-template let-item>
        <img
          [src]="model.getImage(item.image)"
          [stiTooltip]="loc.getP(item.name)"
          tooltipPosition="bottom"
          showDelay="500"
          [style]="{ height: '16px', width: '16px' }"
        />
      </ng-template>
    </sti-selectButton>
    <sti-selectButton
      *ngIf="isRichText"
      [options]="helper.justifyOptions"
      [(value)]="richTextService.activeAlignment"
      optionValue="value"
      [style]="{ margin: '11px 10px 1px 1px', height: '32px', minWidth: '94px' }"
      (onOptionClick)="setAlignment($event.option.value)"
    >
      <ng-template let-item>
        <img
          [src]="model.getImage(item.image)"
          [stiTooltip]="loc.getP(item.name)"
          tooltipPosition="bottom"
          showDelay="500"
          [style]="{ height: '16px', width: '16px' }"
        />
      </ng-template>
    </sti-selectButton>
    <sti-selectButton
      *ngIf="haveVerticalAlignment()"
      [options]="helper.verticalAlignment"
      [(value)]="editableContentService.editableContent.eVerticalAlignment"
      optionValue="value"
      [style]="{ margin: '11px 10px 1px 1px', height: '32px', minWidth: '94px' }"
      (mousedown)="editableContentService.startEdit()"
    >
      <ng-template let-item>
        <img
          [src]="model.getImage(item.image)"
          [stiTooltip]="loc.getP(item.name)"
          tooltipPosition="bottom"
          showDelay="500"
          [style]="{ height: '16px', width: '16px' }"
        />
      </ng-template>
    </sti-selectButton>
    <sti-selectButton
      *ngIf="!haveVerticalAlignment()"
      [options]="helper.verticalAlignment"
      optionValue="value"
      [disabled]="true"
      [style]="{ margin: '11px 10px 1px 1px', height: '32px', minWidth: '90px' }"
    >
      <ng-template let-item>
        <img
          [src]="model.getImage(item.image)"
          [stiTooltip]="loc.getP(item.name)"
          tooltipPosition="bottom"
          showDelay="500"
          [style]="{ height: '16px', width: '16px' }"
        />
      </ng-template>
    </sti-selectButton>
    <!-- <div class="vertical-line"></div>
    <div
      class="container"
      [stiTooltip]="loc.getP('ToggleElementCorners')"
      tooltipPosition="bottom"
      showDelay="500"
      (click)="model.showCornerRadius = !model.showCornerRadius"
    >
      <div class="button {{ model.showCornerRadius ? 'active' : '' }}"><img [src]="getIcon('Corners')" alt="" /></div>
    </div> -->
  </div>`, styles: [".active{background-color:var(--active-color)!important}.disabled{opacity:.5;pointer-events:none}.container{width:40px;display:flex;align-items:center;justify-content:center}.button{height:32px;width:32px;background-color:var(--back-color);border-radius:3px;display:flex;align-items:center;justify-content:center}.button:hover{background-color:var(--hover-color)!important}.button:active{background-color:var(--columnDeleteHover-color)!important}img{max-width:18px}.prev{display:flex;width:100%;position:relative;flex-direction:column}.button-container{display:flex;margin-top:11px;height:32px;width:48px;position:relative;margin-right:10px;border-radius:3px}.button-container:hover{background-color:var(--hover-color)}.button-container:active{background-color:var(--columnDeleteHover-color)}.color-preview{width:20px;height:5px;margin-left:6px}i{height:12px;width:12px;right:3px;top:50%;vertical-align:middle;color:var(--text-color)}i:hover{color:#fff}.home{height:55px;color:var(--text-color);width:100%;display:flex;border-bottom:1px solid var(--formBorder-color);vertical-align:-webkit-baseline-middle;background-color:var(--back-color);font-family:Segoe UI;overflow-x:auto;overflow-y:hidden}*{scrollbar-width:thin;scrollbar-color:var(--thumb-color),var(--back-color)}*::-webkit-scrollbar{-webkit-appearance:none;background-color:var(--back-color);height:10px;width:10px;outline:none}*::-webkit-scrollbar-button{-webkit-appearance:none;height:3px;width:3px}*::-webkit-scrollbar-thumb{-webkit-appearance:none;background-color:var(--thumb-color);height:10px;min-width:25px;max-width:80%;border-radius:4px;border:2px solid var(--back-color)}*::-webkit-scrollbar-thumb:hover{background-color:var(--trackHover-color);height:10px}*::-webkit-scrollbar-track{-webkit-appearance:none;background-color:var(--back-color);border:1px solid var(--back-color)}*::-webkit-scrollbar-corner{background-color:var(--back-color)}.home input{margin-top:12.5px;vertical-align:-webkit-baseline-middle}.vertical-line{margin-top:10px;width:0px;height:32px;border-right:1px solid rgb(195,195,195);margin-right:5px}.Bold{background:var(--navbarBold-icon)}.Italic{background:var(--navbarItalic-icon)}.Underline{background:var(--navbarUnder-icon)}.foreground{margin-left:10px;margin-top:5px;width:16px;height:18px}.background{margin-left:8px;margin-top:5px;width:16px;height:18px}\n"] }]
        }], ctorParameters: function () { return [{ type: i1.StiModelService }, { type: i2.StiHelperService }, { type: i3.StiDraggableService }, { type: i4.StiThemeService }, { type: StiRectangleGeometryLayout }, { type: i5.FormEventsService }, { type: i6.StiEditableContentService }, { type: i7.StiLocalizationService }, { type: i8.StiRichTextService }, { type: i9.StiUndoService }, { type: i10.StiNameService }, { type: i11.StiColorDialogService }, { type: i12.StiClipboardService }]; } });
//# sourceMappingURL=data:application/json;base64, 