text: import $ from 'dom7';
  import Utils from '../../utils/utils';
  import Modal from '../modal/modal-class';
  
  class Popup extends Modal {
    constructor(app, params) {
      const extendedParams = Utils.extend(
        { on: {} },
        app.params.popup,
        params
      );
  
      // Extends with open/close Modal methods;
      super(app, extendedParams);
  
      const popup = this;
  
      popup.params = extendedParams;
  
      // Find Element
      let $el;
      if (!popup.params.el) {
        $el = $(popup.params.content);
      } else {
        $el = $(popup.params.el);
      }
  
      if ($el && $el.length > 0 && $el[0].f7Modal) {
        return $el[0].f7Modal;
      }
  
      if ($el.length === 0) {
        return popup.destroy();
      }
  
      let $backdropEl;
      if (popup.params.backdrop) {
        $backdropEl = app.root.children('.popup-backdrop');
        if ($backdropEl.length === 0) {
          $backdropEl = $('<div class="popup-backdrop"></div>');
          app.root.append($backdropEl);
        }
      }
  
      Utils.extend(popup, {
        app,
        $el,
        el: $el[0],
        $backdropEl,
        backdropEl: $backdropEl && $backdropEl[0],
        type: 'popup',
      });
  
      $el[0].f7Modal = popup;
  
      return popup;
    }
  }
  export default Popup;
  