<commit_before><!--
 - This Source Code is subject to the terms of the Mozilla Public License
 - version 2.0 (the "License"). You can obtain a copy of the License at
 - http://mozilla.org/MPL/2.0/.
 -->

<template>
  <div class="password-info-container">
    <password-message ref="password-message"
                      :messages="{
                        password_ready: false,
                        password_copied: true,
                        no_such_password: false,
                        unknown_generation_method: false
                      }"
    />

    <div class="password-container">
      <iconic-link ref="to-clipboard" class="to-clipboard-link" :title="$t('/(panel)(components)(PasswordMenu)to_clipboard')" @click="copy" />
      <span class="user-name-container">
        <span class="user-name">{{ password.name }}</span>
        <span v-if="password.revision" class="password-revision">{{ password.revision }}</span>
      </span>
      <span v-if="showPasswords && value" class="password-value">{{ value }}</span>
      <iconic-link class="password-remove-link" :title="$t('/(panel)(components)(PasswordMenu)remove_password')" @click="removePassword" />
    </div>
    <div class="password-info">
      <template v-if="password.type == 'generated2'">
        <div class="password-type">{{ $t("/(panel)(components)(PasswordEntry)password_type_generated2") }} </div>
        <div>{{ $t("/(panel)(components)(PasswordEntry)password_length") }} {{ password.length }}</div>
        <div>{{ $t("/(panel)(components)(PasswordEntry)allowed_characters") }}  {{ allowedChars }}</div>
      </template>
      <template v-else-if="password.type == 'stored'">
        <div class="password-type">
          {{ $t("password_type_stored") }}
          <span class="help-icon" :title="$t('recovery_code_explanation')"
                :aria-label="$t('recovery_code_explanation')"
          />
        </div>
        <pre v-if="recoveryCode">{{ recoveryCode }}</pre>
      </template>
      <div v-if="showNotes && password.notes">{{ $t("/(panel)(components)(PasswordEntry)notes") }} {{ password.notes }}</div>
    </div>
  </div>
</template>

<script>
"use strict";

import {set as clipboardSet} from "../../clipboard";
import {passwords, recoveryCodes} from "../../proxy";
import PasswordMessage from "../../components/PasswordMessage.vue";

export default {
  name: "PasswordInfo",
  components: {
    "password-message": PasswordMessage
  },
  props: {
    password: {
      type: Object,<commit_msg>All Passwords page: Normalized whitespace in password types<commit_after><!--
 - This Source Code is subject to the terms of the Mozilla Public License
 - version 2.0 (the "License"). You can obtain a copy of the License at
 - http://mozilla.org/MPL/2.0/.
 -->

<template>
  <div class="password-info-container">
    <password-message ref="password-message"
                      :messages="{
                        password_ready: false,
                        password_copied: true,
                        no_such_password: false,
                        unknown_generation_method: false
                      }"
    />

    <div class="password-container">
      <iconic-link ref="to-clipboard" class="to-clipboard-link" :title="$t('/(panel)(components)(PasswordMenu)to_clipboard')" @click="copy" />
      <span class="user-name-container">
        <span class="user-name">{{ password.name }}</span>
        <span v-if="password.revision" class="password-revision">{{ password.revision }}</span>
      </span>
      <span v-if="showPasswords && value" class="password-value">{{ value }}</span>
      <iconic-link class="password-remove-link" :title="$t('/(panel)(components)(PasswordMenu)remove_password')" @click="removePassword" />
    </div>
    <div class="password-info">
      <template v-if="password.type == 'generated2'">
        <div class="password-type">{{ $t("/(panel)(components)(PasswordEntry)password_type_generated2") }}</div>
        <div>{{ $t("/(panel)(components)(PasswordEntry)password_length") }} {{ password.length }}</div>
        <div>{{ $t("/(panel)(components)(PasswordEntry)allowed_characters") }}  {{ allowedChars }}</div>
      </template>
      <template v-else-if="password.type == 'stored'">
        <div class="password-type">
          <template>{{ $t("password_type_stored") }}</template>
          <span class="help-icon" :title="$t('recovery_code_explanation')"
                :aria-label="$t('recovery_code_explanation')"
          />
        </div>
        <pre v-if="recoveryCode">{{ recoveryCode }}</pre>
      </template>
      <div v-if="showNotes && password.notes">{{ $t("/(panel)(components)(PasswordEntry)notes") }} {{ password.notes }}</div>
    </div>
  </div>
</template>

<script>
"use strict";

import {set as clipboardSet} from "../../clipboard";
import {passwords, recoveryCodes} from "../../proxy";
import PasswordMessage from "../../components/PasswordMessage.vue";

export default {
  name: "PasswordInfo",
  components: {
    "password-message": PasswordMessage
  },
  props: {
    password: {
      type: Object,
{'fraction_non_alphanumeric': 0.18138987043580684, 'fraction_numerical': 0.002355712603062426, 'mean_word_length': 2.949612403100775, 'pattern_counts': {'":': 2, '<': 81, '<?xml version=': 0, '>': 81, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2756313', 'n_tokens_mistral': 1502, 'n_tokens_neox': 1458, 'n_words': 296}