// Copyright 2026 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'chrome://resources/cr_elements/cr_button/cr_button.js';
import '/strings.m.js';
import { I18nMixinLit } from '//resources/cr_elements/i18n_mixin_lit.js';
import { CrLitElement } from '//resources/lit/v3_0/lit.rollup.js';
import { PersonalContextNoticeBrowserProxy } from './browser_proxy.js';
import { getCss } from './personal_context_notice.css.js';
import { getHtml } from './personal_context_notice.html.js';
const PersonalContextNoticeElementBase = I18nMixinLit(CrLitElement);
export class PersonalContextNoticeElement extends PersonalContextNoticeElementBase {
    static get is() {
        return 'personal-context-notice';
    }
    static get styles() {
        return getCss();
    }
    render() {
        return getHtml.bind(this)();
    }
    static get properties() {
        return {
            email_: { type: String },
            avatarUrl_: { type: String },
        };
    }
    #email__accessor_storage = '';
    get email_() { return this.#email__accessor_storage; }
    set email_(value) { this.#email__accessor_storage = value; }
    #avatarUrl__accessor_storage = '';
    get avatarUrl_() { return this.#avatarUrl__accessor_storage; }
    set avatarUrl_(value) { this.#avatarUrl__accessor_storage = value; }
    connectedCallback() {
        super.connectedCallback();
        PersonalContextNoticeBrowserProxy.getInstance()
            .handler.getAccountInfo()
            .then(response => {
            if (response.info) {
                this.email_ = response.info.email;
                this.avatarUrl_ = response.info.avatarUrl;
            }
            PersonalContextNoticeBrowserProxy.getInstance().handler.showUi();
        });
    }
    onManageSettingsClick_() {
        PersonalContextNoticeBrowserProxy.getInstance()
            .handler.onManageSettingsClicked();
    }
    onLearnMoreClick_(e) {
        const target = e.target;
        if (target.tagName === 'A') {
            e.preventDefault();
            PersonalContextNoticeBrowserProxy.getInstance()
                .handler.onLearnMoreClicked();
        }
    }
    onGotItClick_() {
        PersonalContextNoticeBrowserProxy.getInstance()
            .handler.onNoticeAcknowledged();
    }
}
customElements.define(PersonalContextNoticeElement.is, PersonalContextNoticeElement);
