define(['underscore','ko','mageUtils','Magento_Customer/js/customer-data','Magento_Catalog/js/product/storage/ids-storage'],function(_,ko,utils,customerData,idsStorage){'use strict';return _.extend(utils.copy(idsStorage),{name:'IdsStorageCompare',initialize:function(){if(!this.data){this.data=ko.observable({});} if(this.provider&&window.checkout&&window.checkout.baseUrl){this.providerDataHandler(customerData.get(this.provider)());this.initProviderListener();} this.initLocalStorage().cachesDataFromLocalStorage().initDataListener();return this;},initProviderListener:function(){customerData.get(this.provider).subscribe(this.providerDataHandler.bind(this));},providerDataHandler:function(data){data=data.items||data;data=this.prepareData(data);this.add(data);},prepareData:function(data){var result={},scopeId;_.each(data,function(item){if(typeof item.productScope!=='undefined'){scopeId=item.productScope==='store'?window.checkout.storeId:item.productScope==='group'?window.checkout.storeGroupId:window.checkout.websiteId;result[item.productScope+'-'+scopeId+'-'+item.id]={'added_at':new Date().getTime()/ 1000,'product_id':item.id,'scope_id':scopeId};}else{result[item.id]={'added_at':new Date().getTime()/ 1000,'product_id':item.id};}});return result;}});});