@if (showBatchBar()) {
  <td bitCell [ngClass]="RowHeightClass" class="tw-w-10">
    <input
      type="checkbox"
      bitCheckbox
      [checked]="selected()"
      (change)="checkboxChange.emit()"
      [attr.aria-label]="cipher().name"
    />
  </td>
}
<td bitCell [ngClass]="RowHeightClass" class="tw-flex tw-items-center tw-gap-2">
  <app-vault-icon [cipher]="cipher()"></app-vault-icon>
  <div class="tw-truncate">
    <div class="tw-inline-flex tw-w-full">
      <button
        bitLink
        class="tw-overflow-hidden tw-text-ellipsis tw-text-start tw-leading-snug"
        [disabled]="disabled()"
        (click)="viewCipher()"
        title="{{ 'editItemWithName' | i18n: cipher().name }}"
        type="button"
        aria-haspopup="true"
      >
        {{ cipher().name }}
      </button>
      @if (hasAttachments()) {
        <i
          class="bwi bwi-paperclip tw-ml-2 tw-leading-normal"
          title="{{ 'attachments' | i18n }}"
          aria-hidden="true"
        ></i>
        <span class="tw-sr-only">{{ "attachments" | i18n }}</span>
        @if (showFixOldAttachments()) {
          <i
            class="bwi bwi-exclamation-triangle tw-ml-2 tw-leading-normal tw-text-warning"
            title="{{ 'attachmentsNeedFix' | i18n }}"
            aria-hidden="true"
          ></i>
          <span class="tw-sr-only">{{ "attachmentsNeedFix" | i18n }}</span>
        }
      }
    </div>
    <br />
    <span class="tw-text-sm tw-text-muted">{{ subtitle() }}</span>
  </div>
</td>
@if (showOwner()) {
  <td bitCell [ngClass]="RowHeightClass" class="tw-hidden @md:tw-table-cell">
    <app-org-badge
      [disabled]="disabled()"
      [organizationId]="cipher().organizationId"
      [organizationName]="cipher().organizationId | orgNameFromId: organizations()"
    >
    </app-org-badge>
  </td>
}
<td bitCell [ngClass]="RowHeightClass" class="tw-text-right tw-whitespace-nowrap">
  @if (decryptionFailure()) {
    <button
      [disabled]="disabled() || !canManageCollection()"
      [bitMenuTriggerFor]="corruptedCipherOptions"
      size="small"
      bitIconButton="bwi-ellipsis-v"
      type="button"
      label="{{ 'moreOptions' | i18n }}"
    ></button>
    <bit-menu #corruptedCipherOptions>
      @if (canDeleteCipher()) {
        <button bitMenuItem variant="danger" (click)="deleteCipher()" type="button">
          <bit-icon fixedWidth name="bwi-trash" slot="start" />
          {{ (isDeleted() ? "permanentlyDelete" : "delete") | i18n }}
        </button>
      }
    </bit-menu>
  } @else {
    @if (canLaunch()) {
      <button
        [disabled]="disabled()"
        bitIconButton="bwi-external-link"
        type="button"
        [label]="'launchWebsiteForName' | i18n: cipher().name"
        (click)="handleLaunch()"
      ></button>
    }
    @if (showCopyActions()) {
      <vault-item-copy-actions
        class="tw-inline-flex tw-align-middle"
        [cipher]="cipher()"
        [showQuickCopyActions]="showQuickCopyActions()"
        [disabled]="disabled()"
      ></vault-item-copy-actions>
    }

    <button
      #optionsMenuTrigger="menuTrigger"
      [bitMenuTriggerFor]="cipherOptions"
      [disabled]="disabled()"
      bitIconButton="bwi-ellipsis-v"
      type="button"
      label="{{ 'moreOptions' | i18n }}"
    ></button>
    <bit-menu #cipherOptions>
      @if (showFavorite()) {
        <button bitMenuItem type="button" (click)="toggleFavorite()">
          <i class="bwi bwi-fw bwi-star" aria-hidden="true"></i>
          {{ (cipher().favorite ? "unfavorite" : "favorite") | i18n }}
        </button>
      }
      @if (canEditCipher()) {
        <button bitMenuItem type="button" (click)="editCipher()">
          <i class="bwi bwi-fw bwi-pencil-square" aria-hidden="true"></i>
          {{ "edit" | i18n }}
        </button>
      }
      @if (showAttachments()) {
        <button bitMenuItem type="button" (click)="attachments()">
          <i class="bwi bwi-fw bwi-paperclip" aria-hidden="true"></i>
          {{ "attachments" | i18n }}
        </button>
      }
      @if (showClone()) {
        <button bitMenuItem type="button" (click)="clone()">
          <i class="bwi bwi-fw bwi-files" aria-hidden="true"></i>
          {{ "clone" | i18n }}
        </button>
      }
      @if (showAssignToCollections()) {
        <button bitMenuItem type="button" (click)="assignToCollections()">
          <bit-icon fixedWidth [name]="'bwi-collection-shared' | vfo1Icon" slot="start" />
          {{ "assignToCollections" | vfo1I18n: "addToSharedFolder" }}
        </button>
      }
      @if (showArchiveButton()) {
        @if (userCanArchive()) {
          <button bitMenuItem (click)="archive()" type="button">
            <i class="bwi bwi-fw bwi-archive" aria-hidden="true"></i>
            {{ "archiveVerb" | i18n }}
          </button>
        }
        @if (!userCanArchive()) {
          <button bitMenuItem (click)="badge.promptForPremium($event)" type="button">
            <i class="bwi bwi-fw bwi-archive" aria-hidden="true"></i>
            {{ "archiveVerb" | i18n }}
            <!-- Hide app-premium badge from accessibility tools as it results in a button within a button -->
            <div slot="end" class="-tw-mt-0.5" aria-hidden>
              <app-premium-badge #badge></app-premium-badge>
            </div>
          </button>
        }
      }

      @if (showUnArchiveButton()) {
        <button bitMenuItem (click)="unarchive()" type="button">
          <i class="bwi bwi-fw bwi-unarchive" aria-hidden="true"></i>
          {{ "unArchive" | i18n }}
        </button>
      }

      @if (isDeleted() && canRestoreCipher()) {
        <button bitMenuItem (click)="restore()" type="button">
          <i class="bwi bwi-fw bwi-undo" aria-hidden="true"></i>
          {{ "restore" | i18n }}
        </button>
      }
      @if (canDeleteCipher()) {
        <button bitMenuItem variant="danger" (click)="deleteCipher()" type="button">
          <bit-icon fixedWidth name="bwi-trash" slot="start" />
          {{ (isDeleted() ? "permanentlyDelete" : "delete") | i18n }}
        </button>
      }
    </bit-menu>
  }
</td>
