Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/monara/public_html/test.athavaneng.com/themes.php on line 99
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 226
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 227
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 228
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 229
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 230
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 231
/*! For license information please see main.js.LICENSE.txt */
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.WRTCPlayer=e():t.WRTCPlayer=e()}(self,(()=>(()=>{var t={55:t=>{"use strict";t.exports=function(t,e){for(var n={},r=Object.keys(t),i=Array.isArray(e),o=0;o{"use strict";t.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,(t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`))},284:(t,e,n)=>{"use strict";function r(){return"[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0)}function i(t,e){return t.require(e)}n.d(e,{fj:()=>i,wD:()=>r}),t=n.hmd(t)},297:(t,e,n)=>{"use strict";n.d(e,{lu:()=>c});var r=n(936),i=n(284);t=n.hmd(t);var o={nowSeconds:function(){return Date.now()/1e3}};var s=(0,i.wD)()?function(){try{return(0,i.fj)(t,"perf_hooks").performance}catch(t){return}}():function(){var t=(0,r.VZ)().performance;if(t&&t.now)return{now:function(){return t.now()},timeOrigin:Date.now()-t.now()}}(),a=void 0===s?o:{nowSeconds:function(){return(s.timeOrigin+s.now())/1e3}},c=o.nowSeconds.bind(o);a.nowSeconds.bind(a),function(){var t=(0,r.VZ)().performance;if(t)t.timeOrigin?t.timeOrigin:t.timing&&t.timing.navigationStart||Date.now()}()},454:t=>{"use strict";var e="%[a-f0-9]{2}",n=new RegExp("("+e+")|([^%]+?)","gi"),r=new RegExp("("+e+")+","gi");function i(t,e){try{return[decodeURIComponent(t.join(""))]}catch(t){}if(1===t.length)return t;e=e||1;var n=t.slice(0,e),r=t.slice(e);return Array.prototype.concat.call([],i(n),i(r))}function o(t){try{return decodeURIComponent(t)}catch(o){for(var e=t.match(n)||[],r=1;r{"use strict";t.exports=(t,e)=>{if("string"!=typeof t||"string"!=typeof e)throw new TypeError("Expected the arguments to be of type `string`");if(""===e)return[t];const n=t.indexOf(e);return-1===n?[t]:[t.slice(0,n),t.slice(n+e.length)]}},663:(t,e,n)=>{"use strict";const r=n(280),i=n(454),o=n(528),s=n(55),a=Symbol("encodeFragmentIdentifier");function c(t){if("string"!=typeof t||1!==t.length)throw new TypeError("arrayFormatSeparator must be single character string")}function u(t,e){return e.encode?e.strict?r(t):encodeURIComponent(t):t}function l(t,e){return e.decode?i(t):t}function d(t){return Array.isArray(t)?t.sort():"object"==typeof t?d(Object.keys(t)).sort(((t,e)=>Number(t)-Number(e))).map((e=>t[e])):t}function p(t){const e=t.indexOf("#");return-1!==e&&(t=t.slice(0,e)),t}function h(t){const e=(t=p(t)).indexOf("?");return-1===e?"":t.slice(e+1)}function f(t,e){return e.parseNumbers&&!Number.isNaN(Number(t))&&"string"==typeof t&&""!==t.trim()?t=Number(t):!e.parseBooleans||null===t||"true"!==t.toLowerCase()&&"false"!==t.toLowerCase()||(t="true"===t.toLowerCase()),t}function v(t,e){c((e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e)).arrayFormatSeparator);const n=function(t){let e;switch(t.arrayFormat){case"index":return(t,n,r)=>{e=/\[(\d*)\]$/.exec(t),t=t.replace(/\[\d*\]$/,""),e?(void 0===r[t]&&(r[t]={}),r[t][e[1]]=n):r[t]=n};case"bracket":return(t,n,r)=>{e=/(\[\])$/.exec(t),t=t.replace(/\[\]$/,""),e?void 0!==r[t]?r[t]=[].concat(r[t],n):r[t]=[n]:r[t]=n};case"colon-list-separator":return(t,n,r)=>{e=/(:list)$/.exec(t),t=t.replace(/:list$/,""),e?void 0!==r[t]?r[t]=[].concat(r[t],n):r[t]=[n]:r[t]=n};case"comma":case"separator":return(e,n,r)=>{const i="string"==typeof n&&n.includes(t.arrayFormatSeparator),o="string"==typeof n&&!i&&l(n,t).includes(t.arrayFormatSeparator);n=o?l(n,t):n;const s=i||o?n.split(t.arrayFormatSeparator).map((e=>l(e,t))):null===n?n:l(n,t);r[e]=s};case"bracket-separator":return(e,n,r)=>{const i=/(\[\])$/.test(e);if(e=e.replace(/\[\]$/,""),!i)return void(r[e]=n?l(n,t):n);const o=null===n?[]:n.split(t.arrayFormatSeparator).map((e=>l(e,t)));void 0!==r[e]?r[e]=[].concat(r[e],o):r[e]=o};default:return(t,e,n)=>{void 0!==n[t]?n[t]=[].concat(n[t],e):n[t]=e}}}(e),r=Object.create(null);if("string"!=typeof t)return r;if(!(t=t.trim().replace(/^[?#&]/,"")))return r;for(const i of t.split("&")){if(""===i)continue;let[t,s]=o(e.decode?i.replace(/\+/g," "):i,"=");s=void 0===s?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?s:l(s,e),n(l(t,e),s,r)}for(const t of Object.keys(r)){const n=r[t];if("object"==typeof n&&null!==n)for(const t of Object.keys(n))n[t]=f(n[t],e);else r[t]=f(n,e)}return!1===e.sort?r:(!0===e.sort?Object.keys(r).sort():Object.keys(r).sort(e.sort)).reduce(((t,e)=>{const n=r[e];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?t[e]=d(n):t[e]=n,t}),Object.create(null))}e.extract=h,e.parse=v,e.stringify=(t,e)=>{if(!t)return"";c((e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e)).arrayFormatSeparator);const n=n=>e.skipNull&&null==t[n]||e.skipEmptyString&&""===t[n],r=function(t){switch(t.arrayFormat){case"index":return e=>(n,r)=>{const i=n.length;return void 0===r||t.skipNull&&null===r||t.skipEmptyString&&""===r?n:null===r?[...n,[u(e,t),"[",i,"]"].join("")]:[...n,[u(e,t),"[",u(i,t),"]=",u(r,t)].join("")]};case"bracket":return e=>(n,r)=>void 0===r||t.skipNull&&null===r||t.skipEmptyString&&""===r?n:null===r?[...n,[u(e,t),"[]"].join("")]:[...n,[u(e,t),"[]=",u(r,t)].join("")];case"colon-list-separator":return e=>(n,r)=>void 0===r||t.skipNull&&null===r||t.skipEmptyString&&""===r?n:null===r?[...n,[u(e,t),":list="].join("")]:[...n,[u(e,t),":list=",u(r,t)].join("")];case"comma":case"separator":case"bracket-separator":{const e="bracket-separator"===t.arrayFormat?"[]=":"=";return n=>(r,i)=>void 0===i||t.skipNull&&null===i||t.skipEmptyString&&""===i?r:(i=null===i?"":i,0===r.length?[[u(n,t),e,u(i,t)].join("")]:[[r,u(i,t)].join(t.arrayFormatSeparator)])}default:return e=>(n,r)=>void 0===r||t.skipNull&&null===r||t.skipEmptyString&&""===r?n:null===r?[...n,u(e,t)]:[...n,[u(e,t),"=",u(r,t)].join("")]}}(e),i={};for(const e of Object.keys(t))n(e)||(i[e]=t[e]);const o=Object.keys(i);return!1!==e.sort&&o.sort(e.sort),o.map((n=>{const i=t[n];return void 0===i?"":null===i?u(n,e):Array.isArray(i)?0===i.length&&"bracket-separator"===e.arrayFormat?u(n,e)+"[]":i.reduce(r(n),[]).join("&"):u(n,e)+"="+u(i,e)})).filter((t=>t.length>0)).join("&")},e.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);const[n,r]=o(t,"#");return Object.assign({url:n.split("?")[0]||"",query:v(h(t),e)},e&&e.parseFragmentIdentifier&&r?{fragmentIdentifier:l(r,e)}:{})},e.stringifyUrl=(t,n)=>{n=Object.assign({encode:!0,strict:!0,[a]:!0},n);const r=p(t.url).split("?")[0]||"",i=e.extract(t.url),o=e.parse(i,{sort:!1}),s=Object.assign(o,t.query);let c=e.stringify(s,n);c&&(c=`?${c}`);let l=function(t){let e="";const n=t.indexOf("#");return-1!==n&&(e=t.slice(n)),e}(t.url);return t.fragmentIdentifier&&(l=`#${n[a]?u(t.fragmentIdentifier,n):t.fragmentIdentifier}`),`${r}${c}${l}`},e.pick=(t,n,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[a]:!1},r);const{url:i,query:o,fragmentIdentifier:c}=e.parseUrl(t,r);return e.stringifyUrl({url:i,query:s(o,n),fragmentIdentifier:c},r)},e.exclude=(t,n,r)=>{const i=Array.isArray(n)?t=>!n.includes(t):(t,e)=>!n(t,e);return e.pick(t,i,r)}},936:(t,e,n)=>{"use strict";n.d(e,{$N:()=>p,$X:()=>c,Dl:()=>a,FA:()=>f,M6:()=>d,VZ:()=>o,eJ:()=>s,gO:()=>l,pq:()=>u});var r=n(284),i={};function o(){return(0,r.wD)()?n.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:i}function s(){var t=o(),e=t.crypto||t.msCrypto;if(void 0!==e&&e.getRandomValues){var n=new Uint16Array(8);e.getRandomValues(n),n[3]=4095&n[3]|16384,n[4]=16383&n[4]|32768;var r=function(t){for(var e=t.toString(16);e.length<4;)e="0"+e;return e};return r(n[0])+r(n[1])+r(n[2])+r(n[3])+r(n[4])+r(n[5])+r(n[6])+r(n[7])}return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))}function a(t){if(!t)return{};var e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};var n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],relative:e[5]+n+r}}function c(t){if(t.message)return t.message;if(t.exception&&t.exception.values&&t.exception.values[0]){var e=t.exception.values[0];return e.type&&e.value?e.type+": "+e.value:e.type||e.value||t.event_id||""}return t.event_id||""}function u(t){var e=o();if(!("console"in e))return t();var n=e.console,r={};["debug","info","warn","error","log","assert"].forEach((function(t){t in e.console&&n[t].__sentry_original__&&(r[t]=n[t],n[t]=n[t].__sentry_original__)}));var i=t();return Object.keys(r).forEach((function(t){n[t]=r[t]})),i}function l(t,e,n){t.exception=t.exception||{},t.exception.values=t.exception.values||[],t.exception.values[0]=t.exception.values[0]||{},t.exception.values[0].value=t.exception.values[0].value||e||"",t.exception.values[0].type=t.exception.values[0].type||n||"Error"}function d(t,e){void 0===e&&(e={});try{t.exception.values[0].mechanism=t.exception.values[0].mechanism||{},Object.keys(e).forEach((function(n){t.exception.values[0].mechanism[n]=e[n]}))}catch(t){}}function p(){try{return document.location.href}catch(t){return""}}var h=6e4;function f(t,e){if(!e)return h;var n=parseInt(""+e,10);if(!isNaN(n))return 1e3*n;var r=Date.parse(""+e);return isNaN(r)?h:r-t}},942:t=>{t.exports=function(t){t.events={}}},974:t=>{(t.exports=function(){this.events={}}).prototype={emit:function(t){var e=[].slice.call(arguments,1);[].slice.call(this.events[t]||[]).filter((function(t){t.apply(this,e)}))},on:function(t,e){return(this.events[t]=this.events[t]||[]).push(e),function(){this.events[t]=this.events[t].filter((function(t){return t!==e}))}.bind(this)}}}},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](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.hmd=t=>((t=Object.create(t)).children||(t.children=[]),Object.defineProperty(t,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+t.id)}}),t),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})};var r={};return(()=>{"use strict";function t(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);nTn,WRTCPublisherLoad:()=>In,getOptions:()=>xn,getUrl:()=>kn});var i=n(663);function o(t,e,n,r,i,o,s){try{var a=t[o](s),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(r,i)}function s(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var s=t.apply(e,n);function a(t){o(s,r,i,a,c,"next",t)}function c(t){o(s,r,i,a,c,"throw",t)}a(void 0)}))}}function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function c(t){var e=function(t,e){if("object"!=a(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==a(e)?e:e+""}function u(t,e,n){return(e=c(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function l(t){for(var e=1;e=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function f(){for(var t=[],e=0;e0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function m(){for(var t=[],e=0;e=0?m(this._breadcrumbs,[n]).slice(-e):m(this._breadcrumbs,[n]),this._notifyScopeListeners(),this},t.prototype.clearBreadcrumbs=function(){return this._breadcrumbs=[],this._notifyScopeListeners(),this},t.prototype.applyToEvent=function(t,e){var n;if(this._extra&&Object.keys(this._extra).length&&(t.extra=v(v({},this._extra),t.extra)),this._tags&&Object.keys(this._tags).length&&(t.tags=v(v({},this._tags),t.tags)),this._user&&Object.keys(this._user).length&&(t.user=v(v({},this._user),t.user)),this._contexts&&Object.keys(this._contexts).length&&(t.contexts=v(v({},this._contexts),t.contexts)),this._level&&(t.level=this._level),this._transactionName&&(t.transaction=this._transactionName),this._span){t.contexts=v({trace:this._span.getTraceContext()},t.contexts);var r=null===(n=this._span.transaction)||void 0===n?void 0:n.name;r&&(t.tags=v({transaction:r},t.tags))}return this._applyFingerprint(t),t.breadcrumbs=m(t.breadcrumbs||[],this._breadcrumbs),t.breadcrumbs=t.breadcrumbs.length>0?t.breadcrumbs:void 0,this._notifyEventProcessors(m(L(),this._eventProcessors),t,e)},t.prototype._notifyEventProcessors=function(t,e,n,r){var i=this;return void 0===r&&(r=0),new R((function(o,s){var a=t[r];if(null===e||"function"!=typeof a)o(e);else{var c=a(v({},e),n);T(c)?c.then((function(e){return i._notifyEventProcessors(t,e,n,r+1).then(o)})).then(null,s):i._notifyEventProcessors(t,c,n,r+1).then(o).then(null,s)}}))},t.prototype._notifyScopeListeners=function(){var t=this;this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((function(e){e(t)})),this._notifyingListeners=!1)},t.prototype._applyFingerprint=function(t){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],this._fingerprint&&(t.fingerprint=t.fingerprint.concat(this._fingerprint)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint},t}();function L(){var t=(0,I.VZ)();return t.__SENTRY__=t.__SENTRY__||{},t.__SENTRY__.globalEventProcessors=t.__SENTRY__.globalEventProcessors||[],t.__SENTRY__.globalEventProcessors}function N(t){L().push(t)}var A=(0,I.VZ)(),M="Sentry Logger ",U=function(){function t(){this._enabled=!1}return t.prototype.disable=function(){this._enabled=!1},t.prototype.enable=function(){this._enabled=!0},t.prototype.log=function(){for(var t=[],e=0;e=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function G(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function J(t){try{for(var e=t,n=[],r=0,i=0,o=void 0;e&&r++<5&&!("html"===(o=Y(e))||r>1&&i+3*n.length+o.length>=80);)n.push(o),i+=o.length,e=e.parentNode;return n.reverse().join(" > ")}catch(t){return""}}function Y(t){var e,n,r,i,o,s=t,a=[];if(!s||!s.tagName)return"";if(a.push(s.tagName.toLowerCase()),s.id&&a.push("#"+s.id),(e=s.className)&&S(e))for(n=e.split(/\s+/),o=0;o";function Z(t){try{return t&&"function"==typeof t&&t.name||z}catch(t){return z}}function K(t,e){return void 0===e&&(e=0),"string"!=typeof t||0===e||t.length<=e?t:t.substr(0,e)+"..."}function Q(t,e){if(!Array.isArray(t))return"";for(var n=[],r=0;r"}try{o.currentTarget=k(i.currentTarget)?J(i.currentTarget):Object.prototype.toString.call(i.currentTarget)}catch(t){o.currentTarget=""}for(var r in"undefined"!=typeof CustomEvent&&C(t,CustomEvent)&&(o.detail=i.detail),i)Object.prototype.hasOwnProperty.call(i,r)&&(o[r]=i);return o}return t}function rt(t){return function(t){return~-encodeURI(t).split(/%..|./).length}(JSON.stringify(t))}function it(t,e,n){void 0===e&&(e=3),void 0===n&&(n=102400);var r=at(t,e);return rt(r)>n?it(t,e-1,n):r}function ot(t,e){return"domain"===e&&t&&"object"==typeof t&&t._events?"[Domain]":"domainEmitter"===e?"[DomainEmitter]":void 0!==n.g&&t===n.g?"[Global]":"undefined"!=typeof window&&t===window?"[Window]":"undefined"!=typeof document&&t===document?"[Document]":E(r=t)&&"nativeEvent"in r&&"preventDefault"in r&&"stopPropagation"in r?"[SyntheticEvent]":"number"==typeof t&&t!=t?"[NaN]":void 0===t?"[undefined]":"function"==typeof t?"[Function: "+Z(t)+"]":"symbol"==typeof t?"["+String(t)+"]":"bigint"==typeof t?"[BigInt: "+String(t)+"]":t;var r}function st(t,e,n,r){if(void 0===n&&(n=1/0),void 0===r&&(r=new X),0===n)return function(t){var e=Object.prototype.toString.call(t);if("string"==typeof t)return t;if("[object Object]"===e)return"[Object]";if("[object Array]"===e)return"[Array]";var n=ot(t);return w(n)?n:e}(e);if(null!=e&&"function"==typeof e.toJSON)return e.toJSON();var i=ot(e,t);if(w(i))return i;var o=nt(e),s=Array.isArray(e)?[]:{};if(r.memoize(e))return"[Circular ~]";for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(s[a]=st(a,o[a],n-1,r));return r.unmemoize(e),s}function at(t,e){try{return JSON.parse(JSON.stringify(t,(function(t,n){return st(t,n,e)})))}catch(t){return"**non-serializable**"}}function ct(t,e){void 0===e&&(e=40);var n=Object.keys(nt(t));if(n.sort(),!n.length)return"[object has no keys]";if(n[0].length>=e)return K(n[0],e);for(var r=n.length;r>0;r--){var i=n.slice(0,r).join(", ");if(!(i.length>e))return r===n.length?i:K(i,e)}return""}function ut(t){var e,n;if(E(t)){var r=t,i={};try{for(var o=H(Object.keys(r)),s=o.next();!s.done;s=o.next()){var a=s.value;void 0!==r[a]&&(i[a]=ut(r[a]))}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}return i}return Array.isArray(t)?t.map(ut):t}var lt=function(){function t(t){this.errors=0,this.sid=(0,I.eJ)(),this.timestamp=Date.now(),this.started=Date.now(),this.duration=0,this.status=F.Ok,t&&this.update(t)}return t.prototype.update=function(t){void 0===t&&(t={}),t.user&&(t.user.ip_address&&(this.ipAddress=t.user.ip_address),t.did||(this.did=t.user.id||t.user.email||t.user.username)),this.timestamp=t.timestamp||Date.now(),t.sid&&(this.sid=32===t.sid.length?t.sid:(0,I.eJ)()),t.did&&(this.did=""+t.did),"number"==typeof t.started&&(this.started=t.started),"number"==typeof t.duration?this.duration=t.duration:this.duration=this.timestamp-this.started,t.release&&(this.release=t.release),t.environment&&(this.environment=t.environment),t.ipAddress&&(this.ipAddress=t.ipAddress),t.userAgent&&(this.userAgent=t.userAgent),"number"==typeof t.errors&&(this.errors=t.errors),t.status&&(this.status=t.status)},t.prototype.close=function(t){t?this.update({status:t}):this.status===F.Ok?this.update({status:F.Exited}):this.update()},t.prototype.toJSON=function(){return ut({sid:""+this.sid,init:!0,started:new Date(this.started).toISOString(),timestamp:new Date(this.timestamp).toISOString(),status:this.status,errors:this.errors,did:"number"==typeof this.did||"string"==typeof this.did?""+this.did:void 0,duration:this.duration,attrs:ut({release:this.release,environment:this.environment,ip_address:this.ipAddress,user_agent:this.userAgent})})},t}(),dt=function(){function t(t,e,n){void 0===e&&(e=new D),void 0===n&&(n=3),this._version=n,this._stack=[{}],this.getStackTop().scope=e,this.bindClient(t)}return t.prototype.isOlderThan=function(t){return this._version=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Tt(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function Ct(){for(var t=[],e=0;e1&&(l=p.slice(0,-1).join("/"),d=p.pop()),d){var h=d.match(/^\d+/);h&&(d=h[0])}this._fromComponents({host:a,pass:s,path:l,projectId:d,port:u,protocol:r,user:i})},t.prototype._fromComponents=function(t){this.protocol=t.protocol,this.user=t.user,this.pass=t.pass||"",this.host=t.host,this.port=t.port||"",this.path=t.path||"",this.projectId=t.projectId},t.prototype._validate=function(){var t=this;if(["protocol","user","host","projectId"].forEach((function(e){if(!t[e])throw new jt(Rt+": "+e+" missing")})),!this.projectId.match(/^\d+$/))throw new jt(Rt+": Invalid projectId "+this.projectId);if("http"!==this.protocol&&"https"!==this.protocol)throw new jt(Rt+": Invalid protocol "+this.protocol);if(this.port&&isNaN(parseInt(this.port,10)))throw new jt(Rt+": Invalid port "+this.port)},t}(),Dt=[];function Lt(t){var e={};return function(t){var e=t.defaultIntegrations&&f(t.defaultIntegrations)||[],n=t.integrations,r=[];if(Array.isArray(n)){var i=n.map((function(t){return t.name})),o=[];e.forEach((function(t){-1===i.indexOf(t.name)&&-1===o.indexOf(t.name)&&(r.push(t),o.push(t.name))})),n.forEach((function(t){-1===o.indexOf(t.name)&&(r.push(t),o.push(t.name))}))}else"function"==typeof n?(r=n(e),r=Array.isArray(r)?r:[r]):r=f(e);var s=r.map((function(t){return t.name})),a="Debug";return-1!==s.indexOf(a)&&r.push.apply(r,f(r.splice(s.indexOf(a),1))),r}(t).forEach((function(t){e[t.name]=t,function(t){-1===Dt.indexOf(t.name)&&(t.setupOnce(N,ft),Dt.push(t.name),V.log("Integration installed: "+t.name))}(t)})),e}var Nt,At,Mt=function(){function t(t,e){this._integrations={},this._processing=0,this._backend=new t(e),this._options=e,e.dsn&&(this._dsn=new It(e.dsn))}return t.prototype.captureException=function(t,e,n){var r=this,i=e&&e.event_id;return this._process(this._getBackend().eventFromException(t,e).then((function(t){return r._captureEvent(t,e,n)})).then((function(t){i=t}))),i},t.prototype.captureMessage=function(t,e,n,r){var i=this,o=n&&n.event_id,s=w(t)?this._getBackend().eventFromMessage(String(t),e,n):this._getBackend().eventFromException(t,n);return this._process(s.then((function(t){return i._captureEvent(t,n,r)})).then((function(t){o=t}))),o},t.prototype.captureEvent=function(t,e,n){var r=e&&e.event_id;return this._process(this._captureEvent(t,e,n).then((function(t){r=t}))),r},t.prototype.captureSession=function(t){t.release?this._sendSession(t):V.warn("Discarded session because of missing release")},t.prototype.getDsn=function(){return this._dsn},t.prototype.getOptions=function(){return this._options},t.prototype.flush=function(t){var e=this;return this._isClientProcessing(t).then((function(n){return e._getBackend().getTransport().close(t).then((function(t){return n&&t}))}))},t.prototype.close=function(t){var e=this;return this.flush(t).then((function(t){return e.getOptions().enabled=!1,t}))},t.prototype.setupIntegrations=function(){this._isEnabled()&&(this._integrations=Lt(this._options))},t.prototype.getIntegration=function(t){try{return this._integrations[t.id]||null}catch(e){return V.warn("Cannot retrieve integration "+t.id+" from the current Client"),null}},t.prototype._updateSessionFromEvent=function(t,e){var n,r,i,o=!1,s=!1,a=e.exception&&e.exception.values;if(a){s=!0;try{for(var c=p(a),u=c.next();!u.done;u=c.next()){var l=u.value.mechanism;if(l&&!1===l.handled){o=!0;break}}}catch(t){n={error:t}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}}var h=e.user;if(!t.userAgent){var f=e.request?e.request.headers:{};for(var v in f)if("user-agent"===v.toLowerCase()){i=f[v];break}}t.update(d(d({},o&&{status:F.Crashed}),{user:h,userAgent:i,errors:t.errors+Number(s||o)}))},t.prototype._sendSession=function(t){this._getBackend().sendSession(t)},t.prototype._isClientProcessing=function(t){var e=this;return new R((function(n){var r=0,i=setInterval((function(){0==e._processing?(clearInterval(i),n(!0)):(r+=1,t&&r>=t&&(clearInterval(i),n(!1)))}),1)}))},t.prototype._getBackend=function(){return this._backend},t.prototype._isEnabled=function(){return!1!==this.getOptions().enabled&&void 0!==this._dsn},t.prototype._prepareEvent=function(t,e,n){var r=this,i=this.getOptions().normalizeDepth,o=void 0===i?3:i,s=d(d({},t),{event_id:t.event_id||(n&&n.event_id?n.event_id:(0,I.eJ)()),timestamp:t.timestamp||(0,P.lu)()});this._applyClientOptions(s),this._applyIntegrationsMetadata(s);var a=e;n&&n.captureContext&&(a=D.clone(a).update(n.captureContext));var c=R.resolve(s);return a&&(c=a.applyToEvent(s,n)),c.then((function(t){return"number"==typeof o&&o>0?r._normalizeEvent(t,o):t}))},t.prototype._normalizeEvent=function(t,e){if(!t)return null;var n=d(d(d(d(d({},t),t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map((function(t){return d(d({},t),t.data&&{data:at(t.data,e)})}))}),t.user&&{user:at(t.user,e)}),t.contexts&&{contexts:at(t.contexts,e)}),t.extra&&{extra:at(t.extra,e)});return t.contexts&&t.contexts.trace&&(n.contexts.trace=t.contexts.trace),n},t.prototype._applyClientOptions=function(t){var e=this.getOptions(),n=e.environment,r=e.release,i=e.dist,o=e.maxValueLength,s=void 0===o?250:o;"environment"in t||(t.environment="environment"in e?n:"production"),void 0===t.release&&void 0!==r&&(t.release=r),void 0===t.dist&&void 0!==i&&(t.dist=i),t.message&&(t.message=K(t.message,s));var a=t.exception&&t.exception.values&&t.exception.values[0];a&&a.value&&(a.value=K(a.value,s));var c=t.request;c&&c.url&&(c.url=K(c.url,s))},t.prototype._applyIntegrationsMetadata=function(t){var e=t.sdk,n=Object.keys(this._integrations);e&&n.length>0&&(e.integrations=n)},t.prototype._sendEvent=function(t){this._getBackend().sendEvent(t)},t.prototype._captureEvent=function(t,e,n){return this._processEvent(t,e,n).then((function(t){return t.event_id}),(function(t){V.error(t)}))},t.prototype._processEvent=function(t,e,n){var r=this,i=this.getOptions(),o=i.beforeSend,s=i.sampleRate;if(!this._isEnabled())return R.reject(new jt("SDK not enabled, will not send event."));var a="transaction"===t.type;return!a&&"number"==typeof s&&Math.random()>s?R.reject(new jt("Discarding event because it's not included in the random sample (sampling rate = "+s+")")):this._prepareEvent(t,n,e).then((function(t){if(null===t)throw new jt("An event processor returned null, will not send event.");if(e&&e.data&&!0===e.data.__sentry__||a||!o)return t;var n=o(t,e);if(void 0===n)throw new jt("`beforeSend` method has to return `null` or a valid event.");return T(n)?n.then((function(t){return t}),(function(t){throw new jt("beforeSend rejected with "+t)})):n})).then((function(t){if(null===t)throw new jt("`beforeSend` returned `null`, will not send event.");var e=n&&n.getSession&&n.getSession();return!a&&e&&r._updateSessionFromEvent(e,t),r._sendEvent(t),t})).then(null,(function(t){if(t instanceof jt)throw t;throw r.captureException(t,{data:{__sentry__:!0},originalException:t}),new jt("Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: "+t)}))},t.prototype._process=function(t){var e=this;this._processing+=1,t.then((function(t){return e._processing-=1,t}),(function(t){return e._processing-=1,t}))},t}();(At=Nt||(Nt={})).Unknown="unknown",At.Skipped="skipped",At.Success="success",At.RateLimit="rate_limit",At.Invalid="invalid",At.Failed="failed",function(t){t.fromHttpCode=function(e){return e>=200&&e<300?t.Success:429===e?t.RateLimit:e>=400&&e<500?t.Invalid:e>=500?t.Failed:t.Unknown}}(Nt||(Nt={}));var Ut,Ft,$t=function(){function t(){}return t.prototype.sendEvent=function(t){return R.resolve({reason:"NoopTransport: Event has been skipped because no Dsn is configured.",status:Nt.Skipped})},t.prototype.close=function(t){return R.resolve(!0)},t}(),Vt=function(){function t(t){this._options=t,this._options.dsn||V.warn("No DSN provided, backend will not do anything."),this._transport=this._setupTransport()}return t.prototype.eventFromException=function(t,e){throw new jt("Backend has to implement `eventFromException` method")},t.prototype.eventFromMessage=function(t,e,n){throw new jt("Backend has to implement `eventFromMessage` method")},t.prototype.sendEvent=function(t){this._transport.sendEvent(t).then(null,(function(t){V.error("Error while sending event: "+t)}))},t.prototype.sendSession=function(t){this._transport.sendSession?this._transport.sendSession(t).then(null,(function(t){V.error("Error while sending session: "+t)})):V.warn("Dropping session because custom transport doesn't implement sendSession")},t.prototype.getTransport=function(){return this._transport},t.prototype._setupTransport=function(){return new $t},t}();function Bt(){if(!("fetch"in(0,I.VZ)()))return!1;try{return new Headers,new Request(""),new Response,!0}catch(t){return!1}}function qt(t){return t&&/^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function Wt(){if(!Bt())return!1;try{return new Request("_",{referrerPolicy:"origin"}),!0}catch(t){return!1}}(Ft=Ut||(Ut={})).Fatal="fatal",Ft.Error="error",Ft.Warning="warning",Ft.Log="log",Ft.Info="info",Ft.Debug="debug",Ft.Critical="critical",function(t){t.fromString=function(e){switch(e){case"debug":return t.Debug;case"info":return t.Info;case"warn":case"warning":return t.Warning;case"error":return t.Error;case"fatal":return t.Fatal;case"critical":return t.Critical;default:return t.Log}}}(Ut||(Ut={}));var Ht="?",Gt=/^\s*at (?:(.*?) ?\()?((?:file|https?|blob|chrome-extension|address|native|eval|webpack||[-a-z]+:|.*bundle|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Jt=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension|capacitor).*?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Yt=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,Xt=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,zt=/\((\S*)(?::(\d+))(?::(\d+))\)/,Zt=/Minified React error #\d+;/i;function Kt(t){var e=null,n=0;t&&("number"==typeof t.framesToPop?n=t.framesToPop:Zt.test(t.message)&&(n=1));try{if(e=function(t){if(!t||!t.stacktrace)return null;for(var e,n=t.stacktrace,r=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,i=/ line (\d+), column (\d+)\s*(?:in (?:]+)>|([^)]+))\((.*)\))? in (.*):\s*$/i,o=n.split("\n"),s=[],a=0;a eval")>-1&&(e=Xt.exec(n[3]))?(n[1]=n[1]||"eval",n[3]=e[1],n[4]=e[2],n[5]=""):0!==s||n[5]||void 0===t.columnNumber||(i[0].column=t.columnNumber+1),r={url:n[3],func:n[1]||Ht,args:n[2]?n[2].split(","):[],line:n[4]?+n[4]:null,column:n[5]?+n[5]:null}}!r.func&&r.line&&(r.func=Ht),i.push(r)}if(!i.length)return null;return{message:te(t),name:t.name,stack:i}}(t),e)return Qt(e,n)}catch(t){}return{message:te(t),name:t&&t.name,stack:[],failed:!0}}function Qt(t,e){try{return xt(xt({},t),{stack:t.stack.slice(e)})}catch(e){return t}}function te(t){var e=t&&t.message;return e?e.error&&"string"==typeof e.error.message?e.error.message:e:"No error message"}function ee(t){var e=re(t.stack),n={type:t.name,value:t.message};return e&&e.length&&(n.stacktrace={frames:e}),void 0===n.type&&""===n.value&&(n.value="Unrecoverable error caught"),n}function ne(t){return{exception:{values:[ee(t)]}}}function re(t){if(!t||!t.length)return[];var e=t,n=e[0].func||"",r=e[e.length-1].func||"";return-1===n.indexOf("captureMessage")&&-1===n.indexOf("captureException")||(e=e.slice(1)),-1!==r.indexOf("sentryWrapped")&&(e=e.slice(0,-1)),e.slice(0,50).map((function(t){return{colno:null===t.column?void 0:t.column,filename:t.url||e[0].url,function:t.func||"?",in_app:!0,lineno:null===t.line?void 0:t.line}})).reverse()}function ie(t,e,n){var r,i;if(void 0===n&&(n={}),_(t)&&t.error)return r=ne(Kt(t=t.error));if(b(t)||(i=t,"[object DOMException]"===Object.prototype.toString.call(i))){var o=t,s=o.name||(b(o)?"DOMError":"DOMException"),a=o.message?s+": "+o.message:s;return r=oe(a,e,n),(0,I.gO)(r,a),"code"in o&&(r.tags=xt(xt({},r.tags),{"DOMException.code":""+o.code})),r}return g(t)?r=ne(Kt(t)):E(t)||x(t)?(r=function(t,e,n){var r={exception:{values:[{type:x(t)?t.constructor.name:n?"UnhandledRejection":"Error",value:"Non-Error "+(n?"promise rejection":"exception")+" captured with keys: "+ct(t)}]},extra:{__serialized__:it(t)}};if(e){var i=re(Kt(e).stack);r.stacktrace={frames:i}}return r}(t,e,n.rejection),(0,I.M6)(r,{synthetic:!0}),r):(r=oe(t,e,n),(0,I.gO)(r,""+t,void 0),(0,I.M6)(r,{synthetic:!0}),r)}function oe(t,e,n){void 0===n&&(n={});var r={message:t};if(n.attachStacktrace&&e){var i=re(Kt(e).stack);r.stacktrace={frames:i}}return r}function se(t,e){return{body:JSON.stringify({sent_at:(new Date).toISOString()})+"\n"+JSON.stringify({type:"session"})+"\n"+JSON.stringify(t),type:"session",url:e.getEnvelopeEndpointWithUrlEncodedAuth()}}function ae(t,e){var n=t.tags||{},r=n.__sentry_samplingMethod,i=n.__sentry_sampleRate,o=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);i0&&n(!1)}),t);R.all(e._buffer).then((function(){clearTimeout(r),n(!0)})).then(null,(function(){n(!0)}))}))},t}(),le=function(){function t(t){this.options=t,this._buffer=new ue(30),this._rateLimits={},this._api=new ce(this.options.dsn),this.url=this._api.getStoreEndpointWithUrlEncodedAuth()}return t.prototype.sendEvent=function(t){throw new jt("Transport Class has to implement `sendEvent` method")},t.prototype.close=function(t){return this._buffer.drain(t)},t.prototype._handleResponse=function(t){var e=t.requestType,n=t.response,r=t.headers,i=t.resolve,o=t.reject,s=Nt.fromHttpCode(n.status);this._handleRateLimit(r)&&V.warn("Too many requests, backing off until: "+this._disabledUntil(e)),s!==Nt.Success?o(n):i({status:s})},t.prototype._disabledUntil=function(t){return this._rateLimits[t]||this._rateLimits.all},t.prototype._isRateLimited=function(t){return this._disabledUntil(t)>new Date(Date.now())},t.prototype._handleRateLimit=function(t){var e,n,r,i,o=Date.now(),s=t["x-sentry-rate-limits"],a=t["retry-after"];if(s){try{for(var c=kt(s.trim().split(",")),u=c.next();!u.done;u=c.next()){var l=u.value.split(":",2),d=parseInt(l[0],10),p=1e3*(isNaN(d)?60:d);try{for(var h=(r=void 0,kt(l[1].split(";"))),f=h.next();!f.done;f=h.next()){var v=f.value;this._rateLimits[v||"all"]=new Date(o+p)}}catch(t){r={error:t}}finally{try{f&&!f.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}}}catch(t){e={error:t}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(e)throw e.error}}return!0}return!!a&&(this._rateLimits.all=new Date(o+(0,I.FA)(o,a)),!0)},t}(),de=(0,I.VZ)(),pe=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Et(e,t),e.prototype.sendEvent=function(t){return this._sendRequest(ae(t,this._api),t)},e.prototype.sendSession=function(t){return this._sendRequest(se(t,this._api),t)},e.prototype._sendRequest=function(t,e){var n=this;if(this._isRateLimited(t.type))return Promise.reject({event:e,type:t.type,reason:"Transport locked till "+this._disabledUntil(t.type)+" due to too many requests.",status:429});var r={body:t.body,method:"POST",referrerPolicy:Wt()?"origin":""};return void 0!==this.options.fetchParameters&&Object.assign(r,this.options.fetchParameters),void 0!==this.options.headers&&(r.headers=this.options.headers),this._buffer.add(new R((function(e,i){de.fetch(t.url,r).then((function(r){var o={"x-sentry-rate-limits":r.headers.get("X-Sentry-Rate-Limits"),"retry-after":r.headers.get("Retry-After")};n._handleResponse({requestType:t.type,response:r,headers:o,resolve:e,reject:i})})).catch(i)})))},e}(le),he=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Et(e,t),e.prototype.sendEvent=function(t){return this._sendRequest(ae(t,this._api),t)},e.prototype.sendSession=function(t){return this._sendRequest(se(t,this._api),t)},e.prototype._sendRequest=function(t,e){var n=this;return this._isRateLimited(t.type)?Promise.reject({event:e,type:t.type,reason:"Transport locked till "+this._disabledUntil(t.type)+" due to too many requests.",status:429}):this._buffer.add(new R((function(e,r){var i=new XMLHttpRequest;for(var o in i.onreadystatechange=function(){if(4===i.readyState){var o={"x-sentry-rate-limits":i.getResponseHeader("X-Sentry-Rate-Limits"),"retry-after":i.getResponseHeader("Retry-After")};n._handleResponse({requestType:t.type,response:i,headers:o,resolve:e,reject:r})}},i.open("POST",t.url),n.options.headers)n.options.headers.hasOwnProperty(o)&&i.setRequestHeader(o,n.options.headers[o]);i.send(t.body)})))},e}(le),fe=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Et(e,t),e.prototype.eventFromException=function(t,e){return function(t,e,n){var r=ie(e,n&&n.syntheticException||void 0,{attachStacktrace:t.attachStacktrace});return(0,I.M6)(r,{handled:!0,type:"generic"}),r.level=Ut.Error,n&&n.event_id&&(r.event_id=n.event_id),R.resolve(r)}(this._options,t,e)},e.prototype.eventFromMessage=function(t,e,n){return void 0===e&&(e=Ut.Info),function(t,e,n,r){void 0===n&&(n=Ut.Info);var i=oe(e,r&&r.syntheticException||void 0,{attachStacktrace:t.attachStacktrace});return i.level=n,r&&r.event_id&&(i.event_id=r.event_id),R.resolve(i)}(this._options,t,e,n)},e.prototype._setupTransport=function(){if(!this._options.dsn)return t.prototype._setupTransport.call(this);var e=xt(xt({},this._options.transportOptions),{dsn:this._options.dsn});return this._options.transport?new this._options.transport(e):Bt()?new pe(e):new he(e)},e}(Vt);function ve(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function ye(t){for(var e=[],n=1;n0}function be(t,e,n){if(void 0===e&&(e={}),"function"!=typeof t)return t;try{if(t.__sentry__)return t;if(t.__sentry_wrapped__)return t.__sentry_wrapped__}catch(e){return t}var r=function(){var r=Array.prototype.slice.call(arguments);try{n&&"function"==typeof n&&n.apply(this,arguments);var i=r.map((function(t){return be(t,e)}));return t.handleEvent?t.handleEvent.apply(this,i):t.apply(this,i)}catch(t){throw ge+=1,setTimeout((function(){ge-=1})),ye("withScope",(function(n){n.addEventProcessor((function(t){var n=xt({},t);return e.mechanism&&((0,I.gO)(n,void 0,void 0),(0,I.M6)(n,e.mechanism)),n.extra=xt(xt({},n.extra),{arguments:r}),n})),me(t)})),t}};try{for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i])}catch(t){}t.prototype=t.prototype||{},r.prototype=t.prototype,Object.defineProperty(t,"__sentry_wrapped__",{enumerable:!1,value:r}),Object.defineProperties(r,{__sentry__:{enumerable:!1,value:!0},__sentry_original__:{enumerable:!1,value:t}});try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get:function(){return t.name}})}catch(t){}return r}function Se(t){if(void 0===t&&(t={}),t.eventId)if(t.dsn){var e=document.createElement("script");e.async=!0,e.src=new ce(t.dsn).getReportDialogEndpoint(t),t.onLoad&&(e.onload=t.onLoad),(document.head||document.body).appendChild(e)}else V.error("Missing dsn option in showReportDialog call");else V.error("Missing eventId option in showReportDialog call")}var we,Ee=(0,I.VZ)(),xe={},ke={};function Te(t){if(!ke[t])switch(ke[t]=!0,t){case"console":!function(){if(!("console"in Ee))return;["debug","info","warn","error","log","assert"].forEach((function(t){t in Ee.console&&et(Ee.console,t,(function(e){return function(){for(var n=[],r=0;r2?e[2]:void 0;if(r){var i=we,o=String(r);we=o,Oe("history",{from:i,to:o})}return t.apply(this,e)}}Ee.onpopstate=function(){for(var t=[],e=0;e"}0!==e.length&&ft().addBreadcrumb({category:"ui."+t.name,message:e},{event:t.event,name:t.name})},t.prototype._xhrBreadcrumb=function(t){if(t.endTimestamp){if(t.xhr.__sentry_own_request__)return;var e=t.xhr.__sentry_xhr__||{},n=e.method,r=e.url,i=e.status_code,o=e.body;ft().addBreadcrumb({category:"xhr",data:{method:n,url:r,status_code:i},type:"http"},{xhr:t.xhr,input:o})}else;},t.prototype._fetchBreadcrumb=function(t){t.endTimestamp&&(t.fetchData.url.match(/sentry_key/)&&"POST"===t.fetchData.method||(t.error?ft().addBreadcrumb({category:"fetch",data:t.fetchData,level:Ut.Error,type:"http"},{data:t.error,input:t.args}):ft().addBreadcrumb({category:"fetch",data:xt(xt({},t.fetchData),{status_code:t.response.status}),type:"http"},{input:t.args,response:t.response})))},t.prototype._historyBreadcrumb=function(t){var e=(0,I.VZ)(),n=t.from,r=t.to,i=(0,I.Dl)(e.location.href),o=(0,I.Dl)(n),s=(0,I.Dl)(r);o.path||(o=i),i.protocol===s.protocol&&i.host===s.host&&(r=s.relative),i.protocol===o.protocol&&i.host===o.host&&(n=o.relative),ft().addBreadcrumb({category:"navigation",data:{from:n,to:r}})},t.id="Breadcrumbs",t}(),$e="5.30.0",Ve=function(t){function e(e){return void 0===e&&(e={}),t.call(this,fe,e)||this}return Et(e,t),e.prototype.showReportDialog=function(t){void 0===t&&(t={}),(0,I.VZ)().document&&(this._isEnabled()?Se(xt(xt({},t),{dsn:t.dsn||this.getDsn()})):V.error("Trying to call showReportDialog with Sentry Client disabled"))},e.prototype._prepareEvent=function(e,n,r){return e.platform=e.platform||"javascript",e.sdk=xt(xt({},e.sdk),{name:"sentry.javascript.browser",packages:Ct(e.sdk&&e.sdk.packages||[],[{name:"npm:@sentry/browser",version:$e}]),version:$e}),t.prototype._prepareEvent.call(this,e,n,r)},e.prototype._sendEvent=function(e){var n=this.getIntegration(Fe);n&&n.addSentryBreadcrumb(e),t.prototype._sendEvent.call(this,e)},e}(Mt),Be=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],qe=function(){function t(e){this.name=t.id,this._options=xt({XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0},e)}return t.prototype.setupOnce=function(){var t=(0,I.VZ)();(this._options.setTimeout&&et(t,"setTimeout",this._wrapTimeFunction.bind(this)),this._options.setInterval&&et(t,"setInterval",this._wrapTimeFunction.bind(this)),this._options.requestAnimationFrame&&et(t,"requestAnimationFrame",this._wrapRAF.bind(this)),this._options.XMLHttpRequest&&"XMLHttpRequest"in t&&et(XMLHttpRequest.prototype,"send",this._wrapXHR.bind(this)),this._options.eventTarget)&&(Array.isArray(this._options.eventTarget)?this._options.eventTarget:Be).forEach(this._wrapEventTarget.bind(this))},t.prototype._wrapTimeFunction=function(t){return function(){for(var e=[],n=0;n0?e:(0,I.$N)();return 0===t.exception.values[0].stacktrace.frames.length&&t.exception.values[0].stacktrace.frames.push({colno:i,filename:s,function:"?",in_app:!0,lineno:o}),t},t.id="GlobalHandlers",t}(),He=function(){function t(e){void 0===e&&(e={}),this.name=t.id,this._key=e.key||"cause",this._limit=e.limit||5}return t.prototype.setupOnce=function(){N((function(e,n){var r=ft().getIntegration(t);return r?r._handler(e,n):e}))},t.prototype._handler=function(t,e){if(!(t.exception&&t.exception.values&&e&&C(e.originalException,Error)))return t;var n=this._walkErrorTree(e.originalException,this._key);return t.exception.values=Ct(n,t.exception.values),t},t.prototype._walkErrorTree=function(t,e,n){if(void 0===n&&(n=[]),!C(t[e],Error)||n.length+1>=this._limit)return n;var r=ee(Kt(t[e]));return this._walkErrorTree(t[e],e,Ct([r],n))},t.id="LinkedErrors",t}(),Ge=(0,I.VZ)(),Je=function(){function t(){this.name=t.id}return t.prototype.setupOnce=function(){N((function(e){var n,r,i;if(ft().getIntegration(t)){if(!Ge.navigator&&!Ge.location&&!Ge.document)return e;var o=(null===(n=e.request)||void 0===n?void 0:n.url)||(null===(r=Ge.location)||void 0===r?void 0:r.href),s=(Ge.document||{}).referrer,a=(Ge.navigator||{}).userAgent,c=xt(xt(xt({},null===(i=e.request)||void 0===i?void 0:i.headers),s&&{Referer:s}),a&&{"User-Agent":a}),u=xt(xt({},o&&{url:o}),{headers:c});return xt(xt({},e),{request:u})}return e}))},t.id="UserAgent",t}(),Ye=[new bt,new St,new qe,new Fe,new We,new He,new Je];function Xe(t){if(void 0===t&&(t={}),void 0===t.defaultIntegrations&&(t.defaultIntegrations=Ye),void 0===t.release){var e=(0,I.VZ)();e.SENTRY_RELEASE&&e.SENTRY_RELEASE.id&&(t.release=e.SENTRY_RELEASE.id)}void 0===t.autoSessionTracking&&(t.autoSessionTracking=!1),function(t,e){!0===e.debug&&V.enable();var n=ft(),r=new t(e);n.bindClient(r)}(Ve,t),t.autoSessionTracking&&function(){var t=(0,I.VZ)(),e=ft(),n="complete"===document.readyState,r=!1,i=function(){r&&n&&e.endSession()},o=function(){n=!0,i(),t.removeEventListener("load",o)};e.startSession(),n||t.addEventListener("load",o);try{var s=new PerformanceObserver((function(t,e){t.getEntries().forEach((function(t){"first-contentful-paint"===t.name&&t.startTime(console.log(...t),hn+=`${JSON.stringify(t)}\n`,hn),vn=()=>{};class yn{constructor(t,e={},n=!1){this.url=t,this.emitter=new(ln()),this.notify=this.emitter.emit.bind(this.emitter),this.log=n?fn:vn,this.isFirstMsgReceived=!1,this.retryMax=e.retryMax||1,this.retryDelay=e.retryDelay||3e3,this.retryCounter=this.retryMax,this.stopRetryTimeout=null,this.connectionTimeout=null}static get version(){try{return"24.7.1"}catch(t){return""}}destroy(){clearTimeout(this.stopRetryTimeout),clearTimeout(this.connectionTimeout),pn()(this.emitter),"function"==typeof this.onDestroy&&this.onDestroy()}stopRetry(t){this.isFirstMsgReceived=!1,this.retryCounter-=1,this.retryCounter>0?(clearTimeout(this.stopRetryTimeout),this.stopRetryTimeout=setTimeout(t.bind(this),this.retryDelay)):this.stop()}stop(){this.shouldImplementError("stop")}retryCounterReset(){this.retryCounter=this.retryMax}on(...t){return this.emitter.on.apply(this.emitter,t)}shouldImplementError(t){return()=>{throw new Error(`Custom ${t} method should be implemented for WebRTCBase descendants`)}}getVideoCardInfo(){const t="undefined"!=typeof document&&document.createElement("canvas").getContext("webgl");if(!t)return"";const e=t.getExtension("WEBGL_debug_renderer_info");return e?t.getParameter(e.UNMASKED_RENDERER_WEBGL):"no WEBGL_debug_renderer_info"}}function mn(){let t=(new Date).getTime(),e="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(n=>{let r=16*Math.random();return t>0?(r=(t+r)%16|0,t=Math.floor(t/16)):(r=(e+r)%16|0,e=Math.floor(e/16)),("x"===n?r:3&r|8).toString(16)}))}function gn(t,e,n={},r){console.debug(">onnegotiationneeded");const i=t.target;return new Promise(((t,o)=>{i.createOffer(n).then((n=>{i.setLocalDescription(n).then((()=>{(function(t,e){const n=performance.now(),r=new Promise((e=>{setTimeout((()=>{e(t.localDescription)}),250),t.onicegatheringstatechange=n=>"complete"===t.iceGatheringState&&e(t.localDescription)}));!0===e&&r.then((()=>{console.debug("ice gather blocked for N ms:",Math.ceil(performance.now()-n))}));return r})(i,!0).then((n=>{const s=performance.now();console.debug("sending N line offer:",n.sdp.split(/\r\n|\r|\n/).length);const a={method:"POST",headers:{"Content-Type":"application/sdp"}};"string"==typeof r&&(a.headers.Authorization=`Bearer ${r}`),a.body=n.sdp;fetch(e,a).then((e=>{201===e.status&&e.text().then((n=>{console.debug("got N line answer:",n.split(/\r\n|\r|\n/).length),i.signalingState&&"closed"!==i.signalingState&&i.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:n})).then((()=>{const n=e.headers;t(n.get("X-Sid"))})).catch((t=>{o(t)}))}))})).catch((t=>{o(t)}));const c=(performance.now()-s)/1e3,u=new CustomEvent("downtime-msg",{detail:{status:-1,numsec:c}});i.dispatchEvent(u)}))}))}))}))}function _n(t){const e=t.target;console.debug(">iceconnectionstatechange",e.iceConnectionState),"failed"===e.iceConnectionState&&(console.debug("*** restarting ice"),e.restartIce())}const bn=["sdp"];class Sn extends yn{constructor(t,e,n={},r=!1){if(super(e,n,r),!(t instanceof HTMLMediaElement))throw new Error("First argument must be html5 video tag");if(this.remoteVideo=t,this.remoteVideo.addEventListener("play",this.onVideoPlay.bind(this)),this.opts=n,"start_track"in n){if("string"!=typeof n.start_track)throw new Error("start_track must be string");this.start_track=n.start_track}if("videoDisabled"in n&&n.videoDisabled?this.opts.videoDisabled=!0:this.opts.videoDisabled=!1,"audioDisabled"in n&&n.audioDisabled){if(this.opts.videoDisabled)throw new Error("You must enable at least one transceiver");this.opts.audioDisabled=!0}else this.opts.audioDisabled=!1;n.autoplay&&this.play(),n.sentryConfig&&n.sentryConfig.length&&(this.sentryConfig=n.sentryConfig),n.onMediaInfo&&(this.onMediaInfo=n.onMediaInfo),n.onTrackInfo&&(this.onTrackInfo=n.onTrackInfo),this.abr=!1,this.onEventCallback=n.onEvent,this.statsSendEnable=n.statsSendEnable||!0,this.statsSendTime=1e3*n.statsSendTime||6e4}resetStats(){this.playerStatsObject={proto:"webrtc",user_agent:navigator.userAgent,bytes:0,application:{application_name:"webrtc_player",application_version:yn.version?yn.version:null,stall_count:0,pause_count:0,error_count:0,reconnect_count:0,bitrate_change_count:0,live_duration:0,stall_duration:0,pause_duration:0,total_video_frames:0,dropped_video_frames:0,corrupted_video_frames:0}},(this.statsSendEnable||this.opts.statsSendEnable)&&this.startSendStats()}onDestroy(){this.stop(),this.remoteVideo.removeEventListener("play",this.onVideoPlay)}createPeerConnection(t={},e=""){this.log("Player::createPeerConnection"),this.remotePc=new an(t),this.remotePc.stream_id="remote1",this.opts.videoDisabled||this.remotePc.addTransceiver("video",{direction:"sendrecv"}),this.opts.audioDisabled||this.remotePc.addTransceiver("audio",{direction:"sendrecv"}),this.remotePc.addEventListener("iceconnectionstatechange",_n),this.remotePc.addEventListener("negotiationneeded",(t=>{gn(t,e,{offerToReceiveAudio:!this.opts.audioDisabled,offerToReceiveVideo:!this.opts.videoDisabled}).then((t=>{this.xsid=t})).catch((t=>{this.log("handleNegotiationNeeded",t),this.addPlayerStat("error_count"),this.addPlayerStat("reconnect_count"),this.stopRetry(this.play)}))})),this.remotePc.ontrack=this.gotRemoteTrack.bind(this),this.remotePc.onconnectionstatechange=()=>{this.remotePc&&(this.log("Player::peer connection state:",this.remotePc.connectionState),"closed"===this.remotePc.connectionState||"disconnected"===this.remotePc.connectionState?(this.stop(),this.notify(ze,"peer_connection_closed")):"failed"===this.remotePc.connectionState&&this.stopRetry(this.play))},this.remotePc.ondatachannel=t=>{console.debug("!!! ice candidate on data channel:",t)},this.remotePc.oniceconnectionstatechange=t=>{this.remotePc&&(this.log("Player::ice connection change:",t,{iceConnectionState:this.remotePc.iceConnectionState}),"failed"===this.remotePc.iceConnectionState?(this.stopRetry(this.play),this.notify(ze,"ice_connection_fail")):"closed"!==this.remotePc.iceConnectionState&&"disconnected"!==this.remotePc.iceConnectionState&&void 0!==this.remotePc.iceConnectionState||(this.notify(ze,"ice_connection_closed"),this.stopRetry(this.play)),this.notify(Ke,["ICE connection state",this.remotePc&&this.remotePc.iceConnectionState]))},this.remotePc.onicegatheringstatechange=t=>{this.log("Player::ice gathering state",this.remotePc.iceGatheringState,t)},this.progressListener||this.startProgressListener()}getUrl(){const t=new URL(this.url);return t.pathname=`${t.pathname}/whep`,t.search=this.opts.authTokenName&&this.opts.tokenValue?`?${this.opts.authTokenName}=${this.opts.tokenValue}`:"",this.start_track&&(t.search+=`${this.opts.authTokenName&&this.opts.tokenValue?"&":"?"}start_track=${this.start_track}`),t.toString()}play(){this.log("Player::play"),this.remotePc&&this.stop(),this.resetStats(),this.uuid=mn(),this.playerStatsObject.id=this.uuid,this.playerStatsObject.opened_at=Date.now(),this.stopRetryTimeout&&clearTimeout(this.stopRetryTimeout),this.addListeners();const t=this.getUrl();this.createPeerConnection({bundlePolicy:"max-bundle"},t),this.getMediaInfo(),this.sentryConfig&&(Xe({dsn:this.sentryConfig,environment:"production",release:"FlussonicWebrtcPlayer"+(yn.version?`@${yn.version}`:""),tracesSampleRate:1}),this.sentryEnabled=!0)}stop(){if(this.isFirstMsgReceived=!1,this.retryCounterReset(),this.remotePc&&(this.remotePc.onconnectionstatechange=null,this.remotePc.ondatachannel=null,this.remotePc.onicecandidate=null,this.remotePc.onicecandidateerror=null,this.remotePc.oniceconnectionstatechange=null,this.remotePc.onicegatheringstatechange=null,this.remotePc.onremovestream=null,this.remotePc.ontrack=null,this.remotePc.close(),delete this.remotePc),this.stallingStarted){clearTimeout(this.probablyStalled);const t=this.playerStatsObject.application;if(t){let e=t.stall_duration;e+=Date.now()-this.stallingStarted,this.addPlayerStat("stall_duration",!1,e),delete this.stallingStarted}}delete this.frameWidth,this.playerStatsObject.closed_at=Date.now(),this.stopSendStats(),this.removeListeners(),this.progressListener&&(clearInterval(this.progressListener),delete this.progressListener);try{this.remoteVideo.srcObject=null}catch(t){this.remoteVideo.src=null}}gotRemoteTrack(t){if(this.log("remote track",t),"video"===t.track.kind||"audio"===t.track.kind)try{if(this.remoteVideo.srcObject!==t.streams[0]){const n=t.streams,r=e(n,1)[0];this.remoteVideo.srcObject=r}}catch(e){this.sentryEnabled&&me(e),this.addPlayerStat("error_count"),"undefined"!=typeof window&&(this.remoteVideo.src=window.URL.createObjectURL(t.streams[0]))}}getSessionDescription(t){let e=t.sdp,n=function(t,e){if(null==t)return{};var n,r,i=function(t,e){if(null==t)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;n[r]=t[r]}return n}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r{if(t&&e)return;const r=n.content;"video"===r&&(t=!0),"audio"===r&&(e=!0)})),t||(this.opts.videoDisabled=!0),!e){if(this.opts.videoDisabled)throw this.stop(),new Error("You have got no video and no audio transceiver");this.opts.audioDisabled=!0}}return this.mediaInfoTracks}onPlayingInfo(t){this.onTrackInfo&&(this.addPlayerStat("bitrate_change_count"),this.onTrackInfo(t))}changeTracks(t){Array.isArray(t)?("auto"===t[0]?this.trackSwitch([]):this.trackSwitch(t),this.addPlayerStat("bitrate_change_count")):console.error("tracks must be an array")}getMediaInfo(){fetch(`${this.url}/media_info.json${this.getAuthToken()}`,{headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then((t=>t.json())).then((t=>{this.mediaInfoTracks=t.tracks,this.onGetMediaInfo()})).catch((t=>{this.log("get MediaInfo error:",t),this.addPlayerStat("error_count"),this.addPlayerStat("reconnect_count"),this.stopRetry(this.play)}))}trackSwitch(t){fetch(`${this.url}/sessions/${this.xsid?this.xsid:""}/request_tracks${this.getAuthToken()}`,{headers:{Accept:"application/json","Content-Type":"application/json"},method:"PUT",body:JSON.stringify({tracks:t})}).then((t=>{this.log("trackSwitch",t)})).catch((t=>{this.log("track switch error:",t)}))}onEvent(t){const e=t.type,n=this.playerStatsObject.application;switch(e){case"playing":if(this.playerStatsObject.started_at||(this.playerStatsObject.started_at=Date.now(),this.playerStatsObject.updated_at=Date.now()),this.playbackSegmentStart=Date.now(),this.pauseStarted&&n){let t=n.pause_duration;t+=Date.now()-this.pauseStarted,this.addPlayerStat("pause_duration",!1,t),delete this.pauseStarted}this.progressListener||this.startProgressListener();break;case"pause":this.playerStatsObject.started_at&&(this.addPlayerStat("pause_count"),this.pauseStarted=Date.now()),this.progressListener&&(clearInterval(this.progressListener),delete this.progressListener);break;case"stalled":this.playerStatsObject.started_at&&(this.addPlayerStat("stall_count"),this.stallingStarted=Date.now()),this.progressListener&&(clearInterval(this.progressListener),delete this.progressListener)}this.onEventCallback&&this.onEventCallback(t)}startProgressListener(){this.progressListener=setInterval((()=>{this.remotePc&&this.remotePc.getStats(null).then((t=>{t.forEach((t=>{if("transport"===t.type){const e=t.bytesReceived,n=t.timestamp;if(this.playerStatsObject.bytes=e,this.playerStatsObject.updated_at=Math.round(n),this.playbackSegmentStart){const t=this.playerStatsObject.application;if(t){let e=t.live_duration;e+=Date.now()-this.playbackSegmentStart,this.addPlayerStat("live_duration",!1,e),delete this.playbackSegmentStart}}this.playbackSegmentStart=n}else if("track"===t.type&&"kind"in t&&"video"===t.kind){if(t.frameWidth&&t.frameWidth>0&&(this.frameWidth?this.frameWidth!==t.frameWidth&&(this.addPlayerStat("bitrate_change_count"),this.frameWidth=t.frameWidth):this.frameWidth=t.frameWidth),t.framesReceived===this.playerStatsObject.application.total_video_frames){const t=()=>{this.stallingStarted||(this.addPlayerStat("stall_count"),this.stallingStarted=Date.now())};this.probablyStalled=setTimeout(t,500)}else{clearTimeout(this.probablyStalled);const t=this.playerStatsObject.application;if(this.stallingStarted&&t){let e=t.stall_duration;e+=Date.now()-this.stallingStarted,this.addPlayerStat("stall_duration",!1,e),delete this.stallingStarted}}const e=this.remoteVideo.getVideoPlaybackQuality().corruptedVideoFrames;this.addPlayerStat("total_video_frames",!1,t.framesReceived),this.addPlayerStat("dropped_video_frames",!1,t.framesDropped),this.addPlayerStat("corrupted_video_frames",!1,e)}}))}))}),1e3)}addListeners(){this.remoteVideo.addEventListener(rn,this.onEvent.bind(this),!0),this.remoteVideo.addEventListener(sn,this.onEvent.bind(this),!0),this.remoteVideo.addEventListener(on,this.onEvent.bind(this),!0),this.remoteVideo.addEventListener(nn,this.onEvent.bind(this),!0)}removeListeners(){this.remoteVideo.removeEventListener(rn,this.onEvent,!0),this.remoteVideo.removeEventListener(sn,this.onEvent,!0),this.remoteVideo.removeEventListener(on,this.onEvent,!0),this.remoteVideo.removeEventListener(nn,this.onEvent,!0)}addPlayerStat(t,e=!0,n=null){const r=this.playerStatsObject.application;r&&(n?r[t]=Math.round(n):e&&(r[t]+=1),this.playerStatsObject.application=r)}getStats(){return this.xsid&&(this.playerStatsObject.source_id=this.xsid),l({},this.playerStatsObject,{id:this.uuid})}startSendStats(){this.sendingInterval=setInterval((()=>{this.postStats()}),this.statsSendTime||6e4)}stopSendStats(){this.sendingInterval&&(clearInterval(this.sendingInterval),this.postStats())}getStatsUrl(){return`${this.url}/sessions/${this.xsid?this.xsid:""}${this.getAuthToken()}`}getAuthToken(){return this.opts.authTokenName&&this.opts.tokenValue?`?${this.opts.authTokenName}=${this.opts.tokenValue}`:""}postStats(){this.playerStatsObject.started_at&&fetch(this.getStatsUrl(),{headers:{Accept:"application/json","Content-Type":"application/json"},method:"PUT",body:JSON.stringify(this.getStats())}).then((()=>{})).catch((t=>{this.log("Stat send error:",t)}))}}"undefined"!=typeof window&&(window._isGetUserMediaCalled=!!window._isGetUserMediaCalled);class wn extends yn{constructor(t,e={},n=!1){super(t,e,n);const r=this;this.status=tn,this.opts=e,e.preview&&e.preview instanceof HTMLMediaElement&&(this.videoContainer=e.preview,e.previewOptions&&(this.videoContainer.autoplay=!1!==e.previewOptions.autoplay,this.videoContainer.controls=e.previewOptions.controls||!1,this.videoContainer.muted=!1!==e.previewOptions.muted),this.videoContainer.addEventListener("loadedmetadata",(function(){r.log(`Local video videoWidth: ${this.videoWidth}px, videoHeight: ${this.videoHeight}px`)}))),"maxBitrate"in e&&(this.maxBitrate=e.maxBitrate),"canvasCallback"in e&&"function"==typeof e.canvasCallback&&(this.canvasCallback=e.canvasCallback,this.forCanvasCallback="undefined"!=typeof document&&document.createElement("canvas"),this.forCanvasCallback.id="forCanvasCallback",this.forCanvasCallback.style.width="320px",this.videoContainer?(this.videoContainer.after(this.forCanvasCallback),this.videoContainer.style.display="none"):"undefined"!=typeof document&&document.body.appendChild(this.forCanvasCallback),this.canvasCallback(this.forCanvasCallback),this.publishStreamFromCanvas=this.forCanvasCallback.captureStream()),e.sentryConfig&&e.sentryConfig.length&&(this.sentryConfig=e.sentryConfig),this.opts.radeonCheck=!("radeonCheck"in e)||e.radeonCheck,this.trackStats=e.trackStats,this.statsContainer=e.statsContainer,this.password=e.password,this.constraints=e.constraints,this.returnCapabilities=e.returnCapabilities;const i=("undefined"!=typeof window&&window.navigator).userAgent;this.onEventCallback=e.onEvent,this.statsSendEnable=e.statsSendEnable||!0,this.statsSendTime=1e3*e.statsSendTime||6e4;const o="undefined"!=typeof window&&window.RTCRtpTransceiver&&"setCodecPreferences"in window.RTCRtpTransceiver.prototype;if(this.prefferedCodec=-1,i.includes("Chrome/95")&&RTCRtpSender&&o){RTCRtpSender.getCapabilities("video").codecs.forEach(((t,e)=>{"video/H264"===t.mimeType&&t.sdpFmtpLine&&(t.sdpFmtpLine.includes("profile-level-id=42e01f")&&t.sdpFmtpLine.includes("level-asymmetry-allowed=1")?(t.sdpFmtpLine.includes("packetization-mode=0")||t.sdpFmtpLine.includes("packetization-mode=1")&&-1===this.prefferedCodec)&&(this.prefferedCodec=e):t.sdpFmtpLine.includes("profile-level-id=42001f")&&t.sdpFmtpLine.includes("level-asymmetry-allowed=1")&&t.sdpFmtpLine.includes("packetization-mode=0")&&-1===this.prefferedCodec&&(this.prefferedCodec=e))}))}if(this.opts.radeonCheck){const t=this.getVideoCardInfo();this.log("Checking for GPU model:",t),t.length&&t.includes("AMD Radeon(TM) Graphics")&&RTCRtpSender&&o&&(this.log("Detected AMD Radeon(TM) Graphics"),this.prefferedCodec=5)}}resetStats(){this.playerStatsObject={proto:"webrtc",user_agent:navigator.userAgent,bytes:0,application:{application_name:"webrtc_publisher",application_version:yn.version?yn.version:null,stall_count:0,pause_count:0,error_count:0,reconnect_count:0,bitrate_change_count:0,live_duration:0,stall_duration:0,pause_duration:0,total_video_frames:0,dropped_video_frames:0,corrupted_video_frames:0}},this.statsSendEnable&&this.startSendStats()}getUrl(){const t=new URL(this.url);return t.protocol="https",t.pathname+="/whip",this.opts.authTokenName&&this.opts.tokenValue?this.password?t.search=`?${this.opts.authTokenName}=${this.opts.tokenValue}&password=${this.password}`:t.search=`?${this.opts.authTokenName}=${this.opts.tokenValue}`:this.password&&(t.search=`?password=${this.password}`),t.toString()}start(){this.resetStats(),this.uuid=mn(),this.playerStatsObject.opened_at=Date.now();const t=this.getUrl();this.peerConnection=new an,this.peerConnection.addEventListener("iceconnectionstatechange",_n),this.peerConnection.addEventListener("negotiationneeded",(e=>{const n=new Headers;n.append("X-Sid",this.uuid),gn(e,t,{},n).then((t=>{if(this.xsid=t,this.playerStatsObject.started_at=Date.now(),this.onEventCallback&&this.onEventCallback({type:"started",started_at:Date.now()}),this.playerStatsObject.updated_at=Date.now(),this.emitter.emit(Qe),this.videoSender){const t=this.videoSender.sender,e=t.getParameters();this.log("Publisher::maxBitrate is set to:",this.maxBitrate||1e8),e.encodings[0].maxBitrate=this.maxBitrate||1e8,e.encodings[0].priority="medium",e.encodings[0].networkPriority="medium",t.setParameters(e)}this.progressListener||this.startProgressListener()}))})),this.getMedia(this.opts?this.opts.getMediaOptions:null),this.startTrackStats(),this.createSilentAudio(10,44100),this.sentryConfig&&(Xe({dsn:this.sentryConfig,environment:"production",release:"FlussonicWebrtcPublisher"+(yn.version?`@${yn.version}`:""),tracesSampleRate:1}),this.sentryEnabled=!0)}stop(){this.isFirstMsgReceived=!1,this.clearLocalStreamSource(),this.forCanvasCallback&&(this.forCanvasCallback.remove(),this.videoContainer&&(this.videoContainer.style.display="block")),this.peerConnection&&(this.peerConnection.close(),this.peerConnection=null),this.status=en,this.playerStatsObject.closed_at=Date.now(),this.onEventCallback&&this.onEventCallback({type:"closed",closed_at:Date.now()}),this.stopSendStats(),this.progressListener&&(clearInterval(this.progressListener),delete this.progressListener),this.restartTimeout&&(clearInterval(this.restartTimeout),delete this.restartTimeout),this.trackStatsInterval&&(clearInterval(this.trackStatsInterval),delete this.trackStatsInterval),this.sharingStream&&(this.sharingStream.getTracks().forEach((t=>t.stop())),this.sharingStream=null)}startTrackStats(){this.trackStats&&(this.trackStatsInterval=window.setInterval((()=>{this.peerConnection&&this.peerConnection.getStats(null).then((t=>{let e="";if(t.forEach((t=>{e+=`Report: ${t.type}\nID: ${t.id}
\nTimestamp: ${t.timestamp}
\n`,Object.keys(t).forEach((n=>{"id"!==n&&"timestamp"!==n&&"type"!==n&&(e+=`${n}: ${t[n]}
\n`)}))})),this.statsContainer){const t=this.statsContainer;t instanceof HTMLElement&&(t.innerHTML=e)}}))}),1e3))}clearLocalStreamSource(){this.stream&&this.stream.getTracks().forEach((t=>{t.stop()}))}getMedia(t,e){let n=l({},this.constraints);"video"in n||(n=l({},n,{video:!0})),this.opts.inputStreams?this.gotMedia(this.opts.inputStreams):this.getDevices().then((t=>{this.activeDeviceList=t;this.activeDeviceList.filter((t=>"audioinput"===t.kind)).length||(n.audio=!1),navigator.mediaDevices.getUserMedia(n).then((t=>{"undefined"!=typeof window&&(window._isGetUserMediaCalled=!0),this.log("Publisher::mediaDevices.getUserMedia success."),"function"==typeof e?e((()=>{this.log("Publisher::getMedia::cb"),this.gotMedia(t)})):this.gotMedia(t),this.videoContainer&&(this.videoContainer.srcObject=this.stream)})).catch((t=>{this.log("Publisher::mediaDevices.getUserMedia exception occured.",t),this.opts&&this.opts.onGetUserMediaError&&this.opts.onGetUserMediaError(t),this.sendErrorLog()}))}));const r=()=>{this.dummyVideo=this.createDummyVideo("dummyVideo"),this.dummyVideo.srcObject=this.stream,this.dummyVideo.addEventListener("loadedmetadata",this.updateCanvasSize.bind(this),!1),this.dummyVideo.addEventListener("play",(()=>{requestAnimationFrame(this.updateCanvas.bind(this))}),!1)};this.forCanvasCallback&&(r(),this.canvasCallbackContext=this.forCanvasCallback.getContext("2d")),navigator.mediaDevices.ondevicechange=this.onDeviceChange.bind(this)}updateCanvasSize(){this.forCanvasCallback.width=this.dummyVideo.videoWidth,this.forCanvasCallback.height=this.dummyVideo.videoHeight}updateCanvas(){this.dummyVideo.ended||this.dummyVideo.paused||(this.forCanvasCallback&&this.canvasCallbackContext&&this.canvasCallbackContext.drawImage(this.dummyVideo,0,0,this.dummyVideo.videoWidth,this.dummyVideo.videoHeight),requestAnimationFrame(this.updateCanvas.bind(this)))}getDevices(){var t=this;return s((function*(){if(!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices)return void t.log("enumerateDevices() not supported.");let e=[];yield navigator.mediaDevices.enumerateDevices().then((t=>(e=t,e))).catch((e=>{t.log("Publisher::mediaDevices.getUserMedia exception occured.",e),t.opts&&t.opts.onGetUserMediaError&&t.opts.onGetUserMediaError(e),t.sendErrorLog()}));const n=e.filter((t=>"audioinput"===t.kind||"videoinput"===t.kind));return t.log("Publisher:: Devices list ",n),e}))()}onDeviceChange(t){this.addPlayerStat("bitrate_change_count"),this.log("Publisher::Device configuration changed",t);let e=[];this.getDevices.bind(this),this.getDevices().then((t=>{if(e=t.filter((t=>"audioinput"===t.kind)),this.audioSender&&this.audioSender.sender){if(e.length)0!==e.length&&(this.log("Publisher::New audio input device discovered"),navigator.mediaDevices.getUserMedia({audio:!0}).then((t=>{const e=t.getAudioTracks();e.length>0&&(this.log(`Using audio device: ${e[0].label}`),this.audioSender.sender.replaceTrack(e[0]))})));else{this.log("Publisher::Audio input devices lost");const t=this.destination.stream.getAudioTracks();this.audioSender.sender.replaceTrack(t[0])}this.activeDeviceList=t}}))}gotMedia(t){this.stream=t,this.log("Publisher::got",this.stream),this.log("Publisher::gotMedia::peerConnection",this.peerConnection);let n=!1;if("video"in this.constraints&&(n=this.constraints.video),this.publishStreamFromCanvas){const t=e(this.publishStreamFromCanvas.getVideoTracks(),1)[0];this.videoTrack=t,this.videoSender=this.peerConnection.addTransceiver(this.videoTrack,{direction:"sendonly"})}else if(n){const n=e(t.getVideoTracks(),1)[0];this.videoTrack=n,this.videoTrack.contentHint="detail",this.videoTrack.applyConstraints({frameRate:{min:0,max:30}}),this.videoSender=this.peerConnection.addTransceiver(this.videoTrack,{direction:"sendonly"})}let r=t.getAudioTracks();if(r&&r.length>0&&(this.audioSender=this.peerConnection.addTransceiver(t.getAudioTracks()[0],{direction:"sendonly"})),-1!==this.prefferedCodec){let t=RTCRtpSender.getCapabilities("video").codecs;const e=t[this.prefferedCodec];this.log("Publisher preffered codec:",this.prefferedCodec,e),t=[e];this.peerConnection.getTransceivers().find((t=>t.sender&&t.sender.track===this.videoTrack)).setCodecPreferences(t)}this.peerConnection.onconnectionstatechange=t=>{this.log("Publisher::peer connection state",this.peerConnection.connectionState,t),this.onEventCallback&&this.onEventCallback({type:"connection state",connection:this.peerConnection.connectionState})}}restart(){this.addPlayerStat("reconnect_count"),this.stop(),this.restartTimeout=setTimeout(this.start.bind(this),1e3)}mute(){this.stream.getTracks().forEach((t=>{"audio"===t.kind&&(t.enabled=!t.enabled)}))}switchTrack(t){if(t instanceof MediaStreamTrack){if("video"===t.kind){if(!this.videoSender||!this.videoSender.sender)return;this.videoSender.sender.replaceTrack(t)}else{if(!this.audioSender||!this.audioSender.sender)return;this.audioSender.sender.replaceTrack(t)}}else console.info("Publisher only get stream tracks to switch RTCRtpTransceiver sender")}shareScreen(){if(this.sharingStream){if(!this.videoSender||!this.videoSender.sender)return;this.videoSender.sender.replaceTrack(this.videoTrack),this.videoContainer.srcObject=this.stream,this.sharingStream.getTracks().forEach((t=>t.stop())),this.sharingStream=null}else{const t={video:{cursor:"always"},audio:!1};navigator.mediaDevices.getDisplayMedia(t).then((t=>{this.log("Publisher:: screen sharing stream acquired"),this.sharingStream=t,this.videoContainer.srcObject=t;const n=e(this.sharingStream.getVideoTracks(),1)[0];this.sharingScreen=n})).catch((t=>{this.log("Publisher:: screen sharing error",t)}))}}createSilentAudio(t,e=44100){const n=t*e,r="undefined"!=typeof window&&(window.AudioContext||window.webkitAudioContext||window.mozAudioContext);r||this.log("No Audio Context");const i=new r,o=i.createBuffer(1,n,e);this.destination=i.createMediaStreamDestination(),this.silentSource=i.createBufferSource(),this.silentSource.buffer=o,this.silentSource.connect(i.destination),this.silentSource.loop=!0,this.silentSource.start(),this.silentSource.connect(this.destination)}sendErrorLog(t){this.sentryEnabled&&me(t)}createDummyVideo(t){const e="undefined"!=typeof document&&document.createElement("video");return"undefined"!=typeof document&&document.querySelector("body").appendChild(e),e.setAttribute("id",t),e.setAttribute("autoplay",!0),e.style.position="absolute",e.style.top=0,e.style.left=0,e.style.zIndex="-1",e.style.opacity=0,e.style.width="1px",e.style.height="1px",e.style.overflow="hidden",e.muted=!0,e}startProgressListener(){this.progressListener=setInterval((()=>{this.peerConnection&&this.peerConnection.getStats(null).then((t=>{const e=[];t.forEach((t=>{if(e.push({type:t.type,id:t.id,timestamp:t.timestamp}),"transport"===t.type){const e=t.timestamp,n=t.bytesSent;if(this.playerStatsObject.bytes=n,this.playerStatsObject.updated_at=Math.round(e),this.playbackSegmentStart){const t=this.playerStatsObject.application;if(t){let n=t.live_duration;n+=e-this.playbackSegmentStart,this.addPlayerStat("live_duration",Math.round(n)),delete this.playbackSegmentStart}}this.playbackSegmentStart=e}}))}))}),1e3)}addPlayerStat(t,e=null){const n=this.playerStatsObject.application;n&&(e?n[t]=Math.round(e):n[t]+=1,this.playerStatsObject.application=n)}getStats(){return l({},this.playerStatsObject,{id:this.uuid})}startSendStats(){this.sendingInterval=setInterval((()=>{this.postStats()}),this.statsSendTime)}stopSendStats(){this.sendingInterval&&(clearInterval(this.sendingInterval),this.postStats())}getStatsUrl(){const t=this.opts.authTokenName&&this.opts.tokenValue?`?${this.opts.authTokenName}=${this.opts.tokenValue}`:"";return`${this.url}/sessions/${this.xsid?this.xsid:""}${t}`}postStats(){this.playerStatsObject.started_at&&fetch(this.getStatsUrl(),{headers:{Accept:"application/json","Content-Type":"application/json"},method:"PUT",body:JSON.stringify(this.getStats())})}userIsChangingTracks(t,e){console.log("userIsChangingTracks",{e:t,data:e})}on(...t){return this.emitter.on.apply(this.emitter,t)}}function En(t){try{return JSON.parse(t)}catch(t){return{}}}const xn=(t,e,n,r)=>{const i=En(e),o=t.authTokenName||i.authTokenName||"token",s=t[o]||i[o]||"",a=Number(t.statsSendTime)||Number(i.statsSendTime)||60;return{retryMax:100,retryDelay:3e3,sentryConfig:t.sentryConfig||i.statsSendTime,onMediaInfo:n,onTrackInfo:r,statsSendEnable:!0,statsSendTime:a,autoplay:!0,authTokenName:o,tokenValue:s,radeonCheck:!0,inputStreams:window.stream||null,constraints:{video:!0,audio:!0}}},kn=(t,e)=>{const n=En(e),r=t.host||window.location.hostname,i=t.name||n.streamName;if(!i||i.length<1||"string"!=typeof i){const t=window.location;return`${t.origin}${t.pathname.replace("/embed.html","")}`}return`${r.includes("https")||r.includes("http")?"":`${window.location.protocol}//`}${r}${window.location.port&&!t.ignorePort?`:${window.location.port}`:""}/${i}`},Tn=(t="")=>{const e=i.parse(window.location.search),n=document.getElementById("abrInfo");let r={},o={};const s=document.getElementById("webrtc_player");s.muted=!(e.mute&&"false"===e.mute),window.webrtcPlayer=new Sn(s,kn(e,t),xn(e,t,(t=>{r={},o={},t.forEach((t=>{const e=t.content;if(e&&e.length)if("audio"===e){const e=t.track_id,n=t.sample_rate;r[e]=`${n} kbps`}else if("video"===e){const e=t.track_id,n=t.params;if(n){const t=n.width,r=void 0===t?"":t,i=n.height,s=void 0===i?"":i;o[e]=`${r} x ${s}`}else o[e]="0 x 0"}}))}),(t=>{const e=t.audio_track_id,i=t.video_track_id;let s="",a="";i&&(s=o[i]||""),e&&(a=r[e]||""),n.innerText=`Auto bitrate set on ${s}${a?` with ${a} audio`:""}`,n.style.opacity="1",setTimeout((()=>{n.style.opacity="0"}),3e3)})),!0)},Cn=()=>{document.getElementById("publish_button").disabled=!0},On=(t="")=>{const e=i.parse(window.location.search),n=new wn(kn(e,t),xn(e,t),!0);n.on(Qe,Cn),window.webrtcPublisher=n,n.start()};function jn(t){return window.stream=t,document.getElementById("webrtc_player").srcObject=t,navigator.mediaDevices.enumerateDevices()}function Pn(t){console.log("navigator.MediaDevices.getUserMedia error: ",t.message,t.name)}const Rn=(t=!0)=>{const n=()=>document.getElementById("cam_button"),r=()=>document.getElementById("mic_button");if("stream"in window){const i=window.stream;let o=e(i.getVideoTracks(),1)[0];if(!t)o=e(i.getAudioTracks(),1)[0];o.enabled?(o.enabled=!1,t?n().classList.add("off"):r().classList.add("off")):(o.enabled=!0,t?n().classList.remove("off"):r().classList.remove("off"))}},In=()=>{const t=e(document.getElementsByClassName("app"),1)[0],n=document.createElement("div");n.id="webrtc_publish_button_wrapper",t.appendChild(n);const r=document.createElement("button");r.id="publish_button",r.classList.add("webrtc_btn"),r.innerText="Publish",n.appendChild(r);const i=document.createElement("button");i.id="cam_button",i.classList.add("webrtc_btn"),i.innerText="Cam",n.appendChild(i);const o=document.createElement("button");o.id="mic_button",o.classList.add("webrtc_btn"),o.innerText="Mic",n.appendChild(o),navigator.mediaDevices.getUserMedia({video:!0,audio:!0}).then(jn).catch(Pn),r.addEventListener("click",On),i.addEventListener("click",Rn),o.addEventListener("click",(()=>{Rn(!1)}))}})(),r})()));
//# sourceMappingURL=main.js.map