/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import { html, until } from "chrome://global/content/vendor/lit.all.mjs"; import { MozLitElement } from "chrome://global/content/lit-utils.mjs"; const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { featureEngineIdToFluentId: "chrome://global/content/ml/Utils.sys.mjs", }); const DEFAULT_EXTENSION_ICON = "chrome://mozapps/skin/extensions/extensionGeneric.svg"; class MLModelCardListAdditions extends MozLitElement { static properties = { addon: { type: Object, reflect: false }, expanded: { type: Boolean, reflect: true, attribute: true }, }; setAddon(addon) { this.addon = addon; } async renderUsedByAddons() { if (!this.addon.usedByAddonIds.length) { return null; } const addons = await AddonManager.getAddonsByIDs(this.addon.usedByAddonIds); return addons?.map(addon => { if (!addon) { return null; } const iconURL = addon.iconURL ?? DEFAULT_EXTENSION_ICON; return html`