!function(t){"use strict";var e=function(t){return window.trans=window.trans||{},"undefined"!==window.trans[t]&&window.trans[t]?window.trans[t]:t};t(document).ready((function(){function i(){var e=JSON.parse(decodeURIComponent(s("wishlist"))||"[]"),i=JSON.parse(decodeURIComponent(s("project_wishlist"))||"[]");t(".wishlist-count").text(e.length+i.length),e&&e.map((function(e){t('.add-to-wishlist[data-type="property"][data-id="'.concat(e.id,'"]')).find("i").removeClass("far fa-heart").addClass("fas fa-heart")})),i&&i.map((function(e){t('.add-to-wishlist[data-type="project"][data-id="'.concat(e.id,'"]')).find("i").removeClass("far fa-heart").addClass("fas fa-heart")}))}function a(t,e,i){var a=new Date,s=window.siteUrl;s.includes(window.location.protocol)||(s=window.location.protocol+s);var n=new URL(s);a.setTime(a.getTime()+24*i*60*60*1e3);var o="expires="+a.toUTCString();document.cookie=t+"="+e+"; "+o+"; path=/; domain="+n.hostname}function s(t){for(var e=t+"=",i=document.cookie.split(";"),a=0;a<i.length;a++){for(var s=i[a];" "==s.charAt(0);)s=s.substring(1);if(0==s.indexOf(e))return s.substring(e.length,s.length)}return""}function n(t){var e=window.siteUrl;e.includes(window.location.protocol)||(e=window.location.protocol+e);var i=new URL(e);document.cookie=t+"=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/; domain="+i.hostname}i(),t(document).on("click",".add-to-wishlist",(function(o){o.preventDefault();var r=t(o.currentTarget),d="property"===r.data("type")?"wishlist":"project_wishlist",c=r.data("id"),l=decodeURIComponent(s(d)),f=[];if(null!=c&&0!==c&&void 0!==c)if(void 0===l||null==l||""===l)f.push({id:c}),r.find("i").removeClass("far fa-heart").addClass("fas fa-heart"),Theme.showSuccess(e("Added to wishlist successfully!")),a(d,JSON.stringify(f),60);else{var u={id:c},h=(f=JSON.parse(l)).map((function(t){return t.id})).indexOf(u.id);-1===h?(f.push(u),n(d),a(d,JSON.stringify(f),60),r.find("i").removeClass("far fa-heart").addClass("fas fa-heart"),Theme.showSuccess(e("Added to wishlist successfully!"))):(f.splice(h,1),n(d),a(d,JSON.stringify(f),60),r.find("i").removeClass("fas fa-heart").addClass("far fa-heart"),Theme.showSuccess(e("Removed from wishlist successfully!")))}var w=JSON.parse(s(d)).length;t(".wishlist-count").text(w),i()}))}))}(jQuery);