module.exports = "(function(t,e,i){var a=i(5894),s=i(7358),_=i(4810),n=__EXPERIMENTAL_EDGE_SPA__,h={globalTags:{},viewStates:{},shouldBatch:!1};t.exports={initialize:function(){this.__state=a.cloneDeep(h),this.on(s.REGISTER_VIEWS,this.__registerViews),this.on(s.SET_VIEW_ACTIVE_STATE,this.__setIsActive),this.on(s.UPDATE_PARSED_VIEW_METADATA,this.__updateParsedMetadata),this.on(s.UPDATE_USER_SUPPLIED_METADATA,this.__updateUserSuppliedMetadata),this.on(s.TRACK_VIEW_ACTIVATED_EVENT,this.__setViewEventId),this.on(s.SET_GLOBAL_TAGS,this.__setGlobalTags),this.on(s.RESET_VIEW_STATES,this.__resetViewStates),this.on(s.SET_VIEW_BATCHING,this.__setBatching)},getAll:function(){var t={};for(var e in this.__state.viewStates)t[e]=this.getViewState(e);return t},getActiveViewIds:function(){return a.reduce(this.__state.viewStates,a.bind((function(t,e,i){return this.isViewActive(i)&&t.push(i),t}),this),[])},shouldBatch:function(){return this.__state.shouldBatch},getViewState:function(t){var e=a.cloneDeep(this.__state.viewStates[t]),s=this.__state.globalTags;return e.metadata=a.extend({},e.parsedMetadata,s,e.userSuppliedMetadata),__INVARIANT__&&i(2048).isType(\"ViewState\",e),e},getActiveViewTags:function(){var t=this.getActiveViewStates(),e=a.map(t,(function(t){return t.metadata})),i=[{}].concat(e);return a.extend.apply(a,i)},getActivationEventId:function(t){return this.__state.viewStates[t]?this.__state.viewStates[t].activationEventId:null},getActiveViewStates:function(){return a.reduce(this.__state.viewStates,a.bind((function(t,e,i){return this.isViewActive(i)&&t.push(this.getViewState(i)),t}),this),[])},isViewActive:function(t){var e=this.__state.viewStates[t];if(__INVARIANT__&&!e)throw new Error(\"No view for pageId = \"+t);return e||_.warn(\"No Page registered with id\",t),!!e.isActive},getGlobalTags:function(){return a.cloneDeep(this.__state.globalTags)},__resetViewStates:function(){this.__state.viewStates={},this.emitChange()},__registerViews:function(t){a.each(t.views,a.bind((function(t){var e=t.id;n,1,this.__state.viewStates[e]||(this.__state.viewStates[e]={id:e,isActive:a.isBoolean(t.isActive)?t.isActive:null,activatedTimestamp:null,activationEventId:null,parsedMetadata:{},userSuppliedMetadata:{}})}),this)),this.emitChange()},__setIsActive:function(t){var e=t.view.id;if(!this.__state.viewStates[e])throw new Error(\"No view exists with id \"+e);this.__state.viewStates[e].isActive=t.isActive,t.isActive?this.__state.viewStates[e].activatedTimestamp=t.timestamp:(this.__state.viewStates[e].parsedMetadata={},this.__state.viewStates[e].userSuppliedMetadata={}),this.emitChange()},__updateParsedMetadata:function(t){var e=t.pageId;if(!this.__state.viewStates[e])throw new Error(\"No view exists with id \"+e);a.assign(this.__state.viewStates[e].parsedMetadata,t.metadata),this.emitChange()},__updateUserSuppliedMetadata:function(t){var e=t.pageId;if(!this.__state.viewStates[e])throw new Error(\"No view exists with id \"+e);a.assign(this.__state.viewStates[e].userSuppliedMetadata,t.metadata),this.emitChange()},__setViewEventId:function(t){var e=t.pageId;this.__state.viewStates[e]&&(this.__state.viewStates[e].activationEventId=t.eventData.eventId,this.emitChange())},__setGlobalTags:function(t){a.extend(this.__state.globalTags,t),this.emitChange()},__setBatching:function(t){this.__state.shouldBatch=t,this.emitChange()}}})";