File: /home/bohousj/www/wp-content/plugins/happy-elementor-addons-pro/assets/admin/js/live-copy.min.js
"use strict";!function(a){function o(e,t){if(e=e,!(null!=(t=t)&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?t[Symbol.hasInstance](e):e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function e(e,t,n){t&&i(e.prototype,t),n&&i(e,n)}var s=function(){function n(e,t){o(this,n),this.widgetType=e,this.widgetCode=t}return e(n,[{key:"getWidgetType",value:function(){return this.widgetType}},{key:"getWidgetCode",value:function(){return this.widgetCode}},{key:"toJSON",value:function(){return{widgetType:this.widgetType,widgetCode:this.widgetCode}}}]),n}(),c=function(){function t(e){o(this,t),this.widgetStorage=e}return e(t,[{key:"copy",value:function(e){navigator.clipboard.writeText(JSON.stringify(e)).then(function(){}).catch(function(e){console.error("Error copying text to clipboard: ",e)})}}]),t}();a(window).on("elementor/frontend/init",function(){var e=a("#ha-live-copy-base").clone().removeAttr("id").removeAttr("style"),t=a(".elementor-section-wrap > .elementor-section, .elementor-section.elementor-top-section"),n=a(".elementor-element.e-con.e-parent"),o=a("body").hasClass("elementor-editor-active"),i=a(document),r=(t.length<=0&&(t=a(".elementor-section.elementor-top-section")),t=a.merge(t,n),o||t.filter(function(e,t){var t=a(t),n=t.data("settings"),n=n&&n._ha_enable_live_copy&&"yes"===n._ha_enable_live_copy;return n=t.hasClass("e-container")&&t.parents(".e-container").length?!1:n}).append(e),t.on("click.HappyAddonsLiveCopy",".ha-live-copy-btn",function(e){e.preventDefault();var e=a(e.delegateTarget).data(),t=a(this),n=t.parents("[data-elementor-id]").data("elementor-id");t.hasClass("on-progress")||"section"!==e.element_type&&"container"!==e.element_type||(i.trigger({type:"onHappyAddonsLiveCopy",sectionId:e.id,elType:e.element_type,postID:n}),t.addClass("on-progress"))}),new c({}));i.on("onHappyAddonsLiveCopy",function(n){var o=a('[data-id="'+n.sectionId+'"] .ha-live-copy-btn');o.css("cursor","progress"),a.get(livecopy.ajax_url,{action:"get_section_data",section_id:n.sectionId,elType:n.elType,post_id:n.postID,nonce:livecopy.nonce}).done(function(e){var t;e.success?(e=new s(n.elType,e.data),r.copy(e),t=setTimeout(function(){o.removeAttr("style").text("Copied").removeClass("on-progress"),clearTimeout(t);var e=setTimeout(function(){o.text("Live Copy"),clearTimeout(e)},1e3)},500)):console.log("Something is wrong!")})})})}(jQuery);