@brandbrigade/ott-bb-player 1.0.44 → 1.0.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/OTTPlayer.js CHANGED
@@ -269,4 +269,4 @@ ${i.filter(r=>r).join(`
269
269
  `.concat(Z),function(h){l.notifyAfterAddMessage(h-m)})}function d(Z){return Z!==void 0&&c[Z]!==void 0}function s(Z){var m=c[Z];delete c[Z];var p=t.estimateEncodedBytesCount(m);l.notifyAfterRemoveMessage(p)}function o(Z,m){var p=Le(Z),h=t.estimateEncodedBytesCount(p);if(h>=a){B.warn("Discarded a message whose size was bigger than the maximum allowed size ".concat(a,"KB. ").concat(Dt," ").concat(Xc,"/#technical-limitations"));return}d(m)&&s(m),r(p,h,m)}function u(Z){var m=De(c).join(`
270
270
  `);c={};var p=vG(Z.reason),h=p?n.sendOnExit:n.send;if(p&&t.isAsync){var R=t.finishSync();R.outputBytesCount&&h(Zi(R));var y=[R.pendingData,m].filter(Boolean).join(`
271
271
  `);y&&h({data:y,bytesCount:nl(y)})}else m&&t.write(t.isEmpty?m:`
272
- `.concat(m)),t.finish(function(V){h(Zi(V))})}return{flushController:l,add:o,upsert:o,stop:i.unsubscribe}}function Zi(e){var t;return typeof e.output=="string"?t=e.output:t=new Blob([e.output],{type:"text/plain"}),{data:t,bytesCount:e.outputBytesCount,encoding:e.encoding}}function FG(e){var t=e.messagesLimit,n=e.bytesLimit,l=e.durationLimit,a=e.pageExitObservable,c=e.sessionExpireObservable,i=a.subscribe(function(h){return u(h.reason)}),r=c.subscribe(function(){return u("session_expire")}),d=new Q(function(){return function(){i.unsubscribe(),r.unsubscribe()}}),s=0,o=0;function u(h){if(o!==0){var R=o,y=s;o=0,s=0,p(),d.notify({reason:h,messagesCount:R,bytesCount:y})}}var Z;function m(){Z===void 0&&(Z=bt(function(){u("duration_limit")},l))}function p(){Yc(Z),Z=void 0}return{flushObservable:d,get messagesCount(){return o},notifyBeforeAddMessage:function(h){s+h>=n&&u("bytes_limit"),o+=1,s+=h,m()},notifyAfterAddMessage:function(h){h===void 0&&(h=0),s+=h,o>=t?u("messages_limit"):s>=n&&u("bytes_limit")},notifyAfterRemoveMessage:function(h){s-=h,o-=1,o===0&&p()}}}function hi(e,t,n,l,a,c,i){i===void 0&&(i=gG);var r=s(e,t),d=n&&s(e,n);function s(o,u){var Z=u.endpoint,m=u.encoder;return i({encoder:m,request:XG(o,Z,o.batchBytesLimit,l),flushController:FG({messagesLimit:o.batchMessagesLimit,bytesLimit:o.batchBytesLimit,durationLimit:o.flushTimeout,pageExitObservable:a,sessionExpireObservable:c}),messageBytesLimit:o.messageBytesLimit})}return{flushObservable:r.flushController.flushObservable,add:function(o,u){u===void 0&&(u=!0),r.add(o),d&&u&&d.add(n.transformMessage?n.transformMessage(o):o)},upsert:function(o,u){r.upsert(o,u),d&&d.upsert(n.transformMessage?n.transformMessage(o):o,u)},stop:function(){r.stop(),d&&d.stop()}}}function Zn(){var e="",t=0;return{isAsync:!1,get isEmpty(){return!e},write:function(n,l){var a=nl(n);t+=a,e+=n,l&&l(a)},finish:function(n){n(this.finishSync())},finishSync:function(){var n={output:e,outputBytesCount:t,rawBytesCount:t,pendingData:""};return e="",t=0,n},estimateEncodedBytesCount:function(n){return n.length}}}var CG=function(){function e(){this.callbacks={}}return e.prototype.notify=function(t,n){var l=this.callbacks[t];l&&l.forEach(function(a){return a(n)})},e.prototype.subscribe=function(t,n){var l=this;return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(n),{unsubscribe:function(){l.callbacks[t]=l.callbacks[t].filter(function(a){return n!==a})}}},e}();function xG(e,t,n){var l=0,a=!1;return{isLimitReached:function(){if(l===0&&bt(function(){l=0},Xe),l+=1,l<=t||a)return a=!1,!1;if(l===t+1){a=!0;try{n({message:"Reached max number of ".concat(e,"s by minute: ").concat(t),source:j.AGENT,startClocks:me()})}finally{a=!1}}return!0}}}var Yl,vl=new WeakMap;function SG(e){return Yl||(Yl=IG(e)),Yl}function IG(e){return new Q(function(t){var n=ge(XMLHttpRequest.prototype,"open",zG).stop,l=ge(XMLHttpRequest.prototype,"send",function(c){MG(c,e,t)},{computeHandlingStack:!0}).stop,a=ge(XMLHttpRequest.prototype,"abort",JG).stop;return function(){n(),l(),a()}})}function zG(e){var t=e.target,n=e.parameters,l=n[0],a=n[1];vl.set(t,{state:"open",method:String(l).toUpperCase(),url:bl(String(a))})}function MG(e,t,n){var l=e.target,a=e.handlingStack,c=vl.get(l);if(c){var i=c;i.state="start",i.startClocks=me(),i.isAborted=!1,i.xhr=l,i.handlingStack=a;var r=!1,d=ge(l,"onreadystatechange",function(){l.readyState===XMLHttpRequest.DONE&&s()}).stop,s=function(){if(o(),d(),!r){r=!0;var u=c;u.state="complete",u.duration=qb(i.startClocks.timeStamp,ue()),u.status=l.status,n.notify(i0(u))}},o=Fe(t,l,"loadend",s).stop;n.notify(i)}}function JG(e){var t=e.target,n=vl.get(t);n&&(n.isAborted=!0)}var gl;function bi(){return gl||(gl=NG()),gl}function NG(){return new Q(function(e){if(window.fetch){var t=ge(window,"fetch",function(n){return kG(n,e)},{computeHandlingStack:!0}).stop;return t}})}function kG(e,t){var n=e.parameters,l=e.onPostCall,a=e.handlingStack,c=n[0],i=n[1],r=i&&i.method;r===void 0&&c instanceof Request&&(r=c.method);var d=r!==void 0?String(r).toUpperCase():"GET",s=c instanceof Request?c.url:bl(String(c)),o=me(),u={state:"start",init:i,input:c,method:d,startClocks:o,url:s,handlingStack:a};t.notify(u),n[0]=u.input,n[1]=u.init,l(function(Z){return KG(t,Z,u)})}function KG(e,t,n){var l=n;function a(c){l.state="resolve",P(l,c),e.notify(l)}t.then(z(function(c){a({response:c,responseType:c.type,status:c.status,isAborted:!1})}),z(function(c){var i,r;a({status:0,isAborted:((r=(i=l.init)===null||i===void 0?void 0:i.signal)===null||r===void 0?void 0:r.aborted)||c instanceof DOMException&&c.code===DOMException.ABORT_ERR,error:c})}))}var Fl={};function TG(e){var t=e.map(function(n){return Fl[n]||(Fl[n]=HG(n)),Fl[n]});return gc.apply(void 0,t)}function HG(e){return new Q(function(t){var n=ne[e];return ne[e]=function(){for(var l=[],a=0;a<arguments.length;a++)l[a]=arguments[a];n.apply(console,l);var c=rn();ht(function(){t.notify(UG(l,e,c))})},function(){ne[e]=n}})}function UG(e,t,n){var l=e.map(function(i){return wG(i)}).join(" "),a;if(t===K.error){var c=l0(e,function(i){return i instanceof Error});a={stack:c?ve(ae(c)):void 0,fingerprint:Ec(c),causes:c?Dc(c,"console"):void 0,startClocks:me(),message:l,source:j.CONSOLE,handling:"handled",handlingStack:n}}return{api:t,message:l,error:a,handlingStack:n}}function wG(e){return typeof e=="string"?ce(e):e instanceof Error?Bc(ae(e)):Le(ce(e),void 0,2)}function Cl(e){var t={},n=new Q,l={getContext:function(){return $c(t)},setContext:function(a){Rl(a)==="object"?(t=ce(a),e&&e.updateCustomerData(t)):l.clearContext(),n.notify()},setContextProperty:function(a,c){t[a]=ce(c),e&&e.updateCustomerData(t),n.notify()},removeContextProperty:function(a){delete t[a],e&&e.updateCustomerData(t),n.notify()},clearContext:function(){t={},e&&e.resetCustomerData(),n.notify()},changeObservable:n};return l}var BG="_dd_c",QG=[];function pi(e,t,n,l){var a=PG(n,l);QG.push(Fe(e,window,"storage",function(d){var s=d.key;a===s&&c()})),t.changeObservable.subscribe(i),t.setContext($e(r(),t.getContext()));function c(){t.setContext(r())}function i(){localStorage.setItem(a,JSON.stringify(t.getContext()))}function r(){var d=localStorage.getItem(a);return d!==null?JSON.parse(d):{}}}function PG(e,t){return"".concat(BG,"_").concat(e,"_").concat(t)}var EG=3*le,DG=16*le,jG=200;function OG(e){e===void 0&&(e=2);var t=new Map,n=!1;function l(a){if(a===void 0&&(a=0),!(n||e===0)){var c=e===2?EG:DG,i=a;t.forEach(function(r){i+=r.getBytesCount()}),i>c&&(AG(c),n=!0)}}return{createDetachedTracker:function(){var a=Gi(function(){return l(a.getBytesCount())});return a},getOrCreateTracker:function(a){return t.has(a)||t.set(a,Gi(l)),t.get(a)},setCompressionStatus:function(a){e===0&&(e=a,l())},getCompressionStatus:function(){return e},stop:function(){t.forEach(function(a){return a.stop()}),t.clear()}}}function Gi(e){var t=0,n=Fc(function(i){t=nl(Le(i)),e()},jG),l=n.throttled,a=n.cancel,c=function(){a(),t=0};return{updateCustomerData:function(i){cl(i)?c():l(i)},resetCustomerData:c,getBytesCount:function(){return t},stop:function(){a()}}}function AG(e){B.warn("Customer data exceeds the recommended ".concat(e/le,"KiB threshold. ").concat(Dt," ").concat(Xc,"/#customer-data-exceeds-the-recommended-threshold-warning"))}function _G(e,t,n){var l=e.getReader(),a=[],c=0;i();function i(){l.read().then(z(function(d){if(d.done){r();return}a.push(d.value),c+=d.value.length,c>n.bytesLimit?r():i()}),z(function(d){return t(d)}))}function r(){l.cancel().catch(he);var d,s;{var o;if(a.length===1)o=a[0];else{o=new Uint8Array(c);var u=0;a.forEach(function(Z){o.set(Z,u),u+=Z.length})}d=o.slice(0,n.bytesLimit),s=o.length>n.bytesLimit}t(void 0,d,s)}}var $G="datadog-synthetics-public-id",qG="datadog-synthetics-result-id",ey="datadog-synthetics-injects-rum";function yi(){return!!(window._DATADOG_SYNTHETICS_INJECTS_RUM||We(ey))}function ty(){var e=window._DATADOG_SYNTHETICS_PUBLIC_ID||We($G);return typeof e=="string"?e:void 0}function ny(){var e=window._DATADOG_SYNTHETICS_RESULT_ID||We(qG);return typeof e=="string"?e:void 0}function Xi(e){var t=P({},e),n=["id","name","email"];return n.forEach(function(l){l in t&&(t[l]=String(t[l]))}),t}function ly(e){var t=Rl(e)==="object";return t||B.error("Unsupported user:",e),t}var $;function hn(e,t,n){var l=n.getHandler(),a=Array.isArray(l)?l:[l];return Vi[e]>=Vi[n.getLevel()]&&Ee(a,t)}var x={ok:"ok",debug:"debug",info:"info",notice:"notice",warn:"warn",error:"error",critical:"critical",alert:"alert",emerg:"emerg"},Vi=($={},$[x.ok]=0,$[x.debug]=1,$[x.info]=2,$[x.notice]=4,$[x.warn]=5,$[x.error]=6,$[x.critical]=7,$[x.alert]=8,$[x.emerg]=9,$);function bn(e,t){var n=t===void 0?{}:t,l=n.includeMessage,a=l===void 0?!1:l;return{stack:e.stack,kind:e.type,message:a?e.message:void 0,causes:e.causes,fingerprint:e.fingerprint,handling:e.handling}}var ay=function(e,t,n,l){var a=arguments.length,c=a<3?t:l===null?l=Object.getOwnPropertyDescriptor(t,n):l,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(e,t,n,l);else for(var r=e.length-1;r>=0;r--)(i=e[r])&&(c=(a<3?i(c):a>3?i(t,n,c):i(t,n))||c);return a>3&&c&&Object.defineProperty(t,n,c),c},Xt={console:"console",http:"http",silent:"silent"},cy=Object.keys(x),q=function(){function e(t,n,l,a,c,i){a===void 0&&(a=Xt.http),c===void 0&&(c=x.debug),i===void 0&&(i={}),this.handleLogStrategy=t,this.handlerType=a,this.level=c,this.contextManager=Cl(n),this.contextManager.setContext(i),l&&this.contextManager.setContextProperty("logger",{name:l})}return e.prototype.logImplementation=function(t,n,l,a,c){l===void 0&&(l=x.info);var i=ce(n),r;if(a!=null){var d=Pc({stackTrace:a instanceof Error?ae(a):void 0,originalError:a,nonErrorPrefix:"Provided",source:j.LOGGER,handling:"handled",startClocks:me()});r=$e({error:bn(d,{includeMessage:!0})},i)}else r=i;this.handleLogStrategy({message:ce(t),context:r,status:l},this,c)},e.prototype.log=function(t,n,l,a){l===void 0&&(l=x.info);var c;hn(l,Xt.http,this)&&(c=rn()),this.logImplementation(t,n,l,a,c)},e.prototype.setContext=function(t){this.contextManager.setContext(t)},e.prototype.getContext=function(){return this.contextManager.getContext()},e.prototype.setContextProperty=function(t,n){this.contextManager.setContextProperty(t,n)},e.prototype.removeContextProperty=function(t){this.contextManager.removeContextProperty(t)},e.prototype.clearContext=function(){this.contextManager.clearContext()},e.prototype.setHandler=function(t){this.handlerType=t},e.prototype.getHandler=function(){return this.handlerType},e.prototype.setLevel=function(t){this.level=t},e.prototype.getLevel=function(){return this.level},ay([d0],e.prototype,"logImplementation",null),e}();q.prototype.ok=ie(x.ok),q.prototype.debug=ie(x.debug),q.prototype.info=ie(x.info),q.prototype.notice=ie(x.notice),q.prototype.warn=ie(x.warn),q.prototype.error=ie(x.error),q.prototype.critical=ie(x.critical),q.prototype.alert=ie(x.alert),q.prototype.emerg=ie(x.emerg);function ie(e){return function(t,n,l){var a;hn(e,Xt.http,this)&&(a=rn()),this.logImplementation(t,n,e,l,a)}}function iy(e,t){return{view:{referrer:document.referrer,url:window.location.href},context:e.getContext(),user:t.getContext()}}var ry=32*le;function sy(e){e.usePciIntake===!0&&e.site&&e.site!=="datadoghq.com"&&B.warn("PCI compliance for Logs is only available for Datadog organizations in the US1 site. Default intake will be used.");var t=rp(e),n=Wi(e.forwardConsoleLogs,De(K),"Forward Console Logs"),l=Wi(e.forwardReports,De(sn),"Forward Reports");if(!(!t||!n||!l))return e.forwardErrorsToLogs&&!Ee(n,K.error)&&n.push(K.error),P({forwardErrorsToLogs:e.forwardErrorsToLogs!==!1,forwardConsoleLogs:n,forwardReports:l,requestErrorResponseLengthLimit:ry,sendLogsAfterSessionExpiration:!!e.sendLogsAfterSessionExpiration},t)}function Wi(e,t,n){if(e===void 0)return[];if(!(e==="all"||Array.isArray(e)&&e.every(function(l){return Ee(t,l)}))){B.error("".concat(n,' should be "all" or an array with allowed values "').concat(t.join('", "'),'"'));return}return e==="all"?t:Ep(e)}function oy(e){var t=sp(e);return P({forward_errors_to_logs:e.forwardErrorsToLogs,forward_console_logs:e.forwardConsoleLogs,forward_reports:e.forwardReports,use_pci_intake:e.usePciIntake,send_logs_after_session_expiration:e.sendLogsAfterSessionExpiration},t)}function dy(e,t,n){var l=ei(),a,c,i=t.observable.subscribe(r);function r(){if(!(!c||!a||!t.isGranted())){i.unsubscribe();var d=n(a,c);l.drain(d)}}return{init:function(d){if(!d){B.error("Missing configuration");return}if(op(d.enableExperimentalFeatures),un()&&(d=uy(d)),a=d,c){jc("DD_LOGS",d);return}var s=sy(d);s&&(c=s,bi().subscribe(he),t.tryToInit(s.trackingConsent),r())},get initConfiguration(){return a},getInternalContext:he,handleLog:function(d,s,o,u,Z){u===void 0&&(u=e()),Z===void 0&&(Z=ue()),l.add(function(m){return m.handleLog(d,s,o,u,Z)})}}}function uy(e){return P({},e,{clientToken:"empty"})}var Ri="logs";function my(e){var t=OG(),n=Cl(t.getOrCreateTracker(2)),l=Cl(t.getOrCreateTracker(1)),a=B0();function c(){return iy(n,l)}var i=dy(c,a,function(s,o){s.storeContextsAcrossPages&&(pi(o,n,Ri,2),pi(o,l,Ri,1));var u=e(s,o,c,a);return i=Zy(s,u),u}),r={},d=new q(function(){for(var s=[],o=0;o<arguments.length;o++)s[o]=arguments[o];return i.handleLog.apply(i,s)},t.createDetachedTracker());return kp({logger:d,init:z(function(s){return i.init(s)}),setTrackingConsent:z(function(s){a.update(s),tG({feature:"set-tracking-consent",tracking_consent:s})}),getGlobalContext:z(function(){return n.getContext()}),setGlobalContext:z(function(s){return n.setContext(s)}),setGlobalContextProperty:z(function(s,o){return n.setContextProperty(s,o)}),removeGlobalContextProperty:z(function(s){return n.removeContextProperty(s)}),clearGlobalContext:z(function(){return n.clearContext()}),createLogger:z(function(s,o){return o===void 0&&(o={}),r[s]=new q(function(){for(var u=[],Z=0;Z<arguments.length;Z++)u[Z]=arguments[Z];return i.handleLog.apply(i,u)},t.createDetachedTracker(),ce(s),o.handler,o.level,ce(o.context)),r[s]}),getLogger:z(function(s){return r[s]}),getInitConfiguration:z(function(){return $c(i.initConfiguration)}),getInternalContext:z(function(s){return i.getInternalContext(s)}),setUser:z(function(s){ly(s)&&l.setContext(Xi(s))}),getUser:z(function(){return l.getContext()}),setUserProperty:z(function(s,o){var u,Z=Xi((u={},u[s]=o,u))[s];l.setContextProperty(s,Z)}),removeUserProperty:z(function(s){return l.removeContextProperty(s)}),clearUser:z(function(){return l.clearContext()})})}function Zy(e,t){return P({init:function(n){jc("DD_LOGS",n)},initConfiguration:e},t)}var hy="logs";function by(e,t){var n=sG(e,hy,function(l){return Gy(e,l)},t);return{findTrackedSession:function(l,a){a===void 0&&(a={returnInactive:!1});var c=n.findSession(l,a);return c&&c.trackingType==="1"?{id:c.id}:void 0},expireObservable:n.expireObservable}}function py(e){var t=fi(e)==="1",n=t?{}:void 0;return{findTrackedSession:function(){return n},expireObservable:new Q}}function fi(e){return jt(e.sessionSampleRate)?"1":"0"}function Gy(e,t){var n=yy(t)?t:fi(e);return{trackingType:n,isTracked:n==="1"}}function yy(e){return e==="0"||e==="1"}var Li=!1;function pn(e){var t=window;if(yi()){var n=l(t.DD_RUM_SYNTHETICS);return!n&&!Li&&(Li=!0,ni("Logs sent before RUM is injected by the synthetics worker",{testId:ty(),resultId:ny()})),n}return l(t.DD_RUM);function l(a){if(a&&a.getInternalContext)return a.getInternalContext(e)}}function Xy(e,t,n,l,a){var c=cy.concat(["custom"]),i={};c.forEach(function(r){i[r]=xG(r,t.eventRateLimiterThreshold,a)}),n.subscribe(0,function(r){var d,s,o=r.rawLogsEvent,u=r.messageContext,Z=u===void 0?void 0:u,m=r.savedCommonContext,p=m===void 0?void 0:m,h=r.domainContext,R=t0(o.date),y=e.findTrackedSession(R);if(!(!y&&(!t.sendLogsAfterSessionExpiration||!e.findTrackedSession(R,{returnInactive:!0})))){var V=p||l(),L=$e({service:t.service,session_id:y?y.id:void 0,usr:cl(V.user)?void 0:V.user,view:V.view},V.context,pn(R),o,Z);((d=t.beforeSend)===null||d===void 0?void 0:d.call(t,L,h))===!1||L.origin!==j.AGENT&&((s=i[L.status])!==null&&s!==void 0?s:i.custom).isLimitReached()||n.notify(1,L)}})}var xe,Vy=(xe={},xe[K.log]=x.info,xe[K.debug]=x.debug,xe[K.info]=x.info,xe[K.warn]=x.warn,xe[K.error]=x.error,xe);function Wy(e,t){var n=TG(e.forwardConsoleLogs).subscribe(function(l){var a={rawLogsEvent:{date:ue(),message:l.message,origin:j.CONSOLE,error:l.error&&bn(l.error),status:Vy[l.api]},domainContext:{handlingStack:l.handlingStack}};t.notify(0,a)});return{stop:function(){n.unsubscribe()}}}function Ry(e,t){var n=Tp(e,e.forwardReports).subscribe(function(l){var a=l.message,c,i=l.originalError.type==="deprecation"?x.warn:x.error;i===x.error?c=bn(l):l.stack&&(a+=" Found in ".concat(zp(l.stack))),t.notify(0,{rawLogsEvent:{date:ue(),message:a,origin:j.REPORT,error:c,status:i}})});return{stop:function(){n.unsubscribe()}}}function fy(e,t){if(!e.forwardErrorsToLogs)return{stop:he};var n=SG(e).subscribe(function(c){c.state==="complete"&&a("xhr",c)}),l=bi().subscribe(function(c){c.state==="resolve"&&a("fetch",c)});function a(c,i){!e.isIntakeUrl(i.url)&&(gy(i)||ai(i.status))&&("xhr"in i?Ly(i.xhr,e,r):i.response?vy(i.response,e,r):i.error&&Yy(i.error,e,r));function r(d){var s={isAborted:i.isAborted,handlingStack:i.handlingStack};t.notify(0,{rawLogsEvent:{message:"".concat(Fy(c)," error ").concat(i.method," ").concat(i.url),date:i.startClocks.timeStamp,error:{stack:d||"Failed to load",handling:void 0},http:{method:i.method,status_code:i.status,url:i.url},status:x.error,origin:j.NETWORK},domainContext:s})}}return{stop:function(){n.unsubscribe(),l.unsubscribe()}}}function Ly(e,t,n){typeof e.response=="string"?n(xl(e.response,t)):n(e.response)}function Yy(e,t,n){n(xl(ve(ae(e)),t))}function vy(e,t,n){var l=mG(e);!l||!l.body?n():window.TextDecoder?Cy(l.body,t.requestErrorResponseLengthLimit,function(a,c){n(a?"Unable to retrieve response: ".concat(a):c)}):l.text().then(z(function(a){return n(xl(a,t))}),z(function(a){return n("Unable to retrieve response: ".concat(a))}))}function gy(e){return e.status===0&&e.responseType!=="opaque"}function xl(e,t){return e.length>t.requestErrorResponseLengthLimit?"".concat(e.substring(0,t.requestErrorResponseLengthLimit),"..."):e}function Fy(e){return e==="xhr"?"XHR":"Fetch"}function Cy(e,t,n){_G(e,function(l,a,c){if(l)n(l);else{var i=new TextDecoder().decode(a);c&&(i+="..."),n(void 0,i)}},{bytesLimit:t,collectStreamBody:!0})}function xy(e,t){if(!e.forwardErrorsToLogs)return{stop:he};var n=new Q,l=Mp(n).stop,a=n.subscribe(function(c){t.notify(0,{rawLogsEvent:{message:c.message,date:c.startClocks.timeStamp,error:bn(c),origin:j.SOURCE,status:x.error}})});return{stop:function(){l(),a.unsubscribe()}}}var Sy=CG,ee;function Iy(e){function t(n,l,a,c,i){var r=$e(l.getContext(),n.context);if(hn(n.status,Xt.console,l)&&My(n,r),hn(n.status,Xt.http,l)){var d={rawLogsEvent:{date:i||ue(),message:n.message,status:n.status,origin:j.LOGGER},messageContext:r,savedCommonContext:c};a&&(d.domainContext={handlingStack:a}),e.notify(0,d)}}return{handleLog:t}}var zy=(ee={},ee[x.ok]=K.debug,ee[x.debug]=K.debug,ee[x.info]=K.info,ee[x.notice]=K.info,ee[x.warn]=K.warn,ee[x.error]=K.error,ee[x.critical]=K.error,ee[x.alert]=K.error,ee[x.emerg]=K.error,ee);function My(e,t){var n=e.status,l=e.message;ye[zy[n]].call(ne,l,t)}function Jy(e,t,n,l,a){var c=hi(e,{endpoint:e.logsEndpointBuilder,encoder:Zn()},e.replica&&{endpoint:e.replica.logsEndpointBuilder,encoder:Zn()},n,l,a.expireObservable);return t.subscribe(1,function(i){c.add(i)}),c}function Ny(e){var t=Ll();e.subscribe(1,function(n){t.send("log",n)})}function ky(e){return{get:function(t){var n=e.findTrackedSession(t);if(n)return{session_id:n.id}}}}function Ky(e){return function(t){e.notify(0,{rawLogsEvent:{message:t.message,date:t.startClocks.timeStamp,origin:j.AGENT,status:x.error}}),ni("Error reported to customer",{"error.message":t.message})}}function Ty(e,t,n,l,a){var c=Ap("browser-logs-sdk",t);c.setContextProvider(function(){var u,Z,m,p,h,R;return{application:{id:(u=pn())===null||u===void 0?void 0:u.application_id},session:{id:(Z=a.findTrackedSession())===null||Z===void 0?void 0:Z.id},view:{id:(p=(m=pn())===null||m===void 0?void 0:m.view)===null||p===void 0?void 0:p.id},action:{id:(R=(h=pn())===null||h===void 0?void 0:h.user_action)===null||R===void 0?void 0:R.id}}});var i=[];if(un()){var r=Ll(),d=c.observable.subscribe(function(u){return r.send("internal_telemetry",u)});i.push(function(){return d.unsubscribe()})}else{var s=hi(t,{endpoint:t.rumEndpointBuilder,encoder:Zn()},t.replica&&{endpoint:t.replica.rumEndpointBuilder,encoder:Zn()},n,l,a.expireObservable);i.push(function(){return s.stop()});var o=c.observable.subscribe(function(u){return s.add(u,qp(t))});i.push(function(){return o.unsubscribe()})}return $p(),eG(oy(e)),{telemetry:c,stop:function(){i.forEach(function(u){return u()})}}}function Hy(e,t,n,l){var a=new Sy,c=[];a.subscribe(1,function(m){return _c("logs",m)});var i=Ky(a),r=YG(t),d=t.sessionStoreStrategyType&&!un()&&!yi()?by(t,l):py(t),s=Ty(e,t,i,r,d).stop;c.push(function(){return s()}),fy(t,a),xy(t,a),Wy(t,a),Ry(t,a);var o=Iy(a).handleLog;if(Xy(d,t,a,n,i),un())Ny(a);else{var u=Jy(t,a,i,r,d).stop;c.push(function(){return u()})}var Z=ky(d);return{handleLog:o,getInternalContext:Z.get,stop:function(){c.forEach(function(m){return m()})}}}var Gn=my(Hy);Kp(Ze(),"DD_LOGS",Gn);const Uy="1.0.44";Gn.init({clientToken:"pub4844895ac30067ac2c4aaa025dbc39d7",site:"us3.datadoghq.com",forwardErrorsToLogs:!0,sessionSampleRate:100});class Yi{constructor(t,n,l){g(this,"mediaID",null);console.log(`OTTPlayer: version: ${Uy}`),this.video=t,this.srcFrameRate=n,console.log("optionsFromMK: ",l),this.options=jb({enabled:!0,stopAugment:!1,stopAugmentFor:-1,gameId:"Unknown",medialook:!1,allGamesURL:"https://www.virtualott.com/games/",cloudFrontURL:"https://db8igqxlbvayn.cloudfront.net/prod",mediaIdJsonURL:"https://games-prod.virtualott.com/map",offsetJsonURL:"https://games-prod.virtualott.com/offset",renderingMode:Me.Augment,SynchMethod:ro.None,debug:!1,hls_fps:6e4/1001,augmentation:{renderTimecode:!0,offset:0},syncPoint:{frame:0,playerTime:0,mediaTimeMS:0}},l||{}),console.log("options after merge with MK's options: ",JSON.parse(JSON.stringify(this.options))),console.BBlog=function(a){console.log("OTTPlayer: "+a),Gn.logger.info("Web Unsorted msg: "+a,{name:"test"})},console.BBerror=function(...a){console.log("OTTPlayer: ",...a),Gn.logger.error("Web Unsorted error: "+a.join(", "),{name:"test"})},this.getGlobalConfig()}init(){typeof window.globalConfig>"u"?this.options=Object.assign(this.options,{}):this.options=Object.assign(this.options,JSON.parse(JSON.stringify(window.globalConfig)));var t={};if(t.value1=this.options.hls_fps,this.setFps(t),console.log("options after merge with the global options: ",JSON.parse(JSON.stringify(this.options))),!this.options.debug){let n=["debugText","forplus","forDoNotRender","debugText2","toggleBtn","numberInput","plus05CorrectionCheckbox","doNotRenderAugmentationCheckbox","plus05CorrectionLabel","doNotRenderAugmentationLabel","br1","br2","qualityButton","qualitySelect"];for(let l=0;l<n.length;l++){const a=document.getElementById(n[l]);a&&(a.style.display="none")}}this.fetchAndFindGameIdAndOffsetFromMediaId(this.options.gameId)}weHaveTheGameID(){this.frameDrawer=new io(this.video,this.options),this.options.renderingMode==Me.Augment&&this.frameDrawer.initializeComponents()}async getGlobalConfig(){const n=new URL(document.location).searchParams.get("config")||"";if(n!=="")try{const l=await fetch(n);if(!l.ok)throw new Error("Network response was not ok");const a=await l.json();typeof window.globalConfig>"u"&&(window.globalConfig={}),globalConfig=Object.assign({},a,window.globalConfig),console.log("final global config:",window.globalConfig)}catch(l){console.BBerror("Error fetching JSON:",l)}this.init()}async fetchAndFindGameIdAndOffsetFromMediaId(t){if(t="bbtest45",this.options.mediaIdJsonURL=="test"){this.weHaveTheGameID();return}try{const n=await fetch(this.options.mediaIdJsonURL+"/"+t);if(!n.ok)throw new Error(`HTTP error! Status: ${n.status}`);const l=await n.json();if(l.hasOwnProperty("GAME_ID")){console.log({jsonData:l});const a=l.GAME_ID;console.log(`GameId for mediaid= ${t}: ${a}`),this.options.gameId=a,this.weHaveTheGameID(),this.fetchOffsetForGameIdMediaID(this.options.gameId,t)}else console.BBerror(`MediaID ${t} not found in JSON.`),this.options.stopAugment=!0}catch(n){console.BBerror("Error fetching and processing GameId JSON:"+n)}}async fetchOffsetForGameIdMediaID(t,n){if(this.options.offsetJsonURL=="test")return 0;try{const l=await fetch(this.options.offsetJsonURL+"/"+t);l.ok||(console.log(`HTTP error! Status: ${l.status}`),setTimeout(()=>{this.fetchOffsetForGameIdMediaID(t,n)},5e3));const a=await l.json();if(a.hasOwnProperty("offset")&&a.hasOwnProperty("found")){const c=a.offset;a.found==!0&&(console.log(`Offset for gameid= ${t}: ${c}`),this.options.augmentation.offset=c,setTimeout(()=>{this.fetchOffsetForGameIdMediaID(t,n)},6e4))}else console.log(`offset for ${t} not found in JSON.`),setTimeout(()=>{this.fetchOffsetForGameIdMediaID(t,n)},5e3)}catch(l){console.BBerror("Error fetching and processing offset:",l),setTimeout(()=>{this.fetchOffsetForGameIdMediaID(t,n)},5e3)}}toggle(t){this.options.enabled=t}getCanvas(){return this.frameDrawer.getCanvas()}setFps(t){var n=t.value1;switch(n){case 59.94:case 6e4/1001:this.options.hls_fps=6e4/1001;break;case 29.97:case 3e4/1001:this.options.hls_fps=3e4/1001;break;default:console.error("Unsupported hls-src frame-rate: "+n+"fps"),this.options.hls_fps=n;break}}setSyncPoint(t){this.options.syncPoint=t}onNewSegment(t){this.frameDrawer.onNewSegmentForMetadata(t)}onNewMetadata(t){this.frameDrawer.onNewMetadata(t)}}return window.BB={MAX_LOGOS:4,RENDER_IN_WORKER:!0,OTTPlayer:Yi},Yi});
272
+ `.concat(m)),t.finish(function(V){h(Zi(V))})}return{flushController:l,add:o,upsert:o,stop:i.unsubscribe}}function Zi(e){var t;return typeof e.output=="string"?t=e.output:t=new Blob([e.output],{type:"text/plain"}),{data:t,bytesCount:e.outputBytesCount,encoding:e.encoding}}function FG(e){var t=e.messagesLimit,n=e.bytesLimit,l=e.durationLimit,a=e.pageExitObservable,c=e.sessionExpireObservable,i=a.subscribe(function(h){return u(h.reason)}),r=c.subscribe(function(){return u("session_expire")}),d=new Q(function(){return function(){i.unsubscribe(),r.unsubscribe()}}),s=0,o=0;function u(h){if(o!==0){var R=o,y=s;o=0,s=0,p(),d.notify({reason:h,messagesCount:R,bytesCount:y})}}var Z;function m(){Z===void 0&&(Z=bt(function(){u("duration_limit")},l))}function p(){Yc(Z),Z=void 0}return{flushObservable:d,get messagesCount(){return o},notifyBeforeAddMessage:function(h){s+h>=n&&u("bytes_limit"),o+=1,s+=h,m()},notifyAfterAddMessage:function(h){h===void 0&&(h=0),s+=h,o>=t?u("messages_limit"):s>=n&&u("bytes_limit")},notifyAfterRemoveMessage:function(h){s-=h,o-=1,o===0&&p()}}}function hi(e,t,n,l,a,c,i){i===void 0&&(i=gG);var r=s(e,t),d=n&&s(e,n);function s(o,u){var Z=u.endpoint,m=u.encoder;return i({encoder:m,request:XG(o,Z,o.batchBytesLimit,l),flushController:FG({messagesLimit:o.batchMessagesLimit,bytesLimit:o.batchBytesLimit,durationLimit:o.flushTimeout,pageExitObservable:a,sessionExpireObservable:c}),messageBytesLimit:o.messageBytesLimit})}return{flushObservable:r.flushController.flushObservable,add:function(o,u){u===void 0&&(u=!0),r.add(o),d&&u&&d.add(n.transformMessage?n.transformMessage(o):o)},upsert:function(o,u){r.upsert(o,u),d&&d.upsert(n.transformMessage?n.transformMessage(o):o,u)},stop:function(){r.stop(),d&&d.stop()}}}function Zn(){var e="",t=0;return{isAsync:!1,get isEmpty(){return!e},write:function(n,l){var a=nl(n);t+=a,e+=n,l&&l(a)},finish:function(n){n(this.finishSync())},finishSync:function(){var n={output:e,outputBytesCount:t,rawBytesCount:t,pendingData:""};return e="",t=0,n},estimateEncodedBytesCount:function(n){return n.length}}}var CG=function(){function e(){this.callbacks={}}return e.prototype.notify=function(t,n){var l=this.callbacks[t];l&&l.forEach(function(a){return a(n)})},e.prototype.subscribe=function(t,n){var l=this;return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(n),{unsubscribe:function(){l.callbacks[t]=l.callbacks[t].filter(function(a){return n!==a})}}},e}();function xG(e,t,n){var l=0,a=!1;return{isLimitReached:function(){if(l===0&&bt(function(){l=0},Xe),l+=1,l<=t||a)return a=!1,!1;if(l===t+1){a=!0;try{n({message:"Reached max number of ".concat(e,"s by minute: ").concat(t),source:j.AGENT,startClocks:me()})}finally{a=!1}}return!0}}}var Yl,vl=new WeakMap;function SG(e){return Yl||(Yl=IG(e)),Yl}function IG(e){return new Q(function(t){var n=ge(XMLHttpRequest.prototype,"open",zG).stop,l=ge(XMLHttpRequest.prototype,"send",function(c){MG(c,e,t)},{computeHandlingStack:!0}).stop,a=ge(XMLHttpRequest.prototype,"abort",JG).stop;return function(){n(),l(),a()}})}function zG(e){var t=e.target,n=e.parameters,l=n[0],a=n[1];vl.set(t,{state:"open",method:String(l).toUpperCase(),url:bl(String(a))})}function MG(e,t,n){var l=e.target,a=e.handlingStack,c=vl.get(l);if(c){var i=c;i.state="start",i.startClocks=me(),i.isAborted=!1,i.xhr=l,i.handlingStack=a;var r=!1,d=ge(l,"onreadystatechange",function(){l.readyState===XMLHttpRequest.DONE&&s()}).stop,s=function(){if(o(),d(),!r){r=!0;var u=c;u.state="complete",u.duration=qb(i.startClocks.timeStamp,ue()),u.status=l.status,n.notify(i0(u))}},o=Fe(t,l,"loadend",s).stop;n.notify(i)}}function JG(e){var t=e.target,n=vl.get(t);n&&(n.isAborted=!0)}var gl;function bi(){return gl||(gl=NG()),gl}function NG(){return new Q(function(e){if(window.fetch){var t=ge(window,"fetch",function(n){return kG(n,e)},{computeHandlingStack:!0}).stop;return t}})}function kG(e,t){var n=e.parameters,l=e.onPostCall,a=e.handlingStack,c=n[0],i=n[1],r=i&&i.method;r===void 0&&c instanceof Request&&(r=c.method);var d=r!==void 0?String(r).toUpperCase():"GET",s=c instanceof Request?c.url:bl(String(c)),o=me(),u={state:"start",init:i,input:c,method:d,startClocks:o,url:s,handlingStack:a};t.notify(u),n[0]=u.input,n[1]=u.init,l(function(Z){return KG(t,Z,u)})}function KG(e,t,n){var l=n;function a(c){l.state="resolve",P(l,c),e.notify(l)}t.then(z(function(c){a({response:c,responseType:c.type,status:c.status,isAborted:!1})}),z(function(c){var i,r;a({status:0,isAborted:((r=(i=l.init)===null||i===void 0?void 0:i.signal)===null||r===void 0?void 0:r.aborted)||c instanceof DOMException&&c.code===DOMException.ABORT_ERR,error:c})}))}var Fl={};function TG(e){var t=e.map(function(n){return Fl[n]||(Fl[n]=HG(n)),Fl[n]});return gc.apply(void 0,t)}function HG(e){return new Q(function(t){var n=ne[e];return ne[e]=function(){for(var l=[],a=0;a<arguments.length;a++)l[a]=arguments[a];n.apply(console,l);var c=rn();ht(function(){t.notify(UG(l,e,c))})},function(){ne[e]=n}})}function UG(e,t,n){var l=e.map(function(i){return wG(i)}).join(" "),a;if(t===K.error){var c=l0(e,function(i){return i instanceof Error});a={stack:c?ve(ae(c)):void 0,fingerprint:Ec(c),causes:c?Dc(c,"console"):void 0,startClocks:me(),message:l,source:j.CONSOLE,handling:"handled",handlingStack:n}}return{api:t,message:l,error:a,handlingStack:n}}function wG(e){return typeof e=="string"?ce(e):e instanceof Error?Bc(ae(e)):Le(ce(e),void 0,2)}function Cl(e){var t={},n=new Q,l={getContext:function(){return $c(t)},setContext:function(a){Rl(a)==="object"?(t=ce(a),e&&e.updateCustomerData(t)):l.clearContext(),n.notify()},setContextProperty:function(a,c){t[a]=ce(c),e&&e.updateCustomerData(t),n.notify()},removeContextProperty:function(a){delete t[a],e&&e.updateCustomerData(t),n.notify()},clearContext:function(){t={},e&&e.resetCustomerData(),n.notify()},changeObservable:n};return l}var BG="_dd_c",QG=[];function pi(e,t,n,l){var a=PG(n,l);QG.push(Fe(e,window,"storage",function(d){var s=d.key;a===s&&c()})),t.changeObservable.subscribe(i),t.setContext($e(r(),t.getContext()));function c(){t.setContext(r())}function i(){localStorage.setItem(a,JSON.stringify(t.getContext()))}function r(){var d=localStorage.getItem(a);return d!==null?JSON.parse(d):{}}}function PG(e,t){return"".concat(BG,"_").concat(e,"_").concat(t)}var EG=3*le,DG=16*le,jG=200;function OG(e){e===void 0&&(e=2);var t=new Map,n=!1;function l(a){if(a===void 0&&(a=0),!(n||e===0)){var c=e===2?EG:DG,i=a;t.forEach(function(r){i+=r.getBytesCount()}),i>c&&(AG(c),n=!0)}}return{createDetachedTracker:function(){var a=Gi(function(){return l(a.getBytesCount())});return a},getOrCreateTracker:function(a){return t.has(a)||t.set(a,Gi(l)),t.get(a)},setCompressionStatus:function(a){e===0&&(e=a,l())},getCompressionStatus:function(){return e},stop:function(){t.forEach(function(a){return a.stop()}),t.clear()}}}function Gi(e){var t=0,n=Fc(function(i){t=nl(Le(i)),e()},jG),l=n.throttled,a=n.cancel,c=function(){a(),t=0};return{updateCustomerData:function(i){cl(i)?c():l(i)},resetCustomerData:c,getBytesCount:function(){return t},stop:function(){a()}}}function AG(e){B.warn("Customer data exceeds the recommended ".concat(e/le,"KiB threshold. ").concat(Dt," ").concat(Xc,"/#customer-data-exceeds-the-recommended-threshold-warning"))}function _G(e,t,n){var l=e.getReader(),a=[],c=0;i();function i(){l.read().then(z(function(d){if(d.done){r();return}a.push(d.value),c+=d.value.length,c>n.bytesLimit?r():i()}),z(function(d){return t(d)}))}function r(){l.cancel().catch(he);var d,s;{var o;if(a.length===1)o=a[0];else{o=new Uint8Array(c);var u=0;a.forEach(function(Z){o.set(Z,u),u+=Z.length})}d=o.slice(0,n.bytesLimit),s=o.length>n.bytesLimit}t(void 0,d,s)}}var $G="datadog-synthetics-public-id",qG="datadog-synthetics-result-id",ey="datadog-synthetics-injects-rum";function yi(){return!!(window._DATADOG_SYNTHETICS_INJECTS_RUM||We(ey))}function ty(){var e=window._DATADOG_SYNTHETICS_PUBLIC_ID||We($G);return typeof e=="string"?e:void 0}function ny(){var e=window._DATADOG_SYNTHETICS_RESULT_ID||We(qG);return typeof e=="string"?e:void 0}function Xi(e){var t=P({},e),n=["id","name","email"];return n.forEach(function(l){l in t&&(t[l]=String(t[l]))}),t}function ly(e){var t=Rl(e)==="object";return t||B.error("Unsupported user:",e),t}var $;function hn(e,t,n){var l=n.getHandler(),a=Array.isArray(l)?l:[l];return Vi[e]>=Vi[n.getLevel()]&&Ee(a,t)}var x={ok:"ok",debug:"debug",info:"info",notice:"notice",warn:"warn",error:"error",critical:"critical",alert:"alert",emerg:"emerg"},Vi=($={},$[x.ok]=0,$[x.debug]=1,$[x.info]=2,$[x.notice]=4,$[x.warn]=5,$[x.error]=6,$[x.critical]=7,$[x.alert]=8,$[x.emerg]=9,$);function bn(e,t){var n=t===void 0?{}:t,l=n.includeMessage,a=l===void 0?!1:l;return{stack:e.stack,kind:e.type,message:a?e.message:void 0,causes:e.causes,fingerprint:e.fingerprint,handling:e.handling}}var ay=function(e,t,n,l){var a=arguments.length,c=a<3?t:l===null?l=Object.getOwnPropertyDescriptor(t,n):l,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(e,t,n,l);else for(var r=e.length-1;r>=0;r--)(i=e[r])&&(c=(a<3?i(c):a>3?i(t,n,c):i(t,n))||c);return a>3&&c&&Object.defineProperty(t,n,c),c},Xt={console:"console",http:"http",silent:"silent"},cy=Object.keys(x),q=function(){function e(t,n,l,a,c,i){a===void 0&&(a=Xt.http),c===void 0&&(c=x.debug),i===void 0&&(i={}),this.handleLogStrategy=t,this.handlerType=a,this.level=c,this.contextManager=Cl(n),this.contextManager.setContext(i),l&&this.contextManager.setContextProperty("logger",{name:l})}return e.prototype.logImplementation=function(t,n,l,a,c){l===void 0&&(l=x.info);var i=ce(n),r;if(a!=null){var d=Pc({stackTrace:a instanceof Error?ae(a):void 0,originalError:a,nonErrorPrefix:"Provided",source:j.LOGGER,handling:"handled",startClocks:me()});r=$e({error:bn(d,{includeMessage:!0})},i)}else r=i;this.handleLogStrategy({message:ce(t),context:r,status:l},this,c)},e.prototype.log=function(t,n,l,a){l===void 0&&(l=x.info);var c;hn(l,Xt.http,this)&&(c=rn()),this.logImplementation(t,n,l,a,c)},e.prototype.setContext=function(t){this.contextManager.setContext(t)},e.prototype.getContext=function(){return this.contextManager.getContext()},e.prototype.setContextProperty=function(t,n){this.contextManager.setContextProperty(t,n)},e.prototype.removeContextProperty=function(t){this.contextManager.removeContextProperty(t)},e.prototype.clearContext=function(){this.contextManager.clearContext()},e.prototype.setHandler=function(t){this.handlerType=t},e.prototype.getHandler=function(){return this.handlerType},e.prototype.setLevel=function(t){this.level=t},e.prototype.getLevel=function(){return this.level},ay([d0],e.prototype,"logImplementation",null),e}();q.prototype.ok=ie(x.ok),q.prototype.debug=ie(x.debug),q.prototype.info=ie(x.info),q.prototype.notice=ie(x.notice),q.prototype.warn=ie(x.warn),q.prototype.error=ie(x.error),q.prototype.critical=ie(x.critical),q.prototype.alert=ie(x.alert),q.prototype.emerg=ie(x.emerg);function ie(e){return function(t,n,l){var a;hn(e,Xt.http,this)&&(a=rn()),this.logImplementation(t,n,e,l,a)}}function iy(e,t){return{view:{referrer:document.referrer,url:window.location.href},context:e.getContext(),user:t.getContext()}}var ry=32*le;function sy(e){e.usePciIntake===!0&&e.site&&e.site!=="datadoghq.com"&&B.warn("PCI compliance for Logs is only available for Datadog organizations in the US1 site. Default intake will be used.");var t=rp(e),n=Wi(e.forwardConsoleLogs,De(K),"Forward Console Logs"),l=Wi(e.forwardReports,De(sn),"Forward Reports");if(!(!t||!n||!l))return e.forwardErrorsToLogs&&!Ee(n,K.error)&&n.push(K.error),P({forwardErrorsToLogs:e.forwardErrorsToLogs!==!1,forwardConsoleLogs:n,forwardReports:l,requestErrorResponseLengthLimit:ry,sendLogsAfterSessionExpiration:!!e.sendLogsAfterSessionExpiration},t)}function Wi(e,t,n){if(e===void 0)return[];if(!(e==="all"||Array.isArray(e)&&e.every(function(l){return Ee(t,l)}))){B.error("".concat(n,' should be "all" or an array with allowed values "').concat(t.join('", "'),'"'));return}return e==="all"?t:Ep(e)}function oy(e){var t=sp(e);return P({forward_errors_to_logs:e.forwardErrorsToLogs,forward_console_logs:e.forwardConsoleLogs,forward_reports:e.forwardReports,use_pci_intake:e.usePciIntake,send_logs_after_session_expiration:e.sendLogsAfterSessionExpiration},t)}function dy(e,t,n){var l=ei(),a,c,i=t.observable.subscribe(r);function r(){if(!(!c||!a||!t.isGranted())){i.unsubscribe();var d=n(a,c);l.drain(d)}}return{init:function(d){if(!d){B.error("Missing configuration");return}if(op(d.enableExperimentalFeatures),un()&&(d=uy(d)),a=d,c){jc("DD_LOGS",d);return}var s=sy(d);s&&(c=s,bi().subscribe(he),t.tryToInit(s.trackingConsent),r())},get initConfiguration(){return a},getInternalContext:he,handleLog:function(d,s,o,u,Z){u===void 0&&(u=e()),Z===void 0&&(Z=ue()),l.add(function(m){return m.handleLog(d,s,o,u,Z)})}}}function uy(e){return P({},e,{clientToken:"empty"})}var Ri="logs";function my(e){var t=OG(),n=Cl(t.getOrCreateTracker(2)),l=Cl(t.getOrCreateTracker(1)),a=B0();function c(){return iy(n,l)}var i=dy(c,a,function(s,o){s.storeContextsAcrossPages&&(pi(o,n,Ri,2),pi(o,l,Ri,1));var u=e(s,o,c,a);return i=Zy(s,u),u}),r={},d=new q(function(){for(var s=[],o=0;o<arguments.length;o++)s[o]=arguments[o];return i.handleLog.apply(i,s)},t.createDetachedTracker());return kp({logger:d,init:z(function(s){return i.init(s)}),setTrackingConsent:z(function(s){a.update(s),tG({feature:"set-tracking-consent",tracking_consent:s})}),getGlobalContext:z(function(){return n.getContext()}),setGlobalContext:z(function(s){return n.setContext(s)}),setGlobalContextProperty:z(function(s,o){return n.setContextProperty(s,o)}),removeGlobalContextProperty:z(function(s){return n.removeContextProperty(s)}),clearGlobalContext:z(function(){return n.clearContext()}),createLogger:z(function(s,o){return o===void 0&&(o={}),r[s]=new q(function(){for(var u=[],Z=0;Z<arguments.length;Z++)u[Z]=arguments[Z];return i.handleLog.apply(i,u)},t.createDetachedTracker(),ce(s),o.handler,o.level,ce(o.context)),r[s]}),getLogger:z(function(s){return r[s]}),getInitConfiguration:z(function(){return $c(i.initConfiguration)}),getInternalContext:z(function(s){return i.getInternalContext(s)}),setUser:z(function(s){ly(s)&&l.setContext(Xi(s))}),getUser:z(function(){return l.getContext()}),setUserProperty:z(function(s,o){var u,Z=Xi((u={},u[s]=o,u))[s];l.setContextProperty(s,Z)}),removeUserProperty:z(function(s){return l.removeContextProperty(s)}),clearUser:z(function(){return l.clearContext()})})}function Zy(e,t){return P({init:function(n){jc("DD_LOGS",n)},initConfiguration:e},t)}var hy="logs";function by(e,t){var n=sG(e,hy,function(l){return Gy(e,l)},t);return{findTrackedSession:function(l,a){a===void 0&&(a={returnInactive:!1});var c=n.findSession(l,a);return c&&c.trackingType==="1"?{id:c.id}:void 0},expireObservable:n.expireObservable}}function py(e){var t=fi(e)==="1",n=t?{}:void 0;return{findTrackedSession:function(){return n},expireObservable:new Q}}function fi(e){return jt(e.sessionSampleRate)?"1":"0"}function Gy(e,t){var n=yy(t)?t:fi(e);return{trackingType:n,isTracked:n==="1"}}function yy(e){return e==="0"||e==="1"}var Li=!1;function pn(e){var t=window;if(yi()){var n=l(t.DD_RUM_SYNTHETICS);return!n&&!Li&&(Li=!0,ni("Logs sent before RUM is injected by the synthetics worker",{testId:ty(),resultId:ny()})),n}return l(t.DD_RUM);function l(a){if(a&&a.getInternalContext)return a.getInternalContext(e)}}function Xy(e,t,n,l,a){var c=cy.concat(["custom"]),i={};c.forEach(function(r){i[r]=xG(r,t.eventRateLimiterThreshold,a)}),n.subscribe(0,function(r){var d,s,o=r.rawLogsEvent,u=r.messageContext,Z=u===void 0?void 0:u,m=r.savedCommonContext,p=m===void 0?void 0:m,h=r.domainContext,R=t0(o.date),y=e.findTrackedSession(R);if(!(!y&&(!t.sendLogsAfterSessionExpiration||!e.findTrackedSession(R,{returnInactive:!0})))){var V=p||l(),L=$e({service:t.service,session_id:y?y.id:void 0,usr:cl(V.user)?void 0:V.user,view:V.view},V.context,pn(R),o,Z);((d=t.beforeSend)===null||d===void 0?void 0:d.call(t,L,h))===!1||L.origin!==j.AGENT&&((s=i[L.status])!==null&&s!==void 0?s:i.custom).isLimitReached()||n.notify(1,L)}})}var xe,Vy=(xe={},xe[K.log]=x.info,xe[K.debug]=x.debug,xe[K.info]=x.info,xe[K.warn]=x.warn,xe[K.error]=x.error,xe);function Wy(e,t){var n=TG(e.forwardConsoleLogs).subscribe(function(l){var a={rawLogsEvent:{date:ue(),message:l.message,origin:j.CONSOLE,error:l.error&&bn(l.error),status:Vy[l.api]},domainContext:{handlingStack:l.handlingStack}};t.notify(0,a)});return{stop:function(){n.unsubscribe()}}}function Ry(e,t){var n=Tp(e,e.forwardReports).subscribe(function(l){var a=l.message,c,i=l.originalError.type==="deprecation"?x.warn:x.error;i===x.error?c=bn(l):l.stack&&(a+=" Found in ".concat(zp(l.stack))),t.notify(0,{rawLogsEvent:{date:ue(),message:a,origin:j.REPORT,error:c,status:i}})});return{stop:function(){n.unsubscribe()}}}function fy(e,t){if(!e.forwardErrorsToLogs)return{stop:he};var n=SG(e).subscribe(function(c){c.state==="complete"&&a("xhr",c)}),l=bi().subscribe(function(c){c.state==="resolve"&&a("fetch",c)});function a(c,i){!e.isIntakeUrl(i.url)&&(gy(i)||ai(i.status))&&("xhr"in i?Ly(i.xhr,e,r):i.response?vy(i.response,e,r):i.error&&Yy(i.error,e,r));function r(d){var s={isAborted:i.isAborted,handlingStack:i.handlingStack};t.notify(0,{rawLogsEvent:{message:"".concat(Fy(c)," error ").concat(i.method," ").concat(i.url),date:i.startClocks.timeStamp,error:{stack:d||"Failed to load",handling:void 0},http:{method:i.method,status_code:i.status,url:i.url},status:x.error,origin:j.NETWORK},domainContext:s})}}return{stop:function(){n.unsubscribe(),l.unsubscribe()}}}function Ly(e,t,n){typeof e.response=="string"?n(xl(e.response,t)):n(e.response)}function Yy(e,t,n){n(xl(ve(ae(e)),t))}function vy(e,t,n){var l=mG(e);!l||!l.body?n():window.TextDecoder?Cy(l.body,t.requestErrorResponseLengthLimit,function(a,c){n(a?"Unable to retrieve response: ".concat(a):c)}):l.text().then(z(function(a){return n(xl(a,t))}),z(function(a){return n("Unable to retrieve response: ".concat(a))}))}function gy(e){return e.status===0&&e.responseType!=="opaque"}function xl(e,t){return e.length>t.requestErrorResponseLengthLimit?"".concat(e.substring(0,t.requestErrorResponseLengthLimit),"..."):e}function Fy(e){return e==="xhr"?"XHR":"Fetch"}function Cy(e,t,n){_G(e,function(l,a,c){if(l)n(l);else{var i=new TextDecoder().decode(a);c&&(i+="..."),n(void 0,i)}},{bytesLimit:t,collectStreamBody:!0})}function xy(e,t){if(!e.forwardErrorsToLogs)return{stop:he};var n=new Q,l=Mp(n).stop,a=n.subscribe(function(c){t.notify(0,{rawLogsEvent:{message:c.message,date:c.startClocks.timeStamp,error:bn(c),origin:j.SOURCE,status:x.error}})});return{stop:function(){l(),a.unsubscribe()}}}var Sy=CG,ee;function Iy(e){function t(n,l,a,c,i){var r=$e(l.getContext(),n.context);if(hn(n.status,Xt.console,l)&&My(n,r),hn(n.status,Xt.http,l)){var d={rawLogsEvent:{date:i||ue(),message:n.message,status:n.status,origin:j.LOGGER},messageContext:r,savedCommonContext:c};a&&(d.domainContext={handlingStack:a}),e.notify(0,d)}}return{handleLog:t}}var zy=(ee={},ee[x.ok]=K.debug,ee[x.debug]=K.debug,ee[x.info]=K.info,ee[x.notice]=K.info,ee[x.warn]=K.warn,ee[x.error]=K.error,ee[x.critical]=K.error,ee[x.alert]=K.error,ee[x.emerg]=K.error,ee);function My(e,t){var n=e.status,l=e.message;ye[zy[n]].call(ne,l,t)}function Jy(e,t,n,l,a){var c=hi(e,{endpoint:e.logsEndpointBuilder,encoder:Zn()},e.replica&&{endpoint:e.replica.logsEndpointBuilder,encoder:Zn()},n,l,a.expireObservable);return t.subscribe(1,function(i){c.add(i)}),c}function Ny(e){var t=Ll();e.subscribe(1,function(n){t.send("log",n)})}function ky(e){return{get:function(t){var n=e.findTrackedSession(t);if(n)return{session_id:n.id}}}}function Ky(e){return function(t){e.notify(0,{rawLogsEvent:{message:t.message,date:t.startClocks.timeStamp,origin:j.AGENT,status:x.error}}),ni("Error reported to customer",{"error.message":t.message})}}function Ty(e,t,n,l,a){var c=Ap("browser-logs-sdk",t);c.setContextProvider(function(){var u,Z,m,p,h,R;return{application:{id:(u=pn())===null||u===void 0?void 0:u.application_id},session:{id:(Z=a.findTrackedSession())===null||Z===void 0?void 0:Z.id},view:{id:(p=(m=pn())===null||m===void 0?void 0:m.view)===null||p===void 0?void 0:p.id},action:{id:(R=(h=pn())===null||h===void 0?void 0:h.user_action)===null||R===void 0?void 0:R.id}}});var i=[];if(un()){var r=Ll(),d=c.observable.subscribe(function(u){return r.send("internal_telemetry",u)});i.push(function(){return d.unsubscribe()})}else{var s=hi(t,{endpoint:t.rumEndpointBuilder,encoder:Zn()},t.replica&&{endpoint:t.replica.rumEndpointBuilder,encoder:Zn()},n,l,a.expireObservable);i.push(function(){return s.stop()});var o=c.observable.subscribe(function(u){return s.add(u,qp(t))});i.push(function(){return o.unsubscribe()})}return $p(),eG(oy(e)),{telemetry:c,stop:function(){i.forEach(function(u){return u()})}}}function Hy(e,t,n,l){var a=new Sy,c=[];a.subscribe(1,function(m){return _c("logs",m)});var i=Ky(a),r=YG(t),d=t.sessionStoreStrategyType&&!un()&&!yi()?by(t,l):py(t),s=Ty(e,t,i,r,d).stop;c.push(function(){return s()}),fy(t,a),xy(t,a),Wy(t,a),Ry(t,a);var o=Iy(a).handleLog;if(Xy(d,t,a,n,i),un())Ny(a);else{var u=Jy(t,a,i,r,d).stop;c.push(function(){return u()})}var Z=ky(d);return{handleLog:o,getInternalContext:Z.get,stop:function(){c.forEach(function(m){return m()})}}}var Gn=my(Hy);Kp(Ze(),"DD_LOGS",Gn);const Uy="1.0.45";Gn.init({clientToken:"pub4844895ac30067ac2c4aaa025dbc39d7",site:"us3.datadoghq.com",forwardErrorsToLogs:!0,sessionSampleRate:100});class Yi{constructor(t,n,l){g(this,"mediaID",null);console.log(`OTTPlayer: version: ${Uy}`),this.video=t,this.srcFrameRate=n,console.log("optionsFromMK: ",l),this.options=jb({enabled:!0,stopAugment:!1,stopAugmentFor:-1,gameId:"Unknown",medialook:!1,allGamesURL:"https://www.virtualott.com/games/",cloudFrontURL:"https://db8igqxlbvayn.cloudfront.net/prod",mediaIdJsonURL:"https://games-prod.virtualott.com/map",offsetJsonURL:"https://games-prod.virtualott.com/offset",renderingMode:Me.Augment,SynchMethod:ro.None,debug:!1,hls_fps:6e4/1001,augmentation:{renderTimecode:!0,offset:0},syncPoint:{frame:0,playerTime:0,mediaTimeMS:0}},l||{}),console.log("options after merge with MK's options: ",JSON.parse(JSON.stringify(this.options))),console.BBlog=function(a){console.log("OTTPlayer: "+a),Gn.logger.info("Web Unsorted msg: "+a,{name:"test"})},console.BBerror=function(...a){console.log("OTTPlayer: ",...a),Gn.logger.error("Web Unsorted error: "+a.join(", "),{name:"test"})},this.getGlobalConfig()}init(){typeof window.globalConfig>"u"?this.options=Object.assign(this.options,{}):this.options=Object.assign(this.options,JSON.parse(JSON.stringify(window.globalConfig)));var t={};if(t.value1=this.options.hls_fps,this.setFps(t),console.log("options after merge with the global options: ",JSON.parse(JSON.stringify(this.options))),!this.options.debug){let n=["debugText","forplus","forDoNotRender","debugText2","toggleBtn","numberInput","plus05CorrectionCheckbox","doNotRenderAugmentationCheckbox","plus05CorrectionLabel","doNotRenderAugmentationLabel","br1","br2","qualityButton","qualitySelect"];for(let l=0;l<n.length;l++){const a=document.getElementById(n[l]);a&&(a.style.display="none")}}this.fetchAndFindGameIdAndOffsetFromMediaId(this.options.gameId)}weHaveTheGameID(){this.frameDrawer=new io(this.video,this.options),this.options.renderingMode==Me.Augment&&this.frameDrawer.initializeComponents()}async getGlobalConfig(){const n=new URL(document.location).searchParams.get("config")||"";if(n!=="")try{const l=await fetch(n);if(!l.ok)throw new Error("Network response was not ok");const a=await l.json();typeof window.globalConfig>"u"&&(window.globalConfig={}),globalConfig=Object.assign({},a,window.globalConfig),console.log("final global config:",window.globalConfig)}catch(l){console.BBerror("Error fetching JSON:",l)}this.init()}async fetchAndFindGameIdAndOffsetFromMediaId(t){if(t="bbtest45",this.options.mediaIdJsonURL=="test"){this.weHaveTheGameID();return}try{const n=await fetch(this.options.mediaIdJsonURL+"/"+t);if(!n.ok)throw new Error(`HTTP error! Status: ${n.status}`);const l=await n.json();if(l.hasOwnProperty("GAME_ID")){console.log({jsonData:l});const a=l.GAME_ID;console.log(`GameId for mediaid= ${t}: ${a}`),this.options.gameId=a,this.weHaveTheGameID(),this.fetchOffsetForGameIdMediaID(this.options.gameId,t)}else console.BBerror(`MediaID ${t} not found in JSON.`),this.options.stopAugment=!0}catch(n){console.BBerror("Error fetching and processing GameId JSON:"+n)}}async fetchOffsetForGameIdMediaID(t,n){if(this.options.offsetJsonURL=="test")return 0;try{const l=await fetch(this.options.offsetJsonURL+"/"+t);l.ok||(console.log(`HTTP error! Status: ${l.status}`),setTimeout(()=>{this.fetchOffsetForGameIdMediaID(t,n)},5e3));const a=await l.json();if(a.hasOwnProperty("offset")&&a.hasOwnProperty("found")){const c=a.offset;a.found==!0&&(console.log(`Offset for gameid= ${t}: ${c}`),this.options.augmentation.offset=c,setTimeout(()=>{this.fetchOffsetForGameIdMediaID(t,n)},6e4))}else console.log(`offset for ${t} not found in JSON.`),setTimeout(()=>{this.fetchOffsetForGameIdMediaID(t,n)},5e3)}catch(l){console.BBerror("Error fetching and processing offset:",l),setTimeout(()=>{this.fetchOffsetForGameIdMediaID(t,n)},5e3)}}toggle(t){this.options.enabled=t}getCanvas(){return this.frameDrawer.getCanvas()}setFps(t){var n=t.value1;switch(n){case 59.94:case 6e4/1001:this.options.hls_fps=6e4/1001;break;case 29.97:case 3e4/1001:this.options.hls_fps=3e4/1001;break;default:console.error("Unsupported hls-src frame-rate: "+n+"fps"),this.options.hls_fps=n;break}}setSyncPoint(t){this.options.syncPoint=t}onNewSegment(t){this.frameDrawer.onNewSegmentForMetadata(t)}onNewMetadata(t){this.frameDrawer.onNewMetadata(t)}}return window.BB={MAX_LOGOS:4,RENDER_IN_WORKER:!0,OTTPlayer:Yi},Yi});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brandbrigade/ott-bb-player",
3
- "version": "1.0.44",
3
+ "version": "1.0.45",
4
4
  "description": "ott bb player",
5
5
  "main": "./dist/OTTPlayer.js",
6
6
  "files": ["src", "dist"],
@@ -8,7 +8,8 @@
8
8
  "dev": "vite serve --host",
9
9
  "format": "prettier --write .",
10
10
  "build": "vite build",
11
- "build-lib": "vite build --config vite.config.prod.js"
11
+ "build-lib": "vite build --config vite.config.prod.js",
12
+ "preview": "vite preview"
12
13
  },
13
14
  "author": "Alexey",
14
15
  "license": "ISC",
package/src/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ import OTTPlayer from "./OTTPlayer";
2
+
1
3
  window.globalConfig
2
4
  // = {
3
5
  // debug: true,