File: /home/bohousj/www/wp-content/plugins/happy-elementor-addons-pro/assets/admin/js/marvin-new.min.js
"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(){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 a(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 r(e,t,n){t&&a(e.prototype,t),n&&a(e,n)}function m(e){try{JSON.parse(e)}catch(e){return}return 1}var e,l,c=function(){function e(){o(this,e)}return r(e,null,[{key:"prepare",value:function(e,t,n,o){var i=_.findIndex(e,function(e){return"clipboard"===e.name}),a=_.findIndex(e,function(e){return"addNew"===e.name});return 0<=a&&e[a].actions.push({name:"x-insert",title:"Add Nested Section",icon:"hm hm-happyaddons",callback:function(){p.insert(t)},isEnabled:function(){return!0}}),e.splice(i+1,0,{name:"hax-clipboard",actions:[{name:"x-copy",title:"X Copy",icon:"hm hm-happyaddons",shortcut:o,callback:function(){n.copy(t)}},{name:"x-copy-all",title:"X Copy All",icon:"hm hm-happyaddons",shortcut:"Content",callback:function(){n.copyAll()}},{name:"x-paste",title:"X Paste",icon:"hm hm-happyaddons",shortcut:"Live Paste",callback:function(){n.paste(t)}}]}),e}},{key:"prepareForBlankColumn",value:function(e,t,n){return e.push({name:"hax-clipboard",actions:[{name:"x-copy-all",title:"X Copy All",icon:"hm hm-happyaddons",shortcut:"Content",callback:function(){n.copyAll()}},{name:"x-paste",title:"X Paste",icon:"hm hm-happyaddons",shortcut:"Live Paste",callback:function(){n.paste(t)}}]}),e}}]),e}(),p=function(){function e(){o(this,e)}return r(e,null,[{key:"insert",value:function(e){e=e.getContainer().view;"column"===e.getElementType()&&e.addElement({elType:"section",isInner:!0,settings:{},elements:[{id:elementorCommon&&elementorCommon.helpers&&elementorCommon.helpers.getUniqueId()||elementor.helpers.getUniqueID,elType:"column",isInner:!0,settings:{_column_size:100},elements:[]}]})}}]),e}(),n=function(){function n(e,t){o(this,n),this.widgetType=e,this.widgetCode=t}return r(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}(),t=function(){function t(e){o(this,t),this.widgetStorage=e,this.lastCopiedElement="",this.lastPastedElementModel={}}return r(t,[{key:"copy",value:function(e){e=new n(e.model.get("widgetType"),e.model.toJSON());navigator.clipboard.writeText(JSON.stringify(e)).then(function(){}).catch(function(e){console.error("Error copying text to clipboard: ",e)})}},{key:"copyAll",value:function(){var e=Object.values(elementor.getPreviewView().children._views).map(function(e){return e.getContainer()}).map(function(e){return e.model.toJSON()}),e=new n("page",e);navigator.clipboard.writeText(JSON.stringify(e)).then(function(){}).catch(function(e){console.error("Error copying text to clipboard: ",e)})}},{key:"paste",value:function(t){var n,o,e,a,r,l,c,p,s,d=this,u={};"firefox"==(s=(s=navigator.userAgent).match(/chrome|chromium|crios/i)?"chrome":s.match(/firefox|fxios/i)?"firefox":s.match(/safari/i)?"safari":s.match(/opr/ /i)?"opera":s.match(/edg/i)?"edge":"unknow")?(n=t.$el.closest("body"),0==(o=n.find(".ha-live-copy-dialog-box-wrap")).length&&(s="MacOS"==(s=window.navigator.userAgent,p="Unknown OS",-1!=s.indexOf("Win")&&(p="Windows"),-1!=s.indexOf("Mac")&&(p="MacOS"),-1!=s.indexOf("X11")&&(p="UNIX"),p=-1!=s.indexOf("Linux")?"Linux":p)?"Cmd + V":"Ctrl + V",p=jQuery("<div>",{class:"ha-live-copy-dialog-box-wrap open",contenteditable:"false"}),e=jQuery("<div>",{class:"ha-live-copy-dialog-box"}),a=jQuery("<input>",{class:"ha-live-copy-dialog-box-input",type:"text"}).attr("autocomplete","off"),r=jQuery("<span>",{class:"ha-live-copy-dialog-close-button"}).html('<i class="eicon-close"></i>'),s=jQuery("<div>",{class:"ha-live-copy-dialog-header"}).html(s),l=jQuery("<div>",{class:"ha-live-copy-dialog-message"}).html('<p class="ha-live-copy-dialog-description">To paste the element from your other site.</p>'),c=jQuery("<p>",{class:"ha-live-copy-dialog-error error-not-found"}).html("The action could not be completed. Make sure, Your clipboard is not empty or You are copying using HappyAddons xCopy or You are not pasting container on Elementor section."),e.append(a).append(r).append(s).append(l).append(c),p.append(e),n.append(p),o=p,n.find(".ha-live-copy-dialog-box-wrap input").focus(),n.find(".ha-live-copy-dialog-box-wrap").on("click",function(e){e.currentTarget!=e.target&&o.find(".ha-live-copy-dialog-close-button")[0]!=e.target&&o.find("i.eicon-close")[0]!=e.target||o.removeClass("open")})),o.hasClass("open")||(o.addClass("open"),n.find(".ha-live-copy-dialog-box-wrap input").focus()),n.find(".ha-live-copy-dialog-error").hasClass("error-not-found")||n.find(".ha-live-copy-dialog-error").addClass("error-not-found"),t.$el.closest("body").find(".ha-live-copy-dialog-box-wrap").on("paste.onFireFoxLivePaste","input",function(e){e.preventDefault();e=e.originalEvent.clipboardData.getData("text");!m(e)||"object"!=_typeof(u=JSON.parse(e))||"object"==_typeof(u)&&!u.hasOwnProperty("widgetType")&&!u.hasOwnProperty("widgetCode")?n.find(".ha-live-copy-dialog-error").removeClass("error-not-found"):(g(u,d,t),o.removeClass("open")),t.$el.closest("body").find(".ha-live-copy-dialog-box-wrap").off("paste.onFireFoxLivePaste")})):navigator.clipboard.readText().then(function(e){m(e)&&("object"!=_typeof(u=JSON.parse(e))||"object"==_typeof(u)&&!u.hasOwnProperty("widgetType")&&!u.hasOwnProperty("widgetCode")?console.log("its not object or not found widgetType & widgetCode key"):g(u,d,t))}).catch(function(e){console.error("Error pasting text from clipboard: ",e)})}}]),t}();function g(e,n,t){var i,o,a,r,l,c,p,s,d,u;"page"===e.widgetType&&e.widgetCode&&0<e.widgetCode.length?(i=elementor.$previewContents.find("html"),jQuery.ajax({url:marvin.ajaxURL,method:"POST",data:{type:"import",action:"ha_process_ixport",nonce:marvin.nonce,content:JSON.stringify(e.widgetCode)},beforeSend:function(){i.addClass("ha-ixport").attr("data-ixport-text","Processing...")}}).done(function(e){var t,n,o;e.success&&(e=e.data[0],t=elementor.getPreviewContainer(),(n={}).at=t.view.collection.length,e.forEach(function(e){$e.run("document/elements/create",{container:t,model:e,options:n}),n.at++}),i.attr("data-ixport-text","Processing completed"),o=setTimeout(function(){i.removeClass("ha-ixport"),clearTimeout(o)},60))})):(e=e.widgetCode,o=JSON.stringify(e),a=/\.(gif|jpg|jpeg|svg|png)/gi.test(o),r=t.model.get("elType"),l=e.elType,c={elType:l,settings:e.settings},p=null,s={at:0},"section"===l?(d=null,"widget"===r?d=t.getContainer().parent.parent:"column"===r?d=t.getContainer().parent:"section"!==r&&"container"!==r||(d=t.getContainer()),c.elements=e.elements,p=d.parent,s.at=d.view.getOption("_index")+1,d.model.get("isInner")&&(c.isInner=!0)):"container"===l?(d=null,"widget"===r?d=(d=t.getContainer().parent.parent).parent?d:t.getContainer().parent:"column"===r?d=t.getContainer().parent:"section"!==r&&"container"!==r||(d=t.getContainer()),c.elements=e.elements,p=d.parent,s.at=d.view.getOption("_index")+1,d.model.get("isInner")&&(c.isInner=!0)):"column"===l?(c.elements=e.elements,"widget"===r?(p=t.getContainer().parent.parent,s.at=t.getContainer().parent.view.getOption("_index")+1):"column"===r?(p=t.getContainer().parent,s.at=t.getOption("_index")+1):"section"===r&&(p=t.getContainer())):"widget"===l&&(c.widgetType=e.widgetType,p=t.getContainer(),"widget"===r?(p=t.getContainer().parent,s.at=t.getOption("_index")+1):"column"===r?p=t.getContainer():"section"===r&&(p=t.children.findByIndex(0).getContainer())),a&&!_.isEmpty(n.lastPastedElementModel)&&n.lastCopiedElement===o?(s.clone=!0,$e.run("document/elements/create",{model:n.lastPastedElementModel,container:p,options:s})):(u=$e.run("document/elements/create",{model:c,container:p,options:s}),a&&jQuery.ajax({url:marvin.ajaxURL,method:"POST",data:{type:"import",action:"ha_process_ixport",nonce:marvin.nonce,content:o},beforeSend:function(){u.view.$el.addClass("ha-ixport").attr("data-ixport-text","Processing...")}}).done(function(e){var t;e.success&&(e=e.data[0],c.settings=e.settings,c.elType=e.elType,"widget"===e.elType?c.widgetType=e.widgetType:c.elements=e.elements,u.view.$el.attr("data-ixport-text","Processing completed"),t=setTimeout(function(){$e.run("document/elements/delete",{container:u});var e=$e.run("document/elements/create",{model:c,container:p,options:s});n.lastPastedElementModel=elementorCommon.helpers.cloneObject(e.model.toJSON()),clearTimeout(t)},750))}),n.lastCopiedElement=o))}"undefined"!=typeof elementor&&(e=elementor.hooks.addFilter,l=new t({}),e("elements/widget/contextMenuGroups",function(e,t){return c.prepare(e,t,l,"Widget")}),e("elements/container/contextMenuGroups",function(e,t){return c.prepare(e,t,l,"Container")}),e("elements/section/contextMenuGroups",function(e,t){return c.prepare(e,t,l,"Section")}),e("elements/column/contextMenuGroups",function(e,t){return c.prepare(e,t,l,"Column")}),e("element/view",function(t,e){var n;return"column"===e.get("elType")?t.extend({initialize:function(){t.prototype.initialize.apply(this,arguments),n=this},emptyView:t.prototype.emptyView.extend({getContextMenuGroups:function(){var e=t.prototype.emptyView.prototype.getContextMenuGroups.apply(this,arguments);return c.prepareForBlankColumn(e,n,l)}})}):t}))}();