var Wishlist=(function(){"use strict";var STORAGE_KEY="outerbloom_wishlist";function getWishlist(){var wishlist;try{wishlist=JSON.parse(localStorage.getItem(STORAGE_KEY))||[]}catch(e){console.error("Error retrieving wishlist from localStorage",e),wishlist=[]}return wishlist}function saveWishlist(wishlist){try{localStorage.setItem(STORAGE_KEY,JSON.stringify(wishlist))}catch(e){console.error("Error saving wishlist to localStorage",e)}}function isInWishlist(productId){var wishlist=getWishlist();return wishlist.indexOf(productId.toString())!==-1}function addToWishlist(productId){var wishlist=getWishlist();return isInWishlist(productId)||(wishlist.push(productId.toString()),saveWishlist(wishlist)),wishlist}function removeFromWishlist(productId){var wishlist=getWishlist(),index=wishlist.indexOf(productId.toString());return index!==-1&&(wishlist.splice(index,1),saveWishlist(wishlist)),wishlist}function toggleWishlistItem(productId){return console.log("Toggling product in wishlist:",productId),isInWishlist(productId)?(console.log("Product was in wishlist, removing:",productId),removeFromWishlist(productId)):(console.log("Product not in wishlist, adding:",productId),addToWishlist(productId))}function updateWishlistCount(){var wishlist=getWishlist(),count=wishlist.length,$badge=$(".wishlist-count");count>0?($badge.text(count).show(),$badge.removeClass("d-none")):($badge.hide(),$badge.addClass("d-none"))}function init(){updateWishlistCount(),$(".wishlist-toggle").each(function(){var productId=$(this).data("product-handle");isInWishlist(productId)&&$(this).addClass("active")})}return{init:init,isInWishlist:isInWishlist,getWishlist:getWishlist,toggleWishlistItem:toggleWishlistItem,addToWishlist:addToWishlist,removeFromWishlist:removeFromWishlist,updateWishlistCount:updateWishlistCount}})();$(document).ready(function(){Wishlist.init(),$(document).on("click",".wishlist-toggle",function(e){e.preventDefault(),e.stopPropagation();var $this=$(this),productId=$this.data("product-handle");return Wishlist.toggleWishlistItem(productId),Wishlist.isInWishlist(productId)?$this.addClass("active"):$this.removeClass("active"),Wishlist.updateWishlistCount(),!1}),$(document).on("click",".remove-from-wishlist",function(e){e.preventDefault();var productId=$(this).data("product-id");Wishlist.removeFromWishlist(productId),$('.wishlist-item[data-product-id="'+productId+'"]').fadeOut(function(){$(this).remove(),$(".wishlist-item:visible").length===0&&$("#empty-wishlist").fadeIn()}),Wishlist.updateWishlistCount()})});
//# sourceMappingURL=/cdn/shop/t/138/assets/wishlist-fixed.js.map?v=35991423018869066281754360012
