!function(){"use strict";(window.WPCodeConnect||function(n,t,o){jconfirm.defaults={closeIcon:!1,backgroundDismiss:!1,escapeKey:!0,animationBounce:1,useBootstrap:!1,theme:"modern",boxWidth:"560px",type:"blue",animateFromElement:!1};var e={$connectBtn:o("#wpcode-settings-connect-btn"),$connectKey:o("#wpcode-settings-upgrade-license-key")},c="<div class='excl-mark'>!</div>",i={init:function(){console.log("WPCodeConnect: init"),o(i.ready)},ready:function(){i.events()},events:function(){i.connectBtnClick()},connectBtnClick:function(){e.$connectBtn.on("click",(function(){i.gotoUpgradeUrl()}))},proAlreadyInstalled:function(n){const e=WPCodeSVG.WPCodeIcon("checkmark",88,88,"0 0 130.2 130.2","iconId","path circle");o.confirm({title:e+wpcode.almost_done,content:n.data.message,type:"blue",buttons:{confirm:{text:wpcode.plugin_activate_btn,btnClass:"wpcode-btn-confirm",action:function(){t.location.reload()}}}})},gotoUpgradeUrl:function(){var n={action:"wpcode_connect_url",key:e.$connectKey.val(),_wpnonce:wpcode.nonce};o.post(ajaxurl,n).done((function(n){if(n.success)return n.data.reload?void i.proAlreadyInstalled(n):void(t.location.href=n.data.url);o.confirm({title:c+wpcode.oops,closeIcon:!1,content:n.data.message,type:"blue",buttons:{ok:{text:wpcode.ok,btnClass:"wpcode-btn-confirm",action:function(){}}}})})).fail((function(n){i.failAlert(n)}))},failAlert:function(n){o.confirm({title:c+wpcode.oops,content:wpcode.server_error+"<br>"+n.status+" "+n.statusText+" "+n.responseText,type:"blue",buttons:{ok:{text:wpcode.ok,btnClass:"wpcode-btn-confirm",action:function(){}}}})}};return i}(document,window,jQuery)).init()}();