"use strict";
function _typeof(e) {
  return (_typeof =
    "function" == typeof Symbol && "symbol" == typeof Symbol.iterator
      ? function (e) {
          return typeof e;
        }
      : function (e) {
          return e &&
            "function" == typeof Symbol &&
            e.constructor === Symbol &&
            e !== Symbol.prototype
            ? "symbol"
            : typeof e;
        })(e);
}
!(function (e, t, i) {
  var r = {
    Views: {},
    Models: {},
    Collections: {},
    Behaviors: {},
    Layout: null,
    Manager: null,
  };
  ((r.Models.Template = Backbone.Model.extend({
    defaults: {
      template_id: 0,
      title: "",
      type: "",
      thumbnail: "",
      url: "",
      tags: [],
      isPro: !1,
      custom: !1,
      preview: "",
    },
  })),
    (r.Collections.Template = Backbone.Collection.extend({
      model: r.Models.Template,
    })),
    (r.Behaviors.InsertTemplate = Marionette.Behavior.extend({
      ui: { insertButton: ".solaceExtraTemplateLibrary__insert-button" },
      events: { "click @ui.insertButton": "onInsertButtonClick" },
      onInsertButtonClick: function () {
        i.library.insertTemplate({ model: this.view.model });
      },
    })),
    (r.Views.EmptyTemplateCollection = Marionette.ItemView.extend({
      id: "elementor-template-library-templates-empty",
      template: "#tmpl-solaceExtraTemplateLibrary__empty",
      ui: {
        title: ".elementor-template-library-blank-title",
        message: ".elementor-template-library-blank-message",
      },
      modesStrings: {
        empty: {
          title: "Templates Not Found",
          message: "Something Went Wrong Please Check",
        },
        noResults: {
          title: "No Result Found",
          message: "Sorry, but nothing matched your selection",
        },
      },
      getCurrentMode: function () {
        return i.library.getFilter("text") ? "noResults" : "empty";
      },
      onRender: function () {
        var e = this.modesStrings[this.getCurrentMode()];
        (this.ui.title.html(e.title), this.ui.message.html(e.message));
      },
    })),
    (r.Views.Loading = Marionette.ItemView.extend({
      template: "#tmpl-solaceExtraTemplateLibrary__loading",
      id: "solaceExtraTemplateLibrary__loading",
    })),
    (r.Views.Logo = Marionette.ItemView.extend({
      template: "#tmpl-solaceExtraTemplateLibrary__header-logo",
      className: "solaceExtraTemplateLibrary__header-logo",
      templateHelpers: function () {
        return { title: this.getOption("title") };
      },
    })),
    (r.Views.BackButton = Marionette.ItemView.extend({
      template: "#tmpl-solaceExtraTemplateLibrary__header-back",
      id: "elementor-template-library-header-preview-back",
      className: "solaceExtraTemplateLibrary__header-back",
      events: function () {
        return { click: "onClick" };
      },
      onClick: function () {
        i.library.showTemplatesView();
      },
    })),
    (r.Views.Menu = Marionette.ItemView.extend({
      template: "#tmpl-solaceExtraTemplateLibrary__header-menu",
      id: "elementor-template-library-header-menu",
      className: "solaceExtraTemplateLibrary__header-menu",
      templateHelpers: function () {
        return i.library.getTabs();
      },
      ui: { menuItem: ".elementor-template-library-menu-item" },
      events: { "click @ui.menuItem": "onMenuItemClick" },
      onMenuItemClick: function (e) {
        (i.library.setFilter("tags", ""),
          i.library.setFilter("text", ""),
          i.library.setFilter("type", e.currentTarget.dataset.tab, !0),
          i.library.showTemplatesView());
      },
    })),
    (r.Views.ResponsiveMenu = Marionette.ItemView.extend({
      template: "#tmpl-solaceExtraTemplateLibrary__header-menu-responsive",
      id: "elementor-template-library-header-menu-responsive",
      className: "solaceExtraTemplateLibrary__header-menu-responsive",
      ui: { items: "> .elementor-component-tab" },
      events: { "click @ui.items": "onTabItemClick" },
      onTabItemClick: function (t) {
        var r = e(t.currentTarget),
          n = r.data("tab");
        i.library.channels.tabs.trigger("change:device", n, r);
      },
    })),
    (r.Views.Actions = Marionette.ItemView.extend({
      template: "#tmpl-solaceExtraTemplateLibrary__header-actions",
      id: "elementor-template-library-header-actions",
      ui: { sync: "#solaceExtraTemplateLibrary__header-sync i" },
      events: { "click @ui.sync": "onSyncClick" },
      onSyncClick: function () {
        var e = this;
        (e.ui.sync.addClass("eicon-animation-spin"),
          i.library.requestLibraryData({
            onUpdate: function () {
              (e.ui.sync.length &&
                e.ui.sync.removeClass("eicon-animation-spin"),
                i.library.updateBlocksView());
            },
            forceUpdate: !0,
            forceSync: !0,
          }));
      },
    })),
    (r.Views.InsertWrapper = Marionette.ItemView.extend({
      template: "#tmpl-solaceExtraTemplateLibrary__header-insert",
      id: "elementor-template-library-header-preview",
      behaviors: {
        insertTemplate: { behaviorClass: r.Behaviors.InsertTemplate },
      },
    })),
    (r.Views.Preview = Marionette.ItemView.extend({
      template: "#tmpl-solaceExtraTemplateLibrary__preview",
      className: "solaceExtraTemplateLibrary__preview",
      ui: function () {
        return { iframe: "> iframe" };
      },
      onRender: function () {
        this.ui.iframe.attr("src", this.getOption("url")).hide();
        var e = this,
          t = new r.Views.Loading().render();
        (this.$el.append(t.el),
          this.ui.iframe.on("load", function () {
            (e.$el.find("#solaceExtraTemplateLibrary__loading").remove(),
              e.ui.iframe.show());
          }));
      },
    })),
    (r.Views.TemplateCollection = Marionette.CompositeView.extend({
      template: "#tmpl-solaceExtraTemplateLibrary__templates",
      id: "solaceExtraTemplateLibrary__templates",
      className: function () {
        return (
          "solaceExtraTemplateLibrary__templates solaceExtraTemplateLibrary__templates--" +
          i.library.getFilter("type")
        );
      },
      childViewContainer: "#solaceExtraTemplateLibrary__templates-list",
      emptyView: function () {
        return new r.Views.EmptyTemplateCollection();
      },
      ui: {
        templatesWindow: ".solaceExtraTemplateLibrary__templates-window",
        textFilter: "#solaceExtraTemplateLibrary__search",
        filterSelect: "#solaceExtraTemplateLibrary__filter-select",
        filterBar: "#solaceExtraTemplateLibrary__toolbar-filter",
        counter: "#solaceExtraTemplateLibrary__toolbar-counter",
      },
      events: {
        "input @ui.textFilter": "onTextFilterInput",
        "change @ui.filterSelect": "onFilterSelectChange",
      },
      getChildView: function (e) {
        return r.Views.Template;
      },
      initialize: function () {
        this.listenTo(
          i.library.channels.templates,
          "filter:change",
          this._renderChildren,
        );
      },
      filter: function (e) {
        var t = i.library.getFilterTerms(),
          r = !0;
        return (
          _.each(t, function (t, n) {
            var a = i.library.getFilter(n);
            if (a && t.callback) {
              var o = t.callback.call(e, a);
              return (o || (r = !1), o);
            }
          }),
          r
        );
      },
      setMasonrySkin: function () {
        // if ("section" === i.library.getFilter("type")) {
        //   var e = new elementorModules.utils.Masonry({
        //     container: this.$childViewContainer,
        //     items: this.$childViewContainer.children(),
        //   });
        //   this.$childViewContainer.imagesLoaded(e.run.bind(e));
        // }
      },
      onRenderCollection: function () {
        (this.setMasonrySkin(),
          this.updatePerfectScrollbar(),
          this.setTemplatesFoundText());
      },
      setTemplatesFoundText: function () {
        var e = i.library.getFilter("type"),
          t = this.children.length,
          r = "<b>" + t + "</b>";
        ((r += "section" === e ? " block" : " " + e),
          t > 1 && (r += "s"),
          (r += " found"),
          this.ui.counter.html(r));
      },
      onTextFilterInput: function () {
        var e = this;
        var searchValue = e.ui.textFilter.val();
        _.defer(function () {
          if (searchValue) {
            e.ui.filterSelect.val("").trigger("change.select2");
            i.library.setFilter("tags", "");
          }
          i.library.setFilter("text", searchValue);
        });
      },
      onFilterSelectChange: function () {
        var n = this.ui.filterSelect.val() || "";
        if (n) {
          this.ui.textFilter.val("");
          i.library.setFilter("text", "");
        }
        i.library.setFilter("tags", n);
      },
      updatePerfectScrollbar: function () {
        (this.perfectScrollbar ||
          (this.perfectScrollbar = new PerfectScrollbar(
            this.ui.templatesWindow[0],
            { suppressScrollX: !0 },
          )),
          (this.perfectScrollbar.isRtl = !1),
          this.perfectScrollbar.update());
      },
      setTagsFilterHover: function () {},
      onRender: function () {
        var selectedTag = i.library.getFilter("tags") || "";
        if (this.ui.filterSelect && this.ui.filterSelect.length) {
          try {
            if (this.ui.filterSelect.select2) {
              this.ui.filterSelect.select2({ 
                width: "150px", 
                placeholder: "Category",
                allowClear: true
              });
            }
          } catch (err) {}
          this.ui.filterSelect.val(selectedTag).trigger("change.select2");
        }
        this.updatePerfectScrollbar();
      },
    })),
    (r.Views.Template = Marionette.ItemView.extend({
      template: "#tmpl-solaceExtraTemplateLibrary__template",
      className: "solaceExtraTemplateLibrary__template",
      ui: {
        previewButton:
          ".solaceExtraTemplateLibrary__preview-button, .solaceExtraTemplateLibrary__template-preview",
      },
      events: { "click @ui.previewButton": "onPreviewButtonClick" },
      behaviors: {
        insertTemplate: { behaviorClass: r.Behaviors.InsertTemplate },
      },
      onPreviewButtonClick: function () {
        i.library.showPreviewView(this.model);
      },
    })),
    (r.Modal = elementorModules.common.views.modal.Layout.extend({
      getModalOptions: function () {
        return {
          id: "solaceExtraTemplateLibrary__modal",
          hide: {
            onOutsideClick: !1,
            onEscKeyPress: !0,
            onBackgroundClick: !1,
          },
        };
      },
      getTemplateActionButton: function (e) {
        var isLicenseValid = SolaceExtraElementorAddonsEditor.isLicenseValid;
        // Convert to boolean explicitly (wp_localize_script converts true to "1" and false to "")
        isLicenseValid = isLicenseValid === true || isLicenseValid === "1" || isLicenseValid === 1;
        var t =
            "#tmpl-solaceExtraTemplateLibrary__" +
            (e.isPro && !isLicenseValid
              ? "pro-button"
              : "insert-button"),
          i = Marionette.TemplateCache.get(t);
        return Marionette.Renderer.render(i);
      },
      showLogo: function (e) {
        this.getHeaderView().logoArea.show(new r.Views.Logo(e));
      },
      showDefaultHeader: function () {
        this.showLogo({ title: "LIBRARY" });
        var e = this.getHeaderView();
        (e.tools.show(new r.Views.Actions()),
          e.menuArea.show(new r.Views.Menu()));
      },
      showPreviewView: function (e) {
        var t = this.getHeaderView();
        (t.menuArea.show(new r.Views.ResponsiveMenu()),
          t.logoArea.show(new r.Views.BackButton()),
          t.tools.show(new r.Views.InsertWrapper({ model: e })),
          this.modalContent.show(new r.Views.Preview({ url: e.get("url") })));
      },
      showTemplatesView: function (e) {
        (this.showDefaultHeader(),
          this.modalContent.show(
            new r.Views.TemplateCollection({ collection: e }),
          ));
      },
    })),
    (r.Manager = function () {
      function i() {
        var i = e(this).closest(".elementor-top-section"),
          r = i.data("id"),
          n = t.documents.getCurrent().container.children,
          a = i.prev(".elementor-add-section");
        (n &&
          _.each(n, function (e, t) {
            r === e.id && (d.atIndex = t);
          }),
          a.find(".elementor-add-solace-extra-button").length || a.find(p).before(m));
      }
      function n(t, i) {
        i.addClass("elementor-active")
          .siblings()
          .removeClass("elementor-active");
        var r = u[t] || u.desktop;
        e(".solaceExtraTemplateLibrary__preview").css("width", r);
      }
      var a,
        o,
        l,
        s,
        c,
        d = this,
        p = ".elementor-add-new-section .elementor-add-section-drag-title",
        m =
          '<div class="elementor-add-section-area-button elementor-add-solace-extra-button"> <svg style="position: relative;bottom: 4px;" width="14" height="24" viewBox="0 0 14 24" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><rect width="14" height="24" fill="url(#pattern0_40_3)"/><defs><pattern id="pattern0_40_3" patternContentUnits="objectBoundingBox" width="1" height="1"><use xlink:href="#image0_40_3" transform="scale(0.0714286 0.0416667)"/></pattern><image id="image0_40_3" width="14" height="24" preserveAspectRatio="none" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAYCAYAAADKx8xXAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAANNSURBVHgBdZN7TNNXFMc/rbWdnWMKZM5ntsVNYzKXCHOSLIxkmf6xWTK3OWYy5mIiUaMmGh+gwWoUH5iqaKhvfABqFJQm+CKI70RTRTQalShEbQqCVCoPC7TX3/1xSyqRk/x+v3Pv9/c995zvORf6NqN8xQ3F2pDNVXGMt5fm8Hck9iGCQTr37DjFRTp3TidRrmtyOBU6gG9RIiMjCYZwpIp5pIjziOosViusn/aYpOPbhksUIIgAcPzKV20naPLlUREXR38VTH6pSmeWuIAo+g/b03TO6KyEEQxo3seN1iJeOn5juAqmE3KSGddVjv+FA5ddZdS4nltcW0BKZx7+sjSSFcEsX7YxfPLmKPdajuDJ/p3PFGbRiQ4eIg4i6jdRqNLSRaneyG5NlI7Cf/kpMtjMJAa1n6KmLosj1NrJ3ziVSVKMqsUs0eoI3V5CZkTtenruZeQGi2lw/sVEHWnaQEVYoUAhHTO/4CN1sq7ilfmkyaDeXC77nbh/GcMwuW/SdA2GiUEfjfUmXWqROpZPd2ZS2eChZPpkTMc12D6FCaeXU3mnihxjr9b3rH8cz+IBVgaHjERrpJDcGzWY/qKNN/HfkG6iD4u1ElvqwtbRRZQ4TdB7h6sDRzDMnMrXtZmUG7uC3dF6m0Zos5j5ctohSv7PIDpmOJ9HpTJalmE1E2WKGcW34Z8NRnoymDCa78ym7onytGMNtdP5XlXFZcwX5YiCf0ho8vLQFs9QcYmW1hauafrGBo7jHWTBYgjwtndWetPbdnBZFCNeO6meN5GYMDhlHNGilE7/bi2QspdrcevO3VUUaKTXu/5grML0SUn/mZjmwzyr30KZnGfUMHjWcJ2ufJqfZrBGESxh8PlmTsqUtyf3aKAH22pjiCjUeu+1czN4mNonDgok4F7KXHEFcX0uaYogBTMkJWFqdFIWcOFb+AND8GZxTj9+Jctkv+q2cCwsHOqePl7PCnEW4V7AjB5d6tbhChftz6VGufpdLE0jUZwj8CiLvRFCdk+XyEfkTGOS9Fv34JPf2XHEtpbwwr+fB/JeKlI/IlsxeTwfn8ig8lUjtcZ6og0DuTsynj/35JIwu4j7ihDkA6YfnT2V78UOPHkzSIlIy0Af9g75vTk7EnMFigAAAABJRU5ErkJggg=="/></defs></svg> </div>',
        u = { desktop: "100%", tab: "680px", mobile: "360px" };
      ((this.atIndex = -1),
        (this.channels = {
          tabs: Backbone.Radio.channel("tabs"),
          templates: Backbone.Radio.channel("templates"),
        }),
        (this.updateBlocksView = function () {
          (d.setFilter("tags", "", !0),
            d.setFilter("text", "", !0),
            d.getModal().showTemplatesView(s));
        }),
        (this.setFilter = function (e, t, i) {
          (d.channels.templates.reply("filter:" + e, t),
            i || d.channels.templates.trigger("filter:change"));
        }),
        (this.getFilter = function (e) {
          return d.channels.templates.request("filter:" + e);
        }),
        (this.getFilterTerms = function () {
          return {
            tags: {
              callback: function (e) {
                return _.any(this.get("tags"), function (t) {
                  return t.indexOf(e) >= 0;
                });
              },
            },
            text: {
              callback: function (e) {
                return (
                  (e = e.toLowerCase()),
                  this.get("title").toLowerCase().indexOf(e) >= 0 ||
                    _.any(this.get("tags"), function (t) {
                      return t.indexOf(e) >= 0;
                    })
                );
              },
            },
            type: {
              callback: function (e) {
                return this.get("type") === e;
              },
            },
          };
        }),
        (this.showModal = function () {
          (d.getModal().showModal(), d.showTemplatesView());
        }),
        (this.closeModal = function () {
          this.getModal().hideModal();
        }),
        (this.getModal = function () {
          return (a || (a = new r.Modal()), a);
        }),
        (this.init = function () {
          (d.setFilter("type", "section", !0),
            t.on(
              "preview:loaded",
              function () {
                var e = window.elementor.$previewContents,
                  t = setInterval(function () {
                    var r, n;
                    ((n = (r = e).find(p)).length &&
                      !r.find(".elementor-add-solace-extra-button").length &&
                      n.before(m),
                      r.on(
                        "click.onAddElement",
                        ".elementor-editor-section-settings .elementor-editor-element-add",
                        i,
                      ),
                      e.find(".elementor-add-new-section").length > 0 &&
                        clearInterval(t));
                  }, 100);
                (e.on(
                  "click.onAddTemplateButton",
                  ".elementor-add-solace-extra-button",
                  d.showModal.bind(d),
                ),
                  this.channels.tabs.on("change:device", n));
              }.bind(this),
            ));
          var e = jQuery("#tmpl-elementor-add-section");
          if (!(e.length < 1)) {
            var r = e.html();
            ((r = r.replace(
              '<div class="elementor-add-section-drag-title',
              '<div class="elementor-add-section-area-button elementor-add-solace-extra-button"> <svg style="position: relative;bottom: 4px;" width="14" height="24" viewBox="0 0 14 24" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><rect width="14" height="24" fill="url(#pattern0_40_3)"/><defs><pattern id="pattern0_40_3" patternContentUnits="objectBoundingBox" width="1" height="1"><use xlink:href="#image0_40_3" transform="scale(0.0714286 0.0416667)"/></pattern><image id="image0_40_3" width="14" height="24" preserveAspectRatio="none" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAYCAYAAADKx8xXAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAANNSURBVHgBdZN7TNNXFMc/rbWdnWMKZM5ntsVNYzKXCHOSLIxkmf6xWTK3OWYy5mIiUaMmGh+gwWoUH5iqaKhvfABqFJQm+CKI70RTRTQalShEbQqCVCoPC7TX3/1xSyqRk/x+v3Pv9/c995zvORf6NqN8xQ3F2pDNVXGMt5fm8Hck9iGCQTr37DjFRTp3TidRrmtyOBU6gG9RIiMjCYZwpIp5pIjziOosViusn/aYpOPbhksUIIgAcPzKV20naPLlUREXR38VTH6pSmeWuIAo+g/b03TO6KyEEQxo3seN1iJeOn5juAqmE3KSGddVjv+FA5ddZdS4nltcW0BKZx7+sjSSFcEsX7YxfPLmKPdajuDJ/p3PFGbRiQ4eIg4i6jdRqNLSRaneyG5NlI7Cf/kpMtjMJAa1n6KmLosj1NrJ3ziVSVKMqsUs0eoI3V5CZkTtenruZeQGi2lw/sVEHWnaQEVYoUAhHTO/4CN1sq7ilfmkyaDeXC77nbh/GcMwuW/SdA2GiUEfjfUmXWqROpZPd2ZS2eChZPpkTMc12D6FCaeXU3mnihxjr9b3rH8cz+IBVgaHjERrpJDcGzWY/qKNN/HfkG6iD4u1ElvqwtbRRZQ4TdB7h6sDRzDMnMrXtZmUG7uC3dF6m0Zos5j5ctohSv7PIDpmOJ9HpTJalmE1E2WKGcW34Z8NRnoymDCa78ym7onytGMNtdP5XlXFZcwX5YiCf0ho8vLQFs9QcYmW1hauafrGBo7jHWTBYgjwtndWetPbdnBZFCNeO6meN5GYMDhlHNGilE7/bi2QspdrcevO3VUUaKTXu/5grML0SUn/mZjmwzyr30KZnGfUMHjWcJ2ufJqfZrBGESxh8PlmTsqUtyf3aKAH22pjiCjUeu+1czN4mNonDgok4F7KXHEFcX0uaYogBTMkJWFqdFIWcOFb+AND8GZxTj9+Jctkv+q2cCwsHOqePl7PCnEW4V7AjB5d6tbhChftz6VGufpdLE0jUZwj8CiLvRFCdk+XyEfkTGOS9Fv34JPf2XHEtpbwwr+fB/JeKlI/IlsxeTwfn8ig8lUjtcZ6og0DuTsynj/35JIwu4j7ihDkA6YfnT2V78UOPHkzSIlIy0Af9g75vTk7EnMFigAAAABJRU5ErkJggg=="/></defs></svg> </div><div class="elementor-add-section-drag-title',
            )),
              e.html(r));
          }
        }),
        (this.getTabs = function () {
          var e = this.getFilter("type"),
            t = { section: { title: "Blocks" }, page: { title: "Pages" } };
          return (
            _.each(t, function (i, r) {
              e === r && (t[e].active = !0);
            }),
            { tabs: t }
          );
        }),
        (this.getTags = function () {
          return o;
        }),
        (this.getTypeTags = function () {
          return l[d.getFilter("type")];
        }),
        (this.showTemplatesView = function () {
          (d.setFilter("tags", "", !0),
            d.setFilter("text", "", !0),
            s
              ? d.getModal().showTemplatesView(s)
              : d.loadTemplates(function () {
                  d.getModal().showTemplatesView(s);
                }));
        }),
        (this.showPreviewView = function (e) {
          d.getModal().showPreviewView(e);
        }),
        (this.loadTemplates = function (e) {
          d.requestLibraryData({
            onBeforeUpdate: d.getModal().showLoadingView.bind(d.getModal()),
            onUpdate: function () {
              (d.getModal().hideLoadingView(), e && e());
            },
          });
        }),
        (this.requestLibraryData = function (e) {
          if (!s || e.forceUpdate) {
            e.onBeforeUpdate && e.onBeforeUpdate();
            var t = {
              data: {},
              success: function (t) {
                ((s = new r.Collections.Template(t.templates)),
                  t.tags && (o = t.tags),
                  t.type_tags && (l = t.type_tags),
                  e.onUpdate && e.onUpdate());
              },
            };
            (e.forceSync && (t.data.sync = !0),
              elementorCommon.ajax.addRequest(
                "get_solace_extra_elementor_library_data",
                t,
              ));
          } else e.onUpdate && e.onUpdate();
        }),
        (this.requestTemplateData = function (e, t) {
          var i = {
            unique_id: e,
            data: { edit_mode: !0, display: !0, template_id: e },
          };
          (t && jQuery.extend(!0, i, t),
            elementorCommon.ajax.addRequest(
              "get_solace_extra_elementor_template_data",
              i,
            ));
        }),
        (this.insertTemplate = function (e) {
          var t = e.model,
            i = this;
          (i.getModal().showLoadingView(),
            i.requestTemplateData(t.get("template_id"), {
              success: function (e) {
                (i.getModal().hideLoadingView(), i.getModal().hideModal());
                var r = {};
                (-1 !== i.atIndex && (r.at = i.atIndex),
                  $e.run("document/elements/import", {
                    model: t,
                    data: e,
                    options: r,
                  }),
                  (i.atIndex = -1));
              },
              error: function (e) {
                i.showErrorDialog(e);
              },
              complete: function (e) {
                (i.getModal().hideLoadingView(),
                  window.elementor.$previewContents
                    .find(".elementor-add-section .elementor-add-section-close")
                    .click());
              },
            }));
        }),
        (this.showErrorDialog = function (e) {
          if ("object" === _typeof(e)) {
            var t = "";
            (_.each(e, function (e) {
              t += "<div>" + e.message + ".</div>";
            }),
              (e = t));
          } else
            e
              ? (e += ".")
              : (e = "<i>&#60;The error message is empty&#62;</i>");
          d.getErrorDialog()
            .setMessage(
              'The following error(s) occurred while processing the request:<div id="elementor-template-library-error-info">' +
                e +
                "</div>",
            )
            .show();
        }),
        (this.getErrorDialog = function () {
          return (
            c ||
              (c = elementorCommon.dialogsManager.createWidget("alert", {
                id: "elementor-template-library-error-dialog",
                headerMessage: "An error occurred",
              })),
            c
          );
        }));
    }),
    (i.library = new r.Manager()),
    i.library.init(),
    (window.solaceExtra = i));
})(jQuery, window.elementor, window.solaceExtra || {});
