@if (!hideMenu) {
  <ng-container>
    <button
      type="button"
      [bitMenuTriggerFor]="optionsMenu"
      class="filter-options-icon"
      [attr.aria-label]="'organizationOptionsMenu' | i18n"
    >
      <i class="bwi bwi-ellipsis-v" aria-hidden="true"></i>
    </button>
    <bit-menu class="filter-organization-options" #optionsMenu>
      @if (!loaded) {
        <ng-container>
          <i
            class="bwi bwi-spinner bwi-spin tw-m-2 tw-text-muted"
            title="{{ 'loading' | i18n }}"
            aria-hidden="true"
          ></i>
          <span class="tw-sr-only">{{ "loading" | i18n }}</span>
        </ng-container>
      } @else {
        <div
          class="tw-flex tw-min-w-[200px] tw-max-w-[300px] tw-flex-col"
          [appApiAction]="actionPromise"
        >
          @if (allowEnrollmentChanges(organization) && !organization.resetPasswordEnrolled) {
            <button type="button" bitMenuItem (click)="toggleResetPasswordEnrollment(organization)">
              <i class="bwi bwi-fw bwi-key" aria-hidden="true"></i>
              {{ "enrollAccountRecovery" | i18n }}
            </button>
          }
          @if (allowEnrollmentChanges(organization) && organization.resetPasswordEnrolled) {
            <button type="button" bitMenuItem (click)="toggleResetPasswordEnrollment(organization)">
              <i class="bwi bwi-fw bwi-undo" aria-hidden="true"></i>
              {{ "withdrawAccountRecovery" | i18n }}
            </button>
          }
          @if (showSsoOptions(organization)) {
            <ng-container>
              @if (organization.ssoBound) {
                <button type="button" bitMenuItem (click)="unlinkSso(organization)">
                  <i class="bwi bwi-fw bwi-minus-circle"></i>
                  {{ "unlinkSso" | i18n }}
                </button>
              } @else {
                <button type="button" bitMenuItem (click)="handleLinkSso(organization)">
                  <i class="bwi bwi-fw bwi-plus-circle"></i>
                  {{ "linkSso" | i18n }}
                </button>
              }
            </ng-container>
          }
          @if (showLeaveOrgOption) {
            <button type="button" variant="danger" bitMenuItem (click)="leave(organization)">
              <bit-icon fixedWidth name="bwi-sign-out" slot="start" />
              {{ "leave" | i18n }}
            </button>
          }
        </div>
      }
    </bit-menu>
  </ng-container>
}
