<commit_before>import UiState from "../../stores/view/UiState";
import PlaybackState from "../../stores/view/PlaybackState";
const browser = window.browser;

export function find(target) {
  try{
    browser.tabs.query({
      active: true,
      windowId: window.contentWindowId
    }).then((tabs) => {
      if (!tabs.length) {
        console.log("No match tabs");
      } else {
        browser.tabs.sendMessage(tabs[0].id, {
          showElement: true,
          targetValue: target
        }).then((response) => {
          if (response){
            console.log(response.result);
          }
        });
      }
    });
  } catch (e) {
    console.error(e);
  }<commit_msg>show alert if the element wasnt found<commit_after>import UiState from "../../stores/view/UiState";
import PlaybackState from "../../stores/view/PlaybackState";
import ModalState from "../../stores/view/ModalState";
const browser = window.browser;

export function find(target) {
  try{
    browser.tabs.query({
      active: true,
      windowId: window.contentWindowId
    }).then((tabs) => {
      if (!tabs.length) {
        console.log("No match tabs");
      } else {
        browser.tabs.sendMessage(tabs[0].id, {
          showElement: true,
          targetValue: target
        }).then((response) => {
          if (response && response.result === "element not found") {
            ModalState.showAlert({
              title: "Element not found",
              description: `Could not find ${target} on the page`,
              confirmLabel: "Close"
            });
          }
        });
      }
    });
  } catch (e) {
    console.error(e);
  }
{'fraction_non_alphanumeric': 0.1513117754728493, 'fraction_numerical': 0.0012202562538133007, 'mean_word_length': 2.0426716141001857, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '6179855', 'n_tokens_mistral': 471, 'n_tokens_neox': 471, 'n_words': 106}