window.XdUtils=window.XdUtils||{extend:function(e,t){var n,i=t||{};for(n in e)e.hasOwnProperty(n)&&(i[n]=e[n]);return i}},window.jltmaXdLocalStorage=window.jltmaXdLocalStorage||function(){var e="cross-domain-local-message",t={iframeId:"cross-domain-iframe-id",iframeUrl:void 0,initCallback:function(){}},n=-1,i=null,a={},o=!1,s=!0;function l(n){var i,o;try{i=JSON.parse(n.data)}catch(e){}i&&i.namespace===e&&("iframe-ready"===i.id?(s=!0,t.initCallback()):a[(o=i).id]&&(a[o.id](o),delete a[o.id]))}function r(t,o,s,l){n++,a[n]=l;var r={namespace:e,id:n,action:t,key:o,value:s};null!==i&&i.contentWindow.postMessage(JSON.stringify(r),"*")}function c(e){t=XdUtils.extend(e,t);var n=document.createElement("div");window.addEventListener?window.addEventListener("message",l,!1):window.attachEvent("onmessage",l),n.innerHTML='<iframe id="'+t.iframeId+'" src="'+t.iframeUrl+'" style="display: none;"></iframe>',document.body.appendChild(n),i=document.getElementById(t.iframeId)}function d(){return!!o&&!!s}function m(){return"complete"===document.readyState}return{init:function(e){if(!e.iframeUrl)throw"You must specify iframeUrl [CP]";o||(o=!0,m()?c(e):document.addEventListener?document.addEventListener("readystatechange",function(){m()&&c(e)}):document.attachEvent("readystatechange",function(){m()&&c(e)}))},setItem:function(e,t,n){d()&&r("set",e,t,n)},getItem:function(e,t){d()&&r("get",e,null,t)},removeItem:function(e,t){d()&&r("remove",e,null,t)},key:function(e,t){d()&&r("key",e,null,t)},getSize:function(e){d()&&r("size",null,null,e)},getLength:function(e){d()&&r("length",null,null,e)},clear:function(e){d()&&r("clear",null,null,e)},wasInit:function(){return o}}}(),function(e){jltmaXdLocalStorage.init({iframeId:"jltma-xd-iframe",iframeUrl:"https://jeweltheme.github.io/master-addons-magic-copy-api/",initCallback:function(){}});var t={elementTypes:["widget","column","section","container"],storageKey:jltma_cp_xd.storage_key,lastCopiedJson:"",lastPastedModel:{},sameServer:!1,widget:null,container:null,option:{},msg:jltma_cp_xd.message};function n(){elementor.notifications.showToast({message:elementor.translate(t.msg.paste)})}t.elementTypes.forEach(function(i,a){let o=t.elementTypes[a];elementor.hooks.addFilter("elements/"+o+"/contextMenuGroups",function(i,a){return i.push({name:"jltma_"+o,actions:[{name:"jltma_copy",title:"MA Copy",callback:function(){var e={};e.elementType="widget"===o?a.model.get("widgetType"):null,e.elementCode=a.model.toJSON(),jltmaXdLocalStorage.setItem(t.storageKey,JSON.stringify(e),function(){elementor.notifications.showToast({message:elementor.translate(t.msg.copy)})})}},{name:"jltma_paste",title:"MA Paste",callback:function(){jltmaXdLocalStorage.getItem(t.storageKey,function(i){!function(i,a){if(null===i||""===i||Array.isArray(i)&&0===i.length)return elementor.notifications.showToast({message:elementor.translate(t.msg.empty_copy)}),!1;let o=a.model.get("elType"),s=i.elementCode.elType,l=i.elementCode;if(t.widget={elType:s,settings:l.settings},"section"===s||"container"===s)t.widget.elements=l.elements,t.container=elementor.getPreviewContainer();else if("column"===s)switch(t.widget.elements=l.elements,o){case"widget":t.container=a.getContainer().parent.parent;break;case"column":t.container=a.getContainer().parent;break;case"section":t.container=a.getContainer()}else if("widget"===s)switch(t.widget.widgetType=i.elementType,o){case"widget":t.container=a.getContainer().parent,t.option.at=a.getOption("_index")+1;break;case"column":t.container=a.getContainer();break;case"section":t.container=a.children.findByIndex(0).getContainer()}!function(i){var a=JSON.stringify(i),o=/\.(gif|jpg|jpeg|svg|png|tiff|bmp|pdf)/gi.test(a);if(e.isEmptyObject(t.lastPastedModel)||a!==t.lastCopiedJson)if(o&&!t.sameServer){let e=elementor.notifications.getToast(),i=e.getSettings();"hide"in i&&(i=Object.assign(i.hide,{auto:!1}),e.setSettings(i)),elementor.notifications.showToast({message:elementor.translate(t.msg.import_wait)}),elementorCommon.ajax.addRequest("jltma_copy_paste",{data:{type:"single",template:a},success:function(o){var s=o;s.hasOwnProperty("data")&&(s=s.data),"hide"in i?(i=Object.assign(i.hide,{auto:!0}),e.setSettings(i)):"auto"in i&&(i.auto=!0,e.setSettings(i)),t.widget.elType=s.elType,t.widget.settings=s.settings,"widget"===s.elType?t.widget.widgetType=s.widgetType:t.widget.elements=s.elements,$e.run("document/elements/create",{model:t.widget,container:t.container,options:t.option}),n(),t.lastPastedModel=t.widget,t.lastCopiedJson=a},error:function(e){elementor.notifications.showToast({message:elementor.translate(t.msg.error)})}})}else $e.run("document/elements/create",{model:t.widget,container:t.container,options:t.option}),n();else t.option.clone=!0,$e.run("document/elements/create",{model:t.lastPastedModel,container:t.container,options:t.option}),n()}(l)}(JSON.parse(i.value),a)})}}]}),i})})}(jQuery);