'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-8fdcf600.js');

const wistiaVideoCss = ".sc-wistia-video-h{display:block}.sc-wistia-video-h .wistia_embed.sc-wistia-video{margin:auto}";

const WistiaVideo = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        this.width = 720;
        this.height = 520;
    }
    handleWindowResize() {
        window.requestAnimationFrame(() => this.resizeVideo());
    }
    componentDidLoad() {
        window.requestAnimationFrame(() => this.resizeVideo());
    }
    resizeVideo() {
        if (this.el) {
            const parent = this.el.parentElement;
            const width = parent === null || parent === void 0 ? void 0 : parent.offsetWidth;
            if (!width) {
                return;
            }
            this.width = width;
            this.height = width * (10 / 16);
        }
    }
    render() {
        const { videoId } = this;
        if (!videoId) {
            return null;
        }
        return (index.h(index.Host, null, index.h("script", { src: "//fast.wistia.com/assets/external/E-v1.js", async: true }), index.h("div", { class: `wistia_embed wistia_async_${videoId}`, style: {
                width: `${this.width}px`,
                height: `${this.height}px`,
            } }, "\u00A0")));
    }
    get el() { return index.getElement(this); }
};
WistiaVideo.style = wistiaVideoCss;

exports.wistia_video = WistiaVideo;
