UNPKG

aivideocall

Version:

Using this package, you can integrate the callyourai video-call component into your react application.

71 lines (69 loc) 178 kB
"use strict";var Yn=Object.defineProperty;var Zn=(a,e,t)=>e in a?Yn(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var Z=(a,e,t)=>(Zn(a,typeof e!="symbol"?e+"":e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react");var We={exports:{}},fe={};/** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var St;function es(){if(St)return fe;St=1;var a=x,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,s=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function l(c,d,m){var g,y={},f=null,T=null;m!==void 0&&(f=""+m),d.key!==void 0&&(f=""+d.key),d.ref!==void 0&&(T=d.ref);for(g in d)n.call(d,g)&&!i.hasOwnProperty(g)&&(y[g]=d[g]);if(c&&c.defaultProps)for(g in d=c.defaultProps,d)y[g]===void 0&&(y[g]=d[g]);return{$$typeof:e,type:c,key:f,ref:T,props:y,_owner:s.current}}return fe.Fragment=t,fe.jsx=l,fe.jsxs=l,fe}var ve={};/** * @license React * react-jsx-runtime.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Ct;function ts(){return Ct||(Ct=1,process.env.NODE_ENV!=="production"&&function(){var a=x,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),y=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),T=Symbol.for("react.offscreen"),R=Symbol.iterator,k="@@iterator";function V(o){if(o===null||typeof o!="object")return null;var u=R&&o[R]||o[k];return typeof u=="function"?u:null}var j=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function z(o){{for(var u=arguments.length,v=new Array(u>1?u-1:0),b=1;b<u;b++)v[b-1]=arguments[b];Pe("error",o,v)}}function Pe(o,u,v){{var b=j.ReactDebugCurrentFrame,P=b.getStackAddendum();P!==""&&(u+="%s",v=v.concat([P]));var L=v.map(function(M){return String(M)});L.unshift("Warning: "+u),Function.prototype.apply.call(console[o],console,L)}}var ke=!1,xe=!1,I=!1,oe=!1,A=!1,ne;ne=Symbol.for("react.module.reference");function Le(o){return!!(typeof o=="string"||typeof o=="function"||o===n||o===i||A||o===s||o===m||o===g||oe||o===T||ke||xe||I||typeof o=="object"&&o!==null&&(o.$$typeof===f||o.$$typeof===y||o.$$typeof===l||o.$$typeof===c||o.$$typeof===d||o.$$typeof===ne||o.getModuleId!==void 0))}function le(o,u,v){var b=o.displayName;if(b)return b;var P=u.displayName||u.name||"";return P!==""?v+"("+P+")":v}function J(o){return o.displayName||"Context"}function q(o){if(o==null)return null;if(typeof o.tag=="number"&&z("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case n:return"Fragment";case t:return"Portal";case i:return"Profiler";case s:return"StrictMode";case m:return"Suspense";case g:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case c:var u=o;return J(u)+".Consumer";case l:var v=o;return J(v._context)+".Provider";case d:return le(o,o.render,"ForwardRef");case y:var b=o.displayName||null;return b!==null?b:q(o.type)||"Memo";case f:{var P=o,L=P._payload,M=P._init;try{return q(M(L))}catch{return null}}}return null}var Y=Object.assign,ge=0,Xe,Je,Ye,Ze,et,tt,nt;function st(){}st.__reactDisabledLog=!0;function Mn(){{if(ge===0){Xe=console.log,Je=console.info,Ye=console.warn,Ze=console.error,et=console.group,tt=console.groupCollapsed,nt=console.groupEnd;var o={configurable:!0,enumerable:!0,value:st,writable:!0};Object.defineProperties(console,{info:o,log:o,warn:o,error:o,group:o,groupCollapsed:o,groupEnd:o})}ge++}}function Rn(){{if(ge--,ge===0){var o={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Y({},o,{value:Xe}),info:Y({},o,{value:Je}),warn:Y({},o,{value:Ye}),error:Y({},o,{value:Ze}),group:Y({},o,{value:et}),groupCollapsed:Y({},o,{value:tt}),groupEnd:Y({},o,{value:nt})})}ge<0&&z("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Ae=j.ReactCurrentDispatcher,Fe;function Te(o,u,v){{if(Fe===void 0)try{throw Error()}catch(P){var b=P.stack.trim().match(/\n( *(at )?)/);Fe=b&&b[1]||""}return` `+Fe+o}}var De=!1,Ee;{var Pn=typeof WeakMap=="function"?WeakMap:Map;Ee=new Pn}function rt(o,u){if(!o||De)return"";{var v=Ee.get(o);if(v!==void 0)return v}var b;De=!0;var P=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var L;L=Ae.current,Ae.current=null,Mn();try{if(u){var M=function(){throw Error()};if(Object.defineProperty(M.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(M,[])}catch($){b=$}Reflect.construct(o,[],M)}else{try{M.call()}catch($){b=$}o.call(M.prototype)}}else{try{throw Error()}catch($){b=$}o()}}catch($){if($&&b&&typeof $.stack=="string"){for(var w=$.stack.split(` `),W=b.stack.split(` `),D=w.length-1,_=W.length-1;D>=1&&_>=0&&w[D]!==W[_];)_--;for(;D>=1&&_>=0;D--,_--)if(w[D]!==W[_]){if(D!==1||_!==1)do if(D--,_--,_<0||w[D]!==W[_]){var Q=` `+w[D].replace(" at new "," at ");return o.displayName&&Q.includes("<anonymous>")&&(Q=Q.replace("<anonymous>",o.displayName)),typeof o=="function"&&Ee.set(o,Q),Q}while(D>=1&&_>=0);break}}}finally{De=!1,Ae.current=L,Rn(),Error.prepareStackTrace=P}var de=o?o.displayName||o.name:"",re=de?Te(de):"";return typeof o=="function"&&Ee.set(o,re),re}function kn(o,u,v){return rt(o,!1)}function xn(o){var u=o.prototype;return!!(u&&u.isReactComponent)}function be(o,u,v){if(o==null)return"";if(typeof o=="function")return rt(o,xn(o));if(typeof o=="string")return Te(o);switch(o){case m:return Te("Suspense");case g:return Te("SuspenseList")}if(typeof o=="object")switch(o.$$typeof){case d:return kn(o.render);case y:return be(o.type,u,v);case f:{var b=o,P=b._payload,L=b._init;try{return be(L(P),u,v)}catch{}}}return""}var me=Object.prototype.hasOwnProperty,it={},at=j.ReactDebugCurrentFrame;function ye(o){if(o){var u=o._owner,v=be(o.type,o._source,u?u.type:null);at.setExtraStackFrame(v)}else at.setExtraStackFrame(null)}function Ln(o,u,v,b,P){{var L=Function.call.bind(me);for(var M in o)if(L(o,M)){var w=void 0;try{if(typeof o[M]!="function"){var W=Error((b||"React class")+": "+v+" type `"+M+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[M]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw W.name="Invariant Violation",W}w=o[M](u,M,b,v,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(D){w=D}w&&!(w instanceof Error)&&(ye(P),z("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",b||"React class",v,M,typeof w),ye(null)),w instanceof Error&&!(w.message in it)&&(it[w.message]=!0,ye(P),z("Failed %s type: %s",v,w.message),ye(null))}}}var An=Array.isArray;function Oe(o){return An(o)}function Fn(o){{var u=typeof Symbol=="function"&&Symbol.toStringTag,v=u&&o[Symbol.toStringTag]||o.constructor.name||"Object";return v}}function Dn(o){try{return ot(o),!1}catch{return!0}}function ot(o){return""+o}function lt(o){if(Dn(o))return z("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Fn(o)),ot(o)}var pe=j.ReactCurrentOwner,On={key:!0,ref:!0,__self:!0,__source:!0},ct,dt,Ie;Ie={};function In(o){if(me.call(o,"ref")){var u=Object.getOwnPropertyDescriptor(o,"ref").get;if(u&&u.isReactWarning)return!1}return o.ref!==void 0}function _n(o){if(me.call(o,"key")){var u=Object.getOwnPropertyDescriptor(o,"key").get;if(u&&u.isReactWarning)return!1}return o.key!==void 0}function Un(o,u){if(typeof o.ref=="string"&&pe.current&&u&&pe.current.stateNode!==u){var v=q(pe.current.type);Ie[v]||(z('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',q(pe.current.type),o.ref),Ie[v]=!0)}}function Gn(o,u){{var v=function(){ct||(ct=!0,z("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",u))};v.isReactWarning=!0,Object.defineProperty(o,"key",{get:v,configurable:!0})}}function zn(o,u){{var v=function(){dt||(dt=!0,z("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",u))};v.isReactWarning=!0,Object.defineProperty(o,"ref",{get:v,configurable:!0})}}var Bn=function(o,u,v,b,P,L,M){var w={$$typeof:e,type:o,key:u,ref:v,props:M,_owner:L};return w._store={},Object.defineProperty(w._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(w,"_self",{configurable:!1,enumerable:!1,writable:!1,value:b}),Object.defineProperty(w,"_source",{configurable:!1,enumerable:!1,writable:!1,value:P}),Object.freeze&&(Object.freeze(w.props),Object.freeze(w)),w};function Hn(o,u,v,b,P){{var L,M={},w=null,W=null;v!==void 0&&(lt(v),w=""+v),_n(u)&&(lt(u.key),w=""+u.key),In(u)&&(W=u.ref,Un(u,P));for(L in u)me.call(u,L)&&!On.hasOwnProperty(L)&&(M[L]=u[L]);if(o&&o.defaultProps){var D=o.defaultProps;for(L in D)M[L]===void 0&&(M[L]=D[L])}if(w||W){var _=typeof o=="function"?o.displayName||o.name||"Unknown":o;w&&Gn(M,_),W&&zn(M,_)}return Bn(o,w,W,P,b,pe.current,M)}}var _e=j.ReactCurrentOwner,ht=j.ReactDebugCurrentFrame;function ce(o){if(o){var u=o._owner,v=be(o.type,o._source,u?u.type:null);ht.setExtraStackFrame(v)}else ht.setExtraStackFrame(null)}var Ue;Ue=!1;function Ge(o){return typeof o=="object"&&o!==null&&o.$$typeof===e}function ut(){{if(_e.current){var o=q(_e.current.type);if(o)return` Check the render method of \``+o+"`."}return""}}function Vn(o){return""}var gt={};function Wn(o){{var u=ut();if(!u){var v=typeof o=="string"?o:o.displayName||o.name;v&&(u=` Check the top-level render call using <`+v+">.")}return u}}function mt(o,u){{if(!o._store||o._store.validated||o.key!=null)return;o._store.validated=!0;var v=Wn(u);if(gt[v])return;gt[v]=!0;var b="";o&&o._owner&&o._owner!==_e.current&&(b=" It was passed a child from "+q(o._owner.type)+"."),ce(o),z('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',v,b),ce(null)}}function pt(o,u){{if(typeof o!="object")return;if(Oe(o))for(var v=0;v<o.length;v++){var b=o[v];Ge(b)&&mt(b,u)}else if(Ge(o))o._store&&(o._store.validated=!0);else if(o){var P=V(o);if(typeof P=="function"&&P!==o.entries)for(var L=P.call(o),M;!(M=L.next()).done;)Ge(M.value)&&mt(M.value,u)}}}function Nn(o){{var u=o.type;if(u==null||typeof u=="string")return;var v;if(typeof u=="function")v=u.propTypes;else if(typeof u=="object"&&(u.$$typeof===d||u.$$typeof===y))v=u.propTypes;else return;if(v){var b=q(u);Ln(v,o.props,"prop",b,o)}else if(u.PropTypes!==void 0&&!Ue){Ue=!0;var P=q(u);z("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",P||"Unknown")}typeof u.getDefaultProps=="function"&&!u.getDefaultProps.isReactClassApproved&&z("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Kn(o){{for(var u=Object.keys(o.props),v=0;v<u.length;v++){var b=u[v];if(b!=="children"&&b!=="key"){ce(o),z("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",b),ce(null);break}}o.ref!==null&&(ce(o),z("Invalid attribute `ref` supplied to `React.Fragment`."),ce(null))}}var ft={};function vt(o,u,v,b,P,L){{var M=Le(o);if(!M){var w="";(o===void 0||typeof o=="object"&&o!==null&&Object.keys(o).length===0)&&(w+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var W=Vn();W?w+=W:w+=ut();var D;o===null?D="null":Oe(o)?D="array":o!==void 0&&o.$$typeof===e?(D="<"+(q(o.type)||"Unknown")+" />",w=" Did you accidentally export a JSX literal instead of a component?"):D=typeof o,z("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",D,w)}var _=Hn(o,u,v,P,L);if(_==null)return _;if(M){var Q=u.children;if(Q!==void 0)if(b)if(Oe(Q)){for(var de=0;de<Q.length;de++)pt(Q[de],o);Object.freeze&&Object.freeze(Q)}else z("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else pt(Q,o)}if(me.call(u,"key")){var re=q(o),$=Object.keys(u).filter(function(Jn){return Jn!=="key"}),ze=$.length>0?"{key: someKey, "+$.join(": ..., ")+": ...}":"{key: someKey}";if(!ft[re+ze]){var Xn=$.length>0?"{"+$.join(": ..., ")+": ...}":"{}";z(`A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; <%s key={someKey} {...props} />`,ze,re,Xn,re),ft[re+ze]=!0}}return o===n?Kn(_):Nn(_),_}}function $n(o,u,v){return vt(o,u,v,!0)}function jn(o,u,v){return vt(o,u,v,!1)}var qn=jn,Qn=$n;ve.Fragment=n,ve.jsx=qn,ve.jsxs=Qn}()),ve}process.env.NODE_ENV==="production"?We.exports=es():We.exports=ts();var O=We.exports,xt={exports:{}};(function(a){const e={};e.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},e.localCName=e.generateIdentifier(),e.splitLines=function(t){return t.trim().split(` `).map(n=>n.trim())},e.splitSections=function(t){return t.split(` m=`).map((s,i)=>(i>0?"m="+s:s).trim()+`\r `)},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(s=>s.indexOf(n)===0)},e.parseCandidate=function(t){let n;t.indexOf("a=candidate:")===0?n=t.substring(12).split(" "):n=t.substring(10).split(" ");const s={foundation:n[0],component:{1:"rtp",2:"rtcp"}[n[1]]||n[1],protocol:n[2].toLowerCase(),priority:parseInt(n[3],10),ip:n[4],address:n[4],port:parseInt(n[5],10),type:n[7]};for(let i=8;i<n.length;i+=2)switch(n[i]){case"raddr":s.relatedAddress=n[i+1];break;case"rport":s.relatedPort=parseInt(n[i+1],10);break;case"tcptype":s.tcpType=n[i+1];break;case"ufrag":s.ufrag=n[i+1],s.usernameFragment=n[i+1];break;default:s[n[i]]===void 0&&(s[n[i]]=n[i+1]);break}return s},e.writeCandidate=function(t){const n=[];n.push(t.foundation);const s=t.component;s==="rtp"?n.push(1):s==="rtcp"?n.push(2):n.push(s),n.push(t.protocol.toUpperCase()),n.push(t.priority),n.push(t.address||t.ip),n.push(t.port);const i=t.type;return n.push("typ"),n.push(i),i!=="host"&&t.relatedAddress&&t.relatedPort&&(n.push("raddr"),n.push(t.relatedAddress),n.push("rport"),n.push(t.relatedPort)),t.tcpType&&t.protocol.toLowerCase()==="tcp"&&(n.push("tcptype"),n.push(t.tcpType)),(t.usernameFragment||t.ufrag)&&(n.push("ufrag"),n.push(t.usernameFragment||t.ufrag)),"candidate:"+n.join(" ")},e.parseIceOptions=function(t){return t.substring(14).split(" ")},e.parseRtpMap=function(t){let n=t.substring(9).split(" ");const s={payloadType:parseInt(n.shift(),10)};return n=n[0].split("/"),s.name=n[0],s.clockRate=parseInt(n[1],10),s.channels=n.length===3?parseInt(n[2],10):1,s.numChannels=s.channels,s},e.writeRtpMap=function(t){let n=t.payloadType;t.preferredPayloadType!==void 0&&(n=t.preferredPayloadType);const s=t.channels||t.numChannels||1;return"a=rtpmap:"+n+" "+t.name+"/"+t.clockRate+(s!==1?"/"+s:"")+`\r `},e.parseExtmap=function(t){const n=t.substring(9).split(" ");return{id:parseInt(n[0],10),direction:n[0].indexOf("/")>0?n[0].split("/")[1]:"sendrecv",uri:n[1],attributes:n.slice(2).join(" ")}},e.writeExtmap=function(t){return"a=extmap:"+(t.id||t.preferredId)+(t.direction&&t.direction!=="sendrecv"?"/"+t.direction:"")+" "+t.uri+(t.attributes?" "+t.attributes:"")+`\r `},e.parseFmtp=function(t){const n={};let s;const i=t.substring(t.indexOf(" ")+1).split(";");for(let l=0;l<i.length;l++)s=i[l].trim().split("="),n[s[0].trim()]=s[1];return n},e.writeFmtp=function(t){let n="",s=t.payloadType;if(t.preferredPayloadType!==void 0&&(s=t.preferredPayloadType),t.parameters&&Object.keys(t.parameters).length){const i=[];Object.keys(t.parameters).forEach(l=>{t.parameters[l]!==void 0?i.push(l+"="+t.parameters[l]):i.push(l)}),n+="a=fmtp:"+s+" "+i.join(";")+`\r `}return n},e.parseRtcpFb=function(t){const n=t.substring(t.indexOf(" ")+1).split(" ");return{type:n.shift(),parameter:n.join(" ")}},e.writeRtcpFb=function(t){let n="",s=t.payloadType;return t.preferredPayloadType!==void 0&&(s=t.preferredPayloadType),t.rtcpFeedback&&t.rtcpFeedback.length&&t.rtcpFeedback.forEach(i=>{n+="a=rtcp-fb:"+s+" "+i.type+(i.parameter&&i.parameter.length?" "+i.parameter:"")+`\r `}),n},e.parseSsrcMedia=function(t){const n=t.indexOf(" "),s={ssrc:parseInt(t.substring(7,n),10)},i=t.indexOf(":",n);return i>-1?(s.attribute=t.substring(n+1,i),s.value=t.substring(i+1)):s.attribute=t.substring(n+1),s},e.parseSsrcGroup=function(t){const n=t.substring(13).split(" ");return{semantics:n.shift(),ssrcs:n.map(s=>parseInt(s,10))}},e.getMid=function(t){const n=e.matchPrefix(t,"a=mid:")[0];if(n)return n.substring(6)},e.parseFingerprint=function(t){const n=t.substring(14).split(" ");return{algorithm:n[0].toLowerCase(),value:n[1].toUpperCase()}},e.getDtlsParameters=function(t,n){return{role:"auto",fingerprints:e.matchPrefix(t+n,"a=fingerprint:").map(e.parseFingerprint)}},e.writeDtlsParameters=function(t,n){let s="a=setup:"+n+`\r `;return t.fingerprints.forEach(i=>{s+="a=fingerprint:"+i.algorithm+" "+i.value+`\r `}),s},e.parseCryptoLine=function(t){const n=t.substring(9).split(" ");return{tag:parseInt(n[0],10),cryptoSuite:n[1],keyParams:n[2],sessionParams:n.slice(3)}},e.writeCryptoLine=function(t){return"a=crypto:"+t.tag+" "+t.cryptoSuite+" "+(typeof t.keyParams=="object"?e.writeCryptoKeyParams(t.keyParams):t.keyParams)+(t.sessionParams?" "+t.sessionParams.join(" "):"")+`\r `},e.parseCryptoKeyParams=function(t){if(t.indexOf("inline:")!==0)return null;const n=t.substring(7).split("|");return{keyMethod:"inline",keySalt:n[0],lifeTime:n[1],mkiValue:n[2]?n[2].split(":")[0]:void 0,mkiLength:n[2]?n[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 s=e.matchPrefix(t+n,"a=ice-ufrag:")[0],i=e.matchPrefix(t+n,"a=ice-pwd:")[0];return s&&i?{usernameFragment:s.substring(12),password:i.substring(10)}:null},e.writeIceParameters=function(t){let n="a=ice-ufrag:"+t.usernameFragment+`\r a=ice-pwd:`+t.password+`\r `;return t.iceLite&&(n+=`a=ice-lite\r `),n},e.parseRtpParameters=function(t){const n={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},i=e.splitLines(t)[0].split(" ");for(let c=3;c<i.length;c++){const d=i[c],m=e.matchPrefix(t,"a=rtpmap:"+d+" ")[0];if(m){const g=e.parseRtpMap(m),y=e.matchPrefix(t,"a=fmtp:"+d+" ");switch(g.parameters=y.length?e.parseFmtp(y[0]):{},g.rtcpFeedback=e.matchPrefix(t,"a=rtcp-fb:"+d+" ").map(e.parseRtcpFb),n.codecs.push(g),g.name.toUpperCase()){case"RED":case"ULPFEC":n.fecMechanisms.push(g.name.toUpperCase());break}}}e.matchPrefix(t,"a=extmap:").forEach(c=>{n.headerExtensions.push(e.parseExtmap(c))});const l=e.matchPrefix(t,"a=rtcp-fb:* ").map(e.parseRtcpFb);return n.codecs.forEach(c=>{l.forEach(d=>{c.rtcpFeedback.find(g=>g.type===d.type&&g.parameter===d.parameter)||c.rtcpFeedback.push(d)})}),n},e.writeRtpDescription=function(t,n){let s="";s+="m="+t+" ",s+=n.codecs.length>0?"9":"0",s+=" UDP/TLS/RTP/SAVPF ",s+=n.codecs.map(l=>l.preferredPayloadType!==void 0?l.preferredPayloadType:l.payloadType).join(" ")+`\r `,s+=`c=IN IP4 0.0.0.0\r `,s+=`a=rtcp:9 IN IP4 0.0.0.0\r `,n.codecs.forEach(l=>{s+=e.writeRtpMap(l),s+=e.writeFmtp(l),s+=e.writeRtcpFb(l)});let i=0;return n.codecs.forEach(l=>{l.maxptime>i&&(i=l.maxptime)}),i>0&&(s+="a=maxptime:"+i+`\r `),n.headerExtensions&&n.headerExtensions.forEach(l=>{s+=e.writeExtmap(l)}),s},e.parseRtpEncodingParameters=function(t){const n=[],s=e.parseRtpParameters(t),i=s.fecMechanisms.indexOf("RED")!==-1,l=s.fecMechanisms.indexOf("ULPFEC")!==-1,c=e.matchPrefix(t,"a=ssrc:").map(f=>e.parseSsrcMedia(f)).filter(f=>f.attribute==="cname"),d=c.length>0&&c[0].ssrc;let m;const g=e.matchPrefix(t,"a=ssrc-group:FID").map(f=>f.substring(17).split(" ").map(R=>parseInt(R,10)));g.length>0&&g[0].length>1&&g[0][0]===d&&(m=g[0][1]),s.codecs.forEach(f=>{if(f.name.toUpperCase()==="RTX"&&f.parameters.apt){let T={ssrc:d,codecPayloadType:parseInt(f.parameters.apt,10)};d&&m&&(T.rtx={ssrc:m}),n.push(T),i&&(T=JSON.parse(JSON.stringify(T)),T.fec={ssrc:d,mechanism:l?"red+ulpfec":"red"},n.push(T))}}),n.length===0&&d&&n.push({ssrc:d});let y=e.matchPrefix(t,"b=");return y.length&&(y[0].indexOf("b=TIAS:")===0?y=parseInt(y[0].substring(7),10):y[0].indexOf("b=AS:")===0?y=parseInt(y[0].substring(5),10)*1e3*.95-50*40*8:y=void 0,n.forEach(f=>{f.maxBitrate=y})),n},e.parseRtcpParameters=function(t){const n={},s=e.matchPrefix(t,"a=ssrc:").map(c=>e.parseSsrcMedia(c)).filter(c=>c.attribute==="cname")[0];s&&(n.cname=s.value,n.ssrc=s.ssrc);const i=e.matchPrefix(t,"a=rtcp-rsize");n.reducedSize=i.length>0,n.compound=i.length===0;const l=e.matchPrefix(t,"a=rtcp-mux");return n.mux=l.length>0,n},e.writeRtcpParameters=function(t){let n="";return t.reducedSize&&(n+=`a=rtcp-rsize\r `),t.mux&&(n+=`a=rtcp-mux\r `),t.ssrc!==void 0&&t.cname&&(n+="a=ssrc:"+t.ssrc+" cname:"+t.cname+`\r `),n},e.parseMsid=function(t){let n;const s=e.matchPrefix(t,"a=msid:");if(s.length===1)return n=s[0].substring(7).split(" "),{stream:n[0],track:n[1]};const i=e.matchPrefix(t,"a=ssrc:").map(l=>e.parseSsrcMedia(l)).filter(l=>l.attribute==="msid");if(i.length>0)return n=i[0].value.split(" "),{stream:n[0],track:n[1]}},e.parseSctpDescription=function(t){const n=e.parseMLine(t),s=e.matchPrefix(t,"a=max-message-size:");let i;s.length>0&&(i=parseInt(s[0].substring(19),10)),isNaN(i)&&(i=65536);const l=e.matchPrefix(t,"a=sctp-port:");if(l.length>0)return{port:parseInt(l[0].substring(12),10),protocol:n.fmt,maxMessageSize:i};const c=e.matchPrefix(t,"a=sctpmap:");if(c.length>0){const d=c[0].substring(10).split(" ");return{port:parseInt(d[0],10),protocol:d[1],maxMessageSize:i}}},e.writeSctpDescription=function(t,n){let s=[];return t.protocol!=="DTLS/SCTP"?s=["m="+t.kind+" 9 "+t.protocol+" "+n.protocol+`\r `,`c=IN IP4 0.0.0.0\r `,"a=sctp-port:"+n.port+`\r `]:s=["m="+t.kind+" 9 "+t.protocol+" "+n.port+`\r `,`c=IN IP4 0.0.0.0\r `,"a=sctpmap:"+n.port+" "+n.protocol+` 65535\r `],n.maxMessageSize!==void 0&&s.push("a=max-message-size:"+n.maxMessageSize+`\r `),s.join("")},e.generateSessionId=function(){return Math.random().toString().substr(2,22)},e.writeSessionBoilerplate=function(t,n,s){let i;const l=n!==void 0?n:2;return t?i=t:i=e.generateSessionId(),`v=0\r o=`+(s||"thisisadapterortc")+" "+i+" "+l+` IN IP4 127.0.0.1\r s=-\r t=0 0\r `},e.getDirection=function(t,n){const s=e.splitLines(t);for(let i=0;i<s.length;i++)switch(s[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return s[i].substring(2)}return n?e.getDirection(n):"sendrecv"},e.getKind=function(t){return e.splitLines(t)[0].split(" ")[0].substring(2)},e.isRejected=function(t){return t.split(" ",2)[1]==="0"},e.parseMLine=function(t){const s=e.splitLines(t)[0].substring(2).split(" ");return{kind:s[0],port:parseInt(s[1],10),protocol:s[2],fmt:s.slice(3).join(" ")}},e.parseOLine=function(t){const s=e.matchPrefix(t,"o=")[0].substring(2).split(" ");return{username:s[0],sessionId:s[1],sessionVersion:parseInt(s[2],10),netType:s[3],addressType:s[4],address:s[5]}},e.isValidSDP=function(t){if(typeof t!="string"||t.length===0)return!1;const n=e.splitLines(t);for(let s=0;s<n.length;s++)if(n[s].length<2||n[s].charAt(1)!=="=")return!1;return!0},a.exports=e})(xt);var Tt=xt.exports,X,G,Re={d:(a,e)=>{for(var t in e)Re.o(e,t)&&!Re.o(a,t)&&Object.defineProperty(a,t,{enumerable:!0,get:e[t]})},o:(a,e)=>Object.prototype.hasOwnProperty.call(a,e)},S={};Re.d(S,{Dz:()=>hn,g$:()=>It,Lt:()=>Dt,Q9:()=>Ot,qf:()=>$e,hV:()=>vn,z$:()=>pn,J0:()=>qe,De:()=>Es,$C:()=>ae,al:()=>Nt,_W:()=>Kt,Gv:()=>rn,m:()=>an,tz:()=>Wt,Nu:()=>mn,zg:()=>Tn,vp:()=>dn,vU:()=>h,wF:()=>en,rv:()=>un,Nh:()=>gn,ss:()=>Cn,qW:()=>on,QL:()=>sn,cf:()=>bn,eM:()=>Zt,Yd:()=>r,Tk:()=>C,iM:()=>Lt,qy:()=>te,ce:()=>hs,sK:()=>E,Ok:()=>F,q5:()=>fn,g:()=>qs,xl:()=>Jt,I:()=>Yt,bx:()=>je,dD:()=>cn,Ib:()=>Ce,Az:()=>U,Iw:()=>ee,qY:()=>Ke,db:()=>Ft,mR:()=>Se,Tn:()=>Ne,rV:()=>tn,gh:()=>jt,Mi:()=>qt,j:()=>Qt,YB:()=>Xt,i5:()=>nn,x_:()=>ie,Am:()=>Qe,eR:()=>_t,r8:()=>$t,u3:()=>En,vd:()=>Gt,iV:()=>Bt,jZ:()=>zt,SW:()=>Vt,ZH:()=>Ht,Ni:()=>yn,lh:()=>Ut,bq:()=>At,$f:()=>wn,eu:()=>ln,Ax:()=>fs,Mc:()=>ps});class r{static GetStackTrace(){const e=new Error;let t="No Stack Available for this browser";return e.stack&&(t=e.stack.toString().replace(/Error/g,"")),t}static SetLoggerVerbosity(e){this.verboseLogLevel!=null&&(this.verboseLogLevel=e)}static Log(e,t,n){if(n>this.verboseLogLevel)return;const s=`Level: Log Msg: ${t} Caller: ${e}`;console.log(s)}static Info(e,t,n){if(n>this.verboseLogLevel)return;const s=`Level: Info Msg: ${t}`;console.info(s)}static Error(e,t){const n=`Level: Error Msg: ${t} Caller: ${e}`;console.error(n)}static Warning(e,t){const n=`Level: Warning Caller: ${e} Msg: ${t}`;console.warn(n)}}r.verboseLogLevel=5,function(a){a.LIST_STREAMERS="listStreamers",a.SUBSCRIBE="subscribe",a.UNSUBSCRIBE="unsubscribe",a.ICE_CANDIDATE="iceCandidate",a.OFFER="offer",a.ANSWER="answer",a.DATACHANNELREQUEST="dataChannelRequest",a.SFURECVDATACHANNELREADY="peerDataChannelsReady",a.PONG="pong"}(X||(X={}));class te{payload(){return r.Log(r.GetStackTrace(),`Sending => `+JSON.stringify(this,void 0,4),6),JSON.stringify(this)}}class ns extends te{constructor(){super(),this.type=X.LIST_STREAMERS}}class ss extends te{constructor(e){super(),this.type=X.SUBSCRIBE,this.streamerId=e}}class rs extends te{constructor(){super(),this.type=X.UNSUBSCRIBE}}class is extends te{constructor(e){super(),this.type=X.PONG,this.time=e}}class as extends te{constructor(e){super(),this.type=X.OFFER,e&&(this.type=e.type,this.sdp=e.sdp)}}class os extends te{constructor(e){super(),this.type=X.ANSWER,e&&(this.type=e.type,this.sdp=e.sdp)}}class ls extends te{constructor(){super(),this.type=X.DATACHANNELREQUEST}}class cs extends te{constructor(){super(),this.type=X.SFURECVDATACHANNELREADY}}class ds{constructor(e){this.type=X.ICE_CANDIDATE,this.candidate=e}payload(){return r.Log(r.GetStackTrace(),`Sending => `+JSON.stringify(this,void 0,4),6),JSON.stringify(this)}}(function(a){a.CONFIG="config",a.STREAMER_LIST="streamerList",a.PLAYER_COUNT="playerCount",a.OFFER="offer",a.ANSWER="answer",a.ICE_CANDIDATE="iceCandidate",a.PEER_DATA_CHANNELS="peerDataChannels",a.PING="ping",a.WARNING="warning"})(G||(G={}));class Lt{}class hs extends Lt{}class Ne{constructor(){this.FromUEMessageHandlers=new Map}addMessageHandler(e,t){this.FromUEMessageHandlers.set(e,t)}handleMessage(e,t){this.FromUEMessageHandlers.has(e)?this.FromUEMessageHandlers.get(e)(t):r.Error(r.GetStackTrace(),`Message type of ${e} does not have a message handler registered on the frontend - ignoring message.`)}static setupDefaultHandlers(e){e.signallingProtocol.addMessageHandler(G.PING,t=>{const n=new is(new Date().getTime()).payload();r.Log(r.GetStackTrace(),G.PING+": "+t,6),e.webSocket.send(n)}),e.signallingProtocol.addMessageHandler(G.CONFIG,t=>{r.Log(r.GetStackTrace(),G.CONFIG,6);const n=JSON.parse(t);e.onConfig(n)}),e.signallingProtocol.addMessageHandler(G.STREAMER_LIST,t=>{r.Log(r.GetStackTrace(),G.STREAMER_LIST,6);const n=JSON.parse(t);e.onStreamerList(n)}),e.signallingProtocol.addMessageHandler(G.PLAYER_COUNT,t=>{r.Log(r.GetStackTrace(),G.PLAYER_COUNT,6);const n=JSON.parse(t);r.Log(r.GetStackTrace(),"Player Count: "+n.count,6),e.onPlayerCount(n)}),e.signallingProtocol.addMessageHandler(G.ANSWER,t=>{r.Log(r.GetStackTrace(),G.ANSWER,6);const n=JSON.parse(t);e.onWebRtcAnswer(n)}),e.signallingProtocol.addMessageHandler(G.OFFER,t=>{r.Log(r.GetStackTrace(),G.OFFER,6);const n=JSON.parse(t);e.onWebRtcOffer(n)}),e.signallingProtocol.addMessageHandler(G.ICE_CANDIDATE,t=>{r.Log(r.GetStackTrace(),G.ICE_CANDIDATE,6);const n=JSON.parse(t);e.onIceCandidate(n.candidate)}),e.signallingProtocol.addMessageHandler(G.WARNING,t=>{r.Warning(r.GetStackTrace(),`Warning received: ${t}`)}),e.signallingProtocol.addMessageHandler(G.PEER_DATA_CHANNELS,t=>{r.Log(r.GetStackTrace(),G.PEER_DATA_CHANNELS,6);const n=JSON.parse(t);e.onWebRtcPeerDataChannels(n)})}}class At{constructor(){this.WS_OPEN_STATE=1,this.onOpen=new EventTarget,this.onClose=new EventTarget,this.signallingProtocol=new Ne,Ne.setupDefaultHandlers(this)}connect(e){r.Log(r.GetStackTrace(),e,6);try{return this.webSocket=new WebSocket(e),this.webSocket.onopen=t=>this.handleOnOpen(t),this.webSocket.onerror=()=>this.handleOnError(),this.webSocket.onclose=t=>this.handleOnClose(t),this.webSocket.onmessage=t=>this.handleOnMessage(t),this.webSocket.onmessagebinary=t=>this.handleOnMessageBinary(t),!0}catch(t){return r.Error(t,t),!1}}handleOnMessageBinary(e){e&&e.data&&e.data.text().then(t=>{const n=new MessageEvent("messageFromBinary",{data:t});this.handleOnMessage(n)}).catch(t=>{r.Error(r.GetStackTrace(),`Failed to parse binary blob from websocket, reason: ${t}`)})}handleOnMessage(e){if(e.data&&e.data instanceof Blob)return void this.handleOnMessageBinary(e);const t=JSON.parse(e.data);r.Log(r.GetStackTrace(),`received => `+JSON.stringify(JSON.parse(e.data),void 0,4),6),this.signallingProtocol.handleMessage(t.type,e.data)}handleOnOpen(e){r.Log(r.GetStackTrace(),"Connected to the signalling server via WebSocket",6),this.onOpen.dispatchEvent(new Event("open"))}handleOnError(){r.Error(r.GetStackTrace(),"WebSocket error")}handleOnClose(e){r.Log(r.GetStackTrace(),"Disconnected to the signalling server via WebSocket: "+JSON.stringify(e.code)+" - "+e.reason),this.onClose.dispatchEvent(new CustomEvent("close",{detail:e}))}requestStreamerList(){const e=new ns;this.webSocket.send(e.payload())}sendSubscribe(e){const t=new ss(e);this.webSocket.send(t.payload())}sendUnsubscribe(){const e=new rs;this.webSocket.send(e.payload())}sendWebRtcOffer(e){const t=new as(e);this.webSocket.send(t.payload())}sendWebRtcAnswer(e){const t=new os(e);this.webSocket.send(t.payload())}sendWebRtcDatachannelRequest(){const e=new ls;this.webSocket.send(e.payload())}sendSFURecvDataChannelReady(){const e=new cs;this.webSocket.send(e.payload())}sendIceCandidate(e){if(r.Log(r.GetStackTrace(),"Sending Ice Candidate"),this.webSocket&&this.webSocket.readyState===this.WS_OPEN_STATE){const t=new ds(e);this.webSocket.send(t.payload())}}close(){var e;(e=this.webSocket)===null||e===void 0||e.close()}onConfig(e){}onStreamerList(e){}onIceCandidate(e){}onWebRtcAnswer(e){}onWebRtcOffer(e){}onWebRtcPeerDataChannels(e){}onPlayerCount(e){}}class us{constructor(e){this.videoElementProvider=e,this.audioElement=document.createElement("Audio"),this.videoElementProvider.setAudioElement(this.audioElement)}handleOnTrack(e){if(r.Log(r.GetStackTrace(),"handleOnTrack "+JSON.stringify(e.streams),6),e.track.id=="probator")return;const t=this.videoElementProvider.getVideoElement();if(e.track&&r.Log(r.GetStackTrace(),"Got track - "+e.track.kind+" id="+e.track.id+" readyState="+e.track.readyState,6),e.track.kind!="audio")return e.track.kind=="video"&&t.srcObject!==e.streams[0]?(t.srcObject=e.streams[0],void r.Log(r.GetStackTrace(),"Set video source from video track ontrack.")):void 0;this.CreateAudioTrack(e.streams[0])}CreateAudioTrack(e){const t=this.videoElementProvider.getVideoElement();t.srcObject!=e&&t.srcObject&&t.srcObject!==e&&(this.audioElement.srcObject=e,r.Log(r.GetStackTrace(),"Created new audio element to play separate audio stream."))}}class gs{constructor(e){this.freezeFrameHeight=0,this.freezeFrameWidth=0,this.rootDiv=e,this.rootElement=document.createElement("div"),this.rootElement.id="freezeFrame",this.rootElement.style.display="none",this.rootElement.style.pointerEvents="none",this.rootElement.style.position="absolute",this.rootElement.style.zIndex="20",this.imageElement=document.createElement("img"),this.imageElement.style.position="absolute",this.rootElement.appendChild(this.imageElement),this.rootDiv.appendChild(this.rootElement)}setElementForShow(){this.rootElement.style.display="block"}setElementForHide(){this.rootElement.style.display="none"}updateImageElementSource(e){const t=btoa(e.reduce((n,s)=>n+String.fromCharCode(s),""));this.imageElement.src="data:image/jpeg;base64,"+t}setDimensionsFromElementAndResize(){this.freezeFrameHeight=this.imageElement.naturalHeight,this.freezeFrameWidth=this.imageElement.naturalWidth,this.resize()}resize(){if(this.freezeFrameWidth!==0&&this.freezeFrameHeight!==0){let e=0,t=0,n=0,s=0;const i=this.rootDiv.clientWidth/this.rootDiv.clientHeight,l=this.freezeFrameWidth/this.freezeFrameHeight;i<l?(e=this.rootDiv.clientWidth,t=Math.floor(this.rootDiv.clientWidth/l),n=Math.floor(.5*(this.rootDiv.clientHeight-t)),s=0):(e=Math.floor(this.rootDiv.clientHeight*l),t=this.rootDiv.clientHeight,n=0,s=Math.floor(.5*(this.rootDiv.clientWidth-e))),this.rootElement.style.width=this.rootDiv.offsetWidth+"px",this.rootElement.style.height=this.rootDiv.offsetHeight+"px",this.rootElement.style.left="0px",this.rootElement.style.top="0px",this.imageElement.style.width=e+"px",this.imageElement.style.height=t+"px",this.imageElement.style.left=s+"px",this.imageElement.style.top=n+"px"}}}class ms{constructor(e){this.receiving=!1,this.size=0,this.jpeg=void 0,this.valid=!1,this.freezeFrameDelay=50,this.freezeFrame=new gs(e)}showFreezeFrame(){this.valid&&this.freezeFrame.setElementForShow()}hideFreezeFrame(){this.valid=!1,this.freezeFrame.setElementForHide()}updateFreezeFrameAndShow(e,t){this.freezeFrame.updateImageElementSource(e),this.freezeFrame.imageElement.onload=()=>{this.freezeFrame.setDimensionsFromElementAndResize(),t()}}processFreezeFrameMessage(e,t){this.receiving||(this.receiving=!0,this.valid=!1,this.size=0,this.jpeg=void 0),this.size=new DataView(e.slice(1,5).buffer).getInt32(0,!0);const n=e.slice(5);if(this.jpeg){const s=new Uint8Array(this.jpeg.length+n.length);s.set(this.jpeg,0),s.set(n,this.jpeg.length),this.jpeg=s}else this.jpeg=n,this.receiving=!0,r.Log(r.GetStackTrace(),`received first chunk of freeze frame: ${this.jpeg.length}/${this.size}`,6);this.jpeg.length===this.size?(this.receiving=!1,this.valid=!0,r.Log(r.GetStackTrace(),`received complete freeze frame ${this.size}`,6),this.updateFreezeFrameAndShow(this.jpeg,t)):this.jpeg.length>this.size&&(r.Error(r.GetStackTrace(),`received bigger freeze frame than advertised: ${this.jpeg.length}/${this.size}`),this.jpeg=void 0,this.receiving=!1)}}class Ce{constructor(e,t,n,s,i=()=>{}){this.onChange=i,this.onChangeEmit=()=>{},this.id=e,this.description=n,this.label=t,this.value=s}set label(e){this._label=e,this.onChangeEmit(this._value)}get label(){return this._label}get value(){return this._value}set value(e){this._value=e,this.onChange(this._value,this),this.onChangeEmit(this._value)}}class U extends Ce{constructor(e,t,n,s,i,l=()=>{}){super(e,t,n,s,l);const c=new URLSearchParams(window.location.search);if(i&&c.has(this.id)){const d=this.getUrlParamFlag();this.flag=d}else this.flag=s;this.useUrlParams=i}getUrlParamFlag(){const e=new URLSearchParams(window.location.search);return!!e.has(this.id)&&e.get(this.id)!=="false"&&e.get(this.id)!=="False"}updateURLParams(){if(this.useUrlParams){const e=new URLSearchParams(window.location.search);this.flag===!0?e.set(this.id,"true"):e.set(this.id,"false"),window.history.replaceState({},"",e.toString()!==""?`${location.pathname}?${e}`:`${location.pathname}`)}}enable(){this.flag=!0}get flag(){return!!this.value}set flag(e){this.value=e}}class ee extends Ce{constructor(e,t,n,s,i,l,c,d=()=>{}){super(e,t,n,l,d),this._min=s,this._max=i;const m=new URLSearchParams(window.location.search);if(c&&m.has(this.id)){const g=Number.parseInt(m.get(this.id));this.number=Number.isNaN(g)?l:g}else this.number=l;this.useUrlParams=c}updateURLParams(){if(this.useUrlParams){const e=new URLSearchParams(window.location.search);e.set(this.id,this.number.toString()),window.history.replaceState({},"",e.toString()!==""?`${location.pathname}?${e}`:`${location.pathname}`)}}set number(e){this.value=this.clamp(e)}get number(){return this.value}clamp(e){return Math.max(Math.min(this._max,e),this._min)}get min(){return this._min}get max(){return this._max}addOnChangedListener(e){this.onChange=e}}class Ft extends Ce{constructor(e,t,n,s,i,l=()=>{}){super(e,t,n,s,l);const c=new URLSearchParams(window.location.search);if(i&&c.has(this.id)){const d=this.getUrlParamText();this.text=d}else this.text=s;this.useUrlParams=i}getUrlParamText(){var e;const t=new URLSearchParams(window.location.search);return t.has(this.id)&&(e=t.get(this.id))!==null&&e!==void 0?e:""}updateURLParams(){if(this.useUrlParams){const e=new URLSearchParams(window.location.search);e.set(this.id,this.text),window.history.replaceState({},"",e.toString()!==""?`${location.pathname}?${e}`:`${location.pathname}`)}}get text(){return this.value}set text(e){this.value=e}}class Ke extends Ce{constructor(e,t,n,s,i,l,c=()=>{}){super(e,t,n,[s,s],c),this.options=i;const d=new URLSearchParams(window.location.search),m=l&&d.has(this.id)?this.getUrlParamText():s;this.selected=m,this.useUrlParams=l}getUrlParamText(){var e;const t=new URLSearchParams(window.location.search);return t.has(this.id)&&(e=t.get(this.id))!==null&&e!==void 0?e:""}updateURLParams(){if(this.useUrlParams){const e=new URLSearchParams(window.location.search);e.set(this.id,this.selected),window.history.replaceState({},"",e.toString()!==""?`${location.pathname}?${e}`:`${location.pathname}`)}}addOnChangedListener(e){this.onChange=e}get options(){return this._options}set options(e){this._options=e,this.onChangeEmit(this.selected)}get selected(){return this.value}set selected(e){let t=this.options.filter(n=>n.indexOf(e)!==-1);t.length?this.value=t[0]:(t=this.options.filter(n=>n.indexOf(e.split(" ")[0])!==-1),t.length&&(this.value=t[0]))}}class Dt extends Event{constructor(e){super("afkWarningActivate"),this.data=e}}class $e extends Event{constructor(e){super("afkWarningUpdate"),this.data=e}}class Ot extends Event{constructor(){super("afkWarningDeactivate")}}class It extends Event{constructor(){super("afkTimedOut")}}class _t extends Event{constructor(e){super("videoEncoderAvgQP"),this.data=e}}class Ut extends Event{constructor(){super("webRtcSdp")}}class Gt extends Event{constructor(){super("webRtcAutoConnect")}}class zt extends Event{constructor(){super("webRtcConnecting")}}class Bt extends Event{constructor(){super("webRtcConnected")}}class Ht extends Event{constructor(){super("webRtcFailed")}}class Vt extends Event{constructor(e){super("webRtcDisconnected"),this.data=e}}class Wt extends Event{constructor(e){super("dataChannelOpen"),this.data=e}}class Nt extends Event{constructor(e){super("dataChannelClose"),this.data=e}}class Kt extends Event{constructor(e){super("dataChannelError"),this.data=e}}class $t extends Event{constructor(){super("videoInitialized")}}class jt extends Event{constructor(){super("streamLoading")}}class qt extends Event{constructor(){super("streamConnect")}}class Qt extends Event{constructor(){super("streamDisconnect")}}class Xt extends Event{constructor(){super("streamReconnect")}}class Jt extends Event{constructor(e){super("playStreamError"),this.data=e}}class Yt extends Event{constructor(){super("playStream")}}class je extends Event{constructor(e){super("playStreamRejected"),this.data=e}}class Zt extends Event{constructor(e){super("loadFreezeFrame"),this.data=e}}class en extends Event{constructor(){super("hideFreezeFrame")}}class tn extends Event{constructor(e){super("statsReceived"),this.data=e}}class nn extends Event{constructor(e){super("streamerListMessage"),this.data=e}}class sn extends Event{constructor(e){super("latencyTestResult"),this.data=e}}class rn extends Event{constructor(e){super("dataChannelLatencyTestResponse"),this.data=e}}class an extends Event{constructor(e){super("dataChannelLatencyTestResult"),this.data=e}}class on extends Event{constructor(e){super("initialSettings"),this.data=e}}class Se extends Event{constructor(e){super("settingsChanged"),this.data=e}}class ps extends Event{constructor(){super("xrSessionStarted")}}class fs extends Event{constructor(){super("xrSessionEnded")}}class ln extends Event{constructor(e){super("xrFrame"),this.data=e}}class cn extends Event{constructor(e){super("playerCount"),this.data=e}}class dn extends EventTarget{dispatchEvent(e){return super.dispatchEvent(e)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}}class h{}h.AutoConnect="AutoConnect",h.AutoPlayVideo="AutoPlayVideo",h.AFKDetection="TimeoutIfIdle",h.BrowserSendOffer="OfferToReceive",h.HoveringMouseMode="HoveringMouse",h.ForceMonoAudio="ForceMonoAudio",h.ForceTURN="ForceTURN",h.FakeMouseWithTouches="FakeMouseWithTouches",h.IsQualityController="ControlsQuality",h.MatchViewportResolution="MatchViewportRes",h.StartVideoMuted="StartVideoMuted",h.SuppressBrowserKeys="SuppressBrowserKeys",h.UseMic="UseMic",h.KeyboardInput="KeyboardInput",h.MouseInput="MouseInput",h.TouchInput="TouchInput",h.GamepadInput="GamepadInput",h.XRControllerInput="XRControllerInput",h.WaitForStreamer="WaitForStreamer";const vs=a=>Object.getOwnPropertyNames(h).some(e=>h[e]===a);class E{}E.AFKTimeoutSecs="AFKTimeout",E.MinQP="MinQP",E.MaxQP="MaxQP",E.WebRTCFPS="WebRTCFPS",E.WebRTCMinBitrate="WebRTCMinBitrate",E.WebRTCMaxBitrate="WebRTCMaxBitrate",E.MaxReconnectAttempts="MaxReconnectAttempts",E.StreamerAutoJoinInterval="StreamerAutoJoinInterval";const Ss=a=>Object.getOwnPropertyNames(E).some(e=>E[e]===a);class ie{}ie.SignallingServerUrl="ss";const Cs=a=>Object.getOwnPropertyNames(ie).some(e=>ie[e]===a);class F{}F.PreferredCodec="PreferredCodec",F.StreamerId="StreamerId";const Ts=a=>Object.getOwnPropertyNames(F).some(e=>F[e]===a);class Es{constructor(e={}){this.flags=new Map,this.numericParameters=new Map,this.textParameters=new Map,this.optionParameters=new Map;const{initialSettings:t,useUrlParams:n}=e;this._useUrlParams=!!n,this.populateDefaultSettings(this._useUrlParams),t&&this.setSettings(t)}get useUrlParams(){return this._useUrlParams}populateDefaultSettings(e){this.textParameters.set(ie.SignallingServerUrl,new Ft(ie.SignallingServerUrl,"Signalling url","Url of the signalling server",(location.protocol==="https:"?"wss://":"ws://")+window.location.hostname+(window.location.port==="80"||window.location.port===""?"":`:${window.location.port}`),e)),this.optionParameters.set(F.StreamerId,new Ke(F.StreamerId,"Streamer ID","The ID of the streamer to stream.","",[],e)),this.optionParameters.set(F.PreferredCodec,new Ke(F.PreferredCodec,"Preferred Codec","The preferred codec to be used during codec negotiation","H264 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f",function(){const t=[];if(!RTCRtpReceiver.getCapabilities)return t.push("Only available on Chrome"),t;const n=/(VP\d|H26\d|AV1).*/;return RTCRtpReceiver.getCapabilities("video").codecs.forEach(s=>{const i=s.mimeType.split("/")[1]+" "+(s.sdpFmtpLine||"");n.exec(i)!==null&&t.push(i)}),t}(),e)),this.flags.set(h.AutoConnect,new U(h.AutoConnect,"Auto connect to stream","Whether we should attempt to auto connect to the signalling server or show a click to start prompt.",!1,e)),this.flags.set(h.AutoPlayVideo,new U(h.AutoPlayVideo,"Auto play video","When video is ready automatically start playing it as opposed to showing a play button.",!0,e)),this.flags.set(h.BrowserSendOffer,new U(h.BrowserSendOffer,"Browser send offer","Browser will initiate the WebRTC handshake by sending the offer to the streamer",!1,e)),this.flags.set(h.UseMic,new U(h.UseMic,"Use microphone","Make browser request microphone access and open an input audio track.",!1,e)),this.flags.set(h.StartVideoMuted,new U(h.StartVideoMuted,"Start video muted","Video will start muted if true.",!1,e)),this.flags.set(h.SuppressBrowserKeys,new U(h.SuppressBrowserKeys,"Suppress browser keys","Suppress certain browser keys that we use in UE, for example F5 to show shader complexity instead of refresh the page.",!0,e)),this.flags.set(h.IsQualityController,new U(h.IsQualityController,"Is quality controller?","True if this peer controls stream quality",!0,e)),this.flags.set(h.ForceMonoAudio,new U(h.ForceMonoAudio,"Force mono audio","Force browser to request mono audio in the SDP",!1,e)),this.flags.set(h.ForceTURN,new U(h.ForceTURN,"Force TURN","Only generate TURN/Relayed ICE candidates.",!1,e)),this.flags.set(h.AFKDetection,new U(h.AFKDetection,"AFK if idle","Timeout the experience if user is AFK for a period.",!1,e)),this.flags.set(h.MatchViewportResolution,new U(h.MatchViewportResolution,"Match viewport resolution","Pixel Streaming will be instructed to dynamically resize the video stream to match the size of the video element.",!1,e)),this.flags.set(h.HoveringMouseMode,new U(h.HoveringMouseMode,"Control Scheme: Locked Mouse","Either locked mouse, where the pointer is consumed by the video and locked to it, or hovering mouse, where the mouse is not consumed.",!1,e,(t,n)=>{n.label=`Control Scheme: ${t?"Hovering":"Locked"} Mouse`})),this.flags.set(h.FakeMouseWithTouches,new U(h.FakeMouseWithTouches,"Fake mouse with touches","A single finger touch is converted into a mouse event. This allows a non-touch application to be controlled partially via a touch device.",!1,e)),this.flags.set(h.KeyboardInput,new U(h.KeyboardInput,"Keyboard input","If enabled, send keyboard events to streamer",!0,e)),this.flags.set(h.MouseInput,new U(h.MouseInput,"Mouse input","If enabled, send mouse events to streamer",!0,e)),this.flags.set(h.TouchInput,new U(h.TouchInput,"Touch input","If enabled, send touch events to streamer",!0,e)),this.flags.set(h.GamepadInput,new U(h.GamepadInput,"Gamepad input","If enabled, send gamepad events to streamer",!0,e)),this.flags.set(h.XRControllerInput,new U(h.XRControllerInput,"XR controller input","If enabled, send XR controller events to streamer",!0,e)),this.flags.set(h.WaitForStreamer,new U(h.WaitForStreamer,"Wait for streamer","Will continue trying to connect to the first streamer available.",!0,e)),this.numericParameters.set(E.AFKTimeoutSecs,new ee(E.AFKTimeoutSecs,"AFK timeout","The time (in seconds) it takes for the application to time out if AFK timeout is enabled.",0,600,120,e)),this.numericParameters.set(E.MaxReconnectAttempts,new ee(E.MaxReconnectAttempts,"Max Reconnects","Maximum number of reconnects the application will attempt when a streamer disconnects.",0,999,3,e)),this.numericParameters.set(E.MinQP,new ee(E.MinQP,"Min QP","The lower bound for the quantization parameter (QP) of the encoder. 0 = Best quality, 51 = worst quality.",0,51,0,e)),this.numericParameters.set(E.MaxQP,new ee(E.MaxQP,"Max QP","The upper bound for the quantization parameter (QP) of the encoder. 0 = Best quality, 51 = worst quality.",0,51,51,e)),this.numericParameters.set(E.WebRTCFPS,new ee(E.WebRTCFPS,"Max FPS","The maximum FPS that WebRTC will try to transmit frames at.",1,999,60,e)),this.numericParameters.set(E.WebRTCMinBitrate,new ee(E.WebRTCMinBitrate,"Min Bitrate (kbps)","The minimum bitrate that WebRTC should use.",0,5e5,0,e)),this.numericParameters.set(E.WebRTCMaxBitrate,new ee(E.WebRTCMaxBitrate,"Max Bitrate (kbps)","The maximum bitrate that WebRTC should use.",0,5e5,0,e)),this.numericParameters.set(E.StreamerAutoJoinInterval,new ee(E.StreamerAutoJoinInterval,"Streamer Auto Join Interval (ms)","Delay between retries when waiting for an available streamer.",500,9e5,3e3,e))}_addOnNumericSettingChangedListener(e,t){this.numericParameters.has(e)&&this.numericParameters.get(e).addOnChangedListener(t)}_addOnOptionSettingChangedListener(e,t){this.optionParameters.has(e)&&this.optionParameters.get(e).addOnChangedListener(t)}getNumericSettingValue(e){if(this.numericParameters.has(e))return this.numericParameters.get(e).number;throw new Error(`There is no numeric setting with the id of ${e}`)}getTextSettingValue(e){if(this.textParameters.has(e))return this.textParameters.get(e).value;throw new Error(`There is no numeric setting with the id of ${e}`)}setNumericSetting(e,t){if(!this.numericParameters.has(e))throw new Error(`There is no numeric setting with the id of ${e}`);this.numericParameters.get(e).number=t}_addOnSettingChangedListener(e,t){this.flags.has(e)&&(this.flags.get(e).onChange=t)}_addOnTextSettingChangedListener(e,t){this.textParameters.has(e)&&(this.textParameters.get(e).onChange=t)}getSettingOption(e){return this.optionParameters.get(e)}isFlagEnabled(e){return this.flags.get(e).flag}setFlagEnabled(e,t){this.flags.has(e)?this.flags.get(e).flag=t:r.Warning(r.GetStackTrace(),`Cannot toggle flag called ${e} - it does not exist in the Config.flags ma