<!--

    Copyright © 2016-2026 The Thingsboard Authors

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<mat-toolbar color="primary">
  <h2>{{ 'image.embed-image' | translate }}</h2>
  <span class="flex-1"></span>
  <button mat-icon-button
          (click)="cancel()"
          type="button">
    <mat-icon class="material-icons">close</mat-icon>
  </button>
</mat-toolbar>
@if (isLoading$ | async) {
  <mat-progress-bar color="warn" mode="indeterminate">
  </mat-progress-bar>
} @else {
  <div style="height: 4px;"></div>
}
<div mat-dialog-content>
  @if (!readonly || image.public) {
    <div class="tb-form-panel stroked tb-slide-toggle">
      <mat-expansion-panel class="tb-settings" [expanded]="image.public" disabled>
        <mat-expansion-panel-header class="flex flex-row flex-wrap">
          <mat-panel-title>
            @if (!readonly) {
              <div tb-hint-tooltip-icon="{{ 'image.embed-to-html-hint' | translate }}"
                   class="tb-form-row no-border no-padding">
                <mat-slide-toggle class="mat-slide flex items-stretch justify-center" [formControl]="publicStatusControl" (click)="$event.stopPropagation()">
                  <div class="tb-form-panel-title">{{ 'image.embed-to-html' | translate }}</div>
                </mat-slide-toggle>
              </div>
            }
            @if (readonly) {
              <div class="tb-form-panel-title" translate>image.embed-to-html</div>
            }
          </mat-panel-title>
        </mat-expansion-panel-header>
        <ng-template matExpansionPanelContent>
          <div class="tb-embed-image-text" [innerHTML]="'image.embed-to-html-text' | translate"></div>
          <tb-markdown usePlainMarkdown
                       containerClass="tb-embed-image-code"
          [data]="embedToHtmlCode()"></tb-markdown>
        </ng-template>
      </mat-expansion-panel>
    </div>
  }
  <div class="tb-form-panel stroked">
    <div class="tb-form-panel-title" translate>image.embed-to-angular-template</div>
    <div class="tb-embed-image-text" [innerHTML]="'image.embed-to-angular-template-text' | translate"></div>
    <tb-markdown usePlainMarkdown
                 containerClass="tb-embed-image-code"
    [data]="embedToAngularTemplateCode()"></tb-markdown>
  </div>
</div>
