define(['Magento_Customer/js/customer-data'],function(customerData){'use strict';return{sectionName:'ampixel-core-event-pool',publicEventsData:[],sectionUpdateHandlers:[],'Amasty_PixelCore/js/event-data':function(settings){this.publicEventsData=settings.publicEventsData;this.bindSectionUpdates();},getPublicEventsData:function(pixelType){return this.publicEventsData.filter(eventData=>eventData.pixelType===pixelType);},addSectionUpdateHandler:function(pixelType,handlerCallback){this.sectionUpdateHandlers.push({pixelType,handlerCallback});},bindSectionUpdates:function(){customerData.get(this.sectionName).subscribe((eventsSection)=>{const eventsData=eventsSection?.eventsData??[];if(!eventsData.length){return;} this.sectionUpdateHandlers.forEach((updateHandler)=>{updateHandler.handlerCallback(eventsData.filter(eventData=>eventData.pixelType===updateHandler.pixelType));});customerData.set(this.sectionName,{data_id:eventsSection?.data_id??undefined});});}}});