/**
 * Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), the rights to use, copy, modify, merge, and/or distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 * 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
 * 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
 */
import { ANIMATION_TIME, closeImg, COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CLOSE_MASK_BLOCK_ID, COMPONENT_CONTAINER_ID, COMPONENT_RETENTION_ID, COMPONENT_SECTION_ID, LOADING_ID, MOCKUP_ID } from "../../constant";
import { PlatformEnum } from "../../types";
import { addSetFontSizeEvent, amsSetSize, getDesignFontSize } from "../../util";
export var componentCss = ".ams-component-container-mobile {\n  width: 100%;\n  height: 1px;\n  position: fixed;\n  bottom: -1px;\n  left: 0;\n  z-index: 1001;\n  border-radius: 12px 12px 0 0;\n  overflow: hidden;\n}\n.ams-component-container-mobile-animation{\n  animation: ams-component-container-slide-in 0.3s ease-in-out;\n}\n\n.ams-component-section-desktop {\n  font-size: 0;\n}\n\n.ams-component-container-hidden-mobile {\n  width: 100%;\n  height: 0px;\n  position: fixed;\n  bottom: -1px;\n  left: 0;\n  z-index: 1001;\n  background-color: transparent;\n  border-radius: 12px 12px 0 0;\n  animation: ams-component-container-slide-out 0.26s ease-in forwards;\n  overflow: hidden;\n}\n\n.ams-component-section-mobile {\n  border-radius: 12px 12px 0 0;\n  overflow: hidden;\n  font-size: 0;\n  height: 100%;\n}\n\n.ams-component-container-desktop {\n  display: block;\n  width: 672px;\n  position: fixed;\n  top: 50%;\n  left: 50%;\n  z-index: 1001;\n  border-radius: 12px;\n  overflow: hidden;\n  transform-origin: 50% 50%;\n  transform: translate(-50%, -50%);\n}\n.ams-component-container-desktop-animation{\n  animation: ams-component-container-zoom-in 0.3s ease-in-out;\n  animation-fill-mode: forwards\n}\n\n@keyframes ams-component-container-zoom-out {\n  0% {\n    transform: translate(-50%, -50%) scale(1);\n    -webkit-transform: translate(-50%, -50%) scale(1);\n    opacity: 1\n  }\n\n  100% {\n    opacity: 0;\n    transform: translate(-50%, -50%) scale(0.4);\n    -webkit-transform: translate(-50%, -50%) scale(0.4);\n  }\n}\n\n@keyframes ams-component-container-zoom-in {\n  0% {\n    transform: translate(-50%, -50%) scale(0.4);\n    opacity: 0\n  }\n\n  100% {\n    opacity: 1;\n    transform: translate(-50%, -50%) scale(1);\n  }\n}\n\n.ams-component-container-hidden-desktop {\n  display: block;\n  position: fixed;\n  top: 50%;\n  left: 50%;\n  z-index: 1001;\n  border-radius: 8px;\n  overflow: hidden;\n  animation: ams-component-container-zoom-out 0.3s ease-in-out;\n  animation-fill-mode: forwards;\n  transform-origin: 50% 50%;\n}\n\n.ams-component-loading {\n  width: 0.8em;\n  height:0.8em;\n  background: rgba(0, 0, 0, 0.5);\n  border-radius: 8px;\n  position: fixed;\n  top: 50%;\n  left: 50%;\n  transform: translate(-50%, -50%);\n  z-index: 1001;\n  display: flex;\n  flex-direction: column;\n  justify-content: center;\n  align-items: center;\n}\n\n.ams-component-loading .line {\n  width: 40px;\n  height: 40px;\n  position: absolute;\n  top: 50%;\n  left: 50%;\n  transform: translate(-50%, -50%);\n}\n.ams-component-loading .line div {\n  position: absolute;\n  left: 17.67px;\n  top: 0;\n  width: 5.33px;\n  height: 40px;\n}\n\n.ams-component-loading .line div:before,\n.ams-component-loading .line div:after {\n  content: '';\n  display: block;\n  height: 13.33px;\n  background: #fcfcfc;\n  border-radius: 5.3px;\n}\n.ams-component-loading .line div:after {\n  margin-top: 13.33px;\n}\n\n.ams-component-loading .line div:nth-child(2) {\n  -webkit-transform: rotate(45deg);\n}\n\n.ams-component-loading .line div:nth-child(3) {\n  -webkit-transform: rotate(90deg);\n}\n\n.ams-component-loading .line div:nth-child(4) {\n  -webkit-transform: rotate(135deg);\n}\n\n/** \u52A0\u8F7D\u52A8\u753B **/\n@-webkit-keyframes load {\n  0% {\n      opacity: 0;\n  }\n\n  100% {\n      opacity: 1;\n  }\n}\n\n.ams-component-loading .line div:nth-child(1):before {\n  -webkit-animation: load 1s linear 0s infinite;\n}\n\n.ams-component-loading .line div:nth-child(2):before {\n  -webkit-animation: load 1s linear 0.125s infinite;\n}\n\n.ams-component-loading .line div:nth-child(3):before {\n  -webkit-animation: load 1s linear 0.25s infinite;\n}\n\n.ams-component-loading .line div:nth-child(4):before {\n  -webkit-animation: load 1s linear 0.375s infinite;\n}\n\n.ams-component-loading .line div:nth-child(1):after {\n  -webkit-animation: load 1s linear 0.5s infinite;\n}\n\n.ams-component-loading .line div:nth-child(2):after {\n  -webkit-animation: load 1s linear 0.675s infinite;\n}\n\n.ams-component-loading .line div:nth-child(3):after {\n  -webkit-animation: load 1s linear 0.75s infinite;\n}\n\n.ams-component-loading .line div:nth-child(4):after {\n  -webkit-animation: load 1s linear 0.875s infinite;\n}\n\n.ams-component-loading-logo {\n  width: 0.44em;\n  height: 0.44em;\n  -webkit-transform:rotate(360deg);\n  transform:rotate(360deg);\n  -webkit-transition:-webkit-transform 1s linear;\n  transition:transform 1s linear;\n  animation: ams-component-loading-logo 1s linear infinite;\n}\n\n.asm-component-close-block-desktop {\n  position: absolute;\n  width: 40px;\n  height: 40px;\n  right: 0;\n  top: 0;\n  cursor: pointer;\n}\n\n.asm-component-close-block-mobile {\n  position: absolute;\n  width: 0.4em;\n  height: 0.4em;\n  right: 0;\n  top: 0;\n  cursor: pointer;\n  z-index: 1009;\n}\n\n.asm-component-close-block-hidden {\n  width: 0px !important;\n  height: 0px !important;\n  visibility: hidden;\n}\n\n.asm-component-close-block-btn-desktop {\n  width: 11px;\n  height: 11px;\n  object-fit: fill;\n  position: absolute;\n  right: 18.7px;\n  top: 26.7px;\n}\n\n.asm-component-close-block-btn-mobile {\n  width: 0.11em;\n  height: 0.11em;\n  object-fit: fill;\n  position: absolute;\n  right: 0.147em;\n  top: 0.167em;\n}\n\n.ams-component-mask-close-block-desktop {\n  position: absolute;\n  width: 40px;\n  height: 40px;\n  right: 18px;\n  top: 10px;\n  cursor: pointer;\n  z-index: 1013;\n}\n  \n.ams-component-mask-close-block-mobile {\n  position: absolute;\n  width: 40px;\n  height: 40px;\n  right: 18px;\n  cursor: pointer;\n  z-index: 1012;\n}\n\n.ams-component-mask-close-block-hidden {\n  width: 0px !important;\n  height: 0px !important;\n  visibility: hidden;\n}\n\n.ams-component-mask-close-block-btn {\n  width: 24px;\n  height: 24px;\n  object-fit: fill;\n  position: absolute;\n  right: 8px;\n  top: 8px;\n}\n\n.ams-component-container-opacity{\n  opacity: 1;\n}\n\n.ams-component-container-opacity:after{\n  position: absolute;\n  left: 0;\n  top: 0;\n  width: 100%;\n  height: 100%;\n  display: block;\n  content: \"\";\n  z-index: 1010;\n  background-color: rgba(0, 0, 0, 0.35);\n  border-radius: 12px 12px 0 0;\n}\n\n#ams-component-retention {\n  position: fixed;\n  left: 50%;\n  top: 50%;\n  transform: translate(-50%, -50%);\n  transform-origin: 50%;\n  height: auto;\n  display: none;\n  z-index: 1009;\n}\n\n.ams-component-retention-show {\n  display: flex !important;\n  animation: ams-component-container-zoom-in 0.3s ease-in-out;\n  animation-fill-mode: forwards\n}\n\n.ams-component-retention-hidden {\n  display: flex !important;\n  animation: ams-component-container-zoom-out 0.3s ease-in-out;\n  -webkit-animation: ams-component-container-zoom-out 0.3s ease-in-out;\n  animation-fill-mode: forwards;\n  -webkit-animation-fill-mode: forwards;\n}\n\n.ams-component-retention-mobile {\n  width: 294px;\n  border-radius: 12px;\n  padding: 24px 0;\n  background-color: #fff;\n  flex-direction: column;\n  align-items: flex-start;\n  justify-content: center;\n  box-sizing: border-box;\n}\n\n.ams-component-retention-desktop {\n  width: 544px;\n  border-radius: 12px;\n  padding: 32px;\n  background-color: #fff;\n  flex-direction: column;\n  align-items: flex-start;\n  justify-content: center;\n  box-sizing: border-box;\n}\n\n@media screen and (max-width: 300px) {\n  .ams-component-retention-mobile {\n      transform: translate(-50%, -50%) scale(0.8);\n  }\n}\n\n.ams-component-retention-title-mobile {\n  width: 100%;\n  font-style: normal;\n  font-weight: 500;\n  font-size: 16px;\n  line-height: 24px;\n  color: #2A3A52;\n  text-align: center;\n  padding: 0 16px;\n  box-sizing: border-box;\n}\n\n.ams-component-retention-title-desktop {\n  text-align: left;\n  width: 100%;\n  font-style: normal;\n  font-weight: 500;\n  font-size: 16px;\n  line-height: 24px;\n  color: #2A3A52;\n}\n\n.ams-component-retention-sub-title-mobile {\n  width: 100%;\n  font-weight: 400;\n  font-size: 14px;\n  line-height: 20px;\n  color: #7C8CA3;\n  margin-top: 8px;\n  text-align: center;\n  padding: 0 16px;\n  box-sizing: border-box;\n}\n\n.ams-component-retention-sub-title-desktop {\n  text-align: left;\n  font-style: normal;\n  font-weight: 400;\n  font-size: 14px;\n  line-height: 20px;\n  color: #7C8CA3;\n  margin-top: 10px;\n}\n\n.ams-component-retention-btn-block-mobile {\n  width: 100%;\n  display: flex;\n  flex-direction: column;\n  align-items: flex-start;\n  justify-content: center;\n  margin-top: 24px;\n  padding: 0 24px;\n  box-sizing: border-box;\n}\n\n.ams-component-retention-btn-block-desktop {\n  width: 100%;\n  margin-top: 24px;\n}\n\n#ams-component-retention-remain {\n  background: #0079FF;\n  border-radius: 100px;\n  font-style: normal;\n  font-weight: 500;\n  text-align: center;\n  box-sizing: border-box;\n  color: #FFFFFF;\n  overflow: hidden;\n  text-overflow: ellipsis;\n}\n\n.ams-component-retention-remain-mobile {\n  width: 100%;\n  height: 44px;\n  font-size: 16px;\n  line-height: 44px;\n  padding: 0 6px;\n}\n\n.ams-component-retention-remain-desktop {\n  height: 44px;\n  font-size: 16px;\n  line-height: 44px;\n  display: inline-block;\n  padding: 0 24px;\n  float: right;\n  cursor: pointer;\n  padding: 0 16px;\n  max-width: 225px;\n  min-width: 159px;\n}\n\n#ams-component-retention-leave {\n  border-radius: 100px;\n  border: 1px solid #0079FF;\n  font-style: normal;\n  font-weight: 500;\n  text-align: center;\n  box-sizing: border-box;\n  overflow: hidden;\n  text-overflow: ellipsis;\n}\n\n.ams-component-retention-leave-mobile {\n  width: 100%;\n  height: 44px;\n  font-size: 16px;\n  line-height: 44px;\n  color: #1677FF;\n  margin-top: 12px;\n  padding: 0 6px;\n}\n\n.ams-component-retention-leave-desktop {\n  height: 44px;\n  font-size: 16px;\n  line-height: 44px;\n  color: #1677FF;\n  display: inline-block;\n  padding: 0 24px;\n  float: right;\n  margin-right: 16px;\n  cursor: pointer;\n  padding: 0 16px;\n  max-width: 225px;\n  min-width: 144px;\n}\n.".concat(MOCKUP_ID, "-hidden{\nanimation: ").concat(MOCKUP_ID, "-opacity 0.3s ease-in-out;\n  animation-fill-mode: forwards\n}\n/** \u52A0\u8F7D\u52A8\u753B **/\n@-webkit-keyframes ").concat(MOCKUP_ID, "-opacity {\n  0% {\n      opacity: 1;\n  }\n\n  100% {\n      opacity: 0;\n  }\n}\n\n");
export var componentAddCSS = function componentAddCSS() {
  var style = document.createElement('style');
  style.type = 'text/css';
  style.innerHTML = componentCss;
  document.head.appendChild(style);
};
export var createBaseElement = function createBaseElement(platform, closeBtnFunc) {
  if (document.getElementById(COMPONENT_CONTAINER_ID)) return;
  componentAddCSS();
  addSetFontSizeEvent();
  var amsComponentContainer = document.createElement('div');
  amsComponentContainer.className = "".concat(COMPONENT_CONTAINER_ID, "-hidden-").concat(platform);
  amsComponentContainer.id = COMPONENT_CONTAINER_ID;
  amsSetSize(null, amsComponentContainer);
  document.body.appendChild(amsComponentContainer);
  var amsComponentSection = document.createElement('div');
  amsComponentSection.className = "ams-component-section-".concat(platform);
  amsComponentSection.id = COMPONENT_SECTION_ID;
  amsComponentContainer.appendChild(amsComponentSection);
  amsComponentContainer.classList.remove("".concat(COMPONENT_CONTAINER_ID, "-hidden-").concat(platform));
  amsComponentContainer.classList.add("".concat(COMPONENT_CONTAINER_ID, "-").concat(platform));
  createCloseBtn(platform, closeBtnFunc);
  return amsComponentContainer;
};
export var createCloseBtn = function createCloseBtn(platform, closeBtnFunc) {
  var clickEventName = platform === PlatformEnum.mobile ? 'touchend' : 'click';
  var container = document.getElementById(COMPONENT_CONTAINER_ID);
  // close btn
  var closeBtnHTML = "<img class='".concat(COMPONENT_CLOSE_BLOCK_ID, "-btn-").concat(platform, "' src=\"").concat(closeImg, "\"/>");
  var closeBlock = document.createElement('div');
  closeBlock.classList.add("".concat(COMPONENT_CLOSE_BLOCK_ID, "-").concat(platform), "".concat(COMPONENT_CLOSE_BLOCK_ID, "-hidden"));
  closeBlock.id = COMPONENT_CLOSE_BLOCK_ID;
  closeBlock.innerHTML = closeBtnHTML;
  closeBlock.addEventListener(clickEventName, function () {
    closeBtnFunc();
  });
  if (container) container.appendChild(closeBlock);
};
export var createMaskCloseButton = function createMaskCloseButton(platform, closeBtnFunc) {
  var clickEventName = platform === PlatformEnum.mobile ? 'touchend' : 'click';
  var closeBtnHTML = "<div class='".concat(COMPONENT_CLOSE_MASK_BLOCK_ID, "-btn'>\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\">\n  <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M19.5673 4.49829L19.424 4.36736L19.3027 4.27821L19.1702 4.19928C18.5417 3.86236 17.7834 3.96479 17.2841 4.46433L11.9986 9.7512L6.73275 4.4853L6.67045 4.42539C6.01464 3.85742 5.07067 3.85791 4.49751 4.42864L4.38538 4.54934L4.27757 4.69333L4.19868 4.8259C3.862 5.45451 3.96432 6.21286 4.46349 6.71225L9.75274 12.0006L4.42833 17.3276C3.85705 17.9874 3.85754 18.9315 4.42789 19.5048L4.54854 19.6169L4.6925 19.7248L4.82504 19.8038C5.45353 20.1407 6.21179 20.0383 6.71105 19.5388L11.9986 14.2489L17.321 19.574C17.9915 20.1551 18.9356 20.1352 19.5317 19.5388L19.6383 19.4206L19.7338 19.2891C20.1447 18.6603 20.0683 17.8276 19.5316 17.2907L14.2454 12.0016L19.5077 6.73713L19.605 6.63362C20.1455 6.00703 20.1297 5.06361 19.5673 4.49829Z\" fill=\"#EEEEEE\"/>\n</svg>\n  </div>");
  var closeBlock = document.createElement('div');
  closeBlock.classList.add("".concat(COMPONENT_CLOSE_MASK_BLOCK_ID, "-").concat(platform), "".concat(COMPONENT_CLOSE_MASK_BLOCK_ID, "-hidden"));
  closeBlock.id = COMPONENT_CLOSE_MASK_BLOCK_ID;
  closeBlock.innerHTML = closeBtnHTML;
  closeBlock.addEventListener(clickEventName, function () {
    closeBtnFunc();
  });
  document.body.appendChild(closeBlock);
};

/**
 * 弹出离开挽留弹窗
 * @param platform
 * @param remainBtnFunc
 * @param leaveBtnFunc
 */
export var createRetentionPopup = function createRetentionPopup(platform, remainBtnFunc, leaveBtnFunc) {
  var clickEventName = platform === PlatformEnum.mobile ? 'touchend' : 'click';
  // retention popup
  var retentionPopup = document.createElement('div');
  retentionPopup.id = COMPONENT_RETENTION_ID;
  retentionPopup.classList.add("".concat(COMPONENT_RETENTION_ID, "-").concat(platform));
  retentionPopup.innerHTML = "\n    <span id=\"".concat(COMPONENT_RETENTION_ID, "-title\" class=\"").concat(COMPONENT_RETENTION_ID, "-title-").concat(platform, "\">\n      Are you sure you want to leave?\n    </span>\n    <span\n      id=\"").concat(COMPONENT_RETENTION_ID, "-sub-title\"\n      class=\"").concat(COMPONENT_RETENTION_ID, "-sub-title-").concat(platform, "\"\n    >\n      If you leave this page, you'll have to start over again.\n    </span>\n    <div class=\"").concat(COMPONENT_RETENTION_ID, "-btn-block-").concat(platform, "\">\n      <div id=\"").concat(COMPONENT_RETENTION_ID, "-remain\" class=\"").concat(COMPONENT_RETENTION_ID, "-remain-").concat(platform, "\">\n        Continue Payment\n      </div>\n      <div id=\"").concat(COMPONENT_RETENTION_ID, "-leave\" class=\"").concat(COMPONENT_RETENTION_ID, "-leave-").concat(platform, "\">\n        Leave\n      </div>\n    </div>");
  document.body.appendChild(retentionPopup);
  var remainBtn = document.getElementById("".concat(COMPONENT_RETENTION_ID, "-remain"));
  if (remainBtn) {
    remainBtn.addEventListener(clickEventName, remainBtnFunc);
  }
  var leaveBtn = document.getElementById("".concat(COMPONENT_RETENTION_ID, "-leave"));
  if (leaveBtn) {
    leaveBtn.addEventListener(clickEventName, leaveBtnFunc);
  }
};
export var hideRetentionPopup = function hideRetentionPopup() {
  var retentionPopup = document.getElementById(COMPONENT_RETENTION_ID);
  var container = document.getElementById(COMPONENT_CONTAINER_ID);
  if (retentionPopup) {
    retentionPopup.classList.remove("".concat(COMPONENT_RETENTION_ID, "-show"));
    retentionPopup.classList.add("".concat(COMPONENT_RETENTION_ID, "-hidden"));
    setTimeout(function () {
      retentionPopup.classList.remove("".concat(COMPONENT_RETENTION_ID, "-hidden"));
      container === null || container === void 0 || container.classList.remove("".concat(COMPONENT_CONTAINER_ID, "-opacity"));
    }, ANIMATION_TIME);
  }
};
export var removeRetentionPopup = function removeRetentionPopup(platform, remainBtnFunc, leaveBtnFunc) {
  var _document$getElementB;
  var clickEventName = platform === PlatformEnum.mobile ? 'touchend' : 'click';
  var remainBtn = document.getElementById("".concat(COMPONENT_RETENTION_ID, "-remain"));
  if (remainBtn) {
    remainBtn.removeEventListener(clickEventName, remainBtnFunc);
  }
  var leaveBtn = document.getElementById("".concat(COMPONENT_RETENTION_ID, "-leave"));
  if (leaveBtn) {
    leaveBtn.removeEventListener(clickEventName, leaveBtnFunc);
  }
  (_document$getElementB = document.getElementById(COMPONENT_RETENTION_ID)) === null || _document$getElementB === void 0 || _document$getElementB.remove();
};
export var createMockup = function createMockup(options) {
  var clickEventName = (options === null || options === void 0 ? void 0 : options.platform) === PlatformEnum.mobile ? 'touchend' : 'click';
  var body = document.getElementsByTagName('body')[0];
  body.style.overflow = 'hidden';
  var mockup = document.createElement('div');
  mockup.style.width = '100vw';
  mockup.style.height = '100vh';
  mockup.style.position = 'fixed';
  mockup.style.top = '0';
  mockup.style.left = '0';
  mockup.style.zIndex = '1000';
  mockup.style.background = 'rgba(0,0,0,0.5)';
  mockup.style.display = 'none';
  mockup.id = MOCKUP_ID;
  // let click to close
  mockup.addEventListener(clickEventName, function () {
    var _options$onClickOutsi;
    options === null || options === void 0 || (_options$onClickOutsi = options.onClickOutside) === null || _options$onClickOutsi === void 0 || _options$onClickOutsi.call(options);
  });
  body.appendChild(mockup);
  createMaskCloseButton(options === null || options === void 0 ? void 0 : options.platform, options === null || options === void 0 ? void 0 : options.closeBtnFunc);
};
export var addPopupLoading = function addPopupLoading() {
  var loading = document.createElement('div');
  loading === null || loading === void 0 || loading.classList.add(LOADING_ID);
  loading.id = LOADING_ID;
  loading.innerHTML = '<div class="line"><div></div><div></div><div></div><div></div></div>';
  loading.style.fontSize = "".concat(getDesignFontSize(), "px");
  var body = document.getElementsByTagName('body')[0];
  body === null || body === void 0 || body.appendChild(loading);
};

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export var handleDeclareInfo = function handleDeclareInfo(_ref) {
  var _ref$closeDialogData = _ref.closeDialogData,
    closeDialogData = _ref$closeDialogData === void 0 ? {} : _ref$closeDialogData;
  try {
    if (closeDialogData) {
      var retentionTitle = document.getElementById("".concat(COMPONENT_RETENTION_ID, "-title"));
      if (retentionTitle) {
        var _closeDialogData$titl, _closeDialogData$titl2, _closeDialogData$titl3;
        retentionTitle.style.fontSize = "".concat(closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$titl = closeDialogData.title) === null || _closeDialogData$titl === void 0 ? void 0 : _closeDialogData$titl.fontSize, "px");
        retentionTitle.style.color = closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$titl2 = closeDialogData.title) === null || _closeDialogData$titl2 === void 0 ? void 0 : _closeDialogData$titl2.fontColor;
        retentionTitle.innerHTML = closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$titl3 = closeDialogData.title) === null || _closeDialogData$titl3 === void 0 ? void 0 : _closeDialogData$titl3.text;
      }
      var retentionMessage = document.getElementById("".concat(COMPONENT_RETENTION_ID, "-sub-title"));
      if (retentionMessage) {
        var _closeDialogData$mess, _closeDialogData$mess2, _closeDialogData$mess3;
        retentionMessage.style.fontSize = "".concat(closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$mess = closeDialogData.message) === null || _closeDialogData$mess === void 0 ? void 0 : _closeDialogData$mess.fontSize, "px");
        retentionMessage.style.color = closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$mess2 = closeDialogData.message) === null || _closeDialogData$mess2 === void 0 ? void 0 : _closeDialogData$mess2.fontColor;
        retentionMessage.innerHTML = closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$mess3 = closeDialogData.message) === null || _closeDialogData$mess3 === void 0 ? void 0 : _closeDialogData$mess3.text;
      }
      var remainBtn = document.getElementById("".concat(COMPONENT_RETENTION_ID, "-remain"));
      if (remainBtn) {
        var _closeDialogData$btnO, _closeDialogData$btnO2, _closeDialogData$btnO3, _closeDialogData$btnO4, _closeDialogData$btnO5, _closeDialogData$btnO7;
        remainBtn.innerHTML = closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$btnO = closeDialogData.btnOK) === null || _closeDialogData$btnO === void 0 ? void 0 : _closeDialogData$btnO.text;
        remainBtn.style.fontSize = "".concat(closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$btnO2 = closeDialogData.btnOK) === null || _closeDialogData$btnO2 === void 0 ? void 0 : _closeDialogData$btnO2.fontSize, "px");
        remainBtn.style.color = closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$btnO3 = closeDialogData.btnOK) === null || _closeDialogData$btnO3 === void 0 ? void 0 : _closeDialogData$btnO3.fontColor;
        remainBtn.style.borderRadius = "".concat(closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$btnO4 = closeDialogData.btnOK) === null || _closeDialogData$btnO4 === void 0 ? void 0 : _closeDialogData$btnO4.corner, "px");
        if ((closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$btnO5 = closeDialogData.btnOK) === null || _closeDialogData$btnO5 === void 0 ? void 0 : _closeDialogData$btnO5.type) === 'stroke') {
          var _closeDialogData$btnO6;
          remainBtn.style.border = "1px solid ".concat(closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$btnO6 = closeDialogData.btnOK) === null || _closeDialogData$btnO6 === void 0 ? void 0 : _closeDialogData$btnO6.bg);
        } else remainBtn.style.backgroundColor = closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$btnO7 = closeDialogData.btnOK) === null || _closeDialogData$btnO7 === void 0 ? void 0 : _closeDialogData$btnO7.bg;
      }
      var leaveBrn = document.getElementById("".concat(COMPONENT_RETENTION_ID, "-leave"));
      if (leaveBrn) {
        var _closeDialogData$btnC, _closeDialogData$btnC2, _closeDialogData$btnC3, _closeDialogData$btnC4, _closeDialogData$btnC5, _closeDialogData$btnC7;
        leaveBrn.innerHTML = closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$btnC = closeDialogData.btnCancel) === null || _closeDialogData$btnC === void 0 ? void 0 : _closeDialogData$btnC.text;
        leaveBrn.style.fontSize = "".concat(closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$btnC2 = closeDialogData.btnCancel) === null || _closeDialogData$btnC2 === void 0 ? void 0 : _closeDialogData$btnC2.fontSize, "px");
        leaveBrn.style.color = closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$btnC3 = closeDialogData.btnCancel) === null || _closeDialogData$btnC3 === void 0 ? void 0 : _closeDialogData$btnC3.fontColor;
        leaveBrn.style.borderRadius = "".concat(closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$btnC4 = closeDialogData.btnCancel) === null || _closeDialogData$btnC4 === void 0 ? void 0 : _closeDialogData$btnC4.corner, "px");
        if ((closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$btnC5 = closeDialogData.btnCancel) === null || _closeDialogData$btnC5 === void 0 ? void 0 : _closeDialogData$btnC5.type) === 'stroke') {
          var _closeDialogData$btnC6;
          leaveBrn.style.border = "1px solid ".concat(closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$btnC6 = closeDialogData.btnCancel) === null || _closeDialogData$btnC6 === void 0 ? void 0 : _closeDialogData$btnC6.bg);
        } else leaveBrn.style.backgroundColor = closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$btnC7 = closeDialogData.btnCancel) === null || _closeDialogData$btnC7 === void 0 ? void 0 : _closeDialogData$btnC7.bg;
      }
    }
  } catch (error) {
    console.error(error);
  }
};
export var slideInAndOutKeyframes = function slideInAndOutKeyframes(id, height) {
  return "@keyframes ".concat(id, "-slide-in {\n    0% {\n      height: 1px;\n    }\n    100% {\n      height: ").concat(height, "px;\n    }\n  }\n  @keyframes ").concat(id, "-slide-out {\n    0% {\n      height: ").concat(height, "px;\n      opacity: 1;\n    }\n    50% {\n      opacity: 1;\n    }\n    100% {\n      height: 1px;\n      opacity: 0;\n    }\n  }");
};