define(['jquery','ko','underscore','Magento_Customer/js/customer-data'],function($,ko,_,customerData){'use strict';var oldItems=undefined;var mixin={cartUpdated:ko.observable(false),getLastAddedItem:ko.observableArray([]),getLastAddedItemLength:ko.observable(0),getOldItemsLength:ko.observable(0),getOldItems:ko.observableArray([]),initialize:function(){var self=this;var cartData=customerData.get('cart');this.cartUpdated(false);cartData.subscribe(function(oldCart){self.cartUpdated(true);},this,"beforeChange");cartData.subscribe(function(updatedCart){if(this.cartUpdated()&&!_.isUndefined(updatedCart['items'])&&updatedCart['cart_updated']){let new_quote_items=updatedCart['new_quote_items']||[];let old_quote_items=updatedCart['old_quote_items']||[];let old_quote_summary_count=updatedCart['old_quote_summary_count']||0;self.getOldItems(old_quote_items);self.getLastAddedItem(new_quote_items);self.getLastAddedItemLength(Object.keys(new_quote_items).length);self.getOldItemsLength(old_quote_summary_count);}else{this.cartUpdated(false);self.getOldItems([]);self.getLastAddedItem([]);self.getOldItemsLength(0);self.getLastAddedItemLength(0);}},this);return this._super();},scrolled:function(){$(".minicart-items-wrapper").scroll(function(){if($(this).scrollTop()+$(this).innerHeight()>=$(this)[0].scrollHeight-1){$(this).addClass('overflowcart-hide-gradient');}else{$(this).removeClass('overflowcart-hide-gradient');}});},};return function(target){return target.extend(mixin);};});