var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
    if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
    if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
    return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _DevvitNavigateOffsiteDialog_cancelNavigation, _DevvitNavigateOffsiteDialog_completeNavigation;
import { msg } from '@lit/localize';
import { FaceplateDialog } from '@reddit/faceplate-ui/components/faceplate-dialog.js';
import { button, ButtonSize } from '@reddit/faceplate-ui/templates/client/button.js';
import { html, LitElement } from 'lit';
import { customElement, property, query } from 'lit/decorators.js';
import { styles } from '../styles.js';
let DevvitNavigateOffsiteDialog = class DevvitNavigateOffsiteDialog extends LitElement {
    constructor() {
        super(...arguments);
        this.url = '';
        _DevvitNavigateOffsiteDialog_cancelNavigation.set(this, () => {
            this.$dialog?.close();
        });
        _DevvitNavigateOffsiteDialog_completeNavigation.set(this, () => {
            window.open(this.url, '_blank');
            this.$dialog?.close();
        });
    }
    static get styles() {
        return [styles];
    }
    show(url) {
        this.url = url;
        this.$dialog?.showModal();
    }
    render() {
        return html `
      <faceplate-dialog class="z-dialog overflow-auto">
        <div class="flex flex-col gap-sm w-[32rem]">
          <span class="text-32 py-sm">
            ${msg('Continue to external link?', {
            desc: 'Title for dialog asking for permission to navigate off of Reddit',
        })}
          </span>
          <span>${this.url}</span>
          <p>
            ${msg('This link leads to an external site. We cannot guarantee the security on the external site, nor verify its contents.', {
            desc: 'Dialog message informing the user they are about to leave Reddit and that we cannot vouch for the contents of the destination',
        })}
          </p>
          <div class="flex flex-row justify-end gap-sm">
            ${button({
            appearance: 'secondary',
            size: ButtonSize.Medium,
            children: msg('Cancel', { desc: 'Cancel navigation' }),
            attributes: {
                onclick: __classPrivateFieldGet(this, _DevvitNavigateOffsiteDialog_cancelNavigation, "f"),
            },
        })}
            ${button({
            appearance: 'primary',
            size: ButtonSize.Medium,
            children: msg('Continue', { desc: 'Continue navigating to the external site' }),
            attributes: {
                onclick: __classPrivateFieldGet(this, _DevvitNavigateOffsiteDialog_completeNavigation, "f"),
            },
        })}
          </div>
        </div>
      </faceplate-dialog>
    `;
    }
};
_DevvitNavigateOffsiteDialog_cancelNavigation = new WeakMap();
_DevvitNavigateOffsiteDialog_completeNavigation = new WeakMap();
__decorate([
    property({ type: String }),
    __metadata("design:type", String)
], DevvitNavigateOffsiteDialog.prototype, "url", void 0);
__decorate([
    query('faceplate-dialog', true),
    __metadata("design:type", FaceplateDialog)
], DevvitNavigateOffsiteDialog.prototype, "$dialog", void 0);
DevvitNavigateOffsiteDialog = __decorate([
    customElement('devvit-navigate-offsite-dialog')
], DevvitNavigateOffsiteDialog);
export { DevvitNavigateOffsiteDialog };
//# sourceMappingURL=devvit-navigate-offsite-dialog.js.map