amazon-ivs-web-broadcast 1.5.0 → 1.5.2

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.
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see amazon-ivs-web-broadcast-v1.js.LICENSE.txt */
2
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.IVSBroadcastClient=e():t.IVSBroadcastClient=e()}(self,(()=>(()=>{var t={9669:(t,e,n)=>{t.exports=n(1609)},5448:(t,e,n)=>{"use strict";var r=n(4867),i=n(6026),o=n(4372),s=n(5327),a=n(4097),c=n(4109),u=n(7985),d=n(7874),l=n(2648),h=n(644),p=n(205);t.exports=function(t){return new Promise((function(e,n){var f,g=t.data,v=t.headers,m=t.responseType;function _(){t.cancelToken&&t.cancelToken.unsubscribe(f),t.signal&&t.signal.removeEventListener("abort",f)}r.isFormData(g)&&r.isStandardBrowserEnv()&&delete v["Content-Type"];var S=new XMLHttpRequest;if(t.auth){var E=t.auth.username||"",y=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";v.Authorization="Basic "+btoa(E+":"+y)}var b=a(t.baseURL,t.url);function C(){if(S){var r="getAllResponseHeaders"in S?c(S.getAllResponseHeaders()):null,o={data:m&&"text"!==m&&"json"!==m?S.response:S.responseText,status:S.status,statusText:S.statusText,headers:r,config:t,request:S};i((function(t){e(t),_()}),(function(t){n(t),_()}),o),S=null}}if(S.open(t.method.toUpperCase(),s(b,t.params,t.paramsSerializer),!0),S.timeout=t.timeout,"onloadend"in S?S.onloadend=C:S.onreadystatechange=function(){S&&4===S.readyState&&(0!==S.status||S.responseURL&&0===S.responseURL.indexOf("file:"))&&setTimeout(C)},S.onabort=function(){S&&(n(new l("Request aborted",l.ECONNABORTED,t,S)),S=null)},S.onerror=function(){n(new l("Network Error",l.ERR_NETWORK,t,S,S)),S=null},S.ontimeout=function(){var e=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",r=t.transitional||d;t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),n(new l(e,r.clarifyTimeoutError?l.ETIMEDOUT:l.ECONNABORTED,t,S)),S=null},r.isStandardBrowserEnv()){var T=(t.withCredentials||u(b))&&t.xsrfCookieName?o.read(t.xsrfCookieName):void 0;T&&(v[t.xsrfHeaderName]=T)}"setRequestHeader"in S&&r.forEach(v,(function(t,e){void 0===g&&"content-type"===e.toLowerCase()?delete v[e]:S.setRequestHeader(e,t)})),r.isUndefined(t.withCredentials)||(S.withCredentials=!!t.withCredentials),m&&"json"!==m&&(S.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&S.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&S.upload&&S.upload.addEventListener("progress",t.onUploadProgress),(t.cancelToken||t.signal)&&(f=function(t){S&&(n(!t||t&&t.type?new h:t),S.abort(),S=null)},t.cancelToken&&t.cancelToken.subscribe(f),t.signal&&(t.signal.aborted?f():t.signal.addEventListener("abort",f))),g||(g=null);var w=p(b);w&&-1===["http","https","file"].indexOf(w)?n(new l("Unsupported protocol "+w+":",l.ERR_BAD_REQUEST,t)):S.send(g)}))}},1609:(t,e,n)=>{"use strict";var r=n(4867),i=n(1849),o=n(321),s=n(7185);var a=function t(e){var n=new o(e),a=i(o.prototype.request,n);return r.extend(a,o.prototype,n),r.extend(a,n),a.create=function(n){return t(s(e,n))},a}(n(5546));a.Axios=o,a.CanceledError=n(644),a.CancelToken=n(4972),a.isCancel=n(6502),a.VERSION=n(7288).version,a.toFormData=n(7675),a.AxiosError=n(2648),a.Cancel=a.CanceledError,a.all=function(t){return Promise.all(t)},a.spread=n(8713),a.isAxiosError=n(6268),t.exports=a,t.exports.default=a},4972:(t,e,n)=>{"use strict";var r=n(644);function i(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise((function(t){e=t}));var n=this;this.promise.then((function(t){if(n._listeners){var e,r=n._listeners.length;for(e=0;e<r;e++)n._listeners[e](t);n._listeners=null}})),this.promise.then=function(t){var e,r=new Promise((function(t){n.subscribe(t),e=t})).then(t);return r.cancel=function(){n.unsubscribe(e)},r},t((function(t){n.reason||(n.reason=new r(t),e(n.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.prototype.subscribe=function(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]},i.prototype.unsubscribe=function(t){if(this._listeners){var e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}},i.source=function(){var t;return{token:new i((function(e){t=e})),cancel:t}},t.exports=i},644:(t,e,n)=>{"use strict";var r=n(2648);function i(t){r.call(this,null==t?"canceled":t,r.ERR_CANCELED),this.name="CanceledError"}n(4867).inherits(i,r,{__CANCEL__:!0}),t.exports=i},6502:t=>{"use strict";t.exports=function(t){return!(!t||!t.__CANCEL__)}},321:(t,e,n)=>{"use strict";var r=n(4867),i=n(5327),o=n(782),s=n(3572),a=n(7185),c=n(4097),u=n(4875),d=u.validators;function l(t){this.defaults=t,this.interceptors={request:new o,response:new o}}l.prototype.request=function(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},(e=a(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var n=e.transitional;void 0!==n&&u.assertOptions(n,{silentJSONParsing:d.transitional(d.boolean),forcedJSONParsing:d.transitional(d.boolean),clarifyTimeoutError:d.transitional(d.boolean)},!1);var r=[],i=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(i=i&&t.synchronous,r.unshift(t.fulfilled,t.rejected))}));var o,c=[];if(this.interceptors.response.forEach((function(t){c.push(t.fulfilled,t.rejected)})),!i){var l=[s,void 0];for(Array.prototype.unshift.apply(l,r),l=l.concat(c),o=Promise.resolve(e);l.length;)o=o.then(l.shift(),l.shift());return o}for(var h=e;r.length;){var p=r.shift(),f=r.shift();try{h=p(h)}catch(t){f(t);break}}try{o=s(h)}catch(t){return Promise.reject(t)}for(;c.length;)o=o.then(c.shift(),c.shift());return o},l.prototype.getUri=function(t){t=a(this.defaults,t);var e=c(t.baseURL,t.url);return i(e,t.params,t.paramsSerializer)},r.forEach(["delete","get","head","options"],(function(t){l.prototype[t]=function(e,n){return this.request(a(n||{},{method:t,url:e,data:(n||{}).data}))}})),r.forEach(["post","put","patch"],(function(t){function e(e){return function(n,r,i){return this.request(a(i||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}l.prototype[t]=e(),l.prototype[t+"Form"]=e(!0)})),t.exports=l},2648:(t,e,n)=>{"use strict";var r=n(4867);function i(t,e,n,r,i){Error.call(this),this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i)}r.inherits(i,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var o=i.prototype,s={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED"].forEach((function(t){s[t]={value:t}})),Object.defineProperties(i,s),Object.defineProperty(o,"isAxiosError",{value:!0}),i.from=function(t,e,n,s,a,c){var u=Object.create(o);return r.toFlatObject(t,u,(function(t){return t!==Error.prototype})),i.call(u,t.message,e,n,s,a),u.name=t.name,c&&Object.assign(u,c),u},t.exports=i},782:(t,e,n)=>{"use strict";var r=n(4867);function i(){this.handlers=[]}i.prototype.use=function(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},i.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},i.prototype.forEach=function(t){r.forEach(this.handlers,(function(e){null!==e&&t(e)}))},t.exports=i},4097:(t,e,n)=>{"use strict";var r=n(1793),i=n(7303);t.exports=function(t,e){return t&&!r(e)?i(t,e):e}},3572:(t,e,n)=>{"use strict";var r=n(4867),i=n(8527),o=n(6502),s=n(5546),a=n(644);function c(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new a}t.exports=function(t){return c(t),t.headers=t.headers||{},t.data=i.call(t,t.data,t.headers,t.transformRequest),t.headers=r.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),r.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||s.adapter)(t).then((function(e){return c(t),e.data=i.call(t,e.data,e.headers,t.transformResponse),e}),(function(e){return o(e)||(c(t),e&&e.response&&(e.response.data=i.call(t,e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))}},7185:(t,e,n)=>{"use strict";var r=n(4867);t.exports=function(t,e){e=e||{};var n={};function i(t,e){return r.isPlainObject(t)&&r.isPlainObject(e)?r.merge(t,e):r.isPlainObject(e)?r.merge({},e):r.isArray(e)?e.slice():e}function o(n){return r.isUndefined(e[n])?r.isUndefined(t[n])?void 0:i(void 0,t[n]):i(t[n],e[n])}function s(t){if(!r.isUndefined(e[t]))return i(void 0,e[t])}function a(n){return r.isUndefined(e[n])?r.isUndefined(t[n])?void 0:i(void 0,t[n]):i(void 0,e[n])}function c(n){return n in e?i(t[n],e[n]):n in t?i(void 0,t[n]):void 0}var u={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:c};return r.forEach(Object.keys(t).concat(Object.keys(e)),(function(t){var e=u[t]||o,i=e(t);r.isUndefined(i)&&e!==c||(n[t]=i)})),n}},6026:(t,e,n)=>{"use strict";var r=n(2648);t.exports=function(t,e,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?e(new r("Request failed with status code "+n.status,[r.ERR_BAD_REQUEST,r.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):t(n)}},8527:(t,e,n)=>{"use strict";var r=n(4867),i=n(5546);t.exports=function(t,e,n){var o=this||i;return r.forEach(n,(function(n){t=n.call(o,t,e)})),t}},5546:(t,e,n)=>{"use strict";var r=n(4867),i=n(6016),o=n(2648),s=n(7874),a=n(7675),c={"Content-Type":"application/x-www-form-urlencoded"};function u(t,e){!r.isUndefined(t)&&r.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var d,l={transitional:s,adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(d=n(5448)),d),transformRequest:[function(t,e){if(i(e,"Accept"),i(e,"Content-Type"),r.isFormData(t)||r.isArrayBuffer(t)||r.isBuffer(t)||r.isStream(t)||r.isFile(t)||r.isBlob(t))return t;if(r.isArrayBufferView(t))return t.buffer;if(r.isURLSearchParams(t))return u(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString();var n,o=r.isObject(t),s=e&&e["Content-Type"];if((n=r.isFileList(t))||o&&"multipart/form-data"===s){var c=this.env&&this.env.FormData;return a(n?{"files[]":t}:t,c&&new c)}return o||"application/json"===s?(u(e,"application/json"),function(t,e,n){if(r.isString(t))try{return(e||JSON.parse)(t),r.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(n||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var e=this.transitional||l.transitional,n=e&&e.silentJSONParsing,i=e&&e.forcedJSONParsing,s=!n&&"json"===this.responseType;if(s||i&&r.isString(t)&&t.length)try{return JSON.parse(t)}catch(t){if(s){if("SyntaxError"===t.name)throw o.from(t,o.ERR_BAD_RESPONSE,this,null,this.response);throw t}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:n(1623)},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};r.forEach(["delete","get","head"],(function(t){l.headers[t]={}})),r.forEach(["post","put","patch"],(function(t){l.headers[t]=r.merge(c)})),t.exports=l},7874:t=>{"use strict";t.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}},7288:t=>{t.exports={version:"0.27.2"}},1849:t=>{"use strict";t.exports=function(t,e){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return t.apply(e,n)}}},5327:(t,e,n)=>{"use strict";var r=n(4867);function i(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}t.exports=function(t,e,n){if(!e)return t;var o;if(n)o=n(e);else if(r.isURLSearchParams(e))o=e.toString();else{var s=[];r.forEach(e,(function(t,e){null!=t&&(r.isArray(t)?e+="[]":t=[t],r.forEach(t,(function(t){r.isDate(t)?t=t.toISOString():r.isObject(t)&&(t=JSON.stringify(t)),s.push(i(e)+"="+i(t))})))})),o=s.join("&")}if(o){var a=t.indexOf("#");-1!==a&&(t=t.slice(0,a)),t+=(-1===t.indexOf("?")?"?":"&")+o}return t}},7303:t=>{"use strict";t.exports=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}},4372:(t,e,n)=>{"use strict";var r=n(4867);t.exports=r.isStandardBrowserEnv()?{write:function(t,e,n,i,o,s){var a=[];a.push(t+"="+encodeURIComponent(e)),r.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.isString(i)&&a.push("path="+i),r.isString(o)&&a.push("domain="+o),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},1793:t=>{"use strict";t.exports=function(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}},6268:(t,e,n)=>{"use strict";var r=n(4867);t.exports=function(t){return r.isObject(t)&&!0===t.isAxiosError}},7985:(t,e,n)=>{"use strict";var r=n(4867);t.exports=r.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(t){var r=t;return e&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return t=i(window.location.href),function(e){var n=r.isString(e)?i(e):e;return n.protocol===t.protocol&&n.host===t.host}}():function(){return!0}},6016:(t,e,n)=>{"use strict";var r=n(4867);t.exports=function(t,e){r.forEach(t,(function(n,r){r!==e&&r.toUpperCase()===e.toUpperCase()&&(t[e]=n,delete t[r])}))}},1623:t=>{t.exports=null},4109:(t,e,n)=>{"use strict";var r=n(4867),i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];t.exports=function(t){var e,n,o,s={};return t?(r.forEach(t.split("\n"),(function(t){if(o=t.indexOf(":"),e=r.trim(t.substr(0,o)).toLowerCase(),n=r.trim(t.substr(o+1)),e){if(s[e]&&i.indexOf(e)>=0)return;s[e]="set-cookie"===e?(s[e]?s[e]:[]).concat([n]):s[e]?s[e]+", "+n:n}})),s):s}},205:t=>{"use strict";t.exports=function(t){var e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}},8713:t=>{"use strict";t.exports=function(t){return function(e){return t.apply(null,e)}}},7675:(t,e,n)=>{"use strict";var r=n(4867);t.exports=function(t,e){e=e||new FormData;var n=[];function i(t){return null===t?"":r.isDate(t)?t.toISOString():r.isArrayBuffer(t)||r.isTypedArray(t)?"function"==typeof Blob?new Blob([t]):Buffer.from(t):t}return function t(o,s){if(r.isPlainObject(o)||r.isArray(o)){if(-1!==n.indexOf(o))throw Error("Circular reference detected in "+s);n.push(o),r.forEach(o,(function(n,o){if(!r.isUndefined(n)){var a,c=s?s+"."+o:o;if(n&&!s&&"object"==typeof n)if(r.endsWith(o,"{}"))n=JSON.stringify(n);else if(r.endsWith(o,"[]")&&(a=r.toArray(n)))return void a.forEach((function(t){!r.isUndefined(t)&&e.append(c,i(t))}));t(n,c)}})),n.pop()}else e.append(s,i(o))}(t),e}},4875:(t,e,n)=>{"use strict";var r=n(7288).version,i=n(2648),o={};["object","boolean","number","function","string","symbol"].forEach((function(t,e){o[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}}));var s={};o.transitional=function(t,e,n){function o(t,e){return"[Axios v"+r+"] Transitional option '"+t+"'"+e+(n?". "+n:"")}return function(n,r,a){if(!1===t)throw new i(o(r," has been removed"+(e?" in "+e:"")),i.ERR_DEPRECATED);return e&&!s[r]&&(s[r]=!0,console.warn(o(r," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(n,r,a)}},t.exports={assertOptions:function(t,e,n){if("object"!=typeof t)throw new i("options must be an object",i.ERR_BAD_OPTION_VALUE);for(var r=Object.keys(t),o=r.length;o-- >0;){var s=r[o],a=e[s];if(a){var c=t[s],u=void 0===c||a(c,s,t);if(!0!==u)throw new i("option "+s+" must be "+u,i.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new i("Unknown option "+s,i.ERR_BAD_OPTION)}},validators:o}},4867:(t,e,n)=>{"use strict";var r,i=n(1849),o=Object.prototype.toString,s=(r=Object.create(null),function(t){var e=o.call(t);return r[e]||(r[e]=e.slice(8,-1).toLowerCase())});function a(t){return t=t.toLowerCase(),function(e){return s(e)===t}}function c(t){return Array.isArray(t)}function u(t){return void 0===t}var d=a("ArrayBuffer");function l(t){return null!==t&&"object"==typeof t}function h(t){if("object"!==s(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}var p=a("Date"),f=a("File"),g=a("Blob"),v=a("FileList");function m(t){return"[object Function]"===o.call(t)}var _=a("URLSearchParams");function S(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),c(t))for(var n=0,r=t.length;n<r;n++)e.call(null,t[n],n,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}var E,y=(E="undefined"!=typeof Uint8Array&&Object.getPrototypeOf(Uint8Array),function(t){return E&&t instanceof E});t.exports={isArray:c,isArrayBuffer:d,isBuffer:function(t){return null!==t&&!u(t)&&null!==t.constructor&&!u(t.constructor)&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},isFormData:function(t){var e="[object FormData]";return t&&("function"==typeof FormData&&t instanceof FormData||o.call(t)===e||m(t.toString)&&t.toString()===e)},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&d(t.buffer)},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:l,isPlainObject:h,isUndefined:u,isDate:p,isFile:f,isBlob:g,isFunction:m,isStream:function(t){return l(t)&&m(t.pipe)},isURLSearchParams:_,isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:S,merge:function t(){var e={};function n(n,r){h(e[r])&&h(n)?e[r]=t(e[r],n):h(n)?e[r]=t({},n):c(n)?e[r]=n.slice():e[r]=n}for(var r=0,i=arguments.length;r<i;r++)S(arguments[r],n);return e},extend:function(t,e,n){return S(e,(function(e,r){t[r]=n&&"function"==typeof e?i(e,n):e})),t},trim:function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")},stripBOM:function(t){return 65279===t.charCodeAt(0)&&(t=t.slice(1)),t},inherits:function(t,e,n,r){t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,n&&Object.assign(t.prototype,n)},toFlatObject:function(t,e,n){var r,i,o,s={};e=e||{};do{for(i=(r=Object.getOwnPropertyNames(t)).length;i-- >0;)s[o=r[i]]||(e[o]=t[o],s[o]=!0);t=Object.getPrototypeOf(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},kindOf:s,kindOfTest:a,endsWith:function(t,e,n){t=String(t),(void 0===n||n>t.length)&&(n=t.length),n-=e.length;var r=t.indexOf(e,n);return-1!==r&&r===n},toArray:function(t){if(!t)return null;var e=t.length;if(u(e))return null;for(var n=new Array(e);e-- >0;)n[e]=t[e];return n},isTypedArray:y,isFileList:v}},1206:function(t){t.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=90)}({17:function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;var r=n(18),i=function(){function t(){}return t.getFirstMatch=function(t,e){var n=e.match(t);return n&&n.length>0&&n[1]||""},t.getSecondMatch=function(t,e){var n=e.match(t);return n&&n.length>1&&n[2]||""},t.matchAndReturnConst=function(t,e,n){if(t.test(e))return n},t.getWindowsVersionName=function(t){switch(t){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},t.getMacOSVersionName=function(t){var e=t.split(".").splice(0,2).map((function(t){return parseInt(t,10)||0}));if(e.push(0),10===e[0])switch(e[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},t.getAndroidVersionName=function(t){var e=t.split(".").splice(0,2).map((function(t){return parseInt(t,10)||0}));if(e.push(0),!(1===e[0]&&e[1]<5))return 1===e[0]&&e[1]<6?"Cupcake":1===e[0]&&e[1]>=6?"Donut":2===e[0]&&e[1]<2?"Eclair":2===e[0]&&2===e[1]?"Froyo":2===e[0]&&e[1]>2?"Gingerbread":3===e[0]?"Honeycomb":4===e[0]&&e[1]<1?"Ice Cream Sandwich":4===e[0]&&e[1]<4?"Jelly Bean":4===e[0]&&e[1]>=4?"KitKat":5===e[0]?"Lollipop":6===e[0]?"Marshmallow":7===e[0]?"Nougat":8===e[0]?"Oreo":9===e[0]?"Pie":void 0},t.getVersionPrecision=function(t){return t.split(".").length},t.compareVersions=function(e,n,r){void 0===r&&(r=!1);var i=t.getVersionPrecision(e),o=t.getVersionPrecision(n),s=Math.max(i,o),a=0,c=t.map([e,n],(function(e){var n=s-t.getVersionPrecision(e),r=e+new Array(n+1).join(".0");return t.map(r.split("."),(function(t){return new Array(20-t.length).join("0")+t})).reverse()}));for(r&&(a=s-Math.min(i,o)),s-=1;s>=a;){if(c[0][s]>c[1][s])return 1;if(c[0][s]===c[1][s]){if(s===a)return 0;s-=1}else if(c[0][s]<c[1][s])return-1}},t.map=function(t,e){var n,r=[];if(Array.prototype.map)return Array.prototype.map.call(t,e);for(n=0;n<t.length;n+=1)r.push(e(t[n]));return r},t.find=function(t,e){var n,r;if(Array.prototype.find)return Array.prototype.find.call(t,e);for(n=0,r=t.length;n<r;n+=1){var i=t[n];if(e(i,n))return i}},t.assign=function(t){for(var e,n,r=t,i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];if(Object.assign)return Object.assign.apply(Object,[t].concat(o));var a=function(){var t=o[e];"object"==typeof t&&null!==t&&Object.keys(t).forEach((function(e){r[e]=t[e]}))};for(e=0,n=o.length;e<n;e+=1)a();return t},t.getBrowserAlias=function(t){return r.BROWSER_ALIASES_MAP[t]},t.getBrowserTypeByAlias=function(t){return r.BROWSER_MAP[t]||""},t}();e.default=i,t.exports=e.default},18:function(t,e,n){"use strict";e.__esModule=!0,e.ENGINE_MAP=e.OS_MAP=e.PLATFORMS_MAP=e.BROWSER_MAP=e.BROWSER_ALIASES_MAP=void 0,e.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},e.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},e.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},e.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},e.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;var r,i=(r=n(91))&&r.__esModule?r:{default:r},o=n(18);function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var a=function(){function t(){}var e,n,r;return t.getParser=function(t,e){if(void 0===e&&(e=!1),"string"!=typeof t)throw new Error("UserAgent should be a string");return new i.default(t,e)},t.parse=function(t){return new i.default(t).getResult()},e=t,r=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}],(n=null)&&s(e.prototype,n),r&&s(e,r),t}();e.default=a,t.exports=e.default},91:function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;var r=c(n(92)),i=c(n(93)),o=c(n(94)),s=c(n(95)),a=c(n(17));function c(t){return t&&t.__esModule?t:{default:t}}var u=function(){function t(t,e){if(void 0===e&&(e=!1),null==t||""===t)throw new Error("UserAgent parameter can't be empty");this._ua=t,this.parsedResult={},!0!==e&&this.parse()}var e=t.prototype;return e.getUA=function(){return this._ua},e.test=function(t){return t.test(this._ua)},e.parseBrowser=function(){var t=this;this.parsedResult.browser={};var e=a.default.find(r.default,(function(e){if("function"==typeof e.test)return e.test(t);if(e.test instanceof Array)return e.test.some((function(e){return t.test(e)}));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.browser=e.describe(this.getUA())),this.parsedResult.browser},e.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},e.getBrowserName=function(t){return t?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},e.getBrowserVersion=function(){return this.getBrowser().version},e.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},e.parseOS=function(){var t=this;this.parsedResult.os={};var e=a.default.find(i.default,(function(e){if("function"==typeof e.test)return e.test(t);if(e.test instanceof Array)return e.test.some((function(e){return t.test(e)}));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.os=e.describe(this.getUA())),this.parsedResult.os},e.getOSName=function(t){var e=this.getOS().name;return t?String(e).toLowerCase()||"":e||""},e.getOSVersion=function(){return this.getOS().version},e.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},e.getPlatformType=function(t){void 0===t&&(t=!1);var e=this.getPlatform().type;return t?String(e).toLowerCase()||"":e||""},e.parsePlatform=function(){var t=this;this.parsedResult.platform={};var e=a.default.find(o.default,(function(e){if("function"==typeof e.test)return e.test(t);if(e.test instanceof Array)return e.test.some((function(e){return t.test(e)}));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.platform=e.describe(this.getUA())),this.parsedResult.platform},e.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},e.getEngineName=function(t){return t?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},e.parseEngine=function(){var t=this;this.parsedResult.engine={};var e=a.default.find(s.default,(function(e){if("function"==typeof e.test)return e.test(t);if(e.test instanceof Array)return e.test.some((function(e){return t.test(e)}));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.engine=e.describe(this.getUA())),this.parsedResult.engine},e.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},e.getResult=function(){return a.default.assign({},this.parsedResult)},e.satisfies=function(t){var e=this,n={},r=0,i={},o=0;if(Object.keys(t).forEach((function(e){var s=t[e];"string"==typeof s?(i[e]=s,o+=1):"object"==typeof s&&(n[e]=s,r+=1)})),r>0){var s=Object.keys(n),c=a.default.find(s,(function(t){return e.isOS(t)}));if(c){var u=this.satisfies(n[c]);if(void 0!==u)return u}var d=a.default.find(s,(function(t){return e.isPlatform(t)}));if(d){var l=this.satisfies(n[d]);if(void 0!==l)return l}}if(o>0){var h=Object.keys(i),p=a.default.find(h,(function(t){return e.isBrowser(t,!0)}));if(void 0!==p)return this.compareVersion(i[p])}},e.isBrowser=function(t,e){void 0===e&&(e=!1);var n=this.getBrowserName().toLowerCase(),r=t.toLowerCase(),i=a.default.getBrowserTypeByAlias(r);return e&&i&&(r=i.toLowerCase()),r===n},e.compareVersion=function(t){var e=[0],n=t,r=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===t[0]||"<"===t[0]?(n=t.substr(1),"="===t[1]?(r=!0,n=t.substr(2)):e=[],">"===t[0]?e.push(1):e.push(-1)):"="===t[0]?n=t.substr(1):"~"===t[0]&&(r=!0,n=t.substr(1)),e.indexOf(a.default.compareVersions(i,n,r))>-1},e.isOS=function(t){return this.getOSName(!0)===String(t).toLowerCase()},e.isPlatform=function(t){return this.getPlatformType(!0)===String(t).toLowerCase()},e.isEngine=function(t){return this.getEngineName(!0)===String(t).toLowerCase()},e.is=function(t,e){return void 0===e&&(e=!1),this.isBrowser(t,e)||this.isOS(t)||this.isPlatform(t)},e.some=function(t){var e=this;return void 0===t&&(t=[]),t.some((function(t){return e.is(t)}))},t}();e.default=u,t.exports=e.default},92:function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=/version\/(\d+(\.?_?\d+)+)/i,s=[{test:[/googlebot/i],describe:function(t){var e={name:"Googlebot"},n=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/opera/i],describe:function(t){var e={name:"Opera"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/opr\/|opios/i],describe:function(t){var e={name:"Opera"},n=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/SamsungBrowser/i],describe:function(t){var e={name:"Samsung Internet for Android"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/Whale/i],describe:function(t){var e={name:"NAVER Whale Browser"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/MZBrowser/i],describe:function(t){var e={name:"MZ Browser"},n=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/focus/i],describe:function(t){var e={name:"Focus"},n=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/swing/i],describe:function(t){var e={name:"Swing"},n=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/coast/i],describe:function(t){var e={name:"Opera Coast"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(t){var e={name:"Opera Touch"},n=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/yabrowser/i],describe:function(t){var e={name:"Yandex Browser"},n=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/ucbrowser/i],describe:function(t){var e={name:"UC Browser"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/Maxthon|mxios/i],describe:function(t){var e={name:"Maxthon"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/epiphany/i],describe:function(t){var e={name:"Epiphany"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/puffin/i],describe:function(t){var e={name:"Puffin"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sleipnir/i],describe:function(t){var e={name:"Sleipnir"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/k-meleon/i],describe:function(t){var e={name:"K-Meleon"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/micromessenger/i],describe:function(t){var e={name:"WeChat"},n=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/qqbrowser/i],describe:function(t){var e={name:/qqbrowserlite/i.test(t)?"QQ Browser Lite":"QQ Browser"},n=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/msie|trident/i],describe:function(t){var e={name:"Internet Explorer"},n=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/\sedg\//i],describe:function(t){var e={name:"Microsoft Edge"},n=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/edg([ea]|ios)/i],describe:function(t){var e={name:"Microsoft Edge"},n=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/vivaldi/i],describe:function(t){var e={name:"Vivaldi"},n=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/seamonkey/i],describe:function(t){var e={name:"SeaMonkey"},n=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sailfish/i],describe:function(t){var e={name:"Sailfish"},n=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,t);return n&&(e.version=n),e}},{test:[/silk/i],describe:function(t){var e={name:"Amazon Silk"},n=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/phantom/i],describe:function(t){var e={name:"PhantomJS"},n=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/slimerjs/i],describe:function(t){var e={name:"SlimerJS"},n=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(t){var e={name:"BlackBerry"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/(web|hpw)[o0]s/i],describe:function(t){var e={name:"WebOS Browser"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/bada/i],describe:function(t){var e={name:"Bada"},n=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/tizen/i],describe:function(t){var e={name:"Tizen"},n=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/qupzilla/i],describe:function(t){var e={name:"QupZilla"},n=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/firefox|iceweasel|fxios/i],describe:function(t){var e={name:"Firefox"},n=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/electron/i],describe:function(t){var e={name:"Electron"},n=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/MiuiBrowser/i],describe:function(t){var e={name:"Miui"},n=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/chromium/i],describe:function(t){var e={name:"Chromium"},n=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/chrome|crios|crmo/i],describe:function(t){var e={name:"Chrome"},n=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/GSA/i],describe:function(t){var e={name:"Google Search"},n=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:function(t){var e=!t.test(/like android/i),n=t.test(/android/i);return e&&n},describe:function(t){var e={name:"Android Browser"},n=i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/playstation 4/i],describe:function(t){var e={name:"PlayStation 4"},n=i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/safari|applewebkit/i],describe:function(t){var e={name:"Safari"},n=i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/.*/i],describe:function(t){var e=-1!==t.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(e,t),version:i.default.getSecondMatch(e,t)}}}];e.default=s,t.exports=e.default},93:function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/Roku\/DVP/],describe:function(t){var e=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,t);return{name:o.OS_MAP.Roku,version:e}}},{test:[/windows phone/i],describe:function(t){var e=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,t);return{name:o.OS_MAP.WindowsPhone,version:e}}},{test:[/windows /i],describe:function(t){var e=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,t),n=i.default.getWindowsVersionName(e);return{name:o.OS_MAP.Windows,version:e,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(t){var e={name:o.OS_MAP.iOS},n=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,t);return n&&(e.version=n),e}},{test:[/macintosh/i],describe:function(t){var e=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,t).replace(/[_\s]/g,"."),n=i.default.getMacOSVersionName(e),r={name:o.OS_MAP.MacOS,version:e};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe:function(t){var e=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,t).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:e}}},{test:function(t){var e=!t.test(/like android/i),n=t.test(/android/i);return e&&n},describe:function(t){var e=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,t),n=i.default.getAndroidVersionName(e),r={name:o.OS_MAP.Android,version:e};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe:function(t){var e=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,t),n={name:o.OS_MAP.WebOS};return e&&e.length&&(n.version=e),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(t){var e=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,t)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,t)||i.default.getFirstMatch(/\bbb(\d+)/i,t);return{name:o.OS_MAP.BlackBerry,version:e}}},{test:[/bada/i],describe:function(t){var e=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,t);return{name:o.OS_MAP.Bada,version:e}}},{test:[/tizen/i],describe:function(t){var e=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,t);return{name:o.OS_MAP.Tizen,version:e}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(t){var e=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,t);return{name:o.OS_MAP.PlayStation4,version:e}}}];e.default=s,t.exports=e.default},94:function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(t){var e=i.default.getFirstMatch(/(can-l01)/i,t)&&"Nova",n={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return e&&(n.model=e),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(t){var e=t.test(/ipod|iphone/i),n=t.test(/like (ipod|iphone)/i);return e&&!n},describe:function(t){var e=i.default.getFirstMatch(/(ipod|iphone)/i,t);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:e}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(t){return"blackberry"===t.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(t){return"bada"===t.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(t){return"windows phone"===t.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(t){var e=Number(String(t.getOSVersion()).split(".")[0]);return"android"===t.getOSName(!0)&&e>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(t){return"android"===t.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(t){return"macos"===t.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(t){return"windows"===t.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(t){return"linux"===t.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(t){return"playstation 4"===t.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(t){return"roku"===t.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];e.default=s,t.exports=e.default},95:function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:function(t){return"microsoft edge"===t.getBrowserName(!0)},describe:function(t){if(/\sedg\//i.test(t))return{name:o.ENGINE_MAP.Blink};var e=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,t);return{name:o.ENGINE_MAP.EdgeHTML,version:e}}},{test:[/trident/i],describe:function(t){var e={name:o.ENGINE_MAP.Trident},n=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:function(t){return t.test(/presto/i)},describe:function(t){var e={name:o.ENGINE_MAP.Presto},n=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:function(t){var e=t.test(/gecko/i),n=t.test(/like gecko/i);return e&&!n},describe:function(t){var e={name:o.ENGINE_MAP.Gecko},n=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(t){var e={name:o.ENGINE_MAP.WebKit},n=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}}];e.default=s,t.exports=e.default}})},6729:t=>{"use strict";var e=Object.prototype.hasOwnProperty,n="~";function r(){}function i(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function o(t,e,r,o,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new i(r,o||t,s),c=n?n+e:e;return t._events[c]?t._events[c].fn?t._events[c]=[t._events[c],a]:t._events[c].push(a):(t._events[c]=a,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),a.prototype.eventNames=function(){var t,r,i=[];if(0===this._eventsCount)return i;for(r in t=this._events)e.call(t,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},a.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,s=new Array(o);i<o;i++)s[i]=r[i].fn;return s},a.prototype.listenerCount=function(t){var e=n?n+t:t,r=this._events[e];return r?r.fn?1:r.length:0},a.prototype.emit=function(t,e,r,i,o,s){var a=n?n+t:t;if(!this._events[a])return!1;var c,u,d=this._events[a],l=arguments.length;if(d.fn){switch(d.once&&this.removeListener(t,d.fn,void 0,!0),l){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,e),!0;case 3:return d.fn.call(d.context,e,r),!0;case 4:return d.fn.call(d.context,e,r,i),!0;case 5:return d.fn.call(d.context,e,r,i,o),!0;case 6:return d.fn.call(d.context,e,r,i,o,s),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];d.fn.apply(d.context,c)}else{var h,p=d.length;for(u=0;u<p;u++)switch(d[u].once&&this.removeListener(t,d[u].fn,void 0,!0),l){case 1:d[u].fn.call(d[u].context);break;case 2:d[u].fn.call(d[u].context,e);break;case 3:d[u].fn.call(d[u].context,e,r);break;case 4:d[u].fn.call(d[u].context,e,r,i);break;default:if(!c)for(h=1,c=new Array(l-1);h<l;h++)c[h-1]=arguments[h];d[u].fn.apply(d[u].context,c)}}return!0},a.prototype.on=function(t,e,n){return o(this,t,e,n,!1)},a.prototype.once=function(t,e,n){return o(this,t,e,n,!0)},a.prototype.removeListener=function(t,e,r,i){var o=n?n+t:t;if(!this._events[o])return this;if(!e)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==e||i&&!a.once||r&&a.context!==r||s(this,o);else{for(var c=0,u=[],d=a.length;c<d;c++)(a[c].fn!==e||i&&!a[c].once||r&&a[c].context!==r)&&u.push(a[c]);u.length?this._events[o]=1===u.length?u[0]:u:s(this,o)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&s(this,e)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,t.exports=a},1989:(t,e,n)=>{var r=n(1789),i=n(401),o=n(7667),s=n(1327),a=n(1866);function c(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=o,c.prototype.has=s,c.prototype.set=a,t.exports=c},8407:(t,e,n)=>{var r=n(7040),i=n(4125),o=n(2117),s=n(7518),a=n(4705);function c(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=o,c.prototype.has=s,c.prototype.set=a,t.exports=c},7071:(t,e,n)=>{var r=n(852)(n(5639),"Map");t.exports=r},3369:(t,e,n)=>{var r=n(4785),i=n(1285),o=n(6e3),s=n(9916),a=n(5265);function c(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=o,c.prototype.has=s,c.prototype.set=a,t.exports=c},6384:(t,e,n)=>{var r=n(8407),i=n(7465),o=n(3779),s=n(7599),a=n(4758),c=n(4309);function u(t){var e=this.__data__=new r(t);this.size=e.size}u.prototype.clear=i,u.prototype.delete=o,u.prototype.get=s,u.prototype.has=a,u.prototype.set=c,t.exports=u},2705:(t,e,n)=>{var r=n(5639).Symbol;t.exports=r},1149:(t,e,n)=>{var r=n(5639).Uint8Array;t.exports=r},6874:t=>{t.exports=function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}},4636:(t,e,n)=>{var r=n(2545),i=n(5694),o=n(1469),s=n(4144),a=n(5776),c=n(6719),u=Object.prototype.hasOwnProperty;t.exports=function(t,e){var n=o(t),d=!n&&i(t),l=!n&&!d&&s(t),h=!n&&!d&&!l&&c(t),p=n||d||l||h,f=p?r(t.length,String):[],g=f.length;for(var v in t)!e&&!u.call(t,v)||p&&("length"==v||l&&("offset"==v||"parent"==v)||h&&("buffer"==v||"byteLength"==v||"byteOffset"==v)||a(v,g))||f.push(v);return f}},6556:(t,e,n)=>{var r=n(9465),i=n(7813);t.exports=function(t,e,n){(void 0!==n&&!i(t[e],n)||void 0===n&&!(e in t))&&r(t,e,n)}},4865:(t,e,n)=>{var r=n(9465),i=n(7813),o=Object.prototype.hasOwnProperty;t.exports=function(t,e,n){var s=t[e];o.call(t,e)&&i(s,n)&&(void 0!==n||e in t)||r(t,e,n)}},8470:(t,e,n)=>{var r=n(7813);t.exports=function(t,e){for(var n=t.length;n--;)if(r(t[n][0],e))return n;return-1}},9465:(t,e,n)=>{var r=n(8777);t.exports=function(t,e,n){"__proto__"==e&&r?r(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}},3118:(t,e,n)=>{var r=n(3218),i=Object.create,o=function(){function t(){}return function(e){if(!r(e))return{};if(i)return i(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();t.exports=o},8483:(t,e,n)=>{var r=n(5063)();t.exports=r},4239:(t,e,n)=>{var r=n(2705),i=n(9607),o=n(2333),s="[object Null]",a="[object Undefined]",c=r?r.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?a:s:c&&c in Object(t)?i(t):o(t)}},9454:(t,e,n)=>{var r=n(4239),i=n(7005),o="[object Arguments]";t.exports=function(t){return i(t)&&r(t)==o}},8458:(t,e,n)=>{var r=n(3560),i=n(5346),o=n(3218),s=n(346),a=/^\[object .+?Constructor\]$/,c=Function.prototype,u=Object.prototype,d=c.toString,l=u.hasOwnProperty,h=RegExp("^"+d.call(l).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!o(t)||i(t))&&(r(t)?h:a).test(s(t))}},8749:(t,e,n)=>{var r=n(4239),i=n(1780),o=n(7005),s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1,t.exports=function(t){return o(t)&&i(t.length)&&!!s[r(t)]}},313:(t,e,n)=>{var r=n(3218),i=n(5726),o=n(3498),s=Object.prototype.hasOwnProperty;t.exports=function(t){if(!r(t))return o(t);var e=i(t),n=[];for(var a in t)("constructor"!=a||!e&&s.call(t,a))&&n.push(a);return n}},2980:(t,e,n)=>{var r=n(6384),i=n(6556),o=n(8483),s=n(9783),a=n(3218),c=n(1704),u=n(6390);t.exports=function t(e,n,d,l,h){e!==n&&o(n,(function(o,c){if(h||(h=new r),a(o))s(e,n,c,d,t,l,h);else{var p=l?l(u(e,c),o,c+"",e,n,h):void 0;void 0===p&&(p=o),i(e,c,p)}}),c)}},9783:(t,e,n)=>{var r=n(6556),i=n(4626),o=n(7133),s=n(278),a=n(8517),c=n(5694),u=n(1469),d=n(9246),l=n(4144),h=n(3560),p=n(3218),f=n(8630),g=n(6719),v=n(6390),m=n(9881);t.exports=function(t,e,n,_,S,E,y){var b=v(t,n),C=v(e,n),T=y.get(C);if(T)r(t,n,T);else{var w=E?E(b,C,n+"",t,e,y):void 0,I=void 0===w;if(I){var k=u(C),R=!k&&l(C),O=!k&&!R&&g(C);w=C,k||R||O?u(b)?w=b:d(b)?w=s(b):R?(I=!1,w=i(C,!0)):O?(I=!1,w=o(C,!0)):w=[]:f(C)||c(C)?(w=b,c(b)?w=m(b):p(b)&&!h(b)||(w=a(C))):I=!1}I&&(y.set(C,w),S(w,C,_,E,y),y.delete(C)),r(t,n,w)}}},5976:(t,e,n)=>{var r=n(6557),i=n(5357),o=n(61);t.exports=function(t,e){return o(i(t,e,r),t+"")}},6560:(t,e,n)=>{var r=n(5703),i=n(8777),o=n(6557),s=i?function(t,e){return i(t,"toString",{configurable:!0,enumerable:!1,value:r(e),writable:!0})}:o;t.exports=s},2545:t=>{t.exports=function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}},1717:t=>{t.exports=function(t){return function(e){return t(e)}}},4318:(t,e,n)=>{var r=n(1149);t.exports=function(t){var e=new t.constructor(t.byteLength);return new r(e).set(new r(t)),e}},4626:(t,e,n)=>{t=n.nmd(t);var r=n(5639),i=e&&!e.nodeType&&e,o=i&&t&&!t.nodeType&&t,s=o&&o.exports===i?r.Buffer:void 0,a=s?s.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var n=t.length,r=a?a(n):new t.constructor(n);return t.copy(r),r}},7133:(t,e,n)=>{var r=n(4318);t.exports=function(t,e){var n=e?r(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}},278:t=>{t.exports=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}},8363:(t,e,n)=>{var r=n(4865),i=n(9465);t.exports=function(t,e,n,o){var s=!n;n||(n={});for(var a=-1,c=e.length;++a<c;){var u=e[a],d=o?o(n[u],t[u],u,n,t):void 0;void 0===d&&(d=t[u]),s?i(n,u,d):r(n,u,d)}return n}},4429:(t,e,n)=>{var r=n(5639)["__core-js_shared__"];t.exports=r},1463:(t,e,n)=>{var r=n(5976),i=n(6612);t.exports=function(t){return r((function(e,n){var r=-1,o=n.length,s=o>1?n[o-1]:void 0,a=o>2?n[2]:void 0;for(s=t.length>3&&"function"==typeof s?(o--,s):void 0,a&&i(n[0],n[1],a)&&(s=o<3?void 0:s,o=1),e=Object(e);++r<o;){var c=n[r];c&&t(e,c,r,s)}return e}))}},5063:t=>{t.exports=function(t){return function(e,n,r){for(var i=-1,o=Object(e),s=r(e),a=s.length;a--;){var c=s[t?a:++i];if(!1===n(o[c],c,o))break}return e}}},8777:(t,e,n)=>{var r=n(852),i=function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=i},1957:(t,e,n)=>{var r="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;t.exports=r},5050:(t,e,n)=>{var r=n(7019);t.exports=function(t,e){var n=t.__data__;return r(e)?n["string"==typeof e?"string":"hash"]:n.map}},852:(t,e,n)=>{var r=n(8458),i=n(7801);t.exports=function(t,e){var n=i(t,e);return r(n)?n:void 0}},5924:(t,e,n)=>{var r=n(5569)(Object.getPrototypeOf,Object);t.exports=r},9607:(t,e,n)=>{var r=n(2705),i=Object.prototype,o=i.hasOwnProperty,s=i.toString,a=r?r.toStringTag:void 0;t.exports=function(t){var e=o.call(t,a),n=t[a];try{t[a]=void 0;var r=!0}catch(t){}var i=s.call(t);return r&&(e?t[a]=n:delete t[a]),i}},7801:t=>{t.exports=function(t,e){return null==t?void 0:t[e]}},1789:(t,e,n)=>{var r=n(4536);t.exports=function(){this.__data__=r?r(null):{},this.size=0}},401:t=>{t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},7667:(t,e,n)=>{var r=n(4536),i="__lodash_hash_undefined__",o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(r){var n=e[t];return n===i?void 0:n}return o.call(e,t)?e[t]:void 0}},1327:(t,e,n)=>{var r=n(4536),i=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return r?void 0!==e[t]:i.call(e,t)}},1866:(t,e,n)=>{var r=n(4536),i="__lodash_hash_undefined__";t.exports=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=r&&void 0===e?i:e,this}},8517:(t,e,n)=>{var r=n(3118),i=n(5924),o=n(5726);t.exports=function(t){return"function"!=typeof t.constructor||o(t)?{}:r(i(t))}},5776:t=>{var e=9007199254740991,n=/^(?:0|[1-9]\d*)$/;t.exports=function(t,r){var i=typeof t;return!!(r=null==r?e:r)&&("number"==i||"symbol"!=i&&n.test(t))&&t>-1&&t%1==0&&t<r}},6612:(t,e,n)=>{var r=n(7813),i=n(8612),o=n(5776),s=n(3218);t.exports=function(t,e,n){if(!s(n))return!1;var a=typeof e;return!!("number"==a?i(n)&&o(e,n.length):"string"==a&&e in n)&&r(n[e],t)}},7019:t=>{t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},5346:(t,e,n)=>{var r,i=n(4429),o=(r=/[^.]+$/.exec(i&&i.keys&&i.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";t.exports=function(t){return!!o&&o in t}},5726:t=>{var e=Object.prototype;t.exports=function(t){var n=t&&t.constructor;return t===("function"==typeof n&&n.prototype||e)}},7040:t=>{t.exports=function(){this.__data__=[],this.size=0}},4125:(t,e,n)=>{var r=n(8470),i=Array.prototype.splice;t.exports=function(t){var e=this.__data__,n=r(e,t);return!(n<0)&&(n==e.length-1?e.pop():i.call(e,n,1),--this.size,!0)}},2117:(t,e,n)=>{var r=n(8470);t.exports=function(t){var e=this.__data__,n=r(e,t);return n<0?void 0:e[n][1]}},7518:(t,e,n)=>{var r=n(8470);t.exports=function(t){return r(this.__data__,t)>-1}},4705:(t,e,n)=>{var r=n(8470);t.exports=function(t,e){var n=this.__data__,i=r(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this}},4785:(t,e,n)=>{var r=n(1989),i=n(8407),o=n(7071);t.exports=function(){this.size=0,this.__data__={hash:new r,map:new(o||i),string:new r}}},1285:(t,e,n)=>{var r=n(5050);t.exports=function(t){var e=r(this,t).delete(t);return this.size-=e?1:0,e}},6e3:(t,e,n)=>{var r=n(5050);t.exports=function(t){return r(this,t).get(t)}},9916:(t,e,n)=>{var r=n(5050);t.exports=function(t){return r(this,t).has(t)}},5265:(t,e,n)=>{var r=n(5050);t.exports=function(t,e){var n=r(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this}},4536:(t,e,n)=>{var r=n(852)(Object,"create");t.exports=r},3498:t=>{t.exports=function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}},1167:(t,e,n)=>{t=n.nmd(t);var r=n(1957),i=e&&!e.nodeType&&e,o=i&&t&&!t.nodeType&&t,s=o&&o.exports===i&&r.process,a=function(){try{var t=o&&o.require&&o.require("util").types;return t||s&&s.binding&&s.binding("util")}catch(t){}}();t.exports=a},2333:t=>{var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},5569:t=>{t.exports=function(t,e){return function(n){return t(e(n))}}},5357:(t,e,n)=>{var r=n(6874),i=Math.max;t.exports=function(t,e,n){return e=i(void 0===e?t.length-1:e,0),function(){for(var o=arguments,s=-1,a=i(o.length-e,0),c=Array(a);++s<a;)c[s]=o[e+s];s=-1;for(var u=Array(e+1);++s<e;)u[s]=o[s];return u[e]=n(c),r(t,this,u)}}},5639:(t,e,n)=>{var r=n(1957),i="object"==typeof self&&self&&self.Object===Object&&self,o=r||i||Function("return this")();t.exports=o},6390:t=>{t.exports=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}},61:(t,e,n)=>{var r=n(6560),i=n(1275)(r);t.exports=i},1275:t=>{var e=800,n=16,r=Date.now;t.exports=function(t){var i=0,o=0;return function(){var s=r(),a=n-(s-o);if(o=s,a>0){if(++i>=e)return arguments[0]}else i=0;return t.apply(void 0,arguments)}}},7465:(t,e,n)=>{var r=n(8407);t.exports=function(){this.__data__=new r,this.size=0}},3779:t=>{t.exports=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}},7599:t=>{t.exports=function(t){return this.__data__.get(t)}},4758:t=>{t.exports=function(t){return this.__data__.has(t)}},4309:(t,e,n)=>{var r=n(8407),i=n(7071),o=n(3369),s=200;t.exports=function(t,e){var n=this.__data__;if(n instanceof r){var a=n.__data__;if(!i||a.length<s-1)return a.push([t,e]),this.size=++n.size,this;n=this.__data__=new o(a)}return n.set(t,e),this.size=n.size,this}},346:t=>{var e=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return e.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},5703:t=>{t.exports=function(t){return function(){return t}}},7813:t=>{t.exports=function(t,e){return t===e||t!=t&&e!=e}},6557:t=>{t.exports=function(t){return t}},5694:(t,e,n)=>{var r=n(9454),i=n(7005),o=Object.prototype,s=o.hasOwnProperty,a=o.propertyIsEnumerable,c=r(function(){return arguments}())?r:function(t){return i(t)&&s.call(t,"callee")&&!a.call(t,"callee")};t.exports=c},1469:t=>{var e=Array.isArray;t.exports=e},8612:(t,e,n)=>{var r=n(3560),i=n(1780);t.exports=function(t){return null!=t&&i(t.length)&&!r(t)}},9246:(t,e,n)=>{var r=n(8612),i=n(7005);t.exports=function(t){return i(t)&&r(t)}},4144:(t,e,n)=>{t=n.nmd(t);var r=n(5639),i=n(5062),o=e&&!e.nodeType&&e,s=o&&t&&!t.nodeType&&t,a=s&&s.exports===o?r.Buffer:void 0,c=(a?a.isBuffer:void 0)||i;t.exports=c},3560:(t,e,n)=>{var r=n(4239),i=n(3218),o="[object AsyncFunction]",s="[object Function]",a="[object GeneratorFunction]",c="[object Proxy]";t.exports=function(t){if(!i(t))return!1;var e=r(t);return e==s||e==a||e==o||e==c}},1780:t=>{var e=9007199254740991;t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=e}},3218:t=>{t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},7005:t=>{t.exports=function(t){return null!=t&&"object"==typeof t}},8630:(t,e,n)=>{var r=n(4239),i=n(5924),o=n(7005),s="[object Object]",a=Function.prototype,c=Object.prototype,u=a.toString,d=c.hasOwnProperty,l=u.call(Object);t.exports=function(t){if(!o(t)||r(t)!=s)return!1;var e=i(t);if(null===e)return!0;var n=d.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&u.call(n)==l}},6719:(t,e,n)=>{var r=n(8749),i=n(1717),o=n(1167),s=o&&o.isTypedArray,a=s?i(s):r;t.exports=a},1704:(t,e,n)=>{var r=n(4636),i=n(313),o=n(8612);t.exports=function(t){return o(t)?r(t,!0):i(t)}},6486:function(t,e,n){var r;t=n.nmd(t),function(){var i,o="Expected a function",s="__lodash_hash_undefined__",a="__lodash_placeholder__",c=16,u=32,d=64,l=128,h=256,p=1/0,f=9007199254740991,g=NaN,v=4294967295,m=[["ary",l],["bind",1],["bindKey",2],["curry",8],["curryRight",c],["flip",512],["partial",u],["partialRight",d],["rearg",h]],_="[object Arguments]",S="[object Array]",E="[object Boolean]",y="[object Date]",b="[object Error]",C="[object Function]",T="[object GeneratorFunction]",w="[object Map]",I="[object Number]",k="[object Object]",R="[object Promise]",O="[object RegExp]",P="[object Set]",A="[object String]",N="[object Symbol]",D="[object WeakMap]",x="[object ArrayBuffer]",M="[object DataView]",L="[object Float32Array]",U="[object Float64Array]",B="[object Int8Array]",j="[object Int16Array]",F="[object Int32Array]",V="[object Uint8Array]",G="[object Uint8ClampedArray]",W="[object Uint16Array]",$="[object Uint32Array]",z=/\b__p \+= '';/g,H=/\b(__p \+=) '' \+/g,q=/(__e\(.*?\)|\b__t\)) \+\n'';/g,J=/&(?:amp|lt|gt|quot|#39);/g,K=/[&<>"']/g,X=RegExp(J.source),Y=RegExp(K.source),Q=/<%-([\s\S]+?)%>/g,Z=/<%([\s\S]+?)%>/g,tt=/<%=([\s\S]+?)%>/g,et=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nt=/^\w*$/,rt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,it=/[\\^$.*+?()[\]{}|]/g,ot=RegExp(it.source),st=/^\s+/,at=/\s/,ct=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ut=/\{\n\/\* \[wrapped with (.+)\] \*/,dt=/,? & /,lt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ht=/[()=,{}\[\]\/\s]/,pt=/\\(\\)?/g,ft=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,gt=/\w*$/,vt=/^[-+]0x[0-9a-f]+$/i,mt=/^0b[01]+$/i,_t=/^\[object .+?Constructor\]$/,St=/^0o[0-7]+$/i,Et=/^(?:0|[1-9]\d*)$/,yt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,bt=/($^)/,Ct=/['\n\r\u2028\u2029\\]/g,Tt="\\ud800-\\udfff",wt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",It="\\u2700-\\u27bf",kt="a-z\\xdf-\\xf6\\xf8-\\xff",Rt="A-Z\\xc0-\\xd6\\xd8-\\xde",Ot="\\ufe0e\\ufe0f",Pt="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",At="['’]",Nt="["+Tt+"]",Dt="["+Pt+"]",xt="["+wt+"]",Mt="\\d+",Lt="["+It+"]",Ut="["+kt+"]",Bt="[^"+Tt+Pt+Mt+It+kt+Rt+"]",jt="\\ud83c[\\udffb-\\udfff]",Ft="[^"+Tt+"]",Vt="(?:\\ud83c[\\udde6-\\uddff]){2}",Gt="[\\ud800-\\udbff][\\udc00-\\udfff]",Wt="["+Rt+"]",$t="\\u200d",zt="(?:"+Ut+"|"+Bt+")",Ht="(?:"+Wt+"|"+Bt+")",qt="(?:['’](?:d|ll|m|re|s|t|ve))?",Jt="(?:['’](?:D|LL|M|RE|S|T|VE))?",Kt="(?:"+xt+"|"+jt+")"+"?",Xt="["+Ot+"]?",Yt=Xt+Kt+("(?:"+$t+"(?:"+[Ft,Vt,Gt].join("|")+")"+Xt+Kt+")*"),Qt="(?:"+[Lt,Vt,Gt].join("|")+")"+Yt,Zt="(?:"+[Ft+xt+"?",xt,Vt,Gt,Nt].join("|")+")",te=RegExp(At,"g"),ee=RegExp(xt,"g"),ne=RegExp(jt+"(?="+jt+")|"+Zt+Yt,"g"),re=RegExp([Wt+"?"+Ut+"+"+qt+"(?="+[Dt,Wt,"$"].join("|")+")",Ht+"+"+Jt+"(?="+[Dt,Wt+zt,"$"].join("|")+")",Wt+"?"+zt+"+"+qt,Wt+"+"+Jt,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Mt,Qt].join("|"),"g"),ie=RegExp("["+$t+Tt+wt+Ot+"]"),oe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,se=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ae=-1,ce={};ce[L]=ce[U]=ce[B]=ce[j]=ce[F]=ce[V]=ce[G]=ce[W]=ce[$]=!0,ce[_]=ce[S]=ce[x]=ce[E]=ce[M]=ce[y]=ce[b]=ce[C]=ce[w]=ce[I]=ce[k]=ce[O]=ce[P]=ce[A]=ce[D]=!1;var ue={};ue[_]=ue[S]=ue[x]=ue[M]=ue[E]=ue[y]=ue[L]=ue[U]=ue[B]=ue[j]=ue[F]=ue[w]=ue[I]=ue[k]=ue[O]=ue[P]=ue[A]=ue[N]=ue[V]=ue[G]=ue[W]=ue[$]=!0,ue[b]=ue[C]=ue[D]=!1;var de={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},le=parseFloat,he=parseInt,pe="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,fe="object"==typeof self&&self&&self.Object===Object&&self,ge=pe||fe||Function("return this")(),ve=e&&!e.nodeType&&e,me=ve&&t&&!t.nodeType&&t,_e=me&&me.exports===ve,Se=_e&&pe.process,Ee=function(){try{var t=me&&me.require&&me.require("util").types;return t||Se&&Se.binding&&Se.binding("util")}catch(t){}}(),ye=Ee&&Ee.isArrayBuffer,be=Ee&&Ee.isDate,Ce=Ee&&Ee.isMap,Te=Ee&&Ee.isRegExp,we=Ee&&Ee.isSet,Ie=Ee&&Ee.isTypedArray;function ke(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function Re(t,e,n,r){for(var i=-1,o=null==t?0:t.length;++i<o;){var s=t[i];e(r,s,n(s),t)}return r}function Oe(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}function Pe(t,e){for(var n=null==t?0:t.length;n--&&!1!==e(t[n],n,t););return t}function Ae(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function Ne(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++n<r;){var s=t[n];e(s,n,t)&&(o[i++]=s)}return o}function De(t,e){return!!(null==t?0:t.length)&&We(t,e,0)>-1}function xe(t,e,n){for(var r=-1,i=null==t?0:t.length;++r<i;)if(n(e,t[r]))return!0;return!1}function Me(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}function Le(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}function Ue(t,e,n,r){var i=-1,o=null==t?0:t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}function Be(t,e,n,r){var i=null==t?0:t.length;for(r&&i&&(n=t[--i]);i--;)n=e(n,t[i],i,t);return n}function je(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}var Fe=qe("length");function Ve(t,e,n){var r;return n(t,(function(t,n,i){if(e(t,n,i))return r=n,!1})),r}function Ge(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1}function We(t,e,n){return e==e?function(t,e,n){var r=n-1,i=t.length;for(;++r<i;)if(t[r]===e)return r;return-1}(t,e,n):Ge(t,ze,n)}function $e(t,e,n,r){for(var i=n-1,o=t.length;++i<o;)if(r(t[i],e))return i;return-1}function ze(t){return t!=t}function He(t,e){var n=null==t?0:t.length;return n?Xe(t,e)/n:g}function qe(t){return function(e){return null==e?i:e[t]}}function Je(t){return function(e){return null==t?i:t[e]}}function Ke(t,e,n,r,i){return i(t,(function(t,i,o){n=r?(r=!1,t):e(n,t,i,o)})),n}function Xe(t,e){for(var n,r=-1,o=t.length;++r<o;){var s=e(t[r]);s!==i&&(n=n===i?s:n+s)}return n}function Ye(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function Qe(t){return t?t.slice(0,vn(t)+1).replace(st,""):t}function Ze(t){return function(e){return t(e)}}function tn(t,e){return Me(e,(function(e){return t[e]}))}function en(t,e){return t.has(e)}function nn(t,e){for(var n=-1,r=t.length;++n<r&&We(e,t[n],0)>-1;);return n}function rn(t,e){for(var n=t.length;n--&&We(e,t[n],0)>-1;);return n}var on=Je({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),sn=Je({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function an(t){return"\\"+de[t]}function cn(t){return ie.test(t)}function un(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}function dn(t,e){return function(n){return t(e(n))}}function ln(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var s=t[n];s!==e&&s!==a||(t[n]=a,o[i++]=n)}return o}function hn(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}function pn(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=[t,t]})),n}function fn(t){return cn(t)?function(t){var e=ne.lastIndex=0;for(;ne.test(t);)++e;return e}(t):Fe(t)}function gn(t){return cn(t)?function(t){return t.match(ne)||[]}(t):function(t){return t.split("")}(t)}function vn(t){for(var e=t.length;e--&&at.test(t.charAt(e)););return e}var mn=Je({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"});var _n=function t(e){var n,r=(e=null==e?ge:_n.defaults(ge.Object(),e,_n.pick(ge,se))).Array,at=e.Date,Tt=e.Error,wt=e.Function,It=e.Math,kt=e.Object,Rt=e.RegExp,Ot=e.String,Pt=e.TypeError,At=r.prototype,Nt=wt.prototype,Dt=kt.prototype,xt=e["__core-js_shared__"],Mt=Nt.toString,Lt=Dt.hasOwnProperty,Ut=0,Bt=(n=/[^.]+$/.exec(xt&&xt.keys&&xt.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",jt=Dt.toString,Ft=Mt.call(kt),Vt=ge._,Gt=Rt("^"+Mt.call(Lt).replace(it,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Wt=_e?e.Buffer:i,$t=e.Symbol,zt=e.Uint8Array,Ht=Wt?Wt.allocUnsafe:i,qt=dn(kt.getPrototypeOf,kt),Jt=kt.create,Kt=Dt.propertyIsEnumerable,Xt=At.splice,Yt=$t?$t.isConcatSpreadable:i,Qt=$t?$t.iterator:i,Zt=$t?$t.toStringTag:i,ne=function(){try{var t=po(kt,"defineProperty");return t({},"",{}),t}catch(t){}}(),ie=e.clearTimeout!==ge.clearTimeout&&e.clearTimeout,de=at&&at.now!==ge.Date.now&&at.now,pe=e.setTimeout!==ge.setTimeout&&e.setTimeout,fe=It.ceil,ve=It.floor,me=kt.getOwnPropertySymbols,Se=Wt?Wt.isBuffer:i,Ee=e.isFinite,Fe=At.join,Je=dn(kt.keys,kt),Sn=It.max,En=It.min,yn=at.now,bn=e.parseInt,Cn=It.random,Tn=At.reverse,wn=po(e,"DataView"),In=po(e,"Map"),kn=po(e,"Promise"),Rn=po(e,"Set"),On=po(e,"WeakMap"),Pn=po(kt,"create"),An=On&&new On,Nn={},Dn=jo(wn),xn=jo(In),Mn=jo(kn),Ln=jo(Rn),Un=jo(On),Bn=$t?$t.prototype:i,jn=Bn?Bn.valueOf:i,Fn=Bn?Bn.toString:i;function Vn(t){if(na(t)&&!zs(t)&&!(t instanceof zn)){if(t instanceof $n)return t;if(Lt.call(t,"__wrapped__"))return Fo(t)}return new $n(t)}var Gn=function(){function t(){}return function(e){if(!ea(e))return{};if(Jt)return Jt(e);t.prototype=e;var n=new t;return t.prototype=i,n}}();function Wn(){}function $n(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=i}function zn(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=v,this.__views__=[]}function Hn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function qn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Jn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Kn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new Jn;++e<n;)this.add(t[e])}function Xn(t){var e=this.__data__=new qn(t);this.size=e.size}function Yn(t,e){var n=zs(t),r=!n&&$s(t),i=!n&&!r&&Ks(t),o=!n&&!r&&!i&&da(t),s=n||r||i||o,a=s?Ye(t.length,Ot):[],c=a.length;for(var u in t)!e&&!Lt.call(t,u)||s&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||Eo(u,c))||a.push(u);return a}function Qn(t){var e=t.length;return e?t[Kr(0,e-1)]:i}function Zn(t,e){return Lo(Pi(t),cr(e,0,t.length))}function tr(t){return Lo(Pi(t))}function er(t,e,n){(n!==i&&!Vs(t[e],n)||n===i&&!(e in t))&&sr(t,e,n)}function nr(t,e,n){var r=t[e];Lt.call(t,e)&&Vs(r,n)&&(n!==i||e in t)||sr(t,e,n)}function rr(t,e){for(var n=t.length;n--;)if(Vs(t[n][0],e))return n;return-1}function ir(t,e,n,r){return pr(t,(function(t,i,o){e(r,t,n(t),o)})),r}function or(t,e){return t&&Ai(e,Na(e),t)}function sr(t,e,n){"__proto__"==e&&ne?ne(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function ar(t,e){for(var n=-1,o=e.length,s=r(o),a=null==t;++n<o;)s[n]=a?i:ka(t,e[n]);return s}function cr(t,e,n){return t==t&&(n!==i&&(t=t<=n?t:n),e!==i&&(t=t>=e?t:e)),t}function ur(t,e,n,r,o,s){var a,c=1&e,u=2&e,d=4&e;if(n&&(a=o?n(t,r,o,s):n(t)),a!==i)return a;if(!ea(t))return t;var l=zs(t);if(l){if(a=function(t){var e=t.length,n=new t.constructor(e);e&&"string"==typeof t[0]&&Lt.call(t,"index")&&(n.index=t.index,n.input=t.input);return n}(t),!c)return Pi(t,a)}else{var h=vo(t),p=h==C||h==T;if(Ks(t))return Ti(t,c);if(h==k||h==_||p&&!o){if(a=u||p?{}:_o(t),!c)return u?function(t,e){return Ai(t,go(t),e)}(t,function(t,e){return t&&Ai(e,Da(e),t)}(a,t)):function(t,e){return Ai(t,fo(t),e)}(t,or(a,t))}else{if(!ue[h])return o?t:{};a=function(t,e,n){var r=t.constructor;switch(e){case x:return wi(t);case E:case y:return new r(+t);case M:return function(t,e){var n=e?wi(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case L:case U:case B:case j:case F:case V:case G:case W:case $:return Ii(t,n);case w:return new r;case I:case A:return new r(t);case O:return function(t){var e=new t.constructor(t.source,gt.exec(t));return e.lastIndex=t.lastIndex,e}(t);case P:return new r;case N:return i=t,jn?kt(jn.call(i)):{}}var i}(t,h,c)}}s||(s=new Xn);var f=s.get(t);if(f)return f;s.set(t,a),aa(t)?t.forEach((function(r){a.add(ur(r,e,n,r,t,s))})):ra(t)&&t.forEach((function(r,i){a.set(i,ur(r,e,n,i,t,s))}));var g=l?i:(d?u?oo:io:u?Da:Na)(t);return Oe(g||t,(function(r,i){g&&(r=t[i=r]),nr(a,i,ur(r,e,n,i,t,s))})),a}function dr(t,e,n){var r=n.length;if(null==t)return!r;for(t=kt(t);r--;){var o=n[r],s=e[o],a=t[o];if(a===i&&!(o in t)||!s(a))return!1}return!0}function lr(t,e,n){if("function"!=typeof t)throw new Pt(o);return No((function(){t.apply(i,n)}),e)}function hr(t,e,n,r){var i=-1,o=De,s=!0,a=t.length,c=[],u=e.length;if(!a)return c;n&&(e=Me(e,Ze(n))),r?(o=xe,s=!1):e.length>=200&&(o=en,s=!1,e=new Kn(e));t:for(;++i<a;){var d=t[i],l=null==n?d:n(d);if(d=r||0!==d?d:0,s&&l==l){for(var h=u;h--;)if(e[h]===l)continue t;c.push(d)}else o(e,l,r)||c.push(d)}return c}Vn.templateSettings={escape:Q,evaluate:Z,interpolate:tt,variable:"",imports:{_:Vn}},Vn.prototype=Wn.prototype,Vn.prototype.constructor=Vn,$n.prototype=Gn(Wn.prototype),$n.prototype.constructor=$n,zn.prototype=Gn(Wn.prototype),zn.prototype.constructor=zn,Hn.prototype.clear=function(){this.__data__=Pn?Pn(null):{},this.size=0},Hn.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Hn.prototype.get=function(t){var e=this.__data__;if(Pn){var n=e[t];return n===s?i:n}return Lt.call(e,t)?e[t]:i},Hn.prototype.has=function(t){var e=this.__data__;return Pn?e[t]!==i:Lt.call(e,t)},Hn.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Pn&&e===i?s:e,this},qn.prototype.clear=function(){this.__data__=[],this.size=0},qn.prototype.delete=function(t){var e=this.__data__,n=rr(e,t);return!(n<0)&&(n==e.length-1?e.pop():Xt.call(e,n,1),--this.size,!0)},qn.prototype.get=function(t){var e=this.__data__,n=rr(e,t);return n<0?i:e[n][1]},qn.prototype.has=function(t){return rr(this.__data__,t)>-1},qn.prototype.set=function(t,e){var n=this.__data__,r=rr(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},Jn.prototype.clear=function(){this.size=0,this.__data__={hash:new Hn,map:new(In||qn),string:new Hn}},Jn.prototype.delete=function(t){var e=lo(this,t).delete(t);return this.size-=e?1:0,e},Jn.prototype.get=function(t){return lo(this,t).get(t)},Jn.prototype.has=function(t){return lo(this,t).has(t)},Jn.prototype.set=function(t,e){var n=lo(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},Kn.prototype.add=Kn.prototype.push=function(t){return this.__data__.set(t,s),this},Kn.prototype.has=function(t){return this.__data__.has(t)},Xn.prototype.clear=function(){this.__data__=new qn,this.size=0},Xn.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Xn.prototype.get=function(t){return this.__data__.get(t)},Xn.prototype.has=function(t){return this.__data__.has(t)},Xn.prototype.set=function(t,e){var n=this.__data__;if(n instanceof qn){var r=n.__data__;if(!In||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Jn(r)}return n.set(t,e),this.size=n.size,this};var pr=xi(yr),fr=xi(br,!0);function gr(t,e){var n=!0;return pr(t,(function(t,r,i){return n=!!e(t,r,i)})),n}function vr(t,e,n){for(var r=-1,o=t.length;++r<o;){var s=t[r],a=e(s);if(null!=a&&(c===i?a==a&&!ua(a):n(a,c)))var c=a,u=s}return u}function mr(t,e){var n=[];return pr(t,(function(t,r,i){e(t,r,i)&&n.push(t)})),n}function _r(t,e,n,r,i){var o=-1,s=t.length;for(n||(n=So),i||(i=[]);++o<s;){var a=t[o];e>0&&n(a)?e>1?_r(a,e-1,n,r,i):Le(i,a):r||(i[i.length]=a)}return i}var Sr=Mi(),Er=Mi(!0);function yr(t,e){return t&&Sr(t,e,Na)}function br(t,e){return t&&Er(t,e,Na)}function Cr(t,e){return Ne(e,(function(e){return Qs(t[e])}))}function Tr(t,e){for(var n=0,r=(e=Ei(e,t)).length;null!=t&&n<r;)t=t[Bo(e[n++])];return n&&n==r?t:i}function wr(t,e,n){var r=e(t);return zs(t)?r:Le(r,n(t))}function Ir(t){return null==t?t===i?"[object Undefined]":"[object Null]":Zt&&Zt in kt(t)?function(t){var e=Lt.call(t,Zt),n=t[Zt];try{t[Zt]=i;var r=!0}catch(t){}var o=jt.call(t);r&&(e?t[Zt]=n:delete t[Zt]);return o}(t):function(t){return jt.call(t)}(t)}function kr(t,e){return t>e}function Rr(t,e){return null!=t&&Lt.call(t,e)}function Or(t,e){return null!=t&&e in kt(t)}function Pr(t,e,n){for(var o=n?xe:De,s=t[0].length,a=t.length,c=a,u=r(a),d=1/0,l=[];c--;){var h=t[c];c&&e&&(h=Me(h,Ze(e))),d=En(h.length,d),u[c]=!n&&(e||s>=120&&h.length>=120)?new Kn(c&&h):i}h=t[0];var p=-1,f=u[0];t:for(;++p<s&&l.length<d;){var g=h[p],v=e?e(g):g;if(g=n||0!==g?g:0,!(f?en(f,v):o(l,v,n))){for(c=a;--c;){var m=u[c];if(!(m?en(m,v):o(t[c],v,n)))continue t}f&&f.push(v),l.push(g)}}return l}function Ar(t,e,n){var r=null==(t=Oo(t,e=Ei(e,t)))?t:t[Bo(Yo(e))];return null==r?i:ke(r,t,n)}function Nr(t){return na(t)&&Ir(t)==_}function Dr(t,e,n,r,o){return t===e||(null==t||null==e||!na(t)&&!na(e)?t!=t&&e!=e:function(t,e,n,r,o,s){var a=zs(t),c=zs(e),u=a?S:vo(t),d=c?S:vo(e),l=(u=u==_?k:u)==k,h=(d=d==_?k:d)==k,p=u==d;if(p&&Ks(t)){if(!Ks(e))return!1;a=!0,l=!1}if(p&&!l)return s||(s=new Xn),a||da(t)?no(t,e,n,r,o,s):function(t,e,n,r,i,o,s){switch(n){case M:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case x:return!(t.byteLength!=e.byteLength||!o(new zt(t),new zt(e)));case E:case y:case I:return Vs(+t,+e);case b:return t.name==e.name&&t.message==e.message;case O:case A:return t==e+"";case w:var a=un;case P:var c=1&r;if(a||(a=hn),t.size!=e.size&&!c)return!1;var u=s.get(t);if(u)return u==e;r|=2,s.set(t,e);var d=no(a(t),a(e),r,i,o,s);return s.delete(t),d;case N:if(jn)return jn.call(t)==jn.call(e)}return!1}(t,e,u,n,r,o,s);if(!(1&n)){var f=l&&Lt.call(t,"__wrapped__"),g=h&&Lt.call(e,"__wrapped__");if(f||g){var v=f?t.value():t,m=g?e.value():e;return s||(s=new Xn),o(v,m,n,r,s)}}if(!p)return!1;return s||(s=new Xn),function(t,e,n,r,o,s){var a=1&n,c=io(t),u=c.length,d=io(e),l=d.length;if(u!=l&&!a)return!1;var h=u;for(;h--;){var p=c[h];if(!(a?p in e:Lt.call(e,p)))return!1}var f=s.get(t),g=s.get(e);if(f&&g)return f==e&&g==t;var v=!0;s.set(t,e),s.set(e,t);var m=a;for(;++h<u;){var _=t[p=c[h]],S=e[p];if(r)var E=a?r(S,_,p,e,t,s):r(_,S,p,t,e,s);if(!(E===i?_===S||o(_,S,n,r,s):E)){v=!1;break}m||(m="constructor"==p)}if(v&&!m){var y=t.constructor,b=e.constructor;y==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof y&&y instanceof y&&"function"==typeof b&&b instanceof b||(v=!1)}return s.delete(t),s.delete(e),v}(t,e,n,r,o,s)}(t,e,n,r,Dr,o))}function xr(t,e,n,r){var o=n.length,s=o,a=!r;if(null==t)return!s;for(t=kt(t);o--;){var c=n[o];if(a&&c[2]?c[1]!==t[c[0]]:!(c[0]in t))return!1}for(;++o<s;){var u=(c=n[o])[0],d=t[u],l=c[1];if(a&&c[2]){if(d===i&&!(u in t))return!1}else{var h=new Xn;if(r)var p=r(d,l,u,t,e,h);if(!(p===i?Dr(l,d,3,r,h):p))return!1}}return!0}function Mr(t){return!(!ea(t)||(e=t,Bt&&Bt in e))&&(Qs(t)?Gt:_t).test(jo(t));var e}function Lr(t){return"function"==typeof t?t:null==t?ic:"object"==typeof t?zs(t)?Gr(t[0],t[1]):Vr(t):pc(t)}function Ur(t){if(!wo(t))return Je(t);var e=[];for(var n in kt(t))Lt.call(t,n)&&"constructor"!=n&&e.push(n);return e}function Br(t){if(!ea(t))return function(t){var e=[];if(null!=t)for(var n in kt(t))e.push(n);return e}(t);var e=wo(t),n=[];for(var r in t)("constructor"!=r||!e&&Lt.call(t,r))&&n.push(r);return n}function jr(t,e){return t<e}function Fr(t,e){var n=-1,i=qs(t)?r(t.length):[];return pr(t,(function(t,r,o){i[++n]=e(t,r,o)})),i}function Vr(t){var e=ho(t);return 1==e.length&&e[0][2]?ko(e[0][0],e[0][1]):function(n){return n===t||xr(n,t,e)}}function Gr(t,e){return bo(t)&&Io(e)?ko(Bo(t),e):function(n){var r=ka(n,t);return r===i&&r===e?Ra(n,t):Dr(e,r,3)}}function Wr(t,e,n,r,o){t!==e&&Sr(e,(function(s,a){if(o||(o=new Xn),ea(s))!function(t,e,n,r,o,s,a){var c=Po(t,n),u=Po(e,n),d=a.get(u);if(d)return void er(t,n,d);var l=s?s(c,u,n+"",t,e,a):i,h=l===i;if(h){var p=zs(u),f=!p&&Ks(u),g=!p&&!f&&da(u);l=u,p||f||g?zs(c)?l=c:Js(c)?l=Pi(c):f?(h=!1,l=Ti(u,!0)):g?(h=!1,l=Ii(u,!0)):l=[]:oa(u)||$s(u)?(l=c,$s(c)?l=_a(c):ea(c)&&!Qs(c)||(l=_o(u))):h=!1}h&&(a.set(u,l),o(l,u,r,s,a),a.delete(u));er(t,n,l)}(t,e,a,n,Wr,r,o);else{var c=r?r(Po(t,a),s,a+"",t,e,o):i;c===i&&(c=s),er(t,a,c)}}),Da)}function $r(t,e){var n=t.length;if(n)return Eo(e+=e<0?n:0,n)?t[e]:i}function zr(t,e,n){e=e.length?Me(e,(function(t){return zs(t)?function(e){return Tr(e,1===t.length?t[0]:t)}:t})):[ic];var r=-1;e=Me(e,Ze(uo()));var i=Fr(t,(function(t,n,i){var o=Me(e,(function(e){return e(t)}));return{criteria:o,index:++r,value:t}}));return function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}(i,(function(t,e){return function(t,e,n){var r=-1,i=t.criteria,o=e.criteria,s=i.length,a=n.length;for(;++r<s;){var c=ki(i[r],o[r]);if(c)return r>=a?c:c*("desc"==n[r]?-1:1)}return t.index-e.index}(t,e,n)}))}function Hr(t,e,n){for(var r=-1,i=e.length,o={};++r<i;){var s=e[r],a=Tr(t,s);n(a,s)&&ti(o,Ei(s,t),a)}return o}function qr(t,e,n,r){var i=r?$e:We,o=-1,s=e.length,a=t;for(t===e&&(e=Pi(e)),n&&(a=Me(t,Ze(n)));++o<s;)for(var c=0,u=e[o],d=n?n(u):u;(c=i(a,d,c,r))>-1;)a!==t&&Xt.call(a,c,1),Xt.call(t,c,1);return t}function Jr(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(n==r||i!==o){var o=i;Eo(i)?Xt.call(t,i,1):hi(t,i)}}return t}function Kr(t,e){return t+ve(Cn()*(e-t+1))}function Xr(t,e){var n="";if(!t||e<1||e>f)return n;do{e%2&&(n+=t),(e=ve(e/2))&&(t+=t)}while(e);return n}function Yr(t,e){return Do(Ro(t,e,ic),t+"")}function Qr(t){return Qn(Va(t))}function Zr(t,e){var n=Va(t);return Lo(n,cr(e,0,n.length))}function ti(t,e,n,r){if(!ea(t))return t;for(var o=-1,s=(e=Ei(e,t)).length,a=s-1,c=t;null!=c&&++o<s;){var u=Bo(e[o]),d=n;if("__proto__"===u||"constructor"===u||"prototype"===u)return t;if(o!=a){var l=c[u];(d=r?r(l,u,c):i)===i&&(d=ea(l)?l:Eo(e[o+1])?[]:{})}nr(c,u,d),c=c[u]}return t}var ei=An?function(t,e){return An.set(t,e),t}:ic,ni=ne?function(t,e){return ne(t,"toString",{configurable:!0,enumerable:!1,value:ec(e),writable:!0})}:ic;function ri(t){return Lo(Va(t))}function ii(t,e,n){var i=-1,o=t.length;e<0&&(e=-e>o?0:o+e),(n=n>o?o:n)<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var s=r(o);++i<o;)s[i]=t[i+e];return s}function oi(t,e){var n;return pr(t,(function(t,r,i){return!(n=e(t,r,i))})),!!n}function si(t,e,n){var r=0,i=null==t?r:t.length;if("number"==typeof e&&e==e&&i<=2147483647){for(;r<i;){var o=r+i>>>1,s=t[o];null!==s&&!ua(s)&&(n?s<=e:s<e)?r=o+1:i=o}return i}return ai(t,e,ic,n)}function ai(t,e,n,r){var o=0,s=null==t?0:t.length;if(0===s)return 0;for(var a=(e=n(e))!=e,c=null===e,u=ua(e),d=e===i;o<s;){var l=ve((o+s)/2),h=n(t[l]),p=h!==i,f=null===h,g=h==h,v=ua(h);if(a)var m=r||g;else m=d?g&&(r||p):c?g&&p&&(r||!f):u?g&&p&&!f&&(r||!v):!f&&!v&&(r?h<=e:h<e);m?o=l+1:s=l}return En(s,4294967294)}function ci(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var s=t[n],a=e?e(s):s;if(!n||!Vs(a,c)){var c=a;o[i++]=0===s?0:s}}return o}function ui(t){return"number"==typeof t?t:ua(t)?g:+t}function di(t){if("string"==typeof t)return t;if(zs(t))return Me(t,di)+"";if(ua(t))return Fn?Fn.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function li(t,e,n){var r=-1,i=De,o=t.length,s=!0,a=[],c=a;if(n)s=!1,i=xe;else if(o>=200){var u=e?null:Xi(t);if(u)return hn(u);s=!1,i=en,c=new Kn}else c=e?[]:a;t:for(;++r<o;){var d=t[r],l=e?e(d):d;if(d=n||0!==d?d:0,s&&l==l){for(var h=c.length;h--;)if(c[h]===l)continue t;e&&c.push(l),a.push(d)}else i(c,l,n)||(c!==a&&c.push(l),a.push(d))}return a}function hi(t,e){return null==(t=Oo(t,e=Ei(e,t)))||delete t[Bo(Yo(e))]}function pi(t,e,n,r){return ti(t,e,n(Tr(t,e)),r)}function fi(t,e,n,r){for(var i=t.length,o=r?i:-1;(r?o--:++o<i)&&e(t[o],o,t););return n?ii(t,r?0:o,r?o+1:i):ii(t,r?o+1:0,r?i:o)}function gi(t,e){var n=t;return n instanceof zn&&(n=n.value()),Ue(e,(function(t,e){return e.func.apply(e.thisArg,Le([t],e.args))}),n)}function vi(t,e,n){var i=t.length;if(i<2)return i?li(t[0]):[];for(var o=-1,s=r(i);++o<i;)for(var a=t[o],c=-1;++c<i;)c!=o&&(s[o]=hr(s[o]||a,t[c],e,n));return li(_r(s,1),e,n)}function mi(t,e,n){for(var r=-1,o=t.length,s=e.length,a={};++r<o;){var c=r<s?e[r]:i;n(a,t[r],c)}return a}function _i(t){return Js(t)?t:[]}function Si(t){return"function"==typeof t?t:ic}function Ei(t,e){return zs(t)?t:bo(t,e)?[t]:Uo(Sa(t))}var yi=Yr;function bi(t,e,n){var r=t.length;return n=n===i?r:n,!e&&n>=r?t:ii(t,e,n)}var Ci=ie||function(t){return ge.clearTimeout(t)};function Ti(t,e){if(e)return t.slice();var n=t.length,r=Ht?Ht(n):new t.constructor(n);return t.copy(r),r}function wi(t){var e=new t.constructor(t.byteLength);return new zt(e).set(new zt(t)),e}function Ii(t,e){var n=e?wi(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function ki(t,e){if(t!==e){var n=t!==i,r=null===t,o=t==t,s=ua(t),a=e!==i,c=null===e,u=e==e,d=ua(e);if(!c&&!d&&!s&&t>e||s&&a&&u&&!c&&!d||r&&a&&u||!n&&u||!o)return 1;if(!r&&!s&&!d&&t<e||d&&n&&o&&!r&&!s||c&&n&&o||!a&&o||!u)return-1}return 0}function Ri(t,e,n,i){for(var o=-1,s=t.length,a=n.length,c=-1,u=e.length,d=Sn(s-a,0),l=r(u+d),h=!i;++c<u;)l[c]=e[c];for(;++o<a;)(h||o<s)&&(l[n[o]]=t[o]);for(;d--;)l[c++]=t[o++];return l}function Oi(t,e,n,i){for(var o=-1,s=t.length,a=-1,c=n.length,u=-1,d=e.length,l=Sn(s-c,0),h=r(l+d),p=!i;++o<l;)h[o]=t[o];for(var f=o;++u<d;)h[f+u]=e[u];for(;++a<c;)(p||o<s)&&(h[f+n[a]]=t[o++]);return h}function Pi(t,e){var n=-1,i=t.length;for(e||(e=r(i));++n<i;)e[n]=t[n];return e}function Ai(t,e,n,r){var o=!n;n||(n={});for(var s=-1,a=e.length;++s<a;){var c=e[s],u=r?r(n[c],t[c],c,n,t):i;u===i&&(u=t[c]),o?sr(n,c,u):nr(n,c,u)}return n}function Ni(t,e){return function(n,r){var i=zs(n)?Re:ir,o=e?e():{};return i(n,t,uo(r,2),o)}}function Di(t){return Yr((function(e,n){var r=-1,o=n.length,s=o>1?n[o-1]:i,a=o>2?n[2]:i;for(s=t.length>3&&"function"==typeof s?(o--,s):i,a&&yo(n[0],n[1],a)&&(s=o<3?i:s,o=1),e=kt(e);++r<o;){var c=n[r];c&&t(e,c,r,s)}return e}))}function xi(t,e){return function(n,r){if(null==n)return n;if(!qs(n))return t(n,r);for(var i=n.length,o=e?i:-1,s=kt(n);(e?o--:++o<i)&&!1!==r(s[o],o,s););return n}}function Mi(t){return function(e,n,r){for(var i=-1,o=kt(e),s=r(e),a=s.length;a--;){var c=s[t?a:++i];if(!1===n(o[c],c,o))break}return e}}function Li(t){return function(e){var n=cn(e=Sa(e))?gn(e):i,r=n?n[0]:e.charAt(0),o=n?bi(n,1).join(""):e.slice(1);return r[t]()+o}}function Ui(t){return function(e){return Ue(Qa($a(e).replace(te,"")),t,"")}}function Bi(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=Gn(t.prototype),r=t.apply(n,e);return ea(r)?r:n}}function ji(t){return function(e,n,r){var o=kt(e);if(!qs(e)){var s=uo(n,3);e=Na(e),n=function(t){return s(o[t],t,o)}}var a=t(e,n,r);return a>-1?o[s?e[a]:a]:i}}function Fi(t){return ro((function(e){var n=e.length,r=n,s=$n.prototype.thru;for(t&&e.reverse();r--;){var a=e[r];if("function"!=typeof a)throw new Pt(o);if(s&&!c&&"wrapper"==ao(a))var c=new $n([],!0)}for(r=c?r:n;++r<n;){var u=ao(a=e[r]),d="wrapper"==u?so(a):i;c=d&&Co(d[0])&&424==d[1]&&!d[4].length&&1==d[9]?c[ao(d[0])].apply(c,d[3]):1==a.length&&Co(a)?c[u]():c.thru(a)}return function(){var t=arguments,r=t[0];if(c&&1==t.length&&zs(r))return c.plant(r).value();for(var i=0,o=n?e[i].apply(this,t):r;++i<n;)o=e[i].call(this,o);return o}}))}function Vi(t,e,n,o,s,a,c,u,d,h){var p=e&l,f=1&e,g=2&e,v=24&e,m=512&e,_=g?i:Bi(t);return function l(){for(var S=arguments.length,E=r(S),y=S;y--;)E[y]=arguments[y];if(v)var b=co(l),C=function(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&++r;return r}(E,b);if(o&&(E=Ri(E,o,s,v)),a&&(E=Oi(E,a,c,v)),S-=C,v&&S<h){var T=ln(E,b);return Ji(t,e,Vi,l.placeholder,n,E,T,u,d,h-S)}var w=f?n:this,I=g?w[t]:t;return S=E.length,u?E=function(t,e){var n=t.length,r=En(e.length,n),o=Pi(t);for(;r--;){var s=e[r];t[r]=Eo(s,n)?o[s]:i}return t}(E,u):m&&S>1&&E.reverse(),p&&d<S&&(E.length=d),this&&this!==ge&&this instanceof l&&(I=_||Bi(I)),I.apply(w,E)}}function Gi(t,e){return function(n,r){return function(t,e,n,r){return yr(t,(function(t,i,o){e(r,n(t),i,o)})),r}(n,t,e(r),{})}}function Wi(t,e){return function(n,r){var o;if(n===i&&r===i)return e;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=di(n),r=di(r)):(n=ui(n),r=ui(r)),o=t(n,r)}return o}}function $i(t){return ro((function(e){return e=Me(e,Ze(uo())),Yr((function(n){var r=this;return t(e,(function(t){return ke(t,r,n)}))}))}))}function zi(t,e){var n=(e=e===i?" ":di(e)).length;if(n<2)return n?Xr(e,t):e;var r=Xr(e,fe(t/fn(e)));return cn(e)?bi(gn(r),0,t).join(""):r.slice(0,t)}function Hi(t){return function(e,n,o){return o&&"number"!=typeof o&&yo(e,n,o)&&(n=o=i),e=fa(e),n===i?(n=e,e=0):n=fa(n),function(t,e,n,i){for(var o=-1,s=Sn(fe((e-t)/(n||1)),0),a=r(s);s--;)a[i?s:++o]=t,t+=n;return a}(e,n,o=o===i?e<n?1:-1:fa(o),t)}}function qi(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=ma(e),n=ma(n)),t(e,n)}}function Ji(t,e,n,r,o,s,a,c,l,h){var p=8&e;e|=p?u:d,4&(e&=~(p?d:u))||(e&=-4);var f=[t,e,o,p?s:i,p?a:i,p?i:s,p?i:a,c,l,h],g=n.apply(i,f);return Co(t)&&Ao(g,f),g.placeholder=r,xo(g,t,e)}function Ki(t){var e=It[t];return function(t,n){if(t=ma(t),(n=null==n?0:En(ga(n),292))&&Ee(t)){var r=(Sa(t)+"e").split("e");return+((r=(Sa(e(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return e(t)}}var Xi=Rn&&1/hn(new Rn([,-0]))[1]==p?function(t){return new Rn(t)}:uc;function Yi(t){return function(e){var n=vo(e);return n==w?un(e):n==P?pn(e):function(t,e){return Me(e,(function(e){return[e,t[e]]}))}(e,t(e))}}function Qi(t,e,n,s,p,f,g,v){var m=2&e;if(!m&&"function"!=typeof t)throw new Pt(o);var _=s?s.length:0;if(_||(e&=-97,s=p=i),g=g===i?g:Sn(ga(g),0),v=v===i?v:ga(v),_-=p?p.length:0,e&d){var S=s,E=p;s=p=i}var y=m?i:so(t),b=[t,e,n,s,p,S,E,f,g,v];if(y&&function(t,e){var n=t[1],r=e[1],i=n|r,o=i<131,s=r==l&&8==n||r==l&&n==h&&t[7].length<=e[8]||384==r&&e[7].length<=e[8]&&8==n;if(!o&&!s)return t;1&r&&(t[2]=e[2],i|=1&n?0:4);var c=e[3];if(c){var u=t[3];t[3]=u?Ri(u,c,e[4]):c,t[4]=u?ln(t[3],a):e[4]}(c=e[5])&&(u=t[5],t[5]=u?Oi(u,c,e[6]):c,t[6]=u?ln(t[5],a):e[6]);(c=e[7])&&(t[7]=c);r&l&&(t[8]=null==t[8]?e[8]:En(t[8],e[8]));null==t[9]&&(t[9]=e[9]);t[0]=e[0],t[1]=i}(b,y),t=b[0],e=b[1],n=b[2],s=b[3],p=b[4],!(v=b[9]=b[9]===i?m?0:t.length:Sn(b[9]-_,0))&&24&e&&(e&=-25),e&&1!=e)C=8==e||e==c?function(t,e,n){var o=Bi(t);return function s(){for(var a=arguments.length,c=r(a),u=a,d=co(s);u--;)c[u]=arguments[u];var l=a<3&&c[0]!==d&&c[a-1]!==d?[]:ln(c,d);return(a-=l.length)<n?Ji(t,e,Vi,s.placeholder,i,c,l,i,i,n-a):ke(this&&this!==ge&&this instanceof s?o:t,this,c)}}(t,e,v):e!=u&&33!=e||p.length?Vi.apply(i,b):function(t,e,n,i){var o=1&e,s=Bi(t);return function e(){for(var a=-1,c=arguments.length,u=-1,d=i.length,l=r(d+c),h=this&&this!==ge&&this instanceof e?s:t;++u<d;)l[u]=i[u];for(;c--;)l[u++]=arguments[++a];return ke(h,o?n:this,l)}}(t,e,n,s);else var C=function(t,e,n){var r=1&e,i=Bi(t);return function e(){return(this&&this!==ge&&this instanceof e?i:t).apply(r?n:this,arguments)}}(t,e,n);return xo((y?ei:Ao)(C,b),t,e)}function Zi(t,e,n,r){return t===i||Vs(t,Dt[n])&&!Lt.call(r,n)?e:t}function to(t,e,n,r,o,s){return ea(t)&&ea(e)&&(s.set(e,t),Wr(t,e,i,to,s),s.delete(e)),t}function eo(t){return oa(t)?i:t}function no(t,e,n,r,o,s){var a=1&n,c=t.length,u=e.length;if(c!=u&&!(a&&u>c))return!1;var d=s.get(t),l=s.get(e);if(d&&l)return d==e&&l==t;var h=-1,p=!0,f=2&n?new Kn:i;for(s.set(t,e),s.set(e,t);++h<c;){var g=t[h],v=e[h];if(r)var m=a?r(v,g,h,e,t,s):r(g,v,h,t,e,s);if(m!==i){if(m)continue;p=!1;break}if(f){if(!je(e,(function(t,e){if(!en(f,e)&&(g===t||o(g,t,n,r,s)))return f.push(e)}))){p=!1;break}}else if(g!==v&&!o(g,v,n,r,s)){p=!1;break}}return s.delete(t),s.delete(e),p}function ro(t){return Do(Ro(t,i,Ho),t+"")}function io(t){return wr(t,Na,fo)}function oo(t){return wr(t,Da,go)}var so=An?function(t){return An.get(t)}:uc;function ao(t){for(var e=t.name+"",n=Nn[e],r=Lt.call(Nn,e)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==t)return i.name}return e}function co(t){return(Lt.call(Vn,"placeholder")?Vn:t).placeholder}function uo(){var t=Vn.iteratee||oc;return t=t===oc?Lr:t,arguments.length?t(arguments[0],arguments[1]):t}function lo(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function ho(t){for(var e=Na(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,Io(i)]}return e}function po(t,e){var n=function(t,e){return null==t?i:t[e]}(t,e);return Mr(n)?n:i}var fo=me?function(t){return null==t?[]:(t=kt(t),Ne(me(t),(function(e){return Kt.call(t,e)})))}:vc,go=me?function(t){for(var e=[];t;)Le(e,fo(t)),t=qt(t);return e}:vc,vo=Ir;function mo(t,e,n){for(var r=-1,i=(e=Ei(e,t)).length,o=!1;++r<i;){var s=Bo(e[r]);if(!(o=null!=t&&n(t,s)))break;t=t[s]}return o||++r!=i?o:!!(i=null==t?0:t.length)&&ta(i)&&Eo(s,i)&&(zs(t)||$s(t))}function _o(t){return"function"!=typeof t.constructor||wo(t)?{}:Gn(qt(t))}function So(t){return zs(t)||$s(t)||!!(Yt&&t&&t[Yt])}function Eo(t,e){var n=typeof t;return!!(e=null==e?f:e)&&("number"==n||"symbol"!=n&&Et.test(t))&&t>-1&&t%1==0&&t<e}function yo(t,e,n){if(!ea(n))return!1;var r=typeof e;return!!("number"==r?qs(n)&&Eo(e,n.length):"string"==r&&e in n)&&Vs(n[e],t)}function bo(t,e){if(zs(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!ua(t))||(nt.test(t)||!et.test(t)||null!=e&&t in kt(e))}function Co(t){var e=ao(t),n=Vn[e];if("function"!=typeof n||!(e in zn.prototype))return!1;if(t===n)return!0;var r=so(n);return!!r&&t===r[0]}(wn&&vo(new wn(new ArrayBuffer(1)))!=M||In&&vo(new In)!=w||kn&&vo(kn.resolve())!=R||Rn&&vo(new Rn)!=P||On&&vo(new On)!=D)&&(vo=function(t){var e=Ir(t),n=e==k?t.constructor:i,r=n?jo(n):"";if(r)switch(r){case Dn:return M;case xn:return w;case Mn:return R;case Ln:return P;case Un:return D}return e});var To=xt?Qs:mc;function wo(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Dt)}function Io(t){return t==t&&!ea(t)}function ko(t,e){return function(n){return null!=n&&(n[t]===e&&(e!==i||t in kt(n)))}}function Ro(t,e,n){return e=Sn(e===i?t.length-1:e,0),function(){for(var i=arguments,o=-1,s=Sn(i.length-e,0),a=r(s);++o<s;)a[o]=i[e+o];o=-1;for(var c=r(e+1);++o<e;)c[o]=i[o];return c[e]=n(a),ke(t,this,c)}}function Oo(t,e){return e.length<2?t:Tr(t,ii(e,0,-1))}function Po(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Ao=Mo(ei),No=pe||function(t,e){return ge.setTimeout(t,e)},Do=Mo(ni);function xo(t,e,n){var r=e+"";return Do(t,function(t,e){var n=e.length;if(!n)return t;var r=n-1;return e[r]=(n>1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(ct,"{\n/* [wrapped with "+e+"] */\n")}(r,function(t,e){return Oe(m,(function(n){var r="_."+n[0];e&n[1]&&!De(t,r)&&t.push(r)})),t.sort()}(function(t){var e=t.match(ut);return e?e[1].split(dt):[]}(r),n)))}function Mo(t){var e=0,n=0;return function(){var r=yn(),o=16-(r-n);if(n=r,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(i,arguments)}}function Lo(t,e){var n=-1,r=t.length,o=r-1;for(e=e===i?r:e;++n<e;){var s=Kr(n,o),a=t[s];t[s]=t[n],t[n]=a}return t.length=e,t}var Uo=function(t){var e=Ms(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(rt,(function(t,n,r,i){e.push(r?i.replace(pt,"$1"):n||t)})),e}));function Bo(t){if("string"==typeof t||ua(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function jo(t){if(null!=t){try{return Mt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Fo(t){if(t instanceof zn)return t.clone();var e=new $n(t.__wrapped__,t.__chain__);return e.__actions__=Pi(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var Vo=Yr((function(t,e){return Js(t)?hr(t,_r(e,1,Js,!0)):[]})),Go=Yr((function(t,e){var n=Yo(e);return Js(n)&&(n=i),Js(t)?hr(t,_r(e,1,Js,!0),uo(n,2)):[]})),Wo=Yr((function(t,e){var n=Yo(e);return Js(n)&&(n=i),Js(t)?hr(t,_r(e,1,Js,!0),i,n):[]}));function $o(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:ga(n);return i<0&&(i=Sn(r+i,0)),Ge(t,uo(e,3),i)}function zo(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var o=r-1;return n!==i&&(o=ga(n),o=n<0?Sn(r+o,0):En(o,r-1)),Ge(t,uo(e,3),o,!0)}function Ho(t){return(null==t?0:t.length)?_r(t,1):[]}function qo(t){return t&&t.length?t[0]:i}var Jo=Yr((function(t){var e=Me(t,_i);return e.length&&e[0]===t[0]?Pr(e):[]})),Ko=Yr((function(t){var e=Yo(t),n=Me(t,_i);return e===Yo(n)?e=i:n.pop(),n.length&&n[0]===t[0]?Pr(n,uo(e,2)):[]})),Xo=Yr((function(t){var e=Yo(t),n=Me(t,_i);return(e="function"==typeof e?e:i)&&n.pop(),n.length&&n[0]===t[0]?Pr(n,i,e):[]}));function Yo(t){var e=null==t?0:t.length;return e?t[e-1]:i}var Qo=Yr(Zo);function Zo(t,e){return t&&t.length&&e&&e.length?qr(t,e):t}var ts=ro((function(t,e){var n=null==t?0:t.length,r=ar(t,e);return Jr(t,Me(e,(function(t){return Eo(t,n)?+t:t})).sort(ki)),r}));function es(t){return null==t?t:Tn.call(t)}var ns=Yr((function(t){return li(_r(t,1,Js,!0))})),rs=Yr((function(t){var e=Yo(t);return Js(e)&&(e=i),li(_r(t,1,Js,!0),uo(e,2))})),is=Yr((function(t){var e=Yo(t);return e="function"==typeof e?e:i,li(_r(t,1,Js,!0),i,e)}));function os(t){if(!t||!t.length)return[];var e=0;return t=Ne(t,(function(t){if(Js(t))return e=Sn(t.length,e),!0})),Ye(e,(function(e){return Me(t,qe(e))}))}function ss(t,e){if(!t||!t.length)return[];var n=os(t);return null==e?n:Me(n,(function(t){return ke(e,i,t)}))}var as=Yr((function(t,e){return Js(t)?hr(t,e):[]})),cs=Yr((function(t){return vi(Ne(t,Js))})),us=Yr((function(t){var e=Yo(t);return Js(e)&&(e=i),vi(Ne(t,Js),uo(e,2))})),ds=Yr((function(t){var e=Yo(t);return e="function"==typeof e?e:i,vi(Ne(t,Js),i,e)})),ls=Yr(os);var hs=Yr((function(t){var e=t.length,n=e>1?t[e-1]:i;return n="function"==typeof n?(t.pop(),n):i,ss(t,n)}));function ps(t){var e=Vn(t);return e.__chain__=!0,e}function fs(t,e){return e(t)}var gs=ro((function(t){var e=t.length,n=e?t[0]:0,r=this.__wrapped__,o=function(e){return ar(e,t)};return!(e>1||this.__actions__.length)&&r instanceof zn&&Eo(n)?((r=r.slice(n,+n+(e?1:0))).__actions__.push({func:fs,args:[o],thisArg:i}),new $n(r,this.__chain__).thru((function(t){return e&&!t.length&&t.push(i),t}))):this.thru(o)}));var vs=Ni((function(t,e,n){Lt.call(t,n)?++t[n]:sr(t,n,1)}));var ms=ji($o),_s=ji(zo);function Ss(t,e){return(zs(t)?Oe:pr)(t,uo(e,3))}function Es(t,e){return(zs(t)?Pe:fr)(t,uo(e,3))}var ys=Ni((function(t,e,n){Lt.call(t,n)?t[n].push(e):sr(t,n,[e])}));var bs=Yr((function(t,e,n){var i=-1,o="function"==typeof e,s=qs(t)?r(t.length):[];return pr(t,(function(t){s[++i]=o?ke(e,t,n):Ar(t,e,n)})),s})),Cs=Ni((function(t,e,n){sr(t,n,e)}));function Ts(t,e){return(zs(t)?Me:Fr)(t,uo(e,3))}var ws=Ni((function(t,e,n){t[n?0:1].push(e)}),(function(){return[[],[]]}));var Is=Yr((function(t,e){if(null==t)return[];var n=e.length;return n>1&&yo(t,e[0],e[1])?e=[]:n>2&&yo(e[0],e[1],e[2])&&(e=[e[0]]),zr(t,_r(e,1),[])})),ks=de||function(){return ge.Date.now()};function Rs(t,e,n){return e=n?i:e,e=t&&null==e?t.length:e,Qi(t,l,i,i,i,i,e)}function Os(t,e){var n;if("function"!=typeof e)throw new Pt(o);return t=ga(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=i),n}}var Ps=Yr((function(t,e,n){var r=1;if(n.length){var i=ln(n,co(Ps));r|=u}return Qi(t,r,e,n,i)})),As=Yr((function(t,e,n){var r=3;if(n.length){var i=ln(n,co(As));r|=u}return Qi(e,r,t,n,i)}));function Ns(t,e,n){var r,s,a,c,u,d,l=0,h=!1,p=!1,f=!0;if("function"!=typeof t)throw new Pt(o);function g(e){var n=r,o=s;return r=s=i,l=e,c=t.apply(o,n)}function v(t){var n=t-d;return d===i||n>=e||n<0||p&&t-l>=a}function m(){var t=ks();if(v(t))return _(t);u=No(m,function(t){var n=e-(t-d);return p?En(n,a-(t-l)):n}(t))}function _(t){return u=i,f&&r?g(t):(r=s=i,c)}function S(){var t=ks(),n=v(t);if(r=arguments,s=this,d=t,n){if(u===i)return function(t){return l=t,u=No(m,e),h?g(t):c}(d);if(p)return Ci(u),u=No(m,e),g(d)}return u===i&&(u=No(m,e)),c}return e=ma(e)||0,ea(n)&&(h=!!n.leading,a=(p="maxWait"in n)?Sn(ma(n.maxWait)||0,e):a,f="trailing"in n?!!n.trailing:f),S.cancel=function(){u!==i&&Ci(u),l=0,r=d=s=u=i},S.flush=function(){return u===i?c:_(ks())},S}var Ds=Yr((function(t,e){return lr(t,1,e)})),xs=Yr((function(t,e,n){return lr(t,ma(e)||0,n)}));function Ms(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new Pt(o);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=t.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(Ms.Cache||Jn),n}function Ls(t){if("function"!=typeof t)throw new Pt(o);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Ms.Cache=Jn;var Us=yi((function(t,e){var n=(e=1==e.length&&zs(e[0])?Me(e[0],Ze(uo())):Me(_r(e,1),Ze(uo()))).length;return Yr((function(r){for(var i=-1,o=En(r.length,n);++i<o;)r[i]=e[i].call(this,r[i]);return ke(t,this,r)}))})),Bs=Yr((function(t,e){var n=ln(e,co(Bs));return Qi(t,u,i,e,n)})),js=Yr((function(t,e){var n=ln(e,co(js));return Qi(t,d,i,e,n)})),Fs=ro((function(t,e){return Qi(t,h,i,i,i,e)}));function Vs(t,e){return t===e||t!=t&&e!=e}var Gs=qi(kr),Ws=qi((function(t,e){return t>=e})),$s=Nr(function(){return arguments}())?Nr:function(t){return na(t)&&Lt.call(t,"callee")&&!Kt.call(t,"callee")},zs=r.isArray,Hs=ye?Ze(ye):function(t){return na(t)&&Ir(t)==x};function qs(t){return null!=t&&ta(t.length)&&!Qs(t)}function Js(t){return na(t)&&qs(t)}var Ks=Se||mc,Xs=be?Ze(be):function(t){return na(t)&&Ir(t)==y};function Ys(t){if(!na(t))return!1;var e=Ir(t);return e==b||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!oa(t)}function Qs(t){if(!ea(t))return!1;var e=Ir(t);return e==C||e==T||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Zs(t){return"number"==typeof t&&t==ga(t)}function ta(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=f}function ea(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function na(t){return null!=t&&"object"==typeof t}var ra=Ce?Ze(Ce):function(t){return na(t)&&vo(t)==w};function ia(t){return"number"==typeof t||na(t)&&Ir(t)==I}function oa(t){if(!na(t)||Ir(t)!=k)return!1;var e=qt(t);if(null===e)return!0;var n=Lt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Mt.call(n)==Ft}var sa=Te?Ze(Te):function(t){return na(t)&&Ir(t)==O};var aa=we?Ze(we):function(t){return na(t)&&vo(t)==P};function ca(t){return"string"==typeof t||!zs(t)&&na(t)&&Ir(t)==A}function ua(t){return"symbol"==typeof t||na(t)&&Ir(t)==N}var da=Ie?Ze(Ie):function(t){return na(t)&&ta(t.length)&&!!ce[Ir(t)]};var la=qi(jr),ha=qi((function(t,e){return t<=e}));function pa(t){if(!t)return[];if(qs(t))return ca(t)?gn(t):Pi(t);if(Qt&&t[Qt])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[Qt]());var e=vo(t);return(e==w?un:e==P?hn:Va)(t)}function fa(t){return t?(t=ma(t))===p||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function ga(t){var e=fa(t),n=e%1;return e==e?n?e-n:e:0}function va(t){return t?cr(ga(t),0,v):0}function ma(t){if("number"==typeof t)return t;if(ua(t))return g;if(ea(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=ea(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Qe(t);var n=mt.test(t);return n||St.test(t)?he(t.slice(2),n?2:8):vt.test(t)?g:+t}function _a(t){return Ai(t,Da(t))}function Sa(t){return null==t?"":di(t)}var Ea=Di((function(t,e){if(wo(e)||qs(e))Ai(e,Na(e),t);else for(var n in e)Lt.call(e,n)&&nr(t,n,e[n])})),ya=Di((function(t,e){Ai(e,Da(e),t)})),ba=Di((function(t,e,n,r){Ai(e,Da(e),t,r)})),Ca=Di((function(t,e,n,r){Ai(e,Na(e),t,r)})),Ta=ro(ar);var wa=Yr((function(t,e){t=kt(t);var n=-1,r=e.length,o=r>2?e[2]:i;for(o&&yo(e[0],e[1],o)&&(r=1);++n<r;)for(var s=e[n],a=Da(s),c=-1,u=a.length;++c<u;){var d=a[c],l=t[d];(l===i||Vs(l,Dt[d])&&!Lt.call(t,d))&&(t[d]=s[d])}return t})),Ia=Yr((function(t){return t.push(i,to),ke(Ma,i,t)}));function ka(t,e,n){var r=null==t?i:Tr(t,e);return r===i?n:r}function Ra(t,e){return null!=t&&mo(t,e,Or)}var Oa=Gi((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=jt.call(e)),t[e]=n}),ec(ic)),Pa=Gi((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=jt.call(e)),Lt.call(t,e)?t[e].push(n):t[e]=[n]}),uo),Aa=Yr(Ar);function Na(t){return qs(t)?Yn(t):Ur(t)}function Da(t){return qs(t)?Yn(t,!0):Br(t)}var xa=Di((function(t,e,n){Wr(t,e,n)})),Ma=Di((function(t,e,n,r){Wr(t,e,n,r)})),La=ro((function(t,e){var n={};if(null==t)return n;var r=!1;e=Me(e,(function(e){return e=Ei(e,t),r||(r=e.length>1),e})),Ai(t,oo(t),n),r&&(n=ur(n,7,eo));for(var i=e.length;i--;)hi(n,e[i]);return n}));var Ua=ro((function(t,e){return null==t?{}:function(t,e){return Hr(t,e,(function(e,n){return Ra(t,n)}))}(t,e)}));function Ba(t,e){if(null==t)return{};var n=Me(oo(t),(function(t){return[t]}));return e=uo(e),Hr(t,n,(function(t,n){return e(t,n[0])}))}var ja=Yi(Na),Fa=Yi(Da);function Va(t){return null==t?[]:tn(t,Na(t))}var Ga=Ui((function(t,e,n){return e=e.toLowerCase(),t+(n?Wa(e):e)}));function Wa(t){return Ya(Sa(t).toLowerCase())}function $a(t){return(t=Sa(t))&&t.replace(yt,on).replace(ee,"")}var za=Ui((function(t,e,n){return t+(n?"-":"")+e.toLowerCase()})),Ha=Ui((function(t,e,n){return t+(n?" ":"")+e.toLowerCase()})),qa=Li("toLowerCase");var Ja=Ui((function(t,e,n){return t+(n?"_":"")+e.toLowerCase()}));var Ka=Ui((function(t,e,n){return t+(n?" ":"")+Ya(e)}));var Xa=Ui((function(t,e,n){return t+(n?" ":"")+e.toUpperCase()})),Ya=Li("toUpperCase");function Qa(t,e,n){return t=Sa(t),(e=n?i:e)===i?function(t){return oe.test(t)}(t)?function(t){return t.match(re)||[]}(t):function(t){return t.match(lt)||[]}(t):t.match(e)||[]}var Za=Yr((function(t,e){try{return ke(t,i,e)}catch(t){return Ys(t)?t:new Tt(t)}})),tc=ro((function(t,e){return Oe(e,(function(e){e=Bo(e),sr(t,e,Ps(t[e],t))})),t}));function ec(t){return function(){return t}}var nc=Fi(),rc=Fi(!0);function ic(t){return t}function oc(t){return Lr("function"==typeof t?t:ur(t,1))}var sc=Yr((function(t,e){return function(n){return Ar(n,t,e)}})),ac=Yr((function(t,e){return function(n){return Ar(t,n,e)}}));function cc(t,e,n){var r=Na(e),i=Cr(e,r);null!=n||ea(e)&&(i.length||!r.length)||(n=e,e=t,t=this,i=Cr(e,Na(e)));var o=!(ea(n)&&"chain"in n&&!n.chain),s=Qs(t);return Oe(i,(function(n){var r=e[n];t[n]=r,s&&(t.prototype[n]=function(){var e=this.__chain__;if(o||e){var n=t(this.__wrapped__);return(n.__actions__=Pi(this.__actions__)).push({func:r,args:arguments,thisArg:t}),n.__chain__=e,n}return r.apply(t,Le([this.value()],arguments))})})),t}function uc(){}var dc=$i(Me),lc=$i(Ae),hc=$i(je);function pc(t){return bo(t)?qe(Bo(t)):function(t){return function(e){return Tr(e,t)}}(t)}var fc=Hi(),gc=Hi(!0);function vc(){return[]}function mc(){return!1}var _c=Wi((function(t,e){return t+e}),0),Sc=Ki("ceil"),Ec=Wi((function(t,e){return t/e}),1),yc=Ki("floor");var bc,Cc=Wi((function(t,e){return t*e}),1),Tc=Ki("round"),wc=Wi((function(t,e){return t-e}),0);return Vn.after=function(t,e){if("function"!=typeof e)throw new Pt(o);return t=ga(t),function(){if(--t<1)return e.apply(this,arguments)}},Vn.ary=Rs,Vn.assign=Ea,Vn.assignIn=ya,Vn.assignInWith=ba,Vn.assignWith=Ca,Vn.at=Ta,Vn.before=Os,Vn.bind=Ps,Vn.bindAll=tc,Vn.bindKey=As,Vn.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return zs(t)?t:[t]},Vn.chain=ps,Vn.chunk=function(t,e,n){e=(n?yo(t,e,n):e===i)?1:Sn(ga(e),0);var o=null==t?0:t.length;if(!o||e<1)return[];for(var s=0,a=0,c=r(fe(o/e));s<o;)c[a++]=ii(t,s,s+=e);return c},Vn.compact=function(t){for(var e=-1,n=null==t?0:t.length,r=0,i=[];++e<n;){var o=t[e];o&&(i[r++]=o)}return i},Vn.concat=function(){var t=arguments.length;if(!t)return[];for(var e=r(t-1),n=arguments[0],i=t;i--;)e[i-1]=arguments[i];return Le(zs(n)?Pi(n):[n],_r(e,1))},Vn.cond=function(t){var e=null==t?0:t.length,n=uo();return t=e?Me(t,(function(t){if("function"!=typeof t[1])throw new Pt(o);return[n(t[0]),t[1]]})):[],Yr((function(n){for(var r=-1;++r<e;){var i=t[r];if(ke(i[0],this,n))return ke(i[1],this,n)}}))},Vn.conforms=function(t){return function(t){var e=Na(t);return function(n){return dr(n,t,e)}}(ur(t,1))},Vn.constant=ec,Vn.countBy=vs,Vn.create=function(t,e){var n=Gn(t);return null==e?n:or(n,e)},Vn.curry=function t(e,n,r){var o=Qi(e,8,i,i,i,i,i,n=r?i:n);return o.placeholder=t.placeholder,o},Vn.curryRight=function t(e,n,r){var o=Qi(e,c,i,i,i,i,i,n=r?i:n);return o.placeholder=t.placeholder,o},Vn.debounce=Ns,Vn.defaults=wa,Vn.defaultsDeep=Ia,Vn.defer=Ds,Vn.delay=xs,Vn.difference=Vo,Vn.differenceBy=Go,Vn.differenceWith=Wo,Vn.drop=function(t,e,n){var r=null==t?0:t.length;return r?ii(t,(e=n||e===i?1:ga(e))<0?0:e,r):[]},Vn.dropRight=function(t,e,n){var r=null==t?0:t.length;return r?ii(t,0,(e=r-(e=n||e===i?1:ga(e)))<0?0:e):[]},Vn.dropRightWhile=function(t,e){return t&&t.length?fi(t,uo(e,3),!0,!0):[]},Vn.dropWhile=function(t,e){return t&&t.length?fi(t,uo(e,3),!0):[]},Vn.fill=function(t,e,n,r){var o=null==t?0:t.length;return o?(n&&"number"!=typeof n&&yo(t,e,n)&&(n=0,r=o),function(t,e,n,r){var o=t.length;for((n=ga(n))<0&&(n=-n>o?0:o+n),(r=r===i||r>o?o:ga(r))<0&&(r+=o),r=n>r?0:va(r);n<r;)t[n++]=e;return t}(t,e,n,r)):[]},Vn.filter=function(t,e){return(zs(t)?Ne:mr)(t,uo(e,3))},Vn.flatMap=function(t,e){return _r(Ts(t,e),1)},Vn.flatMapDeep=function(t,e){return _r(Ts(t,e),p)},Vn.flatMapDepth=function(t,e,n){return n=n===i?1:ga(n),_r(Ts(t,e),n)},Vn.flatten=Ho,Vn.flattenDeep=function(t){return(null==t?0:t.length)?_r(t,p):[]},Vn.flattenDepth=function(t,e){return(null==t?0:t.length)?_r(t,e=e===i?1:ga(e)):[]},Vn.flip=function(t){return Qi(t,512)},Vn.flow=nc,Vn.flowRight=rc,Vn.fromPairs=function(t){for(var e=-1,n=null==t?0:t.length,r={};++e<n;){var i=t[e];r[i[0]]=i[1]}return r},Vn.functions=function(t){return null==t?[]:Cr(t,Na(t))},Vn.functionsIn=function(t){return null==t?[]:Cr(t,Da(t))},Vn.groupBy=ys,Vn.initial=function(t){return(null==t?0:t.length)?ii(t,0,-1):[]},Vn.intersection=Jo,Vn.intersectionBy=Ko,Vn.intersectionWith=Xo,Vn.invert=Oa,Vn.invertBy=Pa,Vn.invokeMap=bs,Vn.iteratee=oc,Vn.keyBy=Cs,Vn.keys=Na,Vn.keysIn=Da,Vn.map=Ts,Vn.mapKeys=function(t,e){var n={};return e=uo(e,3),yr(t,(function(t,r,i){sr(n,e(t,r,i),t)})),n},Vn.mapValues=function(t,e){var n={};return e=uo(e,3),yr(t,(function(t,r,i){sr(n,r,e(t,r,i))})),n},Vn.matches=function(t){return Vr(ur(t,1))},Vn.matchesProperty=function(t,e){return Gr(t,ur(e,1))},Vn.memoize=Ms,Vn.merge=xa,Vn.mergeWith=Ma,Vn.method=sc,Vn.methodOf=ac,Vn.mixin=cc,Vn.negate=Ls,Vn.nthArg=function(t){return t=ga(t),Yr((function(e){return $r(e,t)}))},Vn.omit=La,Vn.omitBy=function(t,e){return Ba(t,Ls(uo(e)))},Vn.once=function(t){return Os(2,t)},Vn.orderBy=function(t,e,n,r){return null==t?[]:(zs(e)||(e=null==e?[]:[e]),zs(n=r?i:n)||(n=null==n?[]:[n]),zr(t,e,n))},Vn.over=dc,Vn.overArgs=Us,Vn.overEvery=lc,Vn.overSome=hc,Vn.partial=Bs,Vn.partialRight=js,Vn.partition=ws,Vn.pick=Ua,Vn.pickBy=Ba,Vn.property=pc,Vn.propertyOf=function(t){return function(e){return null==t?i:Tr(t,e)}},Vn.pull=Qo,Vn.pullAll=Zo,Vn.pullAllBy=function(t,e,n){return t&&t.length&&e&&e.length?qr(t,e,uo(n,2)):t},Vn.pullAllWith=function(t,e,n){return t&&t.length&&e&&e.length?qr(t,e,i,n):t},Vn.pullAt=ts,Vn.range=fc,Vn.rangeRight=gc,Vn.rearg=Fs,Vn.reject=function(t,e){return(zs(t)?Ne:mr)(t,Ls(uo(e,3)))},Vn.remove=function(t,e){var n=[];if(!t||!t.length)return n;var r=-1,i=[],o=t.length;for(e=uo(e,3);++r<o;){var s=t[r];e(s,r,t)&&(n.push(s),i.push(r))}return Jr(t,i),n},Vn.rest=function(t,e){if("function"!=typeof t)throw new Pt(o);return Yr(t,e=e===i?e:ga(e))},Vn.reverse=es,Vn.sampleSize=function(t,e,n){return e=(n?yo(t,e,n):e===i)?1:ga(e),(zs(t)?Zn:Zr)(t,e)},Vn.set=function(t,e,n){return null==t?t:ti(t,e,n)},Vn.setWith=function(t,e,n,r){return r="function"==typeof r?r:i,null==t?t:ti(t,e,n,r)},Vn.shuffle=function(t){return(zs(t)?tr:ri)(t)},Vn.slice=function(t,e,n){var r=null==t?0:t.length;return r?(n&&"number"!=typeof n&&yo(t,e,n)?(e=0,n=r):(e=null==e?0:ga(e),n=n===i?r:ga(n)),ii(t,e,n)):[]},Vn.sortBy=Is,Vn.sortedUniq=function(t){return t&&t.length?ci(t):[]},Vn.sortedUniqBy=function(t,e){return t&&t.length?ci(t,uo(e,2)):[]},Vn.split=function(t,e,n){return n&&"number"!=typeof n&&yo(t,e,n)&&(e=n=i),(n=n===i?v:n>>>0)?(t=Sa(t))&&("string"==typeof e||null!=e&&!sa(e))&&!(e=di(e))&&cn(t)?bi(gn(t),0,n):t.split(e,n):[]},Vn.spread=function(t,e){if("function"!=typeof t)throw new Pt(o);return e=null==e?0:Sn(ga(e),0),Yr((function(n){var r=n[e],i=bi(n,0,e);return r&&Le(i,r),ke(t,this,i)}))},Vn.tail=function(t){var e=null==t?0:t.length;return e?ii(t,1,e):[]},Vn.take=function(t,e,n){return t&&t.length?ii(t,0,(e=n||e===i?1:ga(e))<0?0:e):[]},Vn.takeRight=function(t,e,n){var r=null==t?0:t.length;return r?ii(t,(e=r-(e=n||e===i?1:ga(e)))<0?0:e,r):[]},Vn.takeRightWhile=function(t,e){return t&&t.length?fi(t,uo(e,3),!1,!0):[]},Vn.takeWhile=function(t,e){return t&&t.length?fi(t,uo(e,3)):[]},Vn.tap=function(t,e){return e(t),t},Vn.throttle=function(t,e,n){var r=!0,i=!0;if("function"!=typeof t)throw new Pt(o);return ea(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ns(t,e,{leading:r,maxWait:e,trailing:i})},Vn.thru=fs,Vn.toArray=pa,Vn.toPairs=ja,Vn.toPairsIn=Fa,Vn.toPath=function(t){return zs(t)?Me(t,Bo):ua(t)?[t]:Pi(Uo(Sa(t)))},Vn.toPlainObject=_a,Vn.transform=function(t,e,n){var r=zs(t),i=r||Ks(t)||da(t);if(e=uo(e,4),null==n){var o=t&&t.constructor;n=i?r?new o:[]:ea(t)&&Qs(o)?Gn(qt(t)):{}}return(i?Oe:yr)(t,(function(t,r,i){return e(n,t,r,i)})),n},Vn.unary=function(t){return Rs(t,1)},Vn.union=ns,Vn.unionBy=rs,Vn.unionWith=is,Vn.uniq=function(t){return t&&t.length?li(t):[]},Vn.uniqBy=function(t,e){return t&&t.length?li(t,uo(e,2)):[]},Vn.uniqWith=function(t,e){return e="function"==typeof e?e:i,t&&t.length?li(t,i,e):[]},Vn.unset=function(t,e){return null==t||hi(t,e)},Vn.unzip=os,Vn.unzipWith=ss,Vn.update=function(t,e,n){return null==t?t:pi(t,e,Si(n))},Vn.updateWith=function(t,e,n,r){return r="function"==typeof r?r:i,null==t?t:pi(t,e,Si(n),r)},Vn.values=Va,Vn.valuesIn=function(t){return null==t?[]:tn(t,Da(t))},Vn.without=as,Vn.words=Qa,Vn.wrap=function(t,e){return Bs(Si(e),t)},Vn.xor=cs,Vn.xorBy=us,Vn.xorWith=ds,Vn.zip=ls,Vn.zipObject=function(t,e){return mi(t||[],e||[],nr)},Vn.zipObjectDeep=function(t,e){return mi(t||[],e||[],ti)},Vn.zipWith=hs,Vn.entries=ja,Vn.entriesIn=Fa,Vn.extend=ya,Vn.extendWith=ba,cc(Vn,Vn),Vn.add=_c,Vn.attempt=Za,Vn.camelCase=Ga,Vn.capitalize=Wa,Vn.ceil=Sc,Vn.clamp=function(t,e,n){return n===i&&(n=e,e=i),n!==i&&(n=(n=ma(n))==n?n:0),e!==i&&(e=(e=ma(e))==e?e:0),cr(ma(t),e,n)},Vn.clone=function(t){return ur(t,4)},Vn.cloneDeep=function(t){return ur(t,5)},Vn.cloneDeepWith=function(t,e){return ur(t,5,e="function"==typeof e?e:i)},Vn.cloneWith=function(t,e){return ur(t,4,e="function"==typeof e?e:i)},Vn.conformsTo=function(t,e){return null==e||dr(t,e,Na(e))},Vn.deburr=$a,Vn.defaultTo=function(t,e){return null==t||t!=t?e:t},Vn.divide=Ec,Vn.endsWith=function(t,e,n){t=Sa(t),e=di(e);var r=t.length,o=n=n===i?r:cr(ga(n),0,r);return(n-=e.length)>=0&&t.slice(n,o)==e},Vn.eq=Vs,Vn.escape=function(t){return(t=Sa(t))&&Y.test(t)?t.replace(K,sn):t},Vn.escapeRegExp=function(t){return(t=Sa(t))&&ot.test(t)?t.replace(it,"\\$&"):t},Vn.every=function(t,e,n){var r=zs(t)?Ae:gr;return n&&yo(t,e,n)&&(e=i),r(t,uo(e,3))},Vn.find=ms,Vn.findIndex=$o,Vn.findKey=function(t,e){return Ve(t,uo(e,3),yr)},Vn.findLast=_s,Vn.findLastIndex=zo,Vn.findLastKey=function(t,e){return Ve(t,uo(e,3),br)},Vn.floor=yc,Vn.forEach=Ss,Vn.forEachRight=Es,Vn.forIn=function(t,e){return null==t?t:Sr(t,uo(e,3),Da)},Vn.forInRight=function(t,e){return null==t?t:Er(t,uo(e,3),Da)},Vn.forOwn=function(t,e){return t&&yr(t,uo(e,3))},Vn.forOwnRight=function(t,e){return t&&br(t,uo(e,3))},Vn.get=ka,Vn.gt=Gs,Vn.gte=Ws,Vn.has=function(t,e){return null!=t&&mo(t,e,Rr)},Vn.hasIn=Ra,Vn.head=qo,Vn.identity=ic,Vn.includes=function(t,e,n,r){t=qs(t)?t:Va(t),n=n&&!r?ga(n):0;var i=t.length;return n<0&&(n=Sn(i+n,0)),ca(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&We(t,e,n)>-1},Vn.indexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:ga(n);return i<0&&(i=Sn(r+i,0)),We(t,e,i)},Vn.inRange=function(t,e,n){return e=fa(e),n===i?(n=e,e=0):n=fa(n),function(t,e,n){return t>=En(e,n)&&t<Sn(e,n)}(t=ma(t),e,n)},Vn.invoke=Aa,Vn.isArguments=$s,Vn.isArray=zs,Vn.isArrayBuffer=Hs,Vn.isArrayLike=qs,Vn.isArrayLikeObject=Js,Vn.isBoolean=function(t){return!0===t||!1===t||na(t)&&Ir(t)==E},Vn.isBuffer=Ks,Vn.isDate=Xs,Vn.isElement=function(t){return na(t)&&1===t.nodeType&&!oa(t)},Vn.isEmpty=function(t){if(null==t)return!0;if(qs(t)&&(zs(t)||"string"==typeof t||"function"==typeof t.splice||Ks(t)||da(t)||$s(t)))return!t.length;var e=vo(t);if(e==w||e==P)return!t.size;if(wo(t))return!Ur(t).length;for(var n in t)if(Lt.call(t,n))return!1;return!0},Vn.isEqual=function(t,e){return Dr(t,e)},Vn.isEqualWith=function(t,e,n){var r=(n="function"==typeof n?n:i)?n(t,e):i;return r===i?Dr(t,e,i,n):!!r},Vn.isError=Ys,Vn.isFinite=function(t){return"number"==typeof t&&Ee(t)},Vn.isFunction=Qs,Vn.isInteger=Zs,Vn.isLength=ta,Vn.isMap=ra,Vn.isMatch=function(t,e){return t===e||xr(t,e,ho(e))},Vn.isMatchWith=function(t,e,n){return n="function"==typeof n?n:i,xr(t,e,ho(e),n)},Vn.isNaN=function(t){return ia(t)&&t!=+t},Vn.isNative=function(t){if(To(t))throw new Tt("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Mr(t)},Vn.isNil=function(t){return null==t},Vn.isNull=function(t){return null===t},Vn.isNumber=ia,Vn.isObject=ea,Vn.isObjectLike=na,Vn.isPlainObject=oa,Vn.isRegExp=sa,Vn.isSafeInteger=function(t){return Zs(t)&&t>=-9007199254740991&&t<=f},Vn.isSet=aa,Vn.isString=ca,Vn.isSymbol=ua,Vn.isTypedArray=da,Vn.isUndefined=function(t){return t===i},Vn.isWeakMap=function(t){return na(t)&&vo(t)==D},Vn.isWeakSet=function(t){return na(t)&&"[object WeakSet]"==Ir(t)},Vn.join=function(t,e){return null==t?"":Fe.call(t,e)},Vn.kebabCase=za,Vn.last=Yo,Vn.lastIndexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=ga(n))<0?Sn(r+o,0):En(o,r-1)),e==e?function(t,e,n){for(var r=n+1;r--;)if(t[r]===e)return r;return r}(t,e,o):Ge(t,ze,o,!0)},Vn.lowerCase=Ha,Vn.lowerFirst=qa,Vn.lt=la,Vn.lte=ha,Vn.max=function(t){return t&&t.length?vr(t,ic,kr):i},Vn.maxBy=function(t,e){return t&&t.length?vr(t,uo(e,2),kr):i},Vn.mean=function(t){return He(t,ic)},Vn.meanBy=function(t,e){return He(t,uo(e,2))},Vn.min=function(t){return t&&t.length?vr(t,ic,jr):i},Vn.minBy=function(t,e){return t&&t.length?vr(t,uo(e,2),jr):i},Vn.stubArray=vc,Vn.stubFalse=mc,Vn.stubObject=function(){return{}},Vn.stubString=function(){return""},Vn.stubTrue=function(){return!0},Vn.multiply=Cc,Vn.nth=function(t,e){return t&&t.length?$r(t,ga(e)):i},Vn.noConflict=function(){return ge._===this&&(ge._=Vt),this},Vn.noop=uc,Vn.now=ks,Vn.pad=function(t,e,n){t=Sa(t);var r=(e=ga(e))?fn(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return zi(ve(i),n)+t+zi(fe(i),n)},Vn.padEnd=function(t,e,n){t=Sa(t);var r=(e=ga(e))?fn(t):0;return e&&r<e?t+zi(e-r,n):t},Vn.padStart=function(t,e,n){t=Sa(t);var r=(e=ga(e))?fn(t):0;return e&&r<e?zi(e-r,n)+t:t},Vn.parseInt=function(t,e,n){return n||null==e?e=0:e&&(e=+e),bn(Sa(t).replace(st,""),e||0)},Vn.random=function(t,e,n){if(n&&"boolean"!=typeof n&&yo(t,e,n)&&(e=n=i),n===i&&("boolean"==typeof e?(n=e,e=i):"boolean"==typeof t&&(n=t,t=i)),t===i&&e===i?(t=0,e=1):(t=fa(t),e===i?(e=t,t=0):e=fa(e)),t>e){var r=t;t=e,e=r}if(n||t%1||e%1){var o=Cn();return En(t+o*(e-t+le("1e-"+((o+"").length-1))),e)}return Kr(t,e)},Vn.reduce=function(t,e,n){var r=zs(t)?Ue:Ke,i=arguments.length<3;return r(t,uo(e,4),n,i,pr)},Vn.reduceRight=function(t,e,n){var r=zs(t)?Be:Ke,i=arguments.length<3;return r(t,uo(e,4),n,i,fr)},Vn.repeat=function(t,e,n){return e=(n?yo(t,e,n):e===i)?1:ga(e),Xr(Sa(t),e)},Vn.replace=function(){var t=arguments,e=Sa(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Vn.result=function(t,e,n){var r=-1,o=(e=Ei(e,t)).length;for(o||(o=1,t=i);++r<o;){var s=null==t?i:t[Bo(e[r])];s===i&&(r=o,s=n),t=Qs(s)?s.call(t):s}return t},Vn.round=Tc,Vn.runInContext=t,Vn.sample=function(t){return(zs(t)?Qn:Qr)(t)},Vn.size=function(t){if(null==t)return 0;if(qs(t))return ca(t)?fn(t):t.length;var e=vo(t);return e==w||e==P?t.size:Ur(t).length},Vn.snakeCase=Ja,Vn.some=function(t,e,n){var r=zs(t)?je:oi;return n&&yo(t,e,n)&&(e=i),r(t,uo(e,3))},Vn.sortedIndex=function(t,e){return si(t,e)},Vn.sortedIndexBy=function(t,e,n){return ai(t,e,uo(n,2))},Vn.sortedIndexOf=function(t,e){var n=null==t?0:t.length;if(n){var r=si(t,e);if(r<n&&Vs(t[r],e))return r}return-1},Vn.sortedLastIndex=function(t,e){return si(t,e,!0)},Vn.sortedLastIndexBy=function(t,e,n){return ai(t,e,uo(n,2),!0)},Vn.sortedLastIndexOf=function(t,e){if(null==t?0:t.length){var n=si(t,e,!0)-1;if(Vs(t[n],e))return n}return-1},Vn.startCase=Ka,Vn.startsWith=function(t,e,n){return t=Sa(t),n=null==n?0:cr(ga(n),0,t.length),e=di(e),t.slice(n,n+e.length)==e},Vn.subtract=wc,Vn.sum=function(t){return t&&t.length?Xe(t,ic):0},Vn.sumBy=function(t,e){return t&&t.length?Xe(t,uo(e,2)):0},Vn.template=function(t,e,n){var r=Vn.templateSettings;n&&yo(t,e,n)&&(e=i),t=Sa(t),e=ba({},e,r,Zi);var o,s,a=ba({},e.imports,r.imports,Zi),c=Na(a),u=tn(a,c),d=0,l=e.interpolate||bt,h="__p += '",p=Rt((e.escape||bt).source+"|"+l.source+"|"+(l===tt?ft:bt).source+"|"+(e.evaluate||bt).source+"|$","g"),f="//# sourceURL="+(Lt.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ae+"]")+"\n";t.replace(p,(function(e,n,r,i,a,c){return r||(r=i),h+=t.slice(d,c).replace(Ct,an),n&&(o=!0,h+="' +\n__e("+n+") +\n'"),a&&(s=!0,h+="';\n"+a+";\n__p += '"),r&&(h+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),d=c+e.length,e})),h+="';\n";var g=Lt.call(e,"variable")&&e.variable;if(g){if(ht.test(g))throw new Tt("Invalid `variable` option passed into `_.template`")}else h="with (obj) {\n"+h+"\n}\n";h=(s?h.replace(z,""):h).replace(H,"$1").replace(q,"$1;"),h="function("+(g||"obj")+") {\n"+(g?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+h+"return __p\n}";var v=Za((function(){return wt(c,f+"return "+h).apply(i,u)}));if(v.source=h,Ys(v))throw v;return v},Vn.times=function(t,e){if((t=ga(t))<1||t>f)return[];var n=v,r=En(t,v);e=uo(e),t-=v;for(var i=Ye(r,e);++n<t;)e(n);return i},Vn.toFinite=fa,Vn.toInteger=ga,Vn.toLength=va,Vn.toLower=function(t){return Sa(t).toLowerCase()},Vn.toNumber=ma,Vn.toSafeInteger=function(t){return t?cr(ga(t),-9007199254740991,f):0===t?t:0},Vn.toString=Sa,Vn.toUpper=function(t){return Sa(t).toUpperCase()},Vn.trim=function(t,e,n){if((t=Sa(t))&&(n||e===i))return Qe(t);if(!t||!(e=di(e)))return t;var r=gn(t),o=gn(e);return bi(r,nn(r,o),rn(r,o)+1).join("")},Vn.trimEnd=function(t,e,n){if((t=Sa(t))&&(n||e===i))return t.slice(0,vn(t)+1);if(!t||!(e=di(e)))return t;var r=gn(t);return bi(r,0,rn(r,gn(e))+1).join("")},Vn.trimStart=function(t,e,n){if((t=Sa(t))&&(n||e===i))return t.replace(st,"");if(!t||!(e=di(e)))return t;var r=gn(t);return bi(r,nn(r,gn(e))).join("")},Vn.truncate=function(t,e){var n=30,r="...";if(ea(e)){var o="separator"in e?e.separator:o;n="length"in e?ga(e.length):n,r="omission"in e?di(e.omission):r}var s=(t=Sa(t)).length;if(cn(t)){var a=gn(t);s=a.length}if(n>=s)return t;var c=n-fn(r);if(c<1)return r;var u=a?bi(a,0,c).join(""):t.slice(0,c);if(o===i)return u+r;if(a&&(c+=u.length-c),sa(o)){if(t.slice(c).search(o)){var d,l=u;for(o.global||(o=Rt(o.source,Sa(gt.exec(o))+"g")),o.lastIndex=0;d=o.exec(l);)var h=d.index;u=u.slice(0,h===i?c:h)}}else if(t.indexOf(di(o),c)!=c){var p=u.lastIndexOf(o);p>-1&&(u=u.slice(0,p))}return u+r},Vn.unescape=function(t){return(t=Sa(t))&&X.test(t)?t.replace(J,mn):t},Vn.uniqueId=function(t){var e=++Ut;return Sa(t)+e},Vn.upperCase=Xa,Vn.upperFirst=Ya,Vn.each=Ss,Vn.eachRight=Es,Vn.first=qo,cc(Vn,(bc={},yr(Vn,(function(t,e){Lt.call(Vn.prototype,e)||(bc[e]=t)})),bc),{chain:!1}),Vn.VERSION="4.17.21",Oe(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){Vn[t].placeholder=Vn})),Oe(["drop","take"],(function(t,e){zn.prototype[t]=function(n){n=n===i?1:Sn(ga(n),0);var r=this.__filtered__&&!e?new zn(this):this.clone();return r.__filtered__?r.__takeCount__=En(n,r.__takeCount__):r.__views__.push({size:En(n,v),type:t+(r.__dir__<0?"Right":"")}),r},zn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),Oe(["filter","map","takeWhile"],(function(t,e){var n=e+1,r=1==n||3==n;zn.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:uo(t,3),type:n}),e.__filtered__=e.__filtered__||r,e}})),Oe(["head","last"],(function(t,e){var n="take"+(e?"Right":"");zn.prototype[t]=function(){return this[n](1).value()[0]}})),Oe(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");zn.prototype[t]=function(){return this.__filtered__?new zn(this):this[n](1)}})),zn.prototype.compact=function(){return this.filter(ic)},zn.prototype.find=function(t){return this.filter(t).head()},zn.prototype.findLast=function(t){return this.reverse().find(t)},zn.prototype.invokeMap=Yr((function(t,e){return"function"==typeof t?new zn(this):this.map((function(n){return Ar(n,t,e)}))})),zn.prototype.reject=function(t){return this.filter(Ls(uo(t)))},zn.prototype.slice=function(t,e){t=ga(t);var n=this;return n.__filtered__&&(t>0||e<0)?new zn(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==i&&(n=(e=ga(e))<0?n.dropRight(-e):n.take(e-t)),n)},zn.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},zn.prototype.toArray=function(){return this.take(v)},yr(zn.prototype,(function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),r=/^(?:head|last)$/.test(e),o=Vn[r?"take"+("last"==e?"Right":""):e],s=r||/^find/.test(e);o&&(Vn.prototype[e]=function(){var e=this.__wrapped__,a=r?[1]:arguments,c=e instanceof zn,u=a[0],d=c||zs(e),l=function(t){var e=o.apply(Vn,Le([t],a));return r&&h?e[0]:e};d&&n&&"function"==typeof u&&1!=u.length&&(c=d=!1);var h=this.__chain__,p=!!this.__actions__.length,f=s&&!h,g=c&&!p;if(!s&&d){e=g?e:new zn(this);var v=t.apply(e,a);return v.__actions__.push({func:fs,args:[l],thisArg:i}),new $n(v,h)}return f&&g?t.apply(this,a):(v=this.thru(l),f?r?v.value()[0]:v.value():v)})})),Oe(["pop","push","shift","sort","splice","unshift"],(function(t){var e=At[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);Vn.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return e.apply(zs(i)?i:[],t)}return this[n]((function(n){return e.apply(zs(n)?n:[],t)}))}})),yr(zn.prototype,(function(t,e){var n=Vn[e];if(n){var r=n.name+"";Lt.call(Nn,r)||(Nn[r]=[]),Nn[r].push({name:e,func:n})}})),Nn[Vi(i,2).name]=[{name:"wrapper",func:i}],zn.prototype.clone=function(){var t=new zn(this.__wrapped__);return t.__actions__=Pi(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Pi(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Pi(this.__views__),t},zn.prototype.reverse=function(){if(this.__filtered__){var t=new zn(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},zn.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=zs(t),r=e<0,i=n?t.length:0,o=function(t,e,n){var r=-1,i=n.length;for(;++r<i;){var o=n[r],s=o.size;switch(o.type){case"drop":t+=s;break;case"dropRight":e-=s;break;case"take":e=En(e,t+s);break;case"takeRight":t=Sn(t,e-s)}}return{start:t,end:e}}(0,i,this.__views__),s=o.start,a=o.end,c=a-s,u=r?a:s-1,d=this.__iteratees__,l=d.length,h=0,p=En(c,this.__takeCount__);if(!n||!r&&i==c&&p==c)return gi(t,this.__actions__);var f=[];t:for(;c--&&h<p;){for(var g=-1,v=t[u+=e];++g<l;){var m=d[g],_=m.iteratee,S=m.type,E=_(v);if(2==S)v=E;else if(!E){if(1==S)continue t;break t}}f[h++]=v}return f},Vn.prototype.at=gs,Vn.prototype.chain=function(){return ps(this)},Vn.prototype.commit=function(){return new $n(this.value(),this.__chain__)},Vn.prototype.next=function(){this.__values__===i&&(this.__values__=pa(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?i:this.__values__[this.__index__++]}},Vn.prototype.plant=function(t){for(var e,n=this;n instanceof Wn;){var r=Fo(n);r.__index__=0,r.__values__=i,e?o.__wrapped__=r:e=r;var o=r;n=n.__wrapped__}return o.__wrapped__=t,e},Vn.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof zn){var e=t;return this.__actions__.length&&(e=new zn(this)),(e=e.reverse()).__actions__.push({func:fs,args:[es],thisArg:i}),new $n(e,this.__chain__)}return this.thru(es)},Vn.prototype.toJSON=Vn.prototype.valueOf=Vn.prototype.value=function(){return gi(this.__wrapped__,this.__actions__)},Vn.prototype.first=Vn.prototype.head,Qt&&(Vn.prototype[Qt]=function(){return this}),Vn}();ge._=_n,(r=function(){return _n}.call(e,n,e,t))===i||(t.exports=r)}.call(this)},2492:(t,e,n)=>{var r=n(2980),i=n(1463)((function(t,e,n){r(t,e,n)}));t.exports=i},5062:t=>{t.exports=function(){return!1}},9881:(t,e,n)=>{var r=n(8363),i=n(1704);t.exports=function(t){return r(t,i(t))}},8660:(t,e,n)=>{var r;!function(t){!function(e){var r="object"==typeof n.g?n.g:"object"==typeof self?self:"object"==typeof this?this:Function("return this;")(),i=o(t);function o(t,e){return function(n,r){"function"!=typeof t[n]&&Object.defineProperty(t,n,{configurable:!0,writable:!0,value:r}),e&&e(n,r)}}void 0===r.Reflect?r.Reflect=t:i=o(r.Reflect,i),function(t){var e=Object.prototype.hasOwnProperty,n="function"==typeof Symbol,r=n&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=n&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",o="function"==typeof Object.create,s={__proto__:[]}instanceof Array,a=!o&&!s,c={create:o?function(){return rt(Object.create(null))}:s?function(){return rt({__proto__:null})}:function(){return rt({})},has:a?function(t,n){return e.call(t,n)}:function(t,e){return e in t},get:a?function(t,n){return e.call(t,n)?t[n]:void 0}:function(t,e){return t[e]}},u=Object.getPrototypeOf(Function),d="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,l=d||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?tt():Map,h=d||"function"!=typeof Set||"function"!=typeof Set.prototype.entries?et():Set,p=new(d||"function"!=typeof WeakMap?nt():WeakMap);function f(t,e,n,r){if(M(n)){if(!$(t))throw new TypeError;if(!H(e))throw new TypeError;return T(t,e)}if(!$(t))throw new TypeError;if(!B(e))throw new TypeError;if(!B(r)&&!M(r)&&!L(r))throw new TypeError;return L(r)&&(r=void 0),w(t,e,n=W(n),r)}function g(t,e){function n(n,r){if(!B(n))throw new TypeError;if(!M(r)&&!q(r))throw new TypeError;A(t,e,n,r)}return n}function v(t,e,n,r){if(!B(n))throw new TypeError;return M(r)||(r=W(r)),A(t,e,n,r)}function m(t,e,n){if(!B(e))throw new TypeError;return M(n)||(n=W(n)),k(t,e,n)}function _(t,e,n){if(!B(e))throw new TypeError;return M(n)||(n=W(n)),R(t,e,n)}function S(t,e,n){if(!B(e))throw new TypeError;return M(n)||(n=W(n)),O(t,e,n)}function E(t,e,n){if(!B(e))throw new TypeError;return M(n)||(n=W(n)),P(t,e,n)}function y(t,e){if(!B(t))throw new TypeError;return M(e)||(e=W(e)),N(t,e)}function b(t,e){if(!B(t))throw new TypeError;return M(e)||(e=W(e)),D(t,e)}function C(t,e,n){if(!B(e))throw new TypeError;M(n)||(n=W(n));var r=I(e,n,!1);if(M(r))return!1;if(!r.delete(t))return!1;if(r.size>0)return!0;var i=p.get(e);return i.delete(n),i.size>0||p.delete(e),!0}function T(t,e){for(var n=t.length-1;n>=0;--n){var r=(0,t[n])(e);if(!M(r)&&!L(r)){if(!H(r))throw new TypeError;e=r}}return e}function w(t,e,n,r){for(var i=t.length-1;i>=0;--i){var o=(0,t[i])(e,n,r);if(!M(o)&&!L(o)){if(!B(o))throw new TypeError;r=o}}return r}function I(t,e,n){var r=p.get(t);if(M(r)){if(!n)return;r=new l,p.set(t,r)}var i=r.get(e);if(M(i)){if(!n)return;i=new l,r.set(e,i)}return i}function k(t,e,n){if(R(t,e,n))return!0;var r=Z(e);return!L(r)&&k(t,r,n)}function R(t,e,n){var r=I(e,n,!1);return!M(r)&&V(r.has(t))}function O(t,e,n){if(R(t,e,n))return P(t,e,n);var r=Z(e);return L(r)?void 0:O(t,r,n)}function P(t,e,n){var r=I(e,n,!1);if(!M(r))return r.get(t)}function A(t,e,n,r){I(n,r,!0).set(t,e)}function N(t,e){var n=D(t,e),r=Z(t);if(null===r)return n;var i=N(r,e);if(i.length<=0)return n;if(n.length<=0)return i;for(var o=new h,s=[],a=0,c=n;a<c.length;a++){var u=c[a];o.has(u)||(o.add(u),s.push(u))}for(var d=0,l=i;d<l.length;d++){u=l[d];o.has(u)||(o.add(u),s.push(u))}return s}function D(t,e){var n=[],r=I(t,e,!1);if(M(r))return n;for(var i=K(r.keys()),o=0;;){var s=Y(i);if(!s)return n.length=o,n;var a=X(s);try{n[o]=a}catch(t){try{Q(i)}finally{throw t}}o++}}function x(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}function M(t){return void 0===t}function L(t){return null===t}function U(t){return"symbol"==typeof t}function B(t){return"object"==typeof t?null!==t:"function"==typeof t}function j(t,e){switch(x(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}var n=3===e?"string":5===e?"number":"default",i=J(t,r);if(void 0!==i){var o=i.call(t,n);if(B(o))throw new TypeError;return o}return F(t,"default"===n?"number":n)}function F(t,e){if("string"===e){var n=t.toString;if(z(n))if(!B(i=n.call(t)))return i;if(z(r=t.valueOf))if(!B(i=r.call(t)))return i}else{var r;if(z(r=t.valueOf))if(!B(i=r.call(t)))return i;var i,o=t.toString;if(z(o))if(!B(i=o.call(t)))return i}throw new TypeError}function V(t){return!!t}function G(t){return""+t}function W(t){var e=j(t,3);return U(e)?e:G(e)}function $(t){return Array.isArray?Array.isArray(t):t instanceof Object?t instanceof Array:"[object Array]"===Object.prototype.toString.call(t)}function z(t){return"function"==typeof t}function H(t){return"function"==typeof t}function q(t){switch(x(t)){case 3:case 4:return!0;default:return!1}}function J(t,e){var n=t[e];if(null!=n){if(!z(n))throw new TypeError;return n}}function K(t){var e=J(t,i);if(!z(e))throw new TypeError;var n=e.call(t);if(!B(n))throw new TypeError;return n}function X(t){return t.value}function Y(t){var e=t.next();return!e.done&&e}function Q(t){var e=t.return;e&&e.call(t)}function Z(t){var e=Object.getPrototypeOf(t);if("function"!=typeof t||t===u)return e;if(e!==u)return e;var n=t.prototype,r=n&&Object.getPrototypeOf(n);if(null==r||r===Object.prototype)return e;var i=r.constructor;return"function"!=typeof i||i===t?e:i}function tt(){var t={},e=[],n=function(){function t(t,e,n){this._index=0,this._keys=t,this._values=e,this._selector=n}return t.prototype["@@iterator"]=function(){return this},t.prototype[i]=function(){return this},t.prototype.next=function(){var t=this._index;if(t>=0&&t<this._keys.length){var n=this._selector(this._keys[t],this._values[t]);return t+1>=this._keys.length?(this._index=-1,this._keys=e,this._values=e):this._index++,{value:n,done:!1}}return{value:void 0,done:!0}},t.prototype.throw=function(t){throw this._index>=0&&(this._index=-1,this._keys=e,this._values=e),t},t.prototype.return=function(t){return this._index>=0&&(this._index=-1,this._keys=e,this._values=e),{value:t,done:!0}},t}();return function(){function e(){this._keys=[],this._values=[],this._cacheKey=t,this._cacheIndex=-2}return Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.has=function(t){return this._find(t,!1)>=0},e.prototype.get=function(t){var e=this._find(t,!1);return e>=0?this._values[e]:void 0},e.prototype.set=function(t,e){var n=this._find(t,!0);return this._values[n]=e,this},e.prototype.delete=function(e){var n=this._find(e,!1);if(n>=0){for(var r=this._keys.length,i=n+1;i<r;i++)this._keys[i-1]=this._keys[i],this._values[i-1]=this._values[i];return this._keys.length--,this._values.length--,e===this._cacheKey&&(this._cacheKey=t,this._cacheIndex=-2),!0}return!1},e.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=t,this._cacheIndex=-2},e.prototype.keys=function(){return new n(this._keys,this._values,r)},e.prototype.values=function(){return new n(this._keys,this._values,o)},e.prototype.entries=function(){return new n(this._keys,this._values,s)},e.prototype["@@iterator"]=function(){return this.entries()},e.prototype[i]=function(){return this.entries()},e.prototype._find=function(t,e){return this._cacheKey!==t&&(this._cacheIndex=this._keys.indexOf(this._cacheKey=t)),this._cacheIndex<0&&e&&(this._cacheIndex=this._keys.length,this._keys.push(t),this._values.push(void 0)),this._cacheIndex},e}();function r(t,e){return t}function o(t,e){return e}function s(t,e){return[t,e]}}function et(){return function(){function t(){this._map=new l}return Object.defineProperty(t.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),t.prototype.has=function(t){return this._map.has(t)},t.prototype.add=function(t){return this._map.set(t,t),this},t.prototype.delete=function(t){return this._map.delete(t)},t.prototype.clear=function(){this._map.clear()},t.prototype.keys=function(){return this._map.keys()},t.prototype.values=function(){return this._map.values()},t.prototype.entries=function(){return this._map.entries()},t.prototype["@@iterator"]=function(){return this.keys()},t.prototype[i]=function(){return this.keys()},t}()}function nt(){var t=16,n=c.create(),r=i();return function(){function t(){this._key=i()}return t.prototype.has=function(t){var e=o(t,!1);return void 0!==e&&c.has(e,this._key)},t.prototype.get=function(t){var e=o(t,!1);return void 0!==e?c.get(e,this._key):void 0},t.prototype.set=function(t,e){return o(t,!0)[this._key]=e,this},t.prototype.delete=function(t){var e=o(t,!1);return void 0!==e&&delete e[this._key]},t.prototype.clear=function(){this._key=i()},t}();function i(){var t;do{t="@@WeakMap@@"+u()}while(c.has(n,t));return n[t]=!0,t}function o(t,n){if(!e.call(t,r)){if(!n)return;Object.defineProperty(t,r,{value:c.create()})}return t[r]}function s(t,e){for(var n=0;n<e;++n)t[n]=255*Math.random()|0;return t}function a(t){return"function"==typeof Uint8Array?"undefined"!=typeof crypto?crypto.getRandomValues(new Uint8Array(t)):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(new Uint8Array(t)):s(new Uint8Array(t),t):s(new Array(t),t)}function u(){var e=a(t);e[6]=79&e[6]|64,e[8]=191&e[8]|128;for(var n="",r=0;r<t;++r){var i=e[r];4!==r&&6!==r&&8!==r||(n+="-"),i<16&&(n+="0"),n+=i.toString(16).toLowerCase()}return n}}function rt(t){return t.__=void 0,delete t.__,t}t("decorate",f),t("metadata",g),t("defineMetadata",v),t("hasMetadata",m),t("hasOwnMetadata",_),t("getMetadata",S),t("getOwnMetadata",E),t("getMetadataKeys",y),t("getOwnMetadataKeys",b),t("deleteMetadata",C)}(i)}()}(r||(r={}))},7539:t=>{"use strict";const e={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};e.localCName=e.generateIdentifier(),e.splitLines=function(t){return t.trim().split("\n").map((t=>t.trim()))},e.splitSections=function(t){return t.split("\nm=").map(((t,e)=>(e>0?"m="+t:t).trim()+"\r\n"))},e.getDescription=function(t){const n=e.splitSections(t);return n&&n[0]},e.getMediaSections=function(t){const n=e.splitSections(t);return n.shift(),n},e.matchPrefix=function(t,n){return e.splitLines(t).filter((t=>0===t.indexOf(n)))},e.parseCandidate=function(t){let e;e=0===t.indexOf("a=candidate:")?t.substring(12).split(" "):t.substring(10).split(" ");const n={foundation:e[0],component:{1:"rtp",2:"rtcp"}[e[1]]||e[1],protocol:e[2].toLowerCase(),priority:parseInt(e[3],10),ip:e[4],address:e[4],port:parseInt(e[5],10),type:e[7]};for(let t=8;t<e.length;t+=2)switch(e[t]){case"raddr":n.relatedAddress=e[t+1];break;case"rport":n.relatedPort=parseInt(e[t+1],10);break;case"tcptype":n.tcpType=e[t+1];break;case"ufrag":n.ufrag=e[t+1],n.usernameFragment=e[t+1];break;default:void 0===n[e[t]]&&(n[e[t]]=e[t+1])}return n},e.writeCandidate=function(t){const e=[];e.push(t.foundation);const n=t.component;"rtp"===n?e.push(1):"rtcp"===n?e.push(2):e.push(n),e.push(t.protocol.toUpperCase()),e.push(t.priority),e.push(t.address||t.ip),e.push(t.port);const r=t.type;return e.push("typ"),e.push(r),"host"!==r&&t.relatedAddress&&t.relatedPort&&(e.push("raddr"),e.push(t.relatedAddress),e.push("rport"),e.push(t.relatedPort)),t.tcpType&&"tcp"===t.protocol.toLowerCase()&&(e.push("tcptype"),e.push(t.tcpType)),(t.usernameFragment||t.ufrag)&&(e.push("ufrag"),e.push(t.usernameFragment||t.ufrag)),"candidate:"+e.join(" ")},e.parseIceOptions=function(t){return t.substr(14).split(" ")},e.parseRtpMap=function(t){let e=t.substr(9).split(" ");const n={payloadType:parseInt(e.shift(),10)};return e=e[0].split("/"),n.name=e[0],n.clockRate=parseInt(e[1],10),n.channels=3===e.length?parseInt(e[2],10):1,n.numChannels=n.channels,n},e.writeRtpMap=function(t){let e=t.payloadType;void 0!==t.preferredPayloadType&&(e=t.preferredPayloadType);const n=t.channels||t.numChannels||1;return"a=rtpmap:"+e+" "+t.name+"/"+t.clockRate+(1!==n?"/"+n:"")+"\r\n"},e.parseExtmap=function(t){const e=t.substr(9).split(" ");return{id:parseInt(e[0],10),direction:e[0].indexOf("/")>0?e[0].split("/")[1]:"sendrecv",uri:e[1]}},e.writeExtmap=function(t){return"a=extmap:"+(t.id||t.preferredId)+(t.direction&&"sendrecv"!==t.direction?"/"+t.direction:"")+" "+t.uri+"\r\n"},e.parseFmtp=function(t){const e={};let n;const r=t.substr(t.indexOf(" ")+1).split(";");for(let t=0;t<r.length;t++)n=r[t].trim().split("="),e[n[0].trim()]=n[1];return e},e.writeFmtp=function(t){let e="",n=t.payloadType;if(void 0!==t.preferredPayloadType&&(n=t.preferredPayloadType),t.parameters&&Object.keys(t.parameters).length){const r=[];Object.keys(t.parameters).forEach((e=>{void 0!==t.parameters[e]?r.push(e+"="+t.parameters[e]):r.push(e)})),e+="a=fmtp:"+n+" "+r.join(";")+"\r\n"}return e},e.parseRtcpFb=function(t){const e=t.substr(t.indexOf(" ")+1).split(" ");return{type:e.shift(),parameter:e.join(" ")}},e.writeRtcpFb=function(t){let e="",n=t.payloadType;return void 0!==t.preferredPayloadType&&(n=t.preferredPayloadType),t.rtcpFeedback&&t.rtcpFeedback.length&&t.rtcpFeedback.forEach((t=>{e+="a=rtcp-fb:"+n+" "+t.type+(t.parameter&&t.parameter.length?" "+t.parameter:"")+"\r\n"})),e},e.parseSsrcMedia=function(t){const e=t.indexOf(" "),n={ssrc:parseInt(t.substr(7,e-7),10)},r=t.indexOf(":",e);return r>-1?(n.attribute=t.substr(e+1,r-e-1),n.value=t.substr(r+1)):n.attribute=t.substr(e+1),n},e.parseSsrcGroup=function(t){const e=t.substr(13).split(" ");return{semantics:e.shift(),ssrcs:e.map((t=>parseInt(t,10)))}},e.getMid=function(t){const n=e.matchPrefix(t,"a=mid:")[0];if(n)return n.substr(6)},e.parseFingerprint=function(t){const e=t.substr(14).split(" ");return{algorithm:e[0].toLowerCase(),value:e[1].toUpperCase()}},e.getDtlsParameters=function(t,n){return{role:"auto",fingerprints:e.matchPrefix(t+n,"a=fingerprint:").map(e.parseFingerprint)}},e.writeDtlsParameters=function(t,e){let n="a=setup:"+e+"\r\n";return t.fingerprints.forEach((t=>{n+="a=fingerprint:"+t.algorithm+" "+t.value+"\r\n"})),n},e.parseCryptoLine=function(t){const e=t.substr(9).split(" ");return{tag:parseInt(e[0],10),cryptoSuite:e[1],keyParams:e[2],sessionParams:e.slice(3)}},e.writeCryptoLine=function(t){return"a=crypto:"+t.tag+" "+t.cryptoSuite+" "+("object"==typeof t.keyParams?e.writeCryptoKeyParams(t.keyParams):t.keyParams)+(t.sessionParams?" "+t.sessionParams.join(" "):"")+"\r\n"},e.parseCryptoKeyParams=function(t){if(0!==t.indexOf("inline:"))return null;const e=t.substr(7).split("|");return{keyMethod:"inline",keySalt:e[0],lifeTime:e[1],mkiValue:e[2]?e[2].split(":")[0]:void 0,mkiLength:e[2]?e[2].split(":")[1]:void 0}},e.writeCryptoKeyParams=function(t){return t.keyMethod+":"+t.keySalt+(t.lifeTime?"|"+t.lifeTime:"")+(t.mkiValue&&t.mkiLength?"|"+t.mkiValue+":"+t.mkiLength:"")},e.getCryptoParameters=function(t,n){return e.matchPrefix(t+n,"a=crypto:").map(e.parseCryptoLine)},e.getIceParameters=function(t,n){const r=e.matchPrefix(t+n,"a=ice-ufrag:")[0],i=e.matchPrefix(t+n,"a=ice-pwd:")[0];return r&&i?{usernameFragment:r.substr(12),password:i.substr(10)}:null},e.writeIceParameters=function(t){let e="a=ice-ufrag:"+t.usernameFragment+"\r\na=ice-pwd:"+t.password+"\r\n";return t.iceLite&&(e+="a=ice-lite\r\n"),e},e.parseRtpParameters=function(t){const n={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=e.splitLines(t)[0].split(" ");for(let i=3;i<r.length;i++){const o=r[i],s=e.matchPrefix(t,"a=rtpmap:"+o+" ")[0];if(s){const r=e.parseRtpMap(s),i=e.matchPrefix(t,"a=fmtp:"+o+" ");switch(r.parameters=i.length?e.parseFmtp(i[0]):{},r.rtcpFeedback=e.matchPrefix(t,"a=rtcp-fb:"+o+" ").map(e.parseRtcpFb),n.codecs.push(r),r.name.toUpperCase()){case"RED":case"ULPFEC":n.fecMechanisms.push(r.name.toUpperCase())}}}return e.matchPrefix(t,"a=extmap:").forEach((t=>{n.headerExtensions.push(e.parseExtmap(t))})),n},e.writeRtpDescription=function(t,n){let r="";r+="m="+t+" ",r+=n.codecs.length>0?"9":"0",r+=" UDP/TLS/RTP/SAVPF ",r+=n.codecs.map((t=>void 0!==t.preferredPayloadType?t.preferredPayloadType:t.payloadType)).join(" ")+"\r\n",r+="c=IN IP4 0.0.0.0\r\n",r+="a=rtcp:9 IN IP4 0.0.0.0\r\n",n.codecs.forEach((t=>{r+=e.writeRtpMap(t),r+=e.writeFmtp(t),r+=e.writeRtcpFb(t)}));let i=0;return n.codecs.forEach((t=>{t.maxptime>i&&(i=t.maxptime)})),i>0&&(r+="a=maxptime:"+i+"\r\n"),n.headerExtensions&&n.headerExtensions.forEach((t=>{r+=e.writeExtmap(t)})),r},e.parseRtpEncodingParameters=function(t){const n=[],r=e.parseRtpParameters(t),i=-1!==r.fecMechanisms.indexOf("RED"),o=-1!==r.fecMechanisms.indexOf("ULPFEC"),s=e.matchPrefix(t,"a=ssrc:").map((t=>e.parseSsrcMedia(t))).filter((t=>"cname"===t.attribute)),a=s.length>0&&s[0].ssrc;let c;const u=e.matchPrefix(t,"a=ssrc-group:FID").map((t=>t.substr(17).split(" ").map((t=>parseInt(t,10)))));u.length>0&&u[0].length>1&&u[0][0]===a&&(c=u[0][1]),r.codecs.forEach((t=>{if("RTX"===t.name.toUpperCase()&&t.parameters.apt){let e={ssrc:a,codecPayloadType:parseInt(t.parameters.apt,10)};a&&c&&(e.rtx={ssrc:c}),n.push(e),i&&(e=JSON.parse(JSON.stringify(e)),e.fec={ssrc:a,mechanism:o?"red+ulpfec":"red"},n.push(e))}})),0===n.length&&a&&n.push({ssrc:a});let d=e.matchPrefix(t,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substr(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substr(5),10)*.95-16e3:void 0,n.forEach((t=>{t.maxBitrate=d}))),n},e.parseRtcpParameters=function(t){const n={},r=e.matchPrefix(t,"a=ssrc:").map((t=>e.parseSsrcMedia(t))).filter((t=>"cname"===t.attribute))[0];r&&(n.cname=r.value,n.ssrc=r.ssrc);const i=e.matchPrefix(t,"a=rtcp-rsize");n.reducedSize=i.length>0,n.compound=0===i.length;const o=e.matchPrefix(t,"a=rtcp-mux");return n.mux=o.length>0,n},e.writeRtcpParameters=function(t){let e="";return t.reducedSize&&(e+="a=rtcp-rsize\r\n"),t.mux&&(e+="a=rtcp-mux\r\n"),void 0!==t.ssrc&&t.cname&&(e+="a=ssrc:"+t.ssrc+" cname:"+t.cname+"\r\n"),e},e.parseMsid=function(t){let n;const r=e.matchPrefix(t,"a=msid:");if(1===r.length)return n=r[0].substr(7).split(" "),{stream:n[0],track:n[1]};const i=e.matchPrefix(t,"a=ssrc:").map((t=>e.parseSsrcMedia(t))).filter((t=>"msid"===t.attribute));return i.length>0?(n=i[0].value.split(" "),{stream:n[0],track:n[1]}):void 0},e.parseSctpDescription=function(t){const n=e.parseMLine(t),r=e.matchPrefix(t,"a=max-message-size:");let i;r.length>0&&(i=parseInt(r[0].substr(19),10)),isNaN(i)&&(i=65536);const o=e.matchPrefix(t,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:n.fmt,maxMessageSize:i};const s=e.matchPrefix(t,"a=sctpmap:");if(s.length>0){const t=s[0].substr(10).split(" ");return{port:parseInt(t[0],10),protocol:t[1],maxMessageSize:i}}},e.writeSctpDescription=function(t,e){let n=[];return n="DTLS/SCTP"!==t.protocol?["m="+t.kind+" 9 "+t.protocol+" "+e.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+e.port+"\r\n"]:["m="+t.kind+" 9 "+t.protocol+" "+e.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+e.port+" "+e.protocol+" 65535\r\n"],void 0!==e.maxMessageSize&&n.push("a=max-message-size:"+e.maxMessageSize+"\r\n"),n.join("")},e.generateSessionId=function(){return Math.random().toString().substr(2,21)},e.writeSessionBoilerplate=function(t,n,r){let i;const o=void 0!==n?n:2;i=t||e.generateSessionId();return"v=0\r\no="+(r||"thisisadapterortc")+" "+i+" "+o+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},e.getDirection=function(t,n){const r=e.splitLines(t);for(let t=0;t<r.length;t++)switch(r[t]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[t].substr(2)}return n?e.getDirection(n):"sendrecv"},e.getKind=function(t){return e.splitLines(t)[0].split(" ")[0].substr(2)},e.isRejected=function(t){return"0"===t.split(" ",2)[1]},e.parseMLine=function(t){const n=e.splitLines(t)[0].substr(2).split(" ");return{kind:n[0],port:parseInt(n[1],10),protocol:n[2],fmt:n.slice(3).join(" ")}},e.parseOLine=function(t){const n=e.matchPrefix(t,"o=")[0].substr(2).split(" ");return{username:n[0],sessionId:n[1],sessionVersion:parseInt(n[2],10),netType:n[3],addressType:n[4],address:n[5]}},e.isValidSDP=function(t){if("string"!=typeof t||0===t.length)return!1;const n=e.splitLines(t);for(let t=0;t<n.length;t++)if(n[t].length<2||"="!==n[t].charAt(1))return!1;return!0},t.exports=e},477:t=>{"use strict";t.exports=function(t,e,n,r){var i=self||window;try{try{var o;try{o=new i.Blob([t])}catch(e){(o=new(i.BlobBuilder||i.WebKitBlobBuilder||i.MozBlobBuilder||i.MSBlobBuilder)).append(t),o=o.getBlob()}var s=i.URL||i.webkitURL,a=s.createObjectURL(o),c=new i[e](a,n);return s.revokeObjectURL(a),c}catch(r){return new i[e]("data:application/javascript,".concat(encodeURIComponent(t)),n)}}catch(t){if(!r)throw Error("Inline worker is not supported");return new i[e](r,n)}}}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={id:r,loaded:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var r={};return(()=>{"use strict";n.r(r),n.d(r,{BASIC_FULL_HD_LANDSCAPE:()=>yt,BASIC_FULL_HD_PORTRAIT:()=>bt,BASIC_LANDSCAPE:()=>St,BASIC_PORTRAIT:()=>Et,BroadcastClientError:()=>BroadcastClientError,BroadcastClientEvents:()=>xe,BroadcastStageConnectionEvents:()=>be,BroadcastStageSubscriptionEvents:()=>Ce,ConnectionState:()=>Ue,DEFAULT_STAGE_LANDSCAPE:()=>Zt,DEFAULT_STAGE_PORTRAIT:()=>te,Errors:()=>t,LOG_LEVEL:()=>T,LogLevels:()=>T,STANDARD_LANDSCAPE:()=>Ct,STANDARD_PORTRAIT:()=>Tt,__version:()=>qr,create:()=>Hr,createStageClient:()=>Jr,default:()=>Yr,isSupported:()=>Dr,stagesSendJoinEvent:()=>Kr,stagesSendLeaveEvent:()=>Xr});var t={};n.r(t),n.d(t,{ADD_DEVICE_COMPOSITION_INDEX_MISSING_ERROR:()=>N,ADD_DEVICE_COMPOSITION_MISSING_ERROR:()=>A,ADD_DEVICE_CONSTRAINTS_ERROR:()=>M,ADD_DEVICE_DEVICE_ERROR:()=>O,ADD_DEVICE_NAME_EXISTS_ERROR:()=>P,ADD_DEVICE_NAME_MISSING_ERROR:()=>D,ADD_DEVICE_UNSUPPORTED:()=>x,BROADCAST_CONFIGURATION_ERROR:()=>H,BROADCAST_ERROR:()=>I,CAMERA_ERROR:()=>k,CLIENT_INVALID_ERROR:()=>Q,EXCHANGE_POSITION_DEVICE_NOT_FOUND_ERROR:()=>V,FAILED_TO_ADD_IMAGE_ERROR:()=>G,INGEST_ENDPOINT_TYPE_ERROR:()=>J,INGEST_ENDPOINT_URL_ERROR:()=>K,INPUT_ERROR:()=>R,INVALID_STREAM_KEY:()=>z,LOGGER_TYPE_ERROR:()=>Y,LOG_LEVEL_TYPE_ERROR:()=>X,NETWORK_RECONNECT_CONFIGURATION_ERROR:()=>Z,NETWORK_RECONNECT_CONFIGURATION_INVALID_TIMEOUT_ERROR:()=>tt,PEER_CONNECTION_ERROR:()=>$,PEER_SETUP_ERROR:()=>W,REMOVE_DEVICE_NOT_FOUND_ERROR:()=>L,REMOVE_IMAGE_NOT_FOUND_ERROR:()=>U,STAGE_TOKEN_TYPE_ERROR:()=>nt,STAGE_WHIP_OVERRIDE_ERROR:()=>rt,STREAM_CONFIGURATION_ERROR:()=>q,STREAM_KEY_INVALID_CHAR_ERROR:()=>et,UPDATE_VIDEO_DEVICE_COMPOSITION_INDEX_MISSING_ERROR:()=>j,UPDATE_VIDEO_DEVICE_COMPOSITION_MISSING_ERROR:()=>B,UPDATE_VIDEO_DEVICE_COMPOSITION_NAME_NOT_FOUND_ERROR:()=>F});var e={};n.r(e),n.d(e,{fixNegotiationNeeded:()=>er,shimAddTrackRemoveTrack:()=>Zn,shimAddTrackRemoveTrackWithNative:()=>Qn,shimGetDisplayMedia:()=>Hn,shimGetSendersWithDtmf:()=>Kn,shimGetStats:()=>Xn,shimGetUserMedia:()=>zn,shimMediaStream:()=>qn,shimOnTrack:()=>Jn,shimPeerConnection:()=>tr,shimSenderReceiverGetStats:()=>Yn});var i={};n.r(i),n.d(i,{shimAddTransceiver:()=>dr,shimCreateAnswer:()=>pr,shimCreateOffer:()=>hr,shimGetDisplayMedia:()=>rr,shimGetParameters:()=>lr,shimGetUserMedia:()=>nr,shimOnTrack:()=>ir,shimPeerConnection:()=>or,shimRTCDataChannel:()=>ur,shimReceiverGetStats:()=>ar,shimRemoveStream:()=>cr,shimSenderGetStats:()=>sr});var o={};n.r(o),n.d(o,{shimAudioContext:()=>br,shimCallbacksAPI:()=>vr,shimConstraints:()=>_r,shimCreateOfferLegacy:()=>yr,shimGetUserMedia:()=>mr,shimLocalStreamsAPI:()=>fr,shimRTCIceServerUrls:()=>Sr,shimRemoteStreamsAPI:()=>gr,shimTrackEventTransceiver:()=>Er});var s={};n.r(s),n.d(s,{removeExtmapAllowMixed:()=>Pr,shimAddIceCandidateNullOrEmpty:()=>Ar,shimConnectionState:()=>Or,shimMaxMessageSize:()=>kr,shimParameterlessSetLocalDescription:()=>Nr,shimRTCIceCandidate:()=>wr,shimRTCIceCandidateRelayProtocol:()=>Ir,shimSendThrowTypeError:()=>Rr});var a={};n.r(a),n.d(a,{BASIC_FULL_HD_LANDSCAPE:()=>yt,BASIC_FULL_HD_PORTRAIT:()=>bt,BASIC_LANDSCAPE:()=>St,BASIC_PORTRAIT:()=>Et,BroadcastClientError:()=>BroadcastClientError,BroadcastClientEvents:()=>xe,ConnectionState:()=>Ue,Errors:()=>t,LOG_LEVEL:()=>T,LogLevels:()=>T,STANDARD_LANDSCAPE:()=>Ct,STANDARD_PORTRAIT:()=>Tt,__version:()=>qr,create:()=>Hr,isSupported:()=>Dr});n(8660);var c,u=n(6729),d=n.n(u),l=n(1206);function h(t){const e="0123456789abcdef";let n="";for(let r=0;r<t;r+=1)n+=e.charAt(Math.floor(Math.random()*e.length));return n}class RequestUUID{constructor(){const t=h;this.value=`${t(8)}-${t(4)}-${t(4)}-${t(4)}-${t(12)}`}}function p(){return new RequestUUID}class TraceId{constructor(){const t=(Date.now()/1e3|0).toString(16);this.value=`1-${t}-${h(24)}`}}function f(){return new TraceId}let g,v;function m(t){return g!==t.stageARN&&(g=t.stageARN,v=void 0),v||(v=h(32)),v}!function(t){t.PUBLISHED_VIDEO_STATS="ivs_broadcast_webrtc_published_video_stats",t.PUBLISHED_VIDEO_STATS_WINDOW="ivs_broadcast_webrtc_published_video_stats_window",t.PUBLISHED_AUDIO_STATS="ivs_broadcast_webrtc_published_audio_stats",t.PUBLISHED_AUDIO_STATS_WINDOW="ivs_broadcast_webrtc_published_audio_stats_window",t.SUBSCRIBED_VIDEO_STATS="ivs_broadcast_webrtc_subscribed_video_stats",t.SUBSCRIBED_VIDEO_STATS_WINDOW="ivs_broadcast_webrtc_sbcrbd_video_stats_window",t.SUBSCRIBED_AUDIO_STATS="ivs_broadcast_webrtc_subscribed_audio_stats",t.SUBSCRIBED_AUDIO_STATS_WINDOW="ivs_broadcast_webrtc_sbcrbd_audio_stats_window",t.PUBLISH="ivs_broadcast_multihost_publish",t.UNPUBLISH="ivs_broadcast_multihost_unpublish",t.SUBSCRIBE="ivs_broadcast_multihost_subscribe",t.UNSUBSCRIBE="ivs_broadcast_multihost_unsubscribe",t.PUBLISH_STARTED="ivs_broadcast_multihost_publish_started",t.PUBLISH_ENDED="ivs_broadcast_multihost_publish_ended",t.STATE_UPDATED="ivs_broadcast_multihost_event_state_updated",t.SUBSCRIBE_STARTED="ivs_broadcast_multihost_subscribe_started",t.SUBSCRIBE_ENDED="ivs_broadcast_multihost_subscribe_ended",t.JOIN="ivs_broadcast_multihost_join",t.LEAVE="ivs_broadcast_multihost_leave",t.SERVER_REQUEST="ivs_broadcast_multihost_server_request",t.TRACE="ivs_broadcast_stage_trace",t.ERROR="ivs_broadcast_error",t.MINUTE="ivs_broadcast_multihost_minute",t.CONNECTION_STATE="ivs_broadcast_webrtc_connection_state",t.ICE_GATHERING_STATE="ivs_broadcast_webrtc_gathering_state",t.EDP_CONNECTED="ivs_broadcast_multihost_event_connected",t.EDP_DISCONNECTED="ivs_broadcast_multihost_event_disconnected",t.EDP_PONG="ivs_broadcast_multihost_edp_rtt",t.SIMULCAST_LAYER_INFO="ivs_broadcast_simulcast_layer_info",t.MULTIHOST_CONFIGURATION="ivs_broadcast_multihost_configuration"}(c||(c={}));class StageAnalyticsEvent{constructor(t,e,n,r){let i="unknown";if(e.stageARN&&e.stageARN.startsWith("arn:aws:ivs:")){const t=e.stageARN.split(":");6===t.length&&(i=t[4])}this.event=t,this.properties={client_time:(new Date).toISOString(),customer_id:i,device_software:window.navigator.userAgent,multihost_id:e.stageARN,participant_id:e.participantID,participant_user_id:e.userID,platform:"web",sdk_version:"1.5.0",session_id:m(e),stage_arn:e.stageARN,trace_id:n.value},e.attrGsRole&&(this.properties.token_attribute_0=e.attrGsRole),e.attrGsSessionId&&(this.properties.token_attribute_1=e.attrGsSessionId),this.critical=r}}class StageErrorEvent extends StageAnalyticsEvent{constructor(t){super(c.ERROR,t.token,t.traceId,!0),Object.assign(this.properties,{code:t.code,tag:t.tag,description:t.message,remote_participant_id:t.remoteParticipantId,request_uuid:t.requestUUID,is_nominal:t.nominal,is_fatal:t.fatal})}}var _=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};const S=4;class SpadeClient{constructor(t="https://broadcast.stats.live-video.net/"){this.spadeUrl=t}send(t,e=!1){return _(this,void 0,void 0,(function*(){const n=Date.now();for(const e of t)e.properties.batch_time_millis=n;const r={"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},i=`data=${this.b64EncodeUnicode(JSON.stringify(t))}`;e?navigator.sendBeacon(this.spadeUrl,i):function(t,e,n={},r=""){_(this,void 0,void 0,(function*(){const i=new XMLHttpRequest;return i.open(t,e,!0),n&&Object.keys(n).forEach((t=>{n.hasOwnProperty(t)&&i.setRequestHeader(t,n[t])})),new Promise(((n,o)=>{i.onreadystatechange=()=>{i.readyState===S&&(i.status>=200&&i.status<300?n(i.responseText):o(new Error(`Spade ${t} ${e} responded ${i.status}\n${i.responseText}`)))},i.send(r)}))}))}("POST",this.spadeUrl,r,i)}))}b64EncodeUnicode(t){return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(Number(`0x${e}`)))))}}function E(t){if(!t)throw new Error("SpadeClient is not defined")}class AnalyticsTracker{constructor(t){this.sharedProperties={},this.spadeClient={},this.queuedEvents=[],this.init({spadeUrl:t})}static getInstance(t){return AnalyticsTracker.instance||(AnalyticsTracker.instance=new AnalyticsTracker(null!=t?t:"https://broadcast.stats.live-video.net/")),AnalyticsTracker.instance}start(){this.sessionId=this.newGuid(),this.sharedProperties.session_id=this.sessionId,this.flushInterval||(this.flushInterval=window.setInterval((()=>{this.flushEvents()}),1e3))}stop(t){let e=!1;clearInterval(this.flushInterval),this.flushInterval=void 0,t&&(this.queuedEvents=this.queuedEvents.filter((t=>t.critical)),e=!0),this.flushEvents(e)}trackEvent(t){t.data.properties=Object.assign({},this.sharedProperties,t.data.properties),this.queuedEvents.push(t.data)}trackEventNoSharedProps(t){this.queuedEvents.push(t)}trackErrorAndThrow(t){throw this.trackError(t),t}trackError(t){AnalyticsTracker.getInstance().trackEventNoSharedProps(new StageErrorEvent(t))}batchEvents(t){E(this.spadeClient);const e=t.map((t=>(t.data.properties=Object.assign({},this.sharedProperties,t.data.properties),t.data)));this.spadeClient.send(e)}init({spadeUrl:t}){this.spadeClient=new SpadeClient(t);const e=l.getParser(navigator.userAgent),n=this.parseSemver(String(e.getBrowserVersion()));this.sharedProperties={browser:navigator.appVersion,browser_family:e.getBrowserName().toLowerCase(),browser_version:`${n.major}.${n.minor}`,customer_id:"ivs",os_name:e.getOSName(),os_version:String(e.getOSVersion()),platform:"web",session_id:this.sessionId,sdk_version:"1.5.0",user_agent:navigator.userAgent,sfu_resource:void 0}}setSfuResource(t){this.sharedProperties.sfu_resource=t}getSfuResource(){return this.sharedProperties.sfu_resource}newGuid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(t=>{const e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))}flushEvents(t=!1){E(this.spadeClient),this.queuedEvents.length>0&&this.spadeClient.send(this.queuedEvents,t),this.queuedEvents=[]}parseSemver(t){const e=/^(\d+)\.(\d+)\.(\d+)[+|-]?(.*)?$/.exec(t)||/^(\d+)\.(\d+)[+|-]?(.*)?$/.exec(t)||/^(\d+)$/.exec(t)||[];return{major:parseInt(e[1],10)||0,minor:parseInt(e[2],10)||0,patch:parseInt(e[3],10)||0}}}const y=1007,b=12e4,C=3e5;class BroadcastClientError extends Error{constructor({name:t,message:e,code:n,details:r,cause:i,params:o}){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,BroadcastClientError),this.name=t||"BroadcastClientError",this.message=e,this.code=n,this.details=r,this.cause=i,this.params=o}}var T,w;!function(t){t[t.TRACE=0]="TRACE",t[t.DEBUG=1]="DEBUG",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(T||(T={})),function(t){t.SPADE="SPADE",t.TIME="Time",t.WEBRTC="WebRTC",t.EMITTER="Emitter",t.MEDIA="Media",t.SUBSCRIPTION="StageSubscription",t.PUBLICATION="StagePublication",t.CONNECTION="StageConnection",t.SOCKET="StageSocket",t.BROADCAST_STAGE_CLIENT="BroadcastStageClient",t.STAGE="Stage",t.REMOTE_PARTICIPANT="RemoteParticipant",t.LOCAL_PARTICIPANT="LocalParticipant"}(w||(w={}));const I={name:"BroadcastError",code:1e3,message:"Unable to broadcast"},k={name:"CameraError",code:2e3,message:"Camera could not be captured"},R={name:"InputError",code:3e3,message:"Input could not be attached"},O={name:"AddDeviceError",code:4e3,message:"Device is missing"},P={name:"AddDeviceNameExistsError",code:4001,message:"Name is already registered"},A={name:"AddDeviceCompositionMissingError",code:4002,message:"VideoComposition is missing"},N={name:"AddDeviceCompositionIndexMissingError",code:4003,message:'VideoComposition\'s "index" property is missing'},D={name:"AddDeviceNameMissingError",code:4004,message:"Name property is missing"},x={name:"AddDeviceUnsupported",code:4005,message:"Unsupported device"},M={name:"AddDeviceConstraintsError",code:4006,message:"Constraints error"},L={name:"RemoveDeviceNotFoundError",code:5e3,message:"Device not found"},U={name:"RemoveImageNotFoundError",code:6e3,message:"Image not found"},B={name:"UpdateVideoDeviceCompositionMissingError",code:7e3,message:"VideoComposition is missing"},j={name:"UpdateVideoDeviceCompositionIndexMissingError",code:7001,message:'VideoComposition\'s "index" property is missing'},F={name:"UpdateVideoDeviceCompositionNameMissingError",code:7002,message:"Video device with that name is not found"},V={name:"ExchangePositionDeviceNotFoundError",code:8e3,message:"Device with that name is not found"},G={name:"FailedToAddImageError",code:9e3,message:"Failed to add image"},W={name:"PeerSetupError",code:1e4,message:"Unexpected return value from setup request"},$={name:"PeerConnectionError",code:10001,message:"Peer connection has failed."},z={name:"InvalidStreamKey",code:10003,message:"Invalid Stream Key."},H={name:"BroadcastConfigurationError",code:11e3,message:"Error when configuring broadcast client"},q={name:"StreamConfigurationError",code:12e3,message:"Error when configuring stream"},J={name:"IngestEndpointTypeError",code:13e3,message:"Ingest endpoint must be a string"},K={name:"IngestEndpointUrlError",code:13001,message:"Ingest endpoint must be a valid https or rtmps URL"},X={name:"LogLevelTypeError",code:14e3,message:"Log Level must be a valid integer between [0..5]"},Y={name:"LoggerTypeError",code:15e3,message:"Logger must be an object"},Q={name:"ClientInvalidError",code:16e3,message:"Client is no longer valid, possibly due to delete() invocation."},Z={name:"NetworkReconnectConfigurationError",code:17e3,message:"Error when configuring network reconnect"},tt={name:"NetworkReconnectConfigurationInvalidTimeoutError",code:17001,message:"Network reconnect timeout value must be a number between [10000, 300000]"},et={name:"StreamKeyInvalidCharError",code:18e3,message:"Streamkey must contain only [A-Za-z0-9_-] characters"},nt={name:"StageTokenTypeError",code:19e3,message:"Stage token must be a string"},rt={name:"StageWhipUrlOverrideError",code:19001,message:"Stage WHIP override URL must be a string starting with http"};var it,ot,st,at,ct,ut,dt,lt,ht,pt=function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)},ft=function(t,e,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(t,n):i?i.value=n:e.set(t,n),n};const gt=1920,vt=1080,mt="missing stream configuration",_t=T.ERROR,St={maxResolution:{width:852,height:480},maxFramerate:30,maxBitrate:1500},Et={maxResolution:{width:480,height:852},maxFramerate:30,maxBitrate:1500},yt={maxResolution:{width:1920,height:1080},maxFramerate:30,maxBitrate:3500},bt={maxResolution:{width:1080,height:1920},maxFramerate:30,maxBitrate:3500},Ct={maxResolution:{width:1920,height:1080},maxFramerate:30,maxBitrate:8500},Tt={maxResolution:{width:1080,height:1920},maxFramerate:30,maxBitrate:8500},wt={reconnect:!1,timeout:b};function It(t){var e,n;if("string"!=typeof t&&void 0!==t)throw new BroadcastClientError(J);if(t){if(t.startsWith("https"))return t;{const r=/(?<protocol>(rtmps|https):\/\/)?(?<id>.+)\.(?<environment>(?=\S*['-])([a-zA-Z'-]+))\.live-video\.net.*/.exec(t);if("rtmps"===(null===(e=null==r?void 0:r.groups)||void 0===e?void 0:e.protocol)&&console.warn("rtmps server url detected; please pass in the ingest endpoint (no rtmps:// protocol) instead"),null===(n=null==r?void 0:r.groups)||void 0===n?void 0:n.id)return`https://${r.groups.id}.webrtc.live-video.net:4443`;throw new BroadcastClientError(K)}}return""}class Config{constructor(t,e,n=St,r,i=wt){this.LOG_LEVEL=T,this.BASIC_LANDSCAPE=St,this.BASIC_PORTRAIT=Et,this.BASIC_FULL_HD_LANDSCAPE=yt,this.BASIC_FULL_HD_PORTRAIT=bt,this.STANDARD_LANDSCAPE=Ct,this.STANDARD_PORTRAIT=Tt,it.set(this,void 0),ot.set(this,void 0),st.set(this,St),at.set(this,void 0),ct.set(this,wt),ut.set(this,(t=>{if(!t)throw new BroadcastClientError(Object.assign(Object.assign({},q),{details:mt}));if(!(t.maxBitrate<=8500&&t.maxBitrate>=200))throw new BroadcastClientError(Object.assign(Object.assign({},q),{details:"maxBitrate must be between 200 and 8500"}));if(!(t.maxFramerate<=60&&t.maxFramerate>=10))throw new BroadcastClientError(Object.assign(Object.assign({},q),{details:"maxFramerate must be between 10 and 60"}));const e=t.maxResolution.width,n=t.maxResolution.height;if(e>gt||n>gt||e<160||n<160||(e===gt&&n>vt||n===gt&&e>vt))throw new BroadcastClientError(Object.assign(Object.assign({},q),{details:"maxResolution values must be between 1080x1920 or 1920x1080"}))})),dt.set(this,(t=>{if(!t)return;const e=Number(t),n=Number.isInteger(e),r=e>=T.TRACE,i=e<=T.SILENT;if(!n||!r||!i)throw new BroadcastClientError(X)})),lt.set(this,(t=>{if(t&&"object"!=typeof t)throw new BroadcastClientError(Y)})),ht.set(this,(t=>{if(!t)return;if("object"!=typeof t||"boolean"!=typeof t.reconnect)throw new BroadcastClientError(Z);const{timeout:e}=t;if(void 0!==e&&(Number.isNaN(e)||"number"!=typeof e||e<1e4||e>C))throw new BroadcastClientError(tt)})),pt(this,lt,"f").call(this,r),pt(this,dt,"f").call(this,e),pt(this,ut,"f").call(this,n),ft(this,it,t,"f"),ft(this,ot,e,"f"),ft(this,st,n,"f"),ft(this,at,r,"f"),ft(this,ct,i,"f")}get ingestEndpoint(){return pt(this,it,"f")}set ingestEndpoint(t){ft(this,it,It(t),"f")}get streamConfig(){return pt(this,st,"f")}set streamConfig(t){pt(this,ut,"f").call(this,t),ft(this,st,t,"f")}get logLevel(){return pt(this,ot,"f")}set logLevel(t){pt(this,dt,"f").call(this,t),ft(this,ot,t,"f")}get logger(){return pt(this,at,"f")}set logger(t){pt(this,lt,"f").call(this,t),ft(this,at,t,"f")}get networkReconnectConfig(){return pt(this,ct,"f")}set networkReconnectConfig(t){pt(this,ht,"f").call(this,t),ft(this,ct,t,"f")}}it=new WeakMap,ot=new WeakMap,st=new WeakMap,at=new WeakMap,ct=new WeakMap,ut=new WeakMap,dt=new WeakMap,lt=new WeakMap,ht=new WeakMap;const kt={[T.INFO]:"#528bff",[T.WARN]:"#ffb31a",[T.DEBUG]:"#00f593",[T.ERROR]:"#ff4f4d",[T.TRACE]:"",[T.SILENT]:"",[w.SPADE]:"#a970ff",[w.TIME]:"#53535f",[w.WEBRTC]:"#0e9bd8",[w.SUBSCRIPTION]:"#ffc400",[w.CONNECTION]:"#ff5edb",[w.SOCKET]:"#8585ff",[w.EMITTER]:"#adadb8",[w.LOCAL_PARTICIPANT]:"#1DD21D",[w.STAGE]:"#EC9806",[w.REMOTE_PARTICIPANT]:"#0680EC",details:"#808080"},Rt=({label:t})=>`background: ${kt[t]||"#333333"}; color: white; padding: 3px; margin-left: 3px;`,Ot=Object.entries(T),Pt=(t,e,n)=>{const r=Rt({label:t}),[i]=Ot.find((([,e])=>e===Number(t)))||[],o=`%c${i}`,s=Rt({label:e}),a=`%c${e}`,c=Rt({label:w.TIME}),u=`%c[${(new Date).toISOString()}]`,d=Rt({label:"details"}),l=`%c[${n}]`,h=[u,o,a],p=[c,r,s];return n&&(h.push(l),p.push(d)),[h.join(""),...p]},At={debug(t){console.groupCollapsed(...Pt(T.DEBUG,t.scope,t.label)),console.debug(t.msg,Object.assign(Object.assign({},t),{level:"debug"})),console.groupEnd()},info(t){console.groupCollapsed(...Pt(T.INFO,t.scope,t.label)),console.info(t.msg,Object.assign(Object.assign({},t),{level:"info"})),console.groupEnd()},warn(t){console.groupCollapsed(...Pt(T.WARN,t.scope,t.label)),console.warn(t.msg,Object.assign(Object.assign({},t),{level:"warn"})),console.groupEnd()},error(t){console.error(t)}};var Nt=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n};Object.entries(T);class Logger{constructor(t=_t,e=At){this.logLevel=t,this.loggerInstance=e}debug(t){var e,n;this.logLevel>T.DEBUG||null===(n=(e=this.loggerInstance).debug)||void 0===n||n.call(e,JSON.parse(JSON.stringify(Object.assign(Object.assign({},t),{level:"debug"}))))}info(t){var e,n;this.logLevel>T.INFO||null===(n=(e=this.loggerInstance).info)||void 0===n||n.call(e,JSON.parse(JSON.stringify(Object.assign(Object.assign({},t),{level:"info"}))))}warn(t){var e,n;this.logLevel>T.WARN||null===(n=(e=this.loggerInstance).warn)||void 0===n||n.call(e,JSON.parse(JSON.stringify(Object.assign(Object.assign({},t),{level:"warn"}))))}error(t){var e,n,{err:r}=t,i=Nt(t,["err"]);this.logLevel>T.ERROR||null===(n=(e=this.loggerInstance).error)||void 0===n||n.call(e,Object.assign({err:r},i))}}class ScopedLogger{constructor(t,e){this.logger=t,this.scope=e}debug(t){var e,n;null===(n=(e=this.logger).debug)||void 0===n||n.call(e,JSON.parse(JSON.stringify(Object.assign(Object.assign({},t),{scope:this.scope}))))}info(t){var e,n;null===(n=(e=this.logger).info)||void 0===n||n.call(e,JSON.parse(JSON.stringify(Object.assign(Object.assign({},t),{scope:this.scope}))))}warn(t){var e,n;null===(n=(e=this.logger).warn)||void 0===n||n.call(e,JSON.parse(JSON.stringify(Object.assign(Object.assign({},t),{scope:this.scope}))))}error(t){var e,n,{err:r}=t,i=Nt(t,["err"]);null===(n=(e=this.logger).error)||void 0===n||n.call(e,Object.assign(Object.assign({err:r},i),{scope:this.scope}))}unwrap(){return this.logger}}var Dt;!function(t){t.PUBLISH="publish",t.SUBSCRIBE="subscribe",t.JOIN="join",t.LEAVE="leave",t.APP_TRACE="app_trace"}(Dt||(Dt={}));const xt=1,Mt=2;class JoinEvent extends StageAnalyticsEvent{constructor(t){super(c.JOIN,t.token,t.traceId,!1),Object.assign(this.properties,{action:Dt.JOIN,event_endpoint:t.eventEndpoint,whip_endpoint:t.whipEndpoint})}}class LeaveEvent extends StageAnalyticsEvent{constructor(t){super(c.LEAVE,t.token,t.traceId,!1),Object.assign(this.properties,{action:Dt.LEAVE,event_endpoint:t.eventEndpoint,whip_endpoint:t.whipEndpoint,reason:t.reason}),this.critical=!0}}var Lt,Ut,Bt,jt,Ft,Vt,Gt,Wt,$t,zt=function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)},Ht=function(t,e,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(t,n):i?i.value=n:e.set(t,n),n};function qt(t){return 1e3*t}const Jt=200,Kt=2500,Xt=30,Yt=1280,Qt=720,Zt={maxResolution:{width:Yt,height:Qt},maxFramerate:Xt,maxBitrate:Kt},te={maxResolution:{width:Qt,height:Yt},maxFramerate:Xt,maxBitrate:Kt},ee={active:!1,maxBitrate:2e5,rid:"low",maxFramerate:15,scaleResolutionDownBy:4},ne={width:320,height:180},re={active:!1,maxBitrate:7e5,rid:"mid",maxFramerate:20,scaleResolutionDownBy:2},ie={width:640,height:360},oe={active:!1,maxBitrate:17e5,rid:"hi",maxFramerate:30,scaleResolutionDownBy:1},se={width:1280,height:720};class StageConfig{constructor(t=Zt,e,n){this.LOG_LEVEL=T,this.DEFAULT_STAGE_LANDSCAPE=Zt,this.DEFAULT_STAGE_PORTRAIT=te,Lt.set(this,void 0),Ut.set(this,void 0),Bt.set(this,void 0),jt.set(this,void 0),Ft.set(this,void 0),Vt.set(this,(t=>{if(!t)throw new BroadcastClientError(Object.assign(Object.assign({},q),{details:mt}));if(!(t.maxBitrate<=Kt&&t.maxBitrate>=Jt))throw new BroadcastClientError(Object.assign(Object.assign({},q),{details:"maxBitrate must be between 200 and 2500"}));if(!(t.maxFramerate<=Xt&&t.maxFramerate>=10))throw new BroadcastClientError(Object.assign(Object.assign({},q),{details:"maxFramerate must be between 10 and 30"}));const e=t.maxResolution.width,n=t.maxResolution.height;if(e>Yt||n>Yt||e<160||n<160||(e===Yt&&n>Qt||n===Yt&&e>Qt))throw new BroadcastClientError(Object.assign(Object.assign({},q),{details:"maxResolution values must be between 720x1280 or 1280x720"}))})),Gt.set(this,(t=>{if(!t)return;const e=Number(t),n=Number.isInteger(e),r=e>=T.TRACE,i=e<=T.SILENT;if(!n||!r||!i)throw new BroadcastClientError(X)})),Wt.set(this,(t=>{if(t&&"object"!=typeof t)throw new BroadcastClientError(Y)})),$t.set(this,(t=>{if(t&&("string"!=typeof t||!t.startsWith("http")))throw new BroadcastClientError(rt)})),zt(this,Wt,"f").call(this,n),zt(this,Gt,"f").call(this,e),zt(this,Vt,"f").call(this,t),Ht(this,Ut,n,"f"),Ht(this,Lt,e,"f"),Ht(this,jt,t,"f")}get streamConfig(){return zt(this,jt,"f")}set streamConfig(t){zt(this,Vt,"f").call(this,t),Ht(this,jt,t,"f")}get logLevel(){return zt(this,Lt,"f")}set logLevel(t){zt(this,Gt,"f").call(this,t),Ht(this,Lt,t,"f")}get logger(){return zt(this,Ut,"f")}set logger(t){zt(this,Wt,"f").call(this,t),Ht(this,Ut,t,"f")}get whipUrlOverride(){return zt(this,Ft,"f")}set whipUrlOverride(t){zt(this,$t,"f").call(this,t),Ht(this,Ft,t,"f")}}Lt=new WeakMap,Ut=new WeakMap,Bt=new WeakMap,jt=new WeakMap,Ft=new WeakMap,Vt=new WeakMap,Gt=new WeakMap,Wt=new WeakMap,$t=new WeakMap;class StageClientError extends BroadcastClientError{constructor({token:t,traceId:e,code:n,tag:r,location:i,message:o,details:s,remoteParticipantId:a,requestUUID:c,fatal:u,nominal:d}){super({name:"StageClientError",message:o,code:n}),Error.captureStackTrace&&Error.captureStackTrace(this,StageClientError),this.token=t,this.traceId=e,this.code=n,this.tag=r,this.location=i,this.message=o,this.details=s,this.remoteParticipantId=a,this.requestUUID=c,this.fatal=u,this.nominal=d}}const ae={JOIN_RELATED:"signalling_session",PUBLISH_RELATED:"webrtc_sink",UNPUBLISH_RELATED:"webrtc_unsink"};function ce(t,e){switch(t){case Dt.PUBLISH:return ae.PUBLISH_RELATED;case Dt.SUBSCRIBE:return`webrtc_source:${e}`;default:return"unknown"}}function ue(t,e){var n,r,i,o;const s={code:t.code,message:`${t.message}: ${e.name} ${e.message}`,fatal:null!==(n=t.fatal)&&void 0!==n&&n,nominal:null!==(r=t.nominal)&&void 0!==r&&r};return e instanceof StageClientError&&(s.fatal=null!==(i=e.fatal)&&void 0!==i&&i,s.nominal=null!==(o=e.nominal)&&void 0!==o&&o),s}var de;!function(t){t[t.Unspecified=2001]="Unspecified",t[t.TokenExpired=2002]="TokenExpired",t[t.NoPermissions=2003]="NoPermissions",t[t.StageAtCapacity=2005]="StageAtCapacity"}(de||(de={}));const le={EXPIRED_TOKEN:{code:1001,message:"Token expired and is no longer valid",fatal:!0,nominal:!0},UNPUBLISH_FAILURE:{code:1013,message:"Failed to unpublish",fatal:!1,nominal:!1},UNSUBSCRIBE_FAILURE:{code:1014,message:"Failed to unsubscribe",fatal:!1,nominal:!1},PUBLISH_FAILURE:{code:1015,message:"Failed to publish",fatal:!1,nominal:!1},SUBSCRIBE_FAILURE:{code:1016,message:"Failed to subscribe",fatal:!1,nominal:!1},JOIN_FAILURE:{code:1017,message:"Failed to join",fatal:!0,nominal:!1},PUBLISH_TIMED_OUT:{code:1020,message:"Publish timed out",fatal:!1,nominal:!1},SUBSCRIBE_TIMED_OUT:{code:1021,message:"Subscribe timed out",fatal:!1,nominal:!1},NO_CANDIDATES:{code:1022,message:"No ICE candidates",fatal:!1,nominal:!1},OPERATION_ABORTED:{code:1023,message:"Request aborted",nominal:!0,fatal:!1},STAGE_AT_CAPACITY:{code:1024,message:"Stage at capacity",fatal:!0,nominal:!1},INTERNAL_SERVER_ERROR:{code:1025,message:"Internal server error",fatal:!0,nominal:!1},TOKEN_PERMISSIONS_DENIED:{code:1026,message:"Token permissions are not valid for the operation",fatal:!0,nominal:!1},UNKNOWN_PERMISSIONS_ERROR:{code:1099,message:"Service error code unknown or not found",fatal:!0,nominal:!1},WEBSOCKET_MESSAGE_PARSE_FAILURE:{code:1204,message:"Failed to parse websocket message",fatal:!1,nominal:!1},WHIP_SESSION_RESOURCE_DELETED:{code:1206,message:"WHIP signaling session resource not found",fatal:!0,nominal:!0},WHIP_TOO_MANY_REQUESTS:{code:1207,message:"WHIP endpoint received too many requests",fatal:!0,nominal:!1},WHIP_OPTIONS_FAILURE:{code:1501,message:"Failed to get ICE Servers from OPTIONS",fatal:!1,nominal:!1},WHIP_POST_FAILURE:{code:1502,message:"WHIP post failure",fatal:!1,nominal:!1},WHIP_DELETE_FAILURE:{code:1503,message:"WHIP delete failure",fatal:!1,nominal:!1},WHIP_URL_MISSING:{code:1504,message:"WHIP delete failure",fatal:!1,nominal:!1},EVENT_PLANE_CONNECTION_FAILURE:{code:1300,message:"Error connecting to event plane",fatal:!0,nominal:!1},PEER_CONNECTION_NETWORK_FAILURE:{code:1400,message:"PeerConnection is lost due to unknown network error",fatal:!1,nominal:!1},CREATE_OFFER_FAILURE:{code:1402,message:"Failed to set local description",fatal:!1,nominal:!1},CREATE_PEER_CONNECTION_FAILURE:{code:1403,message:"Failed to create a peer connection",fatal:!1,nominal:!1},ICE_CANDIDATE_ERROR:{code:1404,message:"ICE candidate error",fatal:!1,nominal:!1}};var he;function pe(t){const e=atob(t);return JSON.parse(e)}!function(t){t.UNPUBLISH="unpublish",t.UNSUBSCRIBE="unsubscribe",t.UNLOAD="unload",t.CONNECTION_FAIL="connection fail"}(he||(he={}));class StageToken{constructor(t){this.rawToken=t;const e=t.split(".");if(3!==e.length)throw Error(`Token format incorrect. length: ${e.length}`);try{this.header=pe(e[0])}catch(t){const e=t instanceof Error?`: ${t.message}`:"";throw Error(`Error parsing Stage Token header${e}`)}try{this.claims=pe(e[1])}catch(t){const e=t instanceof Error?`: ${t.message}`:"";throw Error(`Error parsing Stage Token claims${e}`)}this.signature=e[2];const{claims:n}=this;this.stageARN=n.resource,this.participantID=n.jti,this.eventsURL=n.events_url,this.whipURL=n.whip_url,this.userID=n.user_id,this.expirationTime=n.exp,this.topic=n.topic,this.parseVersionFlags(n.version);const{attributes:r}=n;r&&(this.attrGsRole=r.gs_role,this.attrGsSessionId=r.gs_session_id),this.analyticsTracker=AnalyticsTracker.getInstance()}getPublishEndpoint(){let t="";return this.whipURL&&this.participantID&&(t=`${this.whipURL}/publish/${this.participantID}`),t}getSubscribeEndpoint(t){let e="";return this.whipURL&&(e=`${this.whipURL}/subscribe/${t}`),e}assertTokenIsUnexpired(t,e,n,r){(!this.expirationTime||Date.now()/1e3>=this.expirationTime)&&this.analyticsTracker.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},le.EXPIRED_TOKEN),{location:n,tag:e,token:this,traceId:t,remoteParticipantId:r,message:le.EXPIRED_TOKEN.message,details:`Token expired at ${this.expirationTime} and is no longer valid`})))}parseVersionFlags(t){if(!t)return;const e=t.split(".");2===e.length&&(this.versionFlags=parseInt(e[1],10))}shouldUseTURN(){return void 0===this.versionFlags||0!=(this.versionFlags&xt)}shouldSendSilentAudio(){return void 0===this.versionFlags||0!=(this.versionFlags&Mt)}}function fe(t){return new StageToken(t)}function ge({action:t,identifier:e,token:n,whipURLOverride:r}){let i="";const o=fe(n);switch(r&&(o.whipURL=r),t){case Dt.PUBLISH:i=o.getPublishEndpoint();break;case Dt.SUBSCRIBE:e&&(i=o.getSubscribeEndpoint(e))}return i}var ve=n(9669),me=n.n(ve);class AbortControllersTracker{constructor(){this.abortControllers={},this._isUnloading=!1}static getInstance(){return AbortControllersTracker.instance||(AbortControllersTracker.instance=new AbortControllersTracker),AbortControllersTracker.instance}abortPendingOperations(){Object.entries(this.abortControllers).forEach((([t,e])=>e.abort()))}trackNewAbortController(t){return this.abortControllers[t]=new AbortController,this.abortControllers[t]}removeAbortController(t){delete this.abortControllers[t]}get isUnloading(){return this._isUnloading}set isUnloading(t){this._isUnloading=t}}const _e=t=>{const e=t=>{var e;return(null===(e=t.deviceId)||void 0===e?void 0:e.startsWith("web-contents-media-stream"))?"tab":void 0},n=t=>{var e;return(null===(e=t.deviceId)||void 0===e?void 0:e.startsWith("window"))&&"window"===t.displaySurface?"window":void 0},r=t=>{var e;return(null===(e=t.deviceId)||void 0===e?void 0:e.startsWith("screen"))&&"monitor"===t.displaySurface?"screen":void 0};return(e(i=t)||n(i)||r(i)?void 0:"camera")||r(t)||n(t)||e(t)||"unknown";var i};function Se(t,e){return t.find((t=>t.kind===e))}var Ee;!function(t){t.VIDEO="video",t.AUDIO="audio"}(Ee||(Ee={}));class MediaStreamManager{constructor(){this.mediaTracks=new Map([[Ee.VIDEO,void 0],[Ee.AUDIO,void 0]])}static getOrRegisterInstance(t){let e=this.msmMap.get(t);return e||(e=new MediaStreamManager,this.msmMap.set(t,e)),e}setTrack(t,e){this.mediaTracks.set(t,e)}getTrack(t){return this.mediaTracks.get(t)}}MediaStreamManager.msmMap=new Map;class TraceEvent extends StageAnalyticsEvent{constructor(t,e,n,r,i){super(c.TRACE,t,e,!1),Object.assign(this.properties,{action:r,message:n,remote_participant_id:i})}}function ye(t,e,n,r,i){AnalyticsTracker.getInstance().trackEventNoSharedProps(new TraceEvent(t,e,n,r,i))}const be={STAGE_JOINED:"stageJoined",STAGE_PARTICIPANT_JOINED:"stageParticipantJoined",STAGE_PARTICIPANT_LEFT:"stageParticipantLeft",STAGE_PARTICIPANT_KICKED:"stageParticipantKicked",STAGE_PARTICIPANT_UPDATED:"stageParticipantUpdated",STAGE_REFRESH:"stageRefresh",STATE_CHANGE:"stateChange"},Ce={CONNECTION_STATE_CHANGE:"connectionStateChange",STAGE_STREAM_UPDATE:"stageStreamUpdate"},Te="open",we="close",Ie="messageParseError",ke="refresh",Re="connectionFailure",Oe="stageStateMessage";class EDPConnectedEvent extends StageAnalyticsEvent{constructor(t){super(c.EDP_CONNECTED,t.token,t.traceId,!1),Object.assign(this.properties,{event_endpoint:t.eventEndpoint,protocol:t.protocol,retry_times:t.numRetries})}}class EDPDisconnectedEvent extends StageAnalyticsEvent{constructor(t){super(c.EDP_DISCONNECTED,t.token,t.traceId,!1),Object.assign(this.properties,{event_endpoint:t.eventEndpoint,protocol:t.protocol})}}class PublishEvent extends StageAnalyticsEvent{constructor(t){super(c.PUBLISH,t.token,t.traceId,!1),Object.assign(this.properties,{action:Dt.PUBLISH,remote_participant_id:t.token.participantID})}}class UnpublishEvent extends StageAnalyticsEvent{constructor(t){super(c.UNPUBLISH,t.token,t.traceId,!0),Object.assign(this.properties,{action:Dt.PUBLISH,remote_participant_id:t.token.participantID})}}class SubscribeEvent extends StageAnalyticsEvent{constructor(t){super(c.SUBSCRIBE,t.token,t.traceId,!1),Object.assign(this.properties,{action:Dt.SUBSCRIBE,remote_participant_id:t.subscribedId,subscribed_id:t.subscribedId})}}class UnsubscribeEvent extends StageAnalyticsEvent{constructor(t){super(c.UNSUBSCRIBE,t.token,t.traceId,!0),Object.assign(this.properties,{action:Dt.SUBSCRIBE,remote_participant_id:t.unsubscribedId,unsubscribed_id:t.unsubscribedId})}}class PublishStartedEvent extends StageAnalyticsEvent{constructor(t){super(c.PUBLISH_STARTED,t.token,t.traceId,!1),Object.assign(this.properties,{action:Dt.PUBLISH,options_duration:t.optionsDuration,post_duration:t.postDuration,remote_participant_id:t.token.participantID,time_to_candidate:t.timeToCandidate,total_duration:t.totalDuration})}}class PublishEndedEvent extends StageAnalyticsEvent{constructor(t){super(c.PUBLISH_ENDED,t.token,t.traceId,!0),Object.assign(this.properties,{action:Dt.PUBLISH,remote_participant_id:t.token.participantID,unpublish_successful:t.isUnpublishSuccessful,reason:t.reason})}}class SubscribeStartedEvent extends StageAnalyticsEvent{constructor(t){super(c.SUBSCRIBE_STARTED,t.token,t.traceId,!1),Object.assign(this.properties,{action:Dt.SUBSCRIBE,options_duration:t.optionsDuration,post_duration:t.postDuration,remote_participant_id:t.remoteParticipantId,time_to_candidate:t.timeToCandidate,total_duration:t.totalDuration})}}class SubscribeEndedEvent extends StageAnalyticsEvent{constructor(t){super(c.SUBSCRIBE_ENDED,t.token,t.traceId,!0),Object.assign(this.properties,{action:Dt.SUBSCRIBE,remote_participant_id:t.remoteParticipantId,unsubscribe_successful:t.isUnsubscribeSuccessful,reason:t.reason}),this.critical=!0}}class StateUpdatedEvent extends StageAnalyticsEvent{constructor(t){super(c.STATE_UPDATED,t.token,t.traceId,!1),Object.assign(this.properties,{audio_muted:t.isAudioMuted,is_disconnected:t.isDisconnected,is_publishing:t.isPublishing,other_participant_id:t.otherParticipantId,other_participant_user_id:t.otherParticipantUserId,video_stopped:t.isVideoStopped})}}var Pe=n(6486);class EDPPongEvent extends StageAnalyticsEvent{constructor(t){super(c.EDP_PONG,t.token,t.traceId,!1),Object.assign(this.properties,{event_endpoint:t.eventEndpoint,protocol:t.protocol,edp_rtt:t.edpRttMs})}}var Ae;!function(t){t.MESSAGE="message",t.RESPONSE="response"}(Ae||(Ae={}));class StageSocket{constructor(t){this.protocol="",this.connecting=!1,this.closing=!1,this.closingForError=!1,this.nextConnectionAttempt=0,this.windowUnloading=!1,this.pingInterval=0,this.pongTimeout=0,this.latestPingTimestamp=0,this.pongCount=0,this.latestSequenceNumber=0,this.beforeUnload=()=>{this.windowUnloading=!0},this.logger=new ScopedLogger(t,w.SOCKET),this.emitter=new u.EventEmitter,this.analyticsTracker=AnalyticsTracker.getInstance(),this.connectionAttempts=0,this.sentPing=!1,this.receivedPong=!1,this.id=`[${p().value}] `,window.addEventListener("beforeunload",this.beforeUnload)}connect(t,e,n){this.logger.debug({msg:`${this.id}connecting to ${t}`}),this.addr=t||this.addr,this.token=e||this.token,this.traceId=n||this.traceId;const{topic:r,rawToken:i}=this.token;this.connecting=!0,this.closing=!1;try{this.socket=this.createWebSocket(`${this.addr}?topic=${r}/publishers`,i),this.socket.onmessage=this.onMessage.bind(this),this.socket.onerror=this.onError.bind(this),this.socket.onclose=this.onClose.bind(this),this.socket.onopen=this.onOpen.bind(this),this.protocol=this.socket.protocol}catch(t){this.emitter.emit(Re,new Error("UnableToConnect"))}}send(t){var e;this.logger.debug({msg:`${this.id}sending ${JSON.stringify(t)}`}),this.isReady()?null===(e=this.socket)||void 0===e||e.send(JSON.stringify(t)):this.logger.warn({msg:"Trying to send data over stage socket that is not ready"})}close(){this.closing=!0,this.connecting=!1,this.emitter.emit(we),this.closeSocket()}removeAllListeners(){window.removeEventListener("beforeunload",this.beforeUnload),this.emitter.removeAllListeners()}createWebSocket(t,e){return new WebSocket(t,e)}closeForError(){this.closingForError=!0,this.closeSocket()}closeSocket(){var t;this.logger.debug({msg:`${this.id}closing`}),this.clearTimeouts(),null===(t=this.socket)||void 0===t||t.close(),this.socket&&(this.socket.onmessage=null,this.socket.onerror=null,this.socket.onclose=null,this.socket.onopen=null)}on(t,e){this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}isReady(){return this.logger.debug({msg:`${this.id}isReady called`}),!!this.socket&&this.socket.readyState===this.socket.OPEN}onMessage(t){this.logger.debug({msg:`${this.id}received message: ${t.data}`});try{const e=JSON.parse(t.data);switch(e.type){case"STAGE_STATE":case"aws:ivs:STAGE_STATE":{const t=e.payload.sequenceNumber;t>this.latestSequenceNumber&&(this.emitter.emit(Oe,e),this.latestSequenceNumber=t);break}case"PONG":this.receivedPong=!0,this.pongCount%2==0&&this.analyticsTracker.trackEventNoSharedProps(new EDPPongEvent({token:this.token,eventEndpoint:this.token.eventsURL,protocol:this.protocol,traceId:this.traceId,edpRttMs:performance.now()-this.latestPingTimestamp})),this.pongCount++;break;case"REFRESH":this.emitter.emit(ke);break;default:(0,Pe.noop)()}}catch(t){this.logger.debug({msg:`onMessage JSON Parse error: ${t}`}),this.emitter.emit(Ie,t)}}onError(t){this.logger.debug({msg:`${this.id}error: ${JSON.stringify(t)}`})}onClose(t){if(this.logger.debug({msg:`${this.id}onClose triggered with code (closing = ${this.closing}, closingForError = ${this.closingForError}, connecting = ${this.connecting})`}),this.clearTimeouts(),this.connecting){let t=Math.pow(2,this.connectionAttempts);t>1e3&&(t=1e3),this.logger.debug({msg:`${this.id}reconnecting in ${t} seconds`}),this.connectionAttempts+=1,this.nextConnectionAttempt=window.setTimeout(this.connect.bind(this),1e3*t)}else if(this.closing)this.closing=!1;else if(this.closingForError)this.emitter.emit(Re,new Error("ClosedForError")),this.closingForError=!1;else{if(this.windowUnloading)return;this.logger.debug({msg:`${this.id}unexpected close`}),this.emitter.emit(Re,new Error("UnintentionalError"))}}onOpen(){this.logger.debug({msg:`${this.id} socket opened`});const t=this.connectionAttempts;this.connectionAttempts=0,this.connecting=!1,this.ping(),this.pingInterval=window.setInterval(this.ping.bind(this),3e4),this.emitter.emit(Te,{attempts:t})}ping(){var t;this.logger.debug({msg:`${this.id}sending PING`});try{this.latestPingTimestamp=performance.now(),null===(t=this.socket)||void 0===t||t.send(JSON.stringify({type:"PING"})),this.sentPing=!0,this.receivedPong=!1,this.pongTimeout&&clearTimeout(this.pongTimeout),this.pongTimeout=window.setTimeout(this.pongTimedOut.bind(this),5e3)}catch(t){this.closeForError()}}pongTimedOut(){this.sentPing&&!this.receivedPong&&(this.logger.debug({msg:`${this.id}Pong timed out!`}),this.closeForError())}clearTimeouts(){this.sentPing=this.receivedPong=!1,clearTimeout(this.pongTimeout),clearInterval(this.pingInterval),clearTimeout(this.nextConnectionAttempt)}}class TypedEmitter{constructor(){this.emitter=new u}on(t,e){e.call=function(t,e){return function(n,...r){try{e.apply(n,r)}catch(n){let r=`Error in callback for ${t}`;const i=e.name;return i&&(r+=` for function ${i}`),void console.error(`${r}\n`,n)}}}(t,e),this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}emit(t,...e){this.emitter.emit(t,...e)}removeAllListeners(){this.emitter.removeAllListeners()}}var Ne=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};var De;!function(t){t.DISCONNECTED="disconnected",t.CONNECTING="connecting",t.CONNECTED="connected",t.ERRORED="errored"}(De||(De={}));class StageConnection extends TypedEmitter{constructor(t){super(),this.nonScopedLogger=t,this.participants=new Map,this.disconnected=[],this.state={value:De.DISCONNECTED,context:{hasConnected:!1}},this.onConnecting=(t,e)=>{if(this.logger.debug({msg:"onConnecting",context:t,event:e}),"RECONNECT"===e.type&&this.stageSocket.close(),"CONNECT"===e.type&&(t.token=e.payload.token,t.traceId=e.payload.traceId),!t.token||!t.traceId)return void this.logger.warn({msg:"Attempting a connect but no token OR traceId provided"});const{eventsURL:n}=t.token;this.stageSocket.connect(n,t.token,t.traceId),this.emit(be.STATE_CHANGE,De.CONNECTING),this.state.value=De.CONNECTING},this.onConnected=(t,e)=>{this.logger.debug({msg:"onConnected",context:t,event:e}),t.hasConnected=!0,this.emit(be.STAGE_JOINED),this.emit(be.STATE_CHANGE,De.CONNECTED),this.state.value=De.CONNECTED},this.onDisconnected=t=>{this.logger.debug({msg:"onDisconnected",context:t}),this.stageSocket.close(),t.hasConnected=!1,delete t.traceId,delete t.token,this.emit(be.STATE_CHANGE,De.DISCONNECTED),this.state.value=De.DISCONNECTED},this.onErrored=(t,e)=>{this.logger.error({msg:"Connection failure occurred",err:e.payload.error}),this.emit(be.STATE_CHANGE,De.ERRORED),this.state.value=De.ERRORED,t.hasConnected&&t.token&&t.traceId?this.processStateUpdate({type:"RECONNECT"}):this.stageSocket.close()},this.processStateUpdate=t=>{const e=this.state.value,n=this.state.context;switch(e){case De.DISCONNECTED:"CONNECT"===t.type&&this.onConnecting(n,t);break;case De.CONNECTING:"RECONNECT"===t.type?this.onConnecting(n,t):"DISCONNECT"===t.type?this.onDisconnected(n):"CONNECT_SUCCESS"===t.type?this.onConnected(n,t):"ERROR"===t.type&&this.onErrored(n,t);break;case De.CONNECTED:"RECONNECT"===t.type?this.onConnecting(n,t):"DISCONNECT"===t.type?this.onDisconnected(n):"ERROR"===t.type&&this.onErrored(n,t);break;case De.ERRORED:"RECONNECT"===t.type?this.onConnecting(n,t):"DISCONNECT"===t.type&&this.onDisconnected(n)}},this.trackConnectedEvent=(t,e,n)=>{this.analyticsTracker.trackEventNoSharedProps(new EDPConnectedEvent({token:t,eventEndpoint:t.eventsURL,numRetries:n,protocol:this.stageSocket.protocol,traceId:e}))},this.trackDisconnectedEvent=(t,e)=>{this.analyticsTracker.trackEventNoSharedProps(new EDPDisconnectedEvent({token:t,eventEndpoint:t.eventsURL,protocol:this.stageSocket.protocol,traceId:e}))},this.trackMessageParseError=(t,e)=>n=>{this.logger.error({msg:"Message Parse Error occurred",err:n});const r=new StageClientError({token:t,traceId:e,code:le.WEBSOCKET_MESSAGE_PARSE_FAILURE.code,tag:ae.JOIN_RELATED,location:"onMessage",message:le.WEBSOCKET_MESSAGE_PARSE_FAILURE.message,details:n.message});this.analyticsTracker.trackEventNoSharedProps(new StageErrorEvent(r))},this.onStageStateMessage=(t,e)=>n=>{var r,i;this.logger.debug({msg:"State Stage Message occurred",state:n});const o=n.payload,s=null!==(r=o.participants)&&void 0!==r?r:[],a=null!==(i=o.disconnected)&&void 0!==i?i:[],c=[],u=[],d=(n,r)=>{this.analyticsTracker.trackEventNoSharedProps(new StateUpdatedEvent({token:t,otherParticipantId:n.id,otherParticipantUserId:n.userId,isAudioMuted:n.audioMuted,isVideoStopped:n.videoStopped,isPublishing:n.isPublishing,isDisconnected:r,traceId:e}))};this.participants.forEach((t=>{const e=s.find((e=>e.id===t.id));if(e){let n=!0,r=!1;["isPublishing","id","audioMuted","joinedAt","userId","videoStopped"].forEach((i=>{n=n&&e[i.toString()]===t[i.toString()],n||(t[i.toString()]=e[i.toString()],r=!0)})),Object.keys(t.attributes).forEach((i=>{n=n&&e.attributes[i]===t.attributes[i],n||(t.attributes=e.attributes,r=!0)})),r&&(d(t,!1),this.emit(be.STAGE_PARTICIPANT_UPDATED,e))}else u.push(t)})),s.forEach((t=>{this.participants.get(t.id)||c.push(t)})),u.forEach((t=>{this.participants.delete(t.id),d(t,!0),this.emit(be.STAGE_PARTICIPANT_LEFT,t)})),c.forEach((t=>{this.participants.set(t.id,t),d(t,!1),this.emit(be.STAGE_PARTICIPANT_JOINED,t)})),a.forEach((t=>{this.disconnected.find((e=>e.id===t.id))||(this.disconnected.push(t),"KICKED"===t.status&&this.emit(be.STAGE_PARTICIPANT_KICKED,t))})),this.disconnected=a},this.analyticsTracker=AnalyticsTracker.getInstance(),this.nonScopedLogger=t,this.logger=new ScopedLogger(t,w.CONNECTION),this.stageSocket=new StageSocket(this.nonScopedLogger)}connect(t,e){return Ne(this,void 0,void 0,(function*(){return this.logger.debug({msg:"connect invoked",token:t,traceId:e}),this.state.value!==De.DISCONNECTED&&(this.logger.debug({msg:"Disconnecting previous connection"}),this.processStateUpdate({type:"DISCONNECT"}),window.clearTimeout(this.connectTimeout)),new Promise(((n,r)=>{this.connectTimeout=window.setTimeout((()=>{this.logger.debug({msg:"Attempt to connect timed out"});const t=new Error("InitialConnectTimedOut");this.processStateUpdate({type:"ERROR",payload:{error:t}}),r(t)}),1e4),this.stageSocket.on(Te,(r=>{const{attempts:i}=r;window.clearTimeout(this.connectTimeout),this.trackConnectedEvent(t,e,i),this.processStateUpdate({type:"CONNECT_SUCCESS"}),n()})),this.stageSocket.on(Re,(t=>{this.processStateUpdate({type:"ERROR",payload:{error:t}})})),this.stageSocket.on(ke,(()=>{this.logger.debug({msg:"Refresh event occurred"}),this.emit(be.STAGE_REFRESH),this.processStateUpdate({type:"RECONNECT"})})),this.stageSocket.on(we,(()=>{this.logger.debug({msg:"Close event occurred"}),this.trackDisconnectedEvent(t,e)})),this.stageSocket.on(Oe,this.onStageStateMessage(t,e)),this.stageSocket.on(Ie,this.trackMessageParseError(t,e)),this.processStateUpdate({type:"CONNECT",payload:{token:t,traceId:e}})}))}))}disconnect(){this.logger.debug({msg:"disconnect invoked"});const t=this.state.context.traceId;return this.processStateUpdate({type:"DISCONNECT"}),this.participants=new Map,this.disconnected=[],this.stageSocket.removeAllListeners(),t}getParticipant(t){return this.participants.get(t)}listConnectedParticipants(){const t=[];return this.participants.forEach((e=>{e.subscribed&&t.push(e)})),t}listAvailableParticipants(){return Array.from(this.participants.values())}emitStageState(t,e){this.stageSocket.send({audioMuted:t,type:"SET_STATE",version:"0",videoStopped:e})}}const xe={CONNECTION_STATE_CHANGE:"connectionStateChange",ERROR:"clientError",ACTIVE_STATE_CHANGE:"activeStateChange"},Me="connectionStateChange",Le="clientError";var Ue,Be,je;!function(t){t.CLOSED="closed",t.COMPLETED="completed",t.CONNECTED="connected",t.CONNECTING="connecting",t.DISCONNECTED="disconnected",t.FAILED="failed",t.IDLE="idle",t.NEW="new",t.NONE="none"}(Ue||(Ue={}));class ThrottleTimer{constructor(t,e){this.throttleDuration=0,this.throttled=!1,this.timeout=0,this.unthrottle=()=>{this.trailing&&this.trailingFn&&this.trailingFn(...this.trailingFnArgs),this.clear()},this.throttleDuration=t,this.trailing=!(e&&e.skipTrailing)}invoke(t,...e){return this.throttled?(this.trailingFn=t,this.trailingFnArgs=e,!1):(this.throttled=!0,this.timeout=window.setTimeout(this.unthrottle,this.throttleDuration),t(...e),!0)}clear(){clearTimeout(this.timeout),this.timeout=0,this.throttled=!1,delete this.trailingFn,delete this.trailingFnArgs}}class SDPFmtpLine{constructor(){this.levelAsymmetryAllowed=!1,this.packetisationMode=!1,this.profile="",this.level=0}extractVideoSdpFmtpLine(t){if(!t)return{levelAsymmetryAllowed:this.levelAsymmetryAllowed,packetisationMode:this.packetisationMode,profile:this.profile,level:this.level};return t.split("\r").join(";").split("\n").join(";").split(" ").join(";").split(";").map((t=>t.trim())).filter(Boolean).forEach((t=>{const e=t.split("=");if(2===e.length)switch(e[0]){case"level-asymmetry-allowed":"1"===e[1]?this.levelAsymmetryAllowed=!0:this.levelAsymmetryAllowed=!1;break;case"packetization-mode":"1"===e[1]?this.packetisationMode=!0:this.packetisationMode=!1;break;case"profile-level-id":this.profile=this.getProfileFromId(e[1]),this.level=this.getLevelFromId(e[1])}})),{levelAsymmetryAllowed:this.levelAsymmetryAllowed,packetisationMode:this.packetisationMode,profile:this.profile,level:this.level}}getProfileFromId(t){const e=t.substr(0,2),n=t.substr(2,2);switch(e.substr(0,2)){case"42":return"baseline";case"4d":return"main";case"58":return"extended";case"64":return"high";case"6e":return"00"===n?"high 10":"high 10 intra";case"7a":return"00"===n?"high 42":"high 42 intra";case"f4":return"00"===n?"high 44":"high 44 intra";default:return"unknown"}}getLevelFromId(t){return parseInt(t.substr(4,2),16)}}class CongestionTimeEvent{constructor(t,e){this.transformProperties=(t,e)=>({sum:t.sum,median:t.median(),min:t.min,max:t.max,p90:t.percentile(.9),event_count:t.data.length,period:e});const n=this.transformProperties(t,e);this.data={event:Be.CONGESTION_TIME,properties:n}}}class ConnectionEstablishedEvent{constructor(t,e,n){this.transformProperties=(t,e,n)=>({duration:(t.getTime()-((null==e?void 0:e.getTime())||0))/1e3,ecn_negotiated:!1,ingest_session_id:n});const r=this.transformProperties(t,e,n);this.data={event:Be.CONNECTION_ESTABLISHED,properties:r}}}class ConnectionRTTEvent{constructor(t,e){this.transformProperties=(t,e)=>({sum:t.sum,median:t.median(),min:t.min,max:t.max,p90:t.percentile(.9),event_count:t.data.length,period:e});const n=this.transformProperties(t,e);this.data={event:Be.CONNECTION_RTT,properties:n}}}class ErrorEvent{constructor(t){this.transformProperties=t=>{var e;return{is_fatal:null!==(e=t.isFatal)&&void 0!==e&&e,value:t.value,code:t.code,description:t.description}};const e=this.transformProperties(t);this.data={event:Be.ERROR,properties:e}}}class InputDeviceAttachedEvent{constructor(t,e){this.transformProperties=(t,e)=>({type:t,input_device_id:e.deviceId,position:e.facingMode||"unknown"});const n=this.transformProperties(t,e);this.data={event:Be.INPUT_DEVICE_ATTACHED,properties:n}}}class InputDeviceDetachedEvent{constructor(t,e){this.transformProperties=(t,e)=>({type:t,input_device_id:e.deviceId,position:e.facingMode||"unknown"});const n=this.transformProperties(t,e);this.data={event:Be.INPUT_DEVICE_DETACHED,properties:n}}}class MeasuredBitrateEvent{constructor(t,e){this.transformProperties=(t,e)=>({sum:t.sum,median:t.median(),min:t.min,max:t.max,p90:t.percentile(.9),event_count:t.data.length,period:e});const n=this.transformProperties(t,e);this.data={event:Be.MEASURED_BITRATE,properties:n}}}class MinuteBroadcastEvent{constructor(t,e){this.transformProperties=(t,e)=>({minutes_logged:Math.round((t.timestamp-e)/6e4)});const n=this.transformProperties(t,e);this.data={event:Be.MINUTE_BROADCAST,properties:n}}}class RecommendedBitrateEvent{constructor(t,e){this.transformProperties=(t,e)=>({sum:t.sum,median:t.median(),min:t.min,max:t.max,p90:t.percentile(.9),event_count:t.data.length,period:e});const n=this.transformProperties(t,e);this.data={event:Be.RECOMMENDED_BITRATE,properties:n}}}class SessionAudioEncoderConfiguredEvent{constructor(t){this.transformProperties=t=>({codec:t.mimeType,bitrate:0,sample_rate:t.clockRate,channel_count:t.channels});const e=this.transformProperties(t);this.data={event:Be.SESSION_AUDIO_ENCODER_CONFIGURED,properties:e}}}class SessionAudioPropertiesEvent{constructor(t){this.transformProperties=t=>({codec:"audio",bitrate:32e3,sample_rate:t.sampleRate,channel_count:t.channelCount});const e=this.transformProperties(t);this.data={event:Be.SESSION_AUDIO_PROPERTIES,properties:e}}}class SessionVideoEncoderConfiguredEvent{constructor(t,e,n){this.transformProperties=(t,e,n)=>({codec:n.mimeType,codec_profile:e.profile,codec_level:e.level,rate_mode:"vbr",initial_bitrate:0,keyframe_interval:2,width:t.width,height:t.height,bframe_count:0,target_fps:t.frameRate});const r=this.transformProperties(t,e,n);this.data={event:Be.SESSION_VIDEO_ENCODER_CONFIGURED,properties:r}}}class SessionVideoPropertiesEvent{constructor(t){this.transformProperties=t=>({codec:"video",initial_bitrate:32e3,min_bitrate:0,max_bitrate:0,keyframe_interval:2,width:t.width,height:t.height,auto_bitrate_enabled:!0,bframes_enabled:!1,target_fps:t.frameRate});const e=this.transformProperties(t);this.data={event:Be.SESSION_VIDEO_PROPERTIES,properties:e}}}class SourceAudioLatencyEvent{constructor(t,e){this.transformProperties=(t,e)=>({sum:t.sum,median:t.median(),min:t.min,max:t.max,p90:t.percentile(.9),event_count:t.data.length,period:e});const n=this.transformProperties(t,e);this.data={event:Be.SOURCE_AUDIO_LATENCY,properties:n}}}class SourceVideoLatencyEvent{constructor(t,e){this.transformProperties=(t,e)=>({sum:t.sum,median:t.median(),min:t.min,max:t.max,p90:t.percentile(.9),event_count:t.data.length,period:e});const n=this.transformProperties(t,e);this.data={event:Be.SOURCE_VIDEO_LATENCY,properties:n}}}class StartBroadcastEvent{constructor(t,e){this.transformProperties=({protocol:t,hostname:e,port:n},r)=>({protocol:t,endpoint_host:e,endpoint_port:n,reason:r});const n=this.transformProperties(t,e);this.data={event:Be.START_BROADCAST,properties:n}}}class StopBroadcastEvent{constructor(t){this.transformProperties=({protocol:t,hostname:e,port:n})=>({protocol:t,endpoint_host:e,endpoint_port:n});const e=this.transformProperties(t);this.data={event:Be.STOP_BROADCAST,properties:e}}}class WebRTCAudioStatsEvent{constructor(t){this.transformProperties=t=>({bytes_sent:t.bytesSent,header_bytes_sent:t.headerBytesSent,nack_count:t.nackCount,packets_sent:t.packetsSent,retransmitted_bytes_sent:t.retransmittedBytesSent,retransmitted_packets_sent:t.retransmittedPacketsSent});const e=this.transformProperties(t);this.data={event:Be.WEBRTC_AUDIO_STATS,properties:e}}}class WebRTCVideoStatsEvent{constructor(t){this.transformProperties=t=>({bytes_sent:t.bytesSent,fir_count:t.firCount,frames_encoded:t.framesEncoded,frames_sent:t.framesSent,header_bytes_sent:t.headerBytesSent,huge_frames_sent:t.hugeFramesSent,key_frames_encoded:t.keyFramesEncoded,nack_count:t.nackCount,packets_sent:t.packetsSent,pli_count:t.pliCount,quality_limitation_reason:t.qualityLimitationReason,quality_limitation_resolution_changes:t.qualityLimitationResolutionChanges,retransmitted_bytes_sent:t.retransmittedBytesSent,retransmitted_packets_sent:t.retransmittedPacketsSent,total_encode_time:t.totalEncodeTime,total_encoded_bytes_target:t.totalEncodedBytesTarget,total_packet_send_delay:t.totalPacketsSendDelay});const e=this.transformProperties(t);this.data={event:Be.WEBRTC_VIDEO_STATS,properties:e}}}function Fe(t){return btoa(JSON.stringify(t))}!function(t){t.START_BROADCAST="ivs_broadcast_start_broadcast",t.STOP_BROADCAST="ivs_broadcast_stop_broadcast",t.MINUTE_BROADCAST="ivs_broadcast_minute_broadcast",t.WEBRTC_AUDIO_STATS="ivs_broadcast_webrtc_audio_stats",t.WEBRTC_VIDEO_STATS="ivs_broadcast_webrtc_video_stats",t.WEBRTC_AUDIO_STATS_WINDOW="ivs_broadcast_webrtc_audio_stats_window",t.WEBRTC_VIDEO_STATS_WINDOW="ivs_broadcast_webrtc_video_stats_window",t.CONNECTION_ESTABLISHED="ivs_broadcast_connection_established",t.SESSION_VIDEO_PROPERTIES="ivs_broadcast_session_video_properties",t.SESSION_AUDIO_PROPERTIES="ivs_broadcast_session_audio_properties",t.SESSION_VIDEO_ENCODER_CONFIGURED="ivs_broadcast_session_video_encoder_configured",t.SESSION_AUDIO_ENCODER_CONFIGURED="ivs_broadcast_session_audio_encoder_configured",t.SOURCE_AUDIO_LATENCY="ivs_broadcast_source_audio_latency",t.SOURCE_VIDEO_LATENCY="ivs_broadcast_source_video_latency",t.INPUT_DEVICE_ATTACHED="ivs_broadcast_input_device_attached",t.INPUT_DEVICE_DETACHED="ivs_broadcast_input_device_detached",t.CONGESTION_TIME="ivs_broadcast_congestion_time",t.BUFFER_DURATION="ivs_broadcast_buffer_duration",t.MEASURED_BITRATE="ivs_broadcast_measured_bitrate",t.RECOMMENDED_BITRATE="ivs_broadcast_recommended_bitrate",t.CONNECTION_RTT="ivs_broadcast_connection_rtt",t.ERROR="ivs_broadcast_error"}(Be||(Be={})),function(t){t.USER_INITIATED="user-initiated",t.NETWORK_DISCONNECT="network-disconnect"}(je||(je={}));var Ve,Ge=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};!function(t){t.IDLE="idle",t.EXECUTING="executing",t.RECONNECTING="reconnecting"}(Ve||(Ve={}));class BaseReconnectStrategy{constructor(t,e=12e4,n,r){this.state=Ve.IDLE,this.failureCallback=()=>{},this.peerClient=t,this.timeout=e,this.logger=n,this.emitter=r}onFailure(t){this.failureCallback=t}setStartConfig(t,e){this.ingestEndpoint=t,this.streamKey=e}execute(){const{id:t}=this;this.state===Ve.IDLE&&(this.state=Ve.EXECUTING,this.emitter.emit(xe.CONNECTION_STATE_CHANGE,Ue.CONNECTING),this.logger.info({msg:"Starting execution of reconnect strategy.",id:t}),this.startTimeoutTimer(this.timeout),this.executeStrategy())}startTimeoutTimer(t){this.timeoutTimerId=window.setTimeout((()=>{this.state!==Ve.IDLE&&(this.logger.info({msg:"Reconnect strategy timed out."}),this.stop(),this.emitter.emit(xe.CONNECTION_STATE_CHANGE,Ue.FAILED),this.failureCallback())}),t)}stop(){this.state=Ve.IDLE,clearTimeout(this.timeoutTimerId),this.stopStrategy()}reconnect(){return Ge(this,void 0,void 0,(function*(){if(this.ingestEndpoint&&this.streamKey){const t=this.peerClient.getConnectionState();try{this.logger.info({msg:"Attempting reconnect."}),t===Ue.CONNECTED?this.logger.info({msg:"Already connected! Stopping reconnect strategy."}):(yield this.peerClient.start(this.ingestEndpoint,this.streamKey),this.logger.info({msg:"Reconnect succeeded!"})),this.stop()}catch(t){throw this.logger.error({err:t}),t}}}))}isActive(){return this.state!==Ve.IDLE}}class ExponentialBackoffStrategy extends BaseReconnectStrategy{constructor(){super(...arguments),this.id="ExponentialBackoffStrategy"}executeStrategy(){let t=5e3;const e=()=>Ge(this,void 0,void 0,(function*(){if(this.state===Ve.EXECUTING)try{this.state=Ve.RECONNECTING,yield this.reconnect()}catch(n){this.logger.warn({msg:"Attempted reconnect failed. Trying again in: ",nextRetry:t}),this.state=Ve.EXECUTING,this.currentTimeoutId=window.setTimeout(e,t),t*=2}}));this.currentTimeoutId=window.setTimeout(e,0)}stopStrategy(){clearTimeout(this.currentTimeoutId)}}class NetworkApiStrategy extends BaseReconnectStrategy{constructor(){super(...arguments),this.id="NetworkApiStrategy",this.onConnectionChange=()=>Ge(this,void 0,void 0,(function*(){if(navigator.onLine&&this.state===Ve.EXECUTING){this.state=Ve.RECONNECTING;try{yield this.reconnect()}catch(t){this.logger.warn({msg:"Attempted reconnect failed."}),this.state=Ve.EXECUTING}}}))}executeStrategy(){navigator.connection.addEventListener("change",this.onConnectionChange),this.onConnectionChange()}stopStrategy(){navigator.connection.removeEventListener("change",this.onConnectionChange)}}class PeerClientReconnectStrategyFactory{static create(t,e=wt,n,r){const{reconnect:i,timeout:o}=e;if(i){const e=l.getParser(navigator.userAgent).getBrowserName().toLowerCase();return["edge","chrome"].includes(e)&&navigator.connection?new NetworkApiStrategy(t,o,n,r):new ExponentialBackoffStrategy(t,o,n,r)}}}var We,$e=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},ze=function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)};const He=t=>!!t;function qe(t){if(!t)throw new Error("PeerConnection is not defined")}const Je={bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",enableDtlsSrtp:{exact:!0},enableRtpDataChannels:{exact:!1},optional:[{googHighStartBitrate:{exact:0}},{googPayloadPadding:{exact:!0}},{googScreencastMinBitrate:{exact:100}},{googCpuOveruseDetection:{exact:!0}},{googCpuOveruseEncodeUsage:{exact:!0}},{googCpuUnderuseThreshold:{exact:55}},{googCpuOveruseThreshold:{exact:85}},{enableDscp:{exact:!0}}]};class PeerClient{constructor(t,e,n,r){this.config=t,this.emitter=e,this.mediaStreamManager=n,this.establishConnection=(t,e)=>$e(this,void 0,void 0,(function*(){var n,r,i;qe(this.peerConnection);try{const n=yield this.peerConnection.createOffer({offerToReceiveAudio:!1,offerToReceiveVideo:!1});yield this.handleLocalDescription(n),yield this.sendSetupRequest(t,e,n)}catch(t){if(t instanceof Error){null!==(n=(i=t).code)&&void 0!==n||(i.code=W.code);const e=new BroadcastClientError(Object.assign(Object.assign({},W),{name:t.name,message:t.message,code:null==t?void 0:t.code,cause:t}));throw(null===(r=this.reconnectStrategy)||void 0===r?void 0:r.isActive())||this.handleError(t.code,t.message),this.stop(),e}}})),this.getSessionId=()=>this.ingestSessionId,this.getConnectionState=()=>{var t;if(!this.peerConnection)return Ue.NONE;const e=null===(t=this.reconnectStrategy)||void 0===t?void 0:t.isActive(),n=this.peerConnection.connectionState||this.peerConnection.iceConnectionState;switch(n){case"new":return Ue.NEW;case"closed":return Ue.CLOSED;case"disconnected":return e?Ue.CONNECTING:Ue.DISCONNECTED;case"failed":return e?Ue.CONNECTING:Ue.FAILED;case"idle":return Ue.IDLE;case"checking":case"connecting":return Ue.CONNECTING;case"completed":case"connected":return Ue.CONNECTED;default:return this.logger.warn({msg:"Unhandled connection state:",rawState:n}),Ue.IDLE}},this.onConnectionStateChange=()=>{var t;const e=this.getConnectionState();switch(e){case Ue.CONNECTED:{this.emitter.emit(xe.CONNECTION_STATE_CHANGE,e);const n=new Date;this.analyticsTracker.trackEvent(new ConnectionEstablishedEvent(n,this.connectionStartDate,this.ingestSessionId));const r=this.mediaStreamManager.getTrack(Ee.AUDIO),i=this.mediaStreamManager.getTrack(Ee.VIDEO);if(i){const t=i.getSettings();this.analyticsTracker.trackEvent(new SessionVideoPropertiesEvent(t))}if(r){const t=r.getSettings();this.analyticsTracker.trackEvent(new SessionAudioPropertiesEvent(t))}((null===(t=this.peerConnection)||void 0===t?void 0:t.getSenders())||[]).forEach((t=>{var e;((null===(e=t.getParameters())||void 0===e?void 0:e.codecs)||[]).forEach((e=>{var n;switch(null===(n=t.track)||void 0===n?void 0:n.kind){case"video":{if(!i)break;const t=(new SDPFmtpLine).extractVideoSdpFmtpLine(e.sdpFmtpLine),n=i.getSettings();this.analyticsTracker.trackEvent(new SessionVideoEncoderConfiguredEvent(n,t,e));break}case"audio":if(!r)break;this.analyticsTracker.trackEvent(new SessionAudioEncoderConfiguredEvent(e))}}))}));break}case Ue.CONNECTING:this.emitter.emit(xe.CONNECTION_STATE_CHANGE,e),this.connectionStartDate=new Date,this.disconnectionStartDate=void 0;break;case Ue.FAILED:this.reconnectStrategy?this.reconnectStrategy.execute():(this.emitter.emit(xe.CONNECTION_STATE_CHANGE,e),this.handleTerminalConnectionFailure());break;case Ue.DISCONNECTED:this.emitter.emit(xe.CONNECTION_STATE_CHANGE,e),this.disconnectionStartDate=new Date;break;default:this.emitter.emit(xe.CONNECTION_STATE_CHANGE,e)}},this.handleLocalDescription=t=>$e(this,void 0,void 0,(function*(){var e;return null===(e=this.peerConnection)||void 0===e?void 0:e.setLocalDescription(t)})),We.set(this,(t=>{if("string"!=typeof t)throw new BroadcastClientError(J);try{new URL(t)}catch(t){throw new BroadcastClientError(K)}})),this.logger=new ScopedLogger(r,w.WEBRTC),this.analyticsTracker=AnalyticsTracker.getInstance(),this.createReconnectStrategy(t)}start(t,e){var n;return $e(this,void 0,void 0,(function*(){ze(this,We,"f").call(this,t);const r=[this.mediaStreamManager.getTrack(Ee.VIDEO),this.mediaStreamManager.getTrack(Ee.AUDIO)].filter(He);this.createPeerConnection(),this.addTracks({tracks:r}),this.reconnectStrategy&&this.reconnectStrategy.setStartConfig(t,e),yield this.establishConnection(t,e);if(null===(n=this.reconnectStrategy)||void 0===n?void 0:n.isActive()){const e=new URL(t);this.analyticsTracker.trackEvent(new StartBroadcastEvent({protocol:"webrtc",hostname:e.hostname,port:e.port},je.NETWORK_DISCONNECT))}}))}stop(){var t,e,n,r;this.stateCheckInterval&&(clearInterval(this.stateCheckInterval),this.stateCheckInterval=void 0),this.stopStreamDataChannel&&"open"===this.stopStreamDataChannel.readyState&&this.stopStreamDataChannel.send(" "),[Ue.NEW,Ue.CONNECTING,Ue.CONNECTED].includes(this.getConnectionState())&&this.emitter.emit(xe.CONNECTION_STATE_CHANGE,Ue.CLOSED),null===(t=this.peerConnection)||void 0===t||t.close(),null===(e=this.peerConnection)||void 0===e||e.removeEventListener("connectionstatechange",this.onConnectionStateChange),null===(n=this.peerConnection)||void 0===n||n.removeEventListener("iceconnectionstatechange",this.onConnectionStateChange),this.ingestSessionId=void 0,null===(r=this.reconnectStrategy)||void 0===r||r.stop()}addTracks(t){var e;if(qe(this.peerConnection),!t)return;const n=this.peerConnection.getSenders().map((t=>{var e;return null===(e=t.track)||void 0===e?void 0:e.id})),r=t.tracks.filter((t=>!n.includes(t.id)));for(const t of r)null===(e=this.peerConnection)||void 0===e||e.addTrack(t)}getReports(){var t;return $e(this,void 0,void 0,(function*(){try{const e=(yield null===(t=this.peerConnection)||void 0===t?void 0:t.getStats())||[],n=[];return e.forEach((t=>{n.push(t)})),n}catch(t){return[]}}))}sendSetupRequest(t,e,n){var r;return $e(this,void 0,void 0,(function*(){const i=yield fetch(`${t}/v1/offer`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Object.assign({offer:Fe(n),streamKey:e},this.config.streamConfig))});if(!i.ok)throw function(t){let e=new BroadcastClientError(Object.assign({},W));(null==t?void 0:t.code)===y&&(e=new BroadcastClientError(Object.assign({},z)));(null==t?void 0:t.message)&&(e.message=t.message);return e}(yield i.json());const o=yield i.json();(null==o?void 0:o.answer)&&(yield null===(r=this.peerConnection)||void 0===r?void 0:r.setRemoteDescription(function(t){return JSON.parse(atob(t))}(o.answer)),this.ingestSessionId=o.ingestSessionId)}))}handleTerminalConnectionFailure(){const t=new BroadcastClientError($);this.handleError(t.code,t.message)}handleError(t,e){this.analyticsTracker.trackEvent(new ErrorEvent({code:t,description:e,isFatal:!0})),this.emitter.emit(xe.ERROR,{code:t,message:e})}createPeerConnection(){var t;const e=this.getConnectionState(),n=e!==Ue.NONE,r=e!==Ue.CLOSED,i=null===(t=this.reconnectStrategy)||void 0===t?void 0:t.isActive();n&&r&&!i||(this.stateCheckInterval&&(clearInterval(this.stateCheckInterval),this.stateCheckInterval=void 0),this.stateCheckInterval=window.setInterval((()=>{const t=this.getConnectionState();if(this.reconnectStrategy&&t===Ue.DISCONNECTED&&this.disconnectionStartDate){const t=Date.now()-this.disconnectionStartDate.getTime();this.logger.info({msg:"Time since disconnected:",timeSinceDisconnect:t}),t>1e4&&(this.disconnectionStartDate=void 0,this.reconnectStrategy.execute())}else t===Ue.CLOSED&&(this.handleTerminalConnectionFailure(),clearInterval(this.stateCheckInterval),this.stateCheckInterval=void 0)}),1e3),this.peerConnection=new RTCPeerConnection(Je),this.stopStreamDataChannel=this.peerConnection.createDataChannel("stopStream"),this.peerConnection.addEventListener("connectionstatechange",this.onConnectionStateChange),this.peerConnection.addEventListener("iceconnectionstatechange",this.onConnectionStateChange))}createReconnectStrategy(t){if(this.reconnectStrategy=PeerClientReconnectStrategyFactory.create(this,t.networkReconnectConfig,this.logger,this.emitter),this.reconnectStrategy){this.reconnectStrategy.onFailure(this.handleTerminalConnectionFailure.bind(this));const t=this.reconnectStrategy.id;this.logger.info({msg:"Using reconnect strategy:",strategyId:t})}}}We=new WeakMap;class ServerRequestEvent extends StageAnalyticsEvent{constructor(t,e,n,r,i,o,s){super(c.SERVER_REQUEST,e,s,!0),Object.assign(this.properties,{action:t,http_method:r,remote_participant_id:o,request_uuid:i,url:n})}}const Ke="draft-ietf-wish-whip-04";var Xe=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};function Ye(t,e){return Xe(this,void 0,void 0,(function*(){t.validateStatus=t=>t>=200&&t<300||403===t;const n=yield me()(t);if(403===n.status){if(2003===n.data.code)throw new ve.AxiosError("Request failed with status code 403","ERR_BAD_REQUEST",t,n.request,n);return t.url===n.request.responseURL?(t.validateStatus=t=>t>=200&&t<300,me()(t)):(t.url=n.request.responseURL,e<5?Ye(t,e+1):(t.validateStatus=t=>t>=200&&t<300,me()(t)))}return n}))}function Qe(t){return Xe(this,void 0,void 0,(function*(){return Ye(t,0)}))}function Ze(t){switch(t){case"new":return Ue.NEW;case"closed":return Ue.CLOSED;case"disconnected":return Ue.DISCONNECTED;case"failed":return Ue.FAILED;case"idle":return Ue.IDLE;case"checking":case"connecting":return Ue.CONNECTING;case"completed":case"connected":return Ue.CONNECTED;default:throw new Error(`unknown connecion state: ${t}`)}}var tn=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};const en="x-stages-options",nn="cap",rn="smc",on=btoa(`{"${nn}": ["${rn}"]}`).replace(/[^A-Za-z0-9+/]/g,"");function sn({action:t,identifier:e,token:n,traceId:r,tag:i,configFeatures:o}){var s;return tn(this,void 0,void 0,(function*(){const a=fe(n),c=p(),u=AnalyticsTracker.getInstance();try{const i=ge({action:t,identifier:e,token:n});if(!i)throw Error("Could not find URL in token");const d="OPTIONS";u.trackEventNoSharedProps(new ServerRequestEvent(t,a,i,d,c.value,e,r));const l=AbortControllersTracker.getInstance().trackNewAbortController(e),h={Authorization:`Bearer ${n}`,"X-Stages-Platform":"web","X-Stages-Request-ID":c.value,"X-Stages-SDK":"1.5.0","X-Stages-Session-ID":m(a),"X-Stages-Trace-ID":r.value,"X-Stages-WHIP-Version":Ke};o.simulcastEnabled&&(h[en]=on);const{headers:p,request:f}=yield Qe({headers:h,method:d,url:i,signal:l.signal}),g={simulcastNegotiated:!1};if(p[en]){const t=JSON.parse(atob(p[en]));o.simulcastEnabled&&(null===(s=t[nn])||void 0===s?void 0:s.includes(rn))&&(g.simulcastNegotiated=!0)}if(!p.link)throw Error("Headers returned from OPTIONS request missing link entry");const v=[];if(p.link.split(",").forEach((t=>{const e={credential:"",urls:"",username:""};t.split(";").forEach((t=>{const n=t.split(/=(.*)/s);if(t.startsWith("turn:")||t.startsWith("<turn:")){let n=t.trim();n.startsWith("<turn:")&&n.endsWith(">")&&(n=n.slice(1,-1)),e.urls=n}else if(3===n.length){const t=n[1].trim().slice(1,-1);switch(n[0].trim()){case"credential":e.credential=t;break;case"username":e.username=t}}})),""!==e.credential&&""!==e.urls&&""!==e.username&&v.push(e)})),0===v.length)throw Error("OPTIONS response contained link header, but no valid ICE Servers");return{iceCredentials:v,responseURL:f.responseURL,stageCapabilities:g}}catch(t){me().isCancel(t)&&u.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},ue(le.OPERATION_ABORTED,t)),{token:a,tag:i,traceId:r,location:"getTurnCredentials",remoteParticipantId:e,requestUUID:c})));const n=function(t){var e,n,r,i,o;if(!(null===(e=t.response)||void 0===e?void 0:e.status))return;const s=Number(null===(n=t.response)||void 0===n?void 0:n.status);if(!(s<400)){if(s>=400&&s<=403&&(null===(r=t.response)||void 0===r?void 0:r.data)&&(null===(i=t.response)||void 0===i?void 0:i.data).code)switch((null===(o=t.response)||void 0===o?void 0:o.data).code){case de.TokenExpired:return le.EXPIRED_TOKEN;case de.NoPermissions:return le.TOKEN_PERMISSIONS_DENIED;case de.StageAtCapacity:return le.STAGE_AT_CAPACITY;default:return le.UNKNOWN_PERMISSIONS_ERROR}switch(s){case 404:return le.WHIP_SESSION_RESOURCE_DELETED;case 429:return le.WHIP_TOO_MANY_REQUESTS;case 500:return le.INTERNAL_SERVER_ERROR;default:return le.UNKNOWN_PERMISSIONS_ERROR}}}(t);n&&u.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},ue(n,t)),{token:a,tag:i,traceId:r,location:"getTurnCredentials",remoteParticipantId:e,requestUUID:c}))),u.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},ue(le.WHIP_OPTIONS_FAILURE,t)),{token:a,tag:i,traceId:r,location:"getTurnCredentials",remoteParticipantId:e,requestUUID:c})))}}))}class ConnectionStateEvent extends StageAnalyticsEvent{constructor(t,e,n,r,i){super(c.CONNECTION_STATE,e,n,!1),Object.assign(this.properties,{action:t,remote_participant_id:i,state:r})}}class IceGatheringStateEvent extends StageAnalyticsEvent{constructor(t,e,n,r,i){super(c.ICE_GATHERING_STATE,e,n,!1),Object.assign(this.properties,{action:t,remote_participant_id:i,state:r})}}var an;!function(t){t.OPTIONS="options",t.POST="post",t.CONNECTED="connected",t.ICE_GATHERING="icegathering"}(an||(an={}));const cn="start",un="stop";class PeerClientPerformanceTracker{constructor(t,e){this.marks={},this.optionsDuration=0,this.postDuration=0,this.timeToCandidate=0,this.timeToConnected=0,this.action=t,this.traceId=e}markActionStart(){this.markStart(an.CONNECTED)}markOptionsStart(){this.markStart(an.OPTIONS)}markOptionsStop(){this.markStop(an.OPTIONS),this.optionsDuration=this.measure(an.OPTIONS)}markPostStart(){this.markStart(an.POST)}markPostStop(){this.markStop(an.POST),this.postDuration=this.measure(an.POST)}markIceGatheringStart(){this.markStart(an.ICE_GATHERING)}markIceGatheringStop(){this.markStop(an.ICE_GATHERING),this.timeToCandidate=this.measure(an.ICE_GATHERING)}markActionStop(){this.markStop(an.CONNECTED),this.timeToConnected=this.measure(an.CONNECTED)}markStart(t){this.marks[`${this.namespace}.${t}.${cn}`]=performance.now()}markStop(t){this.marks[`${this.namespace}.${t}.${un}`]=performance.now()}measure(t){const e=`${this.namespace}.${t}.${cn}`,n=`${this.namespace}.${t}.${un}`,r=this.marks[e],i=this.marks[n];return void 0===r||void 0===i?0:i-r}get namespace(){return`ivswb.peerclient.${this.action}.${this.traceId.value}`}getMeasurements(){const{optionsDuration:t,postDuration:e,timeToCandidate:n,timeToConnected:r}=this;return{optionsDuration:t,postDuration:e,timeToCandidate:n,timeToConnected:r}}}var dn,ln,hn=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};function pn(t){return t.track.kind===Ee.AUDIO}function fn(t){return t.track.kind===Ee.VIDEO}!function(t){t.DISCONNECTED="disconnected",t.CONNECTING="connecting",t.CONNECTED="connected",t.ERRORED="errored"}(dn||(dn={})),function(t){t.STATE_CHANGE="stateChange"}(ln||(ln={}));class StagePublication extends TypedEmitter{constructor(t,e,n,r,i=!1){super(),this.token=t,this.nonScopedLogger=e,this.mediaStreamManager=n,this.traceId=r,this.tracksToPublish=[],this.publicationState=dn.DISCONNECTED,this.latestPubAttemptNum=0,this.isPublishing=!1,this.isStarted=!1,this.start=t=>{this.publicationState===dn.DISCONNECTED||this.publicationState===dn.ERRORED?(this.isStarted=!0,this.tracksToPublish=t,this.latestPubAttemptNum=0,this.processStateUpdate()):this.logger.warn({msg:"publication cannot be started if not in disconnected or error state"})},this.requestRTCStats=t=>hn(this,void 0,void 0,(function*(){return this.peerClient.requestRTCStats(t)})),this.stop=()=>hn(this,void 0,void 0,(function*(){this.peerClient.off(Me,this.onPeerClientConnectionStateChange,this),yield this.unpublish(),this.updateState(dn.DISCONNECTED)})),this.processStateUpdate=t=>{const{publicationState:e}=this;e===dn.DISCONNECTED||e===dn.ERRORED?0===this.latestPubAttemptNum&&(this.updateState(dn.CONNECTING),this.tryPublish()):e===dn.CONNECTING?t===Ue.CONNECTED?this.updateState(dn.CONNECTED):t===Ue.FAILED&&this.latestPubAttemptNum>=4&&this.updateState(dn.ERRORED):e===dn.CONNECTED&&t===Ue.FAILED&&0===this.latestPubAttemptNum&&(this.updateState(dn.CONNECTING),this.tryPublish())},this.updateState=t=>{this.publicationState=t,this.emit(ln.STATE_CHANGE,t)},this.tryPublish=()=>hn(this,void 0,void 0,(function*(){if(this.latestPubAttemptNum++,this.latestPubAttemptNum<=4)try{yield this.publish(this.tracksToPublish),this.latestPubAttemptNum=0}catch(t){if(t instanceof StageClientError&&t.fatal)return this.logger.error({msg:"fatal error publishing",err:t}),void this.updateState(dn.ERRORED);const e=1e3*Math.pow(2,this.latestPubAttemptNum);setTimeout((()=>{this.tryPublish()}),e)}})),this.publish=t=>hn(this,void 0,void 0,(function*(){this.traceId=f();try{return this.trackPublishRequested(),this.peerClient.initTracksToPublish(t),yield this.peerClient.connect(!1,this.traceId),this.trackPublishStarted(),this.isPublishing=!0,this.peerClient}catch(t){const e=new StageClientError(Object.assign(Object.assign({},le.PUBLISH_FAILURE),{token:this.token,traceId:this.traceId,tag:ae.PUBLISH_RELATED,location:"publish"}));throw t instanceof StageClientError&&(e.fatal=t.fatal,e.nominal=t.nominal),this.analyticsTracker.trackError(e),t instanceof StageClientError&&(t.location=`publish > ${t.location}`),t}})),this.unpublish=()=>hn(this,void 0,void 0,(function*(){if(this.publicationState!==dn.DISCONNECTED&&this.publicationState!==dn.ERRORED){this.analyticsTracker.trackEventNoSharedProps(new UnpublishEvent({token:this.token,traceId:this.traceId})),this.token.assertTokenIsUnexpired(this.traceId,ce(Dt.PUBLISH),"unpublish",this.token.participantID);try{this.peerClient.stop();const t=AbortControllersTracker.getInstance().isUnloading,e=t?he.UNLOAD:he.UNPUBLISH;t?this.peerClient.cleanup(Dt.PUBLISH,this.token.participantID,this.token):yield this.peerClient.cleanup(Dt.PUBLISH,this.token.participantID,this.token),this.trackPublishEnded(!0,e)}catch(t){const e=new StageClientError(Object.assign(Object.assign({},le.UNPUBLISH_FAILURE),{token:this.token,traceId:this.traceId,tag:ae.UNPUBLISH_RELATED,location:"unpublish"}));throw this.analyticsTracker.trackError(e),this.trackPublishEnded(!1,he.UNPUBLISH),e}}})),this.replaceOrUpdateTrack=t=>hn(this,void 0,void 0,(function*(){this.tracksToPublish.find((e=>e.track.kind===t.track.kind))?this.tracksToPublish=this.tracksToPublish.map((e=>e.track.kind===t.track.kind?t:e)):this.tracksToPublish.push(t),yield this.peerClient.replaceOrUpdateTrack(t)})),this.getAudioSender=()=>this.peerClient.getAudioSender(),this.getVideoSender=()=>this.peerClient.getVideoSender(),this.onPeerClientConnectionStateChange=t=>{var e;if((null===(e=this.peerClient)||void 0===e?void 0:e.traceId)&&this.token)if(this.logger.debug({msg:`onPeerClientConnectionStateChange: ${t}`,state:t}),t===Ue.FAILED&&this.isPublishing&&(this.trackPublishEnded(!0,he.CONNECTION_FAIL),this.isPublishing=!1),this.isStarted)this.processStateUpdate(t);else switch(t){case Ue.CONNECTING:this.publicationState=dn.CONNECTING;break;case Ue.CONNECTED:this.publicationState=dn.CONNECTED;break;case Ue.DISCONNECTED:this.publicationState=dn.DISCONNECTED;break;case Ue.FAILED:this.publicationState=dn.ERRORED;break;default:this.publicationState=dn.CONNECTING}},this.trackPublishRequested=()=>{this.analyticsTracker.trackEventNoSharedProps(new PublishEvent({token:this.token,traceId:this.traceId}))},this.trackPublishStarted=()=>{if(!this.peerClient)return;const t=this.peerClient.getActionMeasurements();this.analyticsTracker.trackEventNoSharedProps(new PublishStartedEvent({token:this.token,traceId:this.traceId,optionsDuration:t.optionsDuration,postDuration:t.postDuration,timeToCandidate:t.timeToCandidate,totalDuration:t.timeToConnected}))},this.trackPublishEnded=(t,e)=>{this.analyticsTracker.trackEventNoSharedProps(new PublishEndedEvent({token:this.token,isUnpublishSuccessful:t,traceId:this.traceId,reason:e}))},this.peerClient=new StagePeerClient(t,this.nonScopedLogger,this.mediaStreamManager,Dt.PUBLISH,ce(Dt.PUBLISH),this.traceId),i&&this.peerClient.setV2(),this.logger=new ScopedLogger(e,w.PUBLICATION),this.analyticsTracker=AnalyticsTracker.getInstance(),this.peerClient.on(Me,this.onPeerClientConnectionStateChange,this)}removeTrack(t){return hn(this,void 0,void 0,(function*(){this.tracksToPublish=this.tracksToPublish.filter((e=>e.track.kind!==t)),yield this.peerClient.removeTrack(t)}))}}class SdpMunger{constructor(t){this.sdp=t}static splitLines(t){return t.trim().split("\n").map((t=>t.trim()))}static splitSections(t){return t.split("\nm=").map(((t,e)=>(e>0?`m=${t}`:t).trim()+SdpMunger.CRLF))}getUniqueRtpHeaderExtensionId(t){const e=[];for(const n of t)if(/^a=extmap:/.test(n.trim())){const t=+n.split("a=extmap:")[1].split(" ")[0];e.includes(t)||e.push(t)}e.sort(((t,e)=>t-e));let n=0;for(const t of e){if(t-n>1)return n+1;n=t}return 14===n?-1:n+1}withVideoLayersAllocationRtpHeaderExtension(t){const e="http://www.webrtc.org/experiments/rtp-hdrext/video-layers-allocation00",n=t?t.getRtpHeaderExtensionId(e):-1,r=-1===n?this.getUniqueRtpHeaderExtensionId(SdpMunger.splitLines(this.sdp)):n,i=SdpMunger.splitSections(this.sdp),o=[];for(let t of i){if(/^m=video/.test(t)&&-1===SdpMunger.getRtpHeaderExtensionIdInSection(t,e)){const n=SdpMunger.splitLines(t),i=[];if(-1===r||this.hasRtpHeaderExtensionId(r)){o.push(t);continue}for(const t of n)if(i.push(t),/^a=sendrecv/.test(t.trim())){const t=`a=extmap:${r} ${e}`;i.push(t)}t=i.join(SdpMunger.CRLF)+SdpMunger.CRLF}else if(-1!==n&&/^m=video/.test(t)&&SdpMunger.getRtpHeaderExtensionIdInSection(t,e)!==n){const r=SdpMunger.splitLines(t),i=[];for(const t of r){if(/^a=extmap:/.test(t.trim())){if(t.split("a=extmap:")[1].split(" ")[1]===e){if(!this.hasRtpHeaderExtensionId(n)){const t=`a=extmap:${n} ${e}`;i.push(t)}continue}}i.push(t)}t=i.join(SdpMunger.CRLF)+SdpMunger.CRLF}o.push(t)}const s=o.join("");return new SdpMunger(s)}static getRtpHeaderExtensionIdInSection(t,e){const n=SdpMunger.splitLines(t);for(const t of n)if(/^a=extmap:/.test(t.trim())){const n=t.split("a=extmap:")[1].split(" "),r=+n[0];if(n[1]===e)return r}return-1}getRtpHeaderExtensionId(t){const e=SdpMunger.splitSections(this.sdp);for(const n of e)if(/^m=video/.test(n)){const e=SdpMunger.getRtpHeaderExtensionIdInSection(n,t);if(-1!==e)return e}return-1}hasRtpHeaderExtensionId(t){const e=SdpMunger.splitLines(this.sdp);for(const n of e)if(/^a=extmap:/.test(n.trim())){if(+n.split("a=extmap:")[1].split(" ")[0]===t)return!0}return!1}}SdpMunger.CRLF="\r\n",SdpMunger.rfc7587LowestBitrate=6e3,SdpMunger.rfc7587HighestBitrate=51e4;class PublishedVideoStatsEvent extends StageAnalyticsEvent{constructor(t,e,n){var r,i;super(c.PUBLISHED_VIDEO_STATS,t,e,!1);const o=AnalyticsTracker.getInstance().getSfuResource();Object.assign(this.properties,Object.assign({action:Dt.PUBLISH,node:null!==(r=null==o?void 0:o.node)&&void 0!==r?r:"",cluster:null!==(i=null==o?void 0:o.cluster)&&void 0!==i?i:""},(t=>{var e,n,r,i;return{bytes_sent:t.bytesSent,fir_count:t.firCount,frames_encoded:t.framesEncoded,frames_sent:t.framesSent,header_bytes_sent:t.headerBytesSent,huge_frames_sent:t.hugeFramesSent,key_frames_encoded:t.keyFramesEncoded,nack_count:t.nackCount,packets_sent:t.packetsSent,pli_count:t.pliCount,quality_limitation_reason:t.qualityLimitationReason,quality_limitation_resolution_changes:t.qualityLimitationResolutionChanges,retransmitted_bytes_sent:t.retransmittedBytesSent,retransmitted_packets_sent:t.retransmittedPacketsSent,total_encode_time:t.totalEncodeTime,total_encoded_bytes_target:t.totalEncodedBytesTarget,total_packet_send_delay:t.totalPacketsSendDelay,frame_width:null!==(e=t.frameWidth)&&void 0!==e?e:0,frame_height:null!==(n=t.frameHeight)&&void 0!==n?n:0,frames_per_second:null!==(r=t.framesPerSecond)&&void 0!==r?r:0,active:!!t.framesPerSecond&&0!==t.framesPerSecond,rid:null!==(i=t.rid)&&void 0!==i?i:"no-rid"}})(n)))}}class PublishedVideoStatsWindowEvent extends StageAnalyticsEvent{constructor(t,e,n,r){var i,o;super(c.PUBLISHED_VIDEO_STATS_WINDOW,t,e,!1);const s=AnalyticsTracker.getInstance().getSfuResource();Object.assign(this.properties,Object.assign({action:Dt.PUBLISH,node:null!==(i=null==s?void 0:s.node)&&void 0!==i?i:"",cluster:null!==(o=null==s?void 0:s.cluster)&&void 0!==o?o:"",windowSizeMs:n.timestamp-r.timestamp},((t,e)=>{var n,r,i,o;return{bytes_sent:t.bytesSent-e.bytesSent,fir_count:t.firCount-e.firCount,frames_encoded:t.framesEncoded-e.framesEncoded,frames_sent:t.framesSent-e.framesSent,header_bytes_sent:t.headerBytesSent-e.headerBytesSent,huge_frames_sent:t.hugeFramesSent-e.hugeFramesSent,key_frames_encoded:t.keyFramesEncoded-e.keyFramesEncoded,nack_count:t.nackCount-e.nackCount,packets_sent:t.packetsSent-e.packetsSent,pli_count:t.pliCount-e.pliCount,quality_limitation_reason:t.qualityLimitationReason,quality_limitation_resolution_changes:t.qualityLimitationResolutionChanges,retransmitted_bytes_sent:t.retransmittedBytesSent-e.retransmittedBytesSent,retransmitted_packets_sent:t.retransmittedPacketsSent-e.retransmittedPacketsSent,total_encode_time:t.totalEncodeTime-e.totalEncodeTime,total_encoded_bytes_target:t.totalEncodedBytesTarget-e.totalEncodedBytesTarget,total_packet_send_delay:t.totalPacketSendDelay-e.totalPacketSendDelay,frame_width:null!==(n=t.frameWidth)&&void 0!==n?n:0,frame_height:null!==(r=t.frameHeight)&&void 0!==r?r:0,frames_per_second:null!==(i=t.framesPerSecond)&&void 0!==i?i:0,active:!!t.framesPerSecond&&0!==t.framesPerSecond,rid:null!==(o=t.rid)&&void 0!==o?o:"no-rid"}})(n,r)))}}class PublishedAudioStatsEvent extends StageAnalyticsEvent{constructor(t,e,n){var r,i;super(c.PUBLISHED_AUDIO_STATS,t,e,!1);const o=AnalyticsTracker.getInstance().getSfuResource();var s;Object.assign(this.properties,Object.assign({action:Dt.PUBLISH,node:null!==(r=null==o?void 0:o.node)&&void 0!==r?r:"",cluster:null!==(i=null==o?void 0:o.cluster)&&void 0!==i?i:""},{bytes_sent:(s=n).bytesSent,header_bytes_sent:s.headerBytesSent,nack_count:s.nackCount,packets_sent:s.packetsSent,retransmitted_bytes_sent:s.retransmittedBytesSent,retransmitted_packets_sent:s.retransmittedPacketsSent}))}}class PublishedAudioStatsWindowEvent extends StageAnalyticsEvent{constructor(t,e,n,r){var i,o;super(c.PUBLISHED_AUDIO_STATS_WINDOW,t,e,!1);const s=AnalyticsTracker.getInstance().getSfuResource();var a,u;Object.assign(this.properties,Object.assign({action:Dt.PUBLISH,node:null!==(i=null==s?void 0:s.node)&&void 0!==i?i:"",cluster:null!==(o=null==s?void 0:s.cluster)&&void 0!==o?o:"",windowSizeMs:n.timestamp-r.timestamp},(u=r,{bytes_sent:(a=n).bytesSent-u.bytesSent,header_bytes_sent:a.headerBytesSent-u.headerBytesSent,nack_count:a.nackCount-u.nackCount,packets_sent:a.packetsSent-u.packetsSent,retransmitted_bytes_sent:a.retransmittedBytesSent-u.retransmittedBytesSent,retransmitted_packets_sent:a.retransmittedPacketsSent-u.retransmittedPacketsSent})))}}class SubscribedVideoStatsEvent extends StageAnalyticsEvent{constructor(t,e,n,r){var i,o;super(c.SUBSCRIBED_VIDEO_STATS,t,e,!1);const s=AnalyticsTracker.getInstance().getSfuResource();Object.assign(this.properties,Object.assign({action:Dt.SUBSCRIBE,node:null!==(i=null==s?void 0:s.node)&&void 0!==i?i:"",cluster:null!==(o=null==s?void 0:s.cluster)&&void 0!==o?o:"",remote_participant_id:n},(t=>{var e,n,r;return{bytes_received:t.bytesReceived,fir_count:t.firCount,frames_decoded:t.framesDecoded,frames_dropped:t.framesDropped,frames_received:t.framesReceived,header_bytes_received:t.headerBytesReceived,jitter_buffer_delay:t.jitterBufferDelay,key_frames_decoded:t.keyFramesDecoded,nack_count:t.nackCount,packets_discarded:t.packetsDiscarded,packets_lost:t.packetsLost,packets_received:t.packetsReceived,pli_count:t.pliCount,total_freezes_duration:t.totalFreezesDuration,total_pauses_duration:t.totalPausesDuration,freeze_count:t.freezeCount,pause_count:t.pauseCount,frame_width:null!==(e=t.frameWidth)&&void 0!==e?e:0,frame_height:null!==(n=t.frameHeight)&&void 0!==n?n:0,frames_per_second:null!==(r=t.framesPerSecond)&&void 0!==r?r:0}})(r)))}}class SubscribedVideoStatsWindowEvent extends StageAnalyticsEvent{constructor(t,e,n,r,i){var o,s;super(c.SUBSCRIBED_VIDEO_STATS_WINDOW,t,e,!1);const a=AnalyticsTracker.getInstance().getSfuResource();Object.assign(this.properties,Object.assign({action:Dt.SUBSCRIBE,node:null!==(o=null==a?void 0:a.node)&&void 0!==o?o:"",cluster:null!==(s=null==a?void 0:a.cluster)&&void 0!==s?s:"",windowSizeMs:r.timestamp-i.timestamp,remote_participant_id:n},((t,e)=>{var n,r,i;return{bytes_received:t.bytesReceived-e.bytesReceived,fir_count:t.firCount-e.firCount,frames_decoded:t.framesDecoded-e.framesDecoded,frames_dropped:t.framesDropped-e.framesDropped,frames_received:t.framesReceived-e.framesReceived,header_bytes_received:t.headerBytesReceived-e.headerBytesReceived,jitter_buffer_delay:t.jitterBufferDelay-e.jitterBufferDelay,key_frames_decoded:t.keyFramesDecoded-e.keyFramesDecoded,nack_count:t.nackCount-e.nackCount,packets_discarded:t.packetsDiscarded-e.packetsDiscarded,packets_lost:t.packetsLost-e.packetsLost,packets_received:t.packetsReceived-e.packetsReceived,pli_count:t.pliCount-e.pliCount,total_freezes_duration:t.totalFreezesDuration-e.totalFreezesDuration,total_pauses_duration:t.totalPausesDuration-e.totalPausesDuration,freeze_count:t.freezeCount-e.freezeCount,pause_count:t.pauseCount-e.pauseCount,frame_width:null!==(n=t.frameWidth)&&void 0!==n?n:0,frame_height:null!==(r=t.frameHeight)&&void 0!==r?r:0,frames_per_second:null!==(i=t.framesPerSecond)&&void 0!==i?i:0}})(r,i)))}}class SubscribedAudioStatsEvent extends StageAnalyticsEvent{constructor(t,e,n,r){var i,o;super(c.SUBSCRIBED_AUDIO_STATS,t,e,!1);const s=AnalyticsTracker.getInstance().getSfuResource();var a;Object.assign(this.properties,Object.assign({action:Dt.SUBSCRIBE,node:null!==(i=null==s?void 0:s.node)&&void 0!==i?i:"",cluster:null!==(o=null==s?void 0:s.cluster)&&void 0!==o?o:"",remote_participant_id:n},{bytes_received:(a=r).bytesReceived,concealed_samples:a.concealedSamples,header_bytes_received:a.headerBytesReceived,inserted_samples_for_deceleration:a.insertedSamplesForDeceleration,jitter_buffer_delay:a.jitterBufferDelay,packets_discarded:a.packetsDiscarded,packets_lost:a.packetsLost,packets_received:a.packetsReceived,removed_samples_for_acceleration:a.removedSamplesForAcceleration,total_samples_received:a.totalSamplesReceived}))}}class SubscribedAudioStatsWindowEvent extends StageAnalyticsEvent{constructor(t,e,n,r,i){var o,s;super(c.SUBSCRIBED_AUDIO_STATS_WINDOW,t,e,!1);const a=AnalyticsTracker.getInstance().getSfuResource();var u,d;Object.assign(this.properties,Object.assign({action:Dt.SUBSCRIBE,windowSizeMs:r.timestamp-i.timestamp,node:null!==(o=null==a?void 0:a.node)&&void 0!==o?o:"",cluster:null!==(s=null==a?void 0:a.cluster)&&void 0!==s?s:"",remote_participant_id:n},(d=i,{bytes_received:(u=r).bytesReceived-d.bytesReceived,concealed_samples:u.concealedSamples-d.concealedSamples,header_bytes_received:u.headerBytesReceived-d.headerBytesReceived,inserted_samples_for_deceleration:u.insertedSamplesForDeceleration-d.insertedSamplesForDeceleration,jitter_buffer_delay:u.jitterBufferDelay-d.jitterBufferDelay,packets_discarded:u.packetsDiscarded-d.packetsDiscarded,packets_lost:u.packetsLost-d.packetsLost,packets_received:u.packetsReceived-d.packetsReceived,removed_samples_for_acceleration:u.removedSamplesForAcceleration-d.removedSamplesForAcceleration,total_samples_received:u.totalSamplesReceived-d.totalSamplesReceived})))}}class MinuteEvent extends StageAnalyticsEvent{constructor(t,e,n,r,i){super(c.MINUTE,t,e,!1),Object.assign(this.properties,{action:r?Dt.PUBLISH:Dt.SUBSCRIBE,is_publishing:r,minutes_logged:n,subscribed_number:i})}}class SimulcastLayerInfoEvent extends StageAnalyticsEvent{constructor(t,e,n,r){super(c.SIMULCAST_LAYER_INFO,t,e,!1),Object.assign(this.properties,{rid:n,active:r})}}class MultihostConfigurationEvent extends StageAnalyticsEvent{constructor(t,e,n){super(c.MULTIHOST_CONFIGURATION,t,e,!1),Object.assign(this.properties,Object.assign({},n))}}var gn=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};const vn="no-rid";class PeerClientStatsReporter{constructor(t,e,n,r){this.minutesLogged=0,this.simulcastEnabled=!1,this.simulcastState={low:!1,mid:!1,hi:!1},this.multihostConfiguration=PeerClientStatsReporter.defaultMultihostConfiguration(),this.prevVideoStats=new Map,this.onPeerConnectionStateChange=()=>{switch(this.getConnectionState()){case Ue.CONNECTED:this.setupIntervals();break;case Ue.FAILED:this.flushStats()}},this.action=t,this.token=e,this.traceId=n,this.analyticsTracker=AnalyticsTracker.getInstance(),this.identifier=r}static defaultMultihostConfiguration(){return{video_codec:"unknown",width:0,height:0,max_bitrate:0,min_bitrate:0,target_fps:0,echo_cancellation:!1,auto_gain:!1,noise_suppression:!1,enable_simulcast:!1}}start(t,e=!1){this.peerConnection=t,this.simulcastEnabled=e,this.prevAudioStats=void 0,this.prevVideoStats=new Map,this.peerConnection.addEventListener("connectionstatechange",this.onPeerConnectionStateChange)}stop(){var t;clearInterval(this.uploadMinutesLoggedInterval),this.uploadMinutesLoggedInterval=void 0,clearInterval(this.uploadStatsInterval),this.uploadStatsInterval=void 0,null===(t=this.peerConnection)||void 0===t||t.removeEventListener("connectionstatechange",this.onPeerConnectionStateChange)}updateMultihostConfiguration(t,e){var n,r,i,o,s,a;return gn(this,void 0,void 0,(function*(){if(this.action!==Dt.PUBLISH||!this.peerConnection)return;const c=PeerClientStatsReporter.defaultMultihostConfiguration();if(e){const t=this.peerConnection.getSenders().filter((t=>null!==t.track&&"video"===t.track.kind));if(t.length>0){(yield t[0].getStats()).forEach((t=>{"codec"===t.type&&(c.video_codec=t.mimeType)}))}const o=e.track.getSettings();c.width=null!==(n=o.width)&&void 0!==n?n:0,c.height=null!==(r=o.height)&&void 0!==r?r:0,c.target_fps=null!==(i=o.frameRate)&&void 0!==i?i:0,e.config?(c.max_bitrate=e.config.maxBitrateBps,c.min_bitrate=e.config.minBitrateBps,c.enable_simulcast=e.config.simulcastEnabled):(c.max_bitrate=qt(Kt),c.min_bitrate=qt(Jt),c.enable_simulcast=!1)}if(t){const e=t.track.getSettings();c.auto_gain=null!==(o=e.autoGainControl)&&void 0!==o&&o,c.echo_cancellation=null!==(s=e.echoCancellation)&&void 0!==s&&s,c.noise_suppression=null!==(a=e.noiseSuppression)&&void 0!==a&&a}(0,Pe.isEqual)(c,this.multihostConfiguration)||(this.analyticsTracker.trackEventNoSharedProps(new MultihostConfigurationEvent(this.token,this.traceId,c)),this.multihostConfiguration=c)}))}setupIntervals(){this.action===Dt.PUBLISH&&(this.uploadMinutesLoggedInterval||(this.uploadMinutePublishedEvent(),this.uploadMinutesLoggedInterval=this.startInterval(this.uploadMinutePublishedEvent,6e4)),this.simulcastEnabled&&!this.pollSimulcastLayerInterval&&(this.pollSimulcastLayers(),this.pollSimulcastLayerInterval=this.startInterval(this.pollSimulcastLayers,5e3))),this.uploadStatsInterval||(this.uploadStats(),this.uploadStatsInterval=this.startInterval(this.uploadStats,1e4))}startInterval(t,e){return setInterval(t.bind(this),e)}getConnectionState(){var t;if(!this.peerConnection)return Ue.NONE;const e=null!==(t=this.peerConnection.connectionState)&&void 0!==t?t:this.peerConnection.iceConnectionState;try{return Ze(e)}catch(t){return Ue.IDLE}}pollSimulcastLayers(){var t;return gn(this,void 0,void 0,(function*(){if(this.getConnectionState()===Ue.CONNECTED){const e=yield null===(t=this.peerConnection)||void 0===t?void 0:t.getStats();if(!e)return;e.forEach((t=>{var e;if("outbound-rtp"===t.type){const n=0!==(null!==(e=t.framesPerSecond)&&void 0!==e?e:0);switch(t.rid){case"low":n!==this.simulcastState.low&&(this.simulcastState.low=n,this.analyticsTracker.trackEventNoSharedProps(new SimulcastLayerInfoEvent(this.token,this.traceId,t.rid,n)));break;case"mid":n!==this.simulcastState.mid&&(this.simulcastState.mid=n,this.analyticsTracker.trackEventNoSharedProps(new SimulcastLayerInfoEvent(this.token,this.traceId,t.rid,n)));break;case"hi":n!==this.simulcastState.hi&&(this.simulcastState.hi=n,this.analyticsTracker.trackEventNoSharedProps(new SimulcastLayerInfoEvent(this.token,this.traceId,t.rid,n)))}}}))}}))}uploadMinutePublishedEvent(){this.getConnectionState()===Ue.CONNECTED&&(this.analyticsTracker.trackEventNoSharedProps(new MinuteEvent(this.token,this.traceId,this.minutesLogged,!0,0)),this.minutesLogged++)}flushStats(){var t;return gn(this,void 0,void 0,(function*(){const e=yield null===(t=this.peerConnection)||void 0===t?void 0:t.getStats();e&&(this.action===Dt.PUBLISH?this.uploadPublisherStats(e):this.action===Dt.SUBSCRIBE&&this.uploadSubscriberStats(e))}))}uploadStats(){var t;return gn(this,void 0,void 0,(function*(){if(this.getConnectionState()===Ue.CONNECTED){const e=yield null===(t=this.peerConnection)||void 0===t?void 0:t.getStats();if(!e)return;this.action===Dt.PUBLISH?this.uploadPublisherStats(e):this.action===Dt.SUBSCRIBE&&this.uploadSubscriberStats(e)}}))}uploadPublisherStats(t){t.forEach((t=>{if("outbound-rtp"===t.type)switch(t.kind){case"audio":this.analyticsTracker.trackEventNoSharedProps(new PublishedAudioStatsEvent(this.token,this.traceId,t)),this.prevAudioStats&&this.analyticsTracker.trackEventNoSharedProps(new PublishedAudioStatsWindowEvent(this.token,this.traceId,t,this.prevAudioStats)),this.prevAudioStats=t;break;case"video":this.analyticsTracker.trackEventNoSharedProps(new PublishedVideoStatsEvent(this.token,this.traceId,t));const e=this.getPrevVideoStat(t);e&&this.analyticsTracker.trackEventNoSharedProps(new PublishedVideoStatsWindowEvent(this.token,this.traceId,t,e)),this.setPrevVideoStat(t)}}))}uploadSubscriberStats(t){t.forEach((t=>{if("inbound-rtp"===t.type)switch(t.kind){case"audio":this.analyticsTracker.trackEventNoSharedProps(new SubscribedAudioStatsEvent(this.token,this.traceId,this.identifier,t)),this.prevAudioStats&&this.analyticsTracker.trackEventNoSharedProps(new SubscribedAudioStatsWindowEvent(this.token,this.traceId,this.identifier,t,this.prevAudioStats)),this.prevAudioStats=t;break;case"video":this.analyticsTracker.trackEventNoSharedProps(new SubscribedVideoStatsEvent(this.token,this.traceId,this.identifier,t));const e=this.getPrevVideoStat(t);e&&this.analyticsTracker.trackEventNoSharedProps(new SubscribedVideoStatsWindowEvent(this.token,this.traceId,this.identifier,t,e)),this.setPrevVideoStat(t)}}))}getPrevVideoStat(t){return this.simulcastEnabled&&t.rid&&this.prevVideoStats.has(t.rid)?this.prevVideoStats.get(t.rid):!this.simulcastEnabled&&this.prevVideoStats.has(vn)?this.prevVideoStats.get(vn):void 0}setPrevVideoStat(t){this.simulcastEnabled&&t.rid?this.prevVideoStats.set(t.rid,t):this.simulcastEnabled||this.prevVideoStats.set(vn,t)}}var mn=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};let _n=null;class StagePeerClient{constructor(t,e,n,r,i,o,s,a){if(this.sentOffer=!1,this.v2=!1,this.subscribeToAudioOnly=!1,this.stageCapabilities={simulcastNegotiated:!1},this.connect=(t=!1,e)=>mn(this,void 0,void 0,(function*(){const{token:n,tag:r,identifier:i,action:o}=this;let s,a,c;const u=()=>{this.emitter.off(Le,s),this.emitter.off(Me,a)};this.traceId=e,this.subscribeToAudioOnly=t;const d=new Promise(((t,e)=>{const u=setTimeout((()=>{this.stop();const t=o===Dt.SUBSCRIBE?le.SUBSCRIBE_TIMED_OUT:le.PUBLISH_TIMED_OUT,s=new StageClientError(Object.assign(Object.assign({},t),{token:n,traceId:this.traceId,tag:r,location:"connect",remoteParticipantId:i}));this.analyticsTracker.trackError(s),e(s)}),1e4);s=t=>{clearTimeout(u),this.stop(),e(t)},a=e=>{e===Ue.CONNECTED&&(clearTimeout(u),t())},this.emitter.on(Le,s),this.emitter.on(Me,a),c=()=>{clearTimeout(u)}}));try{yield this.start();const t=yield this.addTransceivers();return yield d,AbortControllersTracker.getInstance().removeAbortController(i),{mediaStream:t}}catch(t){throw c&&c(),t}finally{u()}})),this.disconnect=()=>mn(this,void 0,void 0,(function*(){const{token:t,action:e}=this;this.stop(),AbortControllersTracker.getInstance().isUnloading?this.cleanup(e,t.participantID,t):yield this.cleanup(e,t.participantID,t)})),this.onTrack=t=>{const{token:e,action:n,traceId:r,identifier:i}=this;ye(e,r,`onTrack: ${t.track.kind}`,n,i)},this.onIceGatheringStateChange=()=>{var t,e;const{token:n,action:r,traceId:i,identifier:o}=this;if("gathering"===(null===(t=this.peerConnection)||void 0===t?void 0:t.iceGatheringState)&&this.perfTracker.markIceGatheringStart(),this.peerConnection){const t=this.peerConnection.iceGatheringState,e=new IceGatheringStateEvent(r,n,i,t,o);this.analyticsTracker.trackEventNoSharedProps(e)}ye(n,i,`ICE gathering state change: ${null===(e=this.peerConnection)||void 0===e?void 0:e.iceGatheringState}`,r,o)},this.onIceCandidate=t=>mn(this,void 0,void 0,(function*(){var e,n,r,i;const{token:o,identifier:s,action:a,sentOffer:c,traceId:u}=this,d=null===(e=t.target.localDescription)||void 0===e?void 0:e.sdp.includes("relay");if(this.analyticsTracker.trackEventNoSharedProps(new TraceEvent(this.token,u,`ice candidate: hasRelay = ${d}, candidate = ${null===(n=t.candidate)||void 0===n?void 0:n.candidate}`,a,s)),!d&&o.shouldUseTURN()||c||void 0===(null===(r=t.candidate)||void 0===r?void 0:r.candidate)||(this.perfTracker.markIceGatheringStop(),this.sentOffer=!0,this.perfTracker.markPostStart(),yield this.fetchAndSetRemoteDescription(a,s,o,this.responseURL),this.perfTracker.markPostStop()),!c&&void 0===(null===(i=t.candidate)||void 0===i?void 0:i.candidate)){const t=new StageClientError(Object.assign(Object.assign({},le.NO_CANDIDATES),{token:o,traceId:u,tag:ce(a,s),location:"StagePeerClient.start",remoteParticipantId:s}));return this.analyticsTracker.trackError(t),void this.emitter.emit(Le,t)}})),this.onMute=()=>mn(this,void 0,void 0,(function*(){const{token:t,action:e,traceId:n,identifier:r}=this;ye(t,n,"Track has muted",e,r)})),this.onUnMute=()=>mn(this,void 0,void 0,(function*(){const{token:t,action:e,traceId:n,identifier:r}=this;ye(t,n,"Track has unmuted",e,r)})),this.stopRemoteVideo=()=>{if(!this.videoTransceiver){const t=new Error("no video transciever to stop");throw this.logger.error({err:t,msg:"error stopping video"}),t}const{mid:t}=this.videoTransceiver;if(!t){const t=new Error("no mid for transceiver");throw this.logger.error({err:t,msg:"error stopping video"}),t}this.sendMediaControlsRequest({pause:[t]})},this.startRemoteVideo=()=>{if(!this.videoTransceiver){const t=new Error("no video transciever to start");throw this.logger.error({err:t,msg:"error starting video"}),t}const{mid:t}=this.videoTransceiver;if(!t){const t=new Error("no mid for transceiver");throw this.logger.error({err:t,msg:"error starting video"}),t}this.sendMediaControlsRequest({play:[t]})},this.sendMediaControlsRequest=t=>{var e;if(this.action!==Dt.SUBSCRIBE){const t=new Error("media controls not supported for publisher peer connections");throw this.logger.error({err:t,msg:"tried to send media controls request for PUBLISHER peer connection"}),t}if(!(null===(e=this.whipResource)||void 0===e?void 0:e.mediaControls)){const t=new Error("media controls url undefined");throw this.logger.error({err:t,msg:"error sending media controls request"}),t}const{mediaControls:n}=this.whipResource,r=p();me().post(n,JSON.stringify(t),{headers:{Authorization:`Bearer ${this.token.rawToken}`,"Content-Type":"application/json","X-Stages-Platform":"web","X-Stages-Request-ID":r.value,"X-Stages-SDK":"1.5.0","X-Stages-Session-ID":m(this.token),"X-Stages-Trace-ID":this.traceId.value,"X-Stages-WHIP-Version":Ke}}).then((t=>{if(t.status>=300){const e=new Error(`got bad status ${t.status} from media controls request`);throw this.logger.error({err:e,msg:"error sending media controls request"}),e}}),(t=>{throw t}))},this.fetchAndSetRemoteDescription=(t,e,n,r)=>mn(this,void 0,void 0,(function*(){var i,o,s,a;const c=p();try{const u="POST";this.analyticsTracker.trackEventNoSharedProps(new ServerRequestEvent(t,n,r,u,c.value,e,this.traceId));const d=AbortControllersTracker.getInstance().trackNewAbortController(e),{data:l,headers:h,request:p}=yield Qe({data:null===(o=null===(i=this.peerConnection)||void 0===i?void 0:i.localDescription)||void 0===o?void 0:o.sdp,headers:{Authorization:`Bearer ${n.rawToken}`,"Content-Type":"application/sdp","X-Stages-Platform":"web","X-Stages-Request-ID":c.value,"X-Stages-SDK":"1.5.0","X-Stages-Session-ID":m(n),"X-Stages-Trace-ID":this.traceId.value,"X-Stages-WHIP-Version":Ke},method:u,responseType:"text",url:r,signal:d.signal});if(this.analyticsTracker.setSfuResource(function(t){const e=t.match(/https:\/\/([^/]+)\//);if(e){const t=e[1].split(".");if(t[0].includes("video-rtx"))return{node:`${t[0]}.${t[1]}`,cluster:t[1]}}}(p.responseURL)),h.location){const t=new URL(p.responseURL),e=t.port?`:${t.port}`:"";this.whipResource={path:`${t.protocol}//${t.hostname}${e}${h.location}`}}null===(s=h.link)||void 0===s||s.split(",").forEach((t=>{const e=this.parseWhipLinkExtension(t);if(3===(null==e?void 0:e.length))switch(e[2]){case"urn:ietf:params:whip:ivs-stages:session-delete":{const t=new URL(p.responseURL),n=t.port?`:${t.port}`:"";this.whipResource&&(this.whipResource.sessionDelete=`${t.protocol}//${t.hostname}${n}${e[1]}`);break}case"urn:ietf:params:whep:core:playback-controls":{const t=new URL(p.responseURL),n=t.port?`:${t.port}`:"";this.whipResource&&(this.whipResource.mediaControls=`${t.protocol}//${t.hostname}${n}${e[1]}`);break}}})),yield null===(a=this.peerConnection)||void 0===a?void 0:a.setRemoteDescription({sdp:l,type:"answer"})}catch(r){if(me().isCancel(r)){const i=new StageClientError(Object.assign(Object.assign({},ue(le.OPERATION_ABORTED,r)),{token:n,traceId:this.traceId,tag:ce(t,e),location:"StagePeerClient.start",requestUUID:c,remoteParticipantId:e}));return this.analyticsTracker.trackError(i),void this.emitter.emit(Le,i)}const i=new StageClientError(Object.assign(Object.assign({},ue(le.WHIP_POST_FAILURE,r)),{token:n,traceId:this.traceId,tag:ce(t,e),location:"StagePeerClient.start",requestUUID:c,remoteParticipantId:e}));this.analyticsTracker.trackError(i),this.emitter.emit(Le,i)}})),this.cleanup=(t,e,n)=>mn(this,void 0,void 0,(function*(){var r,i,o,s;let a=ge({action:t,identifier:e,token:n.rawToken,whipURLOverride:this.whipUrlOverride});const c=p();if(ye(n,this.traceId,`token dataplane url: ${a}`,t,e),(null===(r=this.whipResource)||void 0===r?void 0:r.path)&&(a=null===(i=this.whipResource)||void 0===i?void 0:i.path,ye(n,this.traceId,`use hostnamecachedurl: ${a}`,t,e)),a||this.analyticsTracker.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},le.WHIP_URL_MISSING),{token:n,traceId:this.traceId,tag:ce(t,e),location:t===Dt.SUBSCRIBE?"unsubscribe":"unpublish",requestUUID:c,remoteParticipantId:e}))),AbortControllersTracker.getInstance().isUnloading){if(null===(s=this.whipResource)||void 0===s?void 0:s.sessionDelete){a=this.whipResource.sessionDelete,ye(n,this.traceId,`DELETE via session-delete beacon path: ${a}`,t,e);try{navigator.sendBeacon(a,JSON.stringify({authorization:n.rawToken}))}catch(r){this.analyticsTracker.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},ue(le.WHIP_DELETE_FAILURE,r)),{token:n,traceId:this.traceId,tag:ce(t,e),location:Dt.SUBSCRIBE?"unsubscribe":"unpublish",requestUUID:c,remoteParticipantId:e})))}}}else try{yield me().delete(a,{headers:{Authorization:`Bearer ${n.rawToken}`,"X-Stages-Platform":"web","X-Stages-Request-ID":c.value,"X-Stages-SDK":"1.5.0","X-Stages-Session-ID":m(n),"X-Stages-Trace-ID":this.traceId.value,"X-Stages-WHIP-Version":Ke}})}catch(r){404===(null===(o=r.response)||void 0===o?void 0:o.status)?ye(n,this.traceId,`DELETE returned 404, ignoring, action = ${t}, uuid = ${c.value}`,t,e):this.analyticsTracker.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},ue(le.WHIP_DELETE_FAILURE,r)),{token:n,traceId:this.traceId,tag:ce(t,e),location:Dt.SUBSCRIBE?"unsubscribe":"unpublish",requestUUID:c,remoteParticipantId:e})))}})),this.getConnectionState=()=>{if(!this.peerConnection)return Ue.NONE;const t=this.peerConnection.connectionState||this.peerConnection.iceConnectionState;try{return Ze(t)}catch(e){return this.logger.warn({msg:"Unhandled connection state:",rawState:t}),Ue.IDLE}},this.getValidPeerConnectionCanThrow=()=>{if(!this.peerConnection)throw new Error("missing peer connection");return this.peerConnection},this.onIceCandidateError=t=>{const{token:e,traceId:n,tag:r}=this;if(701!==t.errorCode){const t=new StageClientError(Object.assign(Object.assign({},le.ICE_CANDIDATE_ERROR),{token:e,traceId:n,tag:r,location:"onIceCandidateError",remoteParticipantId:this.identifier}));this.analyticsTracker.trackError(t),this.emitter.emit(Le,t)}},this.onIceConnectionStateChange=()=>{var t;const{token:e,traceId:n,action:r,identifier:i}=this;ye(e,n,`ICE connection state change: ${null===(t=this.peerConnection)||void 0===t?void 0:t.iceConnectionState}`,r,i),this.onConnectionStateChange()},this.onConnectionStateChange=()=>{var t;if(this.peerConnection){const t=this.peerConnection.connectionState||this.peerConnection.iceConnectionState,{token:e,traceId:n,identifier:r,action:i}=this,o=new ConnectionStateEvent(i,e,n,t,r);this.analyticsTracker.trackEventNoSharedProps(o),ye(e,n,`connection state change: ${t}`,i,r)}const e=this.getConnectionState();switch(e){case Ue.CONNECTED:{this.perfTracker.markActionStop(),this.emitter.emit(Me,e);const n=this.mediaStreamManager.getTrack(Ee.AUDIO),r=this.mediaStreamManager.getTrack(Ee.VIDEO);if(r){const t=r.getSettings();this.analyticsTracker.trackEvent(new SessionVideoPropertiesEvent(t))}if(n){const t=n.getSettings();this.analyticsTracker.trackEvent(new SessionAudioPropertiesEvent(t))}const i=(null===(t=this.peerConnection)||void 0===t?void 0:t.getSenders())||[];this.statsReporter.updateMultihostConfiguration(this.audioTrackForPub,this.videoTrackForPub),i.forEach((t=>{var e;((null===(e=t.getParameters())||void 0===e?void 0:e.codecs)||[]).forEach((e=>{var i;switch(null===(i=t.track)||void 0===i?void 0:i.kind){case"video":{if(!r)break;const t=(new SDPFmtpLine).extractVideoSdpFmtpLine(e.sdpFmtpLine),n=r.getSettings();this.analyticsTracker.trackEvent(new SessionVideoEncoderConfiguredEvent(n,t,e));break}case"audio":if(!n)break;this.analyticsTracker.trackEvent(new SessionAudioEncoderConfiguredEvent(e))}}))}));break}case Ue.FAILED:this.emitter.emit(Me,e),this.handleConnectionFailure();break;default:this.emitter.emit(Me,e)}},this.token=t,this.logger=new ScopedLogger(e,w.WEBRTC),this.action=r,this.tag=i,this.traceId=o,this.analyticsTracker=AnalyticsTracker.getInstance(),this.mediaStreamManager=n,this.emitter=new u,r===Dt.SUBSCRIBE&&!s)throw new Error("Subscribe action provided without subscriber Id");this.subscriberId=s,this.perfTracker=new PeerClientPerformanceTracker(this.action,this.traceId),this.whipUrlOverride=a,this.statsReporter=new PeerClientStatsReporter(r,t,o,this.identifier)}setV2(){this.v2=!0}start(){var t,e,n;return mn(this,void 0,void 0,(function*(){const{token:r,action:i,traceId:o,identifier:s}=this;i!==Dt.PUBLISH||r.claims.capabilities.allow_publish||this.analyticsTracker.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},ue(le.TOKEN_PERMISSIONS_DENIED,new Error("Cannot publish with subscribe only token"))),{token:r,traceId:o,tag:ce(i,s),location:"StagePeerClient.start",remoteParticipantId:s})));let a=ge({action:i,identifier:s,token:r.rawToken,whipURLOverride:this.whipUrlOverride}),c=[];try{if(this.perfTracker.markActionStart(),r.shouldUseTURN()){let u;this.perfTracker.markOptionsStart(),({iceCredentials:c,responseURL:a,stageCapabilities:u}=yield sn({action:i,identifier:s,token:r.rawToken,traceId:o,tag:this.tag,configFeatures:{simulcastEnabled:null!==(n=null===(e=null===(t=this.videoTrackForPub)||void 0===t?void 0:t.config)||void 0===e?void 0:e.simulcastEnabled)&&void 0!==n&&n}})),this.stageCapabilities=u,this.perfTracker.markOptionsStop(),this.analyticsTracker.trackEventNoSharedProps(new TraceEvent(this.token,o,`ice url list = ${c.map((t=>t.urls))}`,i,s))}this.sentOffer=!1,this.responseURL=a,this.peerConnection=new RTCPeerConnection({iceServers:c,iceTransportPolicy:r.shouldUseTURN()?"relay":"all"}),this.statsReporter.start(this.peerConnection,this.stageCapabilities.simulcastNegotiated),this.peerConnection.addEventListener("connectionstatechange",this.onConnectionStateChange),this.peerConnection.addEventListener("iceconnectionstatechange",this.onIceConnectionStateChange),this.peerConnection.addEventListener("icecandidateerror",this.onIceCandidateError),this.peerConnection.addEventListener("icegatheringstatechange",this.onIceGatheringStateChange),this.peerConnection.addEventListener("icecandidate",this.onIceCandidate),this.peerConnection.addEventListener("track",this.onTrack),this.peerConnection.addEventListener("mute",this.onMute),this.peerConnection.addEventListener("unmute",this.onUnMute),ye(r,o,"peer connection created",i,s)}catch(t){const e=new StageClientError(Object.assign(Object.assign({},ue(le.CREATE_PEER_CONNECTION_FAILURE,t)),{token:r,traceId:o,tag:ce(i,s),location:"StagePeerClient.start",remoteParticipantId:s}));i===Dt.PUBLISH&&this.emitter.emit(Me,Ue.FAILED),this.emitter.emit(Le,e),this.analyticsTracker.trackErrorAndThrow(e)}}))}stop(){var t,e,n,r,i,o,s,a,c;this.statsReporter.stop(),null===(t=this.peerConnection)||void 0===t||t.removeEventListener("connectionstatechange",this.onConnectionStateChange),null===(e=this.peerConnection)||void 0===e||e.removeEventListener("iceconnectionstatechange",this.onIceConnectionStateChange),null===(n=this.peerConnection)||void 0===n||n.removeEventListener("icecandidateerror",this.onIceCandidateError),null===(r=this.peerConnection)||void 0===r||r.removeEventListener("icegatheringstatechange",this.onIceGatheringStateChange),null===(i=this.peerConnection)||void 0===i||i.removeEventListener("track",this.onTrack),null===(o=this.peerConnection)||void 0===o||o.removeEventListener("mute",this.onMute),null===(s=this.peerConnection)||void 0===s||s.removeEventListener("unmute",this.onUnMute),null===(a=this.peerConnection)||void 0===a||a.removeEventListener("icecandidate",this.onIceCandidate),null===(c=this.peerConnection)||void 0===c||c.close()}getTransceiverForKind(t){if(!this.peerConnection)return;const e=this.peerConnection.getTransceivers();return"audio"===t?e.find((t=>"0"===t.mid)):"video"===t?e.find((t=>"1"===t.mid)):void 0}removeTrack(t){return mn(this,void 0,void 0,(function*(){const e="audio"===t||"video"===t;if(this.peerConnection&&e)try{const e=this.getTransceiverForKind(t);if(!e)return void this.logger.warn({msg:`tried removing track type ${t} but couldn't find transceiver`});yield e.sender.replaceTrack(null),t===Ee.AUDIO?this.audioTrackForPub=void 0:this.videoTrackForPub=void 0,yield this.statsReporter.updateMultihostConfiguration(this.audioTrackForPub,this.videoTrackForPub)}catch(t){this.logger.warn({msg:"error replacing track",err:t})}}))}replaceOrUpdateTrack(t){return mn(this,void 0,void 0,(function*(){if(this.peerConnection&&t.track){pn(t)?this.audioTrackForPub=t:fn(t)&&(this.videoTrackForPub=t);try{const e=this.getTransceiverForKind(t.track.kind);if(!e)return void this.logger.warn({msg:`tried replacing track type ${t.track.kind} but couldn't find transceiver`,track:t.track});if(fn(t)){const n=e.sender.getParameters(),r=this.getEncodingLayersFromConfig(this.stageCapabilities.simulcastNegotiated,t);n.encodings=n.encodings.map((t=>{var e;const n=null!==(e=t.rid)&&void 0!==e?e:"",i=r.find((t=>{var e;return(null!==(e=t.rid)&&void 0!==e?e:"")===n}));return i?Object.assign(Object.assign({},t),i):t})),yield e.sender.setParameters(n)}yield e.sender.replaceTrack(t.track),yield this.statsReporter.updateMultihostConfiguration(this.audioTrackForPub,this.videoTrackForPub)}catch(t){this.logger.warn({msg:"error replacing track",err:t})}}}))}addTransceivers(){var t,e;return mn(this,void 0,void 0,(function*(){const{traceId:n,token:r,action:i,identifier:o}=this;qe(this.peerConnection);let s,a=null;if(i===Dt.PUBLISH){if(this.audioTrackForPub||(this.audioTrackForPub={track:this.getSilentAudio()}),!this.videoTrackForPub&&!this.v2)throw new Error("We cannot configure transceivers without a video track");const e=this.peerConnection.getTransceivers(),s=[];e.forEach((t=>{var e;s.concat(null===(e=t.sender.track)||void 0===e?void 0:e.id)}));const a=new MediaStream([this.audioTrackForPub.track,null===(t=this.videoTrackForPub)||void 0===t?void 0:t.track].filter((t=>!!t&&!s.includes(t.id)))),c=a.getAudioTracks()[0]||"audio",u=a.getVideoTracks()[0]||"video",d={direction:"sendonly",streams:[a]},l={direction:"sendrecv",streams:[a],sendEncodings:this.getEncodingLayersFromConfig(this.stageCapabilities.simulcastNegotiated,this.videoTrackForPub)};this.peerConnection.addTransceiver(c,d),ye(r,n,`track added, type: ${c.kind||c}`,i,o),this.peerConnection.addTransceiver(u,l),ye(r,n,`track added, type: ${u.kind||u}`,i,o)}else if(i===Dt.SUBSCRIBE){if(r.shouldSendSilentAudio()){const t="audio"===(null===(e=this.customSilentAudioTrackForSub)||void 0===e?void 0:e.kind)?this.customSilentAudioTrackForSub:this.getSilentAudio();this.peerConnection.addTransceiver(t,{direction:"sendrecv"})}else this.peerConnection.addTransceiver("audio",{direction:"recvonly"});ye(r,n,"track added, type: audio",i,o),this.subscribeToAudioOnly||(this.videoTransceiver=this.peerConnection.addTransceiver("video",{direction:"recvonly"}),ye(r,n,"track added, type: video",i,o)),a=new MediaStream,this.peerConnection.getTransceivers().forEach((t=>{t.receiver?(this.logger.info({msg:"dbg: Subscribe succeeded, adding media track to participant mediaStream"}),null==a||a.addTrack(t.receiver.track)):this.logger.info({msg:"dbg: Subscribe succeeded, but Transceiver were negotiated without Receiver"})}))}try{ye(this.token,n,"Creating offer",this.action,o),s=yield this.peerConnection.createOffer(),ye(this.token,n,"Setting local description",this.action,o)}catch(t){const e=new StageClientError(Object.assign(Object.assign({},ue(le.CREATE_OFFER_FAILURE,t)),{token:this.token,traceId:n,tag:this.tag,location:"addTransceivers",remoteParticipantId:o}));this.emitter.emit(Le,e),this.analyticsTracker.trackErrorAndThrow(e)}return this.stageCapabilities.simulcastNegotiated&&(s.sdp=new SdpMunger(s.sdp).withVideoLayersAllocationRtpHeaderExtension().sdp),yield this.peerConnection.setLocalDescription(s),ye(this.token,n,"local description set",this.action,o),a}))}getEncodingLayersFromConfig(t,e){var n,r;const i=null==e?void 0:e.track,o=null==e?void 0:e.config;if(t&&i){const t=(0,Pe.cloneDeep)([{encodingParams:ee,targetResolution:ne},{encodingParams:re,targetResolution:ie},{encodingParams:oe,targetResolution:se}]),{height:e,width:s}=i.getSettings(),a=e&&s?{width:s,height:e}:void 0;for(const e of t){e.encodingParams.active=!0;let t=1;a&&(t=Math.floor(Math.sqrt(a.width*a.height/(e.targetResolution.width*e.targetResolution.height))),t=Math.max(t,1)),e.encodingParams.scaleResolutionDownBy=t}let c=null!==(n=null==o?void 0:o.maxBitrateBps)&&void 0!==n?n:oe.maxBitrate;const u=null!==(r=null==o?void 0:o.maxFramerate)&&void 0!==r?r:oe.maxFramerate;return c<re.maxBitrate&&(c=oe.maxBitrate),t[2].encodingParams.maxBitrate=c,t[2].encodingParams.maxFramerate=u,t[2].encodingParams.scaleResolutionDownBy=1,t.map((t=>t.encodingParams))}return o?[{maxBitrate:o.maxBitrateBps,maxFramerate:o.maxFramerate}]:[{maxBitrate:qt(Kt),maxFramerate:Xt}]}getReports(){var t;return mn(this,void 0,void 0,(function*(){try{const e=(yield null===(t=this.peerConnection)||void 0===t?void 0:t.getStats())||[],n=[];return e.forEach((t=>{n.push(t)})),n}catch(t){return[]}}))}requestRTCStats(t){return mn(this,void 0,void 0,(function*(){if(this.peerConnection)return this.peerConnection.getStats(t)}))}get identifier(){return this.subscriberId||this.token.participantID}handleConnectionFailure(){return mn(this,void 0,void 0,(function*(){const{token:t,traceId:e,tag:n}=this;this.analyticsTracker.trackError(new StageClientError(Object.assign(Object.assign({},le.PEER_CONNECTION_NETWORK_FAILURE),{token:t,traceId:e,tag:n,location:"onIceCandidateError",remoteParticipantId:this.identifier})))}))}on(t,e,n){this.emitter.on(t,e,n)}off(t,e,n){this.emitter.off(t,e,n)}getSilentAudio(){_n||(_n=new AudioContext);const t=_n.createOscillator(),e=_n.createGain();t.connect(e);const n=_n.createMediaStreamDestination();return e.connect(n),e.gain.value=0,t.start(),n.stream.getAudioTracks()[0]}getActionMeasurements(){return this.perfTracker.getMeasurements()}getAudioSender(){var t;return null===(t=this.peerConnection)||void 0===t?void 0:t.getSenders().find((t=>{var e;return"audio"===(null===(e=t.track)||void 0===e?void 0:e.kind)}))}getVideoSender(){var t;return null===(t=this.peerConnection)||void 0===t?void 0:t.getSenders().find((t=>{var e;return"video"===(null===(e=t.track)||void 0===e?void 0:e.kind)}))}parseWhipLinkExtension(t){return/<([0-9a-zA-Z/_-]+)>; rel="([a-z:-]+)"/.exec(t)}initTracksToPublish(t){this.videoTrackForPub=t.find(fn),this.audioTrackForPub=t.find(pn)}setCustomSilentAudioTrackForSub(t){this.customSilentAudioTrackForSub=t}}var Sn,En,yn,bn,Cn=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},Tn=function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)};!function(t){t.INIT="init",t.CONNECTING="connecting",t.CONNECTED="connected",t.UNSTABLE="unstable",t.PAUSED="paused",t.FAILED="failed",t.STOPPED="stopped"}(yn||(yn={})),function(t){t.NONE="none",t.AUDIO_ONLY="audio_only",t.AUDIO_VIDEO="audio_video"}(bn||(bn={}));class StageSubscription{constructor(t,e,n,r,i,o,s){this.id=t,this.token=e,this.stageConnection=n,this.nonScopedLogger=r,this.mediaStreamManager=i,this.traceId=o,this.customSilentAudioTrack=s,Sn.add(this),this.emitter=new u.EventEmitter,this.isSubscriptionActive=!1,this.subscriptionState={connectionState:yn.INIT,subscribeInProgress:!1},this.previousSignalState={isTargetPublishing:!1},this.failedRetries=0,this.throttler=new ThrottleTimer(1e3),this.isStarted=!1,this.updateSubscribeType=t=>{t===bn.AUDIO_ONLY?this.peerClient.stopRemoteVideo():t===bn.AUDIO_VIDEO&&this.peerClient.startRemoteVideo()},this.onParticipantUpdated=t=>{Tn(this,Sn,"m",En).call(this,t)&&(this.logger.debug({msg:"onParticipantUpdated",participant:t}),this.onSignalStateChange({isTargetPublishing:t.isPublishing}))},this.onParticipantJoined=t=>{Tn(this,Sn,"m",En).call(this,t)&&(this.logger.debug({msg:"onParticipantJoined",participant:t}),this.onSignalStateChange({isTargetPublishing:t.isPublishing}))},this.onParticipantLeft=t=>{Tn(this,Sn,"m",En).call(this,t)&&(this.logger.debug({msg:"onParticipantLeft",participant:t}),this.onSignalStateChange({isTargetPublishing:!1}))},this.requestRTCStats=t=>Cn(this,void 0,void 0,(function*(){return this.peerClient.requestRTCStats(t)})),this.attemptSubscribe=t=>Cn(this,void 0,void 0,(function*(){if(this.logger.debug({msg:`Subscribe attempt started: ${t}`}),!this.isSubscriptionActive)return this.logger.warn({msg:"Subscribe attempt invalid: Subscription is inactive"}),!1;this.logger.debug({msg:"Subscribe attempt is valid."}),this.subscriptionState.connectionState!==yn.FAILED&&(this.logger.debug({msg:"Updating state to CONNECTING"}),this.changeState({connectionState:yn.CONNECTING}));try{const{mediaStream:t}=yield this.subscribe();return this.throttler.clear(),this.failedRetries=0,this.emitter.emit(Ce.STAGE_STREAM_UPDATE,t),this.logger.debug({msg:"Subscribe attempt succeeded"}),!0}catch(e){this.logger.error({log:"Subscribe attempt failed",err:e}),this.onAttemptSubscribeFailure(t)}return!1})),this.id=t,this.token=e,this.stageConnection=n,this.peerClient=new StagePeerClient(e,this.nonScopedLogger,this.mediaStreamManager,Dt.SUBSCRIBE,ce(Dt.SUBSCRIBE,t),this.traceId,t),this.logger=new ScopedLogger(r,w.SUBSCRIPTION),this.analyticsTracker=AnalyticsTracker.getInstance(),this.traceId=o}onPeerClientConnectionStateChange(t){const e=this.stageConnection.getParticipant(this.id);this.logger.debug({msg:`onPeerClientConnectionStateChange: ${t}`,state:t,targetParticipant:e}),this.onSignalStateChange({peerClientState:t})}onSignalStateChange(t){const e=this.previousSignalState,n=Object.assign({},e,t);this.isSubscriptionActive?(n.isTargetPublishing?t.peerClientState===Ue.DISCONNECTED?this.changeState({connectionState:yn.UNSTABLE}):t.peerClientState===Ue.CONNECTED?this.changeState({connectionState:yn.CONNECTED,subscribeInProgress:!0}):t.peerClientState===Ue.FAILED&&this.subscriptionState.subscribeInProgress&&(this.trackSubscribeEnded(!1,he.CONNECTION_FAIL),this.changeState({subscribeInProgress:!1})):(e.isTargetPublishing&&this.subscriptionState.subscribeInProgress&&(this.logger.debug({msg:"Scheduling an unsubscribe on the event loop"}),this.unsubscribe()),this.throttler.clear(),this.changeState({connectionState:yn.PAUSED})),(!e.isTargetPublishing&&t.isTargetPublishing||t.peerClientState===Ue.FAILED)&&this.throttledAttemptSubscribe("onSignalState change: isTargetPublishing is now true"),Object.assign(this.previousSignalState,t)):this.logger.warn({msg:"Unexpected onSignalStateChange when subscription is inactive"})}onAttemptSubscribeFailure(t){if(this.logger.debug({msg:"Changing/keeping state FAILED"}),this.changeState({connectionState:yn.FAILED}),this.failedRetries<=4){const e=1e3*Math.pow(2,this.failedRetries);this.logger.debug({msg:`Retrying in ${e}ms`}),this.failedRetries++,setTimeout((()=>Cn(this,void 0,void 0,(function*(){this.throttledAttemptSubscribe(t)}))),e)}else this.previousSignalState.isTargetPublishing=!1}start(){this.isSubscriptionActive=!0,this.isStarted=!0,this.peerClient.on(Me,this.onPeerClientConnectionStateChange,this),this.stageConnection.on(be.STAGE_PARTICIPANT_UPDATED,this.onParticipantUpdated),this.stageConnection.on(be.STAGE_PARTICIPANT_JOINED,this.onParticipantJoined),this.stageConnection.on(be.STAGE_PARTICIPANT_LEFT,this.onParticipantLeft),this.stageConnection.on(be.STAGE_PARTICIPANT_KICKED,this.onParticipantLeft);const t=this.stageConnection.getParticipant(this.id);this.onSignalStateChange({isTargetPublishing:null==t?void 0:t.isPublishing})}throttledAttemptSubscribe(t){return this.throttler.invoke(this.attemptSubscribe,t)}changeState(t){void 0!==t.subscribeInProgress&&(this.subscriptionState.subscribeInProgress=t.subscribeInProgress),t.connectionState&&this.subscriptionState.connectionState!==t.connectionState&&(this.subscriptionState.connectionState=t.connectionState,this.emitter.emit(Ce.CONNECTION_STATE_CHANGE,this.subscriptionState.connectionState))}on(t,e){this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}stop(){this.cleanUp(),this.changeState({connectionState:yn.STOPPED})}cleanUp(){this.peerClient&&(this.peerClient.off(Me,this.onPeerClientConnectionStateChange,this),this.unsubscribe()),this.throttler.clear(),this.stageConnection.off(be.STAGE_PARTICIPANT_UPDATED,this.onParticipantUpdated),this.stageConnection.off(be.STAGE_PARTICIPANT_JOINED,this.onParticipantJoined),this.stageConnection.off(be.STAGE_PARTICIPANT_LEFT,this.onParticipantLeft),this.stageConnection.off(be.STAGE_PARTICIPANT_KICKED,this.onParticipantLeft),this.isSubscriptionActive=!1,AbortControllersTracker.getInstance().abortPendingOperations()}isActive(){return this.isSubscriptionActive}getSubscriptionConnectionState(){return this.subscriptionState.connectionState}subscribe(t){return Cn(this,void 0,void 0,(function*(){const{token:e,id:n,customSilentAudioTrack:r}=this;this.traceId=f();try{e.assertTokenIsUnexpired(this.traceId,ce(Dt.SUBSCRIBE,n),"subscribe",n),this.trackSubscribeRequested(),r&&e.shouldSendSilentAudio()&&this.peerClient.setCustomSilentAudioTrackForSub(r);const{mediaStream:i}=yield this.peerClient.connect(t,this.traceId);return this.trackSubscribeStarted(),this.isStarted||(this.subscriptionState={connectionState:yn.CONNECTED,subscribeInProgress:!0}),{peerClient:this.peerClient,mediaStream:i}}catch(t){const r=new StageClientError(Object.assign(Object.assign({},le.SUBSCRIBE_FAILURE),{token:e,traceId:this.traceId,tag:ce(Dt.SUBSCRIBE,n),location:"subscribe",remoteParticipantId:n}));throw this.analyticsTracker.trackEventNoSharedProps(new StageErrorEvent(r)),t instanceof StageClientError&&(t.location=`subscribe > ${t.location}`),t}}))}unsubscribe(){return Cn(this,void 0,void 0,(function*(){if(this.subscriptionState.connectionState===yn.STOPPED||this.subscriptionState.connectionState===yn.INIT)return;const{id:t,token:e}=this;this.analyticsTracker.trackEventNoSharedProps(new UnsubscribeEvent({token:e,unsubscribedId:t,traceId:this.traceId})),e.assertTokenIsUnexpired(this.traceId,ce(Dt.SUBSCRIBE,t),"unsubscribe",t);const n=AbortControllersTracker.getInstance().isUnloading,r=n?he.UNLOAD:he.UNSUBSCRIBE;try{if(!this.peerClient)throw new Error("Invalid unpublish - no peerClient");n?this.peerClient.disconnect():yield this.peerClient.disconnect(),this.trackSubscribeEnded(!0,r),this.isStarted||(this.subscriptionState={connectionState:yn.STOPPED,subscribeInProgress:!0}),this.changeState({subscribeInProgress:!1})}catch(t){this.trackAndThrowUnsubscribeError(r)}}))}trackAndThrowUnsubscribeError(t){const e=new StageClientError(Object.assign(Object.assign({},le.UNSUBSCRIBE_FAILURE),{token:this.token,traceId:this.traceId,tag:ce(Dt.SUBSCRIBE,this.id),location:"unsubscribe",remoteParticipantId:this.id}));throw this.analyticsTracker.trackError(e),this.trackSubscribeEnded(!1,t),e}trackSubscribeRequested(){this.analyticsTracker.trackEventNoSharedProps(new SubscribeEvent({token:this.token,subscribedId:this.id,traceId:this.traceId}))}trackSubscribeStarted(){const{optionsDuration:t,postDuration:e,timeToCandidate:n,timeToConnected:r}=this.peerClient.getActionMeasurements();this.analyticsTracker.trackEventNoSharedProps(new SubscribeStartedEvent({token:this.token,traceId:this.traceId,remoteParticipantId:this.id,optionsDuration:t,postDuration:e,timeToCandidate:n,totalDuration:r}))}trackSubscribeEnded(t,e){this.analyticsTracker.trackEventNoSharedProps(new SubscribeEndedEvent({token:this.token,traceId:this.traceId,remoteParticipantId:this.id,isUnsubscribeSuccessful:t,reason:e}))}}Sn=new WeakSet,En=function(t){return t.id===this.id};var wn,In,kn,Rn,On=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},Pn=function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)},An=function(t,e,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(t,n):i?i.value=n:e.set(t,n),n};class AmazonIVSBroadcastStageClient{constructor(t,e,n){this.emitter=t,this.config=e,this.nonScopedLogger=n,wn.add(this),this.stageToken=null,this.appTraceId=new TraceId,In.set(this,!1),this.useEdp=!0,this.isValid=!0,this.subscriptions=new Map,this.analyticsTracker=AnalyticsTracker.getInstance(),this.mediaStreamManager=MediaStreamManager.getOrRegisterInstance(this),this.stageConnection=new StageConnection(this.nonScopedLogger),this.propagateStageConnectionEvents(this.stageConnection,t),this.analyticsTracker.start();Object.getOwnPropertyNames(AmazonIVSBroadcastStageClient.prototype).forEach((t=>{"stageToken"!==t&&(this[t]=new Proxy(this[t],{apply:(t,e,n)=>{if(!e.isValid)throw new BroadcastClientError(Object.assign({},Q));return Reflect.apply(t,e,n)}}))})),window.addEventListener("beforeunload",(()=>{var t;const e=AbortControllersTracker.getInstance();e.isUnloading=!0,this.unpublish(null===(t=this.stageToken)||void 0===t?void 0:t.rawToken),this.subscriptions.forEach((t=>{t.stop()})),e.abortPendingOperations(),this.analyticsTracker.stop(!0),this.stageConnection.disconnect()})),me().interceptors.response.use(void 0,(t=>On(this,void 0,void 0,(function*(){var e;return 429===(null===(e=null==t?void 0:t.response)||void 0===e?void 0:e.status)&&(yield new Promise((t=>{setTimeout(t,1e3)}))),Promise.reject(t)}))))}propagateStageConnectionEvents(t,e){t.on(be.STAGE_JOINED,(()=>{e.emit(be.STAGE_JOINED)})),t.on(be.STAGE_PARTICIPANT_JOINED,(t=>{e.emit(be.STAGE_PARTICIPANT_JOINED,t)})),t.on(be.STAGE_PARTICIPANT_KICKED,(t=>{e.emit(be.STAGE_PARTICIPANT_KICKED,t)})),t.on(be.STAGE_PARTICIPANT_LEFT,(t=>{e.emit(be.STAGE_PARTICIPANT_LEFT,t)})),t.on(be.STAGE_PARTICIPANT_UPDATED,(t=>{e.emit(be.STAGE_PARTICIPANT_UPDATED,t)})),t.on(be.STAGE_REFRESH,(()=>{e.emit(be.STAGE_REFRESH)}))}delete(){this.isValid=!1}join(t){return On(this,void 0,void 0,(function*(){const e=f();Pn(this,wn,"m",Rn).call(this,t),this.stageToken=fe(t),this.stageToken.assertTokenIsUnexpired(e,ae.JOIN_RELATED,"join"),this.analyticsTracker.trackEventNoSharedProps(new JoinEvent({token:this.stageToken,eventEndpoint:this.stageToken.eventsURL,whipEndpoint:this.stageToken.whipURL,traceId:e}));try{yield this.stageConnection.connect(this.stageToken,e),An(this,In,!0,"f")}catch(t){const n=new StageClientError(Object.assign(Object.assign({},le.EVENT_PLANE_CONNECTION_FAILURE),{token:this.stageToken,traceId:e,tag:ae.JOIN_RELATED,location:"join"}));throw this.analyticsTracker.trackEventNoSharedProps(new StageErrorEvent(n)),n}}))}leave(){if(Pn(this,In,"f")){const t=this.stageConnection.disconnect(),e=this.stageToken;this.analyticsTracker.trackEventNoSharedProps(new LeaveEvent({token:e,eventEndpoint:e.eventsURL,whipEndpoint:e.whipURL,traceId:t}))}}publish(t){return On(this,void 0,void 0,(function*(){const e=f();let n=this.stageToken;if(t&&(n=fe(t)),Pn(this,In,"f")||this.stageToken||(this.stageToken=n),!n)throw new Error("A token must be provided either via a preceding join call or as an argument to publish");n.assertTokenIsUnexpired(e,ae.PUBLISH_RELATED,"publish",n.participantID),this.publication=new StagePublication(n,this.nonScopedLogger,this.mediaStreamManager,f());const r=[],i=this.mediaStreamManager.getTrack(Ee.VIDEO),o=this.mediaStreamManager.getTrack(Ee.AUDIO);i&&r.push({track:i}),o&&r.push({track:o});return{peerConnection:(yield this.publication.publish(r)).getValidPeerConnectionCanThrow()}}))}unpublish(t){return On(this,void 0,void 0,(function*(){let e=this.stageToken;if(t&&(e=fe(t)),!e||!this.publication)throw new Error("A token must be provided either via a preceding join call or as an argument to unpublish");yield this.publication.unpublish()}))}createSubscription(t,e,n){const r=fe(e);if(!this.stageConnection)throw new Error("Must invoke join() before creating a subscription");const i=new StageSubscription(t,r,this.stageConnection,this.nonScopedLogger,this.mediaStreamManager,f(),n);return this.subscriptions.set(t,i),i}createOrGetPublication(t){const e=fe(t);if(!this.stageConnection)throw new Error("Must invoke join() before creating a publication");return this.publication||(this.publication=new StagePublication(e,this.nonScopedLogger,this.mediaStreamManager,f())),this.publication}subscribe(t,e,n,r){var i;return On(this,void 0,void 0,(function*(){let o=this.stageToken;e&&(o=fe(e));const s=f();if(!o)throw new Error("A token must be provided either via a preceding join call or as an argument to subscribe");const a=null===(i=this.stageConnection)||void 0===i?void 0:i.getParticipant(t);if(Pn(this,In,"f")&&!a)throw new Error("error TBD: participant not found");const c=new StageSubscription(t,o,this.stageConnection,this.nonScopedLogger,this.mediaStreamManager,s,n);return c.subscribe(r).then((e=>(a&&(a.subscribed=!0,a.joinedAt=Date.now(),a.peerClient=e.peerClient,e.mediaStream&&(a.mediaSrcObject=e.mediaStream)),this.subscriptions.set(t,c),{peerConnection:e.peerClient.getValidPeerConnectionCanThrow()})))}))}unsubscribe(t,e){return On(this,void 0,void 0,(function*(){let n=this.stageToken;if(e&&(n=fe(e)),!n)throw new Error("A token must be provided either via a preceding join call or as an argument to unsubscribe");const r=this.subscriptions.get(t);return r||this.analyticsTracker.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},le.UNSUBSCRIBE_FAILURE),{token:n,traceId:f(),tag:ce(Dt.SUBSCRIBE,t),location:"unsubscribe",remoteParticipantId:t}))),r.unsubscribe().then((()=>{var e;const n=null===(e=this.stageConnection)||void 0===e?void 0:e.getParticipant(t);n&&(n.subscribed=!1)}))}))}listConnectedParticipants(){var t;return(null===(t=this.stageConnection)||void 0===t?void 0:t.listConnectedParticipants())||[]}listAvailableParticipants(){var t;return(null===(t=this.stageConnection)||void 0===t?void 0:t.listAvailableParticipants())||[]}_trace(t){ye(fe(t.token),this.appTraceId,`app: ${t.message}`,Dt.APP_TRACE,t.remoteParticipantID)}addVideoInputDevice(t,e,n){var r;return On(this,void 0,void 0,(function*(){const e=t.getVideoTracks()[0];this.mediaStreamManager.setTrack(Ee.VIDEO,e),yield null===(r=this.publication)||void 0===r?void 0:r.replaceOrUpdateTrack({track:e,config:{minBitrateBps:qt(Jt),maxBitrateBps:qt(Kt),maxFramerate:Xt,simulcastEnabled:!1}})}))}addAudioInputDevice(t,e){var n;return On(this,void 0,void 0,(function*(){const e=t.getAudioTracks()[0];this.mediaStreamManager.setTrack(Ee.AUDIO,e),yield null===(n=this.publication)||void 0===n?void 0:n.replaceOrUpdateTrack({track:e})}))}getConnectionState(){return this.outboundPeerClient.getConnectionState()}on(t,e){this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}disableVideo(){Pn(this,wn,"m",kn).call(this,void 0,!1)}enableVideo(){Pn(this,wn,"m",kn).call(this,void 0,!0)}disableAudio(){Pn(this,wn,"m",kn).call(this,!1,void 0)}enableAudio(){Pn(this,wn,"m",kn).call(this,!0,void 0)}}In=new WeakMap,wn=new WeakSet,kn=function(t,e){var n,r;if(this.stageConnection&&this.publication){const i=this.publication.getAudioSender(),o=this.publication.getVideoSender();(null==i?void 0:i.track)&&void 0!==t&&(i.track.enabled=t),(null==o?void 0:o.track)&&void 0!==e&&(o.track.enabled=e),this.stageConnection.emitStageState(!1===(null===(n=null==i?void 0:i.track)||void 0===n?void 0:n.enabled)||!1,!1===(null===(r=null==o?void 0:o.track)||void 0===r?void 0:r.enabled)||!1)}},Rn=function(t){if("string"!=typeof t)throw new BroadcastClientError(nt)};let Nn=!0,Dn=!0;function xn(t,e,n){const r=t.match(e);return r&&r.length>=n&&parseInt(r[n],10)}function Mn(t,e,n){if(!t.RTCPeerConnection)return;const r=t.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(t,r){if(t!==e)return i.apply(this,arguments);const o=t=>{const e=n(t);e&&(r.handleEvent?r.handleEvent(e):r(e))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(r,o),i.apply(this,[t,o])};const o=r.removeEventListener;r.removeEventListener=function(t,n){if(t!==e||!this._eventMap||!this._eventMap[e])return o.apply(this,arguments);if(!this._eventMap[e].has(n))return o.apply(this,arguments);const r=this._eventMap[e].get(n);return this._eventMap[e].delete(n),0===this._eventMap[e].size&&delete this._eventMap[e],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[t,r])},Object.defineProperty(r,"on"+e,{get(){return this["_on"+e]},set(t){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),t&&this.addEventListener(e,this["_on"+e]=t)},enumerable:!0,configurable:!0})}function Ln(t){return"boolean"!=typeof t?new Error("Argument type: "+typeof t+". Please use a boolean."):(Nn=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function Un(t){return"boolean"!=typeof t?new Error("Argument type: "+typeof t+". Please use a boolean."):(Dn=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function Bn(){if("object"==typeof window){if(Nn)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function jn(t,e){Dn&&console.warn(t+" is deprecated, please use "+e+" instead.")}function Fn(t){return"[object Object]"===Object.prototype.toString.call(t)}function Vn(t){return Fn(t)?Object.keys(t).reduce((function(e,n){const r=Fn(t[n]),i=r?Vn(t[n]):t[n],o=r&&!Object.keys(i).length;return void 0===i||o?e:Object.assign(e,{[n]:i})}),{}):t}function Gn(t,e,n){e&&!n.has(e.id)&&(n.set(e.id,e),Object.keys(e).forEach((r=>{r.endsWith("Id")?Gn(t,t.get(e[r]),n):r.endsWith("Ids")&&e[r].forEach((e=>{Gn(t,t.get(e),n)}))})))}function Wn(t,e,n){const r=n?"outbound-rtp":"inbound-rtp",i=new Map;if(null===e)return i;const o=[];return t.forEach((t=>{"track"===t.type&&t.trackIdentifier===e.id&&o.push(t)})),o.forEach((e=>{t.forEach((n=>{n.type===r&&n.trackId===e.id&&Gn(t,n,i)}))})),i}const $n=Bn;function zn(t,e){const n=t&&t.navigator;if(!n.mediaDevices)return;const r=function(t){if("object"!=typeof t||t.mandatory||t.optional)return t;const e={};return Object.keys(t).forEach((n=>{if("require"===n||"advanced"===n||"mediaSource"===n)return;const r="object"==typeof t[n]?t[n]:{ideal:t[n]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);const i=function(t,e){return t?t+e.charAt(0).toUpperCase()+e.slice(1):"deviceId"===e?"sourceId":e};if(void 0!==r.ideal){e.optional=e.optional||[];let t={};"number"==typeof r.ideal?(t[i("min",n)]=r.ideal,e.optional.push(t),t={},t[i("max",n)]=r.ideal,e.optional.push(t)):(t[i("",n)]=r.ideal,e.optional.push(t))}void 0!==r.exact&&"number"!=typeof r.exact?(e.mandatory=e.mandatory||{},e.mandatory[i("",n)]=r.exact):["min","max"].forEach((t=>{void 0!==r[t]&&(e.mandatory=e.mandatory||{},e.mandatory[i(t,n)]=r[t])}))})),t.advanced&&(e.optional=(e.optional||[]).concat(t.advanced)),e},i=function(t,i){if(e.version>=61)return i(t);if((t=JSON.parse(JSON.stringify(t)))&&"object"==typeof t.audio){const e=function(t,e,n){e in t&&!(n in t)&&(t[n]=t[e],delete t[e])};e((t=JSON.parse(JSON.stringify(t))).audio,"autoGainControl","googAutoGainControl"),e(t.audio,"noiseSuppression","googNoiseSuppression"),t.audio=r(t.audio)}if(t&&"object"==typeof t.video){let o=t.video.facingMode;o=o&&("object"==typeof o?o:{ideal:o});const s=e.version<66;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&(!n.mediaDevices.getSupportedConstraints||!n.mediaDevices.getSupportedConstraints().facingMode||s)){let e;if(delete t.video.facingMode,"environment"===o.exact||"environment"===o.ideal?e=["back","rear"]:"user"!==o.exact&&"user"!==o.ideal||(e=["front"]),e)return n.mediaDevices.enumerateDevices().then((n=>{let s=(n=n.filter((t=>"videoinput"===t.kind))).find((t=>e.some((e=>t.label.toLowerCase().includes(e)))));return!s&&n.length&&e.includes("back")&&(s=n[n.length-1]),s&&(t.video.deviceId=o.exact?{exact:s.deviceId}:{ideal:s.deviceId}),t.video=r(t.video),$n("chrome: "+JSON.stringify(t)),i(t)}))}t.video=r(t.video)}return $n("chrome: "+JSON.stringify(t)),i(t)},o=function(t){return e.version>=64?t:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[t.name]||t.name,message:t.message,constraint:t.constraint||t.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(n.getUserMedia=function(t,e,r){i(t,(t=>{n.webkitGetUserMedia(t,e,(t=>{r&&r(o(t))}))}))}.bind(n),n.mediaDevices.getUserMedia){const t=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(e){return i(e,(e=>t(e).then((t=>{if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length)throw t.getTracks().forEach((t=>{t.stop()})),new DOMException("","NotFoundError");return t}),(t=>Promise.reject(o(t))))))}}}function Hn(t,e){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&("function"==typeof e?t.navigator.mediaDevices.getDisplayMedia=function(n){return e(n).then((e=>{const r=n.video&&n.video.width,i=n.video&&n.video.height,o=n.video&&n.video.frameRate;return n.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:e,maxFrameRate:o||3}},r&&(n.video.mandatory.maxWidth=r),i&&(n.video.mandatory.maxHeight=i),t.navigator.mediaDevices.getUserMedia(n)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}function qn(t){t.MediaStream=t.MediaStream||t.webkitMediaStream}function Jn(t){if("object"==typeof t&&t.RTCPeerConnection&&!("ontrack"in t.RTCPeerConnection.prototype)){Object.defineProperty(t.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(t){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=t)},enumerable:!0,configurable:!0});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=e=>{e.stream.addEventListener("addtrack",(n=>{let r;r=t.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((t=>t.track&&t.track.id===n.track.id)):{track:n.track};const i=new Event("track");i.track=n.track,i.receiver=r,i.transceiver={receiver:r},i.streams=[e.stream],this.dispatchEvent(i)})),e.stream.getTracks().forEach((n=>{let r;r=t.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((t=>t.track&&t.track.id===n.id)):{track:n};const i=new Event("track");i.track=n,i.receiver=r,i.transceiver={receiver:r},i.streams=[e.stream],this.dispatchEvent(i)}))},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else Mn(t,"track",(t=>(t.transceiver||Object.defineProperty(t,"transceiver",{value:{receiver:t.receiver}}),t)))}function Kn(t){if("object"==typeof t&&t.RTCPeerConnection&&!("getSenders"in t.RTCPeerConnection.prototype)&&"createDTMFSender"in t.RTCPeerConnection.prototype){const e=function(t,e){return{track:e,get dtmf(){return void 0===this._dtmf&&("audio"===e.kind?this._dtmf=t.createDTMFSender(e):this._dtmf=null),this._dtmf},_pc:t}};if(!t.RTCPeerConnection.prototype.getSenders){t.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const n=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(t,r){let i=n.apply(this,arguments);return i||(i=e(this,t),this._senders.push(i)),i};const r=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(t){r.apply(this,arguments);const e=this._senders.indexOf(t);-1!==e&&this._senders.splice(e,1)}}const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(t){this._senders=this._senders||[],n.apply(this,[t]),t.getTracks().forEach((t=>{this._senders.push(e(this,t))}))};const r=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(t){this._senders=this._senders||[],r.apply(this,[t]),t.getTracks().forEach((t=>{const e=this._senders.find((e=>e.track===t));e&&this._senders.splice(this._senders.indexOf(e),1)}))}}else if("object"==typeof t&&t.RTCPeerConnection&&"getSenders"in t.RTCPeerConnection.prototype&&"createDTMFSender"in t.RTCPeerConnection.prototype&&t.RTCRtpSender&&!("dtmf"in t.RTCRtpSender.prototype)){const e=t.RTCPeerConnection.prototype.getSenders;t.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach((t=>t._pc=this)),t},Object.defineProperty(t.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function Xn(t){if(!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){const[t,n,r]=arguments;if(arguments.length>0&&"function"==typeof t)return e.apply(this,arguments);if(0===e.length&&(0===arguments.length||"function"!=typeof t))return e.apply(this,[]);const i=function(t){const e={};return t.result().forEach((t=>{const n={id:t.id,timestamp:t.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[t.type]||t.type};t.names().forEach((e=>{n[e]=t.stat(e)})),e[n.id]=n})),e},o=function(t){return new Map(Object.keys(t).map((e=>[e,t[e]])))};if(arguments.length>=2){const r=function(t){n(o(i(t)))};return e.apply(this,[r,t])}return new Promise(((t,n)=>{e.apply(this,[function(e){t(o(i(e)))},n])})).then(n,r)}}function Yn(t){if(!("object"==typeof t&&t.RTCPeerConnection&&t.RTCRtpSender&&t.RTCRtpReceiver))return;if(!("getStats"in t.RTCRtpSender.prototype)){const e=t.RTCPeerConnection.prototype.getSenders;e&&(t.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach((t=>t._pc=this)),t});const n=t.RTCPeerConnection.prototype.addTrack;n&&(t.RTCPeerConnection.prototype.addTrack=function(){const t=n.apply(this,arguments);return t._pc=this,t}),t.RTCRtpSender.prototype.getStats=function(){const t=this;return this._pc.getStats().then((e=>Wn(e,t.track,!0)))}}if(!("getStats"in t.RTCRtpReceiver.prototype)){const e=t.RTCPeerConnection.prototype.getReceivers;e&&(t.RTCPeerConnection.prototype.getReceivers=function(){const t=e.apply(this,[]);return t.forEach((t=>t._pc=this)),t}),Mn(t,"track",(t=>(t.receiver._pc=t.srcElement,t))),t.RTCRtpReceiver.prototype.getStats=function(){const t=this;return this._pc.getStats().then((e=>Wn(e,t.track,!1)))}}if(!("getStats"in t.RTCRtpSender.prototype)||!("getStats"in t.RTCRtpReceiver.prototype))return;const e=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof t.MediaStreamTrack){const t=arguments[0];let e,n,r;return this.getSenders().forEach((n=>{n.track===t&&(e?r=!0:e=n)})),this.getReceivers().forEach((e=>(e.track===t&&(n?r=!0:n=e),e.track===t))),r||e&&n?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):e?e.getStats():n?n.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}function Qn(t){t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((t=>this._shimmedLocalStreams[t][0]))};const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(t,n){if(!n)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const r=e.apply(this,arguments);return this._shimmedLocalStreams[n.id]?-1===this._shimmedLocalStreams[n.id].indexOf(r)&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(t){this._shimmedLocalStreams=this._shimmedLocalStreams||{},t.getTracks().forEach((t=>{if(this.getSenders().find((e=>e.track===t)))throw new DOMException("Track already exists.","InvalidAccessError")}));const e=this.getSenders();n.apply(this,arguments);const r=this.getSenders().filter((t=>-1===e.indexOf(t)));this._shimmedLocalStreams[t.id]=[t].concat(r)};const r=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(t){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[t.id],r.apply(this,arguments)};const i=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(t){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},t&&Object.keys(this._shimmedLocalStreams).forEach((e=>{const n=this._shimmedLocalStreams[e].indexOf(t);-1!==n&&this._shimmedLocalStreams[e].splice(n,1),1===this._shimmedLocalStreams[e].length&&delete this._shimmedLocalStreams[e]})),i.apply(this,arguments)}}function Zn(t,e){if(!t.RTCPeerConnection)return;if(t.RTCPeerConnection.prototype.addTrack&&e.version>=65)return Qn(t);const n=t.RTCPeerConnection.prototype.getLocalStreams;t.RTCPeerConnection.prototype.getLocalStreams=function(){const t=n.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map((t=>this._reverseStreams[t.id]))};const r=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(e){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},e.getTracks().forEach((t=>{if(this.getSenders().find((e=>e.track===t)))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[e.id]){const n=new t.MediaStream(e.getTracks());this._streams[e.id]=n,this._reverseStreams[n.id]=e,e=n}r.apply(this,[e])};const i=t.RTCPeerConnection.prototype.removeStream;function o(t,e){let n=e.sdp;return Object.keys(t._reverseStreams||[]).forEach((e=>{const r=t._reverseStreams[e],i=t._streams[r.id];n=n.replace(new RegExp(i.id,"g"),r.id)})),new RTCSessionDescription({type:e.type,sdp:n})}t.RTCPeerConnection.prototype.removeStream=function(t){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[t.id]||t]),delete this._reverseStreams[this._streams[t.id]?this._streams[t.id].id:t.id],delete this._streams[t.id]},t.RTCPeerConnection.prototype.addTrack=function(e,n){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const r=[].slice.call(arguments,1);if(1!==r.length||!r[0].getTracks().find((t=>t===e)))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const i=this._streams[n.id];if(i)i.addTrack(e),Promise.resolve().then((()=>{this.dispatchEvent(new Event("negotiationneeded"))}));else{const r=new t.MediaStream([e]);this._streams[n.id]=r,this._reverseStreams[r.id]=n,this.addStream(r)}return this.getSenders().find((t=>t.track===e))},["createOffer","createAnswer"].forEach((function(e){const n=t.RTCPeerConnection.prototype[e],r={[e](){const t=arguments;return arguments.length&&"function"==typeof arguments[0]?n.apply(this,[e=>{const n=o(this,e);t[0].apply(null,[n])},e=>{t[1]&&t[1].apply(null,e)},arguments[2]]):n.apply(this,arguments).then((t=>o(this,t)))}};t.RTCPeerConnection.prototype[e]=r[e]}));const s=t.RTCPeerConnection.prototype.setLocalDescription;t.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(t,e){let n=e.sdp;return Object.keys(t._reverseStreams||[]).forEach((e=>{const r=t._reverseStreams[e],i=t._streams[r.id];n=n.replace(new RegExp(r.id,"g"),i.id)})),new RTCSessionDescription({type:e.type,sdp:n})}(this,arguments[0]),s.apply(this,arguments)):s.apply(this,arguments)};const a=Object.getOwnPropertyDescriptor(t.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(t.RTCPeerConnection.prototype,"localDescription",{get(){const t=a.get.apply(this);return""===t.type?t:o(this,t)}}),t.RTCPeerConnection.prototype.removeTrack=function(t){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!t._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(t._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let e;this._streams=this._streams||{},Object.keys(this._streams).forEach((n=>{this._streams[n].getTracks().find((e=>t.track===e))&&(e=this._streams[n])})),e&&(1===e.getTracks().length?this.removeStream(this._reverseStreams[e.id]):e.removeTrack(t.track),this.dispatchEvent(new Event("negotiationneeded")))}}function tr(t,e){!t.RTCPeerConnection&&t.webkitRTCPeerConnection&&(t.RTCPeerConnection=t.webkitRTCPeerConnection),t.RTCPeerConnection&&e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(e){const n=t.RTCPeerConnection.prototype[e],r={[e](){return arguments[0]=new("addIceCandidate"===e?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};t.RTCPeerConnection.prototype[e]=r[e]}))}function er(t,e){Mn(t,"negotiationneeded",(t=>{const n=t.target;if(!(e.version<72||n.getConfiguration&&"plan-b"===n.getConfiguration().sdpSemantics)||"stable"===n.signalingState)return t}))}function nr(t,e){const n=t&&t.navigator,r=t&&t.MediaStreamTrack;if(n.getUserMedia=function(t,e,r){jn("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(t).then(e,r)},!(e.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){const t=function(t,e,n){e in t&&!(n in t)&&(t[n]=t[e],delete t[e])},e=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(n){return"object"==typeof n&&"object"==typeof n.audio&&(n=JSON.parse(JSON.stringify(n)),t(n.audio,"autoGainControl","mozAutoGainControl"),t(n.audio,"noiseSuppression","mozNoiseSuppression")),e(n)},r&&r.prototype.getSettings){const e=r.prototype.getSettings;r.prototype.getSettings=function(){const n=e.apply(this,arguments);return t(n,"mozAutoGainControl","autoGainControl"),t(n,"mozNoiseSuppression","noiseSuppression"),n}}if(r&&r.prototype.applyConstraints){const e=r.prototype.applyConstraints;r.prototype.applyConstraints=function(n){return"audio"===this.kind&&"object"==typeof n&&(n=JSON.parse(JSON.stringify(n)),t(n,"autoGainControl","mozAutoGainControl"),t(n,"noiseSuppression","mozNoiseSuppression")),e.apply(this,[n])}}}}function rr(t,e){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&(t.navigator.mediaDevices.getDisplayMedia=function(n){if(!n||!n.video){const t=new DOMException("getDisplayMedia without video constraints is undefined");return t.name="NotFoundError",t.code=8,Promise.reject(t)}return!0===n.video?n.video={mediaSource:e}:n.video.mediaSource=e,t.navigator.mediaDevices.getUserMedia(n)})}function ir(t){"object"==typeof t&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function or(t,e){if("object"!=typeof t||!t.RTCPeerConnection&&!t.mozRTCPeerConnection)return;!t.RTCPeerConnection&&t.mozRTCPeerConnection&&(t.RTCPeerConnection=t.mozRTCPeerConnection),e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(e){const n=t.RTCPeerConnection.prototype[e],r={[e](){return arguments[0]=new("addIceCandidate"===e?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};t.RTCPeerConnection.prototype[e]=r[e]}));const n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){const[t,i,o]=arguments;return r.apply(this,[t||null]).then((t=>{if(e.version<53&&!i)try{t.forEach((t=>{t.type=n[t.type]||t.type}))}catch(e){if("TypeError"!==e.name)throw e;t.forEach(((e,r)=>{t.set(r,Object.assign({},e,{type:n[e.type]||e.type}))}))}return t})).then(i,o)}}function sr(t){if("object"!=typeof t||!t.RTCPeerConnection||!t.RTCRtpSender)return;if(t.RTCRtpSender&&"getStats"in t.RTCRtpSender.prototype)return;const e=t.RTCPeerConnection.prototype.getSenders;e&&(t.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach((t=>t._pc=this)),t});const n=t.RTCPeerConnection.prototype.addTrack;n&&(t.RTCPeerConnection.prototype.addTrack=function(){const t=n.apply(this,arguments);return t._pc=this,t}),t.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function ar(t){if("object"!=typeof t||!t.RTCPeerConnection||!t.RTCRtpSender)return;if(t.RTCRtpSender&&"getStats"in t.RTCRtpReceiver.prototype)return;const e=t.RTCPeerConnection.prototype.getReceivers;e&&(t.RTCPeerConnection.prototype.getReceivers=function(){const t=e.apply(this,[]);return t.forEach((t=>t._pc=this)),t}),Mn(t,"track",(t=>(t.receiver._pc=t.srcElement,t))),t.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function cr(t){t.RTCPeerConnection&&!("removeStream"in t.RTCPeerConnection.prototype)&&(t.RTCPeerConnection.prototype.removeStream=function(t){jn("removeStream","removeTrack"),this.getSenders().forEach((e=>{e.track&&t.getTracks().includes(e.track)&&this.removeTrack(e)}))})}function ur(t){t.DataChannel&&!t.RTCDataChannel&&(t.RTCDataChannel=t.DataChannel)}function dr(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype.addTransceiver;e&&(t.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let t=arguments[1]&&arguments[1].sendEncodings;void 0===t&&(t=[]),t=[...t];const n=t.length>0;n&&t.forEach((t=>{if("rid"in t){if(!/^[a-z0-9]{0,16}$/i.test(t.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in t&&!(parseFloat(t.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in t&&!(parseFloat(t.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));const r=e.apply(this,arguments);if(n){const{sender:e}=r,n=e.getParameters();(!("encodings"in n)||1===n.encodings.length&&0===Object.keys(n.encodings[0]).length)&&(n.encodings=t,e.sendEncodings=t,this.setParametersPromises.push(e.setParameters(n).then((()=>{delete e.sendEncodings})).catch((()=>{delete e.sendEncodings}))))}return r})}function lr(t){if("object"!=typeof t||!t.RTCRtpSender)return;const e=t.RTCRtpSender.prototype.getParameters;e&&(t.RTCRtpSender.prototype.getParameters=function(){const t=e.apply(this,arguments);return"encodings"in t||(t.encodings=[].concat(this.sendEncodings||[{}])),t})}function hr(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>e.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):e.apply(this,arguments)}}function pr(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype.createAnswer;t.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>e.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):e.apply(this,arguments)}}function fr(t){if("object"==typeof t&&t.RTCPeerConnection){if("getLocalStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in t.RTCPeerConnection.prototype)){const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addStream=function(t){this._localStreams||(this._localStreams=[]),this._localStreams.includes(t)||this._localStreams.push(t),t.getAudioTracks().forEach((n=>e.call(this,n,t))),t.getVideoTracks().forEach((n=>e.call(this,n,t)))},t.RTCPeerConnection.prototype.addTrack=function(t,...n){return n&&n.forEach((t=>{this._localStreams?this._localStreams.includes(t)||this._localStreams.push(t):this._localStreams=[t]})),e.apply(this,arguments)}}"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(t){this._localStreams||(this._localStreams=[]);const e=this._localStreams.indexOf(t);if(-1===e)return;this._localStreams.splice(e,1);const n=t.getTracks();this.getSenders().forEach((t=>{n.includes(t.track)&&this.removeTrack(t)}))})}}function gr(t){if("object"==typeof t&&t.RTCPeerConnection&&("getRemoteStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in t.RTCPeerConnection.prototype))){Object.defineProperty(t.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(t){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=t),this.addEventListener("track",this._onaddstreampoly=t=>{t.streams.forEach((t=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(t))return;this._remoteStreams.push(t);const e=new Event("addstream");e.stream=t,this.dispatchEvent(e)}))})}});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){const t=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach((e=>{if(t._remoteStreams||(t._remoteStreams=[]),t._remoteStreams.indexOf(e)>=0)return;t._remoteStreams.push(e);const n=new Event("addstream");n.stream=e,t.dispatchEvent(n)}))}),e.apply(t,arguments)}}}function vr(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype,n=e.createOffer,r=e.createAnswer,i=e.setLocalDescription,o=e.setRemoteDescription,s=e.addIceCandidate;e.createOffer=function(t,e){const r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return e?(i.then(t,e),Promise.resolve()):i},e.createAnswer=function(t,e){const n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return e?(i.then(t,e),Promise.resolve()):i};let a=function(t,e,n){const r=i.apply(this,[t]);return n?(r.then(e,n),Promise.resolve()):r};e.setLocalDescription=a,a=function(t,e,n){const r=o.apply(this,[t]);return n?(r.then(e,n),Promise.resolve()):r},e.setRemoteDescription=a,a=function(t,e,n){const r=s.apply(this,[t]);return n?(r.then(e,n),Promise.resolve()):r},e.addIceCandidate=a}function mr(t){const e=t&&t.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){const t=e.mediaDevices,n=t.getUserMedia.bind(t);e.mediaDevices.getUserMedia=t=>n(_r(t))}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=function(t,n,r){e.mediaDevices.getUserMedia(t).then(n,r)}.bind(e))}function _r(t){return t&&void 0!==t.video?Object.assign({},t,{video:Vn(t.video)}):t}function Sr(t){if(!t.RTCPeerConnection)return;const e=t.RTCPeerConnection;t.RTCPeerConnection=function(t,n){if(t&&t.iceServers){const e=[];for(let n=0;n<t.iceServers.length;n++){let r=t.iceServers[n];!r.hasOwnProperty("urls")&&r.hasOwnProperty("url")?(jn("RTCIceServer.url","RTCIceServer.urls"),r=JSON.parse(JSON.stringify(r)),r.urls=r.url,delete r.url,e.push(r)):e.push(t.iceServers[n])}t.iceServers=e}return new e(t,n)},t.RTCPeerConnection.prototype=e.prototype,"generateCertificate"in e&&Object.defineProperty(t.RTCPeerConnection,"generateCertificate",{get:()=>e.generateCertificate})}function Er(t){"object"==typeof t&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function yr(t){const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(t){if(t){void 0!==t.offerToReceiveAudio&&(t.offerToReceiveAudio=!!t.offerToReceiveAudio);const e=this.getTransceivers().find((t=>"audio"===t.receiver.track.kind));!1===t.offerToReceiveAudio&&e?"sendrecv"===e.direction?e.setDirection?e.setDirection("sendonly"):e.direction="sendonly":"recvonly"===e.direction&&(e.setDirection?e.setDirection("inactive"):e.direction="inactive"):!0!==t.offerToReceiveAudio||e||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==t.offerToReceiveVideo&&(t.offerToReceiveVideo=!!t.offerToReceiveVideo);const n=this.getTransceivers().find((t=>"video"===t.receiver.track.kind));!1===t.offerToReceiveVideo&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0!==t.offerToReceiveVideo||n||this.addTransceiver("video",{direction:"recvonly"})}return e.apply(this,arguments)}}function br(t){"object"!=typeof t||t.AudioContext||(t.AudioContext=t.webkitAudioContext)}var Cr=n(7539),Tr=n.n(Cr);function wr(t){if(!t.RTCIceCandidate||t.RTCIceCandidate&&"foundation"in t.RTCIceCandidate.prototype)return;const e=t.RTCIceCandidate;t.RTCIceCandidate=function(t){if("object"==typeof t&&t.candidate&&0===t.candidate.indexOf("a=")&&((t=JSON.parse(JSON.stringify(t))).candidate=t.candidate.substr(2)),t.candidate&&t.candidate.length){const n=new e(t),r=Tr().parseCandidate(t.candidate),i=Object.assign(n,r);return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new e(t)},t.RTCIceCandidate.prototype=e.prototype,Mn(t,"icecandidate",(e=>(e.candidate&&Object.defineProperty(e,"candidate",{value:new t.RTCIceCandidate(e.candidate),writable:"false"}),e)))}function Ir(t){!t.RTCIceCandidate||t.RTCIceCandidate&&"relayProtocol"in t.RTCIceCandidate.prototype||Mn(t,"icecandidate",(t=>{if(t.candidate){const e=Tr().parseCandidate(t.candidate.candidate);"relay"===e.type&&(t.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[e.priority>>24])}return t}))}function kr(t,e){if(!t.RTCPeerConnection)return;"sctp"in t.RTCPeerConnection.prototype||Object.defineProperty(t.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const n=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===e.browser&&e.version>=76){const{sdpSemantics:t}=this.getConfiguration();"plan-b"===t&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(function(t){if(!t||!t.sdp)return!1;const e=Tr().splitSections(t.sdp);return e.shift(),e.some((t=>{const e=Tr().parseMLine(t);return e&&"application"===e.kind&&-1!==e.protocol.indexOf("SCTP")}))}(arguments[0])){const t=function(t){const e=t.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===e||e.length<2)return-1;const n=parseInt(e[1],10);return n!=n?-1:n}(arguments[0]),n=function(t){let n=65536;return"firefox"===e.browser&&(n=e.version<57?-1===t?16384:2147483637:e.version<60?57===e.version?65535:65536:2147483637),n}(t),r=function(t,n){let r=65536;"firefox"===e.browser&&57===e.version&&(r=65535);const i=Tr().matchPrefix(t.sdp,"a=max-message-size:");return i.length>0?r=parseInt(i[0].substr(19),10):"firefox"===e.browser&&-1!==n&&(r=2147483637),r}(arguments[0],t);let i;i=0===n&&0===r?Number.POSITIVE_INFINITY:0===n||0===r?Math.max(n,r):Math.min(n,r);const o={};Object.defineProperty(o,"maxMessageSize",{get:()=>i}),this._sctp=o}return n.apply(this,arguments)}}function Rr(t){if(!t.RTCPeerConnection||!("createDataChannel"in t.RTCPeerConnection.prototype))return;function e(t,e){const n=t.send;t.send=function(){const r=arguments[0],i=r.length||r.size||r.byteLength;if("open"===t.readyState&&e.sctp&&i>e.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+e.sctp.maxMessageSize+" bytes)");return n.apply(t,arguments)}}const n=t.RTCPeerConnection.prototype.createDataChannel;t.RTCPeerConnection.prototype.createDataChannel=function(){const t=n.apply(this,arguments);return e(t,this),t},Mn(t,"datachannel",(t=>(e(t.channel,t.target),t)))}function Or(t){if(!t.RTCPeerConnection||"connectionState"in t.RTCPeerConnection.prototype)return;const e=t.RTCPeerConnection.prototype;Object.defineProperty(e,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(e,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(t){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),t&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=t)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((t=>{const n=e[t];e[t]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=t=>{const e=t.target;if(e._lastConnectionState!==e.connectionState){e._lastConnectionState=e.connectionState;const n=new Event("connectionstatechange",t);e.dispatchEvent(n)}return t},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}}))}function Pr(t,e){if(!t.RTCPeerConnection)return;if("chrome"===e.browser&&e.version>=71)return;if("safari"===e.browser&&e.version>=605)return;const n=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(e){if(e&&e.sdp&&-1!==e.sdp.indexOf("\na=extmap-allow-mixed")){const n=e.sdp.split("\n").filter((t=>"a=extmap-allow-mixed"!==t.trim())).join("\n");t.RTCSessionDescription&&e instanceof t.RTCSessionDescription?arguments[0]=new t.RTCSessionDescription({type:e.type,sdp:n}):e.sdp=n}return n.apply(this,arguments)}}function Ar(t,e){if(!t.RTCPeerConnection||!t.RTCPeerConnection.prototype)return;const n=t.RTCPeerConnection.prototype.addIceCandidate;n&&0!==n.length&&(t.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===e.browser&&e.version<78||"firefox"===e.browser&&e.version<68||"safari"===e.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function Nr(t,e){if(!t.RTCPeerConnection||!t.RTCPeerConnection.prototype)return;const n=t.RTCPeerConnection.prototype.setLocalDescription;n&&0!==n.length&&(t.RTCPeerConnection.prototype.setLocalDescription=function(){let t=arguments[0]||{};if("object"!=typeof t||t.type&&t.sdp)return n.apply(this,arguments);if(t={type:t.type,sdp:t.sdp},!t.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":t.type="offer";break;default:t.type="answer"}if(t.sdp||"offer"!==t.type&&"answer"!==t.type)return n.apply(this,[t]);return("offer"===t.type?this.createOffer:this.createAnswer).apply(this).then((t=>n.apply(this,[t])))})}!function({window:t}={},n={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const r=Bn,a=function(t){const e={browser:null,version:null};if(void 0===t||!t.navigator)return e.browser="Not a browser.",e;const{navigator:n}=t;if(n.mozGetUserMedia)e.browser="firefox",e.version=xn(n.userAgent,/Firefox\/(\d+)\./,1);else if(n.webkitGetUserMedia||!1===t.isSecureContext&&t.webkitRTCPeerConnection)e.browser="chrome",e.version=xn(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!t.RTCPeerConnection||!n.userAgent.match(/AppleWebKit\/(\d+)\./))return e.browser="Not a supported browser.",e;e.browser="safari",e.version=xn(n.userAgent,/AppleWebKit\/(\d+)\./,1),e.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype}return e}(t),c={browserDetails:a,commonShim:s,extractVersion:xn,disableLog:Ln,disableWarnings:Un,sdp:Cr};switch(a.browser){case"chrome":if(!e||!tr||!n.shimChrome)return r("Chrome shim is not included in this adapter release."),c;if(null===a.version)return r("Chrome shim can not determine version, not shimming."),c;r("adapter.js shimming chrome."),c.browserShim=e,Ar(t,a),Nr(t),zn(t,a),qn(t),tr(t,a),Jn(t),Zn(t,a),Kn(t),Xn(t),Yn(t),er(t,a),wr(t),Ir(t),Or(t),kr(t,a),Rr(t),Pr(t,a);break;case"firefox":if(!i||!or||!n.shimFirefox)return r("Firefox shim is not included in this adapter release."),c;r("adapter.js shimming firefox."),c.browserShim=i,Ar(t,a),Nr(t),nr(t,a),or(t,a),ir(t),cr(t),sr(t),ar(t),ur(t),dr(t),lr(t),hr(t),pr(t),wr(t),Or(t),kr(t,a),Rr(t);break;case"safari":if(!o||!n.shimSafari)return r("Safari shim is not included in this adapter release."),c;r("adapter.js shimming safari."),c.browserShim=o,Ar(t,a),Nr(t),Sr(t),yr(t),vr(t),fr(t),gr(t),Er(t),mr(t),br(t),wr(t),Ir(t),kr(t,a),Rr(t),Pr(t,a);break;default:r("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});const Dr=()=>"function"==typeof RTCPeerConnection;class Samples{constructor(){this.min=0,this.max=0,this.sum=0,this.data=[]}push(t){(0===this.min||t<this.min)&&(this.min=t),t>=this.max&&(this.max=t),this.data.push(t),this.sum+=t}median(){this.data.sort();const t=this.data.length>>1;return this.data.length%2==0?this.data[t-1]+this.data[t]>>1:this.data[t]}percentile(t){if(0===this.data.length)return 0;if(t<=0)return this.data[0];if(t>=1)return this.data[this.data.length-1];const e=(this.data.length-1)*t,n=Math.floor(e),r=n+1,i=e%1;return r>=this.data.length?this.data[n]:this.data[n]*(1-i)+this.data[r]*i}}var xr=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};class PeerStatsTracker{constructor(t,e,n){this.peerClient=t,this.broadcastCanvasManager=e,this.logger=new ScopedLogger(n,w.EMITTER),this.previousBytesSent=0,this.startTimestamp=0,this.analyticsTracker=AnalyticsTracker.getInstance(),this.initializeSamples()}start(){this.logger.info({msg:"start emitter"}),this.collectSamplesTimerId=window.setInterval((()=>{this.collectSamples()}),1e3),this.trackSamplesTimerId=window.setInterval((()=>{this.trackSamples()}),3e4),this.trackPeerConnectionStatsTimerId=window.setInterval((()=>{this.trackPeerConnectionStats()}),6e4),this.trackSamples()}stop(){clearInterval(this.collectSamplesTimerId),clearInterval(this.trackSamplesTimerId),clearInterval(this.trackPeerConnectionStatsTimerId),this.collectSamplesTimerId=void 0,this.trackSamplesTimerId=void 0,this.trackPeerConnectionStatsTimerId=void 0}trackPeerConnectionStats(){return xr(this,void 0,void 0,(function*(){(yield this.peerClient.getReports()).forEach((t=>{if("outbound-rtp"===t.type)switch(t.kind){case"audio":this.analyticsTracker.trackEvent(new WebRTCAudioStatsEvent(t));break;case"video":{const e=new WebRTCVideoStatsEvent(t),n=new MinuteBroadcastEvent(t,this.startTimestamp);this.analyticsTracker.batchEvents([e,n]);break}default:this.logger.warn({msg:"unknown report kind: ",reportKind:t.kind})}}))}))}collectSamples(){return xr(this,void 0,void 0,(function*(){let t=0;this.audioLatencySamples.push(this.broadcastCanvasManager.getAudioLatency()),this.videoLatencySamples.push(this.broadcastCanvasManager.getVideoLatency());(yield this.peerClient.getReports()).forEach((e=>{switch(e.type){case"candidate-pair":e.nominated&&(this.rttSamples.push(e.currentRoundTripTime),this.recommendedBitrateSamples.push(e.availableOutgoingBitrate));break;case"outbound-rtp":t+=e.bytesSent||0,0===this.startTimestamp&&"video"===e.kind&&(this.startTimestamp=e.timestamp)}}));const e=8*Math.round(t-this.previousBytesSent);this.previousBytesSent=t,this.measuredBitrateSamples.push(e)}))}trackSamples(){const t=30,e=new SourceAudioLatencyEvent(this.audioLatencySamples,t),n=new SourceVideoLatencyEvent(this.videoLatencySamples,t),r=new CongestionTimeEvent(this.congestionTimeSamples,t),i=new MeasuredBitrateEvent(this.measuredBitrateSamples,t),o=new RecommendedBitrateEvent(this.recommendedBitrateSamples,t),s=new ConnectionRTTEvent(this.rttSamples,t);this.analyticsTracker.batchEvents([e,n,r,i,o,s]),this.initializeSamples()}initializeSamples(){this.audioLatencySamples=new Samples,this.videoLatencySamples=new Samples,this.congestionTimeSamples=new Samples,this.measuredBitrateSamples=new Samples,this.recommendedBitrateSamples=new Samples,this.rttSamples=new Samples}}var Mr,Lr=n(2492);!function(t){t.CONFIG="config",t.UPDATE="update",t.START="start",t.STOP="stop"}(Mr||(Mr={}));var Ur=n(477),Br=n.n(Ur);function jr(){return Br()('/*! For license information please see scheduler.worker.worker.js.LICENSE.txt */\n(()=>{"use strict";var t;!function(t){t.CONFIG="config",t.UPDATE="update",t.START="start",t.STOP="stop"}(t||(t={}));const i=self;const s=new class Scheduler{constructor(){this.config={frameRate:60,isRunning:!1}}setConfig(t){this.config=Object.assign(Object.assign({},this.config),t),this.config.isRunning&&(this.stop(),this.start())}start(){this.config.isRunning||(this.intervalId=setInterval((()=>{i.postMessage({type:t.UPDATE})}),1e3/this.config.frameRate),this.config.isRunning=!0)}stop(){this.config.isRunning&&(clearInterval(this.intervalId),this.intervalId=void 0,this.config.isRunning=!1)}};i.addEventListener("message",(function(i){var n;if(null===(n=null==i?void 0:i.data)||void 0===n?void 0:n.type)switch(i.data.type){case t.CONFIG:s.setConfig(i.data.payload||{});break;case t.START:s.start();break;case t.STOP:s.stop()}}))})();',"Worker",void 0,void 0)}var Fr=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};class BroadcastCanvasManager{constructor(t,e){this.config=t,this.mediaStreamManager=e,this.handleWorkerEvent=t=>{var e;if((null===(e=t.data)||void 0===e?void 0:e.type)===Mr.UPDATE)this.drawComposite()},this.mixer={video:[],audio:[]},this.analyticsTracker=AnalyticsTracker.getInstance(),this.schedulerWorker=new jr,this.running=!1,this.compositeEl=document.createElement("canvas"),this.compositeEl.height=this.config.streamConfig.maxResolution.height,this.compositeEl.width=this.config.streamConfig.maxResolution.width;const n=this.compositeEl.getContext("2d");if(null===n)throw new BroadcastClientError(Object.assign({},I));this.compositeContext=n,this.compositeStream=this.compositeEl.captureStream(void 0!==typeof CanvasCaptureMediaStreamTrack?0:30);const r=Se(this.compositeStream.getTracks(),Ee.VIDEO);this.audioContext=new AudioContext,this.unlockAudioContext(),this.audioDestination=this.audioContext.createMediaStreamDestination(),this.setupSilence();const i=Se(this.audioDestination.stream.getTracks(),Ee.AUDIO);r&&this.mediaStreamManager.setTrack(Ee.VIDEO,r),i&&this.mediaStreamManager.setTrack(Ee.AUDIO,i),this.schedulerWorker.addEventListener("message",this.handleWorkerEvent),this.schedulerWorker.postMessage({type:Mr.CONFIG,payload:{frameRate:this.config.streamConfig.maxFramerate}}),this.previewElement=null,this.previewCtx=null,this.nextMix=(new Date).getTime()}attachPreview(t){this.previewElement=t;const{width:e,height:n}=this.config.streamConfig.maxResolution;this.previewElement.width=e,this.previewElement.height=n,this.previewCtx=this.previewElement.getContext("2d")}detachPreview(){this.previewElement=null,this.previewCtx=null}setupSilence(){const t=this.audioContext.createConstantSource(),e=this.audioContext.createGain();e.gain.value=.001,t.connect(e),e.connect(this.audioDestination),t.start()}unlockAudioContext(){if("suspended"!==this.audioContext.state)return;const t=document.body,e=["touchstart","touchend","mousedown","keydown"],n=()=>{e.forEach((e=>{t.removeEventListener(e,r)}))},r=()=>{this.audioContext.resume().then(n)};e.forEach((e=>{t.addEventListener(e,r,!1)}))}getTracks(){return[this.mediaStreamManager.getTrack(Ee.VIDEO),this.mediaStreamManager.getTrack(Ee.AUDIO)]}getCanvasVideoTrack(){return this.mediaStreamManager.getTrack(Ee.VIDEO)}getAudioInputDevice(t){if("string"!=typeof t)return;const e=this.mixer.audio.find((e=>{if(e.name===t)return e.source}));return null==e?void 0:e.source}getVideoInputDevice(t){if("string"==typeof t)return this.mixer.video.find((e=>e.name===t))}getCanvasDimensions(){return{height:this.compositeEl.height,width:this.compositeEl.width}}addVideoInputDevice(t,e,n){var r;return Fr(this,void 0,void 0,(function*(){if("object"!=typeof t)throw new BroadcastClientError(Object.assign({},O));if(!e||"string"!=typeof e)throw new BroadcastClientError(Object.assign({},D));if(this.mixer.video.some((t=>t.name===e)))throw new BroadcastClientError(Object.assign({},P));if(!n)throw new BroadcastClientError(Object.assign({},A));if("number"!=typeof n.index)throw new BroadcastClientError(Object.assign({},N));const i=function(){const t=document.createElement("video");return t.autoplay=!0,t.muted=!0,t.setAttribute("playsinline",""),t.setAttribute("webkit-playsinline",""),t}(),o=t.getVideoTracks(),[s]=o;if(!o.length)throw new BroadcastClientError(Object.assign({},k));const a=s.getConstraints(),c=Lr({},a,{frameRate:this.config.streamConfig.maxFramerate});try{yield s.applyConstraints(c)}catch(t){let e="Unknown constraints error";t instanceof Error&&(e=t.message),this.analyticsTracker.trackEvent(new ErrorEvent({description:`${M.message}: ${e}`,isFatal:!1,code:M.code}))}const u=()=>Fr(this,void 0,void 0,(function*(){let t=0;for(;t<5;)try{return void(yield i.play())}catch(e){if(!(e instanceof Error))throw new Error("unknown error trying to add video to broadcast");t++,yield new Promise((t=>setTimeout(t,150)))}throw new Error("Error playing video, tries exceeded")})),d=new MediaStream([s]);i.srcObject=d;try{yield u();const t={name:e,element:i,position:n,source:d,render:!0},o=(null===(r=s.getSettings)||void 0===r?void 0:r.call(s))||{};this.analyticsTracker.trackEvent(new InputDeviceAttachedEvent(_e(o),o)),this.mixer.video.push(t)}catch(t){throw new BroadcastClientError(Object.assign(Object.assign({},k),{cause:t}))}}))}addImageSource(t,e,n){var r;return Fr(this,void 0,void 0,(function*(){if(!t)throw new BroadcastClientError(Object.assign({},O));if(!e||"string"!=typeof e)throw new BroadcastClientError(Object.assign({},D));if("image"===t.tagName)throw new BroadcastClientError(Object.assign({},x));if(this.mixer.video.some((t=>t.name===e)))throw new BroadcastClientError(Object.assign({},P));if(!n)throw new BroadcastClientError(Object.assign({},A));if("number"!=typeof n.index)throw new BroadcastClientError(Object.assign({},N));if(t instanceof Image){const e=null===(r=t.src)||void 0===r?void 0:r.slice();try{const e=t.src?new URL(t.src):{};if(e.host&&e.hostname){const e=yield fetch(t.src).then((t=>Fr(this,void 0,void 0,(function*(){return t.blob()})))),n=yield new Promise((t=>{const n=new FileReader;n.onload=()=>{t(n.result)},n.readAsDataURL(e)}));t.src=n}}catch(t){throw new BroadcastClientError(Object.assign(Object.assign({},G),{params:{details:`Image URL: ${e}`}}))}}const i={name:e,element:t,position:n,render:!0};this.mixer.video.push(i)}))}addAudioInputDevice(t,e){return Fr(this,void 0,void 0,(function*(){if("object"!=typeof t)throw new BroadcastClientError(Object.assign({},O));if(!e||"string"!=typeof e)throw new BroadcastClientError(Object.assign({},D));if(this.mixer.audio.some((t=>t.name===e)))throw new BroadcastClientError(Object.assign({},P));const n=t.getAudioTracks();if(!n.length)throw new BroadcastClientError(Object.assign({},R));const r=this.audioContext.createMediaStreamSource(new MediaStream(n)),i=this.audioContext.createGain();i.gain.value=1,r.connect(i),i.connect(this.audioDestination);const o={name:e,source:t,audioTrackSource:r,gainNode:i};this.analyticsTracker.trackEvent(new InputDeviceAttachedEvent("audio",{deviceId:t.id})),this.mixer.audio.push(o)}))}removeImage(t){const e=this.mixer.video.findIndex((e=>e.name===t));if(e<0)throw new BroadcastClientError(Object.assign({},U));this.mixer.video.splice(e,1)}removeVideoInputDevice(t){var e;const n=this.removeDevice(t,this.mixer.video);if(!n)throw new BroadcastClientError(Object.assign({},L));{const t=Se(n.source.getTracks(),Ee.VIDEO);if(!t)throw new BroadcastClientError(Object.assign({},L));n.element.srcObject=null,t.stop();const r=(null===(e=null==t?void 0:t.getSettings)||void 0===e?void 0:e.call(t))||{};this.analyticsTracker.trackEvent(new InputDeviceDetachedEvent(_e(r),r))}}removeAudioInputDevice(t){const e=this.removeDevice(t,this.mixer.audio);if(null==e?void 0:e.audioTrackSource){for(const t of e.source.getTracks())t.stop(),this.analyticsTracker.trackEvent(new InputDeviceDetachedEvent("audio",{deviceId:t.id}));e.gainNode.disconnect(this.audioDestination)}else if(!e)throw new BroadcastClientError(Object.assign({},L))}updateVideoDeviceComposition(t,e){if(!t||"string"!=typeof t)throw new BroadcastClientError(Object.assign({},F));if(!e)throw new BroadcastClientError(Object.assign({},B));if("number"!=typeof e.index)throw new BroadcastClientError(Object.assign({},j));this.mixer.video.forEach(((n,r)=>{n.name===t&&(n.position=e)}))}exchangeVideoDevicePositions(t,e){const n=this.getVideoInputDevice(t),r=this.getVideoInputDevice(e);if(!n)throw new BroadcastClientError(Object.assign(Object.assign({},V),{params:{details:`device with name: "${t}" not found`}}));if(!r)throw new BroadcastClientError(Object.assign(Object.assign({},V),{params:{details:`device with name: "${e}" not found`}}));const i=Object.assign({},n.position),o=Object.assign({},r.position);for(const n of this.mixer.video)n.name===t&&(Vr(o.x)?n.position=Object.assign(Object.assign({},n.position),o):n.position={index:o.index}),n.name===e&&(Vr(i.x)?n.position=Object.assign(Object.assign({},n.position),i):n.position={index:i.index})}start(){this.running||(this.running=!0,this.schedulerWorker.postMessage({type:Mr.CONFIG,payload:{frameRate:this.config.streamConfig.maxFramerate}}),this.schedulerWorker.postMessage({type:Mr.START}))}stop(){this.running&&(this.running=!1,this.schedulerWorker.removeEventListener("message",this.handleWorkerEvent))}isCapturing(){return this.running}getAudioLatency(){return this.audioContext.baseLatency}getVideoLatency(){var t;return(null===(t=this.mediaStreamManager.getTrack(Ee.VIDEO))||void 0===t?void 0:t.getConstraints().latency)||0}disableVideo(){this.mixer.video.forEach((t=>{t.render=!1}))}enableVideo(){this.mixer.video.forEach((t=>{t.render=!0}))}disableAudio(){this.mixer.audio.forEach((t=>{t.audioTrackSource&&(t.gainNode.gain.value=0)}))}enableAudio(){this.mixer.audio.forEach((t=>{t.audioTrackSource&&(t.gainNode.gain.value=1)}))}getDrawRegion(t,e,n){var r,i,o,s;let a=null!==(r=t.position.x)&&void 0!==r?r:0,c=null!==(i=t.position.y)&&void 0!==i?i:0;const u=null!==(o=t.position.width)&&void 0!==o?o:e-a,d=null!==(s=t.position.height)&&void 0!==s?s:n-c,l=u/d;let h=t.element.width,p=t.element.height;t.element instanceof HTMLVideoElement&&(h=t.element.videoWidth,p=t.element.videoHeight);const f=h/p;let g=u,v=d;return f>l?(g=u,v=2*Math.round(u/f/2),c+=(d-v)/2):f<l&&(v=d,g=2*Math.round(d*f/2),a+=(u-g)/2),{x:a,y:c,width:g,height:v}}drawComposite(){if(!this.shouldMix(new Date))return;this.compositeContext.clearRect(0,0,this.compositeEl.width,this.compositeEl.height),this.drawBlackScreen();const t=this.mixer.video.filter((t=>t.render));t.sort(((t,e)=>t.position.index-e.position.index));for(const e of t){const{x:t,y:n,width:r,height:i}=this.getDrawRegion(e,this.compositeEl.width,this.compositeEl.height);this.compositeContext.drawImage(e.element,t,n,r,i)}this.previewElement&&this.previewCtx&&this.previewCtx.drawImage(this.compositeEl,0,0,this.previewElement.width,this.previewElement.height),this.requestCanvasCapture()}requestCanvasCapture(){if(void 0!==typeof CanvasCaptureMediaStreamTrack)if("function"==typeof this.compositeStream.requestFrame){this.compositeStream.requestFrame()}else{this.mediaStreamManager.getTrack(Ee.VIDEO).requestFrame()}}drawBlackScreen(){this.compositeContext.fillStyle="#000000",this.compositeContext.fillRect(0,0,this.compositeEl.width,this.compositeEl.height)}removeDevice(t,e){const n=e.findIndex((e=>(e=>e.name===t)(e)));if(!(n<0))return e.splice(n,1)[0]}shouldMix(t){if(t.getTime()<this.nextMix)return!1;for(;this.nextMix<=t.getTime();)this.nextMix+=1e3/this.config.streamConfig.maxFramerate;return!0}}function Vr(t){return Number.isSafeInteger(t)}var Gr,Wr,$r=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},zr=function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)};class AmazonIVSBroadcastClient{constructor(t){this.config=t,Gr.add(this),this.emitter=new u,this.isValid=!0,this.emitter.on(xe.ERROR,this.stopBroadcast),this.config.ingestEndpoint&&(this.url=new URL(this.config.ingestEndpoint)),this.analyticsTracker=AnalyticsTracker.getInstance(),this.mediaStreamManager=MediaStreamManager.getOrRegisterInstance(this);const e=new Logger(t.logLevel,t.logger);this.peerClient=new PeerClient(this.config,this.emitter,this.mediaStreamManager,e),this.broadcastCanvasManager=new BroadcastCanvasManager(t,this.mediaStreamManager),this.peerStatsTracker=new PeerStatsTracker(this.peerClient,this.broadcastCanvasManager,e),this.broadcastCanvasManager.start();Object.getOwnPropertyNames(AmazonIVSBroadcastClient.prototype).forEach((t=>{this[t]=new Proxy(this[t],{apply:(t,e,n)=>{if(!e.isValid)throw new BroadcastClientError(Object.assign({},Q));return Reflect.apply(t,e,n)}})})),window.addEventListener("beforeunload",(()=>{this.analyticsTracker.stop(!0)}))}delete(){this.isValid=!1,this.peerClient.stop(),this.broadcastCanvasManager.stop(),this.emitter.removeAllListeners()}startBroadcast(t,e){return $r(this,void 0,void 0,(function*(){zr(this,Gr,"m",Wr).call(this,t);const n=It(e||this.config.ingestEndpoint);this.analyticsTracker.start(),this.peerStatsTracker.start(),yield this.peerClient.start(n,t),this.emitter.emit(xe.ACTIVE_STATE_CHANGE,!0),this.url=new URL(n),this.url&&this.analyticsTracker.trackEvent(new StartBroadcastEvent({protocol:"webrtc",hostname:this.url.hostname,port:this.url.port},je.USER_INITIATED))}))}stopBroadcast(){var t,e,n;this.url&&this.analyticsTracker.trackEvent(new StopBroadcastEvent({protocol:"webrtc",hostname:this.url.hostname,port:this.url.port})),null===(t=this.peerStatsTracker)||void 0===t||t.stop(),null===(e=this.peerClient)||void 0===e||e.stop(),null===(n=this.emitter)||void 0===n||n.emit(xe.ACTIVE_STATE_CHANGE,!1)}getCanvasDimensions(){return this.broadcastCanvasManager.getCanvasDimensions()}addVideoInputDevice(t,e,n){return $r(this,void 0,void 0,(function*(){return this.broadcastCanvasManager.addVideoInputDevice(t,e,n)}))}addImageSource(t,e,n){return $r(this,void 0,void 0,(function*(){return this.broadcastCanvasManager.addImageSource(t,e,n)}))}addAudioInputDevice(t,e){return $r(this,void 0,void 0,(function*(){return this.broadcastCanvasManager.addAudioInputDevice(t,e)}))}removeVideoInputDevice(t){this.broadcastCanvasManager.removeVideoInputDevice(t)}removeAudioInputDevice(t){this.broadcastCanvasManager.removeAudioInputDevice(t)}removeImage(t){this.broadcastCanvasManager.removeImage(t)}updateVideoDeviceComposition(t,e){this.broadcastCanvasManager.updateVideoDeviceComposition(t,e)}exchangeVideoDevicePositions(t,e){this.broadcastCanvasManager.exchangeVideoDevicePositions(t,e)}getAudioInputDevice(t){return this.broadcastCanvasManager.getAudioInputDevice(t)}getVideoInputDevice(t){return this.broadcastCanvasManager.getVideoInputDevice(t)}getConnectionState(){return this.peerClient.getConnectionState()}getSessionId(){return this.peerClient.getSessionId()}on(t,e){this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}getAudioContext(){return this.broadcastCanvasManager.audioContext}attachPreview(t){this.broadcastCanvasManager.attachPreview(t)}detachPreview(){this.broadcastCanvasManager.detachPreview()}disableVideo(){this.broadcastCanvasManager.disableVideo()}enableVideo(){this.broadcastCanvasManager.enableVideo()}disableAudio(){this.broadcastCanvasManager.disableAudio()}enableAudio(){this.broadcastCanvasManager.enableAudio()}}function Hr(t){return new AmazonIVSBroadcastClient(function(t){const e=new Config;return e.streamConfig=t.streamConfig,e.ingestEndpoint=t.ingestEndpoint,e.logger=t.logger,e.logLevel=t.logLevel,e.networkReconnectConfig=t.networkReconnectConfig,e}(t))}Gr=new WeakSet,Wr=function(t){if("string"!=typeof t||!/^[a-zA-Z0-9_-]+$/.test(t))throw new BroadcastClientError(et)};const qr="1.5.0";function Jr(t){const e=new StageConfig;e.logger=t.logger,e.logLevel=t.logLevel,e.streamConfig=t.streamConfig,e.whipUrlOverride=t.whipUrlOverride;new Config(void 0,t.logLevel,t.streamConfig,t.logger);return new AmazonIVSBroadcastStageClient(new(d()),e,new Logger(t.logLevel,t.logger))}function Kr(t){const e=AnalyticsTracker.getInstance(),n=fe(t),r=f(),i=new JoinEvent({traceId:r,token:n,eventEndpoint:n.eventsURL,whipEndpoint:n.whipURL});e.trackEventNoSharedProps(i)}function Xr(t,e){const n=AnalyticsTracker.getInstance(),r=fe(t),i=f(),o=new LeaveEvent({traceId:i,token:r,eventEndpoint:r.eventsURL,whipEndpoint:r.whipURL,reason:e});n.trackEventNoSharedProps(o)}const Yr=a})(),r})()));
2
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.IVSBroadcastClient=e():t.IVSBroadcastClient=e()}(self,(()=>(()=>{var t={9669:(t,e,n)=>{t.exports=n(1609)},5448:(t,e,n)=>{"use strict";var r=n(4867),i=n(6026),o=n(4372),s=n(5327),a=n(4097),c=n(4109),u=n(7985),d=n(7874),l=n(2648),h=n(644),p=n(205);t.exports=function(t){return new Promise((function(e,n){var f,g=t.data,v=t.headers,m=t.responseType;function _(){t.cancelToken&&t.cancelToken.unsubscribe(f),t.signal&&t.signal.removeEventListener("abort",f)}r.isFormData(g)&&r.isStandardBrowserEnv()&&delete v["Content-Type"];var S=new XMLHttpRequest;if(t.auth){var E=t.auth.username||"",y=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";v.Authorization="Basic "+btoa(E+":"+y)}var b=a(t.baseURL,t.url);function C(){if(S){var r="getAllResponseHeaders"in S?c(S.getAllResponseHeaders()):null,o={data:m&&"text"!==m&&"json"!==m?S.response:S.responseText,status:S.status,statusText:S.statusText,headers:r,config:t,request:S};i((function(t){e(t),_()}),(function(t){n(t),_()}),o),S=null}}if(S.open(t.method.toUpperCase(),s(b,t.params,t.paramsSerializer),!0),S.timeout=t.timeout,"onloadend"in S?S.onloadend=C:S.onreadystatechange=function(){S&&4===S.readyState&&(0!==S.status||S.responseURL&&0===S.responseURL.indexOf("file:"))&&setTimeout(C)},S.onabort=function(){S&&(n(new l("Request aborted",l.ECONNABORTED,t,S)),S=null)},S.onerror=function(){n(new l("Network Error",l.ERR_NETWORK,t,S,S)),S=null},S.ontimeout=function(){var e=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",r=t.transitional||d;t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),n(new l(e,r.clarifyTimeoutError?l.ETIMEDOUT:l.ECONNABORTED,t,S)),S=null},r.isStandardBrowserEnv()){var T=(t.withCredentials||u(b))&&t.xsrfCookieName?o.read(t.xsrfCookieName):void 0;T&&(v[t.xsrfHeaderName]=T)}"setRequestHeader"in S&&r.forEach(v,(function(t,e){void 0===g&&"content-type"===e.toLowerCase()?delete v[e]:S.setRequestHeader(e,t)})),r.isUndefined(t.withCredentials)||(S.withCredentials=!!t.withCredentials),m&&"json"!==m&&(S.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&S.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&S.upload&&S.upload.addEventListener("progress",t.onUploadProgress),(t.cancelToken||t.signal)&&(f=function(t){S&&(n(!t||t&&t.type?new h:t),S.abort(),S=null)},t.cancelToken&&t.cancelToken.subscribe(f),t.signal&&(t.signal.aborted?f():t.signal.addEventListener("abort",f))),g||(g=null);var w=p(b);w&&-1===["http","https","file"].indexOf(w)?n(new l("Unsupported protocol "+w+":",l.ERR_BAD_REQUEST,t)):S.send(g)}))}},1609:(t,e,n)=>{"use strict";var r=n(4867),i=n(1849),o=n(321),s=n(7185);var a=function t(e){var n=new o(e),a=i(o.prototype.request,n);return r.extend(a,o.prototype,n),r.extend(a,n),a.create=function(n){return t(s(e,n))},a}(n(5546));a.Axios=o,a.CanceledError=n(644),a.CancelToken=n(4972),a.isCancel=n(6502),a.VERSION=n(7288).version,a.toFormData=n(7675),a.AxiosError=n(2648),a.Cancel=a.CanceledError,a.all=function(t){return Promise.all(t)},a.spread=n(8713),a.isAxiosError=n(6268),t.exports=a,t.exports.default=a},4972:(t,e,n)=>{"use strict";var r=n(644);function i(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise((function(t){e=t}));var n=this;this.promise.then((function(t){if(n._listeners){var e,r=n._listeners.length;for(e=0;e<r;e++)n._listeners[e](t);n._listeners=null}})),this.promise.then=function(t){var e,r=new Promise((function(t){n.subscribe(t),e=t})).then(t);return r.cancel=function(){n.unsubscribe(e)},r},t((function(t){n.reason||(n.reason=new r(t),e(n.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.prototype.subscribe=function(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]},i.prototype.unsubscribe=function(t){if(this._listeners){var e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}},i.source=function(){var t;return{token:new i((function(e){t=e})),cancel:t}},t.exports=i},644:(t,e,n)=>{"use strict";var r=n(2648);function i(t){r.call(this,null==t?"canceled":t,r.ERR_CANCELED),this.name="CanceledError"}n(4867).inherits(i,r,{__CANCEL__:!0}),t.exports=i},6502:t=>{"use strict";t.exports=function(t){return!(!t||!t.__CANCEL__)}},321:(t,e,n)=>{"use strict";var r=n(4867),i=n(5327),o=n(782),s=n(3572),a=n(7185),c=n(4097),u=n(4875),d=u.validators;function l(t){this.defaults=t,this.interceptors={request:new o,response:new o}}l.prototype.request=function(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},(e=a(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var n=e.transitional;void 0!==n&&u.assertOptions(n,{silentJSONParsing:d.transitional(d.boolean),forcedJSONParsing:d.transitional(d.boolean),clarifyTimeoutError:d.transitional(d.boolean)},!1);var r=[],i=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(i=i&&t.synchronous,r.unshift(t.fulfilled,t.rejected))}));var o,c=[];if(this.interceptors.response.forEach((function(t){c.push(t.fulfilled,t.rejected)})),!i){var l=[s,void 0];for(Array.prototype.unshift.apply(l,r),l=l.concat(c),o=Promise.resolve(e);l.length;)o=o.then(l.shift(),l.shift());return o}for(var h=e;r.length;){var p=r.shift(),f=r.shift();try{h=p(h)}catch(t){f(t);break}}try{o=s(h)}catch(t){return Promise.reject(t)}for(;c.length;)o=o.then(c.shift(),c.shift());return o},l.prototype.getUri=function(t){t=a(this.defaults,t);var e=c(t.baseURL,t.url);return i(e,t.params,t.paramsSerializer)},r.forEach(["delete","get","head","options"],(function(t){l.prototype[t]=function(e,n){return this.request(a(n||{},{method:t,url:e,data:(n||{}).data}))}})),r.forEach(["post","put","patch"],(function(t){function e(e){return function(n,r,i){return this.request(a(i||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}l.prototype[t]=e(),l.prototype[t+"Form"]=e(!0)})),t.exports=l},2648:(t,e,n)=>{"use strict";var r=n(4867);function i(t,e,n,r,i){Error.call(this),this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i)}r.inherits(i,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var o=i.prototype,s={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED"].forEach((function(t){s[t]={value:t}})),Object.defineProperties(i,s),Object.defineProperty(o,"isAxiosError",{value:!0}),i.from=function(t,e,n,s,a,c){var u=Object.create(o);return r.toFlatObject(t,u,(function(t){return t!==Error.prototype})),i.call(u,t.message,e,n,s,a),u.name=t.name,c&&Object.assign(u,c),u},t.exports=i},782:(t,e,n)=>{"use strict";var r=n(4867);function i(){this.handlers=[]}i.prototype.use=function(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},i.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},i.prototype.forEach=function(t){r.forEach(this.handlers,(function(e){null!==e&&t(e)}))},t.exports=i},4097:(t,e,n)=>{"use strict";var r=n(1793),i=n(7303);t.exports=function(t,e){return t&&!r(e)?i(t,e):e}},3572:(t,e,n)=>{"use strict";var r=n(4867),i=n(8527),o=n(6502),s=n(5546),a=n(644);function c(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new a}t.exports=function(t){return c(t),t.headers=t.headers||{},t.data=i.call(t,t.data,t.headers,t.transformRequest),t.headers=r.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),r.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||s.adapter)(t).then((function(e){return c(t),e.data=i.call(t,e.data,e.headers,t.transformResponse),e}),(function(e){return o(e)||(c(t),e&&e.response&&(e.response.data=i.call(t,e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))}},7185:(t,e,n)=>{"use strict";var r=n(4867);t.exports=function(t,e){e=e||{};var n={};function i(t,e){return r.isPlainObject(t)&&r.isPlainObject(e)?r.merge(t,e):r.isPlainObject(e)?r.merge({},e):r.isArray(e)?e.slice():e}function o(n){return r.isUndefined(e[n])?r.isUndefined(t[n])?void 0:i(void 0,t[n]):i(t[n],e[n])}function s(t){if(!r.isUndefined(e[t]))return i(void 0,e[t])}function a(n){return r.isUndefined(e[n])?r.isUndefined(t[n])?void 0:i(void 0,t[n]):i(void 0,e[n])}function c(n){return n in e?i(t[n],e[n]):n in t?i(void 0,t[n]):void 0}var u={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:c};return r.forEach(Object.keys(t).concat(Object.keys(e)),(function(t){var e=u[t]||o,i=e(t);r.isUndefined(i)&&e!==c||(n[t]=i)})),n}},6026:(t,e,n)=>{"use strict";var r=n(2648);t.exports=function(t,e,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?e(new r("Request failed with status code "+n.status,[r.ERR_BAD_REQUEST,r.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):t(n)}},8527:(t,e,n)=>{"use strict";var r=n(4867),i=n(5546);t.exports=function(t,e,n){var o=this||i;return r.forEach(n,(function(n){t=n.call(o,t,e)})),t}},5546:(t,e,n)=>{"use strict";var r=n(4867),i=n(6016),o=n(2648),s=n(7874),a=n(7675),c={"Content-Type":"application/x-www-form-urlencoded"};function u(t,e){!r.isUndefined(t)&&r.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var d,l={transitional:s,adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(d=n(5448)),d),transformRequest:[function(t,e){if(i(e,"Accept"),i(e,"Content-Type"),r.isFormData(t)||r.isArrayBuffer(t)||r.isBuffer(t)||r.isStream(t)||r.isFile(t)||r.isBlob(t))return t;if(r.isArrayBufferView(t))return t.buffer;if(r.isURLSearchParams(t))return u(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString();var n,o=r.isObject(t),s=e&&e["Content-Type"];if((n=r.isFileList(t))||o&&"multipart/form-data"===s){var c=this.env&&this.env.FormData;return a(n?{"files[]":t}:t,c&&new c)}return o||"application/json"===s?(u(e,"application/json"),function(t,e,n){if(r.isString(t))try{return(e||JSON.parse)(t),r.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(n||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var e=this.transitional||l.transitional,n=e&&e.silentJSONParsing,i=e&&e.forcedJSONParsing,s=!n&&"json"===this.responseType;if(s||i&&r.isString(t)&&t.length)try{return JSON.parse(t)}catch(t){if(s){if("SyntaxError"===t.name)throw o.from(t,o.ERR_BAD_RESPONSE,this,null,this.response);throw t}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:n(1623)},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};r.forEach(["delete","get","head"],(function(t){l.headers[t]={}})),r.forEach(["post","put","patch"],(function(t){l.headers[t]=r.merge(c)})),t.exports=l},7874:t=>{"use strict";t.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}},7288:t=>{t.exports={version:"0.27.2"}},1849:t=>{"use strict";t.exports=function(t,e){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return t.apply(e,n)}}},5327:(t,e,n)=>{"use strict";var r=n(4867);function i(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}t.exports=function(t,e,n){if(!e)return t;var o;if(n)o=n(e);else if(r.isURLSearchParams(e))o=e.toString();else{var s=[];r.forEach(e,(function(t,e){null!=t&&(r.isArray(t)?e+="[]":t=[t],r.forEach(t,(function(t){r.isDate(t)?t=t.toISOString():r.isObject(t)&&(t=JSON.stringify(t)),s.push(i(e)+"="+i(t))})))})),o=s.join("&")}if(o){var a=t.indexOf("#");-1!==a&&(t=t.slice(0,a)),t+=(-1===t.indexOf("?")?"?":"&")+o}return t}},7303:t=>{"use strict";t.exports=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}},4372:(t,e,n)=>{"use strict";var r=n(4867);t.exports=r.isStandardBrowserEnv()?{write:function(t,e,n,i,o,s){var a=[];a.push(t+"="+encodeURIComponent(e)),r.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.isString(i)&&a.push("path="+i),r.isString(o)&&a.push("domain="+o),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},1793:t=>{"use strict";t.exports=function(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}},6268:(t,e,n)=>{"use strict";var r=n(4867);t.exports=function(t){return r.isObject(t)&&!0===t.isAxiosError}},7985:(t,e,n)=>{"use strict";var r=n(4867);t.exports=r.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(t){var r=t;return e&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return t=i(window.location.href),function(e){var n=r.isString(e)?i(e):e;return n.protocol===t.protocol&&n.host===t.host}}():function(){return!0}},6016:(t,e,n)=>{"use strict";var r=n(4867);t.exports=function(t,e){r.forEach(t,(function(n,r){r!==e&&r.toUpperCase()===e.toUpperCase()&&(t[e]=n,delete t[r])}))}},1623:t=>{t.exports=null},4109:(t,e,n)=>{"use strict";var r=n(4867),i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];t.exports=function(t){var e,n,o,s={};return t?(r.forEach(t.split("\n"),(function(t){if(o=t.indexOf(":"),e=r.trim(t.substr(0,o)).toLowerCase(),n=r.trim(t.substr(o+1)),e){if(s[e]&&i.indexOf(e)>=0)return;s[e]="set-cookie"===e?(s[e]?s[e]:[]).concat([n]):s[e]?s[e]+", "+n:n}})),s):s}},205:t=>{"use strict";t.exports=function(t){var e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}},8713:t=>{"use strict";t.exports=function(t){return function(e){return t.apply(null,e)}}},7675:(t,e,n)=>{"use strict";var r=n(4867);t.exports=function(t,e){e=e||new FormData;var n=[];function i(t){return null===t?"":r.isDate(t)?t.toISOString():r.isArrayBuffer(t)||r.isTypedArray(t)?"function"==typeof Blob?new Blob([t]):Buffer.from(t):t}return function t(o,s){if(r.isPlainObject(o)||r.isArray(o)){if(-1!==n.indexOf(o))throw Error("Circular reference detected in "+s);n.push(o),r.forEach(o,(function(n,o){if(!r.isUndefined(n)){var a,c=s?s+"."+o:o;if(n&&!s&&"object"==typeof n)if(r.endsWith(o,"{}"))n=JSON.stringify(n);else if(r.endsWith(o,"[]")&&(a=r.toArray(n)))return void a.forEach((function(t){!r.isUndefined(t)&&e.append(c,i(t))}));t(n,c)}})),n.pop()}else e.append(s,i(o))}(t),e}},4875:(t,e,n)=>{"use strict";var r=n(7288).version,i=n(2648),o={};["object","boolean","number","function","string","symbol"].forEach((function(t,e){o[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}}));var s={};o.transitional=function(t,e,n){function o(t,e){return"[Axios v"+r+"] Transitional option '"+t+"'"+e+(n?". "+n:"")}return function(n,r,a){if(!1===t)throw new i(o(r," has been removed"+(e?" in "+e:"")),i.ERR_DEPRECATED);return e&&!s[r]&&(s[r]=!0,console.warn(o(r," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(n,r,a)}},t.exports={assertOptions:function(t,e,n){if("object"!=typeof t)throw new i("options must be an object",i.ERR_BAD_OPTION_VALUE);for(var r=Object.keys(t),o=r.length;o-- >0;){var s=r[o],a=e[s];if(a){var c=t[s],u=void 0===c||a(c,s,t);if(!0!==u)throw new i("option "+s+" must be "+u,i.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new i("Unknown option "+s,i.ERR_BAD_OPTION)}},validators:o}},4867:(t,e,n)=>{"use strict";var r,i=n(1849),o=Object.prototype.toString,s=(r=Object.create(null),function(t){var e=o.call(t);return r[e]||(r[e]=e.slice(8,-1).toLowerCase())});function a(t){return t=t.toLowerCase(),function(e){return s(e)===t}}function c(t){return Array.isArray(t)}function u(t){return void 0===t}var d=a("ArrayBuffer");function l(t){return null!==t&&"object"==typeof t}function h(t){if("object"!==s(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}var p=a("Date"),f=a("File"),g=a("Blob"),v=a("FileList");function m(t){return"[object Function]"===o.call(t)}var _=a("URLSearchParams");function S(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),c(t))for(var n=0,r=t.length;n<r;n++)e.call(null,t[n],n,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}var E,y=(E="undefined"!=typeof Uint8Array&&Object.getPrototypeOf(Uint8Array),function(t){return E&&t instanceof E});t.exports={isArray:c,isArrayBuffer:d,isBuffer:function(t){return null!==t&&!u(t)&&null!==t.constructor&&!u(t.constructor)&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},isFormData:function(t){var e="[object FormData]";return t&&("function"==typeof FormData&&t instanceof FormData||o.call(t)===e||m(t.toString)&&t.toString()===e)},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&d(t.buffer)},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:l,isPlainObject:h,isUndefined:u,isDate:p,isFile:f,isBlob:g,isFunction:m,isStream:function(t){return l(t)&&m(t.pipe)},isURLSearchParams:_,isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:S,merge:function t(){var e={};function n(n,r){h(e[r])&&h(n)?e[r]=t(e[r],n):h(n)?e[r]=t({},n):c(n)?e[r]=n.slice():e[r]=n}for(var r=0,i=arguments.length;r<i;r++)S(arguments[r],n);return e},extend:function(t,e,n){return S(e,(function(e,r){t[r]=n&&"function"==typeof e?i(e,n):e})),t},trim:function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")},stripBOM:function(t){return 65279===t.charCodeAt(0)&&(t=t.slice(1)),t},inherits:function(t,e,n,r){t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,n&&Object.assign(t.prototype,n)},toFlatObject:function(t,e,n){var r,i,o,s={};e=e||{};do{for(i=(r=Object.getOwnPropertyNames(t)).length;i-- >0;)s[o=r[i]]||(e[o]=t[o],s[o]=!0);t=Object.getPrototypeOf(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},kindOf:s,kindOfTest:a,endsWith:function(t,e,n){t=String(t),(void 0===n||n>t.length)&&(n=t.length),n-=e.length;var r=t.indexOf(e,n);return-1!==r&&r===n},toArray:function(t){if(!t)return null;var e=t.length;if(u(e))return null;for(var n=new Array(e);e-- >0;)n[e]=t[e];return n},isTypedArray:y,isFileList:v}},1206:function(t){t.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=90)}({17:function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;var r=n(18),i=function(){function t(){}return t.getFirstMatch=function(t,e){var n=e.match(t);return n&&n.length>0&&n[1]||""},t.getSecondMatch=function(t,e){var n=e.match(t);return n&&n.length>1&&n[2]||""},t.matchAndReturnConst=function(t,e,n){if(t.test(e))return n},t.getWindowsVersionName=function(t){switch(t){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},t.getMacOSVersionName=function(t){var e=t.split(".").splice(0,2).map((function(t){return parseInt(t,10)||0}));if(e.push(0),10===e[0])switch(e[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},t.getAndroidVersionName=function(t){var e=t.split(".").splice(0,2).map((function(t){return parseInt(t,10)||0}));if(e.push(0),!(1===e[0]&&e[1]<5))return 1===e[0]&&e[1]<6?"Cupcake":1===e[0]&&e[1]>=6?"Donut":2===e[0]&&e[1]<2?"Eclair":2===e[0]&&2===e[1]?"Froyo":2===e[0]&&e[1]>2?"Gingerbread":3===e[0]?"Honeycomb":4===e[0]&&e[1]<1?"Ice Cream Sandwich":4===e[0]&&e[1]<4?"Jelly Bean":4===e[0]&&e[1]>=4?"KitKat":5===e[0]?"Lollipop":6===e[0]?"Marshmallow":7===e[0]?"Nougat":8===e[0]?"Oreo":9===e[0]?"Pie":void 0},t.getVersionPrecision=function(t){return t.split(".").length},t.compareVersions=function(e,n,r){void 0===r&&(r=!1);var i=t.getVersionPrecision(e),o=t.getVersionPrecision(n),s=Math.max(i,o),a=0,c=t.map([e,n],(function(e){var n=s-t.getVersionPrecision(e),r=e+new Array(n+1).join(".0");return t.map(r.split("."),(function(t){return new Array(20-t.length).join("0")+t})).reverse()}));for(r&&(a=s-Math.min(i,o)),s-=1;s>=a;){if(c[0][s]>c[1][s])return 1;if(c[0][s]===c[1][s]){if(s===a)return 0;s-=1}else if(c[0][s]<c[1][s])return-1}},t.map=function(t,e){var n,r=[];if(Array.prototype.map)return Array.prototype.map.call(t,e);for(n=0;n<t.length;n+=1)r.push(e(t[n]));return r},t.find=function(t,e){var n,r;if(Array.prototype.find)return Array.prototype.find.call(t,e);for(n=0,r=t.length;n<r;n+=1){var i=t[n];if(e(i,n))return i}},t.assign=function(t){for(var e,n,r=t,i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];if(Object.assign)return Object.assign.apply(Object,[t].concat(o));var a=function(){var t=o[e];"object"==typeof t&&null!==t&&Object.keys(t).forEach((function(e){r[e]=t[e]}))};for(e=0,n=o.length;e<n;e+=1)a();return t},t.getBrowserAlias=function(t){return r.BROWSER_ALIASES_MAP[t]},t.getBrowserTypeByAlias=function(t){return r.BROWSER_MAP[t]||""},t}();e.default=i,t.exports=e.default},18:function(t,e,n){"use strict";e.__esModule=!0,e.ENGINE_MAP=e.OS_MAP=e.PLATFORMS_MAP=e.BROWSER_MAP=e.BROWSER_ALIASES_MAP=void 0,e.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},e.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},e.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},e.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},e.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;var r,i=(r=n(91))&&r.__esModule?r:{default:r},o=n(18);function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var a=function(){function t(){}var e,n,r;return t.getParser=function(t,e){if(void 0===e&&(e=!1),"string"!=typeof t)throw new Error("UserAgent should be a string");return new i.default(t,e)},t.parse=function(t){return new i.default(t).getResult()},e=t,r=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}],(n=null)&&s(e.prototype,n),r&&s(e,r),t}();e.default=a,t.exports=e.default},91:function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;var r=c(n(92)),i=c(n(93)),o=c(n(94)),s=c(n(95)),a=c(n(17));function c(t){return t&&t.__esModule?t:{default:t}}var u=function(){function t(t,e){if(void 0===e&&(e=!1),null==t||""===t)throw new Error("UserAgent parameter can't be empty");this._ua=t,this.parsedResult={},!0!==e&&this.parse()}var e=t.prototype;return e.getUA=function(){return this._ua},e.test=function(t){return t.test(this._ua)},e.parseBrowser=function(){var t=this;this.parsedResult.browser={};var e=a.default.find(r.default,(function(e){if("function"==typeof e.test)return e.test(t);if(e.test instanceof Array)return e.test.some((function(e){return t.test(e)}));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.browser=e.describe(this.getUA())),this.parsedResult.browser},e.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},e.getBrowserName=function(t){return t?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},e.getBrowserVersion=function(){return this.getBrowser().version},e.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},e.parseOS=function(){var t=this;this.parsedResult.os={};var e=a.default.find(i.default,(function(e){if("function"==typeof e.test)return e.test(t);if(e.test instanceof Array)return e.test.some((function(e){return t.test(e)}));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.os=e.describe(this.getUA())),this.parsedResult.os},e.getOSName=function(t){var e=this.getOS().name;return t?String(e).toLowerCase()||"":e||""},e.getOSVersion=function(){return this.getOS().version},e.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},e.getPlatformType=function(t){void 0===t&&(t=!1);var e=this.getPlatform().type;return t?String(e).toLowerCase()||"":e||""},e.parsePlatform=function(){var t=this;this.parsedResult.platform={};var e=a.default.find(o.default,(function(e){if("function"==typeof e.test)return e.test(t);if(e.test instanceof Array)return e.test.some((function(e){return t.test(e)}));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.platform=e.describe(this.getUA())),this.parsedResult.platform},e.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},e.getEngineName=function(t){return t?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},e.parseEngine=function(){var t=this;this.parsedResult.engine={};var e=a.default.find(s.default,(function(e){if("function"==typeof e.test)return e.test(t);if(e.test instanceof Array)return e.test.some((function(e){return t.test(e)}));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.engine=e.describe(this.getUA())),this.parsedResult.engine},e.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},e.getResult=function(){return a.default.assign({},this.parsedResult)},e.satisfies=function(t){var e=this,n={},r=0,i={},o=0;if(Object.keys(t).forEach((function(e){var s=t[e];"string"==typeof s?(i[e]=s,o+=1):"object"==typeof s&&(n[e]=s,r+=1)})),r>0){var s=Object.keys(n),c=a.default.find(s,(function(t){return e.isOS(t)}));if(c){var u=this.satisfies(n[c]);if(void 0!==u)return u}var d=a.default.find(s,(function(t){return e.isPlatform(t)}));if(d){var l=this.satisfies(n[d]);if(void 0!==l)return l}}if(o>0){var h=Object.keys(i),p=a.default.find(h,(function(t){return e.isBrowser(t,!0)}));if(void 0!==p)return this.compareVersion(i[p])}},e.isBrowser=function(t,e){void 0===e&&(e=!1);var n=this.getBrowserName().toLowerCase(),r=t.toLowerCase(),i=a.default.getBrowserTypeByAlias(r);return e&&i&&(r=i.toLowerCase()),r===n},e.compareVersion=function(t){var e=[0],n=t,r=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===t[0]||"<"===t[0]?(n=t.substr(1),"="===t[1]?(r=!0,n=t.substr(2)):e=[],">"===t[0]?e.push(1):e.push(-1)):"="===t[0]?n=t.substr(1):"~"===t[0]&&(r=!0,n=t.substr(1)),e.indexOf(a.default.compareVersions(i,n,r))>-1},e.isOS=function(t){return this.getOSName(!0)===String(t).toLowerCase()},e.isPlatform=function(t){return this.getPlatformType(!0)===String(t).toLowerCase()},e.isEngine=function(t){return this.getEngineName(!0)===String(t).toLowerCase()},e.is=function(t,e){return void 0===e&&(e=!1),this.isBrowser(t,e)||this.isOS(t)||this.isPlatform(t)},e.some=function(t){var e=this;return void 0===t&&(t=[]),t.some((function(t){return e.is(t)}))},t}();e.default=u,t.exports=e.default},92:function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=/version\/(\d+(\.?_?\d+)+)/i,s=[{test:[/googlebot/i],describe:function(t){var e={name:"Googlebot"},n=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/opera/i],describe:function(t){var e={name:"Opera"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/opr\/|opios/i],describe:function(t){var e={name:"Opera"},n=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/SamsungBrowser/i],describe:function(t){var e={name:"Samsung Internet for Android"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/Whale/i],describe:function(t){var e={name:"NAVER Whale Browser"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/MZBrowser/i],describe:function(t){var e={name:"MZ Browser"},n=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/focus/i],describe:function(t){var e={name:"Focus"},n=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/swing/i],describe:function(t){var e={name:"Swing"},n=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/coast/i],describe:function(t){var e={name:"Opera Coast"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(t){var e={name:"Opera Touch"},n=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/yabrowser/i],describe:function(t){var e={name:"Yandex Browser"},n=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/ucbrowser/i],describe:function(t){var e={name:"UC Browser"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/Maxthon|mxios/i],describe:function(t){var e={name:"Maxthon"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/epiphany/i],describe:function(t){var e={name:"Epiphany"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/puffin/i],describe:function(t){var e={name:"Puffin"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sleipnir/i],describe:function(t){var e={name:"Sleipnir"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/k-meleon/i],describe:function(t){var e={name:"K-Meleon"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/micromessenger/i],describe:function(t){var e={name:"WeChat"},n=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/qqbrowser/i],describe:function(t){var e={name:/qqbrowserlite/i.test(t)?"QQ Browser Lite":"QQ Browser"},n=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/msie|trident/i],describe:function(t){var e={name:"Internet Explorer"},n=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/\sedg\//i],describe:function(t){var e={name:"Microsoft Edge"},n=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/edg([ea]|ios)/i],describe:function(t){var e={name:"Microsoft Edge"},n=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/vivaldi/i],describe:function(t){var e={name:"Vivaldi"},n=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/seamonkey/i],describe:function(t){var e={name:"SeaMonkey"},n=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sailfish/i],describe:function(t){var e={name:"Sailfish"},n=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,t);return n&&(e.version=n),e}},{test:[/silk/i],describe:function(t){var e={name:"Amazon Silk"},n=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/phantom/i],describe:function(t){var e={name:"PhantomJS"},n=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/slimerjs/i],describe:function(t){var e={name:"SlimerJS"},n=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(t){var e={name:"BlackBerry"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/(web|hpw)[o0]s/i],describe:function(t){var e={name:"WebOS Browser"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/bada/i],describe:function(t){var e={name:"Bada"},n=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/tizen/i],describe:function(t){var e={name:"Tizen"},n=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/qupzilla/i],describe:function(t){var e={name:"QupZilla"},n=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/firefox|iceweasel|fxios/i],describe:function(t){var e={name:"Firefox"},n=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/electron/i],describe:function(t){var e={name:"Electron"},n=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/MiuiBrowser/i],describe:function(t){var e={name:"Miui"},n=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/chromium/i],describe:function(t){var e={name:"Chromium"},n=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/chrome|crios|crmo/i],describe:function(t){var e={name:"Chrome"},n=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/GSA/i],describe:function(t){var e={name:"Google Search"},n=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:function(t){var e=!t.test(/like android/i),n=t.test(/android/i);return e&&n},describe:function(t){var e={name:"Android Browser"},n=i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/playstation 4/i],describe:function(t){var e={name:"PlayStation 4"},n=i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/safari|applewebkit/i],describe:function(t){var e={name:"Safari"},n=i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/.*/i],describe:function(t){var e=-1!==t.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(e,t),version:i.default.getSecondMatch(e,t)}}}];e.default=s,t.exports=e.default},93:function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/Roku\/DVP/],describe:function(t){var e=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,t);return{name:o.OS_MAP.Roku,version:e}}},{test:[/windows phone/i],describe:function(t){var e=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,t);return{name:o.OS_MAP.WindowsPhone,version:e}}},{test:[/windows /i],describe:function(t){var e=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,t),n=i.default.getWindowsVersionName(e);return{name:o.OS_MAP.Windows,version:e,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(t){var e={name:o.OS_MAP.iOS},n=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,t);return n&&(e.version=n),e}},{test:[/macintosh/i],describe:function(t){var e=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,t).replace(/[_\s]/g,"."),n=i.default.getMacOSVersionName(e),r={name:o.OS_MAP.MacOS,version:e};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe:function(t){var e=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,t).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:e}}},{test:function(t){var e=!t.test(/like android/i),n=t.test(/android/i);return e&&n},describe:function(t){var e=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,t),n=i.default.getAndroidVersionName(e),r={name:o.OS_MAP.Android,version:e};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe:function(t){var e=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,t),n={name:o.OS_MAP.WebOS};return e&&e.length&&(n.version=e),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(t){var e=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,t)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,t)||i.default.getFirstMatch(/\bbb(\d+)/i,t);return{name:o.OS_MAP.BlackBerry,version:e}}},{test:[/bada/i],describe:function(t){var e=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,t);return{name:o.OS_MAP.Bada,version:e}}},{test:[/tizen/i],describe:function(t){var e=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,t);return{name:o.OS_MAP.Tizen,version:e}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(t){var e=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,t);return{name:o.OS_MAP.PlayStation4,version:e}}}];e.default=s,t.exports=e.default},94:function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(t){var e=i.default.getFirstMatch(/(can-l01)/i,t)&&"Nova",n={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return e&&(n.model=e),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(t){var e=t.test(/ipod|iphone/i),n=t.test(/like (ipod|iphone)/i);return e&&!n},describe:function(t){var e=i.default.getFirstMatch(/(ipod|iphone)/i,t);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:e}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(t){return"blackberry"===t.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(t){return"bada"===t.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(t){return"windows phone"===t.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(t){var e=Number(String(t.getOSVersion()).split(".")[0]);return"android"===t.getOSName(!0)&&e>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(t){return"android"===t.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(t){return"macos"===t.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(t){return"windows"===t.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(t){return"linux"===t.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(t){return"playstation 4"===t.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(t){return"roku"===t.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];e.default=s,t.exports=e.default},95:function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:function(t){return"microsoft edge"===t.getBrowserName(!0)},describe:function(t){if(/\sedg\//i.test(t))return{name:o.ENGINE_MAP.Blink};var e=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,t);return{name:o.ENGINE_MAP.EdgeHTML,version:e}}},{test:[/trident/i],describe:function(t){var e={name:o.ENGINE_MAP.Trident},n=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:function(t){return t.test(/presto/i)},describe:function(t){var e={name:o.ENGINE_MAP.Presto},n=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:function(t){var e=t.test(/gecko/i),n=t.test(/like gecko/i);return e&&!n},describe:function(t){var e={name:o.ENGINE_MAP.Gecko},n=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(t){var e={name:o.ENGINE_MAP.WebKit},n=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}}];e.default=s,t.exports=e.default}})},6729:t=>{"use strict";var e=Object.prototype.hasOwnProperty,n="~";function r(){}function i(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function o(t,e,r,o,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new i(r,o||t,s),c=n?n+e:e;return t._events[c]?t._events[c].fn?t._events[c]=[t._events[c],a]:t._events[c].push(a):(t._events[c]=a,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),a.prototype.eventNames=function(){var t,r,i=[];if(0===this._eventsCount)return i;for(r in t=this._events)e.call(t,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},a.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,s=new Array(o);i<o;i++)s[i]=r[i].fn;return s},a.prototype.listenerCount=function(t){var e=n?n+t:t,r=this._events[e];return r?r.fn?1:r.length:0},a.prototype.emit=function(t,e,r,i,o,s){var a=n?n+t:t;if(!this._events[a])return!1;var c,u,d=this._events[a],l=arguments.length;if(d.fn){switch(d.once&&this.removeListener(t,d.fn,void 0,!0),l){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,e),!0;case 3:return d.fn.call(d.context,e,r),!0;case 4:return d.fn.call(d.context,e,r,i),!0;case 5:return d.fn.call(d.context,e,r,i,o),!0;case 6:return d.fn.call(d.context,e,r,i,o,s),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];d.fn.apply(d.context,c)}else{var h,p=d.length;for(u=0;u<p;u++)switch(d[u].once&&this.removeListener(t,d[u].fn,void 0,!0),l){case 1:d[u].fn.call(d[u].context);break;case 2:d[u].fn.call(d[u].context,e);break;case 3:d[u].fn.call(d[u].context,e,r);break;case 4:d[u].fn.call(d[u].context,e,r,i);break;default:if(!c)for(h=1,c=new Array(l-1);h<l;h++)c[h-1]=arguments[h];d[u].fn.apply(d[u].context,c)}}return!0},a.prototype.on=function(t,e,n){return o(this,t,e,n,!1)},a.prototype.once=function(t,e,n){return o(this,t,e,n,!0)},a.prototype.removeListener=function(t,e,r,i){var o=n?n+t:t;if(!this._events[o])return this;if(!e)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==e||i&&!a.once||r&&a.context!==r||s(this,o);else{for(var c=0,u=[],d=a.length;c<d;c++)(a[c].fn!==e||i&&!a[c].once||r&&a[c].context!==r)&&u.push(a[c]);u.length?this._events[o]=1===u.length?u[0]:u:s(this,o)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&s(this,e)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,t.exports=a},1989:(t,e,n)=>{var r=n(1789),i=n(401),o=n(7667),s=n(1327),a=n(1866);function c(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=o,c.prototype.has=s,c.prototype.set=a,t.exports=c},8407:(t,e,n)=>{var r=n(7040),i=n(4125),o=n(2117),s=n(7518),a=n(4705);function c(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=o,c.prototype.has=s,c.prototype.set=a,t.exports=c},7071:(t,e,n)=>{var r=n(852)(n(5639),"Map");t.exports=r},3369:(t,e,n)=>{var r=n(4785),i=n(1285),o=n(6e3),s=n(9916),a=n(5265);function c(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=o,c.prototype.has=s,c.prototype.set=a,t.exports=c},6384:(t,e,n)=>{var r=n(8407),i=n(7465),o=n(3779),s=n(7599),a=n(4758),c=n(4309);function u(t){var e=this.__data__=new r(t);this.size=e.size}u.prototype.clear=i,u.prototype.delete=o,u.prototype.get=s,u.prototype.has=a,u.prototype.set=c,t.exports=u},2705:(t,e,n)=>{var r=n(5639).Symbol;t.exports=r},1149:(t,e,n)=>{var r=n(5639).Uint8Array;t.exports=r},6874:t=>{t.exports=function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}},4636:(t,e,n)=>{var r=n(2545),i=n(5694),o=n(1469),s=n(4144),a=n(5776),c=n(6719),u=Object.prototype.hasOwnProperty;t.exports=function(t,e){var n=o(t),d=!n&&i(t),l=!n&&!d&&s(t),h=!n&&!d&&!l&&c(t),p=n||d||l||h,f=p?r(t.length,String):[],g=f.length;for(var v in t)!e&&!u.call(t,v)||p&&("length"==v||l&&("offset"==v||"parent"==v)||h&&("buffer"==v||"byteLength"==v||"byteOffset"==v)||a(v,g))||f.push(v);return f}},6556:(t,e,n)=>{var r=n(9465),i=n(7813);t.exports=function(t,e,n){(void 0!==n&&!i(t[e],n)||void 0===n&&!(e in t))&&r(t,e,n)}},4865:(t,e,n)=>{var r=n(9465),i=n(7813),o=Object.prototype.hasOwnProperty;t.exports=function(t,e,n){var s=t[e];o.call(t,e)&&i(s,n)&&(void 0!==n||e in t)||r(t,e,n)}},8470:(t,e,n)=>{var r=n(7813);t.exports=function(t,e){for(var n=t.length;n--;)if(r(t[n][0],e))return n;return-1}},9465:(t,e,n)=>{var r=n(8777);t.exports=function(t,e,n){"__proto__"==e&&r?r(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}},3118:(t,e,n)=>{var r=n(3218),i=Object.create,o=function(){function t(){}return function(e){if(!r(e))return{};if(i)return i(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();t.exports=o},8483:(t,e,n)=>{var r=n(5063)();t.exports=r},4239:(t,e,n)=>{var r=n(2705),i=n(9607),o=n(2333),s="[object Null]",a="[object Undefined]",c=r?r.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?a:s:c&&c in Object(t)?i(t):o(t)}},9454:(t,e,n)=>{var r=n(4239),i=n(7005),o="[object Arguments]";t.exports=function(t){return i(t)&&r(t)==o}},8458:(t,e,n)=>{var r=n(3560),i=n(5346),o=n(3218),s=n(346),a=/^\[object .+?Constructor\]$/,c=Function.prototype,u=Object.prototype,d=c.toString,l=u.hasOwnProperty,h=RegExp("^"+d.call(l).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!o(t)||i(t))&&(r(t)?h:a).test(s(t))}},8749:(t,e,n)=>{var r=n(4239),i=n(1780),o=n(7005),s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1,t.exports=function(t){return o(t)&&i(t.length)&&!!s[r(t)]}},313:(t,e,n)=>{var r=n(3218),i=n(5726),o=n(3498),s=Object.prototype.hasOwnProperty;t.exports=function(t){if(!r(t))return o(t);var e=i(t),n=[];for(var a in t)("constructor"!=a||!e&&s.call(t,a))&&n.push(a);return n}},2980:(t,e,n)=>{var r=n(6384),i=n(6556),o=n(8483),s=n(9783),a=n(3218),c=n(1704),u=n(6390);t.exports=function t(e,n,d,l,h){e!==n&&o(n,(function(o,c){if(h||(h=new r),a(o))s(e,n,c,d,t,l,h);else{var p=l?l(u(e,c),o,c+"",e,n,h):void 0;void 0===p&&(p=o),i(e,c,p)}}),c)}},9783:(t,e,n)=>{var r=n(6556),i=n(4626),o=n(7133),s=n(278),a=n(8517),c=n(5694),u=n(1469),d=n(9246),l=n(4144),h=n(3560),p=n(3218),f=n(8630),g=n(6719),v=n(6390),m=n(9881);t.exports=function(t,e,n,_,S,E,y){var b=v(t,n),C=v(e,n),T=y.get(C);if(T)r(t,n,T);else{var w=E?E(b,C,n+"",t,e,y):void 0,I=void 0===w;if(I){var k=u(C),R=!k&&l(C),P=!k&&!R&&g(C);w=C,k||R||P?u(b)?w=b:d(b)?w=s(b):R?(I=!1,w=i(C,!0)):P?(I=!1,w=o(C,!0)):w=[]:f(C)||c(C)?(w=b,c(b)?w=m(b):p(b)&&!h(b)||(w=a(C))):I=!1}I&&(y.set(C,w),S(w,C,_,E,y),y.delete(C)),r(t,n,w)}}},5976:(t,e,n)=>{var r=n(6557),i=n(5357),o=n(61);t.exports=function(t,e){return o(i(t,e,r),t+"")}},6560:(t,e,n)=>{var r=n(5703),i=n(8777),o=n(6557),s=i?function(t,e){return i(t,"toString",{configurable:!0,enumerable:!1,value:r(e),writable:!0})}:o;t.exports=s},2545:t=>{t.exports=function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}},1717:t=>{t.exports=function(t){return function(e){return t(e)}}},4318:(t,e,n)=>{var r=n(1149);t.exports=function(t){var e=new t.constructor(t.byteLength);return new r(e).set(new r(t)),e}},4626:(t,e,n)=>{t=n.nmd(t);var r=n(5639),i=e&&!e.nodeType&&e,o=i&&t&&!t.nodeType&&t,s=o&&o.exports===i?r.Buffer:void 0,a=s?s.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var n=t.length,r=a?a(n):new t.constructor(n);return t.copy(r),r}},7133:(t,e,n)=>{var r=n(4318);t.exports=function(t,e){var n=e?r(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}},278:t=>{t.exports=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}},8363:(t,e,n)=>{var r=n(4865),i=n(9465);t.exports=function(t,e,n,o){var s=!n;n||(n={});for(var a=-1,c=e.length;++a<c;){var u=e[a],d=o?o(n[u],t[u],u,n,t):void 0;void 0===d&&(d=t[u]),s?i(n,u,d):r(n,u,d)}return n}},4429:(t,e,n)=>{var r=n(5639)["__core-js_shared__"];t.exports=r},1463:(t,e,n)=>{var r=n(5976),i=n(6612);t.exports=function(t){return r((function(e,n){var r=-1,o=n.length,s=o>1?n[o-1]:void 0,a=o>2?n[2]:void 0;for(s=t.length>3&&"function"==typeof s?(o--,s):void 0,a&&i(n[0],n[1],a)&&(s=o<3?void 0:s,o=1),e=Object(e);++r<o;){var c=n[r];c&&t(e,c,r,s)}return e}))}},5063:t=>{t.exports=function(t){return function(e,n,r){for(var i=-1,o=Object(e),s=r(e),a=s.length;a--;){var c=s[t?a:++i];if(!1===n(o[c],c,o))break}return e}}},8777:(t,e,n)=>{var r=n(852),i=function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=i},1957:(t,e,n)=>{var r="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;t.exports=r},5050:(t,e,n)=>{var r=n(7019);t.exports=function(t,e){var n=t.__data__;return r(e)?n["string"==typeof e?"string":"hash"]:n.map}},852:(t,e,n)=>{var r=n(8458),i=n(7801);t.exports=function(t,e){var n=i(t,e);return r(n)?n:void 0}},5924:(t,e,n)=>{var r=n(5569)(Object.getPrototypeOf,Object);t.exports=r},9607:(t,e,n)=>{var r=n(2705),i=Object.prototype,o=i.hasOwnProperty,s=i.toString,a=r?r.toStringTag:void 0;t.exports=function(t){var e=o.call(t,a),n=t[a];try{t[a]=void 0;var r=!0}catch(t){}var i=s.call(t);return r&&(e?t[a]=n:delete t[a]),i}},7801:t=>{t.exports=function(t,e){return null==t?void 0:t[e]}},1789:(t,e,n)=>{var r=n(4536);t.exports=function(){this.__data__=r?r(null):{},this.size=0}},401:t=>{t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},7667:(t,e,n)=>{var r=n(4536),i="__lodash_hash_undefined__",o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(r){var n=e[t];return n===i?void 0:n}return o.call(e,t)?e[t]:void 0}},1327:(t,e,n)=>{var r=n(4536),i=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return r?void 0!==e[t]:i.call(e,t)}},1866:(t,e,n)=>{var r=n(4536),i="__lodash_hash_undefined__";t.exports=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=r&&void 0===e?i:e,this}},8517:(t,e,n)=>{var r=n(3118),i=n(5924),o=n(5726);t.exports=function(t){return"function"!=typeof t.constructor||o(t)?{}:r(i(t))}},5776:t=>{var e=9007199254740991,n=/^(?:0|[1-9]\d*)$/;t.exports=function(t,r){var i=typeof t;return!!(r=null==r?e:r)&&("number"==i||"symbol"!=i&&n.test(t))&&t>-1&&t%1==0&&t<r}},6612:(t,e,n)=>{var r=n(7813),i=n(8612),o=n(5776),s=n(3218);t.exports=function(t,e,n){if(!s(n))return!1;var a=typeof e;return!!("number"==a?i(n)&&o(e,n.length):"string"==a&&e in n)&&r(n[e],t)}},7019:t=>{t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},5346:(t,e,n)=>{var r,i=n(4429),o=(r=/[^.]+$/.exec(i&&i.keys&&i.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";t.exports=function(t){return!!o&&o in t}},5726:t=>{var e=Object.prototype;t.exports=function(t){var n=t&&t.constructor;return t===("function"==typeof n&&n.prototype||e)}},7040:t=>{t.exports=function(){this.__data__=[],this.size=0}},4125:(t,e,n)=>{var r=n(8470),i=Array.prototype.splice;t.exports=function(t){var e=this.__data__,n=r(e,t);return!(n<0)&&(n==e.length-1?e.pop():i.call(e,n,1),--this.size,!0)}},2117:(t,e,n)=>{var r=n(8470);t.exports=function(t){var e=this.__data__,n=r(e,t);return n<0?void 0:e[n][1]}},7518:(t,e,n)=>{var r=n(8470);t.exports=function(t){return r(this.__data__,t)>-1}},4705:(t,e,n)=>{var r=n(8470);t.exports=function(t,e){var n=this.__data__,i=r(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this}},4785:(t,e,n)=>{var r=n(1989),i=n(8407),o=n(7071);t.exports=function(){this.size=0,this.__data__={hash:new r,map:new(o||i),string:new r}}},1285:(t,e,n)=>{var r=n(5050);t.exports=function(t){var e=r(this,t).delete(t);return this.size-=e?1:0,e}},6e3:(t,e,n)=>{var r=n(5050);t.exports=function(t){return r(this,t).get(t)}},9916:(t,e,n)=>{var r=n(5050);t.exports=function(t){return r(this,t).has(t)}},5265:(t,e,n)=>{var r=n(5050);t.exports=function(t,e){var n=r(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this}},4536:(t,e,n)=>{var r=n(852)(Object,"create");t.exports=r},3498:t=>{t.exports=function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}},1167:(t,e,n)=>{t=n.nmd(t);var r=n(1957),i=e&&!e.nodeType&&e,o=i&&t&&!t.nodeType&&t,s=o&&o.exports===i&&r.process,a=function(){try{var t=o&&o.require&&o.require("util").types;return t||s&&s.binding&&s.binding("util")}catch(t){}}();t.exports=a},2333:t=>{var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},5569:t=>{t.exports=function(t,e){return function(n){return t(e(n))}}},5357:(t,e,n)=>{var r=n(6874),i=Math.max;t.exports=function(t,e,n){return e=i(void 0===e?t.length-1:e,0),function(){for(var o=arguments,s=-1,a=i(o.length-e,0),c=Array(a);++s<a;)c[s]=o[e+s];s=-1;for(var u=Array(e+1);++s<e;)u[s]=o[s];return u[e]=n(c),r(t,this,u)}}},5639:(t,e,n)=>{var r=n(1957),i="object"==typeof self&&self&&self.Object===Object&&self,o=r||i||Function("return this")();t.exports=o},6390:t=>{t.exports=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}},61:(t,e,n)=>{var r=n(6560),i=n(1275)(r);t.exports=i},1275:t=>{var e=800,n=16,r=Date.now;t.exports=function(t){var i=0,o=0;return function(){var s=r(),a=n-(s-o);if(o=s,a>0){if(++i>=e)return arguments[0]}else i=0;return t.apply(void 0,arguments)}}},7465:(t,e,n)=>{var r=n(8407);t.exports=function(){this.__data__=new r,this.size=0}},3779:t=>{t.exports=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}},7599:t=>{t.exports=function(t){return this.__data__.get(t)}},4758:t=>{t.exports=function(t){return this.__data__.has(t)}},4309:(t,e,n)=>{var r=n(8407),i=n(7071),o=n(3369),s=200;t.exports=function(t,e){var n=this.__data__;if(n instanceof r){var a=n.__data__;if(!i||a.length<s-1)return a.push([t,e]),this.size=++n.size,this;n=this.__data__=new o(a)}return n.set(t,e),this.size=n.size,this}},346:t=>{var e=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return e.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},5703:t=>{t.exports=function(t){return function(){return t}}},7813:t=>{t.exports=function(t,e){return t===e||t!=t&&e!=e}},6557:t=>{t.exports=function(t){return t}},5694:(t,e,n)=>{var r=n(9454),i=n(7005),o=Object.prototype,s=o.hasOwnProperty,a=o.propertyIsEnumerable,c=r(function(){return arguments}())?r:function(t){return i(t)&&s.call(t,"callee")&&!a.call(t,"callee")};t.exports=c},1469:t=>{var e=Array.isArray;t.exports=e},8612:(t,e,n)=>{var r=n(3560),i=n(1780);t.exports=function(t){return null!=t&&i(t.length)&&!r(t)}},9246:(t,e,n)=>{var r=n(8612),i=n(7005);t.exports=function(t){return i(t)&&r(t)}},4144:(t,e,n)=>{t=n.nmd(t);var r=n(5639),i=n(5062),o=e&&!e.nodeType&&e,s=o&&t&&!t.nodeType&&t,a=s&&s.exports===o?r.Buffer:void 0,c=(a?a.isBuffer:void 0)||i;t.exports=c},3560:(t,e,n)=>{var r=n(4239),i=n(3218),o="[object AsyncFunction]",s="[object Function]",a="[object GeneratorFunction]",c="[object Proxy]";t.exports=function(t){if(!i(t))return!1;var e=r(t);return e==s||e==a||e==o||e==c}},1780:t=>{var e=9007199254740991;t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=e}},3218:t=>{t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},7005:t=>{t.exports=function(t){return null!=t&&"object"==typeof t}},8630:(t,e,n)=>{var r=n(4239),i=n(5924),o=n(7005),s="[object Object]",a=Function.prototype,c=Object.prototype,u=a.toString,d=c.hasOwnProperty,l=u.call(Object);t.exports=function(t){if(!o(t)||r(t)!=s)return!1;var e=i(t);if(null===e)return!0;var n=d.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&u.call(n)==l}},6719:(t,e,n)=>{var r=n(8749),i=n(1717),o=n(1167),s=o&&o.isTypedArray,a=s?i(s):r;t.exports=a},1704:(t,e,n)=>{var r=n(4636),i=n(313),o=n(8612);t.exports=function(t){return o(t)?r(t,!0):i(t)}},6486:function(t,e,n){var r;t=n.nmd(t),function(){var i,o="Expected a function",s="__lodash_hash_undefined__",a="__lodash_placeholder__",c=16,u=32,d=64,l=128,h=256,p=1/0,f=9007199254740991,g=NaN,v=4294967295,m=[["ary",l],["bind",1],["bindKey",2],["curry",8],["curryRight",c],["flip",512],["partial",u],["partialRight",d],["rearg",h]],_="[object Arguments]",S="[object Array]",E="[object Boolean]",y="[object Date]",b="[object Error]",C="[object Function]",T="[object GeneratorFunction]",w="[object Map]",I="[object Number]",k="[object Object]",R="[object Promise]",P="[object RegExp]",O="[object Set]",A="[object String]",N="[object Symbol]",D="[object WeakMap]",x="[object ArrayBuffer]",M="[object DataView]",L="[object Float32Array]",U="[object Float64Array]",B="[object Int8Array]",j="[object Int16Array]",F="[object Int32Array]",V="[object Uint8Array]",G="[object Uint8ClampedArray]",W="[object Uint16Array]",$="[object Uint32Array]",H=/\b__p \+= '';/g,z=/\b(__p \+=) '' \+/g,q=/(__e\(.*?\)|\b__t\)) \+\n'';/g,K=/&(?:amp|lt|gt|quot|#39);/g,J=/[&<>"']/g,X=RegExp(K.source),Y=RegExp(J.source),Q=/<%-([\s\S]+?)%>/g,Z=/<%([\s\S]+?)%>/g,tt=/<%=([\s\S]+?)%>/g,et=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nt=/^\w*$/,rt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,it=/[\\^$.*+?()[\]{}|]/g,ot=RegExp(it.source),st=/^\s+/,at=/\s/,ct=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ut=/\{\n\/\* \[wrapped with (.+)\] \*/,dt=/,? & /,lt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ht=/[()=,{}\[\]\/\s]/,pt=/\\(\\)?/g,ft=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,gt=/\w*$/,vt=/^[-+]0x[0-9a-f]+$/i,mt=/^0b[01]+$/i,_t=/^\[object .+?Constructor\]$/,St=/^0o[0-7]+$/i,Et=/^(?:0|[1-9]\d*)$/,yt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,bt=/($^)/,Ct=/['\n\r\u2028\u2029\\]/g,Tt="\\ud800-\\udfff",wt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",It="\\u2700-\\u27bf",kt="a-z\\xdf-\\xf6\\xf8-\\xff",Rt="A-Z\\xc0-\\xd6\\xd8-\\xde",Pt="\\ufe0e\\ufe0f",Ot="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",At="['’]",Nt="["+Tt+"]",Dt="["+Ot+"]",xt="["+wt+"]",Mt="\\d+",Lt="["+It+"]",Ut="["+kt+"]",Bt="[^"+Tt+Ot+Mt+It+kt+Rt+"]",jt="\\ud83c[\\udffb-\\udfff]",Ft="[^"+Tt+"]",Vt="(?:\\ud83c[\\udde6-\\uddff]){2}",Gt="[\\ud800-\\udbff][\\udc00-\\udfff]",Wt="["+Rt+"]",$t="\\u200d",Ht="(?:"+Ut+"|"+Bt+")",zt="(?:"+Wt+"|"+Bt+")",qt="(?:['’](?:d|ll|m|re|s|t|ve))?",Kt="(?:['’](?:D|LL|M|RE|S|T|VE))?",Jt="(?:"+xt+"|"+jt+")"+"?",Xt="["+Pt+"]?",Yt=Xt+Jt+("(?:"+$t+"(?:"+[Ft,Vt,Gt].join("|")+")"+Xt+Jt+")*"),Qt="(?:"+[Lt,Vt,Gt].join("|")+")"+Yt,Zt="(?:"+[Ft+xt+"?",xt,Vt,Gt,Nt].join("|")+")",te=RegExp(At,"g"),ee=RegExp(xt,"g"),ne=RegExp(jt+"(?="+jt+")|"+Zt+Yt,"g"),re=RegExp([Wt+"?"+Ut+"+"+qt+"(?="+[Dt,Wt,"$"].join("|")+")",zt+"+"+Kt+"(?="+[Dt,Wt+Ht,"$"].join("|")+")",Wt+"?"+Ht+"+"+qt,Wt+"+"+Kt,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Mt,Qt].join("|"),"g"),ie=RegExp("["+$t+Tt+wt+Pt+"]"),oe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,se=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ae=-1,ce={};ce[L]=ce[U]=ce[B]=ce[j]=ce[F]=ce[V]=ce[G]=ce[W]=ce[$]=!0,ce[_]=ce[S]=ce[x]=ce[E]=ce[M]=ce[y]=ce[b]=ce[C]=ce[w]=ce[I]=ce[k]=ce[P]=ce[O]=ce[A]=ce[D]=!1;var ue={};ue[_]=ue[S]=ue[x]=ue[M]=ue[E]=ue[y]=ue[L]=ue[U]=ue[B]=ue[j]=ue[F]=ue[w]=ue[I]=ue[k]=ue[P]=ue[O]=ue[A]=ue[N]=ue[V]=ue[G]=ue[W]=ue[$]=!0,ue[b]=ue[C]=ue[D]=!1;var de={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},le=parseFloat,he=parseInt,pe="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,fe="object"==typeof self&&self&&self.Object===Object&&self,ge=pe||fe||Function("return this")(),ve=e&&!e.nodeType&&e,me=ve&&t&&!t.nodeType&&t,_e=me&&me.exports===ve,Se=_e&&pe.process,Ee=function(){try{var t=me&&me.require&&me.require("util").types;return t||Se&&Se.binding&&Se.binding("util")}catch(t){}}(),ye=Ee&&Ee.isArrayBuffer,be=Ee&&Ee.isDate,Ce=Ee&&Ee.isMap,Te=Ee&&Ee.isRegExp,we=Ee&&Ee.isSet,Ie=Ee&&Ee.isTypedArray;function ke(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function Re(t,e,n,r){for(var i=-1,o=null==t?0:t.length;++i<o;){var s=t[i];e(r,s,n(s),t)}return r}function Pe(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}function Oe(t,e){for(var n=null==t?0:t.length;n--&&!1!==e(t[n],n,t););return t}function Ae(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function Ne(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++n<r;){var s=t[n];e(s,n,t)&&(o[i++]=s)}return o}function De(t,e){return!!(null==t?0:t.length)&&We(t,e,0)>-1}function xe(t,e,n){for(var r=-1,i=null==t?0:t.length;++r<i;)if(n(e,t[r]))return!0;return!1}function Me(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}function Le(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}function Ue(t,e,n,r){var i=-1,o=null==t?0:t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}function Be(t,e,n,r){var i=null==t?0:t.length;for(r&&i&&(n=t[--i]);i--;)n=e(n,t[i],i,t);return n}function je(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}var Fe=qe("length");function Ve(t,e,n){var r;return n(t,(function(t,n,i){if(e(t,n,i))return r=n,!1})),r}function Ge(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1}function We(t,e,n){return e==e?function(t,e,n){var r=n-1,i=t.length;for(;++r<i;)if(t[r]===e)return r;return-1}(t,e,n):Ge(t,He,n)}function $e(t,e,n,r){for(var i=n-1,o=t.length;++i<o;)if(r(t[i],e))return i;return-1}function He(t){return t!=t}function ze(t,e){var n=null==t?0:t.length;return n?Xe(t,e)/n:g}function qe(t){return function(e){return null==e?i:e[t]}}function Ke(t){return function(e){return null==t?i:t[e]}}function Je(t,e,n,r,i){return i(t,(function(t,i,o){n=r?(r=!1,t):e(n,t,i,o)})),n}function Xe(t,e){for(var n,r=-1,o=t.length;++r<o;){var s=e(t[r]);s!==i&&(n=n===i?s:n+s)}return n}function Ye(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function Qe(t){return t?t.slice(0,vn(t)+1).replace(st,""):t}function Ze(t){return function(e){return t(e)}}function tn(t,e){return Me(e,(function(e){return t[e]}))}function en(t,e){return t.has(e)}function nn(t,e){for(var n=-1,r=t.length;++n<r&&We(e,t[n],0)>-1;);return n}function rn(t,e){for(var n=t.length;n--&&We(e,t[n],0)>-1;);return n}var on=Ke({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),sn=Ke({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function an(t){return"\\"+de[t]}function cn(t){return ie.test(t)}function un(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}function dn(t,e){return function(n){return t(e(n))}}function ln(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var s=t[n];s!==e&&s!==a||(t[n]=a,o[i++]=n)}return o}function hn(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}function pn(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=[t,t]})),n}function fn(t){return cn(t)?function(t){var e=ne.lastIndex=0;for(;ne.test(t);)++e;return e}(t):Fe(t)}function gn(t){return cn(t)?function(t){return t.match(ne)||[]}(t):function(t){return t.split("")}(t)}function vn(t){for(var e=t.length;e--&&at.test(t.charAt(e)););return e}var mn=Ke({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"});var _n=function t(e){var n,r=(e=null==e?ge:_n.defaults(ge.Object(),e,_n.pick(ge,se))).Array,at=e.Date,Tt=e.Error,wt=e.Function,It=e.Math,kt=e.Object,Rt=e.RegExp,Pt=e.String,Ot=e.TypeError,At=r.prototype,Nt=wt.prototype,Dt=kt.prototype,xt=e["__core-js_shared__"],Mt=Nt.toString,Lt=Dt.hasOwnProperty,Ut=0,Bt=(n=/[^.]+$/.exec(xt&&xt.keys&&xt.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",jt=Dt.toString,Ft=Mt.call(kt),Vt=ge._,Gt=Rt("^"+Mt.call(Lt).replace(it,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Wt=_e?e.Buffer:i,$t=e.Symbol,Ht=e.Uint8Array,zt=Wt?Wt.allocUnsafe:i,qt=dn(kt.getPrototypeOf,kt),Kt=kt.create,Jt=Dt.propertyIsEnumerable,Xt=At.splice,Yt=$t?$t.isConcatSpreadable:i,Qt=$t?$t.iterator:i,Zt=$t?$t.toStringTag:i,ne=function(){try{var t=po(kt,"defineProperty");return t({},"",{}),t}catch(t){}}(),ie=e.clearTimeout!==ge.clearTimeout&&e.clearTimeout,de=at&&at.now!==ge.Date.now&&at.now,pe=e.setTimeout!==ge.setTimeout&&e.setTimeout,fe=It.ceil,ve=It.floor,me=kt.getOwnPropertySymbols,Se=Wt?Wt.isBuffer:i,Ee=e.isFinite,Fe=At.join,Ke=dn(kt.keys,kt),Sn=It.max,En=It.min,yn=at.now,bn=e.parseInt,Cn=It.random,Tn=At.reverse,wn=po(e,"DataView"),In=po(e,"Map"),kn=po(e,"Promise"),Rn=po(e,"Set"),Pn=po(e,"WeakMap"),On=po(kt,"create"),An=Pn&&new Pn,Nn={},Dn=jo(wn),xn=jo(In),Mn=jo(kn),Ln=jo(Rn),Un=jo(Pn),Bn=$t?$t.prototype:i,jn=Bn?Bn.valueOf:i,Fn=Bn?Bn.toString:i;function Vn(t){if(na(t)&&!Hs(t)&&!(t instanceof Hn)){if(t instanceof $n)return t;if(Lt.call(t,"__wrapped__"))return Fo(t)}return new $n(t)}var Gn=function(){function t(){}return function(e){if(!ea(e))return{};if(Kt)return Kt(e);t.prototype=e;var n=new t;return t.prototype=i,n}}();function Wn(){}function $n(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=i}function Hn(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=v,this.__views__=[]}function zn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function qn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Kn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Jn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new Kn;++e<n;)this.add(t[e])}function Xn(t){var e=this.__data__=new qn(t);this.size=e.size}function Yn(t,e){var n=Hs(t),r=!n&&$s(t),i=!n&&!r&&Js(t),o=!n&&!r&&!i&&da(t),s=n||r||i||o,a=s?Ye(t.length,Pt):[],c=a.length;for(var u in t)!e&&!Lt.call(t,u)||s&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||Eo(u,c))||a.push(u);return a}function Qn(t){var e=t.length;return e?t[Jr(0,e-1)]:i}function Zn(t,e){return Lo(Oi(t),cr(e,0,t.length))}function tr(t){return Lo(Oi(t))}function er(t,e,n){(n!==i&&!Vs(t[e],n)||n===i&&!(e in t))&&sr(t,e,n)}function nr(t,e,n){var r=t[e];Lt.call(t,e)&&Vs(r,n)&&(n!==i||e in t)||sr(t,e,n)}function rr(t,e){for(var n=t.length;n--;)if(Vs(t[n][0],e))return n;return-1}function ir(t,e,n,r){return pr(t,(function(t,i,o){e(r,t,n(t),o)})),r}function or(t,e){return t&&Ai(e,Na(e),t)}function sr(t,e,n){"__proto__"==e&&ne?ne(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function ar(t,e){for(var n=-1,o=e.length,s=r(o),a=null==t;++n<o;)s[n]=a?i:ka(t,e[n]);return s}function cr(t,e,n){return t==t&&(n!==i&&(t=t<=n?t:n),e!==i&&(t=t>=e?t:e)),t}function ur(t,e,n,r,o,s){var a,c=1&e,u=2&e,d=4&e;if(n&&(a=o?n(t,r,o,s):n(t)),a!==i)return a;if(!ea(t))return t;var l=Hs(t);if(l){if(a=function(t){var e=t.length,n=new t.constructor(e);e&&"string"==typeof t[0]&&Lt.call(t,"index")&&(n.index=t.index,n.input=t.input);return n}(t),!c)return Oi(t,a)}else{var h=vo(t),p=h==C||h==T;if(Js(t))return Ti(t,c);if(h==k||h==_||p&&!o){if(a=u||p?{}:_o(t),!c)return u?function(t,e){return Ai(t,go(t),e)}(t,function(t,e){return t&&Ai(e,Da(e),t)}(a,t)):function(t,e){return Ai(t,fo(t),e)}(t,or(a,t))}else{if(!ue[h])return o?t:{};a=function(t,e,n){var r=t.constructor;switch(e){case x:return wi(t);case E:case y:return new r(+t);case M:return function(t,e){var n=e?wi(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case L:case U:case B:case j:case F:case V:case G:case W:case $:return Ii(t,n);case w:return new r;case I:case A:return new r(t);case P:return function(t){var e=new t.constructor(t.source,gt.exec(t));return e.lastIndex=t.lastIndex,e}(t);case O:return new r;case N:return i=t,jn?kt(jn.call(i)):{}}var i}(t,h,c)}}s||(s=new Xn);var f=s.get(t);if(f)return f;s.set(t,a),aa(t)?t.forEach((function(r){a.add(ur(r,e,n,r,t,s))})):ra(t)&&t.forEach((function(r,i){a.set(i,ur(r,e,n,i,t,s))}));var g=l?i:(d?u?oo:io:u?Da:Na)(t);return Pe(g||t,(function(r,i){g&&(r=t[i=r]),nr(a,i,ur(r,e,n,i,t,s))})),a}function dr(t,e,n){var r=n.length;if(null==t)return!r;for(t=kt(t);r--;){var o=n[r],s=e[o],a=t[o];if(a===i&&!(o in t)||!s(a))return!1}return!0}function lr(t,e,n){if("function"!=typeof t)throw new Ot(o);return No((function(){t.apply(i,n)}),e)}function hr(t,e,n,r){var i=-1,o=De,s=!0,a=t.length,c=[],u=e.length;if(!a)return c;n&&(e=Me(e,Ze(n))),r?(o=xe,s=!1):e.length>=200&&(o=en,s=!1,e=new Jn(e));t:for(;++i<a;){var d=t[i],l=null==n?d:n(d);if(d=r||0!==d?d:0,s&&l==l){for(var h=u;h--;)if(e[h]===l)continue t;c.push(d)}else o(e,l,r)||c.push(d)}return c}Vn.templateSettings={escape:Q,evaluate:Z,interpolate:tt,variable:"",imports:{_:Vn}},Vn.prototype=Wn.prototype,Vn.prototype.constructor=Vn,$n.prototype=Gn(Wn.prototype),$n.prototype.constructor=$n,Hn.prototype=Gn(Wn.prototype),Hn.prototype.constructor=Hn,zn.prototype.clear=function(){this.__data__=On?On(null):{},this.size=0},zn.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},zn.prototype.get=function(t){var e=this.__data__;if(On){var n=e[t];return n===s?i:n}return Lt.call(e,t)?e[t]:i},zn.prototype.has=function(t){var e=this.__data__;return On?e[t]!==i:Lt.call(e,t)},zn.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=On&&e===i?s:e,this},qn.prototype.clear=function(){this.__data__=[],this.size=0},qn.prototype.delete=function(t){var e=this.__data__,n=rr(e,t);return!(n<0)&&(n==e.length-1?e.pop():Xt.call(e,n,1),--this.size,!0)},qn.prototype.get=function(t){var e=this.__data__,n=rr(e,t);return n<0?i:e[n][1]},qn.prototype.has=function(t){return rr(this.__data__,t)>-1},qn.prototype.set=function(t,e){var n=this.__data__,r=rr(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},Kn.prototype.clear=function(){this.size=0,this.__data__={hash:new zn,map:new(In||qn),string:new zn}},Kn.prototype.delete=function(t){var e=lo(this,t).delete(t);return this.size-=e?1:0,e},Kn.prototype.get=function(t){return lo(this,t).get(t)},Kn.prototype.has=function(t){return lo(this,t).has(t)},Kn.prototype.set=function(t,e){var n=lo(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},Jn.prototype.add=Jn.prototype.push=function(t){return this.__data__.set(t,s),this},Jn.prototype.has=function(t){return this.__data__.has(t)},Xn.prototype.clear=function(){this.__data__=new qn,this.size=0},Xn.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Xn.prototype.get=function(t){return this.__data__.get(t)},Xn.prototype.has=function(t){return this.__data__.has(t)},Xn.prototype.set=function(t,e){var n=this.__data__;if(n instanceof qn){var r=n.__data__;if(!In||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Kn(r)}return n.set(t,e),this.size=n.size,this};var pr=xi(yr),fr=xi(br,!0);function gr(t,e){var n=!0;return pr(t,(function(t,r,i){return n=!!e(t,r,i)})),n}function vr(t,e,n){for(var r=-1,o=t.length;++r<o;){var s=t[r],a=e(s);if(null!=a&&(c===i?a==a&&!ua(a):n(a,c)))var c=a,u=s}return u}function mr(t,e){var n=[];return pr(t,(function(t,r,i){e(t,r,i)&&n.push(t)})),n}function _r(t,e,n,r,i){var o=-1,s=t.length;for(n||(n=So),i||(i=[]);++o<s;){var a=t[o];e>0&&n(a)?e>1?_r(a,e-1,n,r,i):Le(i,a):r||(i[i.length]=a)}return i}var Sr=Mi(),Er=Mi(!0);function yr(t,e){return t&&Sr(t,e,Na)}function br(t,e){return t&&Er(t,e,Na)}function Cr(t,e){return Ne(e,(function(e){return Qs(t[e])}))}function Tr(t,e){for(var n=0,r=(e=Ei(e,t)).length;null!=t&&n<r;)t=t[Bo(e[n++])];return n&&n==r?t:i}function wr(t,e,n){var r=e(t);return Hs(t)?r:Le(r,n(t))}function Ir(t){return null==t?t===i?"[object Undefined]":"[object Null]":Zt&&Zt in kt(t)?function(t){var e=Lt.call(t,Zt),n=t[Zt];try{t[Zt]=i;var r=!0}catch(t){}var o=jt.call(t);r&&(e?t[Zt]=n:delete t[Zt]);return o}(t):function(t){return jt.call(t)}(t)}function kr(t,e){return t>e}function Rr(t,e){return null!=t&&Lt.call(t,e)}function Pr(t,e){return null!=t&&e in kt(t)}function Or(t,e,n){for(var o=n?xe:De,s=t[0].length,a=t.length,c=a,u=r(a),d=1/0,l=[];c--;){var h=t[c];c&&e&&(h=Me(h,Ze(e))),d=En(h.length,d),u[c]=!n&&(e||s>=120&&h.length>=120)?new Jn(c&&h):i}h=t[0];var p=-1,f=u[0];t:for(;++p<s&&l.length<d;){var g=h[p],v=e?e(g):g;if(g=n||0!==g?g:0,!(f?en(f,v):o(l,v,n))){for(c=a;--c;){var m=u[c];if(!(m?en(m,v):o(t[c],v,n)))continue t}f&&f.push(v),l.push(g)}}return l}function Ar(t,e,n){var r=null==(t=Po(t,e=Ei(e,t)))?t:t[Bo(Yo(e))];return null==r?i:ke(r,t,n)}function Nr(t){return na(t)&&Ir(t)==_}function Dr(t,e,n,r,o){return t===e||(null==t||null==e||!na(t)&&!na(e)?t!=t&&e!=e:function(t,e,n,r,o,s){var a=Hs(t),c=Hs(e),u=a?S:vo(t),d=c?S:vo(e),l=(u=u==_?k:u)==k,h=(d=d==_?k:d)==k,p=u==d;if(p&&Js(t)){if(!Js(e))return!1;a=!0,l=!1}if(p&&!l)return s||(s=new Xn),a||da(t)?no(t,e,n,r,o,s):function(t,e,n,r,i,o,s){switch(n){case M:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case x:return!(t.byteLength!=e.byteLength||!o(new Ht(t),new Ht(e)));case E:case y:case I:return Vs(+t,+e);case b:return t.name==e.name&&t.message==e.message;case P:case A:return t==e+"";case w:var a=un;case O:var c=1&r;if(a||(a=hn),t.size!=e.size&&!c)return!1;var u=s.get(t);if(u)return u==e;r|=2,s.set(t,e);var d=no(a(t),a(e),r,i,o,s);return s.delete(t),d;case N:if(jn)return jn.call(t)==jn.call(e)}return!1}(t,e,u,n,r,o,s);if(!(1&n)){var f=l&&Lt.call(t,"__wrapped__"),g=h&&Lt.call(e,"__wrapped__");if(f||g){var v=f?t.value():t,m=g?e.value():e;return s||(s=new Xn),o(v,m,n,r,s)}}if(!p)return!1;return s||(s=new Xn),function(t,e,n,r,o,s){var a=1&n,c=io(t),u=c.length,d=io(e),l=d.length;if(u!=l&&!a)return!1;var h=u;for(;h--;){var p=c[h];if(!(a?p in e:Lt.call(e,p)))return!1}var f=s.get(t),g=s.get(e);if(f&&g)return f==e&&g==t;var v=!0;s.set(t,e),s.set(e,t);var m=a;for(;++h<u;){var _=t[p=c[h]],S=e[p];if(r)var E=a?r(S,_,p,e,t,s):r(_,S,p,t,e,s);if(!(E===i?_===S||o(_,S,n,r,s):E)){v=!1;break}m||(m="constructor"==p)}if(v&&!m){var y=t.constructor,b=e.constructor;y==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof y&&y instanceof y&&"function"==typeof b&&b instanceof b||(v=!1)}return s.delete(t),s.delete(e),v}(t,e,n,r,o,s)}(t,e,n,r,Dr,o))}function xr(t,e,n,r){var o=n.length,s=o,a=!r;if(null==t)return!s;for(t=kt(t);o--;){var c=n[o];if(a&&c[2]?c[1]!==t[c[0]]:!(c[0]in t))return!1}for(;++o<s;){var u=(c=n[o])[0],d=t[u],l=c[1];if(a&&c[2]){if(d===i&&!(u in t))return!1}else{var h=new Xn;if(r)var p=r(d,l,u,t,e,h);if(!(p===i?Dr(l,d,3,r,h):p))return!1}}return!0}function Mr(t){return!(!ea(t)||(e=t,Bt&&Bt in e))&&(Qs(t)?Gt:_t).test(jo(t));var e}function Lr(t){return"function"==typeof t?t:null==t?ic:"object"==typeof t?Hs(t)?Gr(t[0],t[1]):Vr(t):pc(t)}function Ur(t){if(!wo(t))return Ke(t);var e=[];for(var n in kt(t))Lt.call(t,n)&&"constructor"!=n&&e.push(n);return e}function Br(t){if(!ea(t))return function(t){var e=[];if(null!=t)for(var n in kt(t))e.push(n);return e}(t);var e=wo(t),n=[];for(var r in t)("constructor"!=r||!e&&Lt.call(t,r))&&n.push(r);return n}function jr(t,e){return t<e}function Fr(t,e){var n=-1,i=qs(t)?r(t.length):[];return pr(t,(function(t,r,o){i[++n]=e(t,r,o)})),i}function Vr(t){var e=ho(t);return 1==e.length&&e[0][2]?ko(e[0][0],e[0][1]):function(n){return n===t||xr(n,t,e)}}function Gr(t,e){return bo(t)&&Io(e)?ko(Bo(t),e):function(n){var r=ka(n,t);return r===i&&r===e?Ra(n,t):Dr(e,r,3)}}function Wr(t,e,n,r,o){t!==e&&Sr(e,(function(s,a){if(o||(o=new Xn),ea(s))!function(t,e,n,r,o,s,a){var c=Oo(t,n),u=Oo(e,n),d=a.get(u);if(d)return void er(t,n,d);var l=s?s(c,u,n+"",t,e,a):i,h=l===i;if(h){var p=Hs(u),f=!p&&Js(u),g=!p&&!f&&da(u);l=u,p||f||g?Hs(c)?l=c:Ks(c)?l=Oi(c):f?(h=!1,l=Ti(u,!0)):g?(h=!1,l=Ii(u,!0)):l=[]:oa(u)||$s(u)?(l=c,$s(c)?l=_a(c):ea(c)&&!Qs(c)||(l=_o(u))):h=!1}h&&(a.set(u,l),o(l,u,r,s,a),a.delete(u));er(t,n,l)}(t,e,a,n,Wr,r,o);else{var c=r?r(Oo(t,a),s,a+"",t,e,o):i;c===i&&(c=s),er(t,a,c)}}),Da)}function $r(t,e){var n=t.length;if(n)return Eo(e+=e<0?n:0,n)?t[e]:i}function Hr(t,e,n){e=e.length?Me(e,(function(t){return Hs(t)?function(e){return Tr(e,1===t.length?t[0]:t)}:t})):[ic];var r=-1;e=Me(e,Ze(uo()));var i=Fr(t,(function(t,n,i){var o=Me(e,(function(e){return e(t)}));return{criteria:o,index:++r,value:t}}));return function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}(i,(function(t,e){return function(t,e,n){var r=-1,i=t.criteria,o=e.criteria,s=i.length,a=n.length;for(;++r<s;){var c=ki(i[r],o[r]);if(c)return r>=a?c:c*("desc"==n[r]?-1:1)}return t.index-e.index}(t,e,n)}))}function zr(t,e,n){for(var r=-1,i=e.length,o={};++r<i;){var s=e[r],a=Tr(t,s);n(a,s)&&ti(o,Ei(s,t),a)}return o}function qr(t,e,n,r){var i=r?$e:We,o=-1,s=e.length,a=t;for(t===e&&(e=Oi(e)),n&&(a=Me(t,Ze(n)));++o<s;)for(var c=0,u=e[o],d=n?n(u):u;(c=i(a,d,c,r))>-1;)a!==t&&Xt.call(a,c,1),Xt.call(t,c,1);return t}function Kr(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(n==r||i!==o){var o=i;Eo(i)?Xt.call(t,i,1):hi(t,i)}}return t}function Jr(t,e){return t+ve(Cn()*(e-t+1))}function Xr(t,e){var n="";if(!t||e<1||e>f)return n;do{e%2&&(n+=t),(e=ve(e/2))&&(t+=t)}while(e);return n}function Yr(t,e){return Do(Ro(t,e,ic),t+"")}function Qr(t){return Qn(Va(t))}function Zr(t,e){var n=Va(t);return Lo(n,cr(e,0,n.length))}function ti(t,e,n,r){if(!ea(t))return t;for(var o=-1,s=(e=Ei(e,t)).length,a=s-1,c=t;null!=c&&++o<s;){var u=Bo(e[o]),d=n;if("__proto__"===u||"constructor"===u||"prototype"===u)return t;if(o!=a){var l=c[u];(d=r?r(l,u,c):i)===i&&(d=ea(l)?l:Eo(e[o+1])?[]:{})}nr(c,u,d),c=c[u]}return t}var ei=An?function(t,e){return An.set(t,e),t}:ic,ni=ne?function(t,e){return ne(t,"toString",{configurable:!0,enumerable:!1,value:ec(e),writable:!0})}:ic;function ri(t){return Lo(Va(t))}function ii(t,e,n){var i=-1,o=t.length;e<0&&(e=-e>o?0:o+e),(n=n>o?o:n)<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var s=r(o);++i<o;)s[i]=t[i+e];return s}function oi(t,e){var n;return pr(t,(function(t,r,i){return!(n=e(t,r,i))})),!!n}function si(t,e,n){var r=0,i=null==t?r:t.length;if("number"==typeof e&&e==e&&i<=2147483647){for(;r<i;){var o=r+i>>>1,s=t[o];null!==s&&!ua(s)&&(n?s<=e:s<e)?r=o+1:i=o}return i}return ai(t,e,ic,n)}function ai(t,e,n,r){var o=0,s=null==t?0:t.length;if(0===s)return 0;for(var a=(e=n(e))!=e,c=null===e,u=ua(e),d=e===i;o<s;){var l=ve((o+s)/2),h=n(t[l]),p=h!==i,f=null===h,g=h==h,v=ua(h);if(a)var m=r||g;else m=d?g&&(r||p):c?g&&p&&(r||!f):u?g&&p&&!f&&(r||!v):!f&&!v&&(r?h<=e:h<e);m?o=l+1:s=l}return En(s,4294967294)}function ci(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var s=t[n],a=e?e(s):s;if(!n||!Vs(a,c)){var c=a;o[i++]=0===s?0:s}}return o}function ui(t){return"number"==typeof t?t:ua(t)?g:+t}function di(t){if("string"==typeof t)return t;if(Hs(t))return Me(t,di)+"";if(ua(t))return Fn?Fn.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function li(t,e,n){var r=-1,i=De,o=t.length,s=!0,a=[],c=a;if(n)s=!1,i=xe;else if(o>=200){var u=e?null:Xi(t);if(u)return hn(u);s=!1,i=en,c=new Jn}else c=e?[]:a;t:for(;++r<o;){var d=t[r],l=e?e(d):d;if(d=n||0!==d?d:0,s&&l==l){for(var h=c.length;h--;)if(c[h]===l)continue t;e&&c.push(l),a.push(d)}else i(c,l,n)||(c!==a&&c.push(l),a.push(d))}return a}function hi(t,e){return null==(t=Po(t,e=Ei(e,t)))||delete t[Bo(Yo(e))]}function pi(t,e,n,r){return ti(t,e,n(Tr(t,e)),r)}function fi(t,e,n,r){for(var i=t.length,o=r?i:-1;(r?o--:++o<i)&&e(t[o],o,t););return n?ii(t,r?0:o,r?o+1:i):ii(t,r?o+1:0,r?i:o)}function gi(t,e){var n=t;return n instanceof Hn&&(n=n.value()),Ue(e,(function(t,e){return e.func.apply(e.thisArg,Le([t],e.args))}),n)}function vi(t,e,n){var i=t.length;if(i<2)return i?li(t[0]):[];for(var o=-1,s=r(i);++o<i;)for(var a=t[o],c=-1;++c<i;)c!=o&&(s[o]=hr(s[o]||a,t[c],e,n));return li(_r(s,1),e,n)}function mi(t,e,n){for(var r=-1,o=t.length,s=e.length,a={};++r<o;){var c=r<s?e[r]:i;n(a,t[r],c)}return a}function _i(t){return Ks(t)?t:[]}function Si(t){return"function"==typeof t?t:ic}function Ei(t,e){return Hs(t)?t:bo(t,e)?[t]:Uo(Sa(t))}var yi=Yr;function bi(t,e,n){var r=t.length;return n=n===i?r:n,!e&&n>=r?t:ii(t,e,n)}var Ci=ie||function(t){return ge.clearTimeout(t)};function Ti(t,e){if(e)return t.slice();var n=t.length,r=zt?zt(n):new t.constructor(n);return t.copy(r),r}function wi(t){var e=new t.constructor(t.byteLength);return new Ht(e).set(new Ht(t)),e}function Ii(t,e){var n=e?wi(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function ki(t,e){if(t!==e){var n=t!==i,r=null===t,o=t==t,s=ua(t),a=e!==i,c=null===e,u=e==e,d=ua(e);if(!c&&!d&&!s&&t>e||s&&a&&u&&!c&&!d||r&&a&&u||!n&&u||!o)return 1;if(!r&&!s&&!d&&t<e||d&&n&&o&&!r&&!s||c&&n&&o||!a&&o||!u)return-1}return 0}function Ri(t,e,n,i){for(var o=-1,s=t.length,a=n.length,c=-1,u=e.length,d=Sn(s-a,0),l=r(u+d),h=!i;++c<u;)l[c]=e[c];for(;++o<a;)(h||o<s)&&(l[n[o]]=t[o]);for(;d--;)l[c++]=t[o++];return l}function Pi(t,e,n,i){for(var o=-1,s=t.length,a=-1,c=n.length,u=-1,d=e.length,l=Sn(s-c,0),h=r(l+d),p=!i;++o<l;)h[o]=t[o];for(var f=o;++u<d;)h[f+u]=e[u];for(;++a<c;)(p||o<s)&&(h[f+n[a]]=t[o++]);return h}function Oi(t,e){var n=-1,i=t.length;for(e||(e=r(i));++n<i;)e[n]=t[n];return e}function Ai(t,e,n,r){var o=!n;n||(n={});for(var s=-1,a=e.length;++s<a;){var c=e[s],u=r?r(n[c],t[c],c,n,t):i;u===i&&(u=t[c]),o?sr(n,c,u):nr(n,c,u)}return n}function Ni(t,e){return function(n,r){var i=Hs(n)?Re:ir,o=e?e():{};return i(n,t,uo(r,2),o)}}function Di(t){return Yr((function(e,n){var r=-1,o=n.length,s=o>1?n[o-1]:i,a=o>2?n[2]:i;for(s=t.length>3&&"function"==typeof s?(o--,s):i,a&&yo(n[0],n[1],a)&&(s=o<3?i:s,o=1),e=kt(e);++r<o;){var c=n[r];c&&t(e,c,r,s)}return e}))}function xi(t,e){return function(n,r){if(null==n)return n;if(!qs(n))return t(n,r);for(var i=n.length,o=e?i:-1,s=kt(n);(e?o--:++o<i)&&!1!==r(s[o],o,s););return n}}function Mi(t){return function(e,n,r){for(var i=-1,o=kt(e),s=r(e),a=s.length;a--;){var c=s[t?a:++i];if(!1===n(o[c],c,o))break}return e}}function Li(t){return function(e){var n=cn(e=Sa(e))?gn(e):i,r=n?n[0]:e.charAt(0),o=n?bi(n,1).join(""):e.slice(1);return r[t]()+o}}function Ui(t){return function(e){return Ue(Qa($a(e).replace(te,"")),t,"")}}function Bi(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=Gn(t.prototype),r=t.apply(n,e);return ea(r)?r:n}}function ji(t){return function(e,n,r){var o=kt(e);if(!qs(e)){var s=uo(n,3);e=Na(e),n=function(t){return s(o[t],t,o)}}var a=t(e,n,r);return a>-1?o[s?e[a]:a]:i}}function Fi(t){return ro((function(e){var n=e.length,r=n,s=$n.prototype.thru;for(t&&e.reverse();r--;){var a=e[r];if("function"!=typeof a)throw new Ot(o);if(s&&!c&&"wrapper"==ao(a))var c=new $n([],!0)}for(r=c?r:n;++r<n;){var u=ao(a=e[r]),d="wrapper"==u?so(a):i;c=d&&Co(d[0])&&424==d[1]&&!d[4].length&&1==d[9]?c[ao(d[0])].apply(c,d[3]):1==a.length&&Co(a)?c[u]():c.thru(a)}return function(){var t=arguments,r=t[0];if(c&&1==t.length&&Hs(r))return c.plant(r).value();for(var i=0,o=n?e[i].apply(this,t):r;++i<n;)o=e[i].call(this,o);return o}}))}function Vi(t,e,n,o,s,a,c,u,d,h){var p=e&l,f=1&e,g=2&e,v=24&e,m=512&e,_=g?i:Bi(t);return function l(){for(var S=arguments.length,E=r(S),y=S;y--;)E[y]=arguments[y];if(v)var b=co(l),C=function(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&++r;return r}(E,b);if(o&&(E=Ri(E,o,s,v)),a&&(E=Pi(E,a,c,v)),S-=C,v&&S<h){var T=ln(E,b);return Ki(t,e,Vi,l.placeholder,n,E,T,u,d,h-S)}var w=f?n:this,I=g?w[t]:t;return S=E.length,u?E=function(t,e){var n=t.length,r=En(e.length,n),o=Oi(t);for(;r--;){var s=e[r];t[r]=Eo(s,n)?o[s]:i}return t}(E,u):m&&S>1&&E.reverse(),p&&d<S&&(E.length=d),this&&this!==ge&&this instanceof l&&(I=_||Bi(I)),I.apply(w,E)}}function Gi(t,e){return function(n,r){return function(t,e,n,r){return yr(t,(function(t,i,o){e(r,n(t),i,o)})),r}(n,t,e(r),{})}}function Wi(t,e){return function(n,r){var o;if(n===i&&r===i)return e;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=di(n),r=di(r)):(n=ui(n),r=ui(r)),o=t(n,r)}return o}}function $i(t){return ro((function(e){return e=Me(e,Ze(uo())),Yr((function(n){var r=this;return t(e,(function(t){return ke(t,r,n)}))}))}))}function Hi(t,e){var n=(e=e===i?" ":di(e)).length;if(n<2)return n?Xr(e,t):e;var r=Xr(e,fe(t/fn(e)));return cn(e)?bi(gn(r),0,t).join(""):r.slice(0,t)}function zi(t){return function(e,n,o){return o&&"number"!=typeof o&&yo(e,n,o)&&(n=o=i),e=fa(e),n===i?(n=e,e=0):n=fa(n),function(t,e,n,i){for(var o=-1,s=Sn(fe((e-t)/(n||1)),0),a=r(s);s--;)a[i?s:++o]=t,t+=n;return a}(e,n,o=o===i?e<n?1:-1:fa(o),t)}}function qi(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=ma(e),n=ma(n)),t(e,n)}}function Ki(t,e,n,r,o,s,a,c,l,h){var p=8&e;e|=p?u:d,4&(e&=~(p?d:u))||(e&=-4);var f=[t,e,o,p?s:i,p?a:i,p?i:s,p?i:a,c,l,h],g=n.apply(i,f);return Co(t)&&Ao(g,f),g.placeholder=r,xo(g,t,e)}function Ji(t){var e=It[t];return function(t,n){if(t=ma(t),(n=null==n?0:En(ga(n),292))&&Ee(t)){var r=(Sa(t)+"e").split("e");return+((r=(Sa(e(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return e(t)}}var Xi=Rn&&1/hn(new Rn([,-0]))[1]==p?function(t){return new Rn(t)}:uc;function Yi(t){return function(e){var n=vo(e);return n==w?un(e):n==O?pn(e):function(t,e){return Me(e,(function(e){return[e,t[e]]}))}(e,t(e))}}function Qi(t,e,n,s,p,f,g,v){var m=2&e;if(!m&&"function"!=typeof t)throw new Ot(o);var _=s?s.length:0;if(_||(e&=-97,s=p=i),g=g===i?g:Sn(ga(g),0),v=v===i?v:ga(v),_-=p?p.length:0,e&d){var S=s,E=p;s=p=i}var y=m?i:so(t),b=[t,e,n,s,p,S,E,f,g,v];if(y&&function(t,e){var n=t[1],r=e[1],i=n|r,o=i<131,s=r==l&&8==n||r==l&&n==h&&t[7].length<=e[8]||384==r&&e[7].length<=e[8]&&8==n;if(!o&&!s)return t;1&r&&(t[2]=e[2],i|=1&n?0:4);var c=e[3];if(c){var u=t[3];t[3]=u?Ri(u,c,e[4]):c,t[4]=u?ln(t[3],a):e[4]}(c=e[5])&&(u=t[5],t[5]=u?Pi(u,c,e[6]):c,t[6]=u?ln(t[5],a):e[6]);(c=e[7])&&(t[7]=c);r&l&&(t[8]=null==t[8]?e[8]:En(t[8],e[8]));null==t[9]&&(t[9]=e[9]);t[0]=e[0],t[1]=i}(b,y),t=b[0],e=b[1],n=b[2],s=b[3],p=b[4],!(v=b[9]=b[9]===i?m?0:t.length:Sn(b[9]-_,0))&&24&e&&(e&=-25),e&&1!=e)C=8==e||e==c?function(t,e,n){var o=Bi(t);return function s(){for(var a=arguments.length,c=r(a),u=a,d=co(s);u--;)c[u]=arguments[u];var l=a<3&&c[0]!==d&&c[a-1]!==d?[]:ln(c,d);return(a-=l.length)<n?Ki(t,e,Vi,s.placeholder,i,c,l,i,i,n-a):ke(this&&this!==ge&&this instanceof s?o:t,this,c)}}(t,e,v):e!=u&&33!=e||p.length?Vi.apply(i,b):function(t,e,n,i){var o=1&e,s=Bi(t);return function e(){for(var a=-1,c=arguments.length,u=-1,d=i.length,l=r(d+c),h=this&&this!==ge&&this instanceof e?s:t;++u<d;)l[u]=i[u];for(;c--;)l[u++]=arguments[++a];return ke(h,o?n:this,l)}}(t,e,n,s);else var C=function(t,e,n){var r=1&e,i=Bi(t);return function e(){return(this&&this!==ge&&this instanceof e?i:t).apply(r?n:this,arguments)}}(t,e,n);return xo((y?ei:Ao)(C,b),t,e)}function Zi(t,e,n,r){return t===i||Vs(t,Dt[n])&&!Lt.call(r,n)?e:t}function to(t,e,n,r,o,s){return ea(t)&&ea(e)&&(s.set(e,t),Wr(t,e,i,to,s),s.delete(e)),t}function eo(t){return oa(t)?i:t}function no(t,e,n,r,o,s){var a=1&n,c=t.length,u=e.length;if(c!=u&&!(a&&u>c))return!1;var d=s.get(t),l=s.get(e);if(d&&l)return d==e&&l==t;var h=-1,p=!0,f=2&n?new Jn:i;for(s.set(t,e),s.set(e,t);++h<c;){var g=t[h],v=e[h];if(r)var m=a?r(v,g,h,e,t,s):r(g,v,h,t,e,s);if(m!==i){if(m)continue;p=!1;break}if(f){if(!je(e,(function(t,e){if(!en(f,e)&&(g===t||o(g,t,n,r,s)))return f.push(e)}))){p=!1;break}}else if(g!==v&&!o(g,v,n,r,s)){p=!1;break}}return s.delete(t),s.delete(e),p}function ro(t){return Do(Ro(t,i,zo),t+"")}function io(t){return wr(t,Na,fo)}function oo(t){return wr(t,Da,go)}var so=An?function(t){return An.get(t)}:uc;function ao(t){for(var e=t.name+"",n=Nn[e],r=Lt.call(Nn,e)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==t)return i.name}return e}function co(t){return(Lt.call(Vn,"placeholder")?Vn:t).placeholder}function uo(){var t=Vn.iteratee||oc;return t=t===oc?Lr:t,arguments.length?t(arguments[0],arguments[1]):t}function lo(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function ho(t){for(var e=Na(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,Io(i)]}return e}function po(t,e){var n=function(t,e){return null==t?i:t[e]}(t,e);return Mr(n)?n:i}var fo=me?function(t){return null==t?[]:(t=kt(t),Ne(me(t),(function(e){return Jt.call(t,e)})))}:vc,go=me?function(t){for(var e=[];t;)Le(e,fo(t)),t=qt(t);return e}:vc,vo=Ir;function mo(t,e,n){for(var r=-1,i=(e=Ei(e,t)).length,o=!1;++r<i;){var s=Bo(e[r]);if(!(o=null!=t&&n(t,s)))break;t=t[s]}return o||++r!=i?o:!!(i=null==t?0:t.length)&&ta(i)&&Eo(s,i)&&(Hs(t)||$s(t))}function _o(t){return"function"!=typeof t.constructor||wo(t)?{}:Gn(qt(t))}function So(t){return Hs(t)||$s(t)||!!(Yt&&t&&t[Yt])}function Eo(t,e){var n=typeof t;return!!(e=null==e?f:e)&&("number"==n||"symbol"!=n&&Et.test(t))&&t>-1&&t%1==0&&t<e}function yo(t,e,n){if(!ea(n))return!1;var r=typeof e;return!!("number"==r?qs(n)&&Eo(e,n.length):"string"==r&&e in n)&&Vs(n[e],t)}function bo(t,e){if(Hs(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!ua(t))||(nt.test(t)||!et.test(t)||null!=e&&t in kt(e))}function Co(t){var e=ao(t),n=Vn[e];if("function"!=typeof n||!(e in Hn.prototype))return!1;if(t===n)return!0;var r=so(n);return!!r&&t===r[0]}(wn&&vo(new wn(new ArrayBuffer(1)))!=M||In&&vo(new In)!=w||kn&&vo(kn.resolve())!=R||Rn&&vo(new Rn)!=O||Pn&&vo(new Pn)!=D)&&(vo=function(t){var e=Ir(t),n=e==k?t.constructor:i,r=n?jo(n):"";if(r)switch(r){case Dn:return M;case xn:return w;case Mn:return R;case Ln:return O;case Un:return D}return e});var To=xt?Qs:mc;function wo(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Dt)}function Io(t){return t==t&&!ea(t)}function ko(t,e){return function(n){return null!=n&&(n[t]===e&&(e!==i||t in kt(n)))}}function Ro(t,e,n){return e=Sn(e===i?t.length-1:e,0),function(){for(var i=arguments,o=-1,s=Sn(i.length-e,0),a=r(s);++o<s;)a[o]=i[e+o];o=-1;for(var c=r(e+1);++o<e;)c[o]=i[o];return c[e]=n(a),ke(t,this,c)}}function Po(t,e){return e.length<2?t:Tr(t,ii(e,0,-1))}function Oo(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Ao=Mo(ei),No=pe||function(t,e){return ge.setTimeout(t,e)},Do=Mo(ni);function xo(t,e,n){var r=e+"";return Do(t,function(t,e){var n=e.length;if(!n)return t;var r=n-1;return e[r]=(n>1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(ct,"{\n/* [wrapped with "+e+"] */\n")}(r,function(t,e){return Pe(m,(function(n){var r="_."+n[0];e&n[1]&&!De(t,r)&&t.push(r)})),t.sort()}(function(t){var e=t.match(ut);return e?e[1].split(dt):[]}(r),n)))}function Mo(t){var e=0,n=0;return function(){var r=yn(),o=16-(r-n);if(n=r,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(i,arguments)}}function Lo(t,e){var n=-1,r=t.length,o=r-1;for(e=e===i?r:e;++n<e;){var s=Jr(n,o),a=t[s];t[s]=t[n],t[n]=a}return t.length=e,t}var Uo=function(t){var e=Ms(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(rt,(function(t,n,r,i){e.push(r?i.replace(pt,"$1"):n||t)})),e}));function Bo(t){if("string"==typeof t||ua(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function jo(t){if(null!=t){try{return Mt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Fo(t){if(t instanceof Hn)return t.clone();var e=new $n(t.__wrapped__,t.__chain__);return e.__actions__=Oi(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var Vo=Yr((function(t,e){return Ks(t)?hr(t,_r(e,1,Ks,!0)):[]})),Go=Yr((function(t,e){var n=Yo(e);return Ks(n)&&(n=i),Ks(t)?hr(t,_r(e,1,Ks,!0),uo(n,2)):[]})),Wo=Yr((function(t,e){var n=Yo(e);return Ks(n)&&(n=i),Ks(t)?hr(t,_r(e,1,Ks,!0),i,n):[]}));function $o(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:ga(n);return i<0&&(i=Sn(r+i,0)),Ge(t,uo(e,3),i)}function Ho(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var o=r-1;return n!==i&&(o=ga(n),o=n<0?Sn(r+o,0):En(o,r-1)),Ge(t,uo(e,3),o,!0)}function zo(t){return(null==t?0:t.length)?_r(t,1):[]}function qo(t){return t&&t.length?t[0]:i}var Ko=Yr((function(t){var e=Me(t,_i);return e.length&&e[0]===t[0]?Or(e):[]})),Jo=Yr((function(t){var e=Yo(t),n=Me(t,_i);return e===Yo(n)?e=i:n.pop(),n.length&&n[0]===t[0]?Or(n,uo(e,2)):[]})),Xo=Yr((function(t){var e=Yo(t),n=Me(t,_i);return(e="function"==typeof e?e:i)&&n.pop(),n.length&&n[0]===t[0]?Or(n,i,e):[]}));function Yo(t){var e=null==t?0:t.length;return e?t[e-1]:i}var Qo=Yr(Zo);function Zo(t,e){return t&&t.length&&e&&e.length?qr(t,e):t}var ts=ro((function(t,e){var n=null==t?0:t.length,r=ar(t,e);return Kr(t,Me(e,(function(t){return Eo(t,n)?+t:t})).sort(ki)),r}));function es(t){return null==t?t:Tn.call(t)}var ns=Yr((function(t){return li(_r(t,1,Ks,!0))})),rs=Yr((function(t){var e=Yo(t);return Ks(e)&&(e=i),li(_r(t,1,Ks,!0),uo(e,2))})),is=Yr((function(t){var e=Yo(t);return e="function"==typeof e?e:i,li(_r(t,1,Ks,!0),i,e)}));function os(t){if(!t||!t.length)return[];var e=0;return t=Ne(t,(function(t){if(Ks(t))return e=Sn(t.length,e),!0})),Ye(e,(function(e){return Me(t,qe(e))}))}function ss(t,e){if(!t||!t.length)return[];var n=os(t);return null==e?n:Me(n,(function(t){return ke(e,i,t)}))}var as=Yr((function(t,e){return Ks(t)?hr(t,e):[]})),cs=Yr((function(t){return vi(Ne(t,Ks))})),us=Yr((function(t){var e=Yo(t);return Ks(e)&&(e=i),vi(Ne(t,Ks),uo(e,2))})),ds=Yr((function(t){var e=Yo(t);return e="function"==typeof e?e:i,vi(Ne(t,Ks),i,e)})),ls=Yr(os);var hs=Yr((function(t){var e=t.length,n=e>1?t[e-1]:i;return n="function"==typeof n?(t.pop(),n):i,ss(t,n)}));function ps(t){var e=Vn(t);return e.__chain__=!0,e}function fs(t,e){return e(t)}var gs=ro((function(t){var e=t.length,n=e?t[0]:0,r=this.__wrapped__,o=function(e){return ar(e,t)};return!(e>1||this.__actions__.length)&&r instanceof Hn&&Eo(n)?((r=r.slice(n,+n+(e?1:0))).__actions__.push({func:fs,args:[o],thisArg:i}),new $n(r,this.__chain__).thru((function(t){return e&&!t.length&&t.push(i),t}))):this.thru(o)}));var vs=Ni((function(t,e,n){Lt.call(t,n)?++t[n]:sr(t,n,1)}));var ms=ji($o),_s=ji(Ho);function Ss(t,e){return(Hs(t)?Pe:pr)(t,uo(e,3))}function Es(t,e){return(Hs(t)?Oe:fr)(t,uo(e,3))}var ys=Ni((function(t,e,n){Lt.call(t,n)?t[n].push(e):sr(t,n,[e])}));var bs=Yr((function(t,e,n){var i=-1,o="function"==typeof e,s=qs(t)?r(t.length):[];return pr(t,(function(t){s[++i]=o?ke(e,t,n):Ar(t,e,n)})),s})),Cs=Ni((function(t,e,n){sr(t,n,e)}));function Ts(t,e){return(Hs(t)?Me:Fr)(t,uo(e,3))}var ws=Ni((function(t,e,n){t[n?0:1].push(e)}),(function(){return[[],[]]}));var Is=Yr((function(t,e){if(null==t)return[];var n=e.length;return n>1&&yo(t,e[0],e[1])?e=[]:n>2&&yo(e[0],e[1],e[2])&&(e=[e[0]]),Hr(t,_r(e,1),[])})),ks=de||function(){return ge.Date.now()};function Rs(t,e,n){return e=n?i:e,e=t&&null==e?t.length:e,Qi(t,l,i,i,i,i,e)}function Ps(t,e){var n;if("function"!=typeof e)throw new Ot(o);return t=ga(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=i),n}}var Os=Yr((function(t,e,n){var r=1;if(n.length){var i=ln(n,co(Os));r|=u}return Qi(t,r,e,n,i)})),As=Yr((function(t,e,n){var r=3;if(n.length){var i=ln(n,co(As));r|=u}return Qi(e,r,t,n,i)}));function Ns(t,e,n){var r,s,a,c,u,d,l=0,h=!1,p=!1,f=!0;if("function"!=typeof t)throw new Ot(o);function g(e){var n=r,o=s;return r=s=i,l=e,c=t.apply(o,n)}function v(t){var n=t-d;return d===i||n>=e||n<0||p&&t-l>=a}function m(){var t=ks();if(v(t))return _(t);u=No(m,function(t){var n=e-(t-d);return p?En(n,a-(t-l)):n}(t))}function _(t){return u=i,f&&r?g(t):(r=s=i,c)}function S(){var t=ks(),n=v(t);if(r=arguments,s=this,d=t,n){if(u===i)return function(t){return l=t,u=No(m,e),h?g(t):c}(d);if(p)return Ci(u),u=No(m,e),g(d)}return u===i&&(u=No(m,e)),c}return e=ma(e)||0,ea(n)&&(h=!!n.leading,a=(p="maxWait"in n)?Sn(ma(n.maxWait)||0,e):a,f="trailing"in n?!!n.trailing:f),S.cancel=function(){u!==i&&Ci(u),l=0,r=d=s=u=i},S.flush=function(){return u===i?c:_(ks())},S}var Ds=Yr((function(t,e){return lr(t,1,e)})),xs=Yr((function(t,e,n){return lr(t,ma(e)||0,n)}));function Ms(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new Ot(o);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=t.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(Ms.Cache||Kn),n}function Ls(t){if("function"!=typeof t)throw new Ot(o);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Ms.Cache=Kn;var Us=yi((function(t,e){var n=(e=1==e.length&&Hs(e[0])?Me(e[0],Ze(uo())):Me(_r(e,1),Ze(uo()))).length;return Yr((function(r){for(var i=-1,o=En(r.length,n);++i<o;)r[i]=e[i].call(this,r[i]);return ke(t,this,r)}))})),Bs=Yr((function(t,e){var n=ln(e,co(Bs));return Qi(t,u,i,e,n)})),js=Yr((function(t,e){var n=ln(e,co(js));return Qi(t,d,i,e,n)})),Fs=ro((function(t,e){return Qi(t,h,i,i,i,e)}));function Vs(t,e){return t===e||t!=t&&e!=e}var Gs=qi(kr),Ws=qi((function(t,e){return t>=e})),$s=Nr(function(){return arguments}())?Nr:function(t){return na(t)&&Lt.call(t,"callee")&&!Jt.call(t,"callee")},Hs=r.isArray,zs=ye?Ze(ye):function(t){return na(t)&&Ir(t)==x};function qs(t){return null!=t&&ta(t.length)&&!Qs(t)}function Ks(t){return na(t)&&qs(t)}var Js=Se||mc,Xs=be?Ze(be):function(t){return na(t)&&Ir(t)==y};function Ys(t){if(!na(t))return!1;var e=Ir(t);return e==b||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!oa(t)}function Qs(t){if(!ea(t))return!1;var e=Ir(t);return e==C||e==T||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Zs(t){return"number"==typeof t&&t==ga(t)}function ta(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=f}function ea(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function na(t){return null!=t&&"object"==typeof t}var ra=Ce?Ze(Ce):function(t){return na(t)&&vo(t)==w};function ia(t){return"number"==typeof t||na(t)&&Ir(t)==I}function oa(t){if(!na(t)||Ir(t)!=k)return!1;var e=qt(t);if(null===e)return!0;var n=Lt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Mt.call(n)==Ft}var sa=Te?Ze(Te):function(t){return na(t)&&Ir(t)==P};var aa=we?Ze(we):function(t){return na(t)&&vo(t)==O};function ca(t){return"string"==typeof t||!Hs(t)&&na(t)&&Ir(t)==A}function ua(t){return"symbol"==typeof t||na(t)&&Ir(t)==N}var da=Ie?Ze(Ie):function(t){return na(t)&&ta(t.length)&&!!ce[Ir(t)]};var la=qi(jr),ha=qi((function(t,e){return t<=e}));function pa(t){if(!t)return[];if(qs(t))return ca(t)?gn(t):Oi(t);if(Qt&&t[Qt])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[Qt]());var e=vo(t);return(e==w?un:e==O?hn:Va)(t)}function fa(t){return t?(t=ma(t))===p||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function ga(t){var e=fa(t),n=e%1;return e==e?n?e-n:e:0}function va(t){return t?cr(ga(t),0,v):0}function ma(t){if("number"==typeof t)return t;if(ua(t))return g;if(ea(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=ea(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Qe(t);var n=mt.test(t);return n||St.test(t)?he(t.slice(2),n?2:8):vt.test(t)?g:+t}function _a(t){return Ai(t,Da(t))}function Sa(t){return null==t?"":di(t)}var Ea=Di((function(t,e){if(wo(e)||qs(e))Ai(e,Na(e),t);else for(var n in e)Lt.call(e,n)&&nr(t,n,e[n])})),ya=Di((function(t,e){Ai(e,Da(e),t)})),ba=Di((function(t,e,n,r){Ai(e,Da(e),t,r)})),Ca=Di((function(t,e,n,r){Ai(e,Na(e),t,r)})),Ta=ro(ar);var wa=Yr((function(t,e){t=kt(t);var n=-1,r=e.length,o=r>2?e[2]:i;for(o&&yo(e[0],e[1],o)&&(r=1);++n<r;)for(var s=e[n],a=Da(s),c=-1,u=a.length;++c<u;){var d=a[c],l=t[d];(l===i||Vs(l,Dt[d])&&!Lt.call(t,d))&&(t[d]=s[d])}return t})),Ia=Yr((function(t){return t.push(i,to),ke(Ma,i,t)}));function ka(t,e,n){var r=null==t?i:Tr(t,e);return r===i?n:r}function Ra(t,e){return null!=t&&mo(t,e,Pr)}var Pa=Gi((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=jt.call(e)),t[e]=n}),ec(ic)),Oa=Gi((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=jt.call(e)),Lt.call(t,e)?t[e].push(n):t[e]=[n]}),uo),Aa=Yr(Ar);function Na(t){return qs(t)?Yn(t):Ur(t)}function Da(t){return qs(t)?Yn(t,!0):Br(t)}var xa=Di((function(t,e,n){Wr(t,e,n)})),Ma=Di((function(t,e,n,r){Wr(t,e,n,r)})),La=ro((function(t,e){var n={};if(null==t)return n;var r=!1;e=Me(e,(function(e){return e=Ei(e,t),r||(r=e.length>1),e})),Ai(t,oo(t),n),r&&(n=ur(n,7,eo));for(var i=e.length;i--;)hi(n,e[i]);return n}));var Ua=ro((function(t,e){return null==t?{}:function(t,e){return zr(t,e,(function(e,n){return Ra(t,n)}))}(t,e)}));function Ba(t,e){if(null==t)return{};var n=Me(oo(t),(function(t){return[t]}));return e=uo(e),zr(t,n,(function(t,n){return e(t,n[0])}))}var ja=Yi(Na),Fa=Yi(Da);function Va(t){return null==t?[]:tn(t,Na(t))}var Ga=Ui((function(t,e,n){return e=e.toLowerCase(),t+(n?Wa(e):e)}));function Wa(t){return Ya(Sa(t).toLowerCase())}function $a(t){return(t=Sa(t))&&t.replace(yt,on).replace(ee,"")}var Ha=Ui((function(t,e,n){return t+(n?"-":"")+e.toLowerCase()})),za=Ui((function(t,e,n){return t+(n?" ":"")+e.toLowerCase()})),qa=Li("toLowerCase");var Ka=Ui((function(t,e,n){return t+(n?"_":"")+e.toLowerCase()}));var Ja=Ui((function(t,e,n){return t+(n?" ":"")+Ya(e)}));var Xa=Ui((function(t,e,n){return t+(n?" ":"")+e.toUpperCase()})),Ya=Li("toUpperCase");function Qa(t,e,n){return t=Sa(t),(e=n?i:e)===i?function(t){return oe.test(t)}(t)?function(t){return t.match(re)||[]}(t):function(t){return t.match(lt)||[]}(t):t.match(e)||[]}var Za=Yr((function(t,e){try{return ke(t,i,e)}catch(t){return Ys(t)?t:new Tt(t)}})),tc=ro((function(t,e){return Pe(e,(function(e){e=Bo(e),sr(t,e,Os(t[e],t))})),t}));function ec(t){return function(){return t}}var nc=Fi(),rc=Fi(!0);function ic(t){return t}function oc(t){return Lr("function"==typeof t?t:ur(t,1))}var sc=Yr((function(t,e){return function(n){return Ar(n,t,e)}})),ac=Yr((function(t,e){return function(n){return Ar(t,n,e)}}));function cc(t,e,n){var r=Na(e),i=Cr(e,r);null!=n||ea(e)&&(i.length||!r.length)||(n=e,e=t,t=this,i=Cr(e,Na(e)));var o=!(ea(n)&&"chain"in n&&!n.chain),s=Qs(t);return Pe(i,(function(n){var r=e[n];t[n]=r,s&&(t.prototype[n]=function(){var e=this.__chain__;if(o||e){var n=t(this.__wrapped__);return(n.__actions__=Oi(this.__actions__)).push({func:r,args:arguments,thisArg:t}),n.__chain__=e,n}return r.apply(t,Le([this.value()],arguments))})})),t}function uc(){}var dc=$i(Me),lc=$i(Ae),hc=$i(je);function pc(t){return bo(t)?qe(Bo(t)):function(t){return function(e){return Tr(e,t)}}(t)}var fc=zi(),gc=zi(!0);function vc(){return[]}function mc(){return!1}var _c=Wi((function(t,e){return t+e}),0),Sc=Ji("ceil"),Ec=Wi((function(t,e){return t/e}),1),yc=Ji("floor");var bc,Cc=Wi((function(t,e){return t*e}),1),Tc=Ji("round"),wc=Wi((function(t,e){return t-e}),0);return Vn.after=function(t,e){if("function"!=typeof e)throw new Ot(o);return t=ga(t),function(){if(--t<1)return e.apply(this,arguments)}},Vn.ary=Rs,Vn.assign=Ea,Vn.assignIn=ya,Vn.assignInWith=ba,Vn.assignWith=Ca,Vn.at=Ta,Vn.before=Ps,Vn.bind=Os,Vn.bindAll=tc,Vn.bindKey=As,Vn.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return Hs(t)?t:[t]},Vn.chain=ps,Vn.chunk=function(t,e,n){e=(n?yo(t,e,n):e===i)?1:Sn(ga(e),0);var o=null==t?0:t.length;if(!o||e<1)return[];for(var s=0,a=0,c=r(fe(o/e));s<o;)c[a++]=ii(t,s,s+=e);return c},Vn.compact=function(t){for(var e=-1,n=null==t?0:t.length,r=0,i=[];++e<n;){var o=t[e];o&&(i[r++]=o)}return i},Vn.concat=function(){var t=arguments.length;if(!t)return[];for(var e=r(t-1),n=arguments[0],i=t;i--;)e[i-1]=arguments[i];return Le(Hs(n)?Oi(n):[n],_r(e,1))},Vn.cond=function(t){var e=null==t?0:t.length,n=uo();return t=e?Me(t,(function(t){if("function"!=typeof t[1])throw new Ot(o);return[n(t[0]),t[1]]})):[],Yr((function(n){for(var r=-1;++r<e;){var i=t[r];if(ke(i[0],this,n))return ke(i[1],this,n)}}))},Vn.conforms=function(t){return function(t){var e=Na(t);return function(n){return dr(n,t,e)}}(ur(t,1))},Vn.constant=ec,Vn.countBy=vs,Vn.create=function(t,e){var n=Gn(t);return null==e?n:or(n,e)},Vn.curry=function t(e,n,r){var o=Qi(e,8,i,i,i,i,i,n=r?i:n);return o.placeholder=t.placeholder,o},Vn.curryRight=function t(e,n,r){var o=Qi(e,c,i,i,i,i,i,n=r?i:n);return o.placeholder=t.placeholder,o},Vn.debounce=Ns,Vn.defaults=wa,Vn.defaultsDeep=Ia,Vn.defer=Ds,Vn.delay=xs,Vn.difference=Vo,Vn.differenceBy=Go,Vn.differenceWith=Wo,Vn.drop=function(t,e,n){var r=null==t?0:t.length;return r?ii(t,(e=n||e===i?1:ga(e))<0?0:e,r):[]},Vn.dropRight=function(t,e,n){var r=null==t?0:t.length;return r?ii(t,0,(e=r-(e=n||e===i?1:ga(e)))<0?0:e):[]},Vn.dropRightWhile=function(t,e){return t&&t.length?fi(t,uo(e,3),!0,!0):[]},Vn.dropWhile=function(t,e){return t&&t.length?fi(t,uo(e,3),!0):[]},Vn.fill=function(t,e,n,r){var o=null==t?0:t.length;return o?(n&&"number"!=typeof n&&yo(t,e,n)&&(n=0,r=o),function(t,e,n,r){var o=t.length;for((n=ga(n))<0&&(n=-n>o?0:o+n),(r=r===i||r>o?o:ga(r))<0&&(r+=o),r=n>r?0:va(r);n<r;)t[n++]=e;return t}(t,e,n,r)):[]},Vn.filter=function(t,e){return(Hs(t)?Ne:mr)(t,uo(e,3))},Vn.flatMap=function(t,e){return _r(Ts(t,e),1)},Vn.flatMapDeep=function(t,e){return _r(Ts(t,e),p)},Vn.flatMapDepth=function(t,e,n){return n=n===i?1:ga(n),_r(Ts(t,e),n)},Vn.flatten=zo,Vn.flattenDeep=function(t){return(null==t?0:t.length)?_r(t,p):[]},Vn.flattenDepth=function(t,e){return(null==t?0:t.length)?_r(t,e=e===i?1:ga(e)):[]},Vn.flip=function(t){return Qi(t,512)},Vn.flow=nc,Vn.flowRight=rc,Vn.fromPairs=function(t){for(var e=-1,n=null==t?0:t.length,r={};++e<n;){var i=t[e];r[i[0]]=i[1]}return r},Vn.functions=function(t){return null==t?[]:Cr(t,Na(t))},Vn.functionsIn=function(t){return null==t?[]:Cr(t,Da(t))},Vn.groupBy=ys,Vn.initial=function(t){return(null==t?0:t.length)?ii(t,0,-1):[]},Vn.intersection=Ko,Vn.intersectionBy=Jo,Vn.intersectionWith=Xo,Vn.invert=Pa,Vn.invertBy=Oa,Vn.invokeMap=bs,Vn.iteratee=oc,Vn.keyBy=Cs,Vn.keys=Na,Vn.keysIn=Da,Vn.map=Ts,Vn.mapKeys=function(t,e){var n={};return e=uo(e,3),yr(t,(function(t,r,i){sr(n,e(t,r,i),t)})),n},Vn.mapValues=function(t,e){var n={};return e=uo(e,3),yr(t,(function(t,r,i){sr(n,r,e(t,r,i))})),n},Vn.matches=function(t){return Vr(ur(t,1))},Vn.matchesProperty=function(t,e){return Gr(t,ur(e,1))},Vn.memoize=Ms,Vn.merge=xa,Vn.mergeWith=Ma,Vn.method=sc,Vn.methodOf=ac,Vn.mixin=cc,Vn.negate=Ls,Vn.nthArg=function(t){return t=ga(t),Yr((function(e){return $r(e,t)}))},Vn.omit=La,Vn.omitBy=function(t,e){return Ba(t,Ls(uo(e)))},Vn.once=function(t){return Ps(2,t)},Vn.orderBy=function(t,e,n,r){return null==t?[]:(Hs(e)||(e=null==e?[]:[e]),Hs(n=r?i:n)||(n=null==n?[]:[n]),Hr(t,e,n))},Vn.over=dc,Vn.overArgs=Us,Vn.overEvery=lc,Vn.overSome=hc,Vn.partial=Bs,Vn.partialRight=js,Vn.partition=ws,Vn.pick=Ua,Vn.pickBy=Ba,Vn.property=pc,Vn.propertyOf=function(t){return function(e){return null==t?i:Tr(t,e)}},Vn.pull=Qo,Vn.pullAll=Zo,Vn.pullAllBy=function(t,e,n){return t&&t.length&&e&&e.length?qr(t,e,uo(n,2)):t},Vn.pullAllWith=function(t,e,n){return t&&t.length&&e&&e.length?qr(t,e,i,n):t},Vn.pullAt=ts,Vn.range=fc,Vn.rangeRight=gc,Vn.rearg=Fs,Vn.reject=function(t,e){return(Hs(t)?Ne:mr)(t,Ls(uo(e,3)))},Vn.remove=function(t,e){var n=[];if(!t||!t.length)return n;var r=-1,i=[],o=t.length;for(e=uo(e,3);++r<o;){var s=t[r];e(s,r,t)&&(n.push(s),i.push(r))}return Kr(t,i),n},Vn.rest=function(t,e){if("function"!=typeof t)throw new Ot(o);return Yr(t,e=e===i?e:ga(e))},Vn.reverse=es,Vn.sampleSize=function(t,e,n){return e=(n?yo(t,e,n):e===i)?1:ga(e),(Hs(t)?Zn:Zr)(t,e)},Vn.set=function(t,e,n){return null==t?t:ti(t,e,n)},Vn.setWith=function(t,e,n,r){return r="function"==typeof r?r:i,null==t?t:ti(t,e,n,r)},Vn.shuffle=function(t){return(Hs(t)?tr:ri)(t)},Vn.slice=function(t,e,n){var r=null==t?0:t.length;return r?(n&&"number"!=typeof n&&yo(t,e,n)?(e=0,n=r):(e=null==e?0:ga(e),n=n===i?r:ga(n)),ii(t,e,n)):[]},Vn.sortBy=Is,Vn.sortedUniq=function(t){return t&&t.length?ci(t):[]},Vn.sortedUniqBy=function(t,e){return t&&t.length?ci(t,uo(e,2)):[]},Vn.split=function(t,e,n){return n&&"number"!=typeof n&&yo(t,e,n)&&(e=n=i),(n=n===i?v:n>>>0)?(t=Sa(t))&&("string"==typeof e||null!=e&&!sa(e))&&!(e=di(e))&&cn(t)?bi(gn(t),0,n):t.split(e,n):[]},Vn.spread=function(t,e){if("function"!=typeof t)throw new Ot(o);return e=null==e?0:Sn(ga(e),0),Yr((function(n){var r=n[e],i=bi(n,0,e);return r&&Le(i,r),ke(t,this,i)}))},Vn.tail=function(t){var e=null==t?0:t.length;return e?ii(t,1,e):[]},Vn.take=function(t,e,n){return t&&t.length?ii(t,0,(e=n||e===i?1:ga(e))<0?0:e):[]},Vn.takeRight=function(t,e,n){var r=null==t?0:t.length;return r?ii(t,(e=r-(e=n||e===i?1:ga(e)))<0?0:e,r):[]},Vn.takeRightWhile=function(t,e){return t&&t.length?fi(t,uo(e,3),!1,!0):[]},Vn.takeWhile=function(t,e){return t&&t.length?fi(t,uo(e,3)):[]},Vn.tap=function(t,e){return e(t),t},Vn.throttle=function(t,e,n){var r=!0,i=!0;if("function"!=typeof t)throw new Ot(o);return ea(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ns(t,e,{leading:r,maxWait:e,trailing:i})},Vn.thru=fs,Vn.toArray=pa,Vn.toPairs=ja,Vn.toPairsIn=Fa,Vn.toPath=function(t){return Hs(t)?Me(t,Bo):ua(t)?[t]:Oi(Uo(Sa(t)))},Vn.toPlainObject=_a,Vn.transform=function(t,e,n){var r=Hs(t),i=r||Js(t)||da(t);if(e=uo(e,4),null==n){var o=t&&t.constructor;n=i?r?new o:[]:ea(t)&&Qs(o)?Gn(qt(t)):{}}return(i?Pe:yr)(t,(function(t,r,i){return e(n,t,r,i)})),n},Vn.unary=function(t){return Rs(t,1)},Vn.union=ns,Vn.unionBy=rs,Vn.unionWith=is,Vn.uniq=function(t){return t&&t.length?li(t):[]},Vn.uniqBy=function(t,e){return t&&t.length?li(t,uo(e,2)):[]},Vn.uniqWith=function(t,e){return e="function"==typeof e?e:i,t&&t.length?li(t,i,e):[]},Vn.unset=function(t,e){return null==t||hi(t,e)},Vn.unzip=os,Vn.unzipWith=ss,Vn.update=function(t,e,n){return null==t?t:pi(t,e,Si(n))},Vn.updateWith=function(t,e,n,r){return r="function"==typeof r?r:i,null==t?t:pi(t,e,Si(n),r)},Vn.values=Va,Vn.valuesIn=function(t){return null==t?[]:tn(t,Da(t))},Vn.without=as,Vn.words=Qa,Vn.wrap=function(t,e){return Bs(Si(e),t)},Vn.xor=cs,Vn.xorBy=us,Vn.xorWith=ds,Vn.zip=ls,Vn.zipObject=function(t,e){return mi(t||[],e||[],nr)},Vn.zipObjectDeep=function(t,e){return mi(t||[],e||[],ti)},Vn.zipWith=hs,Vn.entries=ja,Vn.entriesIn=Fa,Vn.extend=ya,Vn.extendWith=ba,cc(Vn,Vn),Vn.add=_c,Vn.attempt=Za,Vn.camelCase=Ga,Vn.capitalize=Wa,Vn.ceil=Sc,Vn.clamp=function(t,e,n){return n===i&&(n=e,e=i),n!==i&&(n=(n=ma(n))==n?n:0),e!==i&&(e=(e=ma(e))==e?e:0),cr(ma(t),e,n)},Vn.clone=function(t){return ur(t,4)},Vn.cloneDeep=function(t){return ur(t,5)},Vn.cloneDeepWith=function(t,e){return ur(t,5,e="function"==typeof e?e:i)},Vn.cloneWith=function(t,e){return ur(t,4,e="function"==typeof e?e:i)},Vn.conformsTo=function(t,e){return null==e||dr(t,e,Na(e))},Vn.deburr=$a,Vn.defaultTo=function(t,e){return null==t||t!=t?e:t},Vn.divide=Ec,Vn.endsWith=function(t,e,n){t=Sa(t),e=di(e);var r=t.length,o=n=n===i?r:cr(ga(n),0,r);return(n-=e.length)>=0&&t.slice(n,o)==e},Vn.eq=Vs,Vn.escape=function(t){return(t=Sa(t))&&Y.test(t)?t.replace(J,sn):t},Vn.escapeRegExp=function(t){return(t=Sa(t))&&ot.test(t)?t.replace(it,"\\$&"):t},Vn.every=function(t,e,n){var r=Hs(t)?Ae:gr;return n&&yo(t,e,n)&&(e=i),r(t,uo(e,3))},Vn.find=ms,Vn.findIndex=$o,Vn.findKey=function(t,e){return Ve(t,uo(e,3),yr)},Vn.findLast=_s,Vn.findLastIndex=Ho,Vn.findLastKey=function(t,e){return Ve(t,uo(e,3),br)},Vn.floor=yc,Vn.forEach=Ss,Vn.forEachRight=Es,Vn.forIn=function(t,e){return null==t?t:Sr(t,uo(e,3),Da)},Vn.forInRight=function(t,e){return null==t?t:Er(t,uo(e,3),Da)},Vn.forOwn=function(t,e){return t&&yr(t,uo(e,3))},Vn.forOwnRight=function(t,e){return t&&br(t,uo(e,3))},Vn.get=ka,Vn.gt=Gs,Vn.gte=Ws,Vn.has=function(t,e){return null!=t&&mo(t,e,Rr)},Vn.hasIn=Ra,Vn.head=qo,Vn.identity=ic,Vn.includes=function(t,e,n,r){t=qs(t)?t:Va(t),n=n&&!r?ga(n):0;var i=t.length;return n<0&&(n=Sn(i+n,0)),ca(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&We(t,e,n)>-1},Vn.indexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:ga(n);return i<0&&(i=Sn(r+i,0)),We(t,e,i)},Vn.inRange=function(t,e,n){return e=fa(e),n===i?(n=e,e=0):n=fa(n),function(t,e,n){return t>=En(e,n)&&t<Sn(e,n)}(t=ma(t),e,n)},Vn.invoke=Aa,Vn.isArguments=$s,Vn.isArray=Hs,Vn.isArrayBuffer=zs,Vn.isArrayLike=qs,Vn.isArrayLikeObject=Ks,Vn.isBoolean=function(t){return!0===t||!1===t||na(t)&&Ir(t)==E},Vn.isBuffer=Js,Vn.isDate=Xs,Vn.isElement=function(t){return na(t)&&1===t.nodeType&&!oa(t)},Vn.isEmpty=function(t){if(null==t)return!0;if(qs(t)&&(Hs(t)||"string"==typeof t||"function"==typeof t.splice||Js(t)||da(t)||$s(t)))return!t.length;var e=vo(t);if(e==w||e==O)return!t.size;if(wo(t))return!Ur(t).length;for(var n in t)if(Lt.call(t,n))return!1;return!0},Vn.isEqual=function(t,e){return Dr(t,e)},Vn.isEqualWith=function(t,e,n){var r=(n="function"==typeof n?n:i)?n(t,e):i;return r===i?Dr(t,e,i,n):!!r},Vn.isError=Ys,Vn.isFinite=function(t){return"number"==typeof t&&Ee(t)},Vn.isFunction=Qs,Vn.isInteger=Zs,Vn.isLength=ta,Vn.isMap=ra,Vn.isMatch=function(t,e){return t===e||xr(t,e,ho(e))},Vn.isMatchWith=function(t,e,n){return n="function"==typeof n?n:i,xr(t,e,ho(e),n)},Vn.isNaN=function(t){return ia(t)&&t!=+t},Vn.isNative=function(t){if(To(t))throw new Tt("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Mr(t)},Vn.isNil=function(t){return null==t},Vn.isNull=function(t){return null===t},Vn.isNumber=ia,Vn.isObject=ea,Vn.isObjectLike=na,Vn.isPlainObject=oa,Vn.isRegExp=sa,Vn.isSafeInteger=function(t){return Zs(t)&&t>=-9007199254740991&&t<=f},Vn.isSet=aa,Vn.isString=ca,Vn.isSymbol=ua,Vn.isTypedArray=da,Vn.isUndefined=function(t){return t===i},Vn.isWeakMap=function(t){return na(t)&&vo(t)==D},Vn.isWeakSet=function(t){return na(t)&&"[object WeakSet]"==Ir(t)},Vn.join=function(t,e){return null==t?"":Fe.call(t,e)},Vn.kebabCase=Ha,Vn.last=Yo,Vn.lastIndexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=ga(n))<0?Sn(r+o,0):En(o,r-1)),e==e?function(t,e,n){for(var r=n+1;r--;)if(t[r]===e)return r;return r}(t,e,o):Ge(t,He,o,!0)},Vn.lowerCase=za,Vn.lowerFirst=qa,Vn.lt=la,Vn.lte=ha,Vn.max=function(t){return t&&t.length?vr(t,ic,kr):i},Vn.maxBy=function(t,e){return t&&t.length?vr(t,uo(e,2),kr):i},Vn.mean=function(t){return ze(t,ic)},Vn.meanBy=function(t,e){return ze(t,uo(e,2))},Vn.min=function(t){return t&&t.length?vr(t,ic,jr):i},Vn.minBy=function(t,e){return t&&t.length?vr(t,uo(e,2),jr):i},Vn.stubArray=vc,Vn.stubFalse=mc,Vn.stubObject=function(){return{}},Vn.stubString=function(){return""},Vn.stubTrue=function(){return!0},Vn.multiply=Cc,Vn.nth=function(t,e){return t&&t.length?$r(t,ga(e)):i},Vn.noConflict=function(){return ge._===this&&(ge._=Vt),this},Vn.noop=uc,Vn.now=ks,Vn.pad=function(t,e,n){t=Sa(t);var r=(e=ga(e))?fn(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return Hi(ve(i),n)+t+Hi(fe(i),n)},Vn.padEnd=function(t,e,n){t=Sa(t);var r=(e=ga(e))?fn(t):0;return e&&r<e?t+Hi(e-r,n):t},Vn.padStart=function(t,e,n){t=Sa(t);var r=(e=ga(e))?fn(t):0;return e&&r<e?Hi(e-r,n)+t:t},Vn.parseInt=function(t,e,n){return n||null==e?e=0:e&&(e=+e),bn(Sa(t).replace(st,""),e||0)},Vn.random=function(t,e,n){if(n&&"boolean"!=typeof n&&yo(t,e,n)&&(e=n=i),n===i&&("boolean"==typeof e?(n=e,e=i):"boolean"==typeof t&&(n=t,t=i)),t===i&&e===i?(t=0,e=1):(t=fa(t),e===i?(e=t,t=0):e=fa(e)),t>e){var r=t;t=e,e=r}if(n||t%1||e%1){var o=Cn();return En(t+o*(e-t+le("1e-"+((o+"").length-1))),e)}return Jr(t,e)},Vn.reduce=function(t,e,n){var r=Hs(t)?Ue:Je,i=arguments.length<3;return r(t,uo(e,4),n,i,pr)},Vn.reduceRight=function(t,e,n){var r=Hs(t)?Be:Je,i=arguments.length<3;return r(t,uo(e,4),n,i,fr)},Vn.repeat=function(t,e,n){return e=(n?yo(t,e,n):e===i)?1:ga(e),Xr(Sa(t),e)},Vn.replace=function(){var t=arguments,e=Sa(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Vn.result=function(t,e,n){var r=-1,o=(e=Ei(e,t)).length;for(o||(o=1,t=i);++r<o;){var s=null==t?i:t[Bo(e[r])];s===i&&(r=o,s=n),t=Qs(s)?s.call(t):s}return t},Vn.round=Tc,Vn.runInContext=t,Vn.sample=function(t){return(Hs(t)?Qn:Qr)(t)},Vn.size=function(t){if(null==t)return 0;if(qs(t))return ca(t)?fn(t):t.length;var e=vo(t);return e==w||e==O?t.size:Ur(t).length},Vn.snakeCase=Ka,Vn.some=function(t,e,n){var r=Hs(t)?je:oi;return n&&yo(t,e,n)&&(e=i),r(t,uo(e,3))},Vn.sortedIndex=function(t,e){return si(t,e)},Vn.sortedIndexBy=function(t,e,n){return ai(t,e,uo(n,2))},Vn.sortedIndexOf=function(t,e){var n=null==t?0:t.length;if(n){var r=si(t,e);if(r<n&&Vs(t[r],e))return r}return-1},Vn.sortedLastIndex=function(t,e){return si(t,e,!0)},Vn.sortedLastIndexBy=function(t,e,n){return ai(t,e,uo(n,2),!0)},Vn.sortedLastIndexOf=function(t,e){if(null==t?0:t.length){var n=si(t,e,!0)-1;if(Vs(t[n],e))return n}return-1},Vn.startCase=Ja,Vn.startsWith=function(t,e,n){return t=Sa(t),n=null==n?0:cr(ga(n),0,t.length),e=di(e),t.slice(n,n+e.length)==e},Vn.subtract=wc,Vn.sum=function(t){return t&&t.length?Xe(t,ic):0},Vn.sumBy=function(t,e){return t&&t.length?Xe(t,uo(e,2)):0},Vn.template=function(t,e,n){var r=Vn.templateSettings;n&&yo(t,e,n)&&(e=i),t=Sa(t),e=ba({},e,r,Zi);var o,s,a=ba({},e.imports,r.imports,Zi),c=Na(a),u=tn(a,c),d=0,l=e.interpolate||bt,h="__p += '",p=Rt((e.escape||bt).source+"|"+l.source+"|"+(l===tt?ft:bt).source+"|"+(e.evaluate||bt).source+"|$","g"),f="//# sourceURL="+(Lt.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ae+"]")+"\n";t.replace(p,(function(e,n,r,i,a,c){return r||(r=i),h+=t.slice(d,c).replace(Ct,an),n&&(o=!0,h+="' +\n__e("+n+") +\n'"),a&&(s=!0,h+="';\n"+a+";\n__p += '"),r&&(h+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),d=c+e.length,e})),h+="';\n";var g=Lt.call(e,"variable")&&e.variable;if(g){if(ht.test(g))throw new Tt("Invalid `variable` option passed into `_.template`")}else h="with (obj) {\n"+h+"\n}\n";h=(s?h.replace(H,""):h).replace(z,"$1").replace(q,"$1;"),h="function("+(g||"obj")+") {\n"+(g?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+h+"return __p\n}";var v=Za((function(){return wt(c,f+"return "+h).apply(i,u)}));if(v.source=h,Ys(v))throw v;return v},Vn.times=function(t,e){if((t=ga(t))<1||t>f)return[];var n=v,r=En(t,v);e=uo(e),t-=v;for(var i=Ye(r,e);++n<t;)e(n);return i},Vn.toFinite=fa,Vn.toInteger=ga,Vn.toLength=va,Vn.toLower=function(t){return Sa(t).toLowerCase()},Vn.toNumber=ma,Vn.toSafeInteger=function(t){return t?cr(ga(t),-9007199254740991,f):0===t?t:0},Vn.toString=Sa,Vn.toUpper=function(t){return Sa(t).toUpperCase()},Vn.trim=function(t,e,n){if((t=Sa(t))&&(n||e===i))return Qe(t);if(!t||!(e=di(e)))return t;var r=gn(t),o=gn(e);return bi(r,nn(r,o),rn(r,o)+1).join("")},Vn.trimEnd=function(t,e,n){if((t=Sa(t))&&(n||e===i))return t.slice(0,vn(t)+1);if(!t||!(e=di(e)))return t;var r=gn(t);return bi(r,0,rn(r,gn(e))+1).join("")},Vn.trimStart=function(t,e,n){if((t=Sa(t))&&(n||e===i))return t.replace(st,"");if(!t||!(e=di(e)))return t;var r=gn(t);return bi(r,nn(r,gn(e))).join("")},Vn.truncate=function(t,e){var n=30,r="...";if(ea(e)){var o="separator"in e?e.separator:o;n="length"in e?ga(e.length):n,r="omission"in e?di(e.omission):r}var s=(t=Sa(t)).length;if(cn(t)){var a=gn(t);s=a.length}if(n>=s)return t;var c=n-fn(r);if(c<1)return r;var u=a?bi(a,0,c).join(""):t.slice(0,c);if(o===i)return u+r;if(a&&(c+=u.length-c),sa(o)){if(t.slice(c).search(o)){var d,l=u;for(o.global||(o=Rt(o.source,Sa(gt.exec(o))+"g")),o.lastIndex=0;d=o.exec(l);)var h=d.index;u=u.slice(0,h===i?c:h)}}else if(t.indexOf(di(o),c)!=c){var p=u.lastIndexOf(o);p>-1&&(u=u.slice(0,p))}return u+r},Vn.unescape=function(t){return(t=Sa(t))&&X.test(t)?t.replace(K,mn):t},Vn.uniqueId=function(t){var e=++Ut;return Sa(t)+e},Vn.upperCase=Xa,Vn.upperFirst=Ya,Vn.each=Ss,Vn.eachRight=Es,Vn.first=qo,cc(Vn,(bc={},yr(Vn,(function(t,e){Lt.call(Vn.prototype,e)||(bc[e]=t)})),bc),{chain:!1}),Vn.VERSION="4.17.21",Pe(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){Vn[t].placeholder=Vn})),Pe(["drop","take"],(function(t,e){Hn.prototype[t]=function(n){n=n===i?1:Sn(ga(n),0);var r=this.__filtered__&&!e?new Hn(this):this.clone();return r.__filtered__?r.__takeCount__=En(n,r.__takeCount__):r.__views__.push({size:En(n,v),type:t+(r.__dir__<0?"Right":"")}),r},Hn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),Pe(["filter","map","takeWhile"],(function(t,e){var n=e+1,r=1==n||3==n;Hn.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:uo(t,3),type:n}),e.__filtered__=e.__filtered__||r,e}})),Pe(["head","last"],(function(t,e){var n="take"+(e?"Right":"");Hn.prototype[t]=function(){return this[n](1).value()[0]}})),Pe(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");Hn.prototype[t]=function(){return this.__filtered__?new Hn(this):this[n](1)}})),Hn.prototype.compact=function(){return this.filter(ic)},Hn.prototype.find=function(t){return this.filter(t).head()},Hn.prototype.findLast=function(t){return this.reverse().find(t)},Hn.prototype.invokeMap=Yr((function(t,e){return"function"==typeof t?new Hn(this):this.map((function(n){return Ar(n,t,e)}))})),Hn.prototype.reject=function(t){return this.filter(Ls(uo(t)))},Hn.prototype.slice=function(t,e){t=ga(t);var n=this;return n.__filtered__&&(t>0||e<0)?new Hn(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==i&&(n=(e=ga(e))<0?n.dropRight(-e):n.take(e-t)),n)},Hn.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Hn.prototype.toArray=function(){return this.take(v)},yr(Hn.prototype,(function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),r=/^(?:head|last)$/.test(e),o=Vn[r?"take"+("last"==e?"Right":""):e],s=r||/^find/.test(e);o&&(Vn.prototype[e]=function(){var e=this.__wrapped__,a=r?[1]:arguments,c=e instanceof Hn,u=a[0],d=c||Hs(e),l=function(t){var e=o.apply(Vn,Le([t],a));return r&&h?e[0]:e};d&&n&&"function"==typeof u&&1!=u.length&&(c=d=!1);var h=this.__chain__,p=!!this.__actions__.length,f=s&&!h,g=c&&!p;if(!s&&d){e=g?e:new Hn(this);var v=t.apply(e,a);return v.__actions__.push({func:fs,args:[l],thisArg:i}),new $n(v,h)}return f&&g?t.apply(this,a):(v=this.thru(l),f?r?v.value()[0]:v.value():v)})})),Pe(["pop","push","shift","sort","splice","unshift"],(function(t){var e=At[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);Vn.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return e.apply(Hs(i)?i:[],t)}return this[n]((function(n){return e.apply(Hs(n)?n:[],t)}))}})),yr(Hn.prototype,(function(t,e){var n=Vn[e];if(n){var r=n.name+"";Lt.call(Nn,r)||(Nn[r]=[]),Nn[r].push({name:e,func:n})}})),Nn[Vi(i,2).name]=[{name:"wrapper",func:i}],Hn.prototype.clone=function(){var t=new Hn(this.__wrapped__);return t.__actions__=Oi(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Oi(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Oi(this.__views__),t},Hn.prototype.reverse=function(){if(this.__filtered__){var t=new Hn(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Hn.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=Hs(t),r=e<0,i=n?t.length:0,o=function(t,e,n){var r=-1,i=n.length;for(;++r<i;){var o=n[r],s=o.size;switch(o.type){case"drop":t+=s;break;case"dropRight":e-=s;break;case"take":e=En(e,t+s);break;case"takeRight":t=Sn(t,e-s)}}return{start:t,end:e}}(0,i,this.__views__),s=o.start,a=o.end,c=a-s,u=r?a:s-1,d=this.__iteratees__,l=d.length,h=0,p=En(c,this.__takeCount__);if(!n||!r&&i==c&&p==c)return gi(t,this.__actions__);var f=[];t:for(;c--&&h<p;){for(var g=-1,v=t[u+=e];++g<l;){var m=d[g],_=m.iteratee,S=m.type,E=_(v);if(2==S)v=E;else if(!E){if(1==S)continue t;break t}}f[h++]=v}return f},Vn.prototype.at=gs,Vn.prototype.chain=function(){return ps(this)},Vn.prototype.commit=function(){return new $n(this.value(),this.__chain__)},Vn.prototype.next=function(){this.__values__===i&&(this.__values__=pa(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?i:this.__values__[this.__index__++]}},Vn.prototype.plant=function(t){for(var e,n=this;n instanceof Wn;){var r=Fo(n);r.__index__=0,r.__values__=i,e?o.__wrapped__=r:e=r;var o=r;n=n.__wrapped__}return o.__wrapped__=t,e},Vn.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Hn){var e=t;return this.__actions__.length&&(e=new Hn(this)),(e=e.reverse()).__actions__.push({func:fs,args:[es],thisArg:i}),new $n(e,this.__chain__)}return this.thru(es)},Vn.prototype.toJSON=Vn.prototype.valueOf=Vn.prototype.value=function(){return gi(this.__wrapped__,this.__actions__)},Vn.prototype.first=Vn.prototype.head,Qt&&(Vn.prototype[Qt]=function(){return this}),Vn}();ge._=_n,(r=function(){return _n}.call(e,n,e,t))===i||(t.exports=r)}.call(this)},2492:(t,e,n)=>{var r=n(2980),i=n(1463)((function(t,e,n){r(t,e,n)}));t.exports=i},5062:t=>{t.exports=function(){return!1}},9881:(t,e,n)=>{var r=n(8363),i=n(1704);t.exports=function(t){return r(t,i(t))}},8660:(t,e,n)=>{var r;!function(t){!function(e){var r="object"==typeof n.g?n.g:"object"==typeof self?self:"object"==typeof this?this:Function("return this;")(),i=o(t);function o(t,e){return function(n,r){"function"!=typeof t[n]&&Object.defineProperty(t,n,{configurable:!0,writable:!0,value:r}),e&&e(n,r)}}void 0===r.Reflect?r.Reflect=t:i=o(r.Reflect,i),function(t){var e=Object.prototype.hasOwnProperty,n="function"==typeof Symbol,r=n&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=n&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",o="function"==typeof Object.create,s={__proto__:[]}instanceof Array,a=!o&&!s,c={create:o?function(){return rt(Object.create(null))}:s?function(){return rt({__proto__:null})}:function(){return rt({})},has:a?function(t,n){return e.call(t,n)}:function(t,e){return e in t},get:a?function(t,n){return e.call(t,n)?t[n]:void 0}:function(t,e){return t[e]}},u=Object.getPrototypeOf(Function),d="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,l=d||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?tt():Map,h=d||"function"!=typeof Set||"function"!=typeof Set.prototype.entries?et():Set,p=new(d||"function"!=typeof WeakMap?nt():WeakMap);function f(t,e,n,r){if(M(n)){if(!$(t))throw new TypeError;if(!z(e))throw new TypeError;return T(t,e)}if(!$(t))throw new TypeError;if(!B(e))throw new TypeError;if(!B(r)&&!M(r)&&!L(r))throw new TypeError;return L(r)&&(r=void 0),w(t,e,n=W(n),r)}function g(t,e){function n(n,r){if(!B(n))throw new TypeError;if(!M(r)&&!q(r))throw new TypeError;A(t,e,n,r)}return n}function v(t,e,n,r){if(!B(n))throw new TypeError;return M(r)||(r=W(r)),A(t,e,n,r)}function m(t,e,n){if(!B(e))throw new TypeError;return M(n)||(n=W(n)),k(t,e,n)}function _(t,e,n){if(!B(e))throw new TypeError;return M(n)||(n=W(n)),R(t,e,n)}function S(t,e,n){if(!B(e))throw new TypeError;return M(n)||(n=W(n)),P(t,e,n)}function E(t,e,n){if(!B(e))throw new TypeError;return M(n)||(n=W(n)),O(t,e,n)}function y(t,e){if(!B(t))throw new TypeError;return M(e)||(e=W(e)),N(t,e)}function b(t,e){if(!B(t))throw new TypeError;return M(e)||(e=W(e)),D(t,e)}function C(t,e,n){if(!B(e))throw new TypeError;M(n)||(n=W(n));var r=I(e,n,!1);if(M(r))return!1;if(!r.delete(t))return!1;if(r.size>0)return!0;var i=p.get(e);return i.delete(n),i.size>0||p.delete(e),!0}function T(t,e){for(var n=t.length-1;n>=0;--n){var r=(0,t[n])(e);if(!M(r)&&!L(r)){if(!z(r))throw new TypeError;e=r}}return e}function w(t,e,n,r){for(var i=t.length-1;i>=0;--i){var o=(0,t[i])(e,n,r);if(!M(o)&&!L(o)){if(!B(o))throw new TypeError;r=o}}return r}function I(t,e,n){var r=p.get(t);if(M(r)){if(!n)return;r=new l,p.set(t,r)}var i=r.get(e);if(M(i)){if(!n)return;i=new l,r.set(e,i)}return i}function k(t,e,n){if(R(t,e,n))return!0;var r=Z(e);return!L(r)&&k(t,r,n)}function R(t,e,n){var r=I(e,n,!1);return!M(r)&&V(r.has(t))}function P(t,e,n){if(R(t,e,n))return O(t,e,n);var r=Z(e);return L(r)?void 0:P(t,r,n)}function O(t,e,n){var r=I(e,n,!1);if(!M(r))return r.get(t)}function A(t,e,n,r){I(n,r,!0).set(t,e)}function N(t,e){var n=D(t,e),r=Z(t);if(null===r)return n;var i=N(r,e);if(i.length<=0)return n;if(n.length<=0)return i;for(var o=new h,s=[],a=0,c=n;a<c.length;a++){var u=c[a];o.has(u)||(o.add(u),s.push(u))}for(var d=0,l=i;d<l.length;d++){u=l[d];o.has(u)||(o.add(u),s.push(u))}return s}function D(t,e){var n=[],r=I(t,e,!1);if(M(r))return n;for(var i=J(r.keys()),o=0;;){var s=Y(i);if(!s)return n.length=o,n;var a=X(s);try{n[o]=a}catch(t){try{Q(i)}finally{throw t}}o++}}function x(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}function M(t){return void 0===t}function L(t){return null===t}function U(t){return"symbol"==typeof t}function B(t){return"object"==typeof t?null!==t:"function"==typeof t}function j(t,e){switch(x(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}var n=3===e?"string":5===e?"number":"default",i=K(t,r);if(void 0!==i){var o=i.call(t,n);if(B(o))throw new TypeError;return o}return F(t,"default"===n?"number":n)}function F(t,e){if("string"===e){var n=t.toString;if(H(n))if(!B(i=n.call(t)))return i;if(H(r=t.valueOf))if(!B(i=r.call(t)))return i}else{var r;if(H(r=t.valueOf))if(!B(i=r.call(t)))return i;var i,o=t.toString;if(H(o))if(!B(i=o.call(t)))return i}throw new TypeError}function V(t){return!!t}function G(t){return""+t}function W(t){var e=j(t,3);return U(e)?e:G(e)}function $(t){return Array.isArray?Array.isArray(t):t instanceof Object?t instanceof Array:"[object Array]"===Object.prototype.toString.call(t)}function H(t){return"function"==typeof t}function z(t){return"function"==typeof t}function q(t){switch(x(t)){case 3:case 4:return!0;default:return!1}}function K(t,e){var n=t[e];if(null!=n){if(!H(n))throw new TypeError;return n}}function J(t){var e=K(t,i);if(!H(e))throw new TypeError;var n=e.call(t);if(!B(n))throw new TypeError;return n}function X(t){return t.value}function Y(t){var e=t.next();return!e.done&&e}function Q(t){var e=t.return;e&&e.call(t)}function Z(t){var e=Object.getPrototypeOf(t);if("function"!=typeof t||t===u)return e;if(e!==u)return e;var n=t.prototype,r=n&&Object.getPrototypeOf(n);if(null==r||r===Object.prototype)return e;var i=r.constructor;return"function"!=typeof i||i===t?e:i}function tt(){var t={},e=[],n=function(){function t(t,e,n){this._index=0,this._keys=t,this._values=e,this._selector=n}return t.prototype["@@iterator"]=function(){return this},t.prototype[i]=function(){return this},t.prototype.next=function(){var t=this._index;if(t>=0&&t<this._keys.length){var n=this._selector(this._keys[t],this._values[t]);return t+1>=this._keys.length?(this._index=-1,this._keys=e,this._values=e):this._index++,{value:n,done:!1}}return{value:void 0,done:!0}},t.prototype.throw=function(t){throw this._index>=0&&(this._index=-1,this._keys=e,this._values=e),t},t.prototype.return=function(t){return this._index>=0&&(this._index=-1,this._keys=e,this._values=e),{value:t,done:!0}},t}();return function(){function e(){this._keys=[],this._values=[],this._cacheKey=t,this._cacheIndex=-2}return Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.has=function(t){return this._find(t,!1)>=0},e.prototype.get=function(t){var e=this._find(t,!1);return e>=0?this._values[e]:void 0},e.prototype.set=function(t,e){var n=this._find(t,!0);return this._values[n]=e,this},e.prototype.delete=function(e){var n=this._find(e,!1);if(n>=0){for(var r=this._keys.length,i=n+1;i<r;i++)this._keys[i-1]=this._keys[i],this._values[i-1]=this._values[i];return this._keys.length--,this._values.length--,e===this._cacheKey&&(this._cacheKey=t,this._cacheIndex=-2),!0}return!1},e.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=t,this._cacheIndex=-2},e.prototype.keys=function(){return new n(this._keys,this._values,r)},e.prototype.values=function(){return new n(this._keys,this._values,o)},e.prototype.entries=function(){return new n(this._keys,this._values,s)},e.prototype["@@iterator"]=function(){return this.entries()},e.prototype[i]=function(){return this.entries()},e.prototype._find=function(t,e){return this._cacheKey!==t&&(this._cacheIndex=this._keys.indexOf(this._cacheKey=t)),this._cacheIndex<0&&e&&(this._cacheIndex=this._keys.length,this._keys.push(t),this._values.push(void 0)),this._cacheIndex},e}();function r(t,e){return t}function o(t,e){return e}function s(t,e){return[t,e]}}function et(){return function(){function t(){this._map=new l}return Object.defineProperty(t.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),t.prototype.has=function(t){return this._map.has(t)},t.prototype.add=function(t){return this._map.set(t,t),this},t.prototype.delete=function(t){return this._map.delete(t)},t.prototype.clear=function(){this._map.clear()},t.prototype.keys=function(){return this._map.keys()},t.prototype.values=function(){return this._map.values()},t.prototype.entries=function(){return this._map.entries()},t.prototype["@@iterator"]=function(){return this.keys()},t.prototype[i]=function(){return this.keys()},t}()}function nt(){var t=16,n=c.create(),r=i();return function(){function t(){this._key=i()}return t.prototype.has=function(t){var e=o(t,!1);return void 0!==e&&c.has(e,this._key)},t.prototype.get=function(t){var e=o(t,!1);return void 0!==e?c.get(e,this._key):void 0},t.prototype.set=function(t,e){return o(t,!0)[this._key]=e,this},t.prototype.delete=function(t){var e=o(t,!1);return void 0!==e&&delete e[this._key]},t.prototype.clear=function(){this._key=i()},t}();function i(){var t;do{t="@@WeakMap@@"+u()}while(c.has(n,t));return n[t]=!0,t}function o(t,n){if(!e.call(t,r)){if(!n)return;Object.defineProperty(t,r,{value:c.create()})}return t[r]}function s(t,e){for(var n=0;n<e;++n)t[n]=255*Math.random()|0;return t}function a(t){return"function"==typeof Uint8Array?"undefined"!=typeof crypto?crypto.getRandomValues(new Uint8Array(t)):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(new Uint8Array(t)):s(new Uint8Array(t),t):s(new Array(t),t)}function u(){var e=a(t);e[6]=79&e[6]|64,e[8]=191&e[8]|128;for(var n="",r=0;r<t;++r){var i=e[r];4!==r&&6!==r&&8!==r||(n+="-"),i<16&&(n+="0"),n+=i.toString(16).toLowerCase()}return n}}function rt(t){return t.__=void 0,delete t.__,t}t("decorate",f),t("metadata",g),t("defineMetadata",v),t("hasMetadata",m),t("hasOwnMetadata",_),t("getMetadata",S),t("getOwnMetadata",E),t("getMetadataKeys",y),t("getOwnMetadataKeys",b),t("deleteMetadata",C)}(i)}()}(r||(r={}))},7539:t=>{"use strict";const e={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};e.localCName=e.generateIdentifier(),e.splitLines=function(t){return t.trim().split("\n").map((t=>t.trim()))},e.splitSections=function(t){return t.split("\nm=").map(((t,e)=>(e>0?"m="+t:t).trim()+"\r\n"))},e.getDescription=function(t){const n=e.splitSections(t);return n&&n[0]},e.getMediaSections=function(t){const n=e.splitSections(t);return n.shift(),n},e.matchPrefix=function(t,n){return e.splitLines(t).filter((t=>0===t.indexOf(n)))},e.parseCandidate=function(t){let e;e=0===t.indexOf("a=candidate:")?t.substring(12).split(" "):t.substring(10).split(" ");const n={foundation:e[0],component:{1:"rtp",2:"rtcp"}[e[1]]||e[1],protocol:e[2].toLowerCase(),priority:parseInt(e[3],10),ip:e[4],address:e[4],port:parseInt(e[5],10),type:e[7]};for(let t=8;t<e.length;t+=2)switch(e[t]){case"raddr":n.relatedAddress=e[t+1];break;case"rport":n.relatedPort=parseInt(e[t+1],10);break;case"tcptype":n.tcpType=e[t+1];break;case"ufrag":n.ufrag=e[t+1],n.usernameFragment=e[t+1];break;default:void 0===n[e[t]]&&(n[e[t]]=e[t+1])}return n},e.writeCandidate=function(t){const e=[];e.push(t.foundation);const n=t.component;"rtp"===n?e.push(1):"rtcp"===n?e.push(2):e.push(n),e.push(t.protocol.toUpperCase()),e.push(t.priority),e.push(t.address||t.ip),e.push(t.port);const r=t.type;return e.push("typ"),e.push(r),"host"!==r&&t.relatedAddress&&t.relatedPort&&(e.push("raddr"),e.push(t.relatedAddress),e.push("rport"),e.push(t.relatedPort)),t.tcpType&&"tcp"===t.protocol.toLowerCase()&&(e.push("tcptype"),e.push(t.tcpType)),(t.usernameFragment||t.ufrag)&&(e.push("ufrag"),e.push(t.usernameFragment||t.ufrag)),"candidate:"+e.join(" ")},e.parseIceOptions=function(t){return t.substr(14).split(" ")},e.parseRtpMap=function(t){let e=t.substr(9).split(" ");const n={payloadType:parseInt(e.shift(),10)};return e=e[0].split("/"),n.name=e[0],n.clockRate=parseInt(e[1],10),n.channels=3===e.length?parseInt(e[2],10):1,n.numChannels=n.channels,n},e.writeRtpMap=function(t){let e=t.payloadType;void 0!==t.preferredPayloadType&&(e=t.preferredPayloadType);const n=t.channels||t.numChannels||1;return"a=rtpmap:"+e+" "+t.name+"/"+t.clockRate+(1!==n?"/"+n:"")+"\r\n"},e.parseExtmap=function(t){const e=t.substr(9).split(" ");return{id:parseInt(e[0],10),direction:e[0].indexOf("/")>0?e[0].split("/")[1]:"sendrecv",uri:e[1]}},e.writeExtmap=function(t){return"a=extmap:"+(t.id||t.preferredId)+(t.direction&&"sendrecv"!==t.direction?"/"+t.direction:"")+" "+t.uri+"\r\n"},e.parseFmtp=function(t){const e={};let n;const r=t.substr(t.indexOf(" ")+1).split(";");for(let t=0;t<r.length;t++)n=r[t].trim().split("="),e[n[0].trim()]=n[1];return e},e.writeFmtp=function(t){let e="",n=t.payloadType;if(void 0!==t.preferredPayloadType&&(n=t.preferredPayloadType),t.parameters&&Object.keys(t.parameters).length){const r=[];Object.keys(t.parameters).forEach((e=>{void 0!==t.parameters[e]?r.push(e+"="+t.parameters[e]):r.push(e)})),e+="a=fmtp:"+n+" "+r.join(";")+"\r\n"}return e},e.parseRtcpFb=function(t){const e=t.substr(t.indexOf(" ")+1).split(" ");return{type:e.shift(),parameter:e.join(" ")}},e.writeRtcpFb=function(t){let e="",n=t.payloadType;return void 0!==t.preferredPayloadType&&(n=t.preferredPayloadType),t.rtcpFeedback&&t.rtcpFeedback.length&&t.rtcpFeedback.forEach((t=>{e+="a=rtcp-fb:"+n+" "+t.type+(t.parameter&&t.parameter.length?" "+t.parameter:"")+"\r\n"})),e},e.parseSsrcMedia=function(t){const e=t.indexOf(" "),n={ssrc:parseInt(t.substr(7,e-7),10)},r=t.indexOf(":",e);return r>-1?(n.attribute=t.substr(e+1,r-e-1),n.value=t.substr(r+1)):n.attribute=t.substr(e+1),n},e.parseSsrcGroup=function(t){const e=t.substr(13).split(" ");return{semantics:e.shift(),ssrcs:e.map((t=>parseInt(t,10)))}},e.getMid=function(t){const n=e.matchPrefix(t,"a=mid:")[0];if(n)return n.substr(6)},e.parseFingerprint=function(t){const e=t.substr(14).split(" ");return{algorithm:e[0].toLowerCase(),value:e[1].toUpperCase()}},e.getDtlsParameters=function(t,n){return{role:"auto",fingerprints:e.matchPrefix(t+n,"a=fingerprint:").map(e.parseFingerprint)}},e.writeDtlsParameters=function(t,e){let n="a=setup:"+e+"\r\n";return t.fingerprints.forEach((t=>{n+="a=fingerprint:"+t.algorithm+" "+t.value+"\r\n"})),n},e.parseCryptoLine=function(t){const e=t.substr(9).split(" ");return{tag:parseInt(e[0],10),cryptoSuite:e[1],keyParams:e[2],sessionParams:e.slice(3)}},e.writeCryptoLine=function(t){return"a=crypto:"+t.tag+" "+t.cryptoSuite+" "+("object"==typeof t.keyParams?e.writeCryptoKeyParams(t.keyParams):t.keyParams)+(t.sessionParams?" "+t.sessionParams.join(" "):"")+"\r\n"},e.parseCryptoKeyParams=function(t){if(0!==t.indexOf("inline:"))return null;const e=t.substr(7).split("|");return{keyMethod:"inline",keySalt:e[0],lifeTime:e[1],mkiValue:e[2]?e[2].split(":")[0]:void 0,mkiLength:e[2]?e[2].split(":")[1]:void 0}},e.writeCryptoKeyParams=function(t){return t.keyMethod+":"+t.keySalt+(t.lifeTime?"|"+t.lifeTime:"")+(t.mkiValue&&t.mkiLength?"|"+t.mkiValue+":"+t.mkiLength:"")},e.getCryptoParameters=function(t,n){return e.matchPrefix(t+n,"a=crypto:").map(e.parseCryptoLine)},e.getIceParameters=function(t,n){const r=e.matchPrefix(t+n,"a=ice-ufrag:")[0],i=e.matchPrefix(t+n,"a=ice-pwd:")[0];return r&&i?{usernameFragment:r.substr(12),password:i.substr(10)}:null},e.writeIceParameters=function(t){let e="a=ice-ufrag:"+t.usernameFragment+"\r\na=ice-pwd:"+t.password+"\r\n";return t.iceLite&&(e+="a=ice-lite\r\n"),e},e.parseRtpParameters=function(t){const n={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=e.splitLines(t)[0].split(" ");for(let i=3;i<r.length;i++){const o=r[i],s=e.matchPrefix(t,"a=rtpmap:"+o+" ")[0];if(s){const r=e.parseRtpMap(s),i=e.matchPrefix(t,"a=fmtp:"+o+" ");switch(r.parameters=i.length?e.parseFmtp(i[0]):{},r.rtcpFeedback=e.matchPrefix(t,"a=rtcp-fb:"+o+" ").map(e.parseRtcpFb),n.codecs.push(r),r.name.toUpperCase()){case"RED":case"ULPFEC":n.fecMechanisms.push(r.name.toUpperCase())}}}return e.matchPrefix(t,"a=extmap:").forEach((t=>{n.headerExtensions.push(e.parseExtmap(t))})),n},e.writeRtpDescription=function(t,n){let r="";r+="m="+t+" ",r+=n.codecs.length>0?"9":"0",r+=" UDP/TLS/RTP/SAVPF ",r+=n.codecs.map((t=>void 0!==t.preferredPayloadType?t.preferredPayloadType:t.payloadType)).join(" ")+"\r\n",r+="c=IN IP4 0.0.0.0\r\n",r+="a=rtcp:9 IN IP4 0.0.0.0\r\n",n.codecs.forEach((t=>{r+=e.writeRtpMap(t),r+=e.writeFmtp(t),r+=e.writeRtcpFb(t)}));let i=0;return n.codecs.forEach((t=>{t.maxptime>i&&(i=t.maxptime)})),i>0&&(r+="a=maxptime:"+i+"\r\n"),n.headerExtensions&&n.headerExtensions.forEach((t=>{r+=e.writeExtmap(t)})),r},e.parseRtpEncodingParameters=function(t){const n=[],r=e.parseRtpParameters(t),i=-1!==r.fecMechanisms.indexOf("RED"),o=-1!==r.fecMechanisms.indexOf("ULPFEC"),s=e.matchPrefix(t,"a=ssrc:").map((t=>e.parseSsrcMedia(t))).filter((t=>"cname"===t.attribute)),a=s.length>0&&s[0].ssrc;let c;const u=e.matchPrefix(t,"a=ssrc-group:FID").map((t=>t.substr(17).split(" ").map((t=>parseInt(t,10)))));u.length>0&&u[0].length>1&&u[0][0]===a&&(c=u[0][1]),r.codecs.forEach((t=>{if("RTX"===t.name.toUpperCase()&&t.parameters.apt){let e={ssrc:a,codecPayloadType:parseInt(t.parameters.apt,10)};a&&c&&(e.rtx={ssrc:c}),n.push(e),i&&(e=JSON.parse(JSON.stringify(e)),e.fec={ssrc:a,mechanism:o?"red+ulpfec":"red"},n.push(e))}})),0===n.length&&a&&n.push({ssrc:a});let d=e.matchPrefix(t,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substr(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substr(5),10)*.95-16e3:void 0,n.forEach((t=>{t.maxBitrate=d}))),n},e.parseRtcpParameters=function(t){const n={},r=e.matchPrefix(t,"a=ssrc:").map((t=>e.parseSsrcMedia(t))).filter((t=>"cname"===t.attribute))[0];r&&(n.cname=r.value,n.ssrc=r.ssrc);const i=e.matchPrefix(t,"a=rtcp-rsize");n.reducedSize=i.length>0,n.compound=0===i.length;const o=e.matchPrefix(t,"a=rtcp-mux");return n.mux=o.length>0,n},e.writeRtcpParameters=function(t){let e="";return t.reducedSize&&(e+="a=rtcp-rsize\r\n"),t.mux&&(e+="a=rtcp-mux\r\n"),void 0!==t.ssrc&&t.cname&&(e+="a=ssrc:"+t.ssrc+" cname:"+t.cname+"\r\n"),e},e.parseMsid=function(t){let n;const r=e.matchPrefix(t,"a=msid:");if(1===r.length)return n=r[0].substr(7).split(" "),{stream:n[0],track:n[1]};const i=e.matchPrefix(t,"a=ssrc:").map((t=>e.parseSsrcMedia(t))).filter((t=>"msid"===t.attribute));return i.length>0?(n=i[0].value.split(" "),{stream:n[0],track:n[1]}):void 0},e.parseSctpDescription=function(t){const n=e.parseMLine(t),r=e.matchPrefix(t,"a=max-message-size:");let i;r.length>0&&(i=parseInt(r[0].substr(19),10)),isNaN(i)&&(i=65536);const o=e.matchPrefix(t,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:n.fmt,maxMessageSize:i};const s=e.matchPrefix(t,"a=sctpmap:");if(s.length>0){const t=s[0].substr(10).split(" ");return{port:parseInt(t[0],10),protocol:t[1],maxMessageSize:i}}},e.writeSctpDescription=function(t,e){let n=[];return n="DTLS/SCTP"!==t.protocol?["m="+t.kind+" 9 "+t.protocol+" "+e.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+e.port+"\r\n"]:["m="+t.kind+" 9 "+t.protocol+" "+e.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+e.port+" "+e.protocol+" 65535\r\n"],void 0!==e.maxMessageSize&&n.push("a=max-message-size:"+e.maxMessageSize+"\r\n"),n.join("")},e.generateSessionId=function(){return Math.random().toString().substr(2,21)},e.writeSessionBoilerplate=function(t,n,r){let i;const o=void 0!==n?n:2;i=t||e.generateSessionId();return"v=0\r\no="+(r||"thisisadapterortc")+" "+i+" "+o+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},e.getDirection=function(t,n){const r=e.splitLines(t);for(let t=0;t<r.length;t++)switch(r[t]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[t].substr(2)}return n?e.getDirection(n):"sendrecv"},e.getKind=function(t){return e.splitLines(t)[0].split(" ")[0].substr(2)},e.isRejected=function(t){return"0"===t.split(" ",2)[1]},e.parseMLine=function(t){const n=e.splitLines(t)[0].substr(2).split(" ");return{kind:n[0],port:parseInt(n[1],10),protocol:n[2],fmt:n.slice(3).join(" ")}},e.parseOLine=function(t){const n=e.matchPrefix(t,"o=")[0].substr(2).split(" ");return{username:n[0],sessionId:n[1],sessionVersion:parseInt(n[2],10),netType:n[3],addressType:n[4],address:n[5]}},e.isValidSDP=function(t){if("string"!=typeof t||0===t.length)return!1;const n=e.splitLines(t);for(let t=0;t<n.length;t++)if(n[t].length<2||"="!==n[t].charAt(1))return!1;return!0},t.exports=e},477:t=>{"use strict";t.exports=function(t,e,n,r){var i=self||window;try{try{var o;try{o=new i.Blob([t])}catch(e){(o=new(i.BlobBuilder||i.WebKitBlobBuilder||i.MozBlobBuilder||i.MSBlobBuilder)).append(t),o=o.getBlob()}var s=i.URL||i.webkitURL,a=s.createObjectURL(o),c=new i[e](a,n);return s.revokeObjectURL(a),c}catch(r){return new i[e]("data:application/javascript,".concat(encodeURIComponent(t)),n)}}catch(t){if(!r)throw Error("Inline worker is not supported");return new i[e](r,n)}}}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={id:r,loaded:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var r={};return(()=>{"use strict";n.r(r),n.d(r,{BASIC_FULL_HD_LANDSCAPE:()=>yt,BASIC_FULL_HD_PORTRAIT:()=>bt,BASIC_LANDSCAPE:()=>St,BASIC_PORTRAIT:()=>Et,BroadcastClientError:()=>BroadcastClientError,BroadcastClientEvents:()=>Me,BroadcastStageConnectionEvents:()=>Ce,BroadcastStageSubscriptionEvents:()=>Te,ConnectionState:()=>Be,DEFAULT_STAGE_LANDSCAPE:()=>Zt,DEFAULT_STAGE_PORTRAIT:()=>te,Errors:()=>t,LOG_LEVEL:()=>T,LogLevels:()=>T,STANDARD_LANDSCAPE:()=>Ct,STANDARD_PORTRAIT:()=>Tt,__version:()=>qr,create:()=>zr,createStageClient:()=>Kr,default:()=>Yr,isSupported:()=>Dr,stagesSendJoinEvent:()=>Jr,stagesSendLeaveEvent:()=>Xr});var t={};n.r(t),n.d(t,{ADD_DEVICE_COMPOSITION_INDEX_MISSING_ERROR:()=>N,ADD_DEVICE_COMPOSITION_MISSING_ERROR:()=>A,ADD_DEVICE_CONSTRAINTS_ERROR:()=>M,ADD_DEVICE_DEVICE_ERROR:()=>P,ADD_DEVICE_NAME_EXISTS_ERROR:()=>O,ADD_DEVICE_NAME_MISSING_ERROR:()=>D,ADD_DEVICE_UNSUPPORTED:()=>x,BROADCAST_CONFIGURATION_ERROR:()=>z,BROADCAST_ERROR:()=>I,CAMERA_ERROR:()=>k,CLIENT_INVALID_ERROR:()=>Q,EXCHANGE_POSITION_DEVICE_NOT_FOUND_ERROR:()=>V,FAILED_TO_ADD_IMAGE_ERROR:()=>G,INGEST_ENDPOINT_TYPE_ERROR:()=>K,INGEST_ENDPOINT_URL_ERROR:()=>J,INPUT_ERROR:()=>R,INVALID_STREAM_KEY:()=>H,LOGGER_TYPE_ERROR:()=>Y,LOG_LEVEL_TYPE_ERROR:()=>X,NETWORK_RECONNECT_CONFIGURATION_ERROR:()=>Z,NETWORK_RECONNECT_CONFIGURATION_INVALID_TIMEOUT_ERROR:()=>tt,PEER_CONNECTION_ERROR:()=>$,PEER_SETUP_ERROR:()=>W,REMOVE_DEVICE_NOT_FOUND_ERROR:()=>L,REMOVE_IMAGE_NOT_FOUND_ERROR:()=>U,STAGE_TOKEN_TYPE_ERROR:()=>nt,STAGE_WHIP_OVERRIDE_ERROR:()=>rt,STREAM_CONFIGURATION_ERROR:()=>q,STREAM_KEY_INVALID_CHAR_ERROR:()=>et,UPDATE_VIDEO_DEVICE_COMPOSITION_INDEX_MISSING_ERROR:()=>j,UPDATE_VIDEO_DEVICE_COMPOSITION_MISSING_ERROR:()=>B,UPDATE_VIDEO_DEVICE_COMPOSITION_NAME_NOT_FOUND_ERROR:()=>F});var e={};n.r(e),n.d(e,{fixNegotiationNeeded:()=>er,shimAddTrackRemoveTrack:()=>Zn,shimAddTrackRemoveTrackWithNative:()=>Qn,shimGetDisplayMedia:()=>zn,shimGetSendersWithDtmf:()=>Jn,shimGetStats:()=>Xn,shimGetUserMedia:()=>Hn,shimMediaStream:()=>qn,shimOnTrack:()=>Kn,shimPeerConnection:()=>tr,shimSenderReceiverGetStats:()=>Yn});var i={};n.r(i),n.d(i,{shimAddTransceiver:()=>dr,shimCreateAnswer:()=>pr,shimCreateOffer:()=>hr,shimGetDisplayMedia:()=>rr,shimGetParameters:()=>lr,shimGetUserMedia:()=>nr,shimOnTrack:()=>ir,shimPeerConnection:()=>or,shimRTCDataChannel:()=>ur,shimReceiverGetStats:()=>ar,shimRemoveStream:()=>cr,shimSenderGetStats:()=>sr});var o={};n.r(o),n.d(o,{shimAudioContext:()=>br,shimCallbacksAPI:()=>vr,shimConstraints:()=>_r,shimCreateOfferLegacy:()=>yr,shimGetUserMedia:()=>mr,shimLocalStreamsAPI:()=>fr,shimRTCIceServerUrls:()=>Sr,shimRemoteStreamsAPI:()=>gr,shimTrackEventTransceiver:()=>Er});var s={};n.r(s),n.d(s,{removeExtmapAllowMixed:()=>Or,shimAddIceCandidateNullOrEmpty:()=>Ar,shimConnectionState:()=>Pr,shimMaxMessageSize:()=>kr,shimParameterlessSetLocalDescription:()=>Nr,shimRTCIceCandidate:()=>wr,shimRTCIceCandidateRelayProtocol:()=>Ir,shimSendThrowTypeError:()=>Rr});var a={};n.r(a),n.d(a,{BASIC_FULL_HD_LANDSCAPE:()=>yt,BASIC_FULL_HD_PORTRAIT:()=>bt,BASIC_LANDSCAPE:()=>St,BASIC_PORTRAIT:()=>Et,BroadcastClientError:()=>BroadcastClientError,BroadcastClientEvents:()=>Me,ConnectionState:()=>Be,Errors:()=>t,LOG_LEVEL:()=>T,LogLevels:()=>T,STANDARD_LANDSCAPE:()=>Ct,STANDARD_PORTRAIT:()=>Tt,__version:()=>qr,create:()=>zr,isSupported:()=>Dr});n(8660);var c,u=n(6729),d=n.n(u),l=n(1206);function h(t){const e="0123456789abcdef";let n="";for(let r=0;r<t;r+=1)n+=e.charAt(Math.floor(Math.random()*e.length));return n}class RequestUUID{constructor(){const t=h;this.value=`${t(8)}-${t(4)}-${t(4)}-${t(4)}-${t(12)}`}}function p(){return new RequestUUID}class TraceId{constructor(){const t=(Date.now()/1e3|0).toString(16);this.value=`1-${t}-${h(24)}`}}function f(){return new TraceId}let g,v;function m(t){return g!==t.stageARN&&(g=t.stageARN,v=void 0),v||(v=h(32)),v}!function(t){t.PUBLISHED_VIDEO_STATS="ivs_broadcast_webrtc_published_video_stats",t.PUBLISHED_VIDEO_STATS_WINDOW="ivs_broadcast_webrtc_published_video_stats_window",t.PUBLISHED_AUDIO_STATS="ivs_broadcast_webrtc_published_audio_stats",t.PUBLISHED_AUDIO_STATS_WINDOW="ivs_broadcast_webrtc_published_audio_stats_window",t.SUBSCRIBED_VIDEO_STATS="ivs_broadcast_webrtc_subscribed_video_stats",t.SUBSCRIBED_VIDEO_STATS_WINDOW="ivs_broadcast_webrtc_sbcrbd_video_stats_window",t.SUBSCRIBED_AUDIO_STATS="ivs_broadcast_webrtc_subscribed_audio_stats",t.SUBSCRIBED_AUDIO_STATS_WINDOW="ivs_broadcast_webrtc_sbcrbd_audio_stats_window",t.PUBLISH="ivs_broadcast_multihost_publish",t.UNPUBLISH="ivs_broadcast_multihost_unpublish",t.SUBSCRIBE="ivs_broadcast_multihost_subscribe",t.UNSUBSCRIBE="ivs_broadcast_multihost_unsubscribe",t.PUBLISH_STARTED="ivs_broadcast_multihost_publish_started",t.PUBLISH_ENDED="ivs_broadcast_multihost_publish_ended",t.STATE_UPDATED="ivs_broadcast_multihost_event_state_updated",t.SUBSCRIBE_STARTED="ivs_broadcast_multihost_subscribe_started",t.SUBSCRIBE_ENDED="ivs_broadcast_multihost_subscribe_ended",t.JOIN="ivs_broadcast_multihost_join",t.LEAVE="ivs_broadcast_multihost_leave",t.SERVER_REQUEST="ivs_broadcast_multihost_server_request",t.TRACE="ivs_broadcast_stage_trace",t.ERROR="ivs_broadcast_error",t.MINUTE="ivs_broadcast_multihost_minute",t.CONNECTION_STATE="ivs_broadcast_webrtc_connection_state",t.ICE_GATHERING_STATE="ivs_broadcast_webrtc_gathering_state",t.EDP_CONNECTED="ivs_broadcast_multihost_event_connected",t.EDP_DISCONNECTED="ivs_broadcast_multihost_event_disconnected",t.EDP_PONG="ivs_broadcast_multihost_edp_rtt",t.SIMULCAST_LAYER_INFO="ivs_broadcast_simulcast_layer_info",t.MULTIHOST_CONFIGURATION="ivs_broadcast_multihost_configuration"}(c||(c={}));class StageAnalyticsEvent{constructor(t,e,n,r){let i="unknown";if(e.stageARN&&e.stageARN.startsWith("arn:aws:ivs:")){const t=e.stageARN.split(":");6===t.length&&(i=t[4])}this.event=t,this.properties={client_time:(new Date).toISOString(),customer_id:i,device_software:window.navigator.userAgent,multihost_id:e.stageARN,participant_id:e.participantID,participant_user_id:e.userID,platform:"web",sdk_version:"1.5.2",session_id:m(e),stage_arn:e.stageARN,trace_id:n.value},e.attrGsRole&&(this.properties.token_attribute_0=e.attrGsRole),e.attrGsSessionId&&(this.properties.token_attribute_1=e.attrGsSessionId),this.critical=r}}class StageErrorEvent extends StageAnalyticsEvent{constructor(t){super(c.ERROR,t.token,t.traceId,!0),Object.assign(this.properties,{code:t.code,tag:t.tag,description:t.message,remote_participant_id:t.remoteParticipantId,request_uuid:t.requestUUID,is_nominal:t.nominal,is_fatal:t.fatal,use_turn:t.token.shouldUseTURN()})}}var _=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};const S=4;class SpadeClient{constructor(t="https://broadcast.stats.live-video.net/"){this.spadeUrl=t}send(t,e=!1){return _(this,void 0,void 0,(function*(){const n=Date.now();for(const e of t)e.properties.batch_time_millis=n;const r={"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},i=`data=${this.b64EncodeUnicode(JSON.stringify(t))}`;e?navigator.sendBeacon(this.spadeUrl,i):function(t,e,n={},r=""){_(this,void 0,void 0,(function*(){const i=new XMLHttpRequest;return i.open(t,e,!0),n&&Object.keys(n).forEach((t=>{n.hasOwnProperty(t)&&i.setRequestHeader(t,n[t])})),new Promise(((n,o)=>{i.onreadystatechange=()=>{i.readyState===S&&(i.status>=200&&i.status<300?n(i.responseText):o(new Error(`Spade ${t} ${e} responded ${i.status}\n${i.responseText}`)))},i.send(r)}))}))}("POST",this.spadeUrl,r,i)}))}b64EncodeUnicode(t){return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(Number(`0x${e}`)))))}}function E(t){if(!t)throw new Error("SpadeClient is not defined")}class AnalyticsTracker{constructor(t){this.sharedProperties={},this.spadeClient={},this.queuedEvents=[],this.init({spadeUrl:t})}static getInstance(t){return AnalyticsTracker.instance||(AnalyticsTracker.instance=new AnalyticsTracker(null!=t?t:"https://broadcast.stats.live-video.net/")),AnalyticsTracker.instance}start(){this.sessionId=this.newGuid(),this.sharedProperties.session_id=this.sessionId,this.flushInterval||(this.flushInterval=window.setInterval((()=>{this.flushEvents()}),1e3))}stop(t){let e=!1;clearInterval(this.flushInterval),this.flushInterval=void 0,t&&(this.queuedEvents=this.queuedEvents.filter((t=>t.critical)),e=!0),this.flushEvents(e)}trackEvent(t){t.data.properties=Object.assign({},this.sharedProperties,t.data.properties),this.queuedEvents.push(t.data)}trackEventNoSharedProps(t){this.queuedEvents.push(t)}trackErrorAndThrow(t){throw this.trackError(t),t}trackError(t){AnalyticsTracker.getInstance().trackEventNoSharedProps(new StageErrorEvent(t))}batchEvents(t){E(this.spadeClient);const e=t.map((t=>(t.data.properties=Object.assign({},this.sharedProperties,t.data.properties),t.data)));this.spadeClient.send(e)}init({spadeUrl:t}){this.spadeClient=new SpadeClient(t);const e=l.getParser(navigator.userAgent),n=this.parseSemver(String(e.getBrowserVersion()));this.sharedProperties={browser:navigator.appVersion,browser_family:e.getBrowserName().toLowerCase(),browser_version:`${n.major}.${n.minor}`,customer_id:"ivs",os_name:e.getOSName(),os_version:String(e.getOSVersion()),platform:"web",session_id:this.sessionId,sdk_version:"1.5.2",user_agent:navigator.userAgent,sfu_resource:void 0}}setSfuResource(t){this.sharedProperties.sfu_resource=t}getSfuResource(){return this.sharedProperties.sfu_resource}newGuid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(t=>{const e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))}flushEvents(t=!1){E(this.spadeClient),this.queuedEvents.length>0&&this.spadeClient.send(this.queuedEvents,t),this.queuedEvents=[]}parseSemver(t){const e=/^(\d+)\.(\d+)\.(\d+)[+|-]?(.*)?$/.exec(t)||/^(\d+)\.(\d+)[+|-]?(.*)?$/.exec(t)||/^(\d+)$/.exec(t)||[];return{major:parseInt(e[1],10)||0,minor:parseInt(e[2],10)||0,patch:parseInt(e[3],10)||0}}}const y=1007,b=12e4,C=3e5;class BroadcastClientError extends Error{constructor({name:t,message:e,code:n,details:r,cause:i,params:o}){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,BroadcastClientError),this.name=t||"BroadcastClientError",this.message=e,this.code=n,this.details=r,this.cause=i,this.params=o}}var T,w;!function(t){t[t.TRACE=0]="TRACE",t[t.DEBUG=1]="DEBUG",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(T||(T={})),function(t){t.SPADE="SPADE",t.TIME="Time",t.WEBRTC="WebRTC",t.EMITTER="Emitter",t.MEDIA="Media",t.SUBSCRIPTION="StageSubscription",t.PUBLICATION="StagePublication",t.CONNECTION="StageConnection",t.SOCKET="StageSocket",t.BROADCAST_STAGE_CLIENT="BroadcastStageClient",t.STAGE="Stage",t.REMOTE_PARTICIPANT="RemoteParticipant",t.LOCAL_PARTICIPANT="LocalParticipant"}(w||(w={}));const I={name:"BroadcastError",code:1e3,message:"Unable to broadcast"},k={name:"CameraError",code:2e3,message:"Camera could not be captured"},R={name:"InputError",code:3e3,message:"Input could not be attached"},P={name:"AddDeviceError",code:4e3,message:"Device is missing"},O={name:"AddDeviceNameExistsError",code:4001,message:"Name is already registered"},A={name:"AddDeviceCompositionMissingError",code:4002,message:"VideoComposition is missing"},N={name:"AddDeviceCompositionIndexMissingError",code:4003,message:'VideoComposition\'s "index" property is missing'},D={name:"AddDeviceNameMissingError",code:4004,message:"Name property is missing"},x={name:"AddDeviceUnsupported",code:4005,message:"Unsupported device"},M={name:"AddDeviceConstraintsError",code:4006,message:"Constraints error"},L={name:"RemoveDeviceNotFoundError",code:5e3,message:"Device not found"},U={name:"RemoveImageNotFoundError",code:6e3,message:"Image not found"},B={name:"UpdateVideoDeviceCompositionMissingError",code:7e3,message:"VideoComposition is missing"},j={name:"UpdateVideoDeviceCompositionIndexMissingError",code:7001,message:'VideoComposition\'s "index" property is missing'},F={name:"UpdateVideoDeviceCompositionNameMissingError",code:7002,message:"Video device with that name is not found"},V={name:"ExchangePositionDeviceNotFoundError",code:8e3,message:"Device with that name is not found"},G={name:"FailedToAddImageError",code:9e3,message:"Failed to add image"},W={name:"PeerSetupError",code:1e4,message:"Unexpected return value from setup request"},$={name:"PeerConnectionError",code:10001,message:"Peer connection has failed."},H={name:"InvalidStreamKey",code:10003,message:"Invalid Stream Key."},z={name:"BroadcastConfigurationError",code:11e3,message:"Error when configuring broadcast client"},q={name:"StreamConfigurationError",code:12e3,message:"Error when configuring stream"},K={name:"IngestEndpointTypeError",code:13e3,message:"Ingest endpoint must be a string"},J={name:"IngestEndpointUrlError",code:13001,message:"Ingest endpoint must be a valid https or rtmps URL"},X={name:"LogLevelTypeError",code:14e3,message:"Log Level must be a valid integer between [0..5]"},Y={name:"LoggerTypeError",code:15e3,message:"Logger must be an object"},Q={name:"ClientInvalidError",code:16e3,message:"Client is no longer valid, possibly due to delete() invocation."},Z={name:"NetworkReconnectConfigurationError",code:17e3,message:"Error when configuring network reconnect"},tt={name:"NetworkReconnectConfigurationInvalidTimeoutError",code:17001,message:"Network reconnect timeout value must be a number between [10000, 300000]"},et={name:"StreamKeyInvalidCharError",code:18e3,message:"Streamkey must contain only [A-Za-z0-9_-] characters"},nt={name:"StageTokenTypeError",code:19e3,message:"Stage token must be a string"},rt={name:"StageWhipUrlOverrideError",code:19001,message:"Stage WHIP override URL must be a string starting with http"};var it,ot,st,at,ct,ut,dt,lt,ht,pt=function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)},ft=function(t,e,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(t,n):i?i.value=n:e.set(t,n),n};const gt=1920,vt=1080,mt="missing stream configuration",_t=T.ERROR,St={maxResolution:{width:852,height:480},maxFramerate:30,maxBitrate:1500},Et={maxResolution:{width:480,height:852},maxFramerate:30,maxBitrate:1500},yt={maxResolution:{width:1920,height:1080},maxFramerate:30,maxBitrate:3500},bt={maxResolution:{width:1080,height:1920},maxFramerate:30,maxBitrate:3500},Ct={maxResolution:{width:1920,height:1080},maxFramerate:30,maxBitrate:8500},Tt={maxResolution:{width:1080,height:1920},maxFramerate:30,maxBitrate:8500},wt={reconnect:!1,timeout:b};function It(t){var e,n;if("string"!=typeof t&&void 0!==t)throw new BroadcastClientError(K);if(t){if(t.startsWith("https"))return t;{const r=/(?<protocol>(rtmps|https):\/\/)?(?<id>.+)\.(?<environment>(?=\S*['-])([a-zA-Z'-]+))\.live-video\.net.*/.exec(t);if("rtmps"===(null===(e=null==r?void 0:r.groups)||void 0===e?void 0:e.protocol)&&console.warn("rtmps server url detected; please pass in the ingest endpoint (no rtmps:// protocol) instead"),null===(n=null==r?void 0:r.groups)||void 0===n?void 0:n.id)return`https://${r.groups.id}.webrtc.live-video.net:4443`;throw new BroadcastClientError(J)}}return""}class Config{constructor(t,e,n=St,r,i=wt){this.LOG_LEVEL=T,this.BASIC_LANDSCAPE=St,this.BASIC_PORTRAIT=Et,this.BASIC_FULL_HD_LANDSCAPE=yt,this.BASIC_FULL_HD_PORTRAIT=bt,this.STANDARD_LANDSCAPE=Ct,this.STANDARD_PORTRAIT=Tt,it.set(this,void 0),ot.set(this,void 0),st.set(this,St),at.set(this,void 0),ct.set(this,wt),ut.set(this,(t=>{if(!t)throw new BroadcastClientError(Object.assign(Object.assign({},q),{details:mt}));if(!(t.maxBitrate<=8500&&t.maxBitrate>=200))throw new BroadcastClientError(Object.assign(Object.assign({},q),{details:"maxBitrate must be between 200 and 8500"}));if(!(t.maxFramerate<=60&&t.maxFramerate>=10))throw new BroadcastClientError(Object.assign(Object.assign({},q),{details:"maxFramerate must be between 10 and 60"}));const e=t.maxResolution.width,n=t.maxResolution.height;if(e>gt||n>gt||e<160||n<160||(e===gt&&n>vt||n===gt&&e>vt))throw new BroadcastClientError(Object.assign(Object.assign({},q),{details:"maxResolution values must be between 1080x1920 or 1920x1080"}))})),dt.set(this,(t=>{if(!t)return;const e=Number(t),n=Number.isInteger(e),r=e>=T.TRACE,i=e<=T.SILENT;if(!n||!r||!i)throw new BroadcastClientError(X)})),lt.set(this,(t=>{if(t&&"object"!=typeof t)throw new BroadcastClientError(Y)})),ht.set(this,(t=>{if(!t)return;if("object"!=typeof t||"boolean"!=typeof t.reconnect)throw new BroadcastClientError(Z);const{timeout:e}=t;if(void 0!==e&&(Number.isNaN(e)||"number"!=typeof e||e<1e4||e>C))throw new BroadcastClientError(tt)})),pt(this,lt,"f").call(this,r),pt(this,dt,"f").call(this,e),pt(this,ut,"f").call(this,n),ft(this,it,t,"f"),ft(this,ot,e,"f"),ft(this,st,n,"f"),ft(this,at,r,"f"),ft(this,ct,i,"f")}get ingestEndpoint(){return pt(this,it,"f")}set ingestEndpoint(t){ft(this,it,It(t),"f")}get streamConfig(){return pt(this,st,"f")}set streamConfig(t){pt(this,ut,"f").call(this,t),ft(this,st,t,"f")}get logLevel(){return pt(this,ot,"f")}set logLevel(t){pt(this,dt,"f").call(this,t),ft(this,ot,t,"f")}get logger(){return pt(this,at,"f")}set logger(t){pt(this,lt,"f").call(this,t),ft(this,at,t,"f")}get networkReconnectConfig(){return pt(this,ct,"f")}set networkReconnectConfig(t){pt(this,ht,"f").call(this,t),ft(this,ct,t,"f")}}it=new WeakMap,ot=new WeakMap,st=new WeakMap,at=new WeakMap,ct=new WeakMap,ut=new WeakMap,dt=new WeakMap,lt=new WeakMap,ht=new WeakMap;const kt={[T.INFO]:"#528bff",[T.WARN]:"#ffb31a",[T.DEBUG]:"#00f593",[T.ERROR]:"#ff4f4d",[T.TRACE]:"",[T.SILENT]:"",[w.SPADE]:"#a970ff",[w.TIME]:"#53535f",[w.WEBRTC]:"#0e9bd8",[w.SUBSCRIPTION]:"#ffc400",[w.CONNECTION]:"#ff5edb",[w.SOCKET]:"#8585ff",[w.EMITTER]:"#adadb8",[w.LOCAL_PARTICIPANT]:"#1DD21D",[w.STAGE]:"#EC9806",[w.REMOTE_PARTICIPANT]:"#0680EC",details:"#808080"},Rt=({label:t})=>`background: ${kt[t]||"#333333"}; color: white; padding: 3px; margin-left: 3px;`,Pt=Object.entries(T),Ot=(t,e,n)=>{const r=Rt({label:t}),[i]=Pt.find((([,e])=>e===Number(t)))||[],o=`%c${i}`,s=Rt({label:e}),a=`%c${e}`,c=Rt({label:w.TIME}),u=`%c[${(new Date).toISOString()}]`,d=Rt({label:"details"}),l=`%c[${n}]`,h=[u,o,a],p=[c,r,s];return n&&(h.push(l),p.push(d)),[h.join(""),...p]},At={debug(t){console.groupCollapsed(...Ot(T.DEBUG,t.scope,t.label)),console.debug(t.msg,Object.assign(Object.assign({},t),{level:"debug"})),console.groupEnd()},info(t){console.groupCollapsed(...Ot(T.INFO,t.scope,t.label)),console.info(t.msg,Object.assign(Object.assign({},t),{level:"info"})),console.groupEnd()},warn(t){console.groupCollapsed(...Ot(T.WARN,t.scope,t.label)),console.warn(t.msg,Object.assign(Object.assign({},t),{level:"warn"})),console.groupEnd()},error(t){console.error(t)}};var Nt=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n};Object.entries(T);class Logger{constructor(t=_t,e=At){this.logLevel=t,this.loggerInstance=e}debug(t){var e,n;this.logLevel>T.DEBUG||null===(n=(e=this.loggerInstance).debug)||void 0===n||n.call(e,JSON.parse(JSON.stringify(Object.assign(Object.assign({},t),{level:"debug"}))))}info(t){var e,n;this.logLevel>T.INFO||null===(n=(e=this.loggerInstance).info)||void 0===n||n.call(e,JSON.parse(JSON.stringify(Object.assign(Object.assign({},t),{level:"info"}))))}warn(t){var e,n;this.logLevel>T.WARN||null===(n=(e=this.loggerInstance).warn)||void 0===n||n.call(e,JSON.parse(JSON.stringify(Object.assign(Object.assign({},t),{level:"warn"}))))}error(t){var e,n,{err:r}=t,i=Nt(t,["err"]);this.logLevel>T.ERROR||null===(n=(e=this.loggerInstance).error)||void 0===n||n.call(e,Object.assign({err:r},i))}}class ScopedLogger{constructor(t,e){this.logger=t,this.scope=e}debug(t){var e,n;null===(n=(e=this.logger).debug)||void 0===n||n.call(e,JSON.parse(JSON.stringify(Object.assign(Object.assign({},t),{scope:this.scope}))))}info(t){var e,n;null===(n=(e=this.logger).info)||void 0===n||n.call(e,JSON.parse(JSON.stringify(Object.assign(Object.assign({},t),{scope:this.scope}))))}warn(t){var e,n;null===(n=(e=this.logger).warn)||void 0===n||n.call(e,JSON.parse(JSON.stringify(Object.assign(Object.assign({},t),{scope:this.scope}))))}error(t){var e,n,{err:r}=t,i=Nt(t,["err"]);null===(n=(e=this.logger).error)||void 0===n||n.call(e,Object.assign(Object.assign({err:r},i),{scope:this.scope}))}unwrap(){return this.logger}}var Dt;!function(t){t.PUBLISH="publish",t.SUBSCRIBE="subscribe",t.JOIN="join",t.LEAVE="leave",t.APP_TRACE="app_trace"}(Dt||(Dt={}));const xt=1,Mt=2;class JoinEvent extends StageAnalyticsEvent{constructor(t){super(c.JOIN,t.token,t.traceId,!1),Object.assign(this.properties,{action:Dt.JOIN,event_endpoint:t.eventEndpoint,whip_endpoint:t.whipEndpoint,use_turn:t.token.shouldUseTURN()})}}class LeaveEvent extends StageAnalyticsEvent{constructor(t){super(c.LEAVE,t.token,t.traceId,!1),Object.assign(this.properties,{action:Dt.LEAVE,event_endpoint:t.eventEndpoint,whip_endpoint:t.whipEndpoint,reason:t.reason}),this.critical=!0}}var Lt,Ut,Bt,jt,Ft,Vt,Gt,Wt,$t,Ht=function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)},zt=function(t,e,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(t,n):i?i.value=n:e.set(t,n),n};function qt(t){return 1e3*t}const Kt=200,Jt=2500,Xt=30,Yt=1280,Qt=720,Zt={maxResolution:{width:Yt,height:Qt},maxFramerate:Xt,maxBitrate:Jt},te={maxResolution:{width:Qt,height:Yt},maxFramerate:Xt,maxBitrate:Jt},ee={active:!1,maxBitrate:2e5,rid:"low",maxFramerate:15,scaleResolutionDownBy:4},ne={width:320,height:180},re={active:!1,maxBitrate:7e5,rid:"mid",maxFramerate:20,scaleResolutionDownBy:2},ie={width:640,height:360},oe={active:!1,maxBitrate:17e5,rid:"hi",maxFramerate:30,scaleResolutionDownBy:1},se={width:1280,height:720};class StageConfig{constructor(t=Zt,e,n){this.LOG_LEVEL=T,this.DEFAULT_STAGE_LANDSCAPE=Zt,this.DEFAULT_STAGE_PORTRAIT=te,Lt.set(this,void 0),Ut.set(this,void 0),Bt.set(this,void 0),jt.set(this,void 0),Ft.set(this,void 0),Vt.set(this,(t=>{if(!t)throw new BroadcastClientError(Object.assign(Object.assign({},q),{details:mt}));if(!(t.maxBitrate<=Jt&&t.maxBitrate>=Kt))throw new BroadcastClientError(Object.assign(Object.assign({},q),{details:"maxBitrate must be between 200 and 2500"}));if(!(t.maxFramerate<=Xt&&t.maxFramerate>=10))throw new BroadcastClientError(Object.assign(Object.assign({},q),{details:"maxFramerate must be between 10 and 30"}));const e=t.maxResolution.width,n=t.maxResolution.height;if(e>Yt||n>Yt||e<160||n<160||(e===Yt&&n>Qt||n===Yt&&e>Qt))throw new BroadcastClientError(Object.assign(Object.assign({},q),{details:"maxResolution values must be between 720x1280 or 1280x720"}))})),Gt.set(this,(t=>{if(!t)return;const e=Number(t),n=Number.isInteger(e),r=e>=T.TRACE,i=e<=T.SILENT;if(!n||!r||!i)throw new BroadcastClientError(X)})),Wt.set(this,(t=>{if(t&&"object"!=typeof t)throw new BroadcastClientError(Y)})),$t.set(this,(t=>{if(t&&("string"!=typeof t||!t.startsWith("http")))throw new BroadcastClientError(rt)})),Ht(this,Wt,"f").call(this,n),Ht(this,Gt,"f").call(this,e),Ht(this,Vt,"f").call(this,t),zt(this,Ut,n,"f"),zt(this,Lt,e,"f"),zt(this,jt,t,"f")}get streamConfig(){return Ht(this,jt,"f")}set streamConfig(t){Ht(this,Vt,"f").call(this,t),zt(this,jt,t,"f")}get logLevel(){return Ht(this,Lt,"f")}set logLevel(t){Ht(this,Gt,"f").call(this,t),zt(this,Lt,t,"f")}get logger(){return Ht(this,Ut,"f")}set logger(t){Ht(this,Wt,"f").call(this,t),zt(this,Ut,t,"f")}get whipUrlOverride(){return Ht(this,Ft,"f")}set whipUrlOverride(t){Ht(this,$t,"f").call(this,t),zt(this,Ft,t,"f")}}Lt=new WeakMap,Ut=new WeakMap,Bt=new WeakMap,jt=new WeakMap,Ft=new WeakMap,Vt=new WeakMap,Gt=new WeakMap,Wt=new WeakMap,$t=new WeakMap;class StageClientError extends BroadcastClientError{constructor({token:t,traceId:e,code:n,tag:r,location:i,message:o,details:s,remoteParticipantId:a,requestUUID:c,fatal:u,nominal:d}){super({name:"StageClientError",message:o,code:n}),Error.captureStackTrace&&Error.captureStackTrace(this,StageClientError),this.token=t,this.traceId=e,this.code=n,this.tag=r,this.location=i,this.message=o,this.details=s,this.remoteParticipantId=a,this.requestUUID=c,this.fatal=u,this.nominal=d}}const ae={JOIN_RELATED:"signalling_session",PUBLISH_RELATED:"webrtc_sink",UNPUBLISH_RELATED:"webrtc_unsink"};function ce(t,e){switch(t){case Dt.PUBLISH:return ae.PUBLISH_RELATED;case Dt.SUBSCRIBE:return`webrtc_source:${e}`;default:return"unknown"}}function ue(t,e){var n,r,i,o;const s={code:t.code,message:`${t.message}: ${e.name} ${e.message}`,fatal:null!==(n=t.fatal)&&void 0!==n&&n,nominal:null!==(r=t.nominal)&&void 0!==r&&r};return e instanceof StageClientError&&(s.fatal=null!==(i=e.fatal)&&void 0!==i&&i,s.nominal=null!==(o=e.nominal)&&void 0!==o&&o),s}function de(t){var e,n,r,i,o;if(!(null===(e=t.response)||void 0===e?void 0:e.status))return;const s=Number(null===(n=t.response)||void 0===n?void 0:n.status);if(!(s<400)){if(s>=400&&s<=403&&(null===(r=t.response)||void 0===r?void 0:r.data)&&(null===(i=t.response)||void 0===i?void 0:i.data).code)switch((null===(o=t.response)||void 0===o?void 0:o.data).code){case le.TokenExpired:return he.EXPIRED_TOKEN;case le.NoPermissions:return he.TOKEN_PERMISSIONS_DENIED;case le.StageAtCapacity:return he.STAGE_AT_CAPACITY;default:return he.UNKNOWN_PERMISSIONS_ERROR}switch(s){case 404:return he.WHIP_SESSION_RESOURCE_DELETED;case 429:return he.WHIP_TOO_MANY_REQUESTS;case 500:return he.INTERNAL_SERVER_ERROR;default:return he.UNKNOWN_PERMISSIONS_ERROR}}}var le;!function(t){t[t.Unspecified=2001]="Unspecified",t[t.TokenExpired=2002]="TokenExpired",t[t.NoPermissions=2003]="NoPermissions",t[t.StageAtCapacity=2005]="StageAtCapacity"}(le||(le={}));const he={EXPIRED_TOKEN:{code:1001,message:"Token expired and is no longer valid",fatal:!0,nominal:!0},UNPUBLISH_FAILURE:{code:1013,message:"Failed to unpublish",fatal:!1,nominal:!1},UNSUBSCRIBE_FAILURE:{code:1014,message:"Failed to unsubscribe",fatal:!1,nominal:!1},PUBLISH_FAILURE:{code:1015,message:"Failed to publish",fatal:!1,nominal:!1},SUBSCRIBE_FAILURE:{code:1016,message:"Failed to subscribe",fatal:!1,nominal:!1},JOIN_FAILURE:{code:1017,message:"Failed to join",fatal:!0,nominal:!1},PUBLISH_TIMED_OUT:{code:1020,message:"Publish timed out",fatal:!1,nominal:!1},SUBSCRIBE_TIMED_OUT:{code:1021,message:"Subscribe timed out",fatal:!1,nominal:!1},NO_CANDIDATES:{code:1022,message:"No ICE candidates",fatal:!1,nominal:!1},OPERATION_ABORTED:{code:1023,message:"Request aborted",nominal:!0,fatal:!1},STAGE_AT_CAPACITY:{code:1024,message:"Stage at capacity",fatal:!0,nominal:!1},INTERNAL_SERVER_ERROR:{code:1025,message:"Internal server error",fatal:!0,nominal:!1},TOKEN_PERMISSIONS_DENIED:{code:1026,message:"Token permissions are not valid for the operation",fatal:!0,nominal:!1},UNKNOWN_PERMISSIONS_ERROR:{code:1099,message:"Service error code unknown or not found",fatal:!0,nominal:!1},WEBSOCKET_MESSAGE_PARSE_FAILURE:{code:1204,message:"Failed to parse websocket message",fatal:!1,nominal:!1},WHIP_SESSION_RESOURCE_DELETED:{code:1206,message:"WHIP signaling session resource not found",fatal:!0,nominal:!0},WHIP_TOO_MANY_REQUESTS:{code:1207,message:"WHIP endpoint received too many requests",fatal:!0,nominal:!1},WHIP_OPTIONS_FAILURE:{code:1501,message:"Failed to get ICE Servers from OPTIONS",fatal:!1,nominal:!1},WHIP_POST_FAILURE:{code:1502,message:"WHIP post failure",fatal:!1,nominal:!1},WHIP_DELETE_FAILURE:{code:1503,message:"WHIP delete failure",fatal:!1,nominal:!1},WHIP_URL_MISSING:{code:1504,message:"WHIP delete failure",fatal:!1,nominal:!1},EVENT_PLANE_CONNECTION_FAILURE:{code:1300,message:"Error connecting to event plane",fatal:!0,nominal:!1},PEER_CONNECTION_NETWORK_FAILURE:{code:1400,message:"PeerConnection is lost due to unknown network error",fatal:!1,nominal:!1},CREATE_OFFER_FAILURE:{code:1402,message:"Failed to set local description",fatal:!1,nominal:!1},CREATE_PEER_CONNECTION_FAILURE:{code:1403,message:"Failed to create a peer connection",fatal:!1,nominal:!1},ICE_CANDIDATE_ERROR:{code:1404,message:"ICE candidate error",fatal:!1,nominal:!1}};var pe;function fe(t){const e=atob(t);return JSON.parse(e)}!function(t){t.UNPUBLISH="unpublish",t.UNSUBSCRIBE="unsubscribe",t.UNLOAD="unload",t.CONNECTION_FAIL="connection fail"}(pe||(pe={}));class StageToken{constructor(t){this.rawToken=t;const e=t.split(".");if(3!==e.length)throw Error(`Token format incorrect. length: ${e.length}`);try{this.header=fe(e[0])}catch(t){const e=t instanceof Error?`: ${t.message}`:"";throw Error(`Error parsing Stage Token header${e}`)}try{this.claims=fe(e[1])}catch(t){const e=t instanceof Error?`: ${t.message}`:"";throw Error(`Error parsing Stage Token claims${e}`)}this.signature=e[2];const{claims:n}=this;this.stageARN=n.resource,this.participantID=n.jti,this.eventsURL=n.events_url,this.whipURL=n.whip_url,this.userID=n.user_id,this.expirationTime=n.exp,this.topic=n.topic,this.parseVersionFlags(n.version);const{attributes:r}=n;r&&(this.attrGsRole=r.gs_role,this.attrGsSessionId=r.gs_session_id),this.analyticsTracker=AnalyticsTracker.getInstance()}getPublishEndpoint(){let t="";return this.whipURL&&this.participantID&&(t=`${this.whipURL}/publish/${this.participantID}`),t}getSubscribeEndpoint(t){let e="";return this.whipURL&&(e=`${this.whipURL}/subscribe/${t}`),e}assertTokenIsUnexpired(t,e,n,r){(!this.expirationTime||Date.now()/1e3>=this.expirationTime)&&this.analyticsTracker.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},he.EXPIRED_TOKEN),{location:n,tag:e,token:this,traceId:t,remoteParticipantId:r,message:he.EXPIRED_TOKEN.message,details:`Token expired at ${this.expirationTime} and is no longer valid`})))}parseVersionFlags(t){if(!t)return;const e=t.split(".");2===e.length&&(this.versionFlags=parseInt(e[1],10))}shouldUseTURN(){return void 0===this.versionFlags||0!=(this.versionFlags&xt)}shouldSendSilentAudio(){return void 0===this.versionFlags||0!=(this.versionFlags&Mt)}}function ge(t){return new StageToken(t)}function ve({action:t,identifier:e,token:n,whipURLOverride:r}){let i="";const o=ge(n);switch(r&&(o.whipURL=r),t){case Dt.PUBLISH:i=o.getPublishEndpoint();break;case Dt.SUBSCRIBE:e&&(i=o.getSubscribeEndpoint(e))}return i}var me=n(9669),_e=n.n(me);class AbortControllersTracker{constructor(){this.abortControllers={},this._isUnloading=!1}static getInstance(){return AbortControllersTracker.instance||(AbortControllersTracker.instance=new AbortControllersTracker),AbortControllersTracker.instance}abortPendingOperations(){Object.entries(this.abortControllers).forEach((([t,e])=>e.abort()))}trackNewAbortController(t){return this.abortControllers[t]=new AbortController,this.abortControllers[t]}removeAbortController(t){delete this.abortControllers[t]}get isUnloading(){return this._isUnloading}set isUnloading(t){this._isUnloading=t}}const Se=t=>{const e=t=>{var e;return(null===(e=t.deviceId)||void 0===e?void 0:e.startsWith("web-contents-media-stream"))?"tab":void 0},n=t=>{var e;return(null===(e=t.deviceId)||void 0===e?void 0:e.startsWith("window"))&&"window"===t.displaySurface?"window":void 0},r=t=>{var e;return(null===(e=t.deviceId)||void 0===e?void 0:e.startsWith("screen"))&&"monitor"===t.displaySurface?"screen":void 0};return(e(i=t)||n(i)||r(i)?void 0:"camera")||r(t)||n(t)||e(t)||"unknown";var i};function Ee(t,e){return t.find((t=>t.kind===e))}var ye;!function(t){t.VIDEO="video",t.AUDIO="audio"}(ye||(ye={}));class MediaStreamManager{constructor(){this.mediaTracks=new Map([[ye.VIDEO,void 0],[ye.AUDIO,void 0]])}static getOrRegisterInstance(t){let e=this.msmMap.get(t);return e||(e=new MediaStreamManager,this.msmMap.set(t,e)),e}setTrack(t,e){this.mediaTracks.set(t,e)}getTrack(t){return this.mediaTracks.get(t)}}MediaStreamManager.msmMap=new Map;class TraceEvent extends StageAnalyticsEvent{constructor(t,e,n,r,i){super(c.TRACE,t,e,!1),Object.assign(this.properties,{action:r,message:n,remote_participant_id:i})}}function be(t,e,n,r,i){AnalyticsTracker.getInstance().trackEventNoSharedProps(new TraceEvent(t,e,n,r,i))}const Ce={STAGE_JOINED:"stageJoined",STAGE_PARTICIPANT_JOINED:"stageParticipantJoined",STAGE_PARTICIPANT_LEFT:"stageParticipantLeft",STAGE_PARTICIPANT_KICKED:"stageParticipantKicked",STAGE_PARTICIPANT_UPDATED:"stageParticipantUpdated",STAGE_REFRESH:"stageRefresh",STATE_CHANGE:"stateChange"},Te={CONNECTION_STATE_CHANGE:"connectionStateChange",STAGE_STREAM_UPDATE:"stageStreamUpdate"},we="open",Ie="close",ke="messageParseError",Re="refresh",Pe="connectionFailure",Oe="stageStateMessage";class EDPConnectedEvent extends StageAnalyticsEvent{constructor(t){super(c.EDP_CONNECTED,t.token,t.traceId,!1),Object.assign(this.properties,{event_endpoint:t.eventEndpoint,protocol:t.protocol,retry_times:t.numRetries})}}class EDPDisconnectedEvent extends StageAnalyticsEvent{constructor(t){super(c.EDP_DISCONNECTED,t.token,t.traceId,!1),Object.assign(this.properties,{event_endpoint:t.eventEndpoint,protocol:t.protocol})}}class MinuteEvent extends StageAnalyticsEvent{constructor(t,e,n,r,i){super(c.MINUTE,t,e,!1),Object.assign(this.properties,{action:r?Dt.PUBLISH:Dt.SUBSCRIBE,is_publishing:r,minutes_logged:n,subscribed_number:i})}}class PublishEvent extends StageAnalyticsEvent{constructor(t){super(c.PUBLISH,t.token,t.traceId,!1),Object.assign(this.properties,{action:Dt.PUBLISH,remote_participant_id:t.token.participantID,use_turn:t.token.shouldUseTURN()})}}class UnpublishEvent extends StageAnalyticsEvent{constructor(t){super(c.UNPUBLISH,t.token,t.traceId,!0),Object.assign(this.properties,{action:Dt.PUBLISH,remote_participant_id:t.token.participantID})}}class SubscribeEvent extends StageAnalyticsEvent{constructor(t){super(c.SUBSCRIBE,t.token,t.traceId,!1),Object.assign(this.properties,{action:Dt.SUBSCRIBE,remote_participant_id:t.subscribedId,subscribed_id:t.subscribedId,use_turn:t.token.shouldUseTURN()})}}class UnsubscribeEvent extends StageAnalyticsEvent{constructor(t){super(c.UNSUBSCRIBE,t.token,t.traceId,!0),Object.assign(this.properties,{action:Dt.SUBSCRIBE,remote_participant_id:t.unsubscribedId,unsubscribed_id:t.unsubscribedId})}}class PublishStartedEvent extends StageAnalyticsEvent{constructor(t){super(c.PUBLISH_STARTED,t.token,t.traceId,!1),Object.assign(this.properties,{action:Dt.PUBLISH,options_duration:t.optionsDuration,post_duration:t.postDuration,remote_participant_id:t.token.participantID,time_to_candidate:t.timeToCandidate,total_duration:t.totalDuration,use_turn:t.token.shouldUseTURN()})}}class PublishEndedEvent extends StageAnalyticsEvent{constructor(t){super(c.PUBLISH_ENDED,t.token,t.traceId,!0),Object.assign(this.properties,{action:Dt.PUBLISH,remote_participant_id:t.token.participantID,unpublish_successful:t.isUnpublishSuccessful,reason:t.reason})}}class SubscribeStartedEvent extends StageAnalyticsEvent{constructor(t){super(c.SUBSCRIBE_STARTED,t.token,t.traceId,!1),Object.assign(this.properties,{action:Dt.SUBSCRIBE,options_duration:t.optionsDuration,post_duration:t.postDuration,remote_participant_id:t.remoteParticipantId,time_to_candidate:t.timeToCandidate,total_duration:t.totalDuration,use_turn:t.token.shouldUseTURN()})}}class SubscribeEndedEvent extends StageAnalyticsEvent{constructor(t){super(c.SUBSCRIBE_ENDED,t.token,t.traceId,!0),Object.assign(this.properties,{action:Dt.SUBSCRIBE,remote_participant_id:t.remoteParticipantId,unsubscribe_successful:t.isUnsubscribeSuccessful,reason:t.reason}),this.critical=!0}}class StateUpdatedEvent extends StageAnalyticsEvent{constructor(t){super(c.STATE_UPDATED,t.token,t.traceId,!1),Object.assign(this.properties,{audio_muted:t.isAudioMuted,is_disconnected:t.isDisconnected,is_publishing:t.isPublishing,other_participant_id:t.otherParticipantId,other_participant_user_id:t.otherParticipantUserId,video_stopped:t.isVideoStopped})}}var Ae=n(6486);class EDPPongEvent extends StageAnalyticsEvent{constructor(t){super(c.EDP_PONG,t.token,t.traceId,!1),Object.assign(this.properties,{event_endpoint:t.eventEndpoint,protocol:t.protocol,edp_rtt:t.edpRttMs})}}var Ne;!function(t){t.MESSAGE="message",t.RESPONSE="response"}(Ne||(Ne={}));class StageSocket{constructor(t){this.protocol="",this.connecting=!1,this.closing=!1,this.closingForError=!1,this.nextConnectionAttempt=0,this.windowUnloading=!1,this.pingInterval=0,this.pongTimeout=0,this.latestPingTimestamp=0,this.pongCount=0,this.latestSequenceNumber=0,this.beforeUnload=()=>{this.windowUnloading=!0},this.logger=new ScopedLogger(t,w.SOCKET),this.emitter=new u.EventEmitter,this.analyticsTracker=AnalyticsTracker.getInstance(),this.connectionAttempts=0,this.sentPing=!1,this.receivedPong=!1,this.id=`[${p().value}] `,window.addEventListener("beforeunload",this.beforeUnload)}connect(t,e,n){this.logger.debug({msg:`${this.id}connecting to ${t}`}),this.addr=t||this.addr,this.token=e||this.token,this.traceId=n||this.traceId;const{topic:r,rawToken:i}=this.token;this.connecting=!0,this.closing=!1;try{this.socket=this.createWebSocket(`${this.addr}?topic=${r}/publishers`,i),this.socket.onmessage=this.onMessage.bind(this),this.socket.onerror=this.onError.bind(this),this.socket.onclose=this.onClose.bind(this),this.socket.onopen=this.onOpen.bind(this),this.protocol=this.socket.protocol}catch(t){this.emitter.emit(Pe,new Error("UnableToConnect"))}}send(t){var e;this.logger.debug({msg:`${this.id}sending ${JSON.stringify(t)}`}),this.isReady()?null===(e=this.socket)||void 0===e||e.send(JSON.stringify(t)):this.logger.warn({msg:"Trying to send data over stage socket that is not ready"})}close(){this.closing=!0,this.connecting=!1,this.emitter.emit(Ie),this.closeSocket()}removeAllListeners(){window.removeEventListener("beforeunload",this.beforeUnload),this.emitter.removeAllListeners()}createWebSocket(t,e){return new WebSocket(t,e)}closeForError(){this.closingForError=!0,this.closeSocket()}closeSocket(){var t;this.logger.debug({msg:`${this.id}closing`}),this.clearTimeouts(),null===(t=this.socket)||void 0===t||t.close(),this.socket&&(this.socket.onmessage=null,this.socket.onerror=null,this.socket.onclose=null,this.socket.onopen=null)}on(t,e){this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}isReady(){return this.logger.debug({msg:`${this.id}isReady called`}),!!this.socket&&this.socket.readyState===this.socket.OPEN}onMessage(t){this.logger.debug({msg:`${this.id}received message: ${t.data}`});try{const e=JSON.parse(t.data);switch(e.type){case"STAGE_STATE":case"aws:ivs:STAGE_STATE":{const t=e.payload.sequenceNumber;t>this.latestSequenceNumber&&(this.emitter.emit(Oe,e),this.latestSequenceNumber=t);break}case"PONG":this.receivedPong=!0,this.pongCount%2==0&&this.analyticsTracker.trackEventNoSharedProps(new EDPPongEvent({token:this.token,eventEndpoint:this.token.eventsURL,protocol:this.protocol,traceId:this.traceId,edpRttMs:performance.now()-this.latestPingTimestamp})),this.pongCount++;break;case"REFRESH":this.emitter.emit(Re);break;default:(0,Ae.noop)()}}catch(t){this.logger.debug({msg:`onMessage JSON Parse error: ${t}`}),this.emitter.emit(ke,t)}}onError(t){this.logger.debug({msg:`${this.id}error: ${JSON.stringify(t)}`})}onClose(t){if(this.logger.debug({msg:`${this.id}onClose triggered with code (closing = ${this.closing}, closingForError = ${this.closingForError}, connecting = ${this.connecting})`}),this.clearTimeouts(),this.connecting){let t=Math.pow(2,this.connectionAttempts);t>1e3&&(t=1e3),this.logger.debug({msg:`${this.id}reconnecting in ${t} seconds`}),this.connectionAttempts+=1,this.nextConnectionAttempt=window.setTimeout(this.connect.bind(this),1e3*t)}else if(this.closing)this.closing=!1;else if(this.closingForError)this.emitter.emit(Pe,new Error("ClosedForError")),this.closingForError=!1;else{if(this.windowUnloading)return;this.logger.debug({msg:`${this.id}unexpected close`}),this.emitter.emit(Pe,new Error("UnintentionalError"))}}onOpen(){this.logger.debug({msg:`${this.id} socket opened`});const t=this.connectionAttempts;this.connectionAttempts=0,this.connecting=!1,this.ping(),this.pingInterval=window.setInterval(this.ping.bind(this),3e4),this.emitter.emit(we,{attempts:t})}ping(){var t;this.logger.debug({msg:`${this.id}sending PING`});try{this.latestPingTimestamp=performance.now(),null===(t=this.socket)||void 0===t||t.send(JSON.stringify({type:"PING"})),this.sentPing=!0,this.receivedPong=!1,this.pongTimeout&&clearTimeout(this.pongTimeout),this.pongTimeout=window.setTimeout(this.pongTimedOut.bind(this),5e3)}catch(t){this.closeForError()}}pongTimedOut(){this.sentPing&&!this.receivedPong&&(this.logger.debug({msg:`${this.id}Pong timed out!`}),this.closeForError())}clearTimeouts(){this.sentPing=this.receivedPong=!1,clearTimeout(this.pongTimeout),clearInterval(this.pingInterval),clearTimeout(this.nextConnectionAttempt)}}class TypedEmitter{constructor(){this.emitter=new u}on(t,e){e.call=function(t,e){return function(n,...r){try{e.apply(n,r)}catch(n){let r=`Error in callback for ${t}`;const i=e.name;return i&&(r+=` for function ${i}`),void console.error(`${r}\n`,n)}}}(t,e),this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}emit(t,...e){this.emitter.emit(t,...e)}removeAllListeners(){this.emitter.removeAllListeners()}}var De=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};var xe;!function(t){t.DISCONNECTED="disconnected",t.CONNECTING="connecting",t.CONNECTED="connected",t.ERRORED="errored"}(xe||(xe={}));class StageConnection extends TypedEmitter{constructor(t){super(),this.nonScopedLogger=t,this.participants=new Map,this.disconnected=[],this.state={value:xe.DISCONNECTED,context:{hasConnected:!1}},this.stageMinutesLogged=0,this.isStagePublishing=!1,this.onConnecting=(t,e)=>{if(this.logger.debug({msg:"onConnecting",context:t,event:e}),"RECONNECT"===e.type&&this.stageSocket.close(),"CONNECT"===e.type&&(t.token=e.payload.token,t.traceId=e.payload.traceId),!t.token||!t.traceId)return void this.logger.warn({msg:"Attempting a connect but no token OR traceId provided"});const{eventsURL:n}=t.token;this.stageSocket.connect(n,t.token,t.traceId),this.emit(Ce.STATE_CHANGE,xe.CONNECTING),this.state.value=xe.CONNECTING},this.onConnected=(t,e)=>{this.logger.debug({msg:"onConnected",context:t,event:e}),t.hasConnected=!0,this.emit(Ce.STAGE_JOINED),this.emit(Ce.STATE_CHANGE,xe.CONNECTED),this.state.value=xe.CONNECTED},this.onDisconnected=t=>{this.logger.debug({msg:"onDisconnected",context:t}),this.stageSocket.close(),t.hasConnected=!1,delete t.traceId,delete t.token,this.emit(Ce.STATE_CHANGE,xe.DISCONNECTED),this.state.value=xe.DISCONNECTED},this.onErrored=(t,e)=>{this.logger.error({msg:"Connection failure occurred",err:e.payload.error}),this.emit(Ce.STATE_CHANGE,xe.ERRORED),this.state.value=xe.ERRORED,t.hasConnected&&t.token&&t.traceId?this.processStateUpdate({type:"RECONNECT"}):this.stageSocket.close()},this.processStateUpdate=t=>{const e=this.state.value,n=this.state.context;switch(e){case xe.DISCONNECTED:"CONNECT"===t.type&&this.onConnecting(n,t);break;case xe.CONNECTING:"RECONNECT"===t.type?this.onConnecting(n,t):"DISCONNECT"===t.type?this.onDisconnected(n):"CONNECT_SUCCESS"===t.type?this.onConnected(n,t):"ERROR"===t.type&&this.onErrored(n,t);break;case xe.CONNECTED:"RECONNECT"===t.type?this.onConnecting(n,t):"DISCONNECT"===t.type?this.onDisconnected(n):"ERROR"===t.type&&this.onErrored(n,t);break;case xe.ERRORED:"RECONNECT"===t.type?this.onConnecting(n,t):"DISCONNECT"===t.type&&this.onDisconnected(n)}},this.trackConnectedEvent=(t,e,n)=>{this.analyticsTracker.trackEventNoSharedProps(new EDPConnectedEvent({token:t,eventEndpoint:t.eventsURL,numRetries:n,protocol:this.stageSocket.protocol,traceId:e}))},this.trackDisconnectedEvent=(t,e)=>{this.analyticsTracker.trackEventNoSharedProps(new EDPDisconnectedEvent({token:t,eventEndpoint:t.eventsURL,protocol:this.stageSocket.protocol,traceId:e}))},this.trackMessageParseError=(t,e)=>n=>{this.logger.error({msg:"Message Parse Error occurred",err:n});const r=new StageClientError({token:t,traceId:e,code:he.WEBSOCKET_MESSAGE_PARSE_FAILURE.code,tag:ae.JOIN_RELATED,location:"onMessage",message:he.WEBSOCKET_MESSAGE_PARSE_FAILURE.message,details:n.message});this.analyticsTracker.trackEventNoSharedProps(new StageErrorEvent(r))},this.onStageStateMessage=(t,e)=>n=>{var r,i;this.logger.debug({msg:"State Stage Message occurred",state:n});const o=n.payload,s=null!==(r=o.participants)&&void 0!==r?r:[],a=null!==(i=o.disconnected)&&void 0!==i?i:[],c=[],u=[],d=(n,r)=>{this.analyticsTracker.trackEventNoSharedProps(new StateUpdatedEvent({token:t,otherParticipantId:n.id,otherParticipantUserId:n.userId,isAudioMuted:n.audioMuted,isVideoStopped:n.videoStopped,isPublishing:n.isPublishing,isDisconnected:r,traceId:e}))};this.participants.forEach((t=>{const e=s.find((e=>e.id===t.id));if(e){let n=!0,r=!1;["isPublishing","id","audioMuted","joinedAt","userId","videoStopped"].forEach((i=>{n=n&&e[i.toString()]===t[i.toString()],n||(t[i.toString()]=e[i.toString()],r=!0)})),Object.keys(t.attributes).forEach((i=>{n=n&&e.attributes[i]===t.attributes[i],n||(t.attributes=e.attributes,r=!0)})),r&&(d(t,!1),this.emit(Ce.STAGE_PARTICIPANT_UPDATED,e))}else u.push(t)})),s.forEach((t=>{this.participants.get(t.id)||c.push(t)})),u.forEach((t=>{this.participants.delete(t.id),d(t,!0),this.emit(Ce.STAGE_PARTICIPANT_LEFT,t)})),c.forEach((t=>{this.participants.set(t.id,t),d(t,!1),this.emit(Ce.STAGE_PARTICIPANT_JOINED,t)})),a.forEach((t=>{this.disconnected.find((e=>e.id===t.id))||(this.disconnected.push(t),"KICKED"===t.status&&this.emit(Ce.STAGE_PARTICIPANT_KICKED,t))})),this.disconnected=a},this.analyticsTracker=AnalyticsTracker.getInstance(),this.nonScopedLogger=t,this.logger=new ScopedLogger(t,w.CONNECTION),this.stageSocket=new StageSocket(this.nonScopedLogger)}connect(t,e){return De(this,void 0,void 0,(function*(){return this.logger.debug({msg:"connect invoked",token:t,traceId:e}),this.traceId=e,this.state.value!==xe.DISCONNECTED&&(this.logger.debug({msg:"Disconnecting previous connection"}),this.processStateUpdate({type:"DISCONNECT"}),window.clearTimeout(this.connectTimeout)),new Promise(((n,r)=>{this.connectTimeout=window.setTimeout((()=>{this.logger.debug({msg:"Attempt to connect timed out"});const t=new Error("InitialConnectTimedOut");this.processStateUpdate({type:"ERROR",payload:{error:t}}),r(t)}),1e4),this.stageSocket.on(we,(r=>{var i;const{attempts:o}=r;window.clearTimeout(this.connectTimeout),this.trackConnectedEvent(t,e,o),this.processStateUpdate({type:"CONNECT_SUCCESS"}),this.startStageMinuteLoggedInterval(t,null!==(i=this.traceId)&&void 0!==i?i:f()),n()})),this.stageSocket.on(Pe,(t=>{this.stopStageMinuteLoggedInterval(),this.processStateUpdate({type:"ERROR",payload:{error:t}})})),this.stageSocket.on(Re,(()=>{this.logger.debug({msg:"Refresh event occurred"}),this.emit(Ce.STAGE_REFRESH),this.processStateUpdate({type:"RECONNECT"})})),this.stageSocket.on(Ie,(()=>{this.logger.debug({msg:"Close event occurred"}),this.stopStageMinuteLoggedInterval(),this.trackDisconnectedEvent(t,e)})),this.stageSocket.on(Oe,this.onStageStateMessage(t,e)),this.stageSocket.on(ke,this.trackMessageParseError(t,e)),this.processStateUpdate({type:"CONNECT",payload:{token:t,traceId:e}})}))}))}disconnect(){this.logger.debug({msg:"disconnect invoked"}),this.stopStageMinuteLoggedInterval(!0);const t=this.state.context.traceId;return this.processStateUpdate({type:"DISCONNECT"}),this.participants=new Map,this.disconnected=[],this.stageSocket.removeAllListeners(),t}getParticipant(t){return this.participants.get(t)}listConnectedParticipants(){const t=[];return this.participants.forEach((e=>{e.subscribed&&t.push(e)})),t}listAvailableParticipants(){return Array.from(this.participants.values())}emitStageState(t,e){this.stageSocket.send({audioMuted:t,type:"SET_STATE",version:"0",videoStopped:e})}setStagePublishing(t){this.isStagePublishing=t}startStageMinuteLoggedInterval(t,e){this.uploadStageMinutesBroadcastInterval||(this.analyticsTracker.trackEventNoSharedProps(new MinuteEvent(t,e,this.stageMinutesLogged,!0,0)),this.uploadStageMinutesBroadcastInterval=setInterval((()=>{this.analyticsTracker.trackEventNoSharedProps(new MinuteEvent(t,null!=e?e:f(),this.stageMinutesLogged,this.isStagePublishing,0)),this.stageMinutesLogged++}),6e4))}stopStageMinuteLoggedInterval(t=!1){this.uploadStageMinutesBroadcastInterval&&(clearInterval(this.uploadStageMinutesBroadcastInterval),this.uploadStageMinutesBroadcastInterval=void 0),t&&(this.stageMinutesLogged=0)}}const Me={CONNECTION_STATE_CHANGE:"connectionStateChange",ERROR:"clientError",ACTIVE_STATE_CHANGE:"activeStateChange"},Le="connectionStateChange",Ue="clientError";var Be,je,Fe;!function(t){t.CLOSED="closed",t.COMPLETED="completed",t.CONNECTED="connected",t.CONNECTING="connecting",t.DISCONNECTED="disconnected",t.FAILED="failed",t.IDLE="idle",t.NEW="new",t.NONE="none"}(Be||(Be={}));class ThrottleTimer{constructor(t,e){this.throttleDuration=0,this.throttled=!1,this.timeout=0,this.unthrottle=()=>{this.trailing&&this.trailingFn&&this.trailingFn(...this.trailingFnArgs),this.clear()},this.throttleDuration=t,this.trailing=!(e&&e.skipTrailing)}invoke(t,...e){return this.throttled?(this.trailingFn=t,this.trailingFnArgs=e,!1):(this.throttled=!0,this.timeout=window.setTimeout(this.unthrottle,this.throttleDuration),t(...e),!0)}clear(){clearTimeout(this.timeout),this.timeout=0,this.throttled=!1,delete this.trailingFn,delete this.trailingFnArgs}}class SDPFmtpLine{constructor(){this.levelAsymmetryAllowed=!1,this.packetisationMode=!1,this.profile="",this.level=0}extractVideoSdpFmtpLine(t){if(!t)return{levelAsymmetryAllowed:this.levelAsymmetryAllowed,packetisationMode:this.packetisationMode,profile:this.profile,level:this.level};return t.split("\r").join(";").split("\n").join(";").split(" ").join(";").split(";").map((t=>t.trim())).filter(Boolean).forEach((t=>{const e=t.split("=");if(2===e.length)switch(e[0]){case"level-asymmetry-allowed":"1"===e[1]?this.levelAsymmetryAllowed=!0:this.levelAsymmetryAllowed=!1;break;case"packetization-mode":"1"===e[1]?this.packetisationMode=!0:this.packetisationMode=!1;break;case"profile-level-id":this.profile=this.getProfileFromId(e[1]),this.level=this.getLevelFromId(e[1])}})),{levelAsymmetryAllowed:this.levelAsymmetryAllowed,packetisationMode:this.packetisationMode,profile:this.profile,level:this.level}}getProfileFromId(t){const e=t.substr(0,2),n=t.substr(2,2);switch(e.substr(0,2)){case"42":return"baseline";case"4d":return"main";case"58":return"extended";case"64":return"high";case"6e":return"00"===n?"high 10":"high 10 intra";case"7a":return"00"===n?"high 42":"high 42 intra";case"f4":return"00"===n?"high 44":"high 44 intra";default:return"unknown"}}getLevelFromId(t){return parseInt(t.substr(4,2),16)}}class CongestionTimeEvent{constructor(t,e){this.transformProperties=(t,e)=>({sum:t.sum,median:t.median(),min:t.min,max:t.max,p90:t.percentile(.9),event_count:t.data.length,period:e});const n=this.transformProperties(t,e);this.data={event:je.CONGESTION_TIME,properties:n}}}class ConnectionEstablishedEvent{constructor(t,e,n){this.transformProperties=(t,e,n)=>({duration:(t.getTime()-((null==e?void 0:e.getTime())||0))/1e3,ecn_negotiated:!1,ingest_session_id:n});const r=this.transformProperties(t,e,n);this.data={event:je.CONNECTION_ESTABLISHED,properties:r}}}class ConnectionRTTEvent{constructor(t,e){this.transformProperties=(t,e)=>({sum:t.sum,median:t.median(),min:t.min,max:t.max,p90:t.percentile(.9),event_count:t.data.length,period:e});const n=this.transformProperties(t,e);this.data={event:je.CONNECTION_RTT,properties:n}}}class ErrorEvent{constructor(t){this.transformProperties=t=>{var e;return{is_fatal:null!==(e=t.isFatal)&&void 0!==e&&e,value:t.value,code:t.code,description:t.description}};const e=this.transformProperties(t);this.data={event:je.ERROR,properties:e}}}class InputDeviceAttachedEvent{constructor(t,e){this.transformProperties=(t,e)=>({type:t,input_device_id:e.deviceId,position:e.facingMode||"unknown"});const n=this.transformProperties(t,e);this.data={event:je.INPUT_DEVICE_ATTACHED,properties:n}}}class InputDeviceDetachedEvent{constructor(t,e){this.transformProperties=(t,e)=>({type:t,input_device_id:e.deviceId,position:e.facingMode||"unknown"});const n=this.transformProperties(t,e);this.data={event:je.INPUT_DEVICE_DETACHED,properties:n}}}class MeasuredBitrateEvent{constructor(t,e){this.transformProperties=(t,e)=>({sum:t.sum,median:t.median(),min:t.min,max:t.max,p90:t.percentile(.9),event_count:t.data.length,period:e});const n=this.transformProperties(t,e);this.data={event:je.MEASURED_BITRATE,properties:n}}}class MinuteBroadcastEvent{constructor(t,e){this.transformProperties=(t,e)=>({minutes_logged:Math.round((t.timestamp-e)/6e4)});const n=this.transformProperties(t,e);this.data={event:je.MINUTE_BROADCAST,properties:n}}}class RecommendedBitrateEvent{constructor(t,e){this.transformProperties=(t,e)=>({sum:t.sum,median:t.median(),min:t.min,max:t.max,p90:t.percentile(.9),event_count:t.data.length,period:e});const n=this.transformProperties(t,e);this.data={event:je.RECOMMENDED_BITRATE,properties:n}}}class SessionAudioEncoderConfiguredEvent{constructor(t){this.transformProperties=t=>({codec:t.mimeType,bitrate:0,sample_rate:t.clockRate,channel_count:t.channels});const e=this.transformProperties(t);this.data={event:je.SESSION_AUDIO_ENCODER_CONFIGURED,properties:e}}}class SessionAudioPropertiesEvent{constructor(t){this.transformProperties=t=>({codec:"audio",bitrate:32e3,sample_rate:t.sampleRate,channel_count:t.channelCount});const e=this.transformProperties(t);this.data={event:je.SESSION_AUDIO_PROPERTIES,properties:e}}}class SessionVideoEncoderConfiguredEvent{constructor(t,e,n){this.transformProperties=(t,e,n)=>({codec:n.mimeType,codec_profile:e.profile,codec_level:e.level,rate_mode:"vbr",initial_bitrate:0,keyframe_interval:2,width:t.width,height:t.height,bframe_count:0,target_fps:t.frameRate});const r=this.transformProperties(t,e,n);this.data={event:je.SESSION_VIDEO_ENCODER_CONFIGURED,properties:r}}}class SessionVideoPropertiesEvent{constructor(t){this.transformProperties=t=>({codec:"video",initial_bitrate:32e3,min_bitrate:0,max_bitrate:0,keyframe_interval:2,width:t.width,height:t.height,auto_bitrate_enabled:!0,bframes_enabled:!1,target_fps:t.frameRate});const e=this.transformProperties(t);this.data={event:je.SESSION_VIDEO_PROPERTIES,properties:e}}}class SourceAudioLatencyEvent{constructor(t,e){this.transformProperties=(t,e)=>({sum:t.sum,median:t.median(),min:t.min,max:t.max,p90:t.percentile(.9),event_count:t.data.length,period:e});const n=this.transformProperties(t,e);this.data={event:je.SOURCE_AUDIO_LATENCY,properties:n}}}class SourceVideoLatencyEvent{constructor(t,e){this.transformProperties=(t,e)=>({sum:t.sum,median:t.median(),min:t.min,max:t.max,p90:t.percentile(.9),event_count:t.data.length,period:e});const n=this.transformProperties(t,e);this.data={event:je.SOURCE_VIDEO_LATENCY,properties:n}}}class StartBroadcastEvent{constructor(t,e){this.transformProperties=({protocol:t,hostname:e,port:n},r)=>({protocol:t,endpoint_host:e,endpoint_port:n,reason:r});const n=this.transformProperties(t,e);this.data={event:je.START_BROADCAST,properties:n}}}class StopBroadcastEvent{constructor(t){this.transformProperties=({protocol:t,hostname:e,port:n})=>({protocol:t,endpoint_host:e,endpoint_port:n});const e=this.transformProperties(t);this.data={event:je.STOP_BROADCAST,properties:e}}}class WebRTCAudioStatsEvent{constructor(t){this.transformProperties=t=>({bytes_sent:t.bytesSent,header_bytes_sent:t.headerBytesSent,nack_count:t.nackCount,packets_sent:t.packetsSent,retransmitted_bytes_sent:t.retransmittedBytesSent,retransmitted_packets_sent:t.retransmittedPacketsSent});const e=this.transformProperties(t);this.data={event:je.WEBRTC_AUDIO_STATS,properties:e}}}class WebRTCVideoStatsEvent{constructor(t){this.transformProperties=t=>({bytes_sent:t.bytesSent,fir_count:t.firCount,frames_encoded:t.framesEncoded,frames_sent:t.framesSent,header_bytes_sent:t.headerBytesSent,huge_frames_sent:t.hugeFramesSent,key_frames_encoded:t.keyFramesEncoded,nack_count:t.nackCount,packets_sent:t.packetsSent,pli_count:t.pliCount,quality_limitation_reason:t.qualityLimitationReason,quality_limitation_resolution_changes:t.qualityLimitationResolutionChanges,retransmitted_bytes_sent:t.retransmittedBytesSent,retransmitted_packets_sent:t.retransmittedPacketsSent,total_encode_time:t.totalEncodeTime,total_encoded_bytes_target:t.totalEncodedBytesTarget,total_packet_send_delay:t.totalPacketsSendDelay});const e=this.transformProperties(t);this.data={event:je.WEBRTC_VIDEO_STATS,properties:e}}}function Ve(t){return btoa(JSON.stringify(t))}!function(t){t.START_BROADCAST="ivs_broadcast_start_broadcast",t.STOP_BROADCAST="ivs_broadcast_stop_broadcast",t.MINUTE_BROADCAST="ivs_broadcast_minute_broadcast",t.WEBRTC_AUDIO_STATS="ivs_broadcast_webrtc_audio_stats",t.WEBRTC_VIDEO_STATS="ivs_broadcast_webrtc_video_stats",t.WEBRTC_AUDIO_STATS_WINDOW="ivs_broadcast_webrtc_audio_stats_window",t.WEBRTC_VIDEO_STATS_WINDOW="ivs_broadcast_webrtc_video_stats_window",t.CONNECTION_ESTABLISHED="ivs_broadcast_connection_established",t.SESSION_VIDEO_PROPERTIES="ivs_broadcast_session_video_properties",t.SESSION_AUDIO_PROPERTIES="ivs_broadcast_session_audio_properties",t.SESSION_VIDEO_ENCODER_CONFIGURED="ivs_broadcast_session_video_encoder_configured",t.SESSION_AUDIO_ENCODER_CONFIGURED="ivs_broadcast_session_audio_encoder_configured",t.SOURCE_AUDIO_LATENCY="ivs_broadcast_source_audio_latency",t.SOURCE_VIDEO_LATENCY="ivs_broadcast_source_video_latency",t.INPUT_DEVICE_ATTACHED="ivs_broadcast_input_device_attached",t.INPUT_DEVICE_DETACHED="ivs_broadcast_input_device_detached",t.CONGESTION_TIME="ivs_broadcast_congestion_time",t.BUFFER_DURATION="ivs_broadcast_buffer_duration",t.MEASURED_BITRATE="ivs_broadcast_measured_bitrate",t.RECOMMENDED_BITRATE="ivs_broadcast_recommended_bitrate",t.CONNECTION_RTT="ivs_broadcast_connection_rtt",t.ERROR="ivs_broadcast_error"}(je||(je={})),function(t){t.USER_INITIATED="user-initiated",t.NETWORK_DISCONNECT="network-disconnect"}(Fe||(Fe={}));var Ge,We=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};!function(t){t.IDLE="idle",t.EXECUTING="executing",t.RECONNECTING="reconnecting"}(Ge||(Ge={}));class BaseReconnectStrategy{constructor(t,e=12e4,n,r){this.state=Ge.IDLE,this.failureCallback=()=>{},this.peerClient=t,this.timeout=e,this.logger=n,this.emitter=r}onFailure(t){this.failureCallback=t}setStartConfig(t,e){this.ingestEndpoint=t,this.streamKey=e}execute(){const{id:t}=this;this.state===Ge.IDLE&&(this.state=Ge.EXECUTING,this.emitter.emit(Me.CONNECTION_STATE_CHANGE,Be.CONNECTING),this.logger.info({msg:"Starting execution of reconnect strategy.",id:t}),this.startTimeoutTimer(this.timeout),this.executeStrategy())}startTimeoutTimer(t){this.timeoutTimerId=window.setTimeout((()=>{this.state!==Ge.IDLE&&(this.logger.info({msg:"Reconnect strategy timed out."}),this.stop(),this.emitter.emit(Me.CONNECTION_STATE_CHANGE,Be.FAILED),this.failureCallback())}),t)}stop(){this.state=Ge.IDLE,clearTimeout(this.timeoutTimerId),this.stopStrategy()}reconnect(){return We(this,void 0,void 0,(function*(){if(this.ingestEndpoint&&this.streamKey){const t=this.peerClient.getConnectionState();try{this.logger.info({msg:"Attempting reconnect."}),t===Be.CONNECTED?this.logger.info({msg:"Already connected! Stopping reconnect strategy."}):(yield this.peerClient.start(this.ingestEndpoint,this.streamKey),this.logger.info({msg:"Reconnect succeeded!"})),this.stop()}catch(t){throw this.logger.error({err:t}),t}}}))}isActive(){return this.state!==Ge.IDLE}}class ExponentialBackoffStrategy extends BaseReconnectStrategy{constructor(){super(...arguments),this.id="ExponentialBackoffStrategy"}executeStrategy(){let t=5e3;const e=()=>We(this,void 0,void 0,(function*(){if(this.state===Ge.EXECUTING)try{this.state=Ge.RECONNECTING,yield this.reconnect()}catch(n){this.logger.warn({msg:"Attempted reconnect failed. Trying again in: ",nextRetry:t}),this.state=Ge.EXECUTING,this.currentTimeoutId=window.setTimeout(e,t),t*=2}}));this.currentTimeoutId=window.setTimeout(e,0)}stopStrategy(){clearTimeout(this.currentTimeoutId)}}class NetworkApiStrategy extends BaseReconnectStrategy{constructor(){super(...arguments),this.id="NetworkApiStrategy",this.onConnectionChange=()=>We(this,void 0,void 0,(function*(){if(navigator.onLine&&this.state===Ge.EXECUTING){this.state=Ge.RECONNECTING;try{yield this.reconnect()}catch(t){this.logger.warn({msg:"Attempted reconnect failed."}),this.state=Ge.EXECUTING}}}))}executeStrategy(){navigator.connection.addEventListener("change",this.onConnectionChange),this.onConnectionChange()}stopStrategy(){navigator.connection.removeEventListener("change",this.onConnectionChange)}}class PeerClientReconnectStrategyFactory{static create(t,e=wt,n,r){const{reconnect:i,timeout:o}=e;if(i){const e=l.getParser(navigator.userAgent).getBrowserName().toLowerCase();return["edge","chrome"].includes(e)&&navigator.connection?new NetworkApiStrategy(t,o,n,r):new ExponentialBackoffStrategy(t,o,n,r)}}}var $e,He=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},ze=function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)};const qe=t=>!!t;function Ke(t){if(!t)throw new Error("PeerConnection is not defined")}const Je={bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",enableDtlsSrtp:{exact:!0},enableRtpDataChannels:{exact:!1},optional:[{googHighStartBitrate:{exact:0}},{googPayloadPadding:{exact:!0}},{googScreencastMinBitrate:{exact:100}},{googCpuOveruseDetection:{exact:!0}},{googCpuOveruseEncodeUsage:{exact:!0}},{googCpuUnderuseThreshold:{exact:55}},{googCpuOveruseThreshold:{exact:85}},{enableDscp:{exact:!0}}]};class PeerClient{constructor(t,e,n,r){this.config=t,this.emitter=e,this.mediaStreamManager=n,this.establishConnection=(t,e)=>He(this,void 0,void 0,(function*(){var n,r,i;Ke(this.peerConnection);try{const n=yield this.peerConnection.createOffer({offerToReceiveAudio:!1,offerToReceiveVideo:!1});yield this.handleLocalDescription(n),yield this.sendSetupRequest(t,e,n)}catch(t){if(t instanceof Error){null!==(n=(i=t).code)&&void 0!==n||(i.code=W.code);const e=new BroadcastClientError(Object.assign(Object.assign({},W),{name:t.name,message:t.message,code:null==t?void 0:t.code,cause:t}));throw(null===(r=this.reconnectStrategy)||void 0===r?void 0:r.isActive())||this.handleError(t.code,t.message),this.stop(),e}}})),this.getSessionId=()=>this.ingestSessionId,this.getConnectionState=()=>{var t;if(!this.peerConnection)return Be.NONE;const e=null===(t=this.reconnectStrategy)||void 0===t?void 0:t.isActive(),n=this.peerConnection.connectionState||this.peerConnection.iceConnectionState;switch(n){case"new":return Be.NEW;case"closed":return Be.CLOSED;case"disconnected":return e?Be.CONNECTING:Be.DISCONNECTED;case"failed":return e?Be.CONNECTING:Be.FAILED;case"idle":return Be.IDLE;case"checking":case"connecting":return Be.CONNECTING;case"completed":case"connected":return Be.CONNECTED;default:return this.logger.warn({msg:"Unhandled connection state:",rawState:n}),Be.IDLE}},this.onConnectionStateChange=()=>{var t;const e=this.getConnectionState();switch(e){case Be.CONNECTED:{this.emitter.emit(Me.CONNECTION_STATE_CHANGE,e);const n=new Date;this.analyticsTracker.trackEvent(new ConnectionEstablishedEvent(n,this.connectionStartDate,this.ingestSessionId));const r=this.mediaStreamManager.getTrack(ye.AUDIO),i=this.mediaStreamManager.getTrack(ye.VIDEO);if(i){const t=i.getSettings();this.analyticsTracker.trackEvent(new SessionVideoPropertiesEvent(t))}if(r){const t=r.getSettings();this.analyticsTracker.trackEvent(new SessionAudioPropertiesEvent(t))}((null===(t=this.peerConnection)||void 0===t?void 0:t.getSenders())||[]).forEach((t=>{var e;((null===(e=t.getParameters())||void 0===e?void 0:e.codecs)||[]).forEach((e=>{var n;switch(null===(n=t.track)||void 0===n?void 0:n.kind){case"video":{if(!i)break;const t=(new SDPFmtpLine).extractVideoSdpFmtpLine(e.sdpFmtpLine),n=i.getSettings();this.analyticsTracker.trackEvent(new SessionVideoEncoderConfiguredEvent(n,t,e));break}case"audio":if(!r)break;this.analyticsTracker.trackEvent(new SessionAudioEncoderConfiguredEvent(e))}}))}));break}case Be.CONNECTING:this.emitter.emit(Me.CONNECTION_STATE_CHANGE,e),this.connectionStartDate=new Date,this.disconnectionStartDate=void 0;break;case Be.FAILED:this.reconnectStrategy?this.reconnectStrategy.execute():(this.emitter.emit(Me.CONNECTION_STATE_CHANGE,e),this.handleTerminalConnectionFailure());break;case Be.DISCONNECTED:this.emitter.emit(Me.CONNECTION_STATE_CHANGE,e),this.disconnectionStartDate=new Date;break;default:this.emitter.emit(Me.CONNECTION_STATE_CHANGE,e)}},this.handleLocalDescription=t=>He(this,void 0,void 0,(function*(){var e;return null===(e=this.peerConnection)||void 0===e?void 0:e.setLocalDescription(t)})),$e.set(this,(t=>{if("string"!=typeof t)throw new BroadcastClientError(K);try{new URL(t)}catch(t){throw new BroadcastClientError(J)}})),this.logger=new ScopedLogger(r,w.WEBRTC),this.analyticsTracker=AnalyticsTracker.getInstance(),this.createReconnectStrategy(t)}start(t,e){var n;return He(this,void 0,void 0,(function*(){ze(this,$e,"f").call(this,t);const r=[this.mediaStreamManager.getTrack(ye.VIDEO),this.mediaStreamManager.getTrack(ye.AUDIO)].filter(qe);this.createPeerConnection(),this.addTracks({tracks:r}),this.reconnectStrategy&&this.reconnectStrategy.setStartConfig(t,e),yield this.establishConnection(t,e);if(null===(n=this.reconnectStrategy)||void 0===n?void 0:n.isActive()){const e=new URL(t);this.analyticsTracker.trackEvent(new StartBroadcastEvent({protocol:"webrtc",hostname:e.hostname,port:e.port},Fe.NETWORK_DISCONNECT))}}))}stop(){var t,e,n,r;this.stateCheckInterval&&(clearInterval(this.stateCheckInterval),this.stateCheckInterval=void 0),this.stopStreamDataChannel&&"open"===this.stopStreamDataChannel.readyState&&this.stopStreamDataChannel.send(" "),[Be.NEW,Be.CONNECTING,Be.CONNECTED].includes(this.getConnectionState())&&this.emitter.emit(Me.CONNECTION_STATE_CHANGE,Be.CLOSED),null===(t=this.peerConnection)||void 0===t||t.close(),null===(e=this.peerConnection)||void 0===e||e.removeEventListener("connectionstatechange",this.onConnectionStateChange),null===(n=this.peerConnection)||void 0===n||n.removeEventListener("iceconnectionstatechange",this.onConnectionStateChange),this.ingestSessionId=void 0,null===(r=this.reconnectStrategy)||void 0===r||r.stop()}addTracks(t){var e;if(Ke(this.peerConnection),!t)return;const n=this.peerConnection.getSenders().map((t=>{var e;return null===(e=t.track)||void 0===e?void 0:e.id})),r=t.tracks.filter((t=>!n.includes(t.id)));for(const t of r)null===(e=this.peerConnection)||void 0===e||e.addTrack(t)}getReports(){var t;return He(this,void 0,void 0,(function*(){try{const e=(yield null===(t=this.peerConnection)||void 0===t?void 0:t.getStats())||[],n=[];return e.forEach((t=>{n.push(t)})),n}catch(t){return[]}}))}sendSetupRequest(t,e,n){var r;return He(this,void 0,void 0,(function*(){const i=yield fetch(`${t}/v1/offer`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Object.assign({offer:Ve(n),streamKey:e},this.config.streamConfig))});if(!i.ok)throw function(t){let e=new BroadcastClientError(Object.assign({},W));(null==t?void 0:t.code)===y&&(e=new BroadcastClientError(Object.assign({},H)));(null==t?void 0:t.message)&&(e.message=t.message);return e}(yield i.json());const o=yield i.json();(null==o?void 0:o.answer)&&(yield null===(r=this.peerConnection)||void 0===r?void 0:r.setRemoteDescription(function(t){return JSON.parse(atob(t))}(o.answer)),this.ingestSessionId=o.ingestSessionId)}))}handleTerminalConnectionFailure(){const t=new BroadcastClientError($);this.handleError(t.code,t.message)}handleError(t,e){this.analyticsTracker.trackEvent(new ErrorEvent({code:t,description:e,isFatal:!0})),this.emitter.emit(Me.ERROR,{code:t,message:e})}createPeerConnection(){var t;const e=this.getConnectionState(),n=e!==Be.NONE,r=e!==Be.CLOSED,i=null===(t=this.reconnectStrategy)||void 0===t?void 0:t.isActive();n&&r&&!i||(this.stateCheckInterval&&(clearInterval(this.stateCheckInterval),this.stateCheckInterval=void 0),this.stateCheckInterval=window.setInterval((()=>{const t=this.getConnectionState();if(this.reconnectStrategy&&t===Be.DISCONNECTED&&this.disconnectionStartDate){const t=Date.now()-this.disconnectionStartDate.getTime();this.logger.info({msg:"Time since disconnected:",timeSinceDisconnect:t}),t>1e4&&(this.disconnectionStartDate=void 0,this.reconnectStrategy.execute())}else t===Be.CLOSED&&(this.handleTerminalConnectionFailure(),clearInterval(this.stateCheckInterval),this.stateCheckInterval=void 0)}),1e3),this.peerConnection=new RTCPeerConnection(Je),this.stopStreamDataChannel=this.peerConnection.createDataChannel("stopStream"),this.peerConnection.addEventListener("connectionstatechange",this.onConnectionStateChange),this.peerConnection.addEventListener("iceconnectionstatechange",this.onConnectionStateChange))}createReconnectStrategy(t){if(this.reconnectStrategy=PeerClientReconnectStrategyFactory.create(this,t.networkReconnectConfig,this.logger,this.emitter),this.reconnectStrategy){this.reconnectStrategy.onFailure(this.handleTerminalConnectionFailure.bind(this));const t=this.reconnectStrategy.id;this.logger.info({msg:"Using reconnect strategy:",strategyId:t})}}}$e=new WeakMap;class ServerRequestEvent extends StageAnalyticsEvent{constructor(t,e,n,r,i,o,s){super(c.SERVER_REQUEST,e,s,!0),Object.assign(this.properties,{action:t,http_method:r,remote_participant_id:o,request_uuid:i,url:n})}}const Xe="draft-ietf-wish-whip-04";var Ye=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};function Qe(t,e){return Ye(this,void 0,void 0,(function*(){t.validateStatus=t=>t>=200&&t<300||403===t;const n=yield _e()(t);if(403===n.status){if(2003===n.data.code)throw new me.AxiosError("Request failed with status code 403","ERR_BAD_REQUEST",t,n.request,n);return t.url===n.request.responseURL?(t.validateStatus=t=>t>=200&&t<300,_e()(t)):(t.url=n.request.responseURL,e<5?Qe(t,e+1):(t.validateStatus=t=>t>=200&&t<300,_e()(t)))}return n}))}function Ze(t){return Ye(this,void 0,void 0,(function*(){return Qe(t,0)}))}function tn(t){switch(t){case"new":return Be.NEW;case"closed":return Be.CLOSED;case"disconnected":return Be.DISCONNECTED;case"failed":return Be.FAILED;case"idle":return Be.IDLE;case"checking":case"connecting":return Be.CONNECTING;case"completed":case"connected":return Be.CONNECTED;default:throw new Error(`unknown connecion state: ${t}`)}}var en=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};const nn="x-stages-options",rn="cap",on="smc",sn=btoa(`{"${rn}": ["${on}"]}`).replace(/[^A-Za-z0-9+/]/g,"");class ConnectionStateEvent extends StageAnalyticsEvent{constructor(t,e,n,r,i){super(c.CONNECTION_STATE,e,n,!1),Object.assign(this.properties,{action:t,remote_participant_id:i,state:r})}}class IceGatheringStateEvent extends StageAnalyticsEvent{constructor(t,e,n,r,i){super(c.ICE_GATHERING_STATE,e,n,!1),Object.assign(this.properties,{action:t,remote_participant_id:i,state:r})}}var an;!function(t){t.OPTIONS="options",t.POST="post",t.CONNECTED="connected",t.ICE_GATHERING="icegathering"}(an||(an={}));const cn="start",un="stop";class PeerClientPerformanceTracker{constructor(t,e){this.marks={},this.optionsDuration=0,this.postDuration=0,this.timeToCandidate=0,this.timeToConnected=0,this.action=t,this.traceId=e}markActionStart(){this.markStart(an.CONNECTED)}markOptionsStart(){this.markStart(an.OPTIONS)}markOptionsStop(){this.markStop(an.OPTIONS),this.optionsDuration=this.measure(an.OPTIONS)}markPostStart(){this.markStart(an.POST)}markPostStop(){this.markStop(an.POST),this.postDuration=this.measure(an.POST)}markIceGatheringStart(){this.markStart(an.ICE_GATHERING)}markIceGatheringStop(){this.markStop(an.ICE_GATHERING),this.timeToCandidate=this.measure(an.ICE_GATHERING)}markActionStop(){this.markStop(an.CONNECTED),this.timeToConnected=this.measure(an.CONNECTED)}markStart(t){this.marks[`${this.namespace}.${t}.${cn}`]=performance.now()}markStop(t){this.marks[`${this.namespace}.${t}.${un}`]=performance.now()}measure(t){const e=`${this.namespace}.${t}.${cn}`,n=`${this.namespace}.${t}.${un}`,r=this.marks[e],i=this.marks[n];return void 0===r||void 0===i?0:i-r}get namespace(){return`ivswb.peerclient.${this.action}.${this.traceId.value}`}getMeasurements(){const{optionsDuration:t,postDuration:e,timeToCandidate:n,timeToConnected:r}=this;return{optionsDuration:t,postDuration:e,timeToCandidate:n,timeToConnected:r}}}var dn,ln,hn=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};function pn(t){return t.track.kind===ye.AUDIO}function fn(t){return t.track.kind===ye.VIDEO}!function(t){t.DISCONNECTED="disconnected",t.CONNECTING="connecting",t.CONNECTED="connected",t.ERRORED="errored"}(dn||(dn={})),function(t){t.STATE_CHANGE="stateChange"}(ln||(ln={}));class StagePublication extends TypedEmitter{constructor(t,e,n,r,i=!1){super(),this.token=t,this.nonScopedLogger=e,this.mediaStreamManager=n,this.traceId=r,this.tracksToPublish=[],this.publicationState=dn.DISCONNECTED,this.latestPubAttemptNum=0,this.isPublishing=!1,this.isStarted=!1,this.start=t=>{this.publicationState===dn.DISCONNECTED||this.publicationState===dn.ERRORED?(this.isStarted=!0,this.tracksToPublish=t,this.latestPubAttemptNum=0,this.processStateUpdate()):this.logger.warn({msg:"publication cannot be started if not in disconnected or error state"})},this.requestRTCStats=t=>hn(this,void 0,void 0,(function*(){return this.peerClient.requestRTCStats(t)})),this.stop=()=>hn(this,void 0,void 0,(function*(){this.peerClient.off(Le,this.onPeerClientConnectionStateChange,this),yield this.unpublish(),this.updateState(dn.DISCONNECTED)})),this.processStateUpdate=t=>{const{publicationState:e}=this;e===dn.DISCONNECTED||e===dn.ERRORED?0===this.latestPubAttemptNum&&(this.updateState(dn.CONNECTING),this.tryPublish()):e===dn.CONNECTING?t===Be.CONNECTED?this.updateState(dn.CONNECTED):t===Be.FAILED&&this.latestPubAttemptNum>=4&&this.updateState(dn.ERRORED):e===dn.CONNECTED&&t===Be.FAILED&&0===this.latestPubAttemptNum&&(this.updateState(dn.CONNECTING),this.tryPublish())},this.updateState=t=>{this.publicationState=t,this.emit(ln.STATE_CHANGE,t)},this.tryPublish=()=>hn(this,void 0,void 0,(function*(){if(this.latestPubAttemptNum++,this.latestPubAttemptNum<=4)try{yield this.publish(this.tracksToPublish),this.latestPubAttemptNum=0}catch(t){if(t instanceof StageClientError&&t.fatal)return this.logger.error({msg:"fatal error publishing",err:t}),void this.updateState(dn.ERRORED);const e=1e3*Math.pow(2,this.latestPubAttemptNum);setTimeout((()=>{this.tryPublish()}),e)}})),this.publish=t=>hn(this,void 0,void 0,(function*(){this.traceId=f();try{return this.trackPublishRequested(),this.peerClient.initTracksToPublish(t),yield this.peerClient.connect(!1,this.traceId),this.trackPublishStarted(),this.isPublishing=!0,this.peerClient}catch(t){const e=new StageClientError(Object.assign(Object.assign({},he.PUBLISH_FAILURE),{token:this.token,traceId:this.traceId,tag:ae.PUBLISH_RELATED,location:"publish"}));throw t instanceof StageClientError&&(e.fatal=t.fatal,e.nominal=t.nominal,t.location=`publish > ${t.location}`),this.analyticsTracker.trackError(e),t}})),this.unpublish=()=>hn(this,void 0,void 0,(function*(){if(this.publicationState!==dn.DISCONNECTED&&this.publicationState!==dn.ERRORED){this.analyticsTracker.trackEventNoSharedProps(new UnpublishEvent({token:this.token,traceId:this.traceId})),this.token.assertTokenIsUnexpired(this.traceId,ce(Dt.PUBLISH),"unpublish",this.token.participantID);try{this.peerClient.stop();const t=AbortControllersTracker.getInstance().isUnloading,e=t?pe.UNLOAD:pe.UNPUBLISH;t?this.peerClient.cleanup(Dt.PUBLISH,this.token.participantID,this.token):yield this.peerClient.cleanup(Dt.PUBLISH,this.token.participantID,this.token),this.trackPublishEnded(!0,e)}catch(t){const e=new StageClientError(Object.assign(Object.assign({},he.UNPUBLISH_FAILURE),{token:this.token,traceId:this.traceId,tag:ae.UNPUBLISH_RELATED,location:"unpublish"}));throw this.analyticsTracker.trackError(e),this.trackPublishEnded(!1,pe.UNPUBLISH),e}}})),this.replaceOrUpdateTrack=t=>hn(this,void 0,void 0,(function*(){this.tracksToPublish.find((e=>e.track.kind===t.track.kind))?this.tracksToPublish=this.tracksToPublish.map((e=>e.track.kind===t.track.kind?t:e)):this.tracksToPublish.push(t),yield this.peerClient.replaceOrUpdateTrack(t)})),this.getAudioSender=()=>this.peerClient.getAudioSender(),this.getVideoSender=()=>this.peerClient.getVideoSender(),this.onPeerClientConnectionStateChange=t=>{var e;if((null===(e=this.peerClient)||void 0===e?void 0:e.traceId)&&this.token)if(this.logger.debug({msg:`onPeerClientConnectionStateChange: ${t}`,state:t}),t===Be.FAILED&&this.isPublishing&&(this.trackPublishEnded(!0,pe.CONNECTION_FAIL),this.isPublishing=!1),this.isStarted)this.processStateUpdate(t);else switch(t){case Be.CONNECTING:this.publicationState=dn.CONNECTING;break;case Be.CONNECTED:this.publicationState=dn.CONNECTED;break;case Be.DISCONNECTED:this.publicationState=dn.DISCONNECTED;break;case Be.FAILED:this.publicationState=dn.ERRORED;break;default:this.publicationState=dn.CONNECTING}},this.trackPublishRequested=()=>{this.analyticsTracker.trackEventNoSharedProps(new PublishEvent({token:this.token,traceId:this.traceId}))},this.trackPublishStarted=()=>{if(!this.peerClient)return;const t=this.peerClient.getActionMeasurements();this.analyticsTracker.trackEventNoSharedProps(new PublishStartedEvent({token:this.token,traceId:this.traceId,optionsDuration:t.optionsDuration,postDuration:t.postDuration,timeToCandidate:t.timeToCandidate,totalDuration:t.timeToConnected}))},this.trackPublishEnded=(t,e)=>{this.analyticsTracker.trackEventNoSharedProps(new PublishEndedEvent({token:this.token,isUnpublishSuccessful:t,traceId:this.traceId,reason:e}))},this.peerClient=new StagePeerClient(t,this.nonScopedLogger,this.mediaStreamManager,Dt.PUBLISH,ce(Dt.PUBLISH),this.traceId),i&&this.peerClient.setV2(),this.logger=new ScopedLogger(e,w.PUBLICATION),this.analyticsTracker=AnalyticsTracker.getInstance(),this.peerClient.on(Le,this.onPeerClientConnectionStateChange,this)}removeTrack(t){return hn(this,void 0,void 0,(function*(){this.tracksToPublish=this.tracksToPublish.filter((e=>e.track.kind!==t)),yield this.peerClient.removeTrack(t)}))}}class SdpMunger{constructor(t){this.sdp=t}static splitLines(t){return t.trim().split("\n").map((t=>t.trim()))}static splitSections(t){return t.split("\nm=").map(((t,e)=>(e>0?`m=${t}`:t).trim()+SdpMunger.CRLF))}getUniqueRtpHeaderExtensionId(t){const e=[];for(const n of t)if(/^a=extmap:/.test(n.trim())){const t=+n.split("a=extmap:")[1].split(" ")[0];e.includes(t)||e.push(t)}e.sort(((t,e)=>t-e));let n=0;for(const t of e){if(t-n>1)return n+1;n=t}return 14===n?-1:n+1}withVideoLayersAllocationRtpHeaderExtension(t){const e="http://www.webrtc.org/experiments/rtp-hdrext/video-layers-allocation00",n=t?t.getRtpHeaderExtensionId(e):-1,r=-1===n?this.getUniqueRtpHeaderExtensionId(SdpMunger.splitLines(this.sdp)):n,i=SdpMunger.splitSections(this.sdp),o=[];for(let t of i){if(/^m=video/.test(t)&&-1===SdpMunger.getRtpHeaderExtensionIdInSection(t,e)){const n=SdpMunger.splitLines(t),i=[];if(-1===r||this.hasRtpHeaderExtensionId(r)){o.push(t);continue}for(const t of n)if(i.push(t),/^a=sendrecv/.test(t.trim())){const t=`a=extmap:${r} ${e}`;i.push(t)}t=i.join(SdpMunger.CRLF)+SdpMunger.CRLF}else if(-1!==n&&/^m=video/.test(t)&&SdpMunger.getRtpHeaderExtensionIdInSection(t,e)!==n){const r=SdpMunger.splitLines(t),i=[];for(const t of r){if(/^a=extmap:/.test(t.trim())){if(t.split("a=extmap:")[1].split(" ")[1]===e){if(!this.hasRtpHeaderExtensionId(n)){const t=`a=extmap:${n} ${e}`;i.push(t)}continue}}i.push(t)}t=i.join(SdpMunger.CRLF)+SdpMunger.CRLF}o.push(t)}const s=o.join("");return new SdpMunger(s)}static getRtpHeaderExtensionIdInSection(t,e){const n=SdpMunger.splitLines(t);for(const t of n)if(/^a=extmap:/.test(t.trim())){const n=t.split("a=extmap:")[1].split(" "),r=+n[0];if(n[1]===e)return r}return-1}getRtpHeaderExtensionId(t){const e=SdpMunger.splitSections(this.sdp);for(const n of e)if(/^m=video/.test(n)){const e=SdpMunger.getRtpHeaderExtensionIdInSection(n,t);if(-1!==e)return e}return-1}hasRtpHeaderExtensionId(t){const e=SdpMunger.splitLines(this.sdp);for(const n of e)if(/^a=extmap:/.test(n.trim())){if(+n.split("a=extmap:")[1].split(" ")[0]===t)return!0}return!1}}SdpMunger.CRLF="\r\n",SdpMunger.rfc7587LowestBitrate=6e3,SdpMunger.rfc7587HighestBitrate=51e4;class PublishedVideoStatsEvent extends StageAnalyticsEvent{constructor(t,e,n){var r,i;super(c.PUBLISHED_VIDEO_STATS,t,e,!1);const o=AnalyticsTracker.getInstance().getSfuResource();Object.assign(this.properties,Object.assign({action:Dt.PUBLISH,node:null!==(r=null==o?void 0:o.node)&&void 0!==r?r:"",cluster:null!==(i=null==o?void 0:o.cluster)&&void 0!==i?i:""},(t=>{var e,n,r,i;return{bytes_sent:t.bytesSent,fir_count:t.firCount,frames_encoded:t.framesEncoded,frames_sent:t.framesSent,header_bytes_sent:t.headerBytesSent,huge_frames_sent:t.hugeFramesSent,key_frames_encoded:t.keyFramesEncoded,nack_count:t.nackCount,packets_sent:t.packetsSent,pli_count:t.pliCount,quality_limitation_reason:t.qualityLimitationReason,quality_limitation_resolution_changes:t.qualityLimitationResolutionChanges,retransmitted_bytes_sent:t.retransmittedBytesSent,retransmitted_packets_sent:t.retransmittedPacketsSent,total_encode_time:t.totalEncodeTime,total_encoded_bytes_target:t.totalEncodedBytesTarget,total_packet_send_delay:t.totalPacketsSendDelay,frame_width:null!==(e=t.frameWidth)&&void 0!==e?e:0,frame_height:null!==(n=t.frameHeight)&&void 0!==n?n:0,frames_per_second:null!==(r=t.framesPerSecond)&&void 0!==r?r:0,active:!!t.framesPerSecond&&0!==t.framesPerSecond,rid:null!==(i=t.rid)&&void 0!==i?i:"no-rid"}})(n)))}}class PublishedVideoStatsWindowEvent extends StageAnalyticsEvent{constructor(t,e,n,r){var i,o;super(c.PUBLISHED_VIDEO_STATS_WINDOW,t,e,!1);const s=AnalyticsTracker.getInstance().getSfuResource();Object.assign(this.properties,Object.assign({action:Dt.PUBLISH,node:null!==(i=null==s?void 0:s.node)&&void 0!==i?i:"",cluster:null!==(o=null==s?void 0:s.cluster)&&void 0!==o?o:"",windowSizeMs:n.timestamp-r.timestamp},((t,e)=>{var n,r,i,o;return{bytes_sent:t.bytesSent-e.bytesSent,fir_count:t.firCount-e.firCount,frames_encoded:t.framesEncoded-e.framesEncoded,frames_sent:t.framesSent-e.framesSent,header_bytes_sent:t.headerBytesSent-e.headerBytesSent,huge_frames_sent:t.hugeFramesSent-e.hugeFramesSent,key_frames_encoded:t.keyFramesEncoded-e.keyFramesEncoded,nack_count:t.nackCount-e.nackCount,packets_sent:t.packetsSent-e.packetsSent,pli_count:t.pliCount-e.pliCount,quality_limitation_reason:t.qualityLimitationReason,quality_limitation_resolution_changes:t.qualityLimitationResolutionChanges,retransmitted_bytes_sent:t.retransmittedBytesSent-e.retransmittedBytesSent,retransmitted_packets_sent:t.retransmittedPacketsSent-e.retransmittedPacketsSent,total_encode_time:t.totalEncodeTime-e.totalEncodeTime,total_encoded_bytes_target:t.totalEncodedBytesTarget-e.totalEncodedBytesTarget,total_packet_send_delay:t.totalPacketSendDelay-e.totalPacketSendDelay,frame_width:null!==(n=t.frameWidth)&&void 0!==n?n:0,frame_height:null!==(r=t.frameHeight)&&void 0!==r?r:0,frames_per_second:null!==(i=t.framesPerSecond)&&void 0!==i?i:0,active:!!t.framesPerSecond&&0!==t.framesPerSecond,rid:null!==(o=t.rid)&&void 0!==o?o:"no-rid"}})(n,r)))}}class PublishedAudioStatsEvent extends StageAnalyticsEvent{constructor(t,e,n){var r,i;super(c.PUBLISHED_AUDIO_STATS,t,e,!1);const o=AnalyticsTracker.getInstance().getSfuResource();var s;Object.assign(this.properties,Object.assign({action:Dt.PUBLISH,node:null!==(r=null==o?void 0:o.node)&&void 0!==r?r:"",cluster:null!==(i=null==o?void 0:o.cluster)&&void 0!==i?i:""},{bytes_sent:(s=n).bytesSent,header_bytes_sent:s.headerBytesSent,nack_count:s.nackCount,packets_sent:s.packetsSent,retransmitted_bytes_sent:s.retransmittedBytesSent,retransmitted_packets_sent:s.retransmittedPacketsSent}))}}class PublishedAudioStatsWindowEvent extends StageAnalyticsEvent{constructor(t,e,n,r){var i,o;super(c.PUBLISHED_AUDIO_STATS_WINDOW,t,e,!1);const s=AnalyticsTracker.getInstance().getSfuResource();var a,u;Object.assign(this.properties,Object.assign({action:Dt.PUBLISH,node:null!==(i=null==s?void 0:s.node)&&void 0!==i?i:"",cluster:null!==(o=null==s?void 0:s.cluster)&&void 0!==o?o:"",windowSizeMs:n.timestamp-r.timestamp},(u=r,{bytes_sent:(a=n).bytesSent-u.bytesSent,header_bytes_sent:a.headerBytesSent-u.headerBytesSent,nack_count:a.nackCount-u.nackCount,packets_sent:a.packetsSent-u.packetsSent,retransmitted_bytes_sent:a.retransmittedBytesSent-u.retransmittedBytesSent,retransmitted_packets_sent:a.retransmittedPacketsSent-u.retransmittedPacketsSent})))}}class SubscribedVideoStatsEvent extends StageAnalyticsEvent{constructor(t,e,n,r){var i,o;super(c.SUBSCRIBED_VIDEO_STATS,t,e,!1);const s=AnalyticsTracker.getInstance().getSfuResource();Object.assign(this.properties,Object.assign({action:Dt.SUBSCRIBE,node:null!==(i=null==s?void 0:s.node)&&void 0!==i?i:"",cluster:null!==(o=null==s?void 0:s.cluster)&&void 0!==o?o:"",remote_participant_id:n},(t=>{var e,n,r;return{bytes_received:t.bytesReceived,fir_count:t.firCount,frames_decoded:t.framesDecoded,frames_dropped:t.framesDropped,frames_received:t.framesReceived,header_bytes_received:t.headerBytesReceived,jitter_buffer_delay:t.jitterBufferDelay,key_frames_decoded:t.keyFramesDecoded,nack_count:t.nackCount,packets_discarded:t.packetsDiscarded,packets_lost:t.packetsLost,packets_received:t.packetsReceived,pli_count:t.pliCount,total_freezes_duration:t.totalFreezesDuration,total_pauses_duration:t.totalPausesDuration,freeze_count:t.freezeCount,pause_count:t.pauseCount,frame_width:null!==(e=t.frameWidth)&&void 0!==e?e:0,frame_height:null!==(n=t.frameHeight)&&void 0!==n?n:0,frames_per_second:null!==(r=t.framesPerSecond)&&void 0!==r?r:0}})(r)))}}class SubscribedVideoStatsWindowEvent extends StageAnalyticsEvent{constructor(t,e,n,r,i){var o,s;super(c.SUBSCRIBED_VIDEO_STATS_WINDOW,t,e,!1);const a=AnalyticsTracker.getInstance().getSfuResource();Object.assign(this.properties,Object.assign({action:Dt.SUBSCRIBE,node:null!==(o=null==a?void 0:a.node)&&void 0!==o?o:"",cluster:null!==(s=null==a?void 0:a.cluster)&&void 0!==s?s:"",windowSizeMs:r.timestamp-i.timestamp,remote_participant_id:n},((t,e)=>{var n,r,i;return{bytes_received:t.bytesReceived-e.bytesReceived,fir_count:t.firCount-e.firCount,frames_decoded:t.framesDecoded-e.framesDecoded,frames_dropped:t.framesDropped-e.framesDropped,frames_received:t.framesReceived-e.framesReceived,header_bytes_received:t.headerBytesReceived-e.headerBytesReceived,jitter_buffer_delay:t.jitterBufferDelay-e.jitterBufferDelay,key_frames_decoded:t.keyFramesDecoded-e.keyFramesDecoded,nack_count:t.nackCount-e.nackCount,packets_discarded:t.packetsDiscarded-e.packetsDiscarded,packets_lost:t.packetsLost-e.packetsLost,packets_received:t.packetsReceived-e.packetsReceived,pli_count:t.pliCount-e.pliCount,total_freezes_duration:t.totalFreezesDuration-e.totalFreezesDuration,total_pauses_duration:t.totalPausesDuration-e.totalPausesDuration,freeze_count:t.freezeCount-e.freezeCount,pause_count:t.pauseCount-e.pauseCount,frame_width:null!==(n=t.frameWidth)&&void 0!==n?n:0,frame_height:null!==(r=t.frameHeight)&&void 0!==r?r:0,frames_per_second:null!==(i=t.framesPerSecond)&&void 0!==i?i:0}})(r,i)))}}class SubscribedAudioStatsEvent extends StageAnalyticsEvent{constructor(t,e,n,r){var i,o;super(c.SUBSCRIBED_AUDIO_STATS,t,e,!1);const s=AnalyticsTracker.getInstance().getSfuResource();var a;Object.assign(this.properties,Object.assign({action:Dt.SUBSCRIBE,node:null!==(i=null==s?void 0:s.node)&&void 0!==i?i:"",cluster:null!==(o=null==s?void 0:s.cluster)&&void 0!==o?o:"",remote_participant_id:n},{bytes_received:(a=r).bytesReceived,concealed_samples:a.concealedSamples,header_bytes_received:a.headerBytesReceived,inserted_samples_for_deceleration:a.insertedSamplesForDeceleration,jitter_buffer_delay:a.jitterBufferDelay,packets_discarded:a.packetsDiscarded,packets_lost:a.packetsLost,packets_received:a.packetsReceived,removed_samples_for_acceleration:a.removedSamplesForAcceleration,total_samples_received:a.totalSamplesReceived}))}}class SubscribedAudioStatsWindowEvent extends StageAnalyticsEvent{constructor(t,e,n,r,i){var o,s;super(c.SUBSCRIBED_AUDIO_STATS_WINDOW,t,e,!1);const a=AnalyticsTracker.getInstance().getSfuResource();var u,d;Object.assign(this.properties,Object.assign({action:Dt.SUBSCRIBE,windowSizeMs:r.timestamp-i.timestamp,node:null!==(o=null==a?void 0:a.node)&&void 0!==o?o:"",cluster:null!==(s=null==a?void 0:a.cluster)&&void 0!==s?s:"",remote_participant_id:n},(d=i,{bytes_received:(u=r).bytesReceived-d.bytesReceived,concealed_samples:u.concealedSamples-d.concealedSamples,header_bytes_received:u.headerBytesReceived-d.headerBytesReceived,inserted_samples_for_deceleration:u.insertedSamplesForDeceleration-d.insertedSamplesForDeceleration,jitter_buffer_delay:u.jitterBufferDelay-d.jitterBufferDelay,packets_discarded:u.packetsDiscarded-d.packetsDiscarded,packets_lost:u.packetsLost-d.packetsLost,packets_received:u.packetsReceived-d.packetsReceived,removed_samples_for_acceleration:u.removedSamplesForAcceleration-d.removedSamplesForAcceleration,total_samples_received:u.totalSamplesReceived-d.totalSamplesReceived})))}}class SimulcastLayerInfoEvent extends StageAnalyticsEvent{constructor(t,e,n,r){super(c.SIMULCAST_LAYER_INFO,t,e,!1),Object.assign(this.properties,{rid:n,active:r})}}class MultihostConfigurationEvent extends StageAnalyticsEvent{constructor(t,e,n){super(c.MULTIHOST_CONFIGURATION,t,e,!1),Object.assign(this.properties,Object.assign({},n))}}var gn=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};const vn="no-rid";class PeerClientStatsReporter{constructor(t,e,n,r){this.simulcastEnabled=!1,this.simulcastState={low:!1,mid:!1,hi:!1},this.multihostConfiguration=PeerClientStatsReporter.defaultMultihostConfiguration(),this.prevVideoStats=new Map,this.onPeerConnectionStateChange=()=>{switch(this.getConnectionState()){case Be.CONNECTED:this.setupIntervals();break;case Be.FAILED:this.flushStats()}},this.action=t,this.token=e,this.traceId=n,this.analyticsTracker=AnalyticsTracker.getInstance(),this.identifier=r}static defaultMultihostConfiguration(){return{video_codec:"unknown",width:0,height:0,max_bitrate:0,min_bitrate:0,target_fps:0,echo_cancellation:!1,auto_gain:!1,noise_suppression:!1,enable_simulcast:!1}}start(t,e=!1){this.peerConnection=t,this.simulcastEnabled=e,this.prevAudioStats=void 0,this.prevVideoStats=new Map,this.peerConnection.addEventListener("connectionstatechange",this.onPeerConnectionStateChange)}stop(){var t;clearInterval(this.uploadStatsInterval),this.uploadStatsInterval=void 0,null===(t=this.peerConnection)||void 0===t||t.removeEventListener("connectionstatechange",this.onPeerConnectionStateChange)}updateMultihostConfiguration(t,e){var n,r,i,o,s,a;return gn(this,void 0,void 0,(function*(){if(this.action!==Dt.PUBLISH||!this.peerConnection)return;const c=PeerClientStatsReporter.defaultMultihostConfiguration();if(e){const t=this.peerConnection.getSenders().filter((t=>null!==t.track&&"video"===t.track.kind));if(t.length>0){(yield t[0].getStats()).forEach((t=>{"codec"===t.type&&(c.video_codec=t.mimeType)}))}const o=e.track.getSettings();c.width=null!==(n=o.width)&&void 0!==n?n:0,c.height=null!==(r=o.height)&&void 0!==r?r:0,c.target_fps=null!==(i=o.frameRate)&&void 0!==i?i:0,e.config?(c.max_bitrate=e.config.maxBitrateBps,c.min_bitrate=e.config.minBitrateBps,c.enable_simulcast=e.config.simulcastEnabled):(c.max_bitrate=qt(Jt),c.min_bitrate=qt(Kt),c.enable_simulcast=!1)}if(t){const e=t.track.getSettings();c.auto_gain=null!==(o=e.autoGainControl)&&void 0!==o&&o,c.echo_cancellation=null!==(s=e.echoCancellation)&&void 0!==s&&s,c.noise_suppression=null!==(a=e.noiseSuppression)&&void 0!==a&&a}(0,Ae.isEqual)(c,this.multihostConfiguration)||(this.analyticsTracker.trackEventNoSharedProps(new MultihostConfigurationEvent(this.token,this.traceId,c)),this.multihostConfiguration=c)}))}setupIntervals(){this.action===Dt.PUBLISH&&this.simulcastEnabled&&!this.pollSimulcastLayerInterval&&(this.pollSimulcastLayers(),this.pollSimulcastLayerInterval=this.startInterval(this.pollSimulcastLayers,5e3)),this.uploadStatsInterval||(this.uploadStats(),this.uploadStatsInterval=this.startInterval(this.uploadStats,1e4))}startInterval(t,e){return setInterval(t.bind(this),e)}getConnectionState(){var t;if(!this.peerConnection)return Be.NONE;const e=null!==(t=this.peerConnection.connectionState)&&void 0!==t?t:this.peerConnection.iceConnectionState;try{return tn(e)}catch(t){return Be.IDLE}}pollSimulcastLayers(){var t;return gn(this,void 0,void 0,(function*(){if(this.getConnectionState()===Be.CONNECTED){const e=yield null===(t=this.peerConnection)||void 0===t?void 0:t.getStats();if(!e)return;e.forEach((t=>{var e;if("outbound-rtp"===t.type){const n=0!==(null!==(e=t.framesPerSecond)&&void 0!==e?e:0);switch(t.rid){case"low":n!==this.simulcastState.low&&(this.simulcastState.low=n,this.analyticsTracker.trackEventNoSharedProps(new SimulcastLayerInfoEvent(this.token,this.traceId,t.rid,n)));break;case"mid":n!==this.simulcastState.mid&&(this.simulcastState.mid=n,this.analyticsTracker.trackEventNoSharedProps(new SimulcastLayerInfoEvent(this.token,this.traceId,t.rid,n)));break;case"hi":n!==this.simulcastState.hi&&(this.simulcastState.hi=n,this.analyticsTracker.trackEventNoSharedProps(new SimulcastLayerInfoEvent(this.token,this.traceId,t.rid,n)))}}}))}}))}flushStats(){var t;return gn(this,void 0,void 0,(function*(){const e=yield null===(t=this.peerConnection)||void 0===t?void 0:t.getStats();e&&(this.action===Dt.PUBLISH?this.uploadPublisherStats(e):this.action===Dt.SUBSCRIBE&&this.uploadSubscriberStats(e))}))}uploadStats(){var t;return gn(this,void 0,void 0,(function*(){if(this.getConnectionState()===Be.CONNECTED){const e=yield null===(t=this.peerConnection)||void 0===t?void 0:t.getStats();if(!e)return;this.action===Dt.PUBLISH?this.uploadPublisherStats(e):this.action===Dt.SUBSCRIBE&&this.uploadSubscriberStats(e)}}))}uploadPublisherStats(t){t.forEach((t=>{if("outbound-rtp"===t.type)switch(t.kind){case"audio":this.analyticsTracker.trackEventNoSharedProps(new PublishedAudioStatsEvent(this.token,this.traceId,t)),this.prevAudioStats&&this.analyticsTracker.trackEventNoSharedProps(new PublishedAudioStatsWindowEvent(this.token,this.traceId,t,this.prevAudioStats)),this.prevAudioStats=t;break;case"video":this.analyticsTracker.trackEventNoSharedProps(new PublishedVideoStatsEvent(this.token,this.traceId,t));const e=this.getPrevVideoStat(t);e&&this.analyticsTracker.trackEventNoSharedProps(new PublishedVideoStatsWindowEvent(this.token,this.traceId,t,e)),this.setPrevVideoStat(t)}}))}uploadSubscriberStats(t){t.forEach((t=>{if("inbound-rtp"===t.type)switch(t.kind){case"audio":this.analyticsTracker.trackEventNoSharedProps(new SubscribedAudioStatsEvent(this.token,this.traceId,this.identifier,t)),this.prevAudioStats&&this.analyticsTracker.trackEventNoSharedProps(new SubscribedAudioStatsWindowEvent(this.token,this.traceId,this.identifier,t,this.prevAudioStats)),this.prevAudioStats=t;break;case"video":this.analyticsTracker.trackEventNoSharedProps(new SubscribedVideoStatsEvent(this.token,this.traceId,this.identifier,t));const e=this.getPrevVideoStat(t);e&&this.analyticsTracker.trackEventNoSharedProps(new SubscribedVideoStatsWindowEvent(this.token,this.traceId,this.identifier,t,e)),this.setPrevVideoStat(t)}}))}getPrevVideoStat(t){return this.simulcastEnabled&&t.rid&&this.prevVideoStats.has(t.rid)?this.prevVideoStats.get(t.rid):!this.simulcastEnabled&&this.prevVideoStats.has(vn)?this.prevVideoStats.get(vn):void 0}setPrevVideoStat(t){this.simulcastEnabled&&t.rid?this.prevVideoStats.set(t.rid,t):this.simulcastEnabled||this.prevVideoStats.set(vn,t)}}var mn=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};let _n=null;class StagePeerClient{constructor(t,e,n,r,i,o,s,a){if(this.sentOffer=!1,this.v2=!1,this.subscribeToAudioOnly=!1,this.stageCapabilities={simulcastNegotiated:!1},this.connect=(t=!1,e)=>mn(this,void 0,void 0,(function*(){const{token:n,tag:r,identifier:i,action:o}=this;let s,a,c,u=!1;const d=()=>{this.emitter.off(Ue,s),this.emitter.off(Le,a)};this.traceId=e,this.subscribeToAudioOnly=t;const l=new Promise(((t,e)=>{const d=setTimeout((()=>{this.stop();const t=o===Dt.SUBSCRIBE?he.SUBSCRIBE_TIMED_OUT:he.PUBLISH_TIMED_OUT,s=new StageClientError(Object.assign(Object.assign({},t),{token:n,traceId:this.traceId,tag:r,location:"connect",remoteParticipantId:i}));this.analyticsTracker.trackError(s),e(s)}),1e4);s=t=>{clearTimeout(d),this.stop(),u&&e(t)},a=e=>{e===Be.CONNECTED&&(clearTimeout(d),t())},this.emitter.on(Ue,s),this.emitter.on(Le,a),c=()=>{clearTimeout(d)}}));try{yield this.start(),u=!0;const t=yield this.addTransceivers();if(yield l,AbortControllersTracker.getInstance().removeAbortController(i),o===Dt.PUBLISH)try{yield this.verifyOrUpdateTransceiverSync()}catch(t){this.logger.error({err:t,msg:"error syncing transceivers"})}return{mediaStream:t}}catch(t){throw c&&c(),t}finally{d()}})),this.disconnect=()=>mn(this,void 0,void 0,(function*(){const{token:t,action:e}=this;this.stop(),AbortControllersTracker.getInstance().isUnloading?this.cleanup(e,t.participantID,t):yield this.cleanup(e,t.participantID,t)})),this.onTrack=t=>{const{token:e,action:n,traceId:r,identifier:i}=this;be(e,r,`onTrack: ${t.track.kind}`,n,i)},this.onIceGatheringStateChange=()=>{var t,e;const{token:n,action:r,traceId:i,identifier:o}=this;if("gathering"===(null===(t=this.peerConnection)||void 0===t?void 0:t.iceGatheringState)&&this.perfTracker.markIceGatheringStart(),this.peerConnection){const t=this.peerConnection.iceGatheringState,e=new IceGatheringStateEvent(r,n,i,t,o);this.analyticsTracker.trackEventNoSharedProps(e)}be(n,i,`ICE gathering state change: ${null===(e=this.peerConnection)||void 0===e?void 0:e.iceGatheringState}`,r,o)},this.onIceCandidate=t=>mn(this,void 0,void 0,(function*(){var e,n,r,i;const{token:o,identifier:s,action:a,sentOffer:c,traceId:u}=this,d=null===(e=t.target.localDescription)||void 0===e?void 0:e.sdp.includes("relay");if(this.analyticsTracker.trackEventNoSharedProps(new TraceEvent(this.token,u,`ice candidate: hasRelay = ${d}, candidate = ${null===(n=t.candidate)||void 0===n?void 0:n.candidate}`,a,s)),!d&&o.shouldUseTURN()||c||void 0===(null===(r=t.candidate)||void 0===r?void 0:r.candidate)||(this.perfTracker.markIceGatheringStop(),this.sentOffer=!0,this.perfTracker.markPostStart(),yield this.fetchAndSetRemoteDescription(a,s,o,this.responseURL),this.perfTracker.markPostStop()),!c&&void 0===(null===(i=t.candidate)||void 0===i?void 0:i.candidate)){const t=new StageClientError(Object.assign(Object.assign({},he.NO_CANDIDATES),{token:o,traceId:u,tag:ce(a,s),location:"StagePeerClient.start",remoteParticipantId:s}));return this.analyticsTracker.trackError(t),void this.emitter.emit(Ue,t)}})),this.onMute=()=>mn(this,void 0,void 0,(function*(){const{token:t,action:e,traceId:n,identifier:r}=this;be(t,n,"Track has muted",e,r)})),this.onUnMute=()=>mn(this,void 0,void 0,(function*(){const{token:t,action:e,traceId:n,identifier:r}=this;be(t,n,"Track has unmuted",e,r)})),this.stopRemoteVideo=()=>{if(!this.videoTransceiver){const t=new Error("no video transciever to stop");throw this.logger.error({err:t,msg:"error stopping video"}),t}const{mid:t}=this.videoTransceiver;if(!t){const t=new Error("no mid for transceiver");throw this.logger.error({err:t,msg:"error stopping video"}),t}this.sendMediaControlsRequest({pause:[t]})},this.startRemoteVideo=()=>{if(!this.videoTransceiver){const t=new Error("no video transciever to start");throw this.logger.error({err:t,msg:"error starting video"}),t}const{mid:t}=this.videoTransceiver;if(!t){const t=new Error("no mid for transceiver");throw this.logger.error({err:t,msg:"error starting video"}),t}this.sendMediaControlsRequest({play:[t]})},this.sendMediaControlsRequest=t=>{var e;if(this.action!==Dt.SUBSCRIBE){const t=new Error("media controls not supported for publisher peer connections");throw this.logger.error({err:t,msg:"tried to send media controls request for PUBLISHER peer connection"}),t}if(!(null===(e=this.whipResource)||void 0===e?void 0:e.mediaControls)){const t=new Error("media controls url undefined");throw this.logger.error({err:t,msg:"error sending media controls request"}),t}const{mediaControls:n}=this.whipResource,r=p();_e().post(n,JSON.stringify(t),{headers:{Authorization:`Bearer ${this.token.rawToken}`,"Content-Type":"application/json","X-Stages-Platform":"web","X-Stages-Request-ID":r.value,"X-Stages-SDK":"1.5.2","X-Stages-Session-ID":m(this.token),"X-Stages-Trace-ID":this.traceId.value,"X-Stages-WHIP-Version":Xe}}).then((t=>{if(t.status>=300){const e=new Error(`got bad status ${t.status} from media controls request`);throw this.logger.error({err:e,msg:"error sending media controls request"}),e}}),(t=>{throw t}))},this.fetchAndSetRemoteDescription=(t,e,n,r)=>mn(this,void 0,void 0,(function*(){var i,o,s,a;const c=p();try{const u="POST";this.analyticsTracker.trackEventNoSharedProps(new ServerRequestEvent(t,n,r,u,c.value,e,this.traceId));const d=AbortControllersTracker.getInstance().trackNewAbortController(e),{data:l,headers:h,request:p}=yield Ze({data:null===(o=null===(i=this.peerConnection)||void 0===i?void 0:i.localDescription)||void 0===o?void 0:o.sdp,headers:{Authorization:`Bearer ${n.rawToken}`,"Content-Type":"application/sdp","X-Stages-Platform":"web","X-Stages-Request-ID":c.value,"X-Stages-SDK":"1.5.2","X-Stages-Session-ID":m(n),"X-Stages-Trace-ID":this.traceId.value,"X-Stages-WHIP-Version":Xe},method:u,responseType:"text",url:r,signal:d.signal});if(this.analyticsTracker.setSfuResource(function(t){const e=t.match(/https:\/\/([^/]+)\//);if(e){const t=e[1].split(".");if(t[0].includes("video-rtx"))return{node:`${t[0]}.${t[1]}`,cluster:t[1]}}}(p.responseURL)),h.location){const t=new URL(p.responseURL),e=t.port?`:${t.port}`:"";this.whipResource={path:`${t.protocol}//${t.hostname}${e}${h.location}`}}null===(s=h.link)||void 0===s||s.split(",").forEach((t=>{const e=this.parseWhipLinkExtension(t);if(3===(null==e?void 0:e.length))switch(e[2]){case"urn:ietf:params:whip:ivs-stages:session-delete":{const t=new URL(p.responseURL),n=t.port?`:${t.port}`:"";this.whipResource&&(this.whipResource.sessionDelete=`${t.protocol}//${t.hostname}${n}${e[1]}`);break}case"urn:ietf:params:whep:core:playback-controls":{const t=new URL(p.responseURL),n=t.port?`:${t.port}`:"";this.whipResource&&(this.whipResource.mediaControls=`${t.protocol}//${t.hostname}${n}${e[1]}`);break}}})),yield null===(a=this.peerConnection)||void 0===a?void 0:a.setRemoteDescription({sdp:l,type:"answer"})}catch(r){if(_e().isCancel(r)){const i=new StageClientError(Object.assign(Object.assign({},ue(he.OPERATION_ABORTED,r)),{token:n,traceId:this.traceId,tag:ce(t,e),location:"StagePeerClient.start",requestUUID:c,remoteParticipantId:e}));return this.analyticsTracker.trackError(i),void this.emitter.emit(Ue,i)}let i=he.WHIP_POST_FAILURE;if(r instanceof me.AxiosError){const t=de(r);t&&(i=t)}const o=new StageClientError(Object.assign(Object.assign({},ue(i,r)),{token:n,traceId:this.traceId,tag:ce(t,e),location:"StagePeerClient.start",requestUUID:c,remoteParticipantId:e}));this.analyticsTracker.trackError(o),this.emitter.emit(Ue,o)}})),this.cleanup=(t,e,n)=>mn(this,void 0,void 0,(function*(){var r,i,o,s;let a=ve({action:t,identifier:e,token:n.rawToken,whipURLOverride:this.whipUrlOverride});const c=p();if(be(n,this.traceId,`token dataplane url: ${a}`,t,e),(null===(r=this.whipResource)||void 0===r?void 0:r.path)&&(a=null===(i=this.whipResource)||void 0===i?void 0:i.path,be(n,this.traceId,`use hostnamecachedurl: ${a}`,t,e)),a||this.analyticsTracker.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},he.WHIP_URL_MISSING),{token:n,traceId:this.traceId,tag:ce(t,e),location:t===Dt.SUBSCRIBE?"unsubscribe":"unpublish",requestUUID:c,remoteParticipantId:e}))),AbortControllersTracker.getInstance().isUnloading){if(null===(s=this.whipResource)||void 0===s?void 0:s.sessionDelete){a=this.whipResource.sessionDelete,be(n,this.traceId,`DELETE via session-delete beacon path: ${a}`,t,e);try{navigator.sendBeacon(a,JSON.stringify({authorization:n.rawToken}))}catch(r){this.analyticsTracker.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},ue(he.WHIP_DELETE_FAILURE,r)),{token:n,traceId:this.traceId,tag:ce(t,e),location:Dt.SUBSCRIBE?"unsubscribe":"unpublish",requestUUID:c,remoteParticipantId:e})))}}}else try{yield _e().delete(a,{headers:{Authorization:`Bearer ${n.rawToken}`,"X-Stages-Platform":"web","X-Stages-Request-ID":c.value,"X-Stages-SDK":"1.5.2","X-Stages-Session-ID":m(n),"X-Stages-Trace-ID":this.traceId.value,"X-Stages-WHIP-Version":Xe}})}catch(r){404===(null===(o=r.response)||void 0===o?void 0:o.status)?be(n,this.traceId,`DELETE returned 404, ignoring, action = ${t}, uuid = ${c.value}`,t,e):this.analyticsTracker.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},ue(he.WHIP_DELETE_FAILURE,r)),{token:n,traceId:this.traceId,tag:ce(t,e),location:Dt.SUBSCRIBE?"unsubscribe":"unpublish",requestUUID:c,remoteParticipantId:e})))}})),this.getConnectionState=()=>{if(!this.peerConnection)return Be.NONE;const t=this.peerConnection.connectionState||this.peerConnection.iceConnectionState;try{return tn(t)}catch(e){return this.logger.warn({msg:"Unhandled connection state:",rawState:t}),Be.IDLE}},this.getValidPeerConnectionCanThrow=()=>{if(!this.peerConnection)throw new Error("missing peer connection");return this.peerConnection},this.onIceCandidateError=t=>{const{token:e,traceId:n,tag:r}=this;if(701!==t.errorCode){const t=new StageClientError(Object.assign(Object.assign({},he.ICE_CANDIDATE_ERROR),{token:e,traceId:n,tag:r,location:"onIceCandidateError",remoteParticipantId:this.identifier}));this.analyticsTracker.trackError(t),this.emitter.emit(Ue,t)}},this.onIceConnectionStateChange=()=>{var t;const{token:e,traceId:n,action:r,identifier:i}=this;be(e,n,`ICE connection state change: ${null===(t=this.peerConnection)||void 0===t?void 0:t.iceConnectionState}`,r,i),this.onConnectionStateChange()},this.onConnectionStateChange=()=>{var t;if(this.peerConnection){const t=this.peerConnection.connectionState||this.peerConnection.iceConnectionState,{token:e,traceId:n,identifier:r,action:i}=this,o=new ConnectionStateEvent(i,e,n,t,r);this.analyticsTracker.trackEventNoSharedProps(o),be(e,n,`connection state change: ${t}`,i,r)}const e=this.getConnectionState();switch(e){case Be.CONNECTED:{this.perfTracker.markActionStop(),this.emitter.emit(Le,e);const n=this.mediaStreamManager.getTrack(ye.AUDIO),r=this.mediaStreamManager.getTrack(ye.VIDEO);if(r){const t=r.getSettings();this.analyticsTracker.trackEvent(new SessionVideoPropertiesEvent(t))}if(n){const t=n.getSettings();this.analyticsTracker.trackEvent(new SessionAudioPropertiesEvent(t))}const i=(null===(t=this.peerConnection)||void 0===t?void 0:t.getSenders())||[];this.statsReporter.updateMultihostConfiguration(this.audioTrackForPub,this.videoTrackForPub),i.forEach((t=>{var e;((null===(e=t.getParameters())||void 0===e?void 0:e.codecs)||[]).forEach((e=>{var i;switch(null===(i=t.track)||void 0===i?void 0:i.kind){case"video":{if(!r)break;const t=(new SDPFmtpLine).extractVideoSdpFmtpLine(e.sdpFmtpLine),n=r.getSettings();this.analyticsTracker.trackEvent(new SessionVideoEncoderConfiguredEvent(n,t,e));break}case"audio":if(!n)break;this.analyticsTracker.trackEvent(new SessionAudioEncoderConfiguredEvent(e))}}))}));break}case Be.FAILED:this.emitter.emit(Le,e),this.handleConnectionFailure();break;default:this.emitter.emit(Le,e)}},this.token=t,this.logger=new ScopedLogger(e,w.WEBRTC),this.action=r,this.tag=i,this.traceId=o,this.analyticsTracker=AnalyticsTracker.getInstance(),this.mediaStreamManager=n,this.emitter=new u,r===Dt.SUBSCRIBE&&!s)throw new Error("Subscribe action provided without subscriber Id");this.subscriberId=s,this.perfTracker=new PeerClientPerformanceTracker(this.action,this.traceId),this.whipUrlOverride=a,this.statsReporter=new PeerClientStatsReporter(r,t,o,this.identifier)}setV2(){this.v2=!0}verifyOrUpdateTransceiverSync(){var t,e;return mn(this,void 0,void 0,(function*(){if(this.videoTrackForPub){const e=this.getTransceiverForKind("video");e?this.videoTrackForPub.track.id!==(null===(t=e.sender.track)||void 0===t?void 0:t.id)&&(this.logger.debug({msg:"found out of sync video transceiver... updating"}),yield this.replaceOrUpdateTrack(this.videoTrackForPub)):this.logger.warn({msg:"missing transceiver for video"})}if(this.audioTrackForPub){const t=this.getTransceiverForKind("audio");t?this.audioTrackForPub.track.id!==(null===(e=t.sender.track)||void 0===e?void 0:e.id)&&(this.logger.debug({msg:"found out of sync audio transceiver... updating"}),yield this.replaceOrUpdateTrack(this.audioTrackForPub)):this.logger.warn({msg:"missing transceiver for audio"})}}))}start(){var t,e,n,r,i,o;return mn(this,void 0,void 0,(function*(){const{token:s,action:a,traceId:c,identifier:u}=this;a!==Dt.PUBLISH||s.claims.capabilities.allow_publish||this.analyticsTracker.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},ue(he.TOKEN_PERMISSIONS_DENIED,new Error("Cannot publish with subscribe only token"))),{token:s,traceId:c,tag:ce(a,u),location:"StagePeerClient.start",remoteParticipantId:u})));let d=ve({action:a,identifier:u,token:s.rawToken,whipURLOverride:this.whipUrlOverride}),l=[];try{if(this.perfTracker.markActionStart(),s.shouldUseTURN()){let r;this.perfTracker.markOptionsStart(),({iceCredentials:l,responseURL:d,stageCapabilities:r}=yield function({action:t,identifier:e,token:n,traceId:r,tag:i,configFeatures:o}){var s;return en(this,void 0,void 0,(function*(){const a=ge(n),c=p(),u=AnalyticsTracker.getInstance();try{const i=ve({action:t,identifier:e,token:n});if(!i)throw Error("Could not find URL in token");const d="OPTIONS";u.trackEventNoSharedProps(new ServerRequestEvent(t,a,i,d,c.value,e,r));const l=AbortControllersTracker.getInstance().trackNewAbortController(e),h={Authorization:`Bearer ${n}`,"X-Stages-Platform":"web","X-Stages-Request-ID":c.value,"X-Stages-SDK":"1.5.2","X-Stages-Session-ID":m(a),"X-Stages-Trace-ID":r.value,"X-Stages-WHIP-Version":Xe};o.simulcastEnabled&&(h[nn]=sn);const{headers:p,request:f}=yield Ze({headers:h,method:d,url:i,signal:l.signal}),g={simulcastNegotiated:!1};if(p[nn]){const t=JSON.parse(atob(p[nn]));o.simulcastEnabled&&(null===(s=t[rn])||void 0===s?void 0:s.includes(on))&&(g.simulcastNegotiated=!0)}if(!p.link)throw Error("Headers returned from OPTIONS request missing link entry");const v=[];if(p.link.split(",").forEach((t=>{const e={credential:"",urls:"",username:""};t.split(";").forEach((t=>{const n=t.split(/=(.*)/s);if(t.startsWith("turn:")||t.startsWith("<turn:")){let n=t.trim();n.startsWith("<turn:")&&n.endsWith(">")&&(n=n.slice(1,-1)),e.urls=n}else if(3===n.length){const t=n[1].trim().slice(1,-1);switch(n[0].trim()){case"credential":e.credential=t;break;case"username":e.username=t}}})),""!==e.credential&&""!==e.urls&&""!==e.username&&v.push(e)})),0===v.length)throw Error("OPTIONS response contained link header, but no valid ICE Servers");return{iceCredentials:v,responseURL:f.responseURL,stageCapabilities:g}}catch(t){_e().isCancel(t)&&u.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},ue(he.OPERATION_ABORTED,t)),{token:a,tag:i,traceId:r,location:"getTurnCredentials",remoteParticipantId:e,requestUUID:c})));let n=he.WHIP_OPTIONS_FAILURE;if(t instanceof me.AxiosError){const e=de(t);e&&(n=e)}u.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},ue(n,t)),{token:a,tag:i,traceId:r,location:"getTurnCredentials",remoteParticipantId:e,requestUUID:c})))}}))}({action:a,identifier:u,token:s.rawToken,traceId:c,tag:this.tag,configFeatures:{simulcastEnabled:null!==(n=null===(e=null===(t=this.videoTrackForPub)||void 0===t?void 0:t.config)||void 0===e?void 0:e.simulcastEnabled)&&void 0!==n&&n}})),this.stageCapabilities=r,this.perfTracker.markOptionsStop(),this.analyticsTracker.trackEventNoSharedProps(new TraceEvent(this.token,c,`ice url list = ${l.map((t=>t.urls))}`,a,u))}else this.stageCapabilities={simulcastNegotiated:null!==(o=null===(i=null===(r=this.videoTrackForPub)||void 0===r?void 0:r.config)||void 0===i?void 0:i.simulcastEnabled)&&void 0!==o&&o};this.sentOffer=!1,this.responseURL=d,this.peerConnection=new RTCPeerConnection({iceServers:l,iceTransportPolicy:s.shouldUseTURN()?"relay":"all"}),this.statsReporter.start(this.peerConnection,this.stageCapabilities.simulcastNegotiated),this.peerConnection.addEventListener("connectionstatechange",this.onConnectionStateChange),this.peerConnection.addEventListener("iceconnectionstatechange",this.onIceConnectionStateChange),this.peerConnection.addEventListener("icecandidateerror",this.onIceCandidateError),this.peerConnection.addEventListener("icegatheringstatechange",this.onIceGatheringStateChange),this.peerConnection.addEventListener("icecandidate",this.onIceCandidate),this.peerConnection.addEventListener("track",this.onTrack),this.peerConnection.addEventListener("mute",this.onMute),this.peerConnection.addEventListener("unmute",this.onUnMute),be(s,c,"peer connection created",a,u)}catch(t){const e=new StageClientError(Object.assign(Object.assign({},ue(he.CREATE_PEER_CONNECTION_FAILURE,t)),{token:s,traceId:c,tag:ce(a,u),location:"StagePeerClient.start",remoteParticipantId:u}));a===Dt.PUBLISH&&this.emitter.emit(Le,Be.FAILED),this.emitter.emit(Ue,e),this.analyticsTracker.trackErrorAndThrow(e)}}))}stop(){var t,e,n,r,i,o,s,a,c;this.statsReporter.stop(),null===(t=this.peerConnection)||void 0===t||t.removeEventListener("connectionstatechange",this.onConnectionStateChange),null===(e=this.peerConnection)||void 0===e||e.removeEventListener("iceconnectionstatechange",this.onIceConnectionStateChange),null===(n=this.peerConnection)||void 0===n||n.removeEventListener("icecandidateerror",this.onIceCandidateError),null===(r=this.peerConnection)||void 0===r||r.removeEventListener("icegatheringstatechange",this.onIceGatheringStateChange),null===(i=this.peerConnection)||void 0===i||i.removeEventListener("track",this.onTrack),null===(o=this.peerConnection)||void 0===o||o.removeEventListener("mute",this.onMute),null===(s=this.peerConnection)||void 0===s||s.removeEventListener("unmute",this.onUnMute),null===(a=this.peerConnection)||void 0===a||a.removeEventListener("icecandidate",this.onIceCandidate),null===(c=this.peerConnection)||void 0===c||c.close()}getTransceiverForKind(t){if(!this.peerConnection)return;const e=this.peerConnection.getTransceivers();return"audio"===t?e.find((t=>"0"===t.mid)):"video"===t?e.find((t=>"1"===t.mid)):void 0}removeTrack(t){return mn(this,void 0,void 0,(function*(){if("audio"===t||"video"===t)if(this.peerConnection)try{const e=this.getTransceiverForKind(t);if(!e)return void this.logger.warn({msg:`tried removing track type ${t} but couldn't find transceiver`});yield e.sender.replaceTrack(null),t===ye.AUDIO?this.audioTrackForPub=void 0:this.videoTrackForPub=void 0,yield this.statsReporter.updateMultihostConfiguration(this.audioTrackForPub,this.videoTrackForPub)}catch(t){this.logger.warn({msg:"error replacing track",err:t})}else t===ye.AUDIO?this.audioTrackForPub=void 0:this.videoTrackForPub=void 0;else this.logger.warn({msg:"RemoveTrack called with invalid track type",trackType:t})}))}replaceOrUpdateTrack(t){return mn(this,void 0,void 0,(function*(){if(t.track){if(pn(t)?this.audioTrackForPub=t:fn(t)&&(this.videoTrackForPub=t),this.peerConnection)try{const e=this.getTransceiverForKind(t.track.kind);if(!e)return void this.logger.warn({msg:`tried replacing track type ${t.track.kind} but couldn't find transceiver`,track:t.track});if(fn(t)){const n=e.sender.getParameters(),r=this.getEncodingLayersFromConfig(this.stageCapabilities.simulcastNegotiated,t);n.encodings=n.encodings.map((t=>{var e;const n=null!==(e=t.rid)&&void 0!==e?e:"",i=r.find((t=>{var e;return(null!==(e=t.rid)&&void 0!==e?e:"")===n}));return i?Object.assign(Object.assign({},t),i):t})),yield e.sender.setParameters(n)}yield e.sender.replaceTrack(t.track),yield this.statsReporter.updateMultihostConfiguration(this.audioTrackForPub,this.videoTrackForPub)}catch(t){this.logger.warn({msg:"error replacing track",err:t})}}else this.logger.warn({msg:"Unexpected call to replaceOrUpdateTrack with no track"})}))}addTransceivers(){var t,e;return mn(this,void 0,void 0,(function*(){const{traceId:n,token:r,action:i,identifier:o}=this;Ke(this.peerConnection);let s,a=null;if(i===Dt.PUBLISH){if(this.audioTrackForPub||(this.audioTrackForPub={track:this.getSilentAudio()}),!this.videoTrackForPub&&!this.v2)throw new Error("We cannot configure transceivers without a video track");const e=this.peerConnection.getTransceivers(),s=[];e.forEach((t=>{var e;s.concat(null===(e=t.sender.track)||void 0===e?void 0:e.id)}));const a=new MediaStream([this.audioTrackForPub.track,null===(t=this.videoTrackForPub)||void 0===t?void 0:t.track].filter((t=>!!t&&!s.includes(t.id)))),c=a.getAudioTracks()[0]||"audio",u=a.getVideoTracks()[0]||"video",d={direction:"sendonly",streams:[a]},l={direction:"sendrecv",streams:[a],sendEncodings:this.getEncodingLayersFromConfig(this.stageCapabilities.simulcastNegotiated,this.videoTrackForPub)};this.peerConnection.addTransceiver(c,d),be(r,n,`track added, type: ${c.kind||c}`,i,o),this.peerConnection.addTransceiver(u,l),be(r,n,`track added, type: ${u.kind||u}`,i,o)}else if(i===Dt.SUBSCRIBE){if(r.shouldSendSilentAudio()){const t="audio"===(null===(e=this.customSilentAudioTrackForSub)||void 0===e?void 0:e.kind)?this.customSilentAudioTrackForSub:this.getSilentAudio();this.peerConnection.addTransceiver(t,{direction:"sendrecv"})}else this.peerConnection.addTransceiver("audio",{direction:"recvonly"});be(r,n,"track added, type: audio",i,o),this.subscribeToAudioOnly||(this.videoTransceiver=this.peerConnection.addTransceiver("video",{direction:"recvonly"}),be(r,n,"track added, type: video",i,o)),a=new MediaStream,this.peerConnection.getTransceivers().forEach((t=>{t.receiver?(this.logger.info({msg:"dbg: Subscribe succeeded, adding media track to participant mediaStream"}),null==a||a.addTrack(t.receiver.track)):this.logger.info({msg:"dbg: Subscribe succeeded, but Transceiver were negotiated without Receiver"})}))}try{be(this.token,n,"Creating offer",this.action,o),s=yield this.peerConnection.createOffer(),be(this.token,n,"Setting local description",this.action,o)}catch(t){const e=new StageClientError(Object.assign(Object.assign({},ue(he.CREATE_OFFER_FAILURE,t)),{token:this.token,traceId:n,tag:this.tag,location:"addTransceivers",remoteParticipantId:o}));this.emitter.emit(Ue,e),this.analyticsTracker.trackErrorAndThrow(e)}return this.stageCapabilities.simulcastNegotiated&&(s.sdp=new SdpMunger(s.sdp).withVideoLayersAllocationRtpHeaderExtension().sdp),yield this.peerConnection.setLocalDescription(s),be(this.token,n,"local description set",this.action,o),a}))}getEncodingLayersFromConfig(t,e){var n,r;const i=null==e?void 0:e.track,o=null==e?void 0:e.config;if(t&&i){const t=(0,Ae.cloneDeep)([{encodingParams:ee,targetResolution:ne},{encodingParams:re,targetResolution:ie},{encodingParams:oe,targetResolution:se}]),{height:e,width:s}=i.getSettings(),a=e&&s?{width:s,height:e}:void 0;for(const e of t){e.encodingParams.active=!0;let t=1;a&&(t=Math.floor(Math.sqrt(a.width*a.height/(e.targetResolution.width*e.targetResolution.height))),t=Math.max(t,1)),e.encodingParams.scaleResolutionDownBy=t}let c=null!==(n=null==o?void 0:o.maxBitrateBps)&&void 0!==n?n:oe.maxBitrate;const u=null!==(r=null==o?void 0:o.maxFramerate)&&void 0!==r?r:oe.maxFramerate;return c<re.maxBitrate&&(c=oe.maxBitrate),t[2].encodingParams.maxBitrate=c,t[2].encodingParams.maxFramerate=u,t[2].encodingParams.scaleResolutionDownBy=1,t.map((t=>t.encodingParams))}return o?[{maxBitrate:o.maxBitrateBps,maxFramerate:o.maxFramerate}]:[{maxBitrate:qt(Jt),maxFramerate:Xt}]}getReports(){var t;return mn(this,void 0,void 0,(function*(){try{const e=(yield null===(t=this.peerConnection)||void 0===t?void 0:t.getStats())||[],n=[];return e.forEach((t=>{n.push(t)})),n}catch(t){return[]}}))}requestRTCStats(t){return mn(this,void 0,void 0,(function*(){if(this.peerConnection)return this.peerConnection.getStats(t)}))}get identifier(){return this.subscriberId||this.token.participantID}handleConnectionFailure(){return mn(this,void 0,void 0,(function*(){const{token:t,traceId:e,tag:n}=this;this.analyticsTracker.trackError(new StageClientError(Object.assign(Object.assign({},he.PEER_CONNECTION_NETWORK_FAILURE),{token:t,traceId:e,tag:n,location:"onIceCandidateError",remoteParticipantId:this.identifier})))}))}on(t,e,n){this.emitter.on(t,e,n)}off(t,e,n){this.emitter.off(t,e,n)}getSilentAudio(){_n||(_n=new AudioContext);const t=_n.createOscillator(),e=_n.createGain();t.connect(e);const n=_n.createMediaStreamDestination();return e.connect(n),e.gain.value=0,t.start(),n.stream.getAudioTracks()[0]}getActionMeasurements(){return this.perfTracker.getMeasurements()}getAudioSender(){var t;return null===(t=this.peerConnection)||void 0===t?void 0:t.getSenders().find((t=>{var e;return"audio"===(null===(e=t.track)||void 0===e?void 0:e.kind)}))}getVideoSender(){var t;return null===(t=this.peerConnection)||void 0===t?void 0:t.getSenders().find((t=>{var e;return"video"===(null===(e=t.track)||void 0===e?void 0:e.kind)}))}parseWhipLinkExtension(t){return/<([0-9a-zA-Z/_-]+)>; rel="([a-z:-]+)"/.exec(t)}initTracksToPublish(t){this.videoTrackForPub=t.find(fn),this.audioTrackForPub=t.find(pn)}setCustomSilentAudioTrackForSub(t){this.customSilentAudioTrackForSub=t}}var Sn,En,yn,bn,Cn=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},Tn=function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)};!function(t){t.INIT="init",t.CONNECTING="connecting",t.CONNECTED="connected",t.UNSTABLE="unstable",t.PAUSED="paused",t.FAILED="failed",t.STOPPED="stopped"}(yn||(yn={})),function(t){t.NONE="none",t.AUDIO_ONLY="audio_only",t.AUDIO_VIDEO="audio_video"}(bn||(bn={}));class StageSubscription{constructor(t,e,n,r,i,o,s){this.id=t,this.token=e,this.stageConnection=n,this.nonScopedLogger=r,this.mediaStreamManager=i,this.traceId=o,this.customSilentAudioTrack=s,Sn.add(this),this.emitter=new u.EventEmitter,this.isSubscriptionActive=!1,this.subscriptionState={connectionState:yn.INIT,subscribeInProgress:!1},this.previousSignalState={isTargetPublishing:!1},this.failedRetries=0,this.throttler=new ThrottleTimer(1e3),this.isStarted=!1,this.updateSubscribeType=t=>{t===bn.AUDIO_ONLY?this.peerClient.stopRemoteVideo():t===bn.AUDIO_VIDEO&&this.peerClient.startRemoteVideo()},this.onParticipantUpdated=t=>{Tn(this,Sn,"m",En).call(this,t)&&(this.logger.debug({msg:"onParticipantUpdated",participant:t}),this.onSignalStateChange({isTargetPublishing:t.isPublishing}))},this.onParticipantJoined=t=>{Tn(this,Sn,"m",En).call(this,t)&&(this.logger.debug({msg:"onParticipantJoined",participant:t}),this.onSignalStateChange({isTargetPublishing:t.isPublishing}))},this.onParticipantLeft=t=>{Tn(this,Sn,"m",En).call(this,t)&&(this.logger.debug({msg:"onParticipantLeft",participant:t}),this.onSignalStateChange({isTargetPublishing:!1}))},this.requestRTCStats=t=>Cn(this,void 0,void 0,(function*(){return this.peerClient.requestRTCStats(t)})),this.attemptSubscribe=t=>Cn(this,void 0,void 0,(function*(){if(this.logger.debug({msg:`Subscribe attempt started: ${t}`}),!this.isSubscriptionActive)return this.logger.warn({msg:"Subscribe attempt invalid: Subscription is inactive"}),!1;this.logger.debug({msg:"Subscribe attempt is valid."}),this.subscriptionState.connectionState!==yn.FAILED&&(this.logger.debug({msg:"Updating state to CONNECTING"}),this.changeState({connectionState:yn.CONNECTING}));try{const{mediaStream:t}=yield this.subscribe();return this.throttler.clear(),this.failedRetries=0,this.emitter.emit(Te.STAGE_STREAM_UPDATE,t),this.logger.debug({msg:"Subscribe attempt succeeded"}),!0}catch(e){this.logger.error({log:"Subscribe attempt failed",err:e}),this.onAttemptSubscribeFailure(t)}return!1})),this.id=t,this.token=e,this.stageConnection=n,this.peerClient=new StagePeerClient(e,this.nonScopedLogger,this.mediaStreamManager,Dt.SUBSCRIBE,ce(Dt.SUBSCRIBE,t),this.traceId,t),this.logger=new ScopedLogger(r,w.SUBSCRIPTION),this.analyticsTracker=AnalyticsTracker.getInstance(),this.traceId=o}onPeerClientConnectionStateChange(t){const e=this.stageConnection.getParticipant(this.id);this.logger.debug({msg:`onPeerClientConnectionStateChange: ${t}`,state:t,targetParticipant:e}),this.onSignalStateChange({peerClientState:t})}onSignalStateChange(t){const e=this.previousSignalState,n=Object.assign({},e,t);this.isSubscriptionActive?(n.isTargetPublishing?t.peerClientState===Be.DISCONNECTED?this.changeState({connectionState:yn.UNSTABLE}):t.peerClientState===Be.CONNECTED?this.changeState({connectionState:yn.CONNECTED,subscribeInProgress:!0}):t.peerClientState===Be.FAILED&&this.subscriptionState.subscribeInProgress&&(this.trackSubscribeEnded(!1,pe.CONNECTION_FAIL),this.changeState({subscribeInProgress:!1})):(e.isTargetPublishing&&this.subscriptionState.subscribeInProgress&&(this.logger.debug({msg:"Scheduling an unsubscribe on the event loop"}),this.unsubscribe()),this.throttler.clear(),this.changeState({connectionState:yn.PAUSED})),(!e.isTargetPublishing&&t.isTargetPublishing||t.peerClientState===Be.FAILED)&&this.throttledAttemptSubscribe("onSignalState change: isTargetPublishing is now true"),Object.assign(this.previousSignalState,t)):this.logger.warn({msg:"Unexpected onSignalStateChange when subscription is inactive"})}onAttemptSubscribeFailure(t){if(this.logger.debug({msg:"Changing/keeping state FAILED"}),this.changeState({connectionState:yn.FAILED}),this.failedRetries<=4){const e=1e3*Math.pow(2,this.failedRetries);this.logger.debug({msg:`Retrying in ${e}ms`}),this.failedRetries++,setTimeout((()=>Cn(this,void 0,void 0,(function*(){this.throttledAttemptSubscribe(t)}))),e)}else this.previousSignalState.isTargetPublishing=!1}start(){this.isSubscriptionActive=!0,this.isStarted=!0,this.peerClient.on(Le,this.onPeerClientConnectionStateChange,this),this.stageConnection.on(Ce.STAGE_PARTICIPANT_UPDATED,this.onParticipantUpdated),this.stageConnection.on(Ce.STAGE_PARTICIPANT_JOINED,this.onParticipantJoined),this.stageConnection.on(Ce.STAGE_PARTICIPANT_LEFT,this.onParticipantLeft),this.stageConnection.on(Ce.STAGE_PARTICIPANT_KICKED,this.onParticipantLeft);const t=this.stageConnection.getParticipant(this.id);this.onSignalStateChange({isTargetPublishing:null==t?void 0:t.isPublishing})}throttledAttemptSubscribe(t){return this.throttler.invoke(this.attemptSubscribe,t)}changeState(t){void 0!==t.subscribeInProgress&&(this.subscriptionState.subscribeInProgress=t.subscribeInProgress),t.connectionState&&this.subscriptionState.connectionState!==t.connectionState&&(this.subscriptionState.connectionState=t.connectionState,this.emitter.emit(Te.CONNECTION_STATE_CHANGE,this.subscriptionState.connectionState))}on(t,e){this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}stop(){this.cleanUp(),this.changeState({connectionState:yn.STOPPED})}cleanUp(){this.peerClient&&(this.peerClient.off(Le,this.onPeerClientConnectionStateChange,this),this.unsubscribe()),this.throttler.clear(),this.stageConnection.off(Ce.STAGE_PARTICIPANT_UPDATED,this.onParticipantUpdated),this.stageConnection.off(Ce.STAGE_PARTICIPANT_JOINED,this.onParticipantJoined),this.stageConnection.off(Ce.STAGE_PARTICIPANT_LEFT,this.onParticipantLeft),this.stageConnection.off(Ce.STAGE_PARTICIPANT_KICKED,this.onParticipantLeft),this.isSubscriptionActive=!1,AbortControllersTracker.getInstance().abortPendingOperations()}isActive(){return this.isSubscriptionActive}getSubscriptionConnectionState(){return this.subscriptionState.connectionState}subscribe(t){return Cn(this,void 0,void 0,(function*(){const{token:e,id:n,customSilentAudioTrack:r}=this;this.traceId=f();try{e.assertTokenIsUnexpired(this.traceId,ce(Dt.SUBSCRIBE,n),"subscribe",n),this.trackSubscribeRequested(),r&&e.shouldSendSilentAudio()&&this.peerClient.setCustomSilentAudioTrackForSub(r);const{mediaStream:i}=yield this.peerClient.connect(t,this.traceId);return this.trackSubscribeStarted(),this.isStarted||(this.subscriptionState={connectionState:yn.CONNECTED,subscribeInProgress:!0}),{peerClient:this.peerClient,mediaStream:i}}catch(t){const r=new StageClientError(Object.assign(Object.assign({},he.SUBSCRIBE_FAILURE),{token:e,traceId:this.traceId,tag:ce(Dt.SUBSCRIBE,n),location:"subscribe",remoteParticipantId:n}));throw this.analyticsTracker.trackEventNoSharedProps(new StageErrorEvent(r)),t instanceof StageClientError&&(t.location=`subscribe > ${t.location}`),t}}))}unsubscribe(){return Cn(this,void 0,void 0,(function*(){if(this.subscriptionState.connectionState===yn.STOPPED||this.subscriptionState.connectionState===yn.INIT)return;const{id:t,token:e}=this;this.analyticsTracker.trackEventNoSharedProps(new UnsubscribeEvent({token:e,unsubscribedId:t,traceId:this.traceId})),e.assertTokenIsUnexpired(this.traceId,ce(Dt.SUBSCRIBE,t),"unsubscribe",t);const n=AbortControllersTracker.getInstance().isUnloading,r=n?pe.UNLOAD:pe.UNSUBSCRIBE;try{if(!this.peerClient)throw new Error("Invalid unpublish - no peerClient");n?this.peerClient.disconnect():yield this.peerClient.disconnect(),this.trackSubscribeEnded(!0,r),this.isStarted||(this.subscriptionState={connectionState:yn.STOPPED,subscribeInProgress:!0}),this.changeState({subscribeInProgress:!1})}catch(t){this.trackAndThrowUnsubscribeError(r)}}))}trackAndThrowUnsubscribeError(t){const e=new StageClientError(Object.assign(Object.assign({},he.UNSUBSCRIBE_FAILURE),{token:this.token,traceId:this.traceId,tag:ce(Dt.SUBSCRIBE,this.id),location:"unsubscribe",remoteParticipantId:this.id}));throw this.analyticsTracker.trackError(e),this.trackSubscribeEnded(!1,t),e}trackSubscribeRequested(){this.analyticsTracker.trackEventNoSharedProps(new SubscribeEvent({token:this.token,subscribedId:this.id,traceId:this.traceId}))}trackSubscribeStarted(){const{optionsDuration:t,postDuration:e,timeToCandidate:n,timeToConnected:r}=this.peerClient.getActionMeasurements();this.analyticsTracker.trackEventNoSharedProps(new SubscribeStartedEvent({token:this.token,traceId:this.traceId,remoteParticipantId:this.id,optionsDuration:t,postDuration:e,timeToCandidate:n,totalDuration:r}))}trackSubscribeEnded(t,e){this.analyticsTracker.trackEventNoSharedProps(new SubscribeEndedEvent({token:this.token,traceId:this.traceId,remoteParticipantId:this.id,isUnsubscribeSuccessful:t,reason:e}))}}Sn=new WeakSet,En=function(t){return t.id===this.id};var wn,In,kn,Rn,Pn=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},On=function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)},An=function(t,e,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(t,n):i?i.value=n:e.set(t,n),n};class AmazonIVSBroadcastStageClient{constructor(t,e,n){this.emitter=t,this.config=e,this.nonScopedLogger=n,wn.add(this),this.stageToken=null,this.appTraceId=new TraceId,In.set(this,!1),this.useEdp=!0,this.isValid=!0,this.subscriptions=new Map,this.analyticsTracker=AnalyticsTracker.getInstance(),this.mediaStreamManager=MediaStreamManager.getOrRegisterInstance(this),this.stageConnection=new StageConnection(this.nonScopedLogger),this.propagateStageConnectionEvents(this.stageConnection,t),this.analyticsTracker.start();Object.getOwnPropertyNames(AmazonIVSBroadcastStageClient.prototype).forEach((t=>{"stageToken"!==t&&(this[t]=new Proxy(this[t],{apply:(t,e,n)=>{if(!e.isValid)throw new BroadcastClientError(Object.assign({},Q));return Reflect.apply(t,e,n)}}))})),window.addEventListener("beforeunload",(()=>{var t;const e=AbortControllersTracker.getInstance();e.isUnloading=!0,this.unpublish(null===(t=this.stageToken)||void 0===t?void 0:t.rawToken),this.subscriptions.forEach((t=>{t.stop()})),e.abortPendingOperations(),this.analyticsTracker.stop(!0),this.stageConnection.disconnect()})),_e().interceptors.response.use(void 0,(t=>Pn(this,void 0,void 0,(function*(){var e;return 429===(null===(e=null==t?void 0:t.response)||void 0===e?void 0:e.status)&&(yield new Promise((t=>{setTimeout(t,1e3)}))),Promise.reject(t)}))))}propagateStageConnectionEvents(t,e){t.on(Ce.STAGE_JOINED,(()=>{e.emit(Ce.STAGE_JOINED)})),t.on(Ce.STAGE_PARTICIPANT_JOINED,(t=>{e.emit(Ce.STAGE_PARTICIPANT_JOINED,t)})),t.on(Ce.STAGE_PARTICIPANT_KICKED,(t=>{e.emit(Ce.STAGE_PARTICIPANT_KICKED,t)})),t.on(Ce.STAGE_PARTICIPANT_LEFT,(t=>{e.emit(Ce.STAGE_PARTICIPANT_LEFT,t)})),t.on(Ce.STAGE_PARTICIPANT_UPDATED,(t=>{e.emit(Ce.STAGE_PARTICIPANT_UPDATED,t)})),t.on(Ce.STAGE_REFRESH,(()=>{e.emit(Ce.STAGE_REFRESH)}))}delete(){this.isValid=!1}join(t){return Pn(this,void 0,void 0,(function*(){const e=f();On(this,wn,"m",Rn).call(this,t),this.stageToken=ge(t),this.stageToken.assertTokenIsUnexpired(e,ae.JOIN_RELATED,"join"),this.analyticsTracker.trackEventNoSharedProps(new JoinEvent({token:this.stageToken,eventEndpoint:this.stageToken.eventsURL,whipEndpoint:this.stageToken.whipURL,traceId:e}));try{yield this.stageConnection.connect(this.stageToken,e),An(this,In,!0,"f")}catch(t){const n=new StageClientError(Object.assign(Object.assign({},he.EVENT_PLANE_CONNECTION_FAILURE),{token:this.stageToken,traceId:e,tag:ae.JOIN_RELATED,location:"join"}));throw this.analyticsTracker.trackEventNoSharedProps(new StageErrorEvent(n)),n}}))}leave(){if(On(this,In,"f")){const t=this.stageConnection.disconnect(),e=this.stageToken;this.analyticsTracker.trackEventNoSharedProps(new LeaveEvent({token:e,eventEndpoint:e.eventsURL,whipEndpoint:e.whipURL,traceId:t}))}}publish(t){return Pn(this,void 0,void 0,(function*(){const e=f();let n=this.stageToken;if(t&&(n=ge(t)),On(this,In,"f")||this.stageToken||(this.stageToken=n),!n)throw new Error("A token must be provided either via a preceding join call or as an argument to publish");n.assertTokenIsUnexpired(e,ae.PUBLISH_RELATED,"publish",n.participantID),this.publication=new StagePublication(n,this.nonScopedLogger,this.mediaStreamManager,f());const r=[],i=this.mediaStreamManager.getTrack(ye.VIDEO),o=this.mediaStreamManager.getTrack(ye.AUDIO);i&&r.push({track:i}),o&&r.push({track:o});return{peerConnection:(yield this.publication.publish(r)).getValidPeerConnectionCanThrow()}}))}unpublish(t){return Pn(this,void 0,void 0,(function*(){let e=this.stageToken;if(t&&(e=ge(t)),!e||!this.publication)throw new Error("A token must be provided either via a preceding join call or as an argument to unpublish");yield this.publication.unpublish()}))}createSubscription(t,e,n){const r=ge(e);if(!this.stageConnection)throw new Error("Must invoke join() before creating a subscription");const i=new StageSubscription(t,r,this.stageConnection,this.nonScopedLogger,this.mediaStreamManager,f(),n);return this.subscriptions.set(t,i),i}createOrGetPublication(t){const e=ge(t);if(!this.stageConnection)throw new Error("Must invoke join() before creating a publication");return this.publication||(this.publication=new StagePublication(e,this.nonScopedLogger,this.mediaStreamManager,f())),this.publication}subscribe(t,e,n,r){var i;return Pn(this,void 0,void 0,(function*(){let o=this.stageToken;e&&(o=ge(e));const s=f();if(!o)throw new Error("A token must be provided either via a preceding join call or as an argument to subscribe");const a=null===(i=this.stageConnection)||void 0===i?void 0:i.getParticipant(t);if(On(this,In,"f")&&!a)throw new Error("error TBD: participant not found");const c=new StageSubscription(t,o,this.stageConnection,this.nonScopedLogger,this.mediaStreamManager,s,n);return c.subscribe(r).then((e=>(a&&(a.subscribed=!0,a.joinedAt=Date.now(),a.peerClient=e.peerClient,e.mediaStream&&(a.mediaSrcObject=e.mediaStream)),this.subscriptions.set(t,c),{peerConnection:e.peerClient.getValidPeerConnectionCanThrow()})))}))}unsubscribe(t,e){return Pn(this,void 0,void 0,(function*(){let n=this.stageToken;if(e&&(n=ge(e)),!n)throw new Error("A token must be provided either via a preceding join call or as an argument to unsubscribe");const r=this.subscriptions.get(t);return r||this.analyticsTracker.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},he.UNSUBSCRIBE_FAILURE),{token:n,traceId:f(),tag:ce(Dt.SUBSCRIBE,t),location:"unsubscribe",remoteParticipantId:t}))),r.unsubscribe().then((()=>{var e;const n=null===(e=this.stageConnection)||void 0===e?void 0:e.getParticipant(t);n&&(n.subscribed=!1)}))}))}listConnectedParticipants(){var t;return(null===(t=this.stageConnection)||void 0===t?void 0:t.listConnectedParticipants())||[]}listAvailableParticipants(){var t;return(null===(t=this.stageConnection)||void 0===t?void 0:t.listAvailableParticipants())||[]}_trace(t){be(ge(t.token),this.appTraceId,`app: ${t.message}`,Dt.APP_TRACE,t.remoteParticipantID)}addVideoInputDevice(t,e,n){var r;return Pn(this,void 0,void 0,(function*(){const e=t.getVideoTracks()[0];this.mediaStreamManager.setTrack(ye.VIDEO,e),yield null===(r=this.publication)||void 0===r?void 0:r.replaceOrUpdateTrack({track:e,config:{minBitrateBps:qt(Kt),maxBitrateBps:qt(Jt),maxFramerate:Xt,simulcastEnabled:!1}})}))}addAudioInputDevice(t,e){var n;return Pn(this,void 0,void 0,(function*(){const e=t.getAudioTracks()[0];this.mediaStreamManager.setTrack(ye.AUDIO,e),yield null===(n=this.publication)||void 0===n?void 0:n.replaceOrUpdateTrack({track:e})}))}getConnectionState(){return this.outboundPeerClient.getConnectionState()}on(t,e){this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}disableVideo(){On(this,wn,"m",kn).call(this,void 0,!1)}enableVideo(){On(this,wn,"m",kn).call(this,void 0,!0)}disableAudio(){On(this,wn,"m",kn).call(this,!1,void 0)}enableAudio(){On(this,wn,"m",kn).call(this,!0,void 0)}}In=new WeakMap,wn=new WeakSet,kn=function(t,e){var n,r;if(this.stageConnection&&this.publication){const i=this.publication.getAudioSender(),o=this.publication.getVideoSender();(null==i?void 0:i.track)&&void 0!==t&&(i.track.enabled=t),(null==o?void 0:o.track)&&void 0!==e&&(o.track.enabled=e),this.stageConnection.emitStageState(!1===(null===(n=null==i?void 0:i.track)||void 0===n?void 0:n.enabled)||!1,!1===(null===(r=null==o?void 0:o.track)||void 0===r?void 0:r.enabled)||!1)}},Rn=function(t){if("string"!=typeof t)throw new BroadcastClientError(nt)};let Nn=!0,Dn=!0;function xn(t,e,n){const r=t.match(e);return r&&r.length>=n&&parseInt(r[n],10)}function Mn(t,e,n){if(!t.RTCPeerConnection)return;const r=t.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(t,r){if(t!==e)return i.apply(this,arguments);const o=t=>{const e=n(t);e&&(r.handleEvent?r.handleEvent(e):r(e))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(r,o),i.apply(this,[t,o])};const o=r.removeEventListener;r.removeEventListener=function(t,n){if(t!==e||!this._eventMap||!this._eventMap[e])return o.apply(this,arguments);if(!this._eventMap[e].has(n))return o.apply(this,arguments);const r=this._eventMap[e].get(n);return this._eventMap[e].delete(n),0===this._eventMap[e].size&&delete this._eventMap[e],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[t,r])},Object.defineProperty(r,"on"+e,{get(){return this["_on"+e]},set(t){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),t&&this.addEventListener(e,this["_on"+e]=t)},enumerable:!0,configurable:!0})}function Ln(t){return"boolean"!=typeof t?new Error("Argument type: "+typeof t+". Please use a boolean."):(Nn=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function Un(t){return"boolean"!=typeof t?new Error("Argument type: "+typeof t+". Please use a boolean."):(Dn=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function Bn(){if("object"==typeof window){if(Nn)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function jn(t,e){Dn&&console.warn(t+" is deprecated, please use "+e+" instead.")}function Fn(t){return"[object Object]"===Object.prototype.toString.call(t)}function Vn(t){return Fn(t)?Object.keys(t).reduce((function(e,n){const r=Fn(t[n]),i=r?Vn(t[n]):t[n],o=r&&!Object.keys(i).length;return void 0===i||o?e:Object.assign(e,{[n]:i})}),{}):t}function Gn(t,e,n){e&&!n.has(e.id)&&(n.set(e.id,e),Object.keys(e).forEach((r=>{r.endsWith("Id")?Gn(t,t.get(e[r]),n):r.endsWith("Ids")&&e[r].forEach((e=>{Gn(t,t.get(e),n)}))})))}function Wn(t,e,n){const r=n?"outbound-rtp":"inbound-rtp",i=new Map;if(null===e)return i;const o=[];return t.forEach((t=>{"track"===t.type&&t.trackIdentifier===e.id&&o.push(t)})),o.forEach((e=>{t.forEach((n=>{n.type===r&&n.trackId===e.id&&Gn(t,n,i)}))})),i}const $n=Bn;function Hn(t,e){const n=t&&t.navigator;if(!n.mediaDevices)return;const r=function(t){if("object"!=typeof t||t.mandatory||t.optional)return t;const e={};return Object.keys(t).forEach((n=>{if("require"===n||"advanced"===n||"mediaSource"===n)return;const r="object"==typeof t[n]?t[n]:{ideal:t[n]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);const i=function(t,e){return t?t+e.charAt(0).toUpperCase()+e.slice(1):"deviceId"===e?"sourceId":e};if(void 0!==r.ideal){e.optional=e.optional||[];let t={};"number"==typeof r.ideal?(t[i("min",n)]=r.ideal,e.optional.push(t),t={},t[i("max",n)]=r.ideal,e.optional.push(t)):(t[i("",n)]=r.ideal,e.optional.push(t))}void 0!==r.exact&&"number"!=typeof r.exact?(e.mandatory=e.mandatory||{},e.mandatory[i("",n)]=r.exact):["min","max"].forEach((t=>{void 0!==r[t]&&(e.mandatory=e.mandatory||{},e.mandatory[i(t,n)]=r[t])}))})),t.advanced&&(e.optional=(e.optional||[]).concat(t.advanced)),e},i=function(t,i){if(e.version>=61)return i(t);if((t=JSON.parse(JSON.stringify(t)))&&"object"==typeof t.audio){const e=function(t,e,n){e in t&&!(n in t)&&(t[n]=t[e],delete t[e])};e((t=JSON.parse(JSON.stringify(t))).audio,"autoGainControl","googAutoGainControl"),e(t.audio,"noiseSuppression","googNoiseSuppression"),t.audio=r(t.audio)}if(t&&"object"==typeof t.video){let o=t.video.facingMode;o=o&&("object"==typeof o?o:{ideal:o});const s=e.version<66;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&(!n.mediaDevices.getSupportedConstraints||!n.mediaDevices.getSupportedConstraints().facingMode||s)){let e;if(delete t.video.facingMode,"environment"===o.exact||"environment"===o.ideal?e=["back","rear"]:"user"!==o.exact&&"user"!==o.ideal||(e=["front"]),e)return n.mediaDevices.enumerateDevices().then((n=>{let s=(n=n.filter((t=>"videoinput"===t.kind))).find((t=>e.some((e=>t.label.toLowerCase().includes(e)))));return!s&&n.length&&e.includes("back")&&(s=n[n.length-1]),s&&(t.video.deviceId=o.exact?{exact:s.deviceId}:{ideal:s.deviceId}),t.video=r(t.video),$n("chrome: "+JSON.stringify(t)),i(t)}))}t.video=r(t.video)}return $n("chrome: "+JSON.stringify(t)),i(t)},o=function(t){return e.version>=64?t:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[t.name]||t.name,message:t.message,constraint:t.constraint||t.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(n.getUserMedia=function(t,e,r){i(t,(t=>{n.webkitGetUserMedia(t,e,(t=>{r&&r(o(t))}))}))}.bind(n),n.mediaDevices.getUserMedia){const t=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(e){return i(e,(e=>t(e).then((t=>{if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length)throw t.getTracks().forEach((t=>{t.stop()})),new DOMException("","NotFoundError");return t}),(t=>Promise.reject(o(t))))))}}}function zn(t,e){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&("function"==typeof e?t.navigator.mediaDevices.getDisplayMedia=function(n){return e(n).then((e=>{const r=n.video&&n.video.width,i=n.video&&n.video.height,o=n.video&&n.video.frameRate;return n.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:e,maxFrameRate:o||3}},r&&(n.video.mandatory.maxWidth=r),i&&(n.video.mandatory.maxHeight=i),t.navigator.mediaDevices.getUserMedia(n)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}function qn(t){t.MediaStream=t.MediaStream||t.webkitMediaStream}function Kn(t){if("object"==typeof t&&t.RTCPeerConnection&&!("ontrack"in t.RTCPeerConnection.prototype)){Object.defineProperty(t.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(t){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=t)},enumerable:!0,configurable:!0});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=e=>{e.stream.addEventListener("addtrack",(n=>{let r;r=t.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((t=>t.track&&t.track.id===n.track.id)):{track:n.track};const i=new Event("track");i.track=n.track,i.receiver=r,i.transceiver={receiver:r},i.streams=[e.stream],this.dispatchEvent(i)})),e.stream.getTracks().forEach((n=>{let r;r=t.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((t=>t.track&&t.track.id===n.id)):{track:n};const i=new Event("track");i.track=n,i.receiver=r,i.transceiver={receiver:r},i.streams=[e.stream],this.dispatchEvent(i)}))},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else Mn(t,"track",(t=>(t.transceiver||Object.defineProperty(t,"transceiver",{value:{receiver:t.receiver}}),t)))}function Jn(t){if("object"==typeof t&&t.RTCPeerConnection&&!("getSenders"in t.RTCPeerConnection.prototype)&&"createDTMFSender"in t.RTCPeerConnection.prototype){const e=function(t,e){return{track:e,get dtmf(){return void 0===this._dtmf&&("audio"===e.kind?this._dtmf=t.createDTMFSender(e):this._dtmf=null),this._dtmf},_pc:t}};if(!t.RTCPeerConnection.prototype.getSenders){t.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const n=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(t,r){let i=n.apply(this,arguments);return i||(i=e(this,t),this._senders.push(i)),i};const r=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(t){r.apply(this,arguments);const e=this._senders.indexOf(t);-1!==e&&this._senders.splice(e,1)}}const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(t){this._senders=this._senders||[],n.apply(this,[t]),t.getTracks().forEach((t=>{this._senders.push(e(this,t))}))};const r=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(t){this._senders=this._senders||[],r.apply(this,[t]),t.getTracks().forEach((t=>{const e=this._senders.find((e=>e.track===t));e&&this._senders.splice(this._senders.indexOf(e),1)}))}}else if("object"==typeof t&&t.RTCPeerConnection&&"getSenders"in t.RTCPeerConnection.prototype&&"createDTMFSender"in t.RTCPeerConnection.prototype&&t.RTCRtpSender&&!("dtmf"in t.RTCRtpSender.prototype)){const e=t.RTCPeerConnection.prototype.getSenders;t.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach((t=>t._pc=this)),t},Object.defineProperty(t.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function Xn(t){if(!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){const[t,n,r]=arguments;if(arguments.length>0&&"function"==typeof t)return e.apply(this,arguments);if(0===e.length&&(0===arguments.length||"function"!=typeof t))return e.apply(this,[]);const i=function(t){const e={};return t.result().forEach((t=>{const n={id:t.id,timestamp:t.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[t.type]||t.type};t.names().forEach((e=>{n[e]=t.stat(e)})),e[n.id]=n})),e},o=function(t){return new Map(Object.keys(t).map((e=>[e,t[e]])))};if(arguments.length>=2){const r=function(t){n(o(i(t)))};return e.apply(this,[r,t])}return new Promise(((t,n)=>{e.apply(this,[function(e){t(o(i(e)))},n])})).then(n,r)}}function Yn(t){if(!("object"==typeof t&&t.RTCPeerConnection&&t.RTCRtpSender&&t.RTCRtpReceiver))return;if(!("getStats"in t.RTCRtpSender.prototype)){const e=t.RTCPeerConnection.prototype.getSenders;e&&(t.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach((t=>t._pc=this)),t});const n=t.RTCPeerConnection.prototype.addTrack;n&&(t.RTCPeerConnection.prototype.addTrack=function(){const t=n.apply(this,arguments);return t._pc=this,t}),t.RTCRtpSender.prototype.getStats=function(){const t=this;return this._pc.getStats().then((e=>Wn(e,t.track,!0)))}}if(!("getStats"in t.RTCRtpReceiver.prototype)){const e=t.RTCPeerConnection.prototype.getReceivers;e&&(t.RTCPeerConnection.prototype.getReceivers=function(){const t=e.apply(this,[]);return t.forEach((t=>t._pc=this)),t}),Mn(t,"track",(t=>(t.receiver._pc=t.srcElement,t))),t.RTCRtpReceiver.prototype.getStats=function(){const t=this;return this._pc.getStats().then((e=>Wn(e,t.track,!1)))}}if(!("getStats"in t.RTCRtpSender.prototype)||!("getStats"in t.RTCRtpReceiver.prototype))return;const e=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof t.MediaStreamTrack){const t=arguments[0];let e,n,r;return this.getSenders().forEach((n=>{n.track===t&&(e?r=!0:e=n)})),this.getReceivers().forEach((e=>(e.track===t&&(n?r=!0:n=e),e.track===t))),r||e&&n?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):e?e.getStats():n?n.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}function Qn(t){t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((t=>this._shimmedLocalStreams[t][0]))};const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(t,n){if(!n)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const r=e.apply(this,arguments);return this._shimmedLocalStreams[n.id]?-1===this._shimmedLocalStreams[n.id].indexOf(r)&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(t){this._shimmedLocalStreams=this._shimmedLocalStreams||{},t.getTracks().forEach((t=>{if(this.getSenders().find((e=>e.track===t)))throw new DOMException("Track already exists.","InvalidAccessError")}));const e=this.getSenders();n.apply(this,arguments);const r=this.getSenders().filter((t=>-1===e.indexOf(t)));this._shimmedLocalStreams[t.id]=[t].concat(r)};const r=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(t){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[t.id],r.apply(this,arguments)};const i=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(t){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},t&&Object.keys(this._shimmedLocalStreams).forEach((e=>{const n=this._shimmedLocalStreams[e].indexOf(t);-1!==n&&this._shimmedLocalStreams[e].splice(n,1),1===this._shimmedLocalStreams[e].length&&delete this._shimmedLocalStreams[e]})),i.apply(this,arguments)}}function Zn(t,e){if(!t.RTCPeerConnection)return;if(t.RTCPeerConnection.prototype.addTrack&&e.version>=65)return Qn(t);const n=t.RTCPeerConnection.prototype.getLocalStreams;t.RTCPeerConnection.prototype.getLocalStreams=function(){const t=n.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map((t=>this._reverseStreams[t.id]))};const r=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(e){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},e.getTracks().forEach((t=>{if(this.getSenders().find((e=>e.track===t)))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[e.id]){const n=new t.MediaStream(e.getTracks());this._streams[e.id]=n,this._reverseStreams[n.id]=e,e=n}r.apply(this,[e])};const i=t.RTCPeerConnection.prototype.removeStream;function o(t,e){let n=e.sdp;return Object.keys(t._reverseStreams||[]).forEach((e=>{const r=t._reverseStreams[e],i=t._streams[r.id];n=n.replace(new RegExp(i.id,"g"),r.id)})),new RTCSessionDescription({type:e.type,sdp:n})}t.RTCPeerConnection.prototype.removeStream=function(t){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[t.id]||t]),delete this._reverseStreams[this._streams[t.id]?this._streams[t.id].id:t.id],delete this._streams[t.id]},t.RTCPeerConnection.prototype.addTrack=function(e,n){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const r=[].slice.call(arguments,1);if(1!==r.length||!r[0].getTracks().find((t=>t===e)))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const i=this._streams[n.id];if(i)i.addTrack(e),Promise.resolve().then((()=>{this.dispatchEvent(new Event("negotiationneeded"))}));else{const r=new t.MediaStream([e]);this._streams[n.id]=r,this._reverseStreams[r.id]=n,this.addStream(r)}return this.getSenders().find((t=>t.track===e))},["createOffer","createAnswer"].forEach((function(e){const n=t.RTCPeerConnection.prototype[e],r={[e](){const t=arguments;return arguments.length&&"function"==typeof arguments[0]?n.apply(this,[e=>{const n=o(this,e);t[0].apply(null,[n])},e=>{t[1]&&t[1].apply(null,e)},arguments[2]]):n.apply(this,arguments).then((t=>o(this,t)))}};t.RTCPeerConnection.prototype[e]=r[e]}));const s=t.RTCPeerConnection.prototype.setLocalDescription;t.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(t,e){let n=e.sdp;return Object.keys(t._reverseStreams||[]).forEach((e=>{const r=t._reverseStreams[e],i=t._streams[r.id];n=n.replace(new RegExp(r.id,"g"),i.id)})),new RTCSessionDescription({type:e.type,sdp:n})}(this,arguments[0]),s.apply(this,arguments)):s.apply(this,arguments)};const a=Object.getOwnPropertyDescriptor(t.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(t.RTCPeerConnection.prototype,"localDescription",{get(){const t=a.get.apply(this);return""===t.type?t:o(this,t)}}),t.RTCPeerConnection.prototype.removeTrack=function(t){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!t._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(t._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let e;this._streams=this._streams||{},Object.keys(this._streams).forEach((n=>{this._streams[n].getTracks().find((e=>t.track===e))&&(e=this._streams[n])})),e&&(1===e.getTracks().length?this.removeStream(this._reverseStreams[e.id]):e.removeTrack(t.track),this.dispatchEvent(new Event("negotiationneeded")))}}function tr(t,e){!t.RTCPeerConnection&&t.webkitRTCPeerConnection&&(t.RTCPeerConnection=t.webkitRTCPeerConnection),t.RTCPeerConnection&&e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(e){const n=t.RTCPeerConnection.prototype[e],r={[e](){return arguments[0]=new("addIceCandidate"===e?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};t.RTCPeerConnection.prototype[e]=r[e]}))}function er(t,e){Mn(t,"negotiationneeded",(t=>{const n=t.target;if(!(e.version<72||n.getConfiguration&&"plan-b"===n.getConfiguration().sdpSemantics)||"stable"===n.signalingState)return t}))}function nr(t,e){const n=t&&t.navigator,r=t&&t.MediaStreamTrack;if(n.getUserMedia=function(t,e,r){jn("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(t).then(e,r)},!(e.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){const t=function(t,e,n){e in t&&!(n in t)&&(t[n]=t[e],delete t[e])},e=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(n){return"object"==typeof n&&"object"==typeof n.audio&&(n=JSON.parse(JSON.stringify(n)),t(n.audio,"autoGainControl","mozAutoGainControl"),t(n.audio,"noiseSuppression","mozNoiseSuppression")),e(n)},r&&r.prototype.getSettings){const e=r.prototype.getSettings;r.prototype.getSettings=function(){const n=e.apply(this,arguments);return t(n,"mozAutoGainControl","autoGainControl"),t(n,"mozNoiseSuppression","noiseSuppression"),n}}if(r&&r.prototype.applyConstraints){const e=r.prototype.applyConstraints;r.prototype.applyConstraints=function(n){return"audio"===this.kind&&"object"==typeof n&&(n=JSON.parse(JSON.stringify(n)),t(n,"autoGainControl","mozAutoGainControl"),t(n,"noiseSuppression","mozNoiseSuppression")),e.apply(this,[n])}}}}function rr(t,e){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&(t.navigator.mediaDevices.getDisplayMedia=function(n){if(!n||!n.video){const t=new DOMException("getDisplayMedia without video constraints is undefined");return t.name="NotFoundError",t.code=8,Promise.reject(t)}return!0===n.video?n.video={mediaSource:e}:n.video.mediaSource=e,t.navigator.mediaDevices.getUserMedia(n)})}function ir(t){"object"==typeof t&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function or(t,e){if("object"!=typeof t||!t.RTCPeerConnection&&!t.mozRTCPeerConnection)return;!t.RTCPeerConnection&&t.mozRTCPeerConnection&&(t.RTCPeerConnection=t.mozRTCPeerConnection),e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(e){const n=t.RTCPeerConnection.prototype[e],r={[e](){return arguments[0]=new("addIceCandidate"===e?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};t.RTCPeerConnection.prototype[e]=r[e]}));const n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){const[t,i,o]=arguments;return r.apply(this,[t||null]).then((t=>{if(e.version<53&&!i)try{t.forEach((t=>{t.type=n[t.type]||t.type}))}catch(e){if("TypeError"!==e.name)throw e;t.forEach(((e,r)=>{t.set(r,Object.assign({},e,{type:n[e.type]||e.type}))}))}return t})).then(i,o)}}function sr(t){if("object"!=typeof t||!t.RTCPeerConnection||!t.RTCRtpSender)return;if(t.RTCRtpSender&&"getStats"in t.RTCRtpSender.prototype)return;const e=t.RTCPeerConnection.prototype.getSenders;e&&(t.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach((t=>t._pc=this)),t});const n=t.RTCPeerConnection.prototype.addTrack;n&&(t.RTCPeerConnection.prototype.addTrack=function(){const t=n.apply(this,arguments);return t._pc=this,t}),t.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function ar(t){if("object"!=typeof t||!t.RTCPeerConnection||!t.RTCRtpSender)return;if(t.RTCRtpSender&&"getStats"in t.RTCRtpReceiver.prototype)return;const e=t.RTCPeerConnection.prototype.getReceivers;e&&(t.RTCPeerConnection.prototype.getReceivers=function(){const t=e.apply(this,[]);return t.forEach((t=>t._pc=this)),t}),Mn(t,"track",(t=>(t.receiver._pc=t.srcElement,t))),t.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function cr(t){t.RTCPeerConnection&&!("removeStream"in t.RTCPeerConnection.prototype)&&(t.RTCPeerConnection.prototype.removeStream=function(t){jn("removeStream","removeTrack"),this.getSenders().forEach((e=>{e.track&&t.getTracks().includes(e.track)&&this.removeTrack(e)}))})}function ur(t){t.DataChannel&&!t.RTCDataChannel&&(t.RTCDataChannel=t.DataChannel)}function dr(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype.addTransceiver;e&&(t.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let t=arguments[1]&&arguments[1].sendEncodings;void 0===t&&(t=[]),t=[...t];const n=t.length>0;n&&t.forEach((t=>{if("rid"in t){if(!/^[a-z0-9]{0,16}$/i.test(t.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in t&&!(parseFloat(t.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in t&&!(parseFloat(t.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));const r=e.apply(this,arguments);if(n){const{sender:e}=r,n=e.getParameters();(!("encodings"in n)||1===n.encodings.length&&0===Object.keys(n.encodings[0]).length)&&(n.encodings=t,e.sendEncodings=t,this.setParametersPromises.push(e.setParameters(n).then((()=>{delete e.sendEncodings})).catch((()=>{delete e.sendEncodings}))))}return r})}function lr(t){if("object"!=typeof t||!t.RTCRtpSender)return;const e=t.RTCRtpSender.prototype.getParameters;e&&(t.RTCRtpSender.prototype.getParameters=function(){const t=e.apply(this,arguments);return"encodings"in t||(t.encodings=[].concat(this.sendEncodings||[{}])),t})}function hr(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>e.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):e.apply(this,arguments)}}function pr(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype.createAnswer;t.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>e.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):e.apply(this,arguments)}}function fr(t){if("object"==typeof t&&t.RTCPeerConnection){if("getLocalStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in t.RTCPeerConnection.prototype)){const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addStream=function(t){this._localStreams||(this._localStreams=[]),this._localStreams.includes(t)||this._localStreams.push(t),t.getAudioTracks().forEach((n=>e.call(this,n,t))),t.getVideoTracks().forEach((n=>e.call(this,n,t)))},t.RTCPeerConnection.prototype.addTrack=function(t,...n){return n&&n.forEach((t=>{this._localStreams?this._localStreams.includes(t)||this._localStreams.push(t):this._localStreams=[t]})),e.apply(this,arguments)}}"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(t){this._localStreams||(this._localStreams=[]);const e=this._localStreams.indexOf(t);if(-1===e)return;this._localStreams.splice(e,1);const n=t.getTracks();this.getSenders().forEach((t=>{n.includes(t.track)&&this.removeTrack(t)}))})}}function gr(t){if("object"==typeof t&&t.RTCPeerConnection&&("getRemoteStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in t.RTCPeerConnection.prototype))){Object.defineProperty(t.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(t){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=t),this.addEventListener("track",this._onaddstreampoly=t=>{t.streams.forEach((t=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(t))return;this._remoteStreams.push(t);const e=new Event("addstream");e.stream=t,this.dispatchEvent(e)}))})}});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){const t=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach((e=>{if(t._remoteStreams||(t._remoteStreams=[]),t._remoteStreams.indexOf(e)>=0)return;t._remoteStreams.push(e);const n=new Event("addstream");n.stream=e,t.dispatchEvent(n)}))}),e.apply(t,arguments)}}}function vr(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype,n=e.createOffer,r=e.createAnswer,i=e.setLocalDescription,o=e.setRemoteDescription,s=e.addIceCandidate;e.createOffer=function(t,e){const r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return e?(i.then(t,e),Promise.resolve()):i},e.createAnswer=function(t,e){const n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return e?(i.then(t,e),Promise.resolve()):i};let a=function(t,e,n){const r=i.apply(this,[t]);return n?(r.then(e,n),Promise.resolve()):r};e.setLocalDescription=a,a=function(t,e,n){const r=o.apply(this,[t]);return n?(r.then(e,n),Promise.resolve()):r},e.setRemoteDescription=a,a=function(t,e,n){const r=s.apply(this,[t]);return n?(r.then(e,n),Promise.resolve()):r},e.addIceCandidate=a}function mr(t){const e=t&&t.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){const t=e.mediaDevices,n=t.getUserMedia.bind(t);e.mediaDevices.getUserMedia=t=>n(_r(t))}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=function(t,n,r){e.mediaDevices.getUserMedia(t).then(n,r)}.bind(e))}function _r(t){return t&&void 0!==t.video?Object.assign({},t,{video:Vn(t.video)}):t}function Sr(t){if(!t.RTCPeerConnection)return;const e=t.RTCPeerConnection;t.RTCPeerConnection=function(t,n){if(t&&t.iceServers){const e=[];for(let n=0;n<t.iceServers.length;n++){let r=t.iceServers[n];!r.hasOwnProperty("urls")&&r.hasOwnProperty("url")?(jn("RTCIceServer.url","RTCIceServer.urls"),r=JSON.parse(JSON.stringify(r)),r.urls=r.url,delete r.url,e.push(r)):e.push(t.iceServers[n])}t.iceServers=e}return new e(t,n)},t.RTCPeerConnection.prototype=e.prototype,"generateCertificate"in e&&Object.defineProperty(t.RTCPeerConnection,"generateCertificate",{get:()=>e.generateCertificate})}function Er(t){"object"==typeof t&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function yr(t){const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(t){if(t){void 0!==t.offerToReceiveAudio&&(t.offerToReceiveAudio=!!t.offerToReceiveAudio);const e=this.getTransceivers().find((t=>"audio"===t.receiver.track.kind));!1===t.offerToReceiveAudio&&e?"sendrecv"===e.direction?e.setDirection?e.setDirection("sendonly"):e.direction="sendonly":"recvonly"===e.direction&&(e.setDirection?e.setDirection("inactive"):e.direction="inactive"):!0!==t.offerToReceiveAudio||e||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==t.offerToReceiveVideo&&(t.offerToReceiveVideo=!!t.offerToReceiveVideo);const n=this.getTransceivers().find((t=>"video"===t.receiver.track.kind));!1===t.offerToReceiveVideo&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0!==t.offerToReceiveVideo||n||this.addTransceiver("video",{direction:"recvonly"})}return e.apply(this,arguments)}}function br(t){"object"!=typeof t||t.AudioContext||(t.AudioContext=t.webkitAudioContext)}var Cr=n(7539),Tr=n.n(Cr);function wr(t){if(!t.RTCIceCandidate||t.RTCIceCandidate&&"foundation"in t.RTCIceCandidate.prototype)return;const e=t.RTCIceCandidate;t.RTCIceCandidate=function(t){if("object"==typeof t&&t.candidate&&0===t.candidate.indexOf("a=")&&((t=JSON.parse(JSON.stringify(t))).candidate=t.candidate.substr(2)),t.candidate&&t.candidate.length){const n=new e(t),r=Tr().parseCandidate(t.candidate),i=Object.assign(n,r);return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new e(t)},t.RTCIceCandidate.prototype=e.prototype,Mn(t,"icecandidate",(e=>(e.candidate&&Object.defineProperty(e,"candidate",{value:new t.RTCIceCandidate(e.candidate),writable:"false"}),e)))}function Ir(t){!t.RTCIceCandidate||t.RTCIceCandidate&&"relayProtocol"in t.RTCIceCandidate.prototype||Mn(t,"icecandidate",(t=>{if(t.candidate){const e=Tr().parseCandidate(t.candidate.candidate);"relay"===e.type&&(t.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[e.priority>>24])}return t}))}function kr(t,e){if(!t.RTCPeerConnection)return;"sctp"in t.RTCPeerConnection.prototype||Object.defineProperty(t.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const n=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===e.browser&&e.version>=76){const{sdpSemantics:t}=this.getConfiguration();"plan-b"===t&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(function(t){if(!t||!t.sdp)return!1;const e=Tr().splitSections(t.sdp);return e.shift(),e.some((t=>{const e=Tr().parseMLine(t);return e&&"application"===e.kind&&-1!==e.protocol.indexOf("SCTP")}))}(arguments[0])){const t=function(t){const e=t.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===e||e.length<2)return-1;const n=parseInt(e[1],10);return n!=n?-1:n}(arguments[0]),n=function(t){let n=65536;return"firefox"===e.browser&&(n=e.version<57?-1===t?16384:2147483637:e.version<60?57===e.version?65535:65536:2147483637),n}(t),r=function(t,n){let r=65536;"firefox"===e.browser&&57===e.version&&(r=65535);const i=Tr().matchPrefix(t.sdp,"a=max-message-size:");return i.length>0?r=parseInt(i[0].substr(19),10):"firefox"===e.browser&&-1!==n&&(r=2147483637),r}(arguments[0],t);let i;i=0===n&&0===r?Number.POSITIVE_INFINITY:0===n||0===r?Math.max(n,r):Math.min(n,r);const o={};Object.defineProperty(o,"maxMessageSize",{get:()=>i}),this._sctp=o}return n.apply(this,arguments)}}function Rr(t){if(!t.RTCPeerConnection||!("createDataChannel"in t.RTCPeerConnection.prototype))return;function e(t,e){const n=t.send;t.send=function(){const r=arguments[0],i=r.length||r.size||r.byteLength;if("open"===t.readyState&&e.sctp&&i>e.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+e.sctp.maxMessageSize+" bytes)");return n.apply(t,arguments)}}const n=t.RTCPeerConnection.prototype.createDataChannel;t.RTCPeerConnection.prototype.createDataChannel=function(){const t=n.apply(this,arguments);return e(t,this),t},Mn(t,"datachannel",(t=>(e(t.channel,t.target),t)))}function Pr(t){if(!t.RTCPeerConnection||"connectionState"in t.RTCPeerConnection.prototype)return;const e=t.RTCPeerConnection.prototype;Object.defineProperty(e,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(e,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(t){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),t&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=t)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((t=>{const n=e[t];e[t]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=t=>{const e=t.target;if(e._lastConnectionState!==e.connectionState){e._lastConnectionState=e.connectionState;const n=new Event("connectionstatechange",t);e.dispatchEvent(n)}return t},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}}))}function Or(t,e){if(!t.RTCPeerConnection)return;if("chrome"===e.browser&&e.version>=71)return;if("safari"===e.browser&&e.version>=605)return;const n=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(e){if(e&&e.sdp&&-1!==e.sdp.indexOf("\na=extmap-allow-mixed")){const n=e.sdp.split("\n").filter((t=>"a=extmap-allow-mixed"!==t.trim())).join("\n");t.RTCSessionDescription&&e instanceof t.RTCSessionDescription?arguments[0]=new t.RTCSessionDescription({type:e.type,sdp:n}):e.sdp=n}return n.apply(this,arguments)}}function Ar(t,e){if(!t.RTCPeerConnection||!t.RTCPeerConnection.prototype)return;const n=t.RTCPeerConnection.prototype.addIceCandidate;n&&0!==n.length&&(t.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===e.browser&&e.version<78||"firefox"===e.browser&&e.version<68||"safari"===e.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function Nr(t,e){if(!t.RTCPeerConnection||!t.RTCPeerConnection.prototype)return;const n=t.RTCPeerConnection.prototype.setLocalDescription;n&&0!==n.length&&(t.RTCPeerConnection.prototype.setLocalDescription=function(){let t=arguments[0]||{};if("object"!=typeof t||t.type&&t.sdp)return n.apply(this,arguments);if(t={type:t.type,sdp:t.sdp},!t.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":t.type="offer";break;default:t.type="answer"}if(t.sdp||"offer"!==t.type&&"answer"!==t.type)return n.apply(this,[t]);return("offer"===t.type?this.createOffer:this.createAnswer).apply(this).then((t=>n.apply(this,[t])))})}!function({window:t}={},n={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const r=Bn,a=function(t){const e={browser:null,version:null};if(void 0===t||!t.navigator)return e.browser="Not a browser.",e;const{navigator:n}=t;if(n.mozGetUserMedia)e.browser="firefox",e.version=xn(n.userAgent,/Firefox\/(\d+)\./,1);else if(n.webkitGetUserMedia||!1===t.isSecureContext&&t.webkitRTCPeerConnection)e.browser="chrome",e.version=xn(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!t.RTCPeerConnection||!n.userAgent.match(/AppleWebKit\/(\d+)\./))return e.browser="Not a supported browser.",e;e.browser="safari",e.version=xn(n.userAgent,/AppleWebKit\/(\d+)\./,1),e.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype}return e}(t),c={browserDetails:a,commonShim:s,extractVersion:xn,disableLog:Ln,disableWarnings:Un,sdp:Cr};switch(a.browser){case"chrome":if(!e||!tr||!n.shimChrome)return r("Chrome shim is not included in this adapter release."),c;if(null===a.version)return r("Chrome shim can not determine version, not shimming."),c;r("adapter.js shimming chrome."),c.browserShim=e,Ar(t,a),Nr(t),Hn(t,a),qn(t),tr(t,a),Kn(t),Zn(t,a),Jn(t),Xn(t),Yn(t),er(t,a),wr(t),Ir(t),Pr(t),kr(t,a),Rr(t),Or(t,a);break;case"firefox":if(!i||!or||!n.shimFirefox)return r("Firefox shim is not included in this adapter release."),c;r("adapter.js shimming firefox."),c.browserShim=i,Ar(t,a),Nr(t),nr(t,a),or(t,a),ir(t),cr(t),sr(t),ar(t),ur(t),dr(t),lr(t),hr(t),pr(t),wr(t),Pr(t),kr(t,a),Rr(t);break;case"safari":if(!o||!n.shimSafari)return r("Safari shim is not included in this adapter release."),c;r("adapter.js shimming safari."),c.browserShim=o,Ar(t,a),Nr(t),Sr(t),yr(t),vr(t),fr(t),gr(t),Er(t),mr(t),br(t),wr(t),Ir(t),kr(t,a),Rr(t),Or(t,a);break;default:r("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});const Dr=()=>"function"==typeof RTCPeerConnection;class Samples{constructor(){this.min=0,this.max=0,this.sum=0,this.data=[]}push(t){(0===this.min||t<this.min)&&(this.min=t),t>=this.max&&(this.max=t),this.data.push(t),this.sum+=t}median(){this.data.sort();const t=this.data.length>>1;return this.data.length%2==0?this.data[t-1]+this.data[t]>>1:this.data[t]}percentile(t){if(0===this.data.length)return 0;if(t<=0)return this.data[0];if(t>=1)return this.data[this.data.length-1];const e=(this.data.length-1)*t,n=Math.floor(e),r=n+1,i=e%1;return r>=this.data.length?this.data[n]:this.data[n]*(1-i)+this.data[r]*i}}var xr=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};class PeerStatsTracker{constructor(t,e,n){this.peerClient=t,this.broadcastCanvasManager=e,this.logger=new ScopedLogger(n,w.EMITTER),this.previousBytesSent=0,this.startTimestamp=0,this.analyticsTracker=AnalyticsTracker.getInstance(),this.initializeSamples()}start(){this.logger.info({msg:"start emitter"}),this.collectSamplesTimerId=window.setInterval((()=>{this.collectSamples()}),1e3),this.trackSamplesTimerId=window.setInterval((()=>{this.trackSamples()}),3e4),this.trackPeerConnectionStatsTimerId=window.setInterval((()=>{this.trackPeerConnectionStats()}),6e4),this.trackSamples()}stop(){clearInterval(this.collectSamplesTimerId),clearInterval(this.trackSamplesTimerId),clearInterval(this.trackPeerConnectionStatsTimerId),this.collectSamplesTimerId=void 0,this.trackSamplesTimerId=void 0,this.trackPeerConnectionStatsTimerId=void 0}trackPeerConnectionStats(){return xr(this,void 0,void 0,(function*(){(yield this.peerClient.getReports()).forEach((t=>{if("outbound-rtp"===t.type)switch(t.kind){case"audio":this.analyticsTracker.trackEvent(new WebRTCAudioStatsEvent(t));break;case"video":{const e=new WebRTCVideoStatsEvent(t),n=new MinuteBroadcastEvent(t,this.startTimestamp);this.analyticsTracker.batchEvents([e,n]);break}default:this.logger.warn({msg:"unknown report kind: ",reportKind:t.kind})}}))}))}collectSamples(){return xr(this,void 0,void 0,(function*(){let t=0;this.audioLatencySamples.push(this.broadcastCanvasManager.getAudioLatency()),this.videoLatencySamples.push(this.broadcastCanvasManager.getVideoLatency());(yield this.peerClient.getReports()).forEach((e=>{switch(e.type){case"candidate-pair":e.nominated&&(this.rttSamples.push(e.currentRoundTripTime),this.recommendedBitrateSamples.push(e.availableOutgoingBitrate));break;case"outbound-rtp":t+=e.bytesSent||0,0===this.startTimestamp&&"video"===e.kind&&(this.startTimestamp=e.timestamp)}}));const e=8*Math.round(t-this.previousBytesSent);this.previousBytesSent=t,this.measuredBitrateSamples.push(e)}))}trackSamples(){const t=30,e=new SourceAudioLatencyEvent(this.audioLatencySamples,t),n=new SourceVideoLatencyEvent(this.videoLatencySamples,t),r=new CongestionTimeEvent(this.congestionTimeSamples,t),i=new MeasuredBitrateEvent(this.measuredBitrateSamples,t),o=new RecommendedBitrateEvent(this.recommendedBitrateSamples,t),s=new ConnectionRTTEvent(this.rttSamples,t);this.analyticsTracker.batchEvents([e,n,r,i,o,s]),this.initializeSamples()}initializeSamples(){this.audioLatencySamples=new Samples,this.videoLatencySamples=new Samples,this.congestionTimeSamples=new Samples,this.measuredBitrateSamples=new Samples,this.recommendedBitrateSamples=new Samples,this.rttSamples=new Samples}}var Mr,Lr=n(2492);!function(t){t.CONFIG="config",t.UPDATE="update",t.START="start",t.STOP="stop"}(Mr||(Mr={}));var Ur=n(477),Br=n.n(Ur);function jr(){return Br()('/*! For license information please see scheduler.worker.worker.js.LICENSE.txt */\n(()=>{"use strict";var t;!function(t){t.CONFIG="config",t.UPDATE="update",t.START="start",t.STOP="stop"}(t||(t={}));const i=self;const s=new class Scheduler{constructor(){this.config={frameRate:60,isRunning:!1}}setConfig(t){this.config=Object.assign(Object.assign({},this.config),t),this.config.isRunning&&(this.stop(),this.start())}start(){this.config.isRunning||(this.intervalId=setInterval((()=>{i.postMessage({type:t.UPDATE})}),1e3/this.config.frameRate),this.config.isRunning=!0)}stop(){this.config.isRunning&&(clearInterval(this.intervalId),this.intervalId=void 0,this.config.isRunning=!1)}};i.addEventListener("message",(function(i){var n;if(null===(n=null==i?void 0:i.data)||void 0===n?void 0:n.type)switch(i.data.type){case t.CONFIG:s.setConfig(i.data.payload||{});break;case t.START:s.start();break;case t.STOP:s.stop()}}))})();',"Worker",void 0,void 0)}var Fr=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};class BroadcastCanvasManager{constructor(t,e){this.config=t,this.mediaStreamManager=e,this.handleWorkerEvent=t=>{var e;if((null===(e=t.data)||void 0===e?void 0:e.type)===Mr.UPDATE)this.drawComposite()},this.mixer={video:[],audio:[]},this.analyticsTracker=AnalyticsTracker.getInstance(),this.schedulerWorker=new jr,this.running=!1,this.compositeEl=document.createElement("canvas"),this.compositeEl.height=this.config.streamConfig.maxResolution.height,this.compositeEl.width=this.config.streamConfig.maxResolution.width;const n=this.compositeEl.getContext("2d");if(null===n)throw new BroadcastClientError(Object.assign({},I));this.compositeContext=n,this.compositeStream=this.compositeEl.captureStream(void 0!==typeof CanvasCaptureMediaStreamTrack?0:30);const r=Ee(this.compositeStream.getTracks(),ye.VIDEO);this.audioContext=new AudioContext,this.unlockAudioContext(),this.audioDestination=this.audioContext.createMediaStreamDestination(),this.setupSilence();const i=Ee(this.audioDestination.stream.getTracks(),ye.AUDIO);r&&this.mediaStreamManager.setTrack(ye.VIDEO,r),i&&this.mediaStreamManager.setTrack(ye.AUDIO,i),this.schedulerWorker.addEventListener("message",this.handleWorkerEvent),this.schedulerWorker.postMessage({type:Mr.CONFIG,payload:{frameRate:this.config.streamConfig.maxFramerate}}),this.previewElement=null,this.previewCtx=null,this.nextMix=(new Date).getTime()}attachPreview(t){this.previewElement=t;const{width:e,height:n}=this.config.streamConfig.maxResolution;this.previewElement.width=e,this.previewElement.height=n,this.previewCtx=this.previewElement.getContext("2d")}detachPreview(){this.previewElement=null,this.previewCtx=null}setupSilence(){const t=this.audioContext.createConstantSource(),e=this.audioContext.createGain();e.gain.value=.001,t.connect(e),e.connect(this.audioDestination),t.start()}unlockAudioContext(){if("suspended"!==this.audioContext.state)return;const t=document.body,e=["touchstart","touchend","mousedown","keydown"],n=()=>{e.forEach((e=>{t.removeEventListener(e,r)}))},r=()=>{this.audioContext.resume().then(n)};e.forEach((e=>{t.addEventListener(e,r,!1)}))}getTracks(){return[this.mediaStreamManager.getTrack(ye.VIDEO),this.mediaStreamManager.getTrack(ye.AUDIO)]}getCanvasVideoTrack(){return this.mediaStreamManager.getTrack(ye.VIDEO)}getAudioInputDevice(t){if("string"!=typeof t)return;const e=this.mixer.audio.find((e=>{if(e.name===t)return e.source}));return null==e?void 0:e.source}getVideoInputDevice(t){if("string"==typeof t)return this.mixer.video.find((e=>e.name===t))}getCanvasDimensions(){return{height:this.compositeEl.height,width:this.compositeEl.width}}addVideoInputDevice(t,e,n){var r;return Fr(this,void 0,void 0,(function*(){if("object"!=typeof t)throw new BroadcastClientError(Object.assign({},P));if(!e||"string"!=typeof e)throw new BroadcastClientError(Object.assign({},D));if(this.mixer.video.some((t=>t.name===e)))throw new BroadcastClientError(Object.assign({},O));if(!n)throw new BroadcastClientError(Object.assign({},A));if("number"!=typeof n.index)throw new BroadcastClientError(Object.assign({},N));const i=function(){const t=document.createElement("video");return t.autoplay=!0,t.muted=!0,t.setAttribute("playsinline",""),t.setAttribute("webkit-playsinline",""),t}(),o=t.getVideoTracks(),[s]=o;if(!o.length)throw new BroadcastClientError(Object.assign({},k));const a=s.getConstraints(),c=Lr({},a,{frameRate:this.config.streamConfig.maxFramerate});try{yield s.applyConstraints(c)}catch(t){let e="Unknown constraints error";t instanceof Error&&(e=t.message),this.analyticsTracker.trackEvent(new ErrorEvent({description:`${M.message}: ${e}`,isFatal:!1,code:M.code}))}const u=()=>Fr(this,void 0,void 0,(function*(){let t=0;for(;t<5;)try{return void(yield i.play())}catch(e){if(!(e instanceof Error))throw new Error("unknown error trying to add video to broadcast");t++,yield new Promise((t=>setTimeout(t,150)))}throw new Error("Error playing video, tries exceeded")})),d=new MediaStream([s]);i.srcObject=d;try{yield u();const t={name:e,element:i,position:n,source:d,render:!0},o=(null===(r=s.getSettings)||void 0===r?void 0:r.call(s))||{};this.analyticsTracker.trackEvent(new InputDeviceAttachedEvent(Se(o),o)),this.mixer.video.push(t)}catch(t){throw new BroadcastClientError(Object.assign(Object.assign({},k),{cause:t}))}}))}addImageSource(t,e,n){var r;return Fr(this,void 0,void 0,(function*(){if(!t)throw new BroadcastClientError(Object.assign({},P));if(!e||"string"!=typeof e)throw new BroadcastClientError(Object.assign({},D));if("image"===t.tagName)throw new BroadcastClientError(Object.assign({},x));if(this.mixer.video.some((t=>t.name===e)))throw new BroadcastClientError(Object.assign({},O));if(!n)throw new BroadcastClientError(Object.assign({},A));if("number"!=typeof n.index)throw new BroadcastClientError(Object.assign({},N));if(t instanceof Image){const e=null===(r=t.src)||void 0===r?void 0:r.slice();try{const e=t.src?new URL(t.src):{};if(e.host&&e.hostname){const e=yield fetch(t.src).then((t=>Fr(this,void 0,void 0,(function*(){return t.blob()})))),n=yield new Promise((t=>{const n=new FileReader;n.onload=()=>{t(n.result)},n.readAsDataURL(e)}));t.src=n}}catch(t){throw new BroadcastClientError(Object.assign(Object.assign({},G),{params:{details:`Image URL: ${e}`}}))}}const i={name:e,element:t,position:n,render:!0};this.mixer.video.push(i)}))}addAudioInputDevice(t,e){return Fr(this,void 0,void 0,(function*(){if("object"!=typeof t)throw new BroadcastClientError(Object.assign({},P));if(!e||"string"!=typeof e)throw new BroadcastClientError(Object.assign({},D));if(this.mixer.audio.some((t=>t.name===e)))throw new BroadcastClientError(Object.assign({},O));const n=t.getAudioTracks();if(!n.length)throw new BroadcastClientError(Object.assign({},R));const r=this.audioContext.createMediaStreamSource(new MediaStream(n)),i=this.audioContext.createGain();i.gain.value=1,r.connect(i),i.connect(this.audioDestination);const o={name:e,source:t,audioTrackSource:r,gainNode:i};this.analyticsTracker.trackEvent(new InputDeviceAttachedEvent("audio",{deviceId:t.id})),this.mixer.audio.push(o)}))}removeImage(t){const e=this.mixer.video.findIndex((e=>e.name===t));if(e<0)throw new BroadcastClientError(Object.assign({},U));this.mixer.video.splice(e,1)}removeVideoInputDevice(t){var e;const n=this.removeDevice(t,this.mixer.video);if(!n)throw new BroadcastClientError(Object.assign({},L));{const t=Ee(n.source.getTracks(),ye.VIDEO);if(!t)throw new BroadcastClientError(Object.assign({},L));n.element.srcObject=null,t.stop();const r=(null===(e=null==t?void 0:t.getSettings)||void 0===e?void 0:e.call(t))||{};this.analyticsTracker.trackEvent(new InputDeviceDetachedEvent(Se(r),r))}}removeAudioInputDevice(t){const e=this.removeDevice(t,this.mixer.audio);if(null==e?void 0:e.audioTrackSource){for(const t of e.source.getTracks())t.stop(),this.analyticsTracker.trackEvent(new InputDeviceDetachedEvent("audio",{deviceId:t.id}));e.gainNode.disconnect(this.audioDestination)}else if(!e)throw new BroadcastClientError(Object.assign({},L))}updateVideoDeviceComposition(t,e){if(!t||"string"!=typeof t)throw new BroadcastClientError(Object.assign({},F));if(!e)throw new BroadcastClientError(Object.assign({},B));if("number"!=typeof e.index)throw new BroadcastClientError(Object.assign({},j));this.mixer.video.forEach(((n,r)=>{n.name===t&&(n.position=e)}))}exchangeVideoDevicePositions(t,e){const n=this.getVideoInputDevice(t),r=this.getVideoInputDevice(e);if(!n)throw new BroadcastClientError(Object.assign(Object.assign({},V),{params:{details:`device with name: "${t}" not found`}}));if(!r)throw new BroadcastClientError(Object.assign(Object.assign({},V),{params:{details:`device with name: "${e}" not found`}}));const i=Object.assign({},n.position),o=Object.assign({},r.position);for(const n of this.mixer.video)n.name===t&&(Vr(o.x)?n.position=Object.assign(Object.assign({},n.position),o):n.position={index:o.index}),n.name===e&&(Vr(i.x)?n.position=Object.assign(Object.assign({},n.position),i):n.position={index:i.index})}start(){this.running||(this.running=!0,this.schedulerWorker.postMessage({type:Mr.CONFIG,payload:{frameRate:this.config.streamConfig.maxFramerate}}),this.schedulerWorker.postMessage({type:Mr.START}))}stop(){this.running&&(this.running=!1,this.schedulerWorker.removeEventListener("message",this.handleWorkerEvent))}isCapturing(){return this.running}getAudioLatency(){return this.audioContext.baseLatency}getVideoLatency(){var t;return(null===(t=this.mediaStreamManager.getTrack(ye.VIDEO))||void 0===t?void 0:t.getConstraints().latency)||0}disableVideo(){this.mixer.video.forEach((t=>{t.render=!1}))}enableVideo(){this.mixer.video.forEach((t=>{t.render=!0}))}disableAudio(){this.mixer.audio.forEach((t=>{t.audioTrackSource&&(t.gainNode.gain.value=0)}))}enableAudio(){this.mixer.audio.forEach((t=>{t.audioTrackSource&&(t.gainNode.gain.value=1)}))}getDrawRegion(t,e,n){var r,i,o,s;let a=null!==(r=t.position.x)&&void 0!==r?r:0,c=null!==(i=t.position.y)&&void 0!==i?i:0;const u=null!==(o=t.position.width)&&void 0!==o?o:e-a,d=null!==(s=t.position.height)&&void 0!==s?s:n-c,l=u/d;let h=t.element.width,p=t.element.height;t.element instanceof HTMLVideoElement&&(h=t.element.videoWidth,p=t.element.videoHeight);const f=h/p;let g=u,v=d;return f>l?(g=u,v=2*Math.round(u/f/2),c+=(d-v)/2):f<l&&(v=d,g=2*Math.round(d*f/2),a+=(u-g)/2),{x:a,y:c,width:g,height:v}}drawComposite(){if(!this.shouldMix(new Date))return;this.compositeContext.clearRect(0,0,this.compositeEl.width,this.compositeEl.height),this.drawBlackScreen();const t=this.mixer.video.filter((t=>t.render));t.sort(((t,e)=>t.position.index-e.position.index));for(const e of t){const{x:t,y:n,width:r,height:i}=this.getDrawRegion(e,this.compositeEl.width,this.compositeEl.height);this.compositeContext.drawImage(e.element,t,n,r,i)}this.previewElement&&this.previewCtx&&this.previewCtx.drawImage(this.compositeEl,0,0,this.previewElement.width,this.previewElement.height),this.requestCanvasCapture()}requestCanvasCapture(){if(void 0!==typeof CanvasCaptureMediaStreamTrack)if("function"==typeof this.compositeStream.requestFrame){this.compositeStream.requestFrame()}else{this.mediaStreamManager.getTrack(ye.VIDEO).requestFrame()}}drawBlackScreen(){this.compositeContext.fillStyle="#000000",this.compositeContext.fillRect(0,0,this.compositeEl.width,this.compositeEl.height)}removeDevice(t,e){const n=e.findIndex((e=>(e=>e.name===t)(e)));if(!(n<0))return e.splice(n,1)[0]}shouldMix(t){if(t.getTime()<this.nextMix)return!1;for(;this.nextMix<=t.getTime();)this.nextMix+=1e3/this.config.streamConfig.maxFramerate;return!0}}function Vr(t){return Number.isSafeInteger(t)}var Gr,Wr,$r=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},Hr=function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)};class AmazonIVSBroadcastClient{constructor(t){this.config=t,Gr.add(this),this.emitter=new u,this.isValid=!0,this.emitter.on(Me.ERROR,this.stopBroadcast),this.config.ingestEndpoint&&(this.url=new URL(this.config.ingestEndpoint)),this.analyticsTracker=AnalyticsTracker.getInstance(),this.mediaStreamManager=MediaStreamManager.getOrRegisterInstance(this);const e=new Logger(t.logLevel,t.logger);this.peerClient=new PeerClient(this.config,this.emitter,this.mediaStreamManager,e),this.broadcastCanvasManager=new BroadcastCanvasManager(t,this.mediaStreamManager),this.peerStatsTracker=new PeerStatsTracker(this.peerClient,this.broadcastCanvasManager,e),this.broadcastCanvasManager.start();Object.getOwnPropertyNames(AmazonIVSBroadcastClient.prototype).forEach((t=>{this[t]=new Proxy(this[t],{apply:(t,e,n)=>{if(!e.isValid)throw new BroadcastClientError(Object.assign({},Q));return Reflect.apply(t,e,n)}})})),window.addEventListener("beforeunload",(()=>{this.analyticsTracker.stop(!0)}))}delete(){this.isValid=!1,this.peerClient.stop(),this.broadcastCanvasManager.stop(),this.emitter.removeAllListeners()}startBroadcast(t,e){return $r(this,void 0,void 0,(function*(){Hr(this,Gr,"m",Wr).call(this,t);const n=It(e||this.config.ingestEndpoint);this.analyticsTracker.start(),this.peerStatsTracker.start(),yield this.peerClient.start(n,t),this.emitter.emit(Me.ACTIVE_STATE_CHANGE,!0),this.url=new URL(n),this.url&&this.analyticsTracker.trackEvent(new StartBroadcastEvent({protocol:"webrtc",hostname:this.url.hostname,port:this.url.port},Fe.USER_INITIATED))}))}stopBroadcast(){var t,e,n;this.url&&this.analyticsTracker.trackEvent(new StopBroadcastEvent({protocol:"webrtc",hostname:this.url.hostname,port:this.url.port})),null===(t=this.peerStatsTracker)||void 0===t||t.stop(),null===(e=this.peerClient)||void 0===e||e.stop(),null===(n=this.emitter)||void 0===n||n.emit(Me.ACTIVE_STATE_CHANGE,!1)}getCanvasDimensions(){return this.broadcastCanvasManager.getCanvasDimensions()}addVideoInputDevice(t,e,n){return $r(this,void 0,void 0,(function*(){return this.broadcastCanvasManager.addVideoInputDevice(t,e,n)}))}addImageSource(t,e,n){return $r(this,void 0,void 0,(function*(){return this.broadcastCanvasManager.addImageSource(t,e,n)}))}addAudioInputDevice(t,e){return $r(this,void 0,void 0,(function*(){return this.broadcastCanvasManager.addAudioInputDevice(t,e)}))}removeVideoInputDevice(t){this.broadcastCanvasManager.removeVideoInputDevice(t)}removeAudioInputDevice(t){this.broadcastCanvasManager.removeAudioInputDevice(t)}removeImage(t){this.broadcastCanvasManager.removeImage(t)}updateVideoDeviceComposition(t,e){this.broadcastCanvasManager.updateVideoDeviceComposition(t,e)}exchangeVideoDevicePositions(t,e){this.broadcastCanvasManager.exchangeVideoDevicePositions(t,e)}getAudioInputDevice(t){return this.broadcastCanvasManager.getAudioInputDevice(t)}getVideoInputDevice(t){return this.broadcastCanvasManager.getVideoInputDevice(t)}getConnectionState(){return this.peerClient.getConnectionState()}getSessionId(){return this.peerClient.getSessionId()}on(t,e){this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}getAudioContext(){return this.broadcastCanvasManager.audioContext}attachPreview(t){this.broadcastCanvasManager.attachPreview(t)}detachPreview(){this.broadcastCanvasManager.detachPreview()}disableVideo(){this.broadcastCanvasManager.disableVideo()}enableVideo(){this.broadcastCanvasManager.enableVideo()}disableAudio(){this.broadcastCanvasManager.disableAudio()}enableAudio(){this.broadcastCanvasManager.enableAudio()}}function zr(t){return new AmazonIVSBroadcastClient(function(t){const e=new Config;return e.streamConfig=t.streamConfig,e.ingestEndpoint=t.ingestEndpoint,e.logger=t.logger,e.logLevel=t.logLevel,e.networkReconnectConfig=t.networkReconnectConfig,e}(t))}Gr=new WeakSet,Wr=function(t){if("string"!=typeof t||!/^[a-zA-Z0-9_-]+$/.test(t))throw new BroadcastClientError(et)};const qr="1.5.2";function Kr(t){const e=new StageConfig;e.logger=t.logger,e.logLevel=t.logLevel,e.streamConfig=t.streamConfig,e.whipUrlOverride=t.whipUrlOverride;new Config(void 0,t.logLevel,t.streamConfig,t.logger);return new AmazonIVSBroadcastStageClient(new(d()),e,new Logger(t.logLevel,t.logger))}function Jr(t){const e=AnalyticsTracker.getInstance(),n=ge(t),r=f(),i=new JoinEvent({traceId:r,token:n,eventEndpoint:n.eventsURL,whipEndpoint:n.whipURL});e.trackEventNoSharedProps(i)}function Xr(t,e){const n=AnalyticsTracker.getInstance(),r=ge(t),i=f(),o=new LeaveEvent({traceId:i,token:r,eventEndpoint:r.eventsURL,whipEndpoint:r.whipURL,reason:e});n.trackEventNoSharedProps(o)}const Yr=a})(),r})()));