'use strict';

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

const index = require('./index-8277cbb3.js');
const domContextHooks_module = require('./dom-context-hooks.module-e7b6727c.js');
const index_module = require('./index.module-f8c8495f.js');
require('./JSS-8503a151.js');
require('./mixins-4761d472.js');
const sqmCloseButtonView = require('./sqm-close-button-view-e9f2a454.js');

const CloseButton = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    /**
     * @uiName Color
     * @uiWidget color
     * @uiType string
     */
    this.color = "#000000";
    domContextHooks_module.h$1(this);
  }
  disconnectedCallback() { }
  render() {
    var _a;
    const sdk = index_module.getEnvironmentSDK();
    const isPopup = sdk.type === "SquatchJS2" &&
      ((_a = sdk.widgetIdent) === null || _a === void 0 ? void 0 : _a.engagementMedium) === "POPUP";
    if (!isPopup)
      return index.h("div", { style: { display: "none" } });
    const onClick = () => {
      var _a, _b;
      if (sdk.type === "SquatchJS2") {
        (_b = (_a = sdk.api).close) === null || _b === void 0 ? void 0 : _b.call(_a);
      }
    };
    return index.h(sqmCloseButtonView.CloseButtonView, { onClick: onClick, color: this.color });
  }
};

exports.sqm_close_button = CloseButton;
