!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var i=t();for(var o in i)("object"==typeof exports?exports:e)[o]=i[o]}}(window,function(){return function(e){var t={};function i(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=e,i.c=t,i.d=function(e,t,o){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(o,n,function(t){return e[t]}.bind(null,n));return o},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=0)}([function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var i in e)t.hasOwnProperty(i)||(t[i]=e[i])}(i(1));var o=i(2);t.sbMsgBusPredefinedTopics={GeoTopics:o.GeoTopics}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("test",function(){},t)}catch(e){}function i(e){var t,i=document.getElementsByTagName("iframe");return t=Array.prototype.filter.call(i,function(t){return t.src.match(e)})[0],s.push(t),t&&t.contentWindow}function o(e,t){var i=e.indexOf(t);i>-1&&e.splice(i,1)}e=!e||{capture:!0,passive:!0},setTimeout(function e(){!function(){if(window.sbMsgBus){var e=window.sbMsgBus;Object.keys(e.topics).forEach(function(t){0===e.topics[t].length&&(delete e.topics[t],delete n[t])})}}(),setTimeout(e,1e4)},1e4);var n={},s=[],r=[],c="sb_",u=function(){function e(){this.sbPrefix=c,this.type="",this.isActive=!1,this.topics=Object.create(null),this.receiveMessages=this.receiveMessages.bind(this),this.deactivate=this.deactivate.bind(this),this.activate()}return e.prototype.activate=function(){return this.isActive=!0,this.type="parent",(null!==window.opener&&void 0!==window.opener||window.parent!==window)&&this.initAsChild(),window.addEventListener("onunload",this.deactivate,!0),window.addEventListener("message",this.receiveMessages,!0),this.link(window),this},e.prototype.deactivate=function(){return this.isActive=!1,this.topics=Object.create(null),this.post({"sb-mbus-unlink":window.location.toString()}),s=[],r=[],window.removeEventListener("onunload",this.deactivate,!0),window.removeEventListener("message",this.receiveMessages,!0),this.unlink(window),this},e.prototype.initAsChild=function(){return this.type="child",this.link(null===window.opener||void 0===window.opener?window.parent:window.opener),this.post({"sb-mbus-link":window.location.origin.toString()}),this},e.prototype.link=function(e){return this.isActive?("string"==typeof e&&(t=i(e)),"object"==typeof e&&"function"==typeof e.postMessage&&(t=e),t&&-1===r.indexOf(t)&&r.push(t),this):this;var t},e.prototype.unlink=function(e){return this.isActive?("string"==typeof e&&(t=i(e)),"object"==typeof e&&"function"==typeof e.postMessage&&(t=e),t&&o(r,t),this):this;var t},e.prototype.receiveMessages=function(e){var t;try{t=JSON.parse(e.data)}catch(e){t=void 0}return t&&this.routeMessages(t),this},e.prototype.routeMessages=function(e){var t=this;return e&&Object.keys(e).forEach(function(i){if(i.match("sb-mbus-"))try{t[i.replace("sb-mbus-","")](e[i])}catch(e){console.error(e)}else i.match(c)&&(Array.isArray(t.topics[i])&&t.topics[i].forEach(function(t){"function"==typeof t&&setTimeout(function(){try{t(e[i])}catch(e){console.error(e)}})}),function(e,t){n[e]=t}(i,e[i]))}),this},e.prototype.subscribe=function(e,t){void 0===this.topics[e]&&(this.topics[e]=[]),-1===this.topics[e].indexOf(t)&&this.topics[e].push(t),void 0!==n[e]&&t(n[e])},e.prototype.unsubscribe=function(e,t){Array.isArray(this.topics[e])&&o(this.topics[e],t)},e.prototype.post=function(e){var t;try{t=JSON.stringify(e)}catch(i){t="",console.error("Tried to send malformed message: "+e+", err > "+i)}return r.forEach(function(e){if(void 0!==e&&"function"==typeof e.postMessage)try{e.postMessage(t,"*")}catch(e){console.error(e)}}),this},e}();window.sbMsgBus=window.sbMsgBus||new u}(),t.sbMsgBus=window.sbMsgBus},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=i(0);t.GeoTopics={SB_GeoOnLogin:o.sbMsgBus.sbPrefix+"geo_sdk_login",SB_GeoOnLogout:o.sbMsgBus.sbPrefix+"geo_sdk_logout",SB_HideRegulationMessageonUserLogin:o.sbMsgBus.sbPrefix+"hideRegulationMessageonUserLogin",SB_ShowRegulationMessageonUserLogin:o.sbMsgBus.sbPrefix+"showRegulationMessageonUserLogin",SB_HideHeaderLoader:o.sbMsgBus.sbPrefix+"hideHeaderLoader",SB_GeoSdkTopic:o.sbMsgBus.sbPrefix+"geo_sdk_topic"}}])}); //# sourceMappingURL=sbMsgBus.js.map