@img-arena/front-row-seat
Version:
IMG Arena Front Row Seat integration SDK
17 lines (14 loc) • 22 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).frontRowSeat={})}(this,(function(e){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},t(e,n)};function n(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r,o,i,a,s=function(){return s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},s.apply(this,arguments)};function c(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))}function u(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function h(e){if(!e||!Object.keys(e).length)throw TypeError("Expected options object to be passed, received: ".concat(e));if("mw-soccer"===(null==e?void 0:e.sport))return function(e){var t=e||{},n=t.operator,r=t.sport,o=t.targetElementSelector,i=t.initialContext;if(!i||"object"!=typeof i)throw TypeError("Expected initialContext to be context update object, received: ".concat(typeof i," ").concat(i));if(!n||"string"!=typeof n)throw TypeError("Expected operator to be non null string, received: ".concat(typeof n," ").concat(n));if(!r||"string"!=typeof r)throw TypeError("Expected sport to be non null string, received: ".concat(typeof r," ").concat(r));if(!o||"string"!=typeof o&&!(o instanceof window.HTMLElement))throw TypeError("Expected targetElementSelector to be non null string or dom element, received: ".concat(typeof o," ").concat(o));return!0}(e);var t=e.operator,n=e.sport,r=e.version,o=e.betlinkVersion,i=e.eventId,a=e.theme,s=e.language,c=e.targetModule,u=e.targetElementSelector,h=e.initialContext,d=e.trading,l=e.options;if(!t||"string"!=typeof t)throw TypeError("Expected operator to be non null string, received: ".concat(typeof t," ").concat(t));if(!n||"string"!=typeof n)throw TypeError("Expected sport to be non null string, received: ".concat(typeof n," ").concat(n));if(!r||"string"!=typeof r)throw TypeError("Expected version to be non null string, received: ".concat(typeof r," ").concat(r));if(o&&"string"!=typeof o)throw TypeError("Expected betlinkVersion to be non null string, received: ".concat(typeof o," ").concat(o));if(!(i&&"string"==typeof i||o))throw TypeError("Expected eventId to be non null string, received: ".concat(typeof i," ").concat(i));if(a&&"string"!=typeof a)throw TypeError("Expected theme to be a string, received: ".concat(typeof a," ").concat(a));if(s&&"string"!=typeof s)throw TypeError("Expected language to be a string, received: ".concat(typeof s," ").concat(s));if(!(c&&"string"==typeof c||o))throw TypeError("Expected targetModule to be non null string, received: ".concat(typeof c," ").concat(c));if(!u||"string"!=typeof u&&!(u instanceof window.HTMLElement))throw TypeError("Expected targetElementSelector to be non null string or dom element, received: ".concat(typeof u," ").concat(u));if(h&&"object"!=typeof h)throw TypeError("Expected initialContext to be context update object, received: ".concat(typeof h," ").concat(h));if(l&&"object"!=typeof l)throw TypeError("Expected options to be options object, received: ".concat(typeof l," ").concat(l));if(null!=d&&!("boolean"==typeof d))throw TypeError("Expected trading to be boolean or undefined, received: ".concat(typeof d," ").concat(d));return!0}function d(e,t){return void 0===t&&(t=!1),e?t?window.btoa(encodeURIComponent(JSON.stringify(e))):window.btoa(JSON.stringify(e)):""}e.MessageTopics=void 0,(r=e.MessageTopics||(e.MessageTopics={})).CONTEXT_UPDATE="context-update",r.OPTIONS_UPDATE="options-update",r.SELECTION_UPDATE="selection-update",r.CLEAR_SELECTIONS="clear-selections",r.HANDSHAKE_ATTEMPT="handshake-attempt",r.HANDSHAKE_REPLY="handshake-reply",r.HANDSHAKE_FAILED="handshake-failed",r.VIDEO_PLAYBACK_AUTH_REQUEST="video-playback-auth-request",r.VIDEO_PLAYBACK_AUTH_RESPONSE="video-playback-auth-response",r.BETLINK_OPERATOR_AUTH_TOKEN_REQUEST="betlink-operator-auth-token-request",r.BETLINK_OPERATOR_AUTH_TOKEN_RESPONSE="betlink-operator-auth-token-response",r.APP_LOADED="app-loaded",r.CURRENT_EVENT_ID_UPDATE="current-event-id-update",r.MARKETS_UPDATE="markets-update",r.MARKETS_SUSPEND="markets-suspend",r.MARKETS_REMOVE="markets-remove",r.MARKETS_PLACE_BET="markets-place-bet",e.TennisRoundShortNames=void 0,(o=e.TennisRoundShortNames||(e.TennisRoundShortNames={})).Bronze="Bronze",o.F="F",o.First="First",o.Fourth="Fourth",o.Q="Q",o.Q1="Q1",o.Q2="Q2",o.Q3="Q3",o.Q4="Q4",o.Qf="QF",o.Robin="Robin",o.Rubber="Rubber",o.Sf="SF",o.Second="Second",o.Third="Third",o.W="W",e.MatchType=void 0,(i=e.MatchType||(e.MatchType={})).Ld="LD",i.Ls="LS",i.Md="MD",i.Ms="MS",i.Qld="QLD",i.Qls="QLS",i.Qmd="QMD",i.Qms="QMS",i.Qs="QS",i.Qxd="QXD",i.Rs="RS",i.Xd="XD",e.EventIdType=void 0,(e.EventIdType||(e.EventIdType={})).Current="current",e.SportType=void 0,(a=e.SportType||(e.SportType={})).Golf="golf",a.Tennis="tennis",a.Ufc="ufc",a.Basketball="basketball",a.Soccer="soccer",a.MwSoccer="mw-soccer";var l=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];e&&console.debug.apply(null,t)}},p=function(e){return JSON.stringify(e,null,2)},f=function(){function t(t){var n=this;this.debug=!1,this.handshakeSuccess=!1,this.listeners=[],this._messageQueue=[],this.debug=!!t,this.parentWindow=window.parent,window.addEventListener("message",(function(t){var r,o,i,a=t.data;l(n.debug)("ChildCommunication: received message from parent window, message: ".concat(p(a),", handshakeSuccess: ").concat(n.handshakeSuccess,", handshakeRef: ").concat(n.handshakeRef)),a.topic===e.MessageTopics.HANDSHAKE_ATTEMPT?(n.handshakeSuccess=!0,n.origin=t.origin,n.handshakeRef=a.handshakeRef,function(e){return null==e?void 0:e.versionNumber}(a.context)&&(null===(r=a.context)||void 0===r?void 0:r.versionNumber)&&(null===(o=n.resolveVersionNumber)||void 0===o||o.call(n,null===(i=a.context)||void 0===i?void 0:i.versionNumber)),l(n.debug)("ChildCommunication: handshake request received, handshakeRef: ".concat(n.handshakeRef)),n.sendMessageToParent({topic:e.MessageTopics.HANDSHAKE_REPLY,context:{}}),n.flushQueue()):n.sendMessageToEventCentre(a)}))}return t.prototype.flushQueue=function(){var e=this;this._messageQueue.forEach((function(t){e.sendMessageToParent(t)})),this._messageQueue=[]},t.prototype.sendMessageToParent=function(e){l(this.debug)("ChildCommunication: attempting to send message to parent, message: ".concat(p(e),", handshakeSuccess: ").concat(this.handshakeSuccess,", handshakeRef: ").concat(this.handshakeRef)),this.handshakeSuccess?this.parentWindow.postMessage(s(s({},e),{handshakeRef:this.handshakeRef}),"*"):this._messageQueue.push(e)},t.prototype.sendMessageToEventCentre=function(e){this.listeners.forEach((function(t){t(e)}))},t.prototype.onMessage=function(e){this.listeners.push(e)},t.prototype.getVersionNumber=function(){return c(this,void 0,void 0,(function(){var e=this;return u(this,(function(t){return window.parent===window?[2,Promise.resolve("no-iframe")]:[2,new Promise((function(t){e.resolveVersionNumber=function(e){return t(e||"legacy")},setTimeout((function(){return t("no-frsjs-or-timeout")}),5e3)}))]}))}))},t}();var m=function(){function t(t){var n=this;this.listeners={},this.emit=function(t,r){!function(t){if(!Object.values(e.MessageTopics).includes(t))throw TypeError("Expected supported message topic, received: ".concat(typeof t," ").concat(t))}(t),n.comms.sendMessageToParent({topic:t,context:r})},this.on=function(e,t){n.listeners[e]=t},this.removeCallback=function(e){delete n.listeners[e]},this.comms=new f(t),this.comms.onMessage((function(e){n.listeners[e.topic]&&n.listeners[e.topic](e.context)}))}return t.prototype.getVersion=function(){return c(this,void 0,void 0,(function(){var e;return u(this,(function(t){switch(t.label){case 0:return e={guestVersion:"1.54.0"},[4,this.comms.getVersionNumber()];case 1:return[2,(e.hostVersion=t.sent(),e)]}}))}))},t}();function g(e){return new m(e)}var _="apps.imgarena.com";function v(e){var t=e.__betlink_iframe_url_override__,n=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["__betlink_iframe_url_override__"]),r="https://".concat(e.operator,".").concat(_,"/betlink/").concat(e.betlinkVersion||"latest","/full/");t&&(r=t.origin+t.path),e.eventId&&(r="".concat(r,"#/golf/markets/").concat(e.eventId,"/outright"));var o=new URL(r),i=new URLSearchParams(o.search),a=e.betlinkEnv||e.env||"demo",s=e.env||"demo",c=e.operatorEnv||"prod";return i.append("betlinkEnv",a),i.append("env",s),i.append("language",e.language||"en_GB"),i.append("initialContext",d(n,!0)),i.append("operatorEnv",c),o.search=i.toString(),o.toString()}var E={theme:"default",language:"en-GB",targetModule:"full",env:"prod",version:"latest"};function y(e){if("mw-soccer"!==e.sport)throw new Error("".concat(y.name," must be called with sport = 'mw-soccer'"));if(!e.initialContext)throw new Error("Missing required initial context for sport 'mw-soccer'");var t=Object.assign({},E,e),n="https://".concat(t.operator,".").concat(b,"/").concat(t.sport,"/").concat(t.version,"/").concat(t.targetModule,"/");t.__iframe_url_override__&&(n=t.__iframe_url_override__.origin+t.__iframe_url_override__.path);var r=new URL(n),o=new URLSearchParams(r.search);return["operator","operatorEnv","env"].forEach((function(e){var n=t[e];n&&o.append(e,n.toString())})),["initialContext","options"].forEach((function(e){if(t[e]){var n=d(t[e]);o.append(e,n)}})),r.search=o.toString(),r.toString()}var b="apps.imgarena.com";function T(t){return c(this,void 0,void 0,(function(){return u(this,(function(n){switch(n.label){case 0:if(t!==e.SportType.Ufc)return[2,null];n.label=1;case 1:return n.trys.push([1,4,,5]),[4,fetch("https://dixgwmlrk5btxsfzviip6hdhrm0tazmw.lambda-url.eu-west-1.on.aws/")];case 2:return[4,n.sent().json()];case 3:return[2,n.sent()];case 4:return n.sent(),[2,null];case 5:return[2]}}))}))}var w=function(){function t(t,n,r){var o=this;this.debug=!1,this.handshakeSuccess=!1,this.listeners=[],this._messageQueue=[],this.debug=!!r,this.iframe=document.createElement("iframe"),n.appendChild(this.iframe),this.handshakeRef=Date.now().toString(8),this.resetIframe(t),window.addEventListener("message",(function(t){l(o.debug)("ParentCommunication: received message from child window, ".concat(p(t.data),", handshakeSuccess ").concat(o.handshakeSuccess,", handshakeRef: ").concat(o.handshakeRef));var n=t.data;n.handshakeRef===o.handshakeRef&&(n.topic===e.MessageTopics.HANDSHAKE_REPLY?(o.handshakeSuccess=!0,o.flushQueue()):o.sendMessageToParent(n))}))}return t.prototype.resetIframe=function(e){var t=this;if(this.iframe.style.display=null===e?"none":"block",!(e===this.iframe.src)){if(this.handshakeSuccess=!1,this._onIframeLoad&&this.iframe.removeEventListener("load",this._onIframeLoad),this._latestHandshakeTimeout&&clearTimeout(this._latestHandshakeTimeout),!e)return this.iframe.removeAttribute("src"),void(this.iframeWindow=null);this.origin=e&&new URL(e).origin,this.iframe.setAttribute("src",null!=e?e:""),this.iframe.setAttribute("id","imgarena-event-centre__".concat(this.handshakeRef)),this.iframeWindow=this.iframe.contentWindow,this._onIframeLoad=function(){t.triggerHandshake(20)},this.iframe.addEventListener("load",this._onIframeLoad)}},t.prototype.triggerHandshake=function(t){var n=this;this.handshakeSuccess||(0===t?this.sendMessageToParent({topic:e.MessageTopics.HANDSHAKE_FAILED,context:{}}):(this.iframeWindow&&(l(this.debug)("ParentCommunication: triggering handshake, attempts left: ".concat(t,", handshakeRef: ").concat(this.handshakeRef)),this.iframeWindow.postMessage({topic:e.MessageTopics.HANDSHAKE_ATTEMPT,context:{frameOrigin:this.origin,handshakeRef:this.handshakeRef,versionNumber:"1.54.0"},handshakeRef:this.handshakeRef},"*")),this._latestHandshakeTimeout=setTimeout((function(){n.triggerHandshake(t-1)}),150)))},t.prototype.flushQueue=function(){var e=this;0!==this._messageQueue.length&&(l(this.debug)("ParentCommunication: flushing queue, handshakeRef: ".concat(this.handshakeRef,", queue length: ").concat(this._messageQueue.length)),this._messageQueue.forEach((function(t){e.sendMessageToIframe(t)})),this._messageQueue=[])},t.prototype.sendMessageToIframe=function(e){l(this.debug)("ParentCommunication: Sending message to iframe: Message: ".concat(p(e),", handshakeSuccess: ").concat(this.handshakeSuccess,", handshakeRef: ").concat(this.handshakeRef)),this.handshakeSuccess?this.iframeWindow&&this.origin&&this.iframeWindow.postMessage(s(s({},e),{handshakeRef:this.handshakeRef}),this.origin):this._messageQueue.push(e)},t.prototype.sendMessageToParent=function(e){this.listeners.forEach((function(t){t(e)}))},t.prototype.onMessage=function(e){this.listeners.push(e)},t}(),S=[],k=[];var R={"front-row-seat-container":"style_module_frontRowSeatContainer__7404ef75","event-centre":"style_module_eventCentre__7404ef75","event-centre-lite":"style_module_eventCentreLite__7404ef75","with-betlink":"style_module_withBetlink__7404ef75",betlink:"style_module_betlink__7404ef75"};!function(e,t){if(e&&"undefined"!=typeof document){var n,r=!0===t.prepend?"prepend":"append",o=!0===t.singleTag,i="string"==typeof t.container?document.querySelector(t.container):document.getElementsByTagName("head")[0];if(o){var a=S.indexOf(i);-1===a&&(a=S.push(i)-1,k[a]={}),n=k[a]&&k[a][r]?k[a][r]:k[a][r]=s()}else n=s();65279===e.charCodeAt(0)&&(e=e.substring(1)),n.styleSheet?n.styleSheet.cssText+=e:n.appendChild(document.createTextNode(e))}function s(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),t.attributes)for(var n=Object.keys(t.attributes),o=0;o<n.length;o++)e.setAttribute(n[o],t.attributes[n[o]]);var a="prepend"===r?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}(".style_module_frontRowSeatContainer__7404ef75 {\n display: flex;\n width: 100%;\n height: 100%;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n}\n\n.style_module_eventCentre__7404ef75 {\n height: 100%;\n width: 100%;\n border: none;\n}\n\n.style_module_eventCentreLite__7404ef75 {\n height: 100%;\n width: 100%;\n border: none;\n}\n\n.style_module_eventCentre__7404ef75.style_module_withBetlink__7404ef75 {\n max-height: 400px;\n}\n\n.style_module_betlink__7404ef75 {\n height: 100%;\n width: 100%;\n}",{});var M=function(){function e(e){this.debug=!1,this.communications=[],this.listeners={},this.debug=!!e.__debug__;var t=this.getTargetElement(e.targetElementSelector);this.frontRowSeatContainerElement=document.createElement("div"),this.frontRowSeatContainerElement.className=R["front-row-seat-container"],t.appendChild(this.frontRowSeatContainerElement)}return e.prototype.initCommunication=function(e,t){var n=new w(e,this.frontRowSeatContainerElement,this.debug);n.iframe.className=R[t],this.communications.push(n),this.addEventHandlers()},e.prototype.emit=function(e,t){this.communications.forEach((function(n){n.sendMessageToIframe({topic:e,context:t})}))},e.prototype.on=function(e,t){this.listeners[e]=t},e.prototype.removeCallback=function(e){delete this.listeners[e]},e.prototype.addEventHandlers=function(){var e=this;this.communications.forEach((function(t){t.onMessage((function(n){e.listeners[n.topic]&&e.listeners[n.topic](n.context),e.communications.filter((function(e){return e!==t})).forEach((function(e){e.sendMessageToIframe(n)}))}))}))},e.prototype.getTargetElement=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=0,r=e;n<r.length;n++){var o=r[n];if(o){var i=document.querySelector(o);if(i)return i}}throw Error("Failed to find target element with selector: "+e.join(","))},e}(),C=function(e){function t(t){var n=this;return h(t),n=e.call(this,{__debug__:!!t.__debug__,targetElementSelector:t.targetElementSelector||""})||this,t.betlinkVersion?n.initCommunication(v(t),"betlink"):n.initCommunication(function(e){if("mw-soccer"===e.sport)return y(e);var t=Object.assign({},E,e);if(!e.eventId)return null;var n="https://".concat(t.operator,".").concat(b,"/").concat(t.sport,"/").concat(t.version,"/").concat(t.targetModule,"/");t.__iframe_url_override__&&(n=t.__iframe_url_override__.origin+t.__iframe_url_override__.path);var r=new URL(n),o=new URLSearchParams(r.search);return["eventId","operator","operatorEnv","theme","language","env","targetModule","trading"].forEach((function(e){var n=t[e];n&&o.append(e,n.toString())})),t.__replay_id__&&o.append("replayId",t.__replay_id__),["initialContext","options"].forEach((function(e){if(t[e]){var n=d(t[e]);o.append(e,n)}})),r.search=o.toString(),r.toString()}(t)||"","event-centre"),n}return n(t,e),t}(M);function P(t,n){return c(this,void 0,void 0,(function(){var r;return u(this,(function(o){switch(o.label){case 0:return[4,T(n.sport)];case 1:return(r=o.sent())&&t.emit(e.MessageTopics.CURRENT_EVENT_ID_UPDATE,r),[2]}}))}))}function A(t){var n=new C(t);return function(t,n){c(this,void 0,void 0,(function(){return u(this,(function(r){switch(r.label){case 0:return n.eventId!==e.EventIdType.Current?[3,2]:[4,P(t,n)];case 1:r.sent(),r.label=2;case 2:return[2]}}))}))}(n,t),n}var x,O={theme:"default",targetModule:"",language:"en-GB",env:"prod",operator:"img"},N=function(e){function t(t){var n=e.call(this,{__debug__:!!t.__debug__,targetElementSelector:t.targetElementSelector})||this;return n.BASE_URL="https://{OPERATOR}.apps.imgarena.com/ec-lite/latest/{PATH}",n.iFrameUrl="",n.args=Object.assign({},O,t),n.iFrameUrl=n.createEventCentreLiteUrl(),n.initCommunication(n.iFrameUrl,"event-centre-lite"),n}return n(t,e),t.prototype.createEventCentreLiteUrl=function(){var e,t="prod"===this.args.env||"replay-dev"===this.args.env||"demo"===this.args.env?"full/":"index.html",n=new URL((null===(e=this.args.__iframe_url_override__)||void 0===e?void 0:e.origin)||this.BASE_URL.replace("{OPERATOR}",this.args.operator).replace("{PATH}",t)),r=new URLSearchParams(n.search);return this.appendParam("sport",r),this.appendParam("targetModule",r),this.appendParam("eventId",r),this.appendParam("theme",r),this.appendParam("language",r),this.appendParam("env",r),this.appendParam("view",r),this.appendParam("__replay_id__",r,"replayId"),this.appendInitialContextParam(r),n.search=r.toString(),n.toString()},t.prototype.appendParam=function(e,t,n){if(this.args[e]){var r="".concat(this.args[e]);t.append(n||e,r)}},t.prototype.appendInitialContextParam=function(e){this.args.initialContext&&Object.keys(this.args.initialContext).length&&e.append("initialContext",d(this.args.initialContext))},t}(M);function L(e){return new N(e)}!function(e){e.DEFAULT="default",e.LENGTHENING="lengthening",e.SHORTENING="shortening"}(x||(x={}));var I={UPDATE:e.MessageTopics.MARKETS_UPDATE,SUSPEND:e.MessageTopics.MARKETS_SUSPEND,REMOVE:e.MessageTopics.MARKETS_REMOVE,PLACE_BET:e.MessageTopics.MARKETS_PLACE_BET},U=Object.freeze({__proto__:null,get MarketDirection(){return x},MARKETS_EVENT:I}),Q={MessageTopics:e.MessageTopics,encodeJSONParameter:d,decodeJSONParameter:function(e,t){if(void 0===t&&(t=!1),e){if(t)return JSON.parse(decodeURIComponent(window.atob(e)));var n=window.atob(e);return JSON.parse(n)}}},D={eventCentreClient:g,eventCenterLite:L,eventCentre:A,eventCentreUtils:Q,eventCentreMarkets:U};e.default=D,e.eventCenterLite=L,e.eventCentre=A,e.eventCentreClient=g,e.eventCentreMarkets=U,e.eventCentreUtils=Q,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=index.umd.js.map