UNPKG

@phenixrts/sdk

Version:
2 lines 226 kB
/*! For license information please see channels.js.LICENSE.txt */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.phenix=t():e.phenix=t()}(self,(()=>(()=>{var e={131:e=>{"use strict";e.exports=function(e,t,n,r){var i=self||window;try{try{var o;try{o=new i.Blob([e])}catch(t){(o=new(i.BlobBuilder||i.WebKitBlobBuilder||i.MozBlobBuilder||i.MSBlobBuilder)).append(e),o=o.getBlob()}var a=i.URL||i.webkitURL,s=a.createObjectURL(o),u=new i[t](s,n);return a.revokeObjectURL(s),u}catch(r){return new i[t]("data:application/javascript,".concat(encodeURIComponent(e)),n)}}catch(e){if(!r)throw Error("Inline worker is not supported");return new i[t](r,n)}}},79:e=>{e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r},e.exports.__esModule=!0,e.exports.default=e.exports},987:e=>{e.exports=function(e){if(Array.isArray(e))return e},e.exports.__esModule=!0,e.exports.default=e.exports},901:(e,t,n)=>{var r=n(79);e.exports=function(e){if(Array.isArray(e))return r(e)},e.exports.__esModule=!0,e.exports.default=e.exports},475:e=>{e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.__esModule=!0,e.exports.default=e.exports},293:e=>{function t(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}e.exports=function(e){return function(){var n=this,r=arguments;return new Promise((function(i,o){var a=e.apply(n,r);function s(e){t(a,i,o,s,u,"next",e)}function u(e){t(a,i,o,s,u,"throw",e)}s(void 0)}))}},e.exports.__esModule=!0,e.exports.default=e.exports},383:e=>{e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports},579:(e,t,n)=>{var r=n(736);function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,r(i.key),i)}}e.exports=function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e},e.exports.__esModule=!0,e.exports.default=e.exports},693:(e,t,n)=>{var r=n(736);e.exports=function(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.__esModule=!0,e.exports.default=e.exports},72:e=>{function t(n){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},511:(e,t,n)=>{var r=n(636);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&r(e,t)},e.exports.__esModule=!0,e.exports.default=e.exports},291:e=>{e.exports=function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.__esModule=!0,e.exports.default=e.exports},156:e=>{e.exports=function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],u=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);u=!0);}catch(e){c=!0,i=e}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}},e.exports.__esModule=!0,e.exports.default=e.exports},752:e=>{e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports},869:e=>{e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports},452:(e,t,n)=>{var r=n(738).default,i=n(475);e.exports=function(e,t){if(t&&("object"==r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return i(e)},e.exports.__esModule=!0,e.exports.default=e.exports},633:(e,t,n)=>{var r=n(738).default;function i(){"use strict";e.exports=i=function(){return n},e.exports.__esModule=!0,e.exports.default=e.exports;var t,n={},o=Object.prototype,a=o.hasOwnProperty,s=Object.defineProperty||function(e,t,n){e[t]=n.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",d=u.toStringTag||"@@toStringTag";function h(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{h({},"")}catch(t){h=function(e,t,n){return e[t]=n}}function f(e,t,n,r){var i=t&&t.prototype instanceof b?t:b,o=Object.create(i.prototype),a=new R(r||[]);return s(o,"_invoke",{value:F(e,n,a)}),o}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}n.wrap=f;var m="suspendedStart",v="suspendedYield",g="executing",y="completed",_={};function b(){}function C(){}function k(){}var S={};h(S,c,(function(){return this}));var w=Object.getPrototypeOf,x=w&&w(w(O([])));x&&x!==o&&a.call(x,c)&&(S=x);var T=k.prototype=b.prototype=Object.create(S);function P(e){["next","throw","return"].forEach((function(t){h(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,t){function n(i,o,s,u){var c=p(e[i],e,o);if("throw"!==c.type){var l=c.arg,d=l.value;return d&&"object"==r(d)&&a.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,s,u)}),(function(e){n("throw",e,s,u)})):t.resolve(d).then((function(e){l.value=e,s(l)}),(function(e){return n("throw",e,s,u)}))}u(c.arg)}var i;s(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(o,o):o()}})}function F(e,n,r){var i=m;return function(o,a){if(i===g)throw Error("Generator is already running");if(i===y){if("throw"===o)throw a;return{value:t,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var u=I(s,r);if(u){if(u===_)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===m)throw i=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=g;var c=p(e,n,r);if("normal"===c.type){if(i=r.done?y:v,c.arg===_)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=y,r.method="throw",r.arg=c.arg)}}}function I(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,I(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),_;var o=p(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,_;var a=o.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,_):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,_)}function L(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function D(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function O(e){if(e||""===e){var n=e[c];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(a.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(r(e)+" is not iterable")}return C.prototype=k,s(T,"constructor",{value:k,configurable:!0}),s(k,"constructor",{value:C,configurable:!0}),C.displayName=h(k,d,"GeneratorFunction"),n.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===C||"GeneratorFunction"===(t.displayName||t.name))},n.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,k):(e.__proto__=k,h(e,d,"GeneratorFunction")),e.prototype=Object.create(T),e},n.awrap=function(e){return{__await:e}},P(E.prototype),h(E.prototype,l,(function(){return this})),n.AsyncIterator=E,n.async=function(e,t,r,i,o){void 0===o&&(o=Promise);var a=new E(f(e,t,r,i),o);return n.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},P(T),h(T,d,"Generator"),h(T,c,(function(){return this})),h(T,"toString",(function(){return"[object Generator]"})),n.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},n.values=O,R.prototype={constructor:R,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(D),!e)for(var n in this)"t"===n.charAt(0)&&a.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function r(r,i){return s.type="throw",s.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=a.call(o,"catchLoc"),c=a.call(o,"finallyLoc");if(u&&c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&a.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,_):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),_},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),D(n),_}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;D(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:O(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),_}},n}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports},636:e=>{function t(n,r){return e.exports=t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n,r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},715:(e,t,n)=>{var r=n(987),i=n(156),o=n(122),a=n(752);e.exports=function(e,t){return r(e)||i(e,t)||o(e,t)||a()},e.exports.__esModule=!0,e.exports.default=e.exports},132:(e,t,n)=>{var r=n(901),i=n(291),o=n(122),a=n(869);e.exports=function(e){return r(e)||i(e)||o(e)||a()},e.exports.__esModule=!0,e.exports.default=e.exports},45:(e,t,n)=>{var r=n(738).default;e.exports=function(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},736:(e,t,n)=>{var r=n(738).default,i=n(45);e.exports=function(e){var t=i(e,"string");return"symbol"==r(t)?t:t+""},e.exports.__esModule=!0,e.exports.default=e.exports},738:e=>{function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},122:(e,t,n)=>{var r=n(79);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}},e.exports.__esModule=!0,e.exports.default=e.exports},756:(e,t,n)=>{var r=n(633)();e.exports=r;try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";n.r(r),n.d(r,{ChannelState:()=>Fe,Channels:()=>en,SDK:()=>xe,default:()=>tn});var e=n(383),t=n.n(e),i=n(579),o=n.n(i),a=n(693),s=n.n(a),u=n(452),c=n.n(u),l=n(72),d=n.n(l),h=n(511),f=n.n(h),p=function(){return o()((function e(n){t()(this,e),s()(this,"_disposed",void 0),s()(this,"_disposable",void 0),this._disposed=!1,this._disposable=n}),[{key:"dispose",value:function(){if(!this._disposed)return this._disposed=!0,this._disposable.call(this)}}])}();function m(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(m=function(){return!!e})()}var v,g=function(e){function n(e,r){return t()(this,n),i=this,o=n,a=[function(){var t=e.indexOf(r);t>=0&&e.splice(t,1)}],o=d()(o),c()(i,m()?Reflect.construct(o,a||[],d()(i).constructor):o.apply(i,a));var i,o,a}return f()(n,e),o()(n)}(p),y=function(){return o()((function e(n){t()(this,e),s()(this,"_listeners",void 0),s()(this,"_value",void 0),this._listeners=[],this._value=n}),[{key:"value",get:function(){return this._value},set:function(e){var t=this._value!==e;if(t&&e){var n=e;"function"==typeof n.equals&&(t=!n.equals(this._value))}t&&(this._value=e,this._listeners.forEach((function(t){t(e)})))}},{key:"subscribe",value:function(e){return this._listeners.push(e),e(this._value),new g(this._listeners,e)}}])}(),_=function(){return o()((function e(n){t()(this,e),s()(this,"_subject",void 0),this._subject=n}),[{key:"value",get:function(){return this._subject.value}},{key:"subscribe",value:function(e){return this._subject.subscribe(e)}}])}(),b=function(){function e(n){t()(this,e),s()(this,"_document",void 0),s()(this,"_location",void 0),s()(this,"_navigator",void 0),s()(this,"_window",void 0),this._document=n.document,this._location=n.location,this._navigator=n.navigator,this._window=n.window}return o()(e,[{key:"FormData",get:function(){return this._window.FormData}},{key:"HTMLVideoElement",get:function(){return this._window.HTMLVideoElement}},{key:"MediaStream",get:function(){return this._window.MediaStream}},{key:"MediaStreamTrack",get:function(){return this._window.MediaStreamTrack}},{key:"RTCPeerConnection",get:function(){return this._window.RTCPeerConnection}},{key:"RTCSessionDescription",get:function(){return this._window.RTCSessionDescription}},{key:"RTCIceCandidate",get:function(){return this._window.RTCIceCandidate}},{key:"URL",get:function(){return this._window.URL}},{key:"URLSearchParams",get:function(){return this._window.URLSearchParams}},{key:"addDocumentEventListener",get:function(){return this._document.addEventListener.bind(this._document)}},{key:"addWindowEventListener",get:function(){return this._window.addEventListener.bind(this._window)}},{key:"clearInterval",get:function(){return this._window.clearInterval.bind(this._window)}},{key:"clearTimeout",get:function(){return this._window.clearTimeout.bind(this._window)}},{key:"documentCreateElement",get:function(){return this._document.createElement.bind(this._document)}},{key:"documentHasFocus",get:function(){return this._document.hasFocus.bind(this._document)}},{key:"documentIsHidden",get:function(){return!!this._document.hidden}},{key:"documentQuerySelector",get:function(){return this._document.querySelector.bind(this._document)}},{key:"fetch",get:function(){return this._window.fetch.bind(this._window)}},{key:"locationHostname",get:function(){return this._location.hostname}},{key:"locationSearch",get:function(){return this._location.search}},{key:"navigatorConnection",get:function(){return this._navigator.connection}},{key:"navigatorIsOnLine",get:function(){return this._navigator.onLine}},{key:"pageLoadTime",get:function(){return this._window.__phenixPageLoadTime||this._window.__pageLoadTime}},{key:"queueMicrotask",get:function(){return this._window.queueMicrotask.bind(this._window)}},{key:"removeDocumentEventListener",get:function(){return this._document.removeEventListener.bind(this._document)}},{key:"removeWindowEventListener",get:function(){return this._window.removeEventListener.bind(this._window)}},{key:"setInterval",get:function(){return this._window.setInterval.bind(this._window)}},{key:"setTimeout",get:function(){return this._window.setTimeout.bind(this._window)}}],[{key:"setInstance",value:function(t){if(this._instance.value)throw new Error("GlobalScope can only be set one time");this._instance.value=new e(t)}},{key:"getInstance",value:function(){return e._readOnlyInstance}},{key:"subscribe",value:function(t){return e._readOnlyInstance.subscribe(t)}}])}();v=b,s()(b,"_instance",new y(null)),s()(b,"_readOnlyInstance",new _(v._instance));var C,k,S,w=b.getInstance(),x=function(){function e(){t()(this,e)}return o()(e,null,[{key:"browserNameAndVersion",get:function(){return e._browserNameAndVersion}},{key:"browserName",get:function(){return this._browserName}},{key:"browserMajorVersion",get:function(){return this._browserMajorVersion}},{key:"isAndroid",get:function(){return e._isAndroid}},{key:"isChrome69",get:function(){return e._isChrome69}},{key:"isChrome70",get:function(){return e._isChrome70}},{key:"isChrome71",get:function(){return e._isChrome71}},{key:"isChrome72",get:function(){return e._isChrome72}},{key:"isChrome74",get:function(){return e._isChrome74}},{key:"isChrome75",get:function(){return e._isChrome75}},{key:"isChrome76",get:function(){return e._isChrome76}},{key:"isChrome77",get:function(){return e._isChrome77}},{key:"isMobile",value:function(){return e._isMobile}},{key:"parseBrowserNameAndVersion",value:function(){if(!navigator||!navigator.userAgent)return"";var t=navigator.userAgent.match(e._browserNameAndVersionRegex);return t&&t[0]?t[0]:e.parseBrowserNameAndVersionForIE()}},{key:"parseBrowserName",value:function(){if(!e._browserNameAndVersion)return"";var t=e._browserNameAndVersion.split("/");return t&&t[0]?t[0]:""}},{key:"parseBrowserMajorVersion",value:function(){if(!e._browserNameAndVersion)return 0;var t=e._browserNameAndVersion.split("/");if(!t||!t[1])return 0;var n=t[1];return n&&Number(n.split(".")[0])||0}},{key:"parseBrowserNameAndVersionForIE",value:function(){if(!navigator||!navigator.userAgent)return"";var e=navigator.userAgent,t=e.indexOf("MSIE ");if(t>0)return"IE/".concat(parseInt(e.substring(t+5,e.indexOf(".",t)),10));if(e.indexOf("Trident/")>0){var n=e.indexOf("rv:");return"IE/".concat(parseInt(e.substring(n+3,e.indexOf(".",n)),10))}return""}}])}();C=x,s()(x,"_browserNameAndVersionRegex",/(MSIE|(?!Gecko.+)Firefox|(?!AppleWebKit.+Chrome.+)Safari|(?!AppleWebKit.+)Chrome|AppleWebKit(?!.+Chrome|.+Safari)|Gecko(?!.+Firefox))(?: |\/)([\d.apre]+)/g),s()(x,"_browserNameAndVersion",C.parseBrowserNameAndVersion()),s()(x,"_browserName",C.parseBrowserName()),s()(x,"_browserMajorVersion",C.parseBrowserMajorVersion()),s()(x,"_isMobile",/Android|iPhone|iPad|iPod|BlackBerry|Opera Mini/i.test(null===(k=navigator)||void 0===k?void 0:k.userAgent)),s()(x,"_isAndroid",/Android/i.test(null===(S=navigator)||void 0===S?void 0:S.userAgent)),s()(x,"_isChrome69",C._browserNameAndVersion.includes("Chrome/69.")),s()(x,"_isChrome70",C._browserNameAndVersion.includes("Chrome/70.")),s()(x,"_isChrome71",C._browserNameAndVersion.includes("Chrome/71.")),s()(x,"_isChrome72",C._browserNameAndVersion.includes("Chrome/72.")),s()(x,"_isChrome74",C._browserNameAndVersion.includes("Chrome/74.")),s()(x,"_isChrome75",C._browserNameAndVersion.includes("Chrome/75.")),s()(x,"_isChrome76",C._browserNameAndVersion.includes("Chrome/76.")),s()(x,"_isChrome77",C._browserNameAndVersion.includes("Chrome/77."));var T=function(){function e(){t()(this,e)}return o()(e,null,[{key:"clientOfferDisabled",get:function(){return x.isChrome74||x.isChrome75||x.isChrome76||x.isChrome77}},{key:"getTransceiversDisabled",get:function(){return e.addTranceiverDisabled}},{key:"addTranceiverDisabled",get:function(){return x.isChrome69||x.isChrome70||x.isChrome71||x.isChrome72}},{key:"getStatsPromiseBasedDisabled",get:function(){return"Chrome"===x.browserName&&x.browserMajorVersion<=66}},{key:"getCurrentOfferDisabled",get:function(){return"Chrome"===x.browserName&&x.browserMajorVersion<=69||"Firefox"===x.browserName&&x.browserMajorVersion<=56}},{key:"onTrackDisabled",get:function(){return"Chrome"===x.browserName&&x.browserMajorVersion<=63||"Firefox"===x.browserName&&x.browserMajorVersion<=52}},{key:"webkitRTCPeerConnectionEnabled",get:function(){return"Chrome"===x.browserName&&x.browserMajorVersion<=55}},{key:"promiseBasedPCMethodsDisabled",get:function(){return"Firefox"===x.browserName&&x.browserMajorVersion<=52}},{key:"shouldUseNativeHls",get:function(){return"Safari"===x.browserName||"SamsungBrowser"===x.browserName}},{key:"isPrecachingEnabled",get:function(){return"IE"!==x.browserName}},{key:"isForceChromeGarbageCollectionSupported",get:function(){var e;return"Chrome"===x.browserName&&"function"==typeof(null===(e=w.value)||void 0===e?void 0:e.documentCreateElement)}},{key:"isQueueMicrotaskSupported",get:function(){return"Chrome"===x.browserName&&x.browserMajorVersion>=71||"Firefox"===x.browserName&&x.browserMajorVersion>=69||"Safari"===x.browserName}},{key:"isMobile",get:function(){return x.isMobile()}},{key:"isInsertableStreamsSupported",get:function(){return!("undefined"==typeof MediaStreamTrackProcessor||"undefined"==typeof MediaStreamTrackGenerator)}},{key:"isEncodedInsertableStreamsSupported",get:function(){return"undefined"!=typeof RTCRtpReceiver&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams}},{key:"isRTCRtpScriptTransformSupported",get:function(){return"undefined"!=typeof RTCRtpScriptTransform}},{key:"isRequestVideoFrameCallbackSupported",get:function(){var e;return void 0!==(null===(e=w.value)||void 0===e?void 0:e.HTMLVideoElement.prototype.requestVideoFrameCallback)}},{key:"isChannelFrameTimingInformationSupported",get:function(){return e.isRequestVideoFrameCallbackSupported&&(e.isEncodedInsertableStreamsSupported||e.isRTCRtpScriptTransformSupported)}},{key:"errorStackAlsoHasErrorMessage",get:function(){return"Firefox"!==x.browserName&&"Safari"!==x.browserName}}])}(),P=function(e){return e[e.All=-1]="All",e[e.Trace=10]="Trace",e[e.Debug=20]="Debug",e[e.Info=30]="Info",e[e.Warn=40]="Warn",e[e.Error=50]="Error",e[e.Fatal=60]="Fatal",e[e.Off=100]="Off",e}({}),E=function(){return o()((function e(n,r,i){t()(this,e),s()(this,"_category",void 0),s()(this,"_appenders",void 0),s()(this,"_threshold",void 0),this._category=n,this._appenders=r,this._threshold=i}),[{key:"category",get:function(){return this._category}},{key:"appenders",get:function(){return this._appenders}},{key:"threshold",get:function(){return this._threshold}},{key:"trace",value:function(){if(this._threshold.value&&!(this._threshold.value>P.Trace)){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.log(P.Trace,t)}}},{key:"debug",value:function(){if(this._threshold.value&&!(this._threshold.value>P.Debug)){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.log(P.Debug,t)}}},{key:"info",value:function(){if(this._threshold.value&&!(this._threshold.value>P.Info)){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.log(P.Info,t)}}},{key:"warn",value:function(){if(this._threshold.value&&!(this._threshold.value>P.Warn)){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.log(P.Warn,t)}}},{key:"error",value:function(){if(this._threshold.value&&!(this._threshold.value>P.Error)){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.log(P.Error,t)}}},{key:"fatal",value:function(){if(this._threshold.value&&!(this._threshold.value>P.Fatal)){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.log(P.Fatal,t)}}},{key:"log",value:function(e,t){var n=this,r=new Date,i=this.replacePlaceholders(t);this._appenders.value.forEach((function(t){t.log(e,i,n.category,r)}))}},{key:"replacePlaceholders",value:function(e){for(var t=this,n=e[0],r=0;n.indexOf&&e.length>1&&r>=0;)if((r=n.indexOf("%",r))>0)switch(n.substring(r+1,r+2)){case"%":n=n.substring(0,r)+n.substring(r+1),r++;break;case"s":case"d":e[0]=n=this.replaceArgument(this.toString(e[1]),n,r),e.splice(1,1);break;case"j":e[0]=n=this.replaceArgument(this.stringify(e[1]),n,r),e.splice(1,1);break;default:return e.toString()}return e.length>1&&(e=e.reduce((function(e,n,r,i){return r+1===i.length&&n instanceof Error?T.errorStackAlsoHasErrorMessage?e+"\n"+t.toString(n.stack):e+"\n"+t.toString(n.message)+"\n"+t.toString(n.stack):e+"[".concat(t.toString(n),"]")}))),e.toString()}},{key:"stringify",value:function(e){var t=[];try{return JSON.stringify(e instanceof Error?this.toString(e):e,(function(e,n){if(n&&n instanceof Object){if(t.includes(n))return"<recursive>";t.push(n)}return n}),2)}catch(e){return"[object invalid JSON.stringify]"}}},{key:"replaceArgument",value:function(e,t,n){return t.substring(0,n)+this.toString(e)+t.substring(n+2)}},{key:"toString",value:function(e){if("string"==typeof e)return e;if("boolean"==typeof e)return e?"true":"false";if("number"==typeof e)return e.toString();var t="";if(e)if("function"==typeof e)t=e.toString();else if(e instanceof Object)try{t=e.toString()}catch(e){t="[object invalid toString()]"}return t}}])}(),F=function(){return o()((function e(){t()(this,e),s()(this,"_appenders",[])}),[{key:"value",get:function(){return this._appenders}},{key:"add",value:function(e){this._appenders.push(e)}},{key:"remove",value:function(e){this._appenders=this._appenders.reduce((function(t,n){return n!==e&&t.push(n),t}),[])}}])}(),I=function(){return o()((function e(){t()(this,e)}),null,[{key:"sendLocalCandidates",get:function(){return this._sendLocalCandidates}},{key:"sendLogs",get:function(){return this._sendLogs}},{key:"sendMetrics",get:function(){return this._sendMetrics}},{key:"logToConsole",get:function(){return this._logToConsole}},{key:"applyFeatures",value:function(){try{var e={sendLocalCandidates:!0,sendLogs:"All",sendMetrics:"All",logToConsole:"All"};this._sendLocalCandidates=!("sendLocalCandidates"in e)||e.sendLocalCandidates,this._sendLogs="sendLogs"in e?e.sendLogs:"All",this._sendMetrics="sendMetrics"in e?e.sendMetrics:"All",this._logToConsole="logToConsole"in e?e.logToConsole:"All"}catch(e){this._sendLocalCandidates=!0,this._sendLogs="All",this._sendMetrics="All",this._logToConsole="All"}}}])}();s()(I,"_sendLocalCandidates",void 0),s()(I,"_sendLogs",void 0),s()(I,"_sendMetrics",void 0),s()(I,"_logToConsole",void 0),I.applyFeatures();var L=function(){return o()((function e(){t()(this,e)}),null,[{key:"defaultLoggingLevel",get:function(){return P[I.sendLogs]}},{key:"defaultConsoleLoggingLevel",get:function(){return P[I.logToConsole]}},{key:"defaultTelemetryLoggingLevel",get:function(){return P.Info}}])}(),D=function(){return o()((function e(){t()(this,e),s()(this,"_threshold",L.defaultLoggingLevel)}),[{key:"value",get:function(){return this._threshold}},{key:"setThreshold",value:function(e){this._threshold=e}}])}(),R=function(){return o()((function e(n){t()(this,e),s()(this,"_threshold",void 0),this._threshold=n}),[{key:"log",value:function(e,t,n,r){if(!(e<this._threshold)){var i="".concat(r.toISOString()," [").concat(n,"] [").concat(P[e],"] ").concat(t);e<P.Warn?console.log(i):console.error(i)}}}])}(),O=n(293),A=n.n(O),M=n(756),N=n.n(M),V=function(){function e(){throw t()(this,e),new Error("Numbers is a static class that may not be instantiated")}return o()(e,null,[{key:"countNumberLength",value:function(t){var n=0,r=t;return r<0&&(r*=-1,n++),e.countDigitsBeforeDecimal(r)+n+(r!==Math.floor(r)?e.countDigitsAfterDecimal(r)+1:0)}},{key:"fixRounding",value:function(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}},{key:"countDigitsBeforeDecimal",value:function(e){for(var t=1,n=e;n>=10;)n/=10,t++;return t}},{key:"countDigitsAfterDecimal",value:function(t){for(var n=t,r=Math.floor(t),i=0;r!==n&&i<15;)i++,r=e.fixRounding(n,i);return i}}])}(),U=function(){return o()((function e(){t()(this,e)}),null,[{key:"sdkVersion",get:function(){try{return"2025-02-06T18:19:55.363Z (2025.0.4)"}catch(e){return this._defaultVersion}}}])}();s()(U,"_defaultVersion",(new Date).toISOString());var B=function(){return o()((function e(n){var r=this;t()(this,e),s()(this,"_telemetryConfiguration",void 0),s()(this,"_logs",[]),s()(this,"_isSending",!1),s()(this,"_domain",""),this._telemetryConfiguration=n,this.getLocationHostnameFromGlobalScope().then((function(e){r._domain=e}))}),[{key:"push",value:function(e,t,n,r){var i=(r.valueOf()-this._telemetryConfiguration.pageLoadTime)/1e3,o={timestamp:r.toISOString(),tenancy:this._telemetryConfiguration.tenancy,level:P[e],category:n,message:t,sessionId:this._telemetryConfiguration.sessionId,version:U.sdkVersion,environment:this._telemetryConfiguration.environment,fullQualifiedName:this._domain,runtime:i};e<P.Error?this._logs.push(o):this._logs.unshift(o),this.sendLogsIfAble()}},{key:"getLocationHostnameFromGlobalScope",value:function(){return new Promise((function(e){var t=w.subscribe((function(n){n&&(e(n.locationHostname),t.dispose())}))}))}},{key:"sendLogs",value:(n=A()(N().mark((function e(t){var n;return N().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new w.value.FormData).append("jsonBody",JSON.stringify({records:t})),e.next=4,w.value.fetch(this._telemetryConfiguration.url,{method:"POST",body:n});case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"sendLogsIfAble",value:(e=A()(N().mark((function e(){var t,n,r,i,o,a=this;return N().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(this._logs.length<=0||this._isSending)&&w.value){e.next=2;break}return e.abrupt("return");case 2:for(t=0,n=0,this._isSending=!0,r=function(e){return"number"==typeof e?V.countNumberLength(e):e.length},i=function(e){return Object.values(e).reduce((function(e,t){return e+(t?r(t):0)}),0)};this._logs.length>t&&i(this._logs[t])+n<8192;)n+=i(this._logs[t]),t++;return t||(this._logs[t].message=this._logs[t].message.substring(0,i(this._logs[t])+(8192-i(this._logs[t]))),t=1),o=this._logs.slice(0,t),this._logs=this._logs.slice(t),e.abrupt("return",this.sendLogs(o).then((function(e){return a._isSending=!1,a.sendLogsIfAble(),e})).catch((function(){a._isSending=!1,a.sendLogsIfAble()})));case 12:case"end":return e.stop()}}),e,this)}))),function(){return e.apply(this,arguments)})}]);var e,n}(),j=function(){return o()((function e(n){t()(this,e),s()(this,"_telemetryService",void 0),s()(this,"_tenancy",void 0),s()(this,"_sessionId",void 0),s()(this,"_threshold",void 0),this._tenancy=n.tenancy,this._sessionId=n.sessionId,this._threshold=n.threshold,this._telemetryService=new B(n)}),[{key:"log",value:function(e,t,n,r){e<this._threshold||this._telemetryService.push(e,t,n,r)}}])}(),H=function(){return o()((function e(){t()(this,e),s()(this,"_url","https://telemetry.phenixrts.com/telemetry/logs"),s()(this,"_tenancy","-"),s()(this,"_sessionId","-"),s()(this,"_environment","-"),s()(this,"_pageLoadTime",0),s()(this,"_threshold",L.defaultTelemetryLoggingLevel)}),[{key:"url",get:function(){return this._url},set:function(e){var t=new w.value.URL(e);t.pathname=t.pathname+"/logs",this._url=t.toString()}},{key:"environment",get:function(){return this._environment},set:function(e){this._environment=e}},{key:"tenancy",get:function(){return this._tenancy},set:function(e){this._tenancy=e}},{key:"sessionId",get:function(){return this._sessionId},set:function(e){this._sessionId=e}},{key:"pageLoadTime",get:function(){return this._pageLoadTime},set:function(e){this._pageLoadTime=e}},{key:"threshold",get:function(){return this._threshold},set:function(e){this._threshold=e}}])}(),z=function(){return o()((function e(){t()(this,e)}),null,[{key:"defaultTelemetryLevel",get:function(){return G[I.sendMetrics]}}])}(),G=function(e){return e[e.Off=100]="Off",e[e.Essential=10]="Essential",e[e.All=-1]="All",e}({}),W=function(){return o()((function e(){t()(this,e),s()(this,"_url","https://telemetry.phenixrts.com/telemetry/metrics"),s()(this,"_tenancy","-"),s()(this,"_sessionId","-"),s()(this,"_environment","-"),s()(this,"_threshold",z.defaultTelemetryLevel)}),[{key:"url",get:function(){return this._url},set:function(e){var t=new w.value.URL(e);t.pathname=t.pathname+"/metrics",this._url=t.toString()}},{key:"environment",get:function(){return this._environment},set:function(e){this._environment=e}},{key:"tenancy",get:function(){return this._tenancy},set:function(e){this._tenancy=e}},{key:"sessionId",get:function(){return this._sessionId},set:function(e){this._sessionId=e}},{key:"threshold",get:function(){return this._threshold},set:function(e){this._threshold=e}}])}(),q=function(e){throw new Error("Unexpected value [".concat(e,"]. This should never be reached"))},J=function(){return o()((function e(){t()(this,e)}),null,[{key:"convertTelemetryLevelToTelemetryLevelType",value:function(e){switch(e){case G.Off:return"Off";case G.Essential:return"Essential";case G.All:return"All";default:q(e)}}},{key:"convertTelemetryLevelTypeToTelemetryLevel",value:function(e){switch(e){case"Off":return G.Off;case"Essential":return G.Essential;case"All":return G.All;default:q(e)}}}])}(),K=function(){return o()((function e(){t()(this,e)}),null,[{key:"convertLoggingLevelToLoggingLevelType",value:function(e){switch(e){case P.Off:return"Off";case P.Trace:return"Trace";case P.Debug:return"Debug";case P.Info:return"Trace";case P.Warn:return"Warn";case P.Error:return"Error";case P.Fatal:return"Fatal";case P.All:return"All";default:q(e)}}},{key:"convertLoggingLevelTypeToLoggingLevel",value:function(e){switch(e){case"Off":return P.Off;case"Trace":return P.Trace;case"Debug":return P.Debug;case"Info":return P.Info;case"Warn":return P.Warn;case"Error":return P.Error;case"Fatal":return P.Fatal;case"All":return P.All;default:q(e)}}}])}(),Z=function(){function e(){t()(this,e)}return o()(e,null,[{key:"getStringValue",value:function(t){return e.defaultStringValue[t]}},{key:"getBooleanValue",value:function(t){return e.defaultBooleanValue[t]}},{key:"defaultStringValue",get:function(){return{"phenix-metrics-level":J.convertTelemetryLevelToTelemetryLevelType(z.defaultTelemetryLevel),"phenix-logging-level":K.convertLoggingLevelToLoggingLevelType(L.defaultLoggingLevel),"phenix-console-logging-level":K.convertLoggingLevelToLoggingLevelType(L.defaultConsoleLoggingLevel),"phenix-telemetry-logging-level":K.convertLoggingLevelToLoggingLevelType(L.defaultTelemetryLoggingLevel),"phenix-channel-token":"","phenix-uri":"","phenix-base-uri":""}}},{key:"defaultBooleanValue",get:function(){return{"phenix-automatically-retry-on-failure":!0,"phenix-automatically-reconnect-peer-connection":!0,"phenix-force-garbage-collection-on-restart":!0,"phenix-skip-garbage-collection-on-mobile-devices":!0}}}])}(),Q=function(){function e(){throw t()(this,e),new Error("LoggerFactory is a static class that may not be instantiated")}return o()(e,null,[{key:"telemetryConfiguration",get:function(){return e._telemetryConfiguration}},{key:"getLogger",value:function(t){return"string"!=typeof t&&(t="SDK"),e._loggers[t]||(e._loggers[t]=new E(t,this._appenders,this._threshold))}},{key:"applyLoggerConfigFromParameterConfiguration",value:function(){e.applyLoggingLevel(),e.applyAppenderLoggingLevel("console",e.applyConsoleLogger.bind(this)),e.applyAppenderLoggingLevel("telemetry",e.applyTelemetryLogger.bind(this))}},{key:"applyLoggingLevel",value:function(){var e=Z.getStringValue("phenix-logging-level");P[e]&&this._threshold.setThreshold(P[e])}},{key:"applyAppenderLoggingLevel",value:function(e,t){var n=Z.getStringValue("phenix-".concat(e,"-logging-level"));"Off"!==n&&t(P[n])}},{key:"applyConsoleLogger",value:function(e){this._appenders.add(new R(e||L.defaultConsoleLoggingLevel))}},{key:"applyTelemetryLogger",value:function(e){this._telemetryConfiguration.threshold=e||L.defaultTelemetryLoggingLevel,this._appenders.add(new j(this._telemetryConfiguration))}}])}();s()(Q,"_loggers",{}),s()(Q,"_appenders",new F),s()(Q,"_threshold",new D),s()(Q,"_telemetryConfiguration",new H),Q.applyLoggerConfigFromParameterConfiguration();var $=function(){return o()((function e(){throw t()(this,e),new Error("Strings is a static class that may not be instantiated")}),null,[{key:"random",value:function(e){var t=Math.ceil(e/13);return new Array(t).fill((function(){return Math.random().toString(16).substring(2,15)})).reduce((function(e,t){return e+t()}),"").substring(0,e)}}])}(),X=function(){return o()((function e(n){var r,i;t()(this,e),s()(this,"_applicationId",void 0),s()(this,"_token",void 0),this._applicationId=(null==n?void 0:n.applicationId)||"",this._token={uri:null!=n&&null!==(r=n.token)&&void 0!==r&&r.uri?new w.value.URL(n.token.uri):null,capabilities:(null==n||null===(i=n.token)||void 0===i?void 0:i.capabilities)||[]}}),[{key:"uri",get:function(){return this._token.uri}},{key:"capabilities",get:function(){return this._token.capabilities}},{key:"tenancy",get:function(){return this._applicationId}}])}(),Y=function(){function e(){t()(this,e)}return o()(e,null,[{key:"parseToken",value:function(t){if(!this.isEncodedEdgeTokenValid(t))return e._logger.error("Token is not valid [%s]",t),new X(null);try{var n=atob(t.substr(7)),r=JSON.parse(n);return r.token=JSON.parse(r.token),new X(r)}catch(t){return e._logger.error("Cannot parse token value",t),new X(null)}}},{key:"isEncodedEdgeTokenValid",value:function(e){return!!e&&e.startsWith("DIGEST:")}}])}();s()(Y,"_logger",Q.getLogger("EdgeAuthParser"));var ee=function(){return o()((function e(){t()(this,e),s()(this,"_list",[])}),[{key:"add",value:function(e){this._list.push(e)}},{key:"dispose",value:function(){this._list.forEach((function(e){return e.dispose()})),this._list.length=0}},{key:"toString",value:function(){return"DisposableList[disposables=".concat(this._list.length,"]")}}])}(),te="visibilitychange",ne=function(){return o()((function e(){t()(this,e),s()(this,"_disposables",new ee),s()(this,"_readOnlyIsForeground",void 0),s()(this,"_isForeground",void 0),s()(this,"_timeOfLastTabFocusChange",Date.now()),this._isForeground=new y(!0),this._readOnlyIsForeground=new _(this._isForeground),this.initialize()}),[{key:"isForeground",get:function(){return this._readOnlyIsForeground}},{key:"getTimeSinceLastChange",value:function(){return Date.now()-this._timeOfLastTabFocusChange}},{key:"dispose",value:function(){this._disposables.dispose()}},{key:"initialize",value:function(){var e=this,t=function(){return e._isForeground.value=!w.value.documentIsHidden},n=!1;w.value.addDocumentEventListener(te,t,n),this._disposables.add(new p((function(){return w.value.removeDocumentEventListener(te,t,n)})))}}])}(),re=function(){return o()((function e(n){t()(this,e),s()(this,"_logger",Q.getLogger("VanillaPeerConnection")),s()(this,"_peerConnection",void 0),T.webkitRTCPeerConnectionEnabled?this._peerConnection=new webkitRTCPeerConnection(n):this._peerConnection=new w.value.RTCPeerConnection(n)}),[{key:"native",get:function(){return this._peerConnection}},{key:"currentLocalDescription",get:function(){var e;return(null===(e=this._peerConnection)||void 0===e?void 0:e.currentLocalDescription)||null}},{key:"currentRemoteDescription",get:function(){var e;return(null===(e=this._peerConnection)||void 0===e?void 0:e.currentRemoteDescription)||null}},{key:"connectionState",get:function(){var e;return(null===(e=this._peerConnection)||void 0===e?void 0:e.connectionState)||null}},{key:"iceConnectionState",get:function(){var e;return(null===(e=this._peerConnection)||void 0===e?void 0:e.iceConnectionState)||null}},{key:"supportsGetConfiguration",get:function(){var e;return"function"==typeof(null===(e=this._peerConnection)||void 0===e?void 0:e.getConfiguration)}},{key:"supportsSetConfiguration",get:function(){var e;return"function"==typeof(null===(e=this._peerConnection)||void 0===e?void 0:e.setConfiguration)}},{key:"supportsGetTransceivers",get:function(){var e;return!T.getTransceiversDisabled&&"function"==typeof(null===(e=this._peerConnection)||void 0===e?void 0:e.getTransceivers)}},{key:"supportsAddTransceiver",get:function(){var e;return!T.addTranceiverDisabled&&"function"==typeof(null===(e=this._peerConnection)||void 0===e?void 0:e.addTransceiver)}},{key:"createOffer",value:(i=A()(N().mark((function e(t){var n=this;return N().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._peerConnection){e.next=2;break}throw new Error("No PeerConnection initialized");case 2:if(!T.promiseBasedPCMethodsDisabled){e.next=4;break}return e.abrupt("return",new Promise((function(e,r){return n._peerConnection.createOffer(e,r,t)})));case 4:return e.abrupt("return",this._peerConnection.createOffer(t));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"createAnswer",value:(r=A()(N().mark((function e(t){var n=this;return N().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._peerConnection){e.next=2;break}throw new Error("No PeerConnection initialized");case 2:if(!T.promiseBasedPCMethodsDisabled){e.next=4;break}return e.abrupt("return",new Promise((function(e,r){return n._peerConnection.createAnswer(e,r,t)})));case 4:return e.abrupt("return",this._peerConnection.createAnswer(t));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"setLocalDescription",value:(n=A()(N().mark((function e(t){return N().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._peerConnection){e.next=2;break}throw new Error("No PeerConnection initialized");case 2:return e.abrupt("return",this._peerConnection.setLocalDescription(T.promiseBasedPCMethodsDisabled?new RTCSessionDescription(t):t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"setRemoteDescription",value:(e=A()(N().mark((function e(t){var n;return N().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._peerConnection){e.next=2;break}throw new Error("No PeerConnection initialized");case 2:return(null===(n=t.sdp)||void 0===n?void 0:n.match(/a=crypto:/i))&&this._logger.warn("SDP a=crypto is not supported"),e.abrupt("return",this._peerConnection.setRemoteDescription(T.promiseBasedPCMethodsDisabled?new RTCSessionDescription(t):t));case 5:case"end":return e.stop()}}),e,this)}))),function(t){return e.apply(this,arguments)})},{key:"getSenders",value:function(){if(!this._peerConnection)throw new Error("No PeerConnection initialized");return this._peerConnection.getSenders()}},{key:"getReceivers",value:function(){if(!this._peerConnection)throw new Error("No PeerConnection initialized");return this._peerConnection.getReceivers()}},{key:"getStats",value:function(e){if(!this._peerConnection)throw new Error("No PeerConnection initialized");return this._peerConnection.getStats(e)}},{key:"getStatsLegacy",value:function(){var e=this;if(!this._peerConnection)throw new Error("No PeerConnection initialized");return new Promise((function(t){e._peerConnection.getStats(t)}))}},{key:"addEventListener",value:function(e,t,n){if(!this._peerConnection)throw new Error("No PeerConnection initialized");this._peerConnection.addEventListener(e,t,n)}},{key:"removeEventListener",value:function(e,t,n){if(!this._peerConnection)throw new Error("No PeerConnection initialized");this._peerConnection.removeEventListener(e,t,n)}},{key:"getTransceivers",value:function(){if(!this._peerConnection)throw new Error("No PeerConnection initialized");return this._peerConnection.getTransceivers()}},{key:"addTransceiver",value:function(e,t){if(!this._peerConnection)throw new Error("No PeerConnection initialized");return this._peerConnection.addTransceiver(e,t)}},{key:"addStream",value:function(e){var t=this;e.getTracks().forEach((function(e){if(!t._peerConnection)throw new Error("No PeerConnection initialized");t._peerConnection.addTrack(e)}))}},{key:"getConfiguration",value:function(){if(!this._peerConnection)throw new Error("No PeerConnection initialized");return this._peerConnection.getConfiguration()}},{key:"setConfiguration",value:function(e){if(!this._peerConnection)throw new Error("No PeerConnection initialized");this._peerConnection.setConfiguration(e)}},{key:"ontrack",get:function(){if(!this._peerConnection)throw new Error("No PeerConnection initialized");return this._peerConnection.ontrack},set:function(e){if(!this._peerConnection)throw new Error("No PeerConnection initialized");this._peerConnection.ontrack=e}},{key:"onicecandidate",get:function(){if(!this._peerConnection)throw new Error("No PeerConnection initialized");return this._peerConnection.onicecandidate},set:function(e){if(!this._peerConnection)throw new Error("No PeerConnection initialized");this._peerConnection.onicecandidate=e}},{key:"onconnectionstatechange",get:function(){if(!this._peerConnection)throw new Error("No PeerConnection initialized");return this._peerConnection.onconnectionstatechange},set:function(e){if(!this._peerConnection)throw new Error("No PeerConnection initialized");this._peerConnection.onconnectionstatechange=e}},{key:"oniceconnectionstatechange",get:function(){if(!this._peerConnection)throw new Error("No PeerConnection initialized");return this._peerConnection.oniceconnectionstatechange},set:function(e){if(!this._peerConnection)throw new Error("No PeerConnection initialized");this._peerConnection.oniceconnectionstatechange=e}},{key:"close",value:function(){var e;null===(e=this._peerConnection)||void 0===e||e.close()}},{key:"dispose",value:function(){this._peerConnection=null}}]);var e,n,r,i}(),ie=function(){return o()((function e(){t()(this,e)}),[{key:"createPeerConnection",value:(e=A()(N().mark((function e(t){return N().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){w.subscribe((function(n){n&&e(new re(t))}))})));case 1:case"end":return e.stop()}}),e)}))),function(t){return e.apply(this,arguments)})}]);var e}(),oe=function(e){return e[e.Disabled=0]="Disabled",e[e.Enabled=1]="Enabled",e}({}),ae=["audio","video"],se=function(){function e(){throw t()(this,e),new Error("PeerConnectionService is a static class that may not be instantiated")}return o()(e,null,[{key:"peerConnectionFactory",get:function(){return e._peerConnectionFactory}},{key:"initiateInitialPrecaching",value:function(){T.isPrecachingEnabled&&e.precacheCreatePeerConnectionOffer().catch((function(t){return e._logger.error("Failed to pre-cache peer connection offer",t)}))}},{key:"precacheCreatePeerConnectionOffer",value:(r=A()(N().mark((function t(){return N().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",e._cached={direction:"recvonly",peerConnection:e.createPeerConnectionOffer().catch((function(t){throw e._cached=null,t}))});case 1:case"end":return t.stop()}}),t)}))),function(){return r.apply(this,arguments)})},{key:"createPeerConnectionOffer",value:(n=A()(N().mark((function t(){var n,r,i,o,a,s=arguments;return N().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=s.length>0&&void 0!==s[0]?s[0]:"recvonly",r=s.length>1&&void 0!==s[1]?s[1]:ae,i=s.length>2&&void 0!==s[2]?s[2]:oe.Disabled,!e._cached||e._cached.direction!==n||i!==oe.Disabled||!this.isTracksKindsEquivalentToDefault(r)){t.next=7;break}return o=e._cached.peerConnection,e._cached=null,t.abrupt("return",o);case 7:return a=T.isEncodedInsertableStreamsSupported?{encodedInsertableStreams:i===oe.Enabled}:void 0,t.abrupt("return",e._peerConnectionFactory.value.createPeerConnection(a).then(function(){var e=A()(N().mark((function e(t){var i,o,a,s;return N().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=t.supportsAddTransceiver,o=[],a=[],!i){e.next=12;break}return r.forEach((function(e){"audio"!==e?"video"!==e||a.push(t.addTransceiver(e,{direction:n})):o.push(t.addTransceiver(e,{direction:n}))})),e.t0=o,e.t1=a,e.t2=t,e.next=10,t.createOffer(void 0);case 10:return e.t3=e.sent,e.abrupt("return",{audioTransceivers:e.t0,videoTransceivers:e.t1,peerConnection:e.t2,localOffer:e.t3});case 12:return s="recvonly"===n?{offerToReceiveAudio:!0,offerToReceiveVideo:!0}:{},e.t4=t,e.next=16,t.createOffer(s);case 16:return e.t5=e.sent,e.abrupt("return",{peerConnection:e.t4,localOffer:e.t5});case 18:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 9:case"end":return t.stop()}}),t,this)