(window.webpackJsonpvtex_product_list_context_0_4_1=window.webpackJsonpvtex_product_list_context_0_4_1||[]).push([["ProductListContext"],[function(t,e){t.exports=React},,,function(t,e,n){"use strict";n.r(e);var s=n(1),r=n(0),i=n.n(r),o={nextImpressions:[],sentIds:new Map},c=Object(r.createContext)(o),a=Object(r.createContext)((function(t){console.error("error in dispatch ",t)}));function u(t,e){var n,s;switch(e.type){case"SEND_IMPRESSION":var r=e.args,i=r.product,o=r.position,c=void 0===o?0:o,a=t.nextImpressions;if(t.sentIds.has(i.productId))return t;var u=t.sentIds.size+1;t.sentIds.set(i.productId,{position:u});var d=null!==(s=null===(n=t.nextImpressions[0])||void 0===n?void 0:n.impressionIndex)&&void 0!==s?s:u;return a=t.nextImpressions.concat({product:i,impressionIndex:u,originalIndex:c}).sort((function(t,e){return t.originalIndex-e.originalIndex})).map((function(t,e){return Object.assign(Object.assign({},t),{impressionIndex:d+e})})),Object.assign(Object.assign({},t),{nextImpressions:a});case"RESET_NEXT_IMPRESSIONS":return Object.assign(Object.assign({},t),{nextImpressions:[]});case"SET_LIST_NAME":return e.args.listName!==t.listName?Object.assign(Object.assign({},t),{listName:e.args.listName,sentIds:new Map}):t;default:throw new Error("Unhandled action type on product-list-context")}}var d={nextImpressions:[],sentIds:new Map};e.default={ProductListProvider:function(t){var e=t.children,n=t.listName,o=Object(r.useReducer)(u,d),p=Object(s.a)(o,2),l=p[0],x=p[1];return Object(r.useEffect)((function(){x({type:"SET_LIST_NAME",args:{listName:n}})}),[n]),i.a.createElement(c.Provider,{value:l},i.a.createElement(a.Provider,{value:x},e))},useProductListState:function(){return Object(r.useContext)(c)},useProductListDispatch:function(){return Object(r.useContext)(a)}}},,,,function(t,e,n){"use strict";n.r(e),function(t){var e=n(2);n.p=Object(e.getPublicPath)("vtex.product-list-context@0.4.1");var s=Object(e.register)((function(){return n(3)}),t,"vtex.product-list-context@0.4.1","vtex.product-list-context@0.x","ProductListContext");s.renderHotReload,s.setupHMR}.call(this,n(4)(t))}],[[7,"common"]]]);