(()=>{"use strict";var t={};function n(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=Array(n);e<n;e++)r[e]=t[e];return r}function e(t,n,e,r,i,a,o){try{var l=t[a](o),c=l.value}catch(t){return void e(t)}l.done?n(c):Promise.resolve(c).then(r,i)}t.n=n=>{var e=n&&n.__esModule?()=>n.default:()=>n;return t.d(e,{a:e}),e},t.d=(n,e)=>{for(var r in e)t.o(e,r)&&!t.o(n,r)&&Object.defineProperty(n,r,{enumerable:!0,get:e[r]})},t.o=(t,n)=>Object.prototype.hasOwnProperty.call(t,n);const r=window.regeneratorRuntime;var i,a,o=t.n(r);i=jQuery,a=function(t){var n,e=null===(n=betterLinksApp)||void 0===n?void 0:n.betterlinkspro_version;if(!e)return!1;for(var r=e.split(".").map(Number),i=t.split(".").map(Number),a=0;a<Math.max(r.length,i.length);a++){var o=r[a]||0,l=i[a]||0;if(o>l)return!0;if(o<l)return!1}return!0},{init:function(){this.trackUnCloakedLinksWithLinkID(),this.trackUnCloakedLinksWithoutLinkID()},trackUnCloakedLinksWithoutLinkID:function(){var t=this;i(document).on("click","body a.betterlinks-linked-text:not([data-link-id])",function(n){var e,r;if(null===(e=n.target)||void 0===e||null===(e=e.href)||void 0===e||!e.startsWith(null===(r=betterLinksApp)||void 0===r?void 0:r.site_url)){!1 in navigator&&(n.preventDefault(),t.redirectToTarget(n.target));var i={target_url:n.target.href};t.initTracking(i)}})},trackUnCloakedLinksWithLinkID:function(){var t=this;i(document).on("click","body a.betterlinks-linked-text[data-link-id]",function(n){var e,r;if(null===(e=n.target)||void 0===e||null===(e=e.href)||void 0===e||!e.startsWith(null===(r=betterLinksApp)||void 0===r?void 0:r.site_url)){var i;!1 in navigator&&(n.preventDefault(),t.redirectToTarget(n.target));var a={linkId:null===(i=n.target.dataset)||void 0===i?void 0:i.linkId};t.initTracking(a)}})},redirectToTarget:function(t){""===t.target?window.location.href=t.href:window.open(t.href,t.target)},initTracking:function(t){return(r=o().mark(function e(){var r,i,l;return o().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("undefined"==typeof geolocationService||!a("2.5.0")){e.next=4;break}return e.prev=1,e.next=2,geolocationService.getCountry();case 2:(r=e.sent)&&(t.country_code=r.country_code,t.country_name=r.country_name),e.next=4;break;case 3:e.prev=3,l=e.catch(1),console.warn("Failed to get country data:",l);case 4:(i=new FormData).append("action","betterlinks__js_analytics_tracking"),i.append("security",betterLinksApp.betterlinks_nonce),Object.entries(t).forEach(function(t){var e,r,a=(r=2,function(t){if(Array.isArray(t))return t}(e=t)||function(t,n){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var r,i,a,o,l=[],c=!0,u=!1;try{if(a=(e=e.call(t)).next,0===n){if(Object(e)!==e)return;c=!1}else for(;!(c=(r=a.call(e)).done)&&(l.push(r.value),l.length!==n);c=!0);}catch(t){u=!0,i=t}finally{try{if(!c&&null!=e.return&&(o=e.return(),Object(o)!==o))return}finally{if(u)throw i}}return l}}(e,r)||function(t,e){if(t){if("string"==typeof t)return n(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=a[0],l=a[1];i.append(o,l)}),i.append("location",location.pathname),"sendBeacon"in navigator?navigator.sendBeacon(betterLinksApp.ajaxurl,i):fetch(betterLinksApp.ajaxurl,{method:"POST",body:i});case 5:case"end":return e.stop()}},e,null,[[1,3]])}),function(){var t=this,n=arguments;return new Promise(function(i,a){var o=r.apply(t,n);function l(t){e(o,i,a,l,c,"next",t)}function c(t){e(o,i,a,l,c,"throw",t)}l(void 0)})})();var r}}.init()})();