@whereby.com/browser-sdk 2.0.0-alpha9 → 2.0.0-beta2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/README.md +82 -29
  2. package/dist/LocalMedia.d.ts +70 -0
  3. package/dist/LocalMedia.js +208 -0
  4. package/dist/RoomConnection.d.ts +190 -0
  5. package/dist/RoomConnection.js +646 -0
  6. package/dist/RoomParticipant.d.ts +50 -0
  7. package/dist/RoomParticipant.js +48 -0
  8. package/dist/api/ApiClient.d.ts +26 -0
  9. package/dist/api/ApiClient.js +61 -0
  10. package/dist/api/Credentials.d.ts +17 -0
  11. package/dist/api/Credentials.js +16 -0
  12. package/dist/api/HttpClient.d.ts +16 -0
  13. package/dist/api/HttpClient.js +52 -0
  14. package/dist/api/MultipartHttpClient.d.ts +10 -0
  15. package/dist/api/MultipartHttpClient.js +25 -0
  16. package/dist/api/OrganizationApiClient.d.ts +16 -0
  17. package/dist/api/OrganizationApiClient.js +28 -0
  18. package/dist/api/Response.d.ts +29 -0
  19. package/dist/api/Response.js +9 -0
  20. package/dist/api/credentialsService/index.d.ts +27 -0
  21. package/dist/api/credentialsService/index.js +89 -0
  22. package/dist/api/deviceService/index.d.ts +9 -0
  23. package/dist/api/deviceService/index.js +23 -0
  24. package/dist/api/extractUtils.d.ts +16 -0
  25. package/dist/api/extractUtils.js +51 -0
  26. package/dist/api/index.d.ts +7 -0
  27. package/dist/api/index.js +7 -0
  28. package/dist/api/localStorageWrapper/index.d.ts +2 -0
  29. package/dist/api/localStorageWrapper/index.js +15 -0
  30. package/dist/api/models/Account.d.ts +20 -0
  31. package/dist/api/models/Account.js +24 -0
  32. package/dist/api/models/Meeting.d.ts +12 -0
  33. package/dist/api/models/Meeting.js +29 -0
  34. package/dist/api/models/Organization.d.ts +102 -0
  35. package/dist/api/models/Organization.js +81 -0
  36. package/dist/api/models/Room.d.ts +4 -0
  37. package/dist/api/models/Room.js +38 -0
  38. package/dist/api/models/account/EmbeddedFreeTierStatus.d.ts +13 -0
  39. package/dist/api/models/account/EmbeddedFreeTierStatus.js +17 -0
  40. package/dist/api/modules/AbstractStore.d.ts +5 -0
  41. package/dist/api/modules/AbstractStore.js +1 -0
  42. package/dist/api/modules/ChromeStorageStore.d.ts +10 -0
  43. package/dist/api/modules/ChromeStorageStore.js +21 -0
  44. package/dist/api/modules/LocalStorageStore.d.ts +9 -0
  45. package/dist/api/modules/LocalStorageStore.js +35 -0
  46. package/dist/api/modules/tests/__mocks__/storage.d.ts +10 -0
  47. package/dist/api/modules/tests/__mocks__/storage.js +19 -0
  48. package/dist/api/organizationService/index.d.ts +46 -0
  49. package/dist/api/organizationService/index.js +158 -0
  50. package/dist/api/organizationServiceCache/index.d.ts +13 -0
  51. package/dist/api/organizationServiceCache/index.js +16 -0
  52. package/dist/api/parameterAssertUtils.d.ts +13 -0
  53. package/dist/api/parameterAssertUtils.js +64 -0
  54. package/dist/api/roomService/index.d.ts +54 -0
  55. package/dist/api/roomService/index.js +160 -0
  56. package/dist/api/test/helpers.d.ts +7 -0
  57. package/dist/api/test/helpers.js +32 -0
  58. package/dist/api/types.d.ts +5 -0
  59. package/dist/api/types.js +1 -0
  60. package/dist/embed/index.d.ts +32 -0
  61. package/dist/embed/index.js +124 -0
  62. package/dist/react/VideoView.d.ts +15 -0
  63. package/dist/react/VideoView.js +37 -0
  64. package/dist/react/index.d.ts +6 -0
  65. package/dist/react/index.js +4 -0
  66. package/dist/react/useLocalMedia.d.ts +29 -0
  67. package/dist/react/useLocalMedia.js +109 -0
  68. package/dist/react/useRoomConnection.d.ts +57 -0
  69. package/dist/react/useRoomConnection.js +340 -0
  70. package/dist/utils/debounce.d.ts +9 -0
  71. package/dist/utils/debounce.js +18 -0
  72. package/dist/utils/fakeAudioStream.d.ts +1 -0
  73. package/dist/utils/fakeAudioStream.js +18 -0
  74. package/dist/utils/fakeWebcamFrame.d.ts +1 -0
  75. package/dist/utils/fakeWebcamFrame.js +49 -0
  76. package/dist/utils/index.d.ts +2 -0
  77. package/dist/utils/index.js +2 -0
  78. package/dist/v2-beta2.js +2000 -0
  79. package/dist/version.d.ts +1 -0
  80. package/dist/version.js +1 -0
  81. package/package.json +110 -81
  82. package/dist/lib.cjs.js +0 -5868
  83. package/dist/lib.esm.js +0 -5850
  84. package/dist/types.d.ts +0 -308
  85. package/dist/v2-alpha9.js +0 -43
package/dist/v2-alpha9.js DELETED
@@ -1,43 +0,0 @@
1
- import e from"fs";import t from"url";import i from"child_process";import n from"http";import s from"https";import a from"stream";import r from"zlib";import o from"net";import c from"tls";import p from"crypto";import d,{EventEmitter as l}from"events";import u from"assert";import m from"tty";import h from"util";import f from"os";import g from"path";function v(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(i){if("default"!==i&&!(i in e)){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}}))})),Object.freeze(e)}
2
- /*! (c) Andrea Giammarchi - ISC */var b={};try{b.WeakMap=WeakMap}catch(e){b.WeakMap=function(e,t){var i=t.defineProperty,n=t.hasOwnProperty,s=a.prototype;return s.delete=function(e){return this.has(e)&&delete e[this._]},s.get=function(e){return this.has(e)?e[this._]:void 0},s.has=function(e){return n.call(e,this._)},s.set=function(e,t){return i(e,this._,{configurable:!0,value:t}),this},a;function a(t){i(this,"_",{value:"_@ungap/weakmap"+e++}),t&&t.forEach(r,this)}function r(e){this.set(e[0],e[1])}}(Math.random(),Object)}var _=b.WeakMap,y={};try{y.Event=new Event(".").constructor}catch(e){try{y.Event=new CustomEvent(".").constructor}catch(e){y.Event=function(e,t){t||(t={});var i=document.createEvent("Event"),n=!!t.bubbles,s=!!t.cancelable;i.initEvent(e,n,s);try{i.bubbles=n,i.cancelable=s}catch(i){}return i}}}var x=y.Event,w={};
3
- /*! (c) Andrea Giammarchi - ISC */try{w.WeakSet=WeakSet}catch(e){!function(e){var t=new e,i=n.prototype;function n(i){t.set(this,new e),i&&i.forEach(this.add,this)}i.add=function(e){return t.get(this).set(e,1),this},i.delete=function(e){return t.get(this).delete(e)},i.has=function(e){return t.get(this).has(e)},w.WeakSet=n}(WeakMap)}var S,R,C=w.WeakSet,k="-"+Math.random().toFixed(6)+"%",T=!1;
4
- /*! (c) Andrea Giammarchi - ISC */try{S=document.createElement("template"),R="tabindex","content"in S&&(S.innerHTML='<p tabindex="'+k+'"></p>',S.content.childNodes[0].getAttribute(R)==k)||(k="_dt: "+k.slice(1,-1)+";",T=!0)}catch(e){}var P="\x3c!--"+k+"--\x3e",E=/^(?:plaintext|script|style|textarea|title|xmp)$/i,O=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
5
- /*! (c) Andrea Giammarchi - ISC */
6
- function D(e){return e.join(P).replace(B,q).replace(N,U)}var I=" \\f\\n\\r\\t",j="[^ \\f\\n\\r\\t\\/>\"'=]+",L="[ \\f\\n\\r\\t]+"+j,M="<([A-Za-z]+[A-Za-z0-9:._-]*)((?:",A="(?:\\s*=\\s*(?:'[^']*?'|\"[^\"]*?\"|<[^>]*?>|"+j.replace("\\/","")+"))?)",N=new RegExp(M+L+A+"+)(["+I+"]*/?>)","g"),B=new RegExp(M+L+A+"*)(["+I+"]*/>)","g"),F=new RegExp("("+L+"\\s*=\\s*)(['\"]?)"+P+"\\2","gi");function U(e,t,i,n){return"<"+t+i.replace(F,z)+n}function z(e,t,i){return t+(i||'"')+k+(i||'"')}function q(e,t,i){return O.test(t)?e:"<"+t+i+"></"+t+">"}const{isArray:$}=Array,{indexOf:V,slice:W}=[];var H=e=>({get:t=>e.get(t),set:(t,i)=>(e.set(t,i),i)});const G=(e,t)=>111===e.nodeType?1/t<0?t?(({firstChild:e,lastChild:t})=>{const i=document.createRange();return i.setStartAfter(e),i.setEndAfter(t),i.deleteContents(),e})(e):e.lastChild:t?e.valueOf():e.firstChild:e,K=e=>{const{childNodes:t}=e,{length:i}=t;if(i<2)return i?t[0]:e;const n=W.call(t,0);return{ELEMENT_NODE:1,nodeType:111,firstChild:n[0],lastChild:n[i-1],valueOf(){if(t.length!==i){let t=0;for(;t<i;)e.appendChild(n[t++])}return e}}};
7
- /*! (c) Andrea Giammarchi - ISC */
8
- var J=function(e){var t="fragment",i="template",n="content"in a(i)?function(e){var t=a(i);return t.innerHTML=e,t.content}:function(e){var n=a(t),r=a(i),o=null;if(/^[^\S]*?<(col(?:group)?|t(?:head|body|foot|r|d|h))/i.test(e)){var c=RegExp.$1;r.innerHTML="<table>"+e+"</table>",o=r.querySelectorAll(c)}else r.innerHTML=e,o=r.childNodes;return s(n,o),n};return function(e,t){return("svg"===t?r:n)(e)};function s(e,t){for(var i=t.length;i--;)e.appendChild(t[0])}function a(i){return i===t?e.createDocumentFragment():e.createElementNS("http://www.w3.org/1999/xhtml",i)}function r(e){var i=a(t),n=a("div");return n.innerHTML='<svg xmlns="http://www.w3.org/2000/svg">'+e+"</svg>",s(i,n.firstChild.childNodes),i}}(document),Q=(e,t,i,n,s)=>{const a=i.length;let r=t.length,o=a,c=0,p=0,d=null;for(;c<r||p<o;)if(r===c){const t=o<a?p?n(i[p-1],-0).nextSibling:n(i[o-p],0):s;for(;p<o;)e.insertBefore(n(i[p++],1),t)}else if(o===p)for(;c<r;)d&&d.has(t[c])||e.removeChild(n(t[c],-1)),c++;else if(t[c]===i[p])c++,p++;else if(t[r-1]===i[o-1])r--,o--;else if(t[c]===i[o-1]&&i[p]===t[r-1]){const s=n(t[--r],-1).nextSibling;e.insertBefore(n(i[p++],1),n(t[c++],-1).nextSibling),e.insertBefore(n(i[--o],1),s),t[r]=i[o]}else{if(!d){d=new Map;let e=p;for(;e<o;)d.set(i[e],e++)}if(d.has(t[c])){const s=d.get(t[c]);if(p<s&&s<o){let a=c,l=1;for(;++a<r&&a<o&&d.get(t[a])===s+l;)l++;if(l>s-p){const a=n(t[c],0);for(;p<s;)e.insertBefore(n(i[p++],1),a)}else e.replaceChild(n(i[p++],1),n(t[c++],-1))}else c++}else e.removeChild(n(t[c++],-1))}return i},Y=function(e,t,i,n,s){var a=s in e,r=e.createDocumentFragment();return r.appendChild(e.createTextNode("g")),r.appendChild(e.createTextNode("")),(a?e.importNode(r,!0):r.cloneNode(!0)).childNodes.length<2?function e(t,i){for(var n=t.cloneNode(),s=t.childNodes||[],a=s.length,r=0;i&&r<a;r++)n.appendChild(e(s[r],i));return n}:a?e.importNode:function(e,t){return e.cloneNode(!!t)}}(document,0,0,0,"importNode"),X="".trim||function(){return String(this).replace(/^\s+|\s+/g,"")},Z=T?function(e,t){var i=t.join(" ");return t.slice.call(e,0).sort((function(e,t){return i.indexOf(e.name)<=i.indexOf(t.name)?-1:1}))}:function(e,t){return t.slice.call(e,0)};function ee(e,t){for(var i=t.length,n=0;n<i;)e=e.childNodes[t[n++]];return e}function te(e,t,i,n){for(var s=e.childNodes,a=s.length,r=0;r<a;){var o=s[r];switch(o.nodeType){case 1:var c=n.concat(r);ie(o,t,i,c),te(o,t,i,c);break;case 8:var p=o.textContent;if(p===k)i.shift(),t.push(E.test(e.nodeName)?ae(e,n):ne(o,n.concat(r)));else switch(p.slice(0,2)){case"/*":if("*/"!==p.slice(-2))break;case"👻":e.removeChild(o),r--,a--}break;case 3:E.test(e.nodeName)&&X.call(o.textContent)===P&&(i.shift(),t.push(ae(e,n)))}r++}}function ie(e,t,i,n){for(var s=e.attributes,a=[],r=[],o=Z(s,i),c=o.length,p=0;p<c;){var d,l=o[p++],u=l.value===k;if(u||1<(d=l.value.split(P)).length){var m=l.name;if(a.indexOf(m)<0){a.push(m);var h=i.shift().replace(u?/^(?:|[\S\s]*?\s)(\S+?)\s*=\s*('|")?$/:new RegExp("^(?:|[\\S\\s]*?\\s)("+m+")\\s*=\\s*('|\")[\\S\\s]*","i"),"$1"),f=s[h]||s[h.toLowerCase()];if(u)t.push(se(f,n,h,null));else{for(var g=d.length-2;g--;)i.shift();t.push(se(f,n,h,d))}}r.push(l)}}p=0;for(var v=(0<(c=r.length)&&T&&!("ownerSVGElement"in e));p<c;){var b=r[p++];v&&(b.value=""),e.removeAttribute(b.name)}var _=e.nodeName;if(/^script$/i.test(_)){var y=document.createElement(_);for(c=s.length,p=0;p<c;)y.setAttributeNode(s[p++].cloneNode(!0));y.textContent=e.textContent,e.parentNode.replaceChild(y,e)}}function ne(e,t){return{type:"any",node:e,path:t}}function se(e,t,i,n){return{type:"attr",node:e,path:t,name:i,sparse:n}}function ae(e,t){return{type:"text",node:e,path:t}}var re=H(new _);function oe(e,t){var i=(e.convert||D)(t),n=e.transform;n&&(i=n(i));var s=J(i,e.type);de(s);var a=[];return te(s,a,t.slice(0),[]),{content:s,updates:function(i){for(var n=[],s=a.length,r=0,o=0;r<s;){var c=a[r++],p=ee(i,c.path);switch(c.type){case"any":n.push({fn:e.any(p,[]),sparse:!1});break;case"attr":var d=c.sparse,l=e.attribute(p,c.name,c.node);null===d?n.push({fn:l,sparse:!1}):(o+=d.length-2,n.push({fn:l,sparse:!0,values:d}));break;case"text":n.push({fn:e.text(p),sparse:!1}),p.textContent=""}}return s+=o,function(){var e=arguments.length;if(s!==e-1)throw new Error(e-1+" values instead of "+s+"\n"+t.join("${value}"));for(var a=1,r=1;a<e;){var o=n[a-r];if(o.sparse){var c=o.values,p=c[0],d=1,l=c.length;for(r+=l-2;d<l;)p+=arguments[a++]+c[d++];o.fn(p)}else o.fn(arguments[a++])}return i}}}}function ce(e,t){var i=re.get(t)||re.set(t,oe(e,t));return i.updates(Y.call(document,i.content,!0))}var pe=[];function de(e){for(var t=e.childNodes,i=t.length;i--;){var n=t[i];1!==n.nodeType&&0===X.call(n.textContent).length&&e.removeChild(n)}}
9
- /*! (c) Andrea Giammarchi - ISC */var le=function(){var e=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,t=/([^A-Z])([A-Z]+)/g;return function(e,t){return"ownerSVGElement"in e?function(e,t){var i;t?i=t.cloneNode(!0):(e.setAttribute("style","--hyper:style;"),i=e.getAttributeNode("style"));return i.value="",e.setAttributeNode(i),n(i,!0)}(e,t):n(e.style,!1)};function i(e,t,i){return t+"-"+i.toLowerCase()}function n(n,s){var a,r;return function(o){var c,p,d,l;switch(typeof o){case"object":if(o){if("object"===a){if(!s&&r!==o)for(p in r)p in o||(n[p]="")}else s?n.value="":n.cssText="";for(p in c=s?{}:n,o)d="number"!=typeof(l=o[p])||e.test(p)?l:l+"px",!s&&/^--/.test(p)?c.setProperty(p,d):c[p]=d;a="object",s?n.value=function(e){var n,s=[];for(n in e)s.push(n.replace(t,i),":",e[n],";");return s.join("")}(r=c):r=o;break}default:r!=o&&(a="string",r=o,s?n.value=o||"":n.cssText=o||"")}}}}();const ue=(e,t)=>{let i,n=!0;const s=document.createAttributeNS(null,t);return t=>{i!==t&&(i=t,null==i?n||(e.removeAttributeNode(s),n=!0):(s.value=t,n&&(e.setAttributeNodeNS(s),n=!1)))}},me=({dataset:e})=>t=>{for(const i in t){const n=t[i];null==n?delete e[i]:e[i]=n}},he=(e,t)=>"dataset"===t?me(e):i=>{e[t]=i},fe=/^(?:form|list)$/i,ge=(e,t)=>e.ownerDocument.createTextNode(t);function ve(e){return this.type=e,function(e){var t=pe,i=de;return function(n){return t!==n&&(i=ce(e,t=n)),i.apply(null,arguments)}}(this)}function be(e){return e(this)}ve.prototype={attribute(e,t,i){const n="svg"===this.type;switch(t){case"class":if(n)return ue(e,t);t="className";case"props":return he(e,t);case"aria":return(e=>t=>{for(const i in t){const n="role"===i?i:`aria-${i}`,s=t[i];null==s?e.removeAttribute(n):e.setAttribute(n,s)}})(e);case"style":return le(e,i,n);case"ref":return(e=>t=>{"function"==typeof t?t(e):t.current=e})(e);case".dataset":return me(e);default:return"."===t.slice(0,1)?he(e,t.slice(1)):"?"===t.slice(0,1)?((e,t,i)=>n=>{i!==!!n&&((i=!!n)?e.setAttribute(t,""):e.removeAttribute(t))})(e,t.slice(1)):"on"===t.slice(0,2)?((e,t)=>{let i,n=t.slice(2);return!(t in e)&&t.toLowerCase()in e&&(n=n.toLowerCase()),t=>{const s=$(t)?t:[t,!1];i!==s[0]&&(i&&e.removeEventListener(n,i,s[1]),(i=s[0])&&e.addEventListener(n,i,s[1]))}})(e,t):!(t in e)||n||fe.test(t)?ue(e,t):((e,t)=>{let i;return n=>{i!==n&&(i=n,e[t]!==n&&(null==n?(e[t]="",e.removeAttribute(t)):e[t]=n))}})(e,t)}},any(e,t){const{type:i}=this;let n,s=!1;const a=r=>{switch(typeof r){case"string":case"number":case"boolean":s?n!==r&&(n=r,t[0].textContent=r):(s=!0,n=r,t=Q(e.parentNode,t,[ge(e,r)],G,e));break;case"function":a(r(e));break;case"object":case"undefined":if(null==r){s=!1,t=Q(e.parentNode,t,[],G,e);break}default:if(s=!1,n=r,$(r))if(0===r.length)t.length&&(t=Q(e.parentNode,t,[],G,e));else switch(typeof r[0]){case"string":case"number":case"boolean":a(String(r));break;case"function":a(r.map(be,e));break;case"object":$(r[0])&&(r=r.concat.apply([],r));default:t=Q(e.parentNode,t,r,G,e)}else"ELEMENT_NODE"in r?t=Q(e.parentNode,t,11===r.nodeType?W.call(r.childNodes):[r],G,e):"text"in r?a(String(r.text)):"any"in r?a(r.any):"html"in r?t=Q(e.parentNode,t,W.call(J([].concat(r.html).join(""),i).childNodes),G,e):"length"in r&&a(W.call(r))}};return a},text(e){let t;const i=n=>{if(t!==n){t=n;const s=typeof n;"object"===s&&n?"text"in n?i(String(n.text)):"any"in n?i(n.any):"html"in n?i([].concat(n.html).join("")):"length"in n&&i(W.call(n).join("")):"function"===s?i(n(e)):e.textContent=null==n?"":n}};return i}};const{create:_e,freeze:ye,keys:xe}=Object,we=ve.prototype,Se=H(new _),Re=e=>({html:ke("html",e),svg:ke("svg",e),render(t,i){const n="function"==typeof i?i():i,s=Se.get(t)||Se.set(t,Ce()),a=n instanceof Ee?Te(e,s,n):n;return a!==s.wire&&(s.wire=a,t.textContent="",t.appendChild(a.valueOf())),t}}),Ce=()=>({stack:[],entry:null,wire:null}),ke=(e,t)=>{const i=H(new _);return n.for=(e,s)=>{const a=i.get(e)||i.set(e,_e(null));return a[s]||(a[s]=(e=>function(){return Te(t,e,n.apply(null,arguments))})(Ce()))},n.node=function(){return Te(t,Ce(),n.apply(null,arguments)).valueOf()},n;function n(){return new Ee(e,De.apply(null,arguments))}},Te=(e,t,{type:i,template:n,values:s})=>{const{length:a}=s;Pe(e,t,s,a);let{entry:r}=t;if(r&&r.template===n&&r.type===i)r.tag(n,...s);else{const a=new e(i);t.entry=r={type:i,template:n,tag:a,wire:K(a(n,...s))}}return r.wire},Pe=(e,{stack:t},i,n)=>{for(let s=0;s<n;s++){const n=i[s];n instanceof Oe?i[s]=Te(e,t[s]||(t[s]=Ce()),n):$(n)?Pe(e,t[s]||(t[s]=Ce()),n,n.length):t[s]=null}n<t.length&&t.splice(n)};function Ee(e,t){this.type=e,this.template=t.shift(),this.values=t}ye(Ee);const Oe=Ee;function De(){let e=[],t=0,{length:i}=arguments;for(;t<i;)e.push(arguments[t++]);return e}Re(ve);var Ie="function"==typeof cancelAnimationFrame,je=Ie?cancelAnimationFrame:clearTimeout,Le=Ie?requestAnimationFrame:setTimeout;function Me(e){var t,i,n,s,a;return o(),function(e,o,p){return n=e,s=o,a=p,i||(i=Le(r)),--t<0&&c(!0),c};function r(){o(),n.apply(s,a||[])}function o(){t=e||1/0,i=Ie?0:null}function c(e){var t=!!i;return t&&(je(i),e&&r()),t}}
10
- /*! (c) Andrea Giammarchi - ISC */let Ae=null;const Ne=H(new WeakMap),Be=(e,t,i)=>{e.apply(t,i)},Fe={async:!1,always:!1},Ue=(e,t)=>"function"==typeof t?t(e):t,ze=(e,t,i,n)=>{const s=Ae.i++,{hook:a,args:r,stack:o,length:c}=Ae;s===c&&(Ae.length=o.push({}));const p=o[s];if(p.args=r,s===c){const s="function"==typeof i,{async:r,always:o}=(s?n:i)||n||Fe;p.$=s?i(t):Ue(void 0,t),p._=r?Ne.get(a)||Ne.set(a,Me()):Be,p.f=t=>{const i=e(p.$,t);(o||p.$!==i)&&(p.$=i,p._(a,null,p.args))}}return[p.$,p.f]},qe=new WeakMap;function $e({hook:e}){return e===this.hook}const Ve=new WeakMap,We=H(Ve),He=()=>{},Ge=e=>(t,i)=>{const n=Ae.i++,{hook:s,after:a,stack:r,length:o}=Ae;if(n<o){const s=r[n],{update:o,values:c,stop:p}=s;if(!i||i.some(Xe,c)){s.values=i,e&&p(e);const{clean:n}=s;n&&(s.clean=null,n());const r=()=>{s.clean=t()};e?o(r):a.push(r)}}else{const n=e?Me():He,o={clean:null,update:n,values:i,stop:He};Ae.length=r.push(o),(We.get(s)||We.set(s,[])).push(o);const c=()=>{o.clean=t()};e?o.stop=n(c):a.push(c)}},Ke=e=>{(Ve.get(e)||[]).forEach((e=>{const{clean:t,stop:i}=e;i(),t&&(e.clean=null,t())}))};Ve.has.bind(Ve);const Je=Ge(!0),Qe=Ge(!1),Ye=(e,t)=>{const i=Ae.i++,{stack:n,length:s}=Ae;return i===s?Ae.length=n.push({$:e(),_:t}):t&&!t.some(Xe,n[i]._)||(n[i]={$:e(),_:t}),n[i].$};function Xe(e,t){return e!==this[t]}let Ze=null;try{Ze=new{o(){}}.o}catch(Yt){}let et=e=>class extends e{};if(Ze){const{getPrototypeOf:e,setPrototypeOf:t}=Object,{construct:i}="object"==typeof Reflect?Reflect:{construct(e,i,n){const s=[null];for(let e=0;e<i.length;e++)s.push(i[e]);const a=e.bind.apply(e,s);return t(new a,n.prototype)}};et=function(n,s){function a(){return i(s?e(n):n,arguments,a)}return t(a.prototype,n.prototype),t(a,n)}}const tt={map:{},re:null},it=e=>new RegExp(`<(/)?(${e.join("|")})([^A-Za-z0-9:._-])`,"g");let nt=null;const st=(e,t)=>{const{map:i,re:n}=nt||t;return e.replace(n,((e,t,n,s)=>{const{tagName:a,is:r,element:o}=i[n];return o?t?`</${r}>`:`<${r}${s}`:t?`</${a}>`:`<${a} is="${r}"${s}`}))},at=({tagName:e,is:t,element:i})=>i?t:`${e}[is="${t}"]`,rt=()=>nt,ot=e=>{nt=e},ct={useCallback:(e,t)=>Ye((()=>e),t),useContext:e=>{const{hook:t,args:i}=Ae,n=qe.get(e),s={hook:t,args:i};return n.some($e,s)||n.push(s),e.value},useEffect:Je,useLayoutEffect:Qe,useMemo:Ye,useReducer:ze,useRef:e=>{const t=Ae.i++,{stack:i,length:n}=Ae;return t===n&&(Ae.length=i.push({current:e})),i[t]},useState:(e,t)=>ze(Ue,e,void 0,t)},{render:pt,html:dt,svg:lt}=(e=>{const t=_e(we);return xe(e).forEach((i=>{t[i]=e[i](t[i]||("convert"===i?D:String))})),i.prototype=t,Re(i);function i(){return ve.apply(this,arguments)}})({transform:()=>e=>st(e,tt)}),{defineProperties:ut}=Object,mt=new _,ht=new _,ft=new _,gt=new C,vt="attributeChangedCallback",bt="connectedCallback",_t=`dis${bt}`,yt=(e,t,i)=>{if(i in e){const n=e[i];t[i]={configurable:true,value(){return It.call(this),n.apply(this,arguments)}}}else t[i]={configurable:true,value:It}},xt=e=>{const{prototype:t}=e,i=[],n={html:{configurable:true,get:Et},svg:{configurable:true,get:Ot}};if(n["_🔥"]={value:{events:i,info:null}},"handleEvent"in t||(n.handleEvent={configurable:true,value:Dt}),"render"in t&&t.render.length){const{oninit:e}=t;ut(t,{oninit:{configurable:true,value(){const t=(e=>{const t=[];return function i(){const n=Ae,s=[];Ae={hook:i,args:arguments,stack:t,i:0,length:t.length,after:s};try{return e.apply(null,arguments)}finally{Ae=n;for(let e=0,{length:t}=s;e<t;e++)s[e]()}}})(this.render.bind(this,ct));ut(this,{render:{configurable:true,value:t}}),this.addEventListener("disconnected",Ke.bind(null,t),!1),e&&e.apply(this,arguments)}}})}"oninit"in t&&(i.push("init"),yt(t,n,"render")),yt(t,n,vt),yt(t,n,bt),yt(t,n,_t),[[vt,"onattributechanged",jt],[bt,"onconnected",Lt],[_t,"ondisconnected",At],[bt,"render",Mt]].forEach((([e,s,a])=>{if(!(e in t)&&s in t)if("render"!==s&&i.push(s.slice(2)),e in n){const t=n[e].value;n[e]={configurable:true,value(){return t.apply(this,arguments),a.apply(this,arguments)}}}else n[e]={configurable:true,value:a}}));const s=e.booleanAttributes||[];s.forEach((e=>{e in t||(n[e]={configurable:true,get(){return this.hasAttribute(e)},set(t){t&&"false"!==t?this.setAttribute(e,t):this.removeAttribute(e)}})}));const a=e.observedAttributes||[];a.forEach((e=>{e in t||(n[e]={configurable:true,get(){return this.getAttribute(e)},set(t){null==t?this.removeAttribute(e):this.setAttribute(e,t)}})}));(e.mappedAttributes||[]).forEach((e=>{const s=new _,a="on"+e in t;a&&i.push(e),n[e]={configurable:true,get(){return s.get(this)},set(t){if(s.set(this,t),a){const i=wt(e);if(i.detail=t,gt.has(this))this.dispatchEvent(i);else{const e=ft.get(this);e?e.push(i):ft.set(this,[i])}}}}})),ut(t,n);const r=s.concat(a);return r.length?ut(e,{observedAttributes:{configurable:true,get:()=>r}}):e},wt=e=>new x(e),St=(...e)=>new Oe("html",e);St.for=dt.for;const Rt=(...e)=>new Oe("svg",e);Rt.for=lt.for;const Ct=(e,t,i)=>{const n=kt(e,t,new _);return i.set(e,n),n},kt=(e,t,i)=>(n,...s)=>{const a=i.get(n)||((e,t,{info:i})=>{const n=i?st(t.join("_🔥"),i).split("_🔥"):t;return e.set(t,n),n})(i,n,e["_🔥"]);return pt(e,(()=>t(a,...s)))};function Tt(e){this.addEventListener(e,this)}function Pt(e){this.dispatchEvent(e)}function Et(){return mt.get(this)||Ct(this,St,mt)}function Ot(){return ht.get(this)||Ct(this,Rt,ht)}function Dt(e){this[`on${e.type}`](e)}function It(){if(!gt.has(this)){gt.add(this),this["_🔥"].events.forEach(Tt,this),this.dispatchEvent(wt("init"));const e=ft.get(this);e&&(ft.delete(this),e.forEach(Pt,this))}}function jt(e,t,i){const n=wt("attributechanged");n.attributeName=e,n.oldValue=t,n.newValue=i,this.dispatchEvent(n)}function Lt(){this.dispatchEvent(wt("connected"))}function Mt(){this.render()}function At(){this.dispatchEvent(wt("disconnected"))}const{create:Nt,defineProperty:Bt,defineProperties:Ft,getOwnPropertyNames:Ut,getOwnPropertySymbols:zt,getOwnPropertyDescriptor:qt,keys:$t}=Object,Vt={element:HTMLElement},Wt=new _;new _;const Ht=new _;new _;const Gt=e=>{const t=Nt(null),i=Nt(null),n={prototype:i,statics:t};return Ut(e).concat(zt(e)).forEach((n=>{const s=qt(e,n);switch(s.enumerable=!1,n){case"extends":n="tagName";case"contains":case"includes":case"name":case"booleanAttributes":case"mappedAttributes":case"observedAttributes":case"style":case"tagName":t[n]=s;break;default:i[n]=s}})),n},Kt=(e,t,i)=>{if(!/^([A-Z][A-Za-z0-9_]*)(<([A-Za-z0-9:._-]+)>|:([A-Za-z0-9:._-]+))?$/.test(e))throw"Invalid name";const{$1:n,$3:s,$4:a}=RegExp;let r=s||a||t.tagName||t.extends||"element";const o="fragment"===r;if(o)r="element";else if(!/^[A-Za-z0-9:._-]+$/.test(r))throw"Invalid tag";let c="",p="";r.indexOf("-")<0?(c=n.replace(/(([A-Z0-9])([A-Z0-9][a-z]))|(([a-z])([A-Z]))/g,"$2$5-$3$6").toLowerCase()+i,c.indexOf("-")<0&&(p="-heresy")):(c=r+i,r="element");const d=c+p;if(customElements.get(d))throw`Duplicated ${d} definition`;const l=et("object"==typeof t?Ht.get(t)||((e,t)=>{const{statics:i,prototype:n}=Gt(e),s=et(Vt[t]||(Vt[t]=document.createElement(t).constructor),!1);return Ft(s.prototype,n),Ft(s,i),Ht.set(e,xt(s)),s})(t,r):Wt.get(t)||(e=>{const t=et(e,!1);return Wt.set(e,xt(t)),t})(t),!0),u="element"===r;if(Bt(l,"new",{value:u?()=>document.createElement(d):()=>document.createElement(r,{is:d})}),Bt(l.prototype,"is",{value:d}),""===i){const e=(e=>{const{length:t}=e;let i=0,n=0;for(;n<t;)i=(i<<5)-i+e.charCodeAt(n++),i&=i;return i.toString(36)})(c.toUpperCase());tt.map[n]=Jt(l,r,d,{id:e,i:0}),tt.re=it($t(tt.map))}if(o){const{render:e}=l.prototype;Bt(l.prototype,"render",{configurable:!0,value(){if(e&&e.apply(this,arguments),this.parentNode){const{firstChild:e}=this;let t=null;if(e){const i=document.createRange();i.setStartBefore(e),i.setEndAfter(this.lastChild),t=i.extractContents(),this.parentNode.replaceChild(t,this)}}}})}const m=[d,l];return u||m.push({extends:r}),customElements.define(...m),{Class:l,is:d,name:n,tagName:r}},Jt=(e,t,i,n)=>{const{prototype:s}=e,a=((e,t)=>({tagName:e,is:t,element:"element"===e}))(t,i),r=[at(a)],o=e.includes||e.contains;if(o){const e={};$t(o).forEach((t=>{const i=`-${n.id}-${n.i++}`,{Class:s,is:a,name:c,tagName:p}=Kt(t,o[t],i);r.push(at(e[c]=Jt(s,p,a,n)))}));const t=it($t(e)),{events:i}=s["_🔥"],a={events:i,info:{map:e,re:t}};if(Bt(s,"_🔥",{value:a}),"render"in s){const{render:e}=s,{info:t}=a;Bt(s,"render",{configurable:!0,value(){const i=rt();ot(t);const n=e.apply(this,arguments);return ot(i),n}})}}return"style"in e&&(e=>{if((e||"").length){const t=document.createElement("style");t.type="text/css",t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e));const i=document.head||document.querySelector("head");i.insertBefore(t,i.lastChild)}})(e.style(...r)),a},Qt=["audio","background","cameraaccess","chat","people","embed","emptyRoomInvitation","help","leaveButton","precallReview","screenshare","video","floatSelf","recording","logo","locking","participantCount","settingsButton","pipButton","moreButton","personality","subgridLabels","lowData","breakout"];var Yt,Xt;function Zt(e,t,i,n){return new(i||(i=Promise))((function(s,a){function r(e){try{c(n.next(e))}catch(e){a(e)}}function o(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,o)}c((n=n.apply(e,t||[])).next())}))}Yt="WherebyEmbed",Xt={oninit(){this.iframe=((e,t)=>e?e[t]||(e[t]={current:null}):{current:null})()},onconnected(){window.addEventListener("message",this.onmessage)},ondisconnected(){window.removeEventListener("message",this.onmessage)},observedAttributes:["displayName","minimal","room","subdomain","lang","metadata","groups","virtualBackgroundUrl","avatarUrl",...Qt].map((e=>e.toLowerCase())),onattributechanged({attributeName:e,oldValue:t}){["room","subdomain"].includes(e)&&null==t||this.render()},style:e=>`\n ${e} {\n display: block;\n }\n ${e} iframe {\n border: none;\n height: 100%;\n width: 100%;\n }\n `,_postCommand(e,t=[]){if(this.iframe.current){const i=new URL(this.room,`https://${this.subdomain}.whereby.com`);this.iframe.current.contentWindow.postMessage({command:e,args:t},i.origin)}},startRecording(){this._postCommand("start_recording")},stopRecording(){this._postCommand("stop_recording")},toggleCamera(e){this._postCommand("toggle_camera",[e])},toggleMicrophone(e){this._postCommand("toggle_microphone",[e])},toggleScreenshare(e){this._postCommand("toggle_screenshare",[e])},onmessage({origin:e,data:t}){if(e!==new URL(this.room,`https://${this.subdomain}.whereby.com`).origin)return;const{type:i,payload:n}=t;this.dispatchEvent(new CustomEvent(i,{detail:n}))},render(){const{avatarurl:e,displayname:t,lang:i,metadata:n,minimal:s,room:a,groups:r,virtualbackgroundurl:o}=this;if(!a)return this.html`Whereby: Missing room attribute.`;const c=/https:\/\/([^.]+)\.whereby.com\/.+/.exec(a),p=c&&c[1]||this.subdomain;if(!p)return this.html`Whereby: Missing subdomain attr.`;const d=new URL(a,`https://${p}.whereby.com`);return Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({jsApi:!0,we:"2.0.0-alpha9",iframeSource:p},t&&{displayName:t}),i&&{lang:i}),n&&{metadata:n}),r&&{groups:r}),o&&{virtualBackgroundUrl:o}),e&&{avatarUrl:e}),null!=s&&{embed:s}),Qt.reduce(((e,t)=>null!=this[t.toLowerCase()]?Object.assign(Object.assign({},e),{[t]:this[t.toLowerCase()]}):e),{}))).forEach((([e,t])=>{d.searchParams.has(e)||"string"!=typeof t||d.searchParams.set(e,t)})),this.html`
11
- <iframe
12
- ref=${this.iframe}
13
- src=${d}
14
- allow="autoplay; camera; microphone; fullscreen; speaker; display-capture" />
15
- `}},("string"==typeof Yt?Kt(Yt,Xt,""):Kt(Yt.name,Yt,"")).Class;var ei="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ti(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ii(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var i=function e(){if(this instanceof e){var i=[null];i.push.apply(i,arguments);var n=Function.bind.apply(t,i);return new n}return t.apply(this,arguments)};i.prototype=t.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(i,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),i}var ni,si={},ai={};function ri(){if(ni)return ai;ni=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),r=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),l=Symbol.iterator;var u={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},m=Object.assign,h={};function f(e,t,i){this.props=e,this.context=t,this.refs=h,this.updater=i||u}function g(){}function v(e,t,i){this.props=e,this.context=t,this.refs=h,this.updater=i||u}f.prototype.isReactComponent={},f.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},f.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},g.prototype=f.prototype;var b=v.prototype=new g;b.constructor=v,m(b,f.prototype),b.isPureReactComponent=!0;var _=Array.isArray,y=Object.prototype.hasOwnProperty,x={current:null},w={key:!0,ref:!0,__self:!0,__source:!0};function S(t,i,n){var s,a={},r=null,o=null;if(null!=i)for(s in void 0!==i.ref&&(o=i.ref),void 0!==i.key&&(r=""+i.key),i)y.call(i,s)&&!w.hasOwnProperty(s)&&(a[s]=i[s]);var c=arguments.length-2;if(1===c)a.children=n;else if(1<c){for(var p=Array(c),d=0;d<c;d++)p[d]=arguments[d+2];a.children=p}if(t&&t.defaultProps)for(s in c=t.defaultProps)void 0===a[s]&&(a[s]=c[s]);return{$$typeof:e,type:t,key:r,ref:o,props:a,_owner:x.current}}function R(t){return"object"==typeof t&&null!==t&&t.$$typeof===e}var C=/\/+/g;function k(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,(function(e){return t[e]}))}(""+e.key):t.toString(36)}function T(i,n,s,a,r){var o=typeof i;"undefined"!==o&&"boolean"!==o||(i=null);var c=!1;if(null===i)c=!0;else switch(o){case"string":case"number":c=!0;break;case"object":switch(i.$$typeof){case e:case t:c=!0}}if(c)return r=r(c=i),i=""===a?"."+k(c,0):a,_(r)?(s="",null!=i&&(s=i.replace(C,"$&/")+"/"),T(r,n,s,"",(function(e){return e}))):null!=r&&(R(r)&&(r=function(t,i){return{$$typeof:e,type:t.type,key:i,ref:t.ref,props:t.props,_owner:t._owner}}(r,s+(!r.key||c&&c.key===r.key?"":(""+r.key).replace(C,"$&/")+"/")+i)),n.push(r)),1;if(c=0,a=""===a?".":a+":",_(i))for(var p=0;p<i.length;p++){var d=a+k(o=i[p],p);c+=T(o,n,s,d,r)}else if(d=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=l&&e[l]||e["@@iterator"])?e:null}(i),"function"==typeof d)for(i=d.call(i),p=0;!(o=i.next()).done;)c+=T(o=o.value,n,s,d=a+k(o,p++),r);else if("object"===o)throw n=String(i),Error("Objects are not valid as a React child (found: "+("[object Object]"===n?"object with keys {"+Object.keys(i).join(", ")+"}":n)+"). If you meant to render a collection of children, use an array instead.");return c}function P(e,t,i){if(null==e)return e;var n=[],s=0;return T(e,n,"","",(function(e){return t.call(i,e,s++)})),n}function E(e){if(-1===e._status){var t=e._result;(t=t()).then((function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)}),(function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)})),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var O={current:null},D={transition:null},I={ReactCurrentDispatcher:O,ReactCurrentBatchConfig:D,ReactCurrentOwner:x};return ai.Children={map:P,forEach:function(e,t,i){P(e,(function(){t.apply(this,arguments)}),i)},count:function(e){var t=0;return P(e,(function(){t++})),t},toArray:function(e){return P(e,(function(e){return e}))||[]},only:function(e){if(!R(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},ai.Component=f,ai.Fragment=i,ai.Profiler=s,ai.PureComponent=v,ai.StrictMode=n,ai.Suspense=c,ai.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=I,ai.cloneElement=function(t,i,n){if(null==t)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var s=m({},t.props),a=t.key,r=t.ref,o=t._owner;if(null!=i){if(void 0!==i.ref&&(r=i.ref,o=x.current),void 0!==i.key&&(a=""+i.key),t.type&&t.type.defaultProps)var c=t.type.defaultProps;for(p in i)y.call(i,p)&&!w.hasOwnProperty(p)&&(s[p]=void 0===i[p]&&void 0!==c?c[p]:i[p])}var p=arguments.length-2;if(1===p)s.children=n;else if(1<p){c=Array(p);for(var d=0;d<p;d++)c[d]=arguments[d+2];s.children=c}return{$$typeof:e,type:t.type,key:a,ref:r,props:s,_owner:o}},ai.createContext=function(e){return(e={$$typeof:r,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:a,_context:e},e.Consumer=e},ai.createElement=S,ai.createFactory=function(e){var t=S.bind(null,e);return t.type=e,t},ai.createRef=function(){return{current:null}},ai.forwardRef=function(e){return{$$typeof:o,render:e}},ai.isValidElement=R,ai.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:E}},ai.memo=function(e,t){return{$$typeof:p,type:e,compare:void 0===t?null:t}},ai.startTransition=function(e){var t=D.transition;D.transition={};try{e()}finally{D.transition=t}},ai.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")},ai.useCallback=function(e,t){return O.current.useCallback(e,t)},ai.useContext=function(e){return O.current.useContext(e)},ai.useDebugValue=function(){},ai.useDeferredValue=function(e){return O.current.useDeferredValue(e)},ai.useEffect=function(e,t){return O.current.useEffect(e,t)},ai.useId=function(){return O.current.useId()},ai.useImperativeHandle=function(e,t,i){return O.current.useImperativeHandle(e,t,i)},ai.useInsertionEffect=function(e,t){return O.current.useInsertionEffect(e,t)},ai.useLayoutEffect=function(e,t){return O.current.useLayoutEffect(e,t)},ai.useMemo=function(e,t){return O.current.useMemo(e,t)},ai.useReducer=function(e,t,i){return O.current.useReducer(e,t,i)},ai.useRef=function(e){return O.current.useRef(e)},ai.useState=function(e){return O.current.useState(e)},ai.useSyncExternalStore=function(e,t,i){return O.current.useSyncExternalStore(e,t,i)},ai.useTransition=function(){return O.current.useTransition()},ai.version="18.2.0",ai}var oi,ci,pi={},di={get exports(){return pi},set exports(e){pi=e}};function li(){return oi||(oi=1,e=di,t=pi,"production"!==process.env.NODE_ENV&&function(){"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var i=Symbol.for("react.element"),n=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),c=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),u=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),f=Symbol.iterator;function g(e){if(null===e||"object"!=typeof e)return null;var t=f&&e[f]||e["@@iterator"];return"function"==typeof t?t:null}var v={current:null},b={transition:null},_={current:null,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1},y={current:null},x={},w=null;function S(e){w=e}x.setExtraStackFrame=function(e){w=e},x.getCurrentStack=null,x.getStackAddendum=function(){var e="";w&&(e+=w);var t=x.getCurrentStack;return t&&(e+=t()||""),e};var R={ReactCurrentDispatcher:v,ReactCurrentBatchConfig:b,ReactCurrentOwner:y};function C(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];T("warn",e,i)}function k(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];T("error",e,i)}function T(e,t,i){var n=R.ReactDebugCurrentFrame.getStackAddendum();""!==n&&(t+="%s",i=i.concat([n]));var s=i.map((function(e){return String(e)}));s.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,s)}R.ReactDebugCurrentFrame=x,R.ReactCurrentActQueue=_;var P={};function E(e,t){var i=e.constructor,n=i&&(i.displayName||i.name)||"ReactClass",s=n+"."+t;P[s]||(k("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",t,n),P[s]=!0)}var O={isMounted:function(e){return!1},enqueueForceUpdate:function(e,t,i){E(e,"forceUpdate")},enqueueReplaceState:function(e,t,i,n){E(e,"replaceState")},enqueueSetState:function(e,t,i,n){E(e,"setState")}},D=Object.assign,I={};function j(e,t,i){this.props=e,this.context=t,this.refs=I,this.updater=i||O}Object.freeze(I),j.prototype.isReactComponent={},j.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw new Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},j.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};var L={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]},M=function(e,t){Object.defineProperty(j.prototype,e,{get:function(){C("%s(...) is deprecated in plain JavaScript React classes. %s",t[0],t[1])}})};for(var A in L)L.hasOwnProperty(A)&&M(A,L[A]);function N(){}function B(e,t,i){this.props=e,this.context=t,this.refs=I,this.updater=i||O}N.prototype=j.prototype;var F=B.prototype=new N;F.constructor=B,D(F,j.prototype),F.isPureReactComponent=!0;var U=Array.isArray;function z(e){return U(e)}function q(e){return""+e}function $(e){if(function(e){try{return q(e),!1}catch(e){return!0}}(e))return k("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",function(e){return"function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object"}(e)),q(e)}function V(e){return e.displayName||"Context"}function W(e){if(null==e)return null;if("number"==typeof e.tag&&k("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),"function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case s:return"Fragment";case n:return"Portal";case r:return"Profiler";case a:return"StrictMode";case d:return"Suspense";case l:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case c:return V(e)+".Consumer";case o:return V(e._context)+".Provider";case p:return function(e,t,i){var n=e.displayName;if(n)return n;var s=t.displayName||t.name||"";return""!==s?i+"("+s+")":i}(e,e.render,"ForwardRef");case u:var t=e.displayName||null;return null!==t?t:W(e.type)||"Memo";case m:var i=e,h=i._payload,f=i._init;try{return W(f(h))}catch(e){return null}}return null}var H,G,K,J=Object.prototype.hasOwnProperty,Q={key:!0,ref:!0,__self:!0,__source:!0};function Y(e){if(J.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return void 0!==e.ref}function X(e){if(J.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}function Z(e,t){var i=function(){H||(H=!0,k("%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)",t))};i.isReactWarning=!0,Object.defineProperty(e,"key",{get:i,configurable:!0})}function ee(e,t){var i=function(){G||(G=!0,k("%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)",t))};i.isReactWarning=!0,Object.defineProperty(e,"ref",{get:i,configurable:!0})}function te(e){if("string"==typeof e.ref&&y.current&&e.__self&&y.current.stateNode!==e.__self){var t=W(y.current.type);K[t]||(k('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',t,e.ref),K[t]=!0)}}K={};var ie=function(e,t,n,s,a,r,o){var c={$$typeof:i,type:e,key:t,ref:n,props:o,_owner:r,_store:{}};return Object.defineProperty(c._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(c,"_self",{configurable:!1,enumerable:!1,writable:!1,value:s}),Object.defineProperty(c,"_source",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.freeze&&(Object.freeze(c.props),Object.freeze(c)),c};function ne(e,t,i){var n,s={},a=null,r=null,o=null,c=null;if(null!=t)for(n in Y(t)&&(r=t.ref,te(t)),X(t)&&($(t.key),a=""+t.key),o=void 0===t.__self?null:t.__self,c=void 0===t.__source?null:t.__source,t)J.call(t,n)&&!Q.hasOwnProperty(n)&&(s[n]=t[n]);var p=arguments.length-2;if(1===p)s.children=i;else if(p>1){for(var d=Array(p),l=0;l<p;l++)d[l]=arguments[l+2];Object.freeze&&Object.freeze(d),s.children=d}if(e&&e.defaultProps){var u=e.defaultProps;for(n in u)void 0===s[n]&&(s[n]=u[n])}if(a||r){var m="function"==typeof e?e.displayName||e.name||"Unknown":e;a&&Z(s,m),r&&ee(s,m)}return ie(e,a,r,o,c,y.current,s)}function se(e,t,i){if(null==e)throw new Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var n,s,a=D({},e.props),r=e.key,o=e.ref,c=e._self,p=e._source,d=e._owner;if(null!=t)for(n in Y(t)&&(o=t.ref,d=y.current),X(t)&&($(t.key),r=""+t.key),e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)J.call(t,n)&&!Q.hasOwnProperty(n)&&(void 0===t[n]&&void 0!==s?a[n]=s[n]:a[n]=t[n]);var l=arguments.length-2;if(1===l)a.children=i;else if(l>1){for(var u=Array(l),m=0;m<l;m++)u[m]=arguments[m+2];a.children=u}return ie(e.type,r,o,c,p,d,a)}function ae(e){return"object"==typeof e&&null!==e&&e.$$typeof===i}var re,oe=!1,ce=/\/+/g;function pe(e){return e.replace(ce,"$&/")}function de(e,t){return"object"==typeof e&&null!==e&&null!=e.key?($(e.key),i=""+e.key,n={"=":"=0",":":"=2"},"$"+i.replace(/[=:]/g,(function(e){return n[e]}))):t.toString(36);var i,n}function le(e,t,s,a,r){var o=typeof e;"undefined"!==o&&"boolean"!==o||(e=null);var c,p,d,l=!1;if(null===e)l=!0;else switch(o){case"string":case"number":l=!0;break;case"object":switch(e.$$typeof){case i:case n:l=!0}}if(l){var u=e,m=r(u),h=""===a?"."+de(u,0):a;if(z(m)){var f="";null!=h&&(f=pe(h)+"/"),le(m,t,f,"",(function(e){return e}))}else null!=m&&(ae(m)&&(!m.key||u&&u.key===m.key||$(m.key),c=m,p=s+(!m.key||u&&u.key===m.key?"":pe(""+m.key)+"/")+h,m=ie(c.type,p,c.ref,c._self,c._source,c._owner,c.props)),t.push(m));return 1}var v=0,b=""===a?".":a+":";if(z(e))for(var _=0;_<e.length;_++)v+=le(d=e[_],t,s,b+de(d,_),r);else{var y=g(e);if("function"==typeof y){var x=e;y===x.entries&&(oe||C("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),oe=!0);for(var w,S=y.call(x),R=0;!(w=S.next()).done;)v+=le(d=w.value,t,s,b+de(d,R++),r)}else if("object"===o){var k=String(e);throw new Error("Objects are not valid as a React child (found: "+("[object Object]"===k?"object with keys {"+Object.keys(e).join(", ")+"}":k)+"). If you meant to render a collection of children, use an array instead.")}}return v}function ue(e,t,i){if(null==e)return e;var n=[],s=0;return le(e,n,"","",(function(e){return t.call(i,e,s++)})),n}function me(e){if(-1===e._status){var t=(0,e._result)();if(t.then((function(t){if(0===e._status||-1===e._status){var i=e;i._status=1,i._result=t}}),(function(t){if(0===e._status||-1===e._status){var i=e;i._status=2,i._result=t}})),-1===e._status){var i=e;i._status=0,i._result=t}}if(1===e._status){var n=e._result;return void 0===n&&k("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?",n),"default"in n||k("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))",n),n.default}throw e._result}function he(e){return"string"==typeof e||"function"==typeof e||e===s||e===r||e===a||e===d||e===l||e===h||"object"==typeof e&&null!==e&&(e.$$typeof===m||e.$$typeof===u||e.$$typeof===o||e.$$typeof===c||e.$$typeof===p||e.$$typeof===re||void 0!==e.getModuleId)}function fe(){var e=v.current;return null===e&&k("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem."),e}re=Symbol.for("react.module.reference");var ge,ve,be,_e,ye,xe,we,Se=0;function Re(){}Re.__reactDisabledLog=!0;var Ce,ke=R.ReactCurrentDispatcher;function Te(e,t,i){if(void 0===Ce)try{throw Error()}catch(e){var n=e.stack.trim().match(/\n( *(at )?)/);Ce=n&&n[1]||""}return"\n"+Ce+e}var Pe,Ee=!1,Oe="function"==typeof WeakMap?WeakMap:Map;function De(e,t){if(!e||Ee)return"";var i,n=Pe.get(e);if(void 0!==n)return n;Ee=!0;var s,a=Error.prepareStackTrace;Error.prepareStackTrace=void 0,s=ke.current,ke.current=null,function(){if(0===Se){ge=console.log,ve=console.info,be=console.warn,_e=console.error,ye=console.group,xe=console.groupCollapsed,we=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Re,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}Se++}();try{if(t){var r=function(){throw Error()};if(Object.defineProperty(r.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(r,[])}catch(e){i=e}Reflect.construct(e,[],r)}else{try{r.call()}catch(e){i=e}e.call(r.prototype)}}else{try{throw Error()}catch(e){i=e}e()}}catch(t){if(t&&i&&"string"==typeof t.stack){for(var o=t.stack.split("\n"),c=i.stack.split("\n"),p=o.length-1,d=c.length-1;p>=1&&d>=0&&o[p]!==c[d];)d--;for(;p>=1&&d>=0;p--,d--)if(o[p]!==c[d]){if(1!==p||1!==d)do{if(p--,--d<0||o[p]!==c[d]){var l="\n"+o[p].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),"function"==typeof e&&Pe.set(e,l),l}}while(p>=1&&d>=0);break}}}finally{Ee=!1,ke.current=s,function(){if(0==--Se){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:D({},e,{value:ge}),info:D({},e,{value:ve}),warn:D({},e,{value:be}),error:D({},e,{value:_e}),group:D({},e,{value:ye}),groupCollapsed:D({},e,{value:xe}),groupEnd:D({},e,{value:we})})}Se<0&&k("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=a}var u=e?e.displayName||e.name:"",m=u?Te(u):"";return"function"==typeof e&&Pe.set(e,m),m}function Ie(e,t,i){if(null==e)return"";if("function"==typeof e)return De(e,function(e){var t=e.prototype;return!(!t||!t.isReactComponent)}(e));if("string"==typeof e)return Te(e);switch(e){case d:return Te("Suspense");case l:return Te("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case p:return De(e.render,!1);case u:return Ie(e.type,t,i);case m:var n=e,s=n._payload,a=n._init;try{return Ie(a(s),t,i)}catch(e){}}return""}Pe=new Oe;var je,Le={},Me=R.ReactDebugCurrentFrame;function Ae(e){if(e){var t=e._owner,i=Ie(e.type,e._source,t?t.type:null);Me.setExtraStackFrame(i)}else Me.setExtraStackFrame(null)}function Ne(e){if(e){var t=e._owner;S(Ie(e.type,e._source,t?t.type:null))}else S(null)}function Be(){if(y.current){var e=W(y.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}function Fe(e){return null!=e&&void 0!==(t=e.__source)?"\n\nCheck your code at "+t.fileName.replace(/^.*[\\\/]/,"")+":"+t.lineNumber+".":"";var t}je=!1;var Ue={};function ze(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var i=function(e){var t=Be();if(!t){var i="string"==typeof e?e:e.displayName||e.name;i&&(t="\n\nCheck the top-level render call using <"+i+">.")}return t}(t);if(!Ue[i]){Ue[i]=!0;var n="";e&&e._owner&&e._owner!==y.current&&(n=" It was passed a child from "+W(e._owner.type)+"."),Ne(e),k('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',i,n),Ne(null)}}}function qe(e,t){if("object"==typeof e)if(z(e))for(var i=0;i<e.length;i++){var n=e[i];ae(n)&&ze(n,t)}else if(ae(e))e._store&&(e._store.validated=!0);else if(e){var s=g(e);if("function"==typeof s&&s!==e.entries)for(var a,r=s.call(e);!(a=r.next()).done;)ae(a.value)&&ze(a.value,t)}}function $e(e){var t,i=e.type;if(null!=i&&"string"!=typeof i){if("function"==typeof i)t=i.propTypes;else{if("object"!=typeof i||i.$$typeof!==p&&i.$$typeof!==u)return;t=i.propTypes}if(t){var n=W(i);!function(e,t,i,n,s){var a=Function.call.bind(J);for(var r in e)if(a(e,r)){var o=void 0;try{if("function"!=typeof e[r]){var c=Error((n||"React class")+": "+i+" type `"+r+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[r]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw c.name="Invariant Violation",c}o=e[r](t,r,n,i,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(e){o=e}!o||o instanceof Error||(Ae(s),k("%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).",n||"React class",i,r,typeof o),Ae(null)),o instanceof Error&&!(o.message in Le)&&(Le[o.message]=!0,Ae(s),k("Failed %s type: %s",i,o.message),Ae(null))}}(t,e.props,"prop",n,e)}else void 0===i.PropTypes||je||(je=!0,k("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",W(i)||"Unknown"));"function"!=typeof i.getDefaultProps||i.getDefaultProps.isReactClassApproved||k("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ve(e){for(var t=Object.keys(e.props),i=0;i<t.length;i++){var n=t[i];if("children"!==n&&"key"!==n){Ne(e),k("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),Ne(null);break}}null!==e.ref&&(Ne(e),k("Invalid attribute `ref` supplied to `React.Fragment`."),Ne(null))}function We(e,t,n){var a=he(e);if(!a){var r="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(r+=" 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 o,c=Fe(t);r+=c||Be(),null===e?o="null":z(e)?o="array":void 0!==e&&e.$$typeof===i?(o="<"+(W(e.type)||"Unknown")+" />",r=" Did you accidentally export a JSX literal instead of a component?"):o=typeof e,k("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",o,r)}var p=ne.apply(this,arguments);if(null==p)return p;if(a)for(var d=2;d<arguments.length;d++)qe(arguments[d],e);return e===s?Ve(p):$e(p),p}var He=!1,Ge=!1,Ke=null,Je=0,Qe=!1;function Ye(e){e!==Je-1&&k("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),Je=e}function Xe(t,i,n){var s=_.current;if(null!==s)try{et(s),function(t){if(null===Ke)try{var i=("require"+Math.random()).slice(0,7),n=e&&e[i];Ke=n.call(e,"timers").setImmediate}catch(e){Ke=function(e){!1===Ge&&(Ge=!0,"undefined"==typeof MessageChannel&&k("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var t=new MessageChannel;t.port1.onmessage=e,t.port2.postMessage(void 0)}}Ke(t)}((function(){0===s.length?(_.current=null,i(t)):Xe(t,i,n)}))}catch(e){n(e)}else i(t)}var Ze=!1;function et(e){if(!Ze){Ze=!0;var t=0;try{for(;t<e.length;t++){var i=e[t];do{i=i(!0)}while(null!==i)}e.length=0}catch(i){throw e=e.slice(t+1),i}finally{Ze=!1}}}var tt=We,it=function(e,t,i){for(var n=se.apply(this,arguments),s=2;s<arguments.length;s++)qe(arguments[s],n.type);return $e(n),n},nt=function(e){var t=We.bind(null,e);return t.type=e,He||(He=!0,C("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.")),Object.defineProperty(t,"type",{enumerable:!1,get:function(){return C("Factory.type is deprecated. Access the class directly before passing it to createFactory."),Object.defineProperty(this,"type",{value:e}),e}}),t},st={map:ue,forEach:function(e,t,i){ue(e,(function(){t.apply(this,arguments)}),i)},count:function(e){var t=0;return ue(e,(function(){t++})),t},toArray:function(e){return ue(e,(function(e){return e}))||[]},only:function(e){if(!ae(e))throw new Error("React.Children.only expected to receive a single React element child.");return e}};t.Children=st,t.Component=j,t.Fragment=s,t.Profiler=r,t.PureComponent=B,t.StrictMode=a,t.Suspense=d,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=R,t.cloneElement=it,t.createContext=function(e){var t={$$typeof:c,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null};t.Provider={$$typeof:o,_context:t};var i=!1,n=!1,s=!1,a={$$typeof:c,_context:t};return Object.defineProperties(a,{Provider:{get:function(){return n||(n=!0,k("Rendering <Context.Consumer.Provider> is not supported and will be removed in a future major release. Did you mean to render <Context.Provider> instead?")),t.Provider},set:function(e){t.Provider=e}},_currentValue:{get:function(){return t._currentValue},set:function(e){t._currentValue=e}},_currentValue2:{get:function(){return t._currentValue2},set:function(e){t._currentValue2=e}},_threadCount:{get:function(){return t._threadCount},set:function(e){t._threadCount=e}},Consumer:{get:function(){return i||(i=!0,k("Rendering <Context.Consumer.Consumer> is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?")),t.Consumer}},displayName:{get:function(){return t.displayName},set:function(e){s||(C("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.",e),s=!0)}}}),t.Consumer=a,t._currentRenderer=null,t._currentRenderer2=null,t},t.createElement=tt,t.createFactory=nt,t.createRef=function(){var e={current:null};return Object.seal(e),e},t.forwardRef=function(e){null!=e&&e.$$typeof===u?k("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):"function"!=typeof e?k("forwardRef requires a render function but was given %s.",null===e?"null":typeof e):0!==e.length&&2!==e.length&&k("forwardRef render functions accept exactly two parameters: props and ref. %s",1===e.length?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),null!=e&&(null==e.defaultProps&&null==e.propTypes||k("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?"));var t,i={$$typeof:p,render:e};return Object.defineProperty(i,"displayName",{enumerable:!1,configurable:!0,get:function(){return t},set:function(i){t=i,e.name||e.displayName||(e.displayName=i)}}),i},t.isValidElement=ae,t.lazy=function(e){var t,i,n={$$typeof:m,_payload:{_status:-1,_result:e},_init:me};return Object.defineProperties(n,{defaultProps:{configurable:!0,get:function(){return t},set:function(e){k("React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),t=e,Object.defineProperty(n,"defaultProps",{enumerable:!0})}},propTypes:{configurable:!0,get:function(){return i},set:function(e){k("React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),i=e,Object.defineProperty(n,"propTypes",{enumerable:!0})}}}),n},t.memo=function(e,t){he(e)||k("memo: The first argument must be a component. Instead received: %s",null===e?"null":typeof e);var i,n={$$typeof:u,type:e,compare:void 0===t?null:t};return Object.defineProperty(n,"displayName",{enumerable:!1,configurable:!0,get:function(){return i},set:function(t){i=t,e.name||e.displayName||(e.displayName=t)}}),n},t.startTransition=function(e,t){var i=b.transition;b.transition={};var n=b.transition;b.transition._updatedFibers=new Set;try{e()}finally{b.transition=i,null===i&&n._updatedFibers&&(n._updatedFibers.size>10&&C("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."),n._updatedFibers.clear())}},t.unstable_act=function(e){var t=Je;Je++,null===_.current&&(_.current=[]);var i,n=_.isBatchingLegacy;try{if(_.isBatchingLegacy=!0,i=e(),!n&&_.didScheduleLegacyUpdate){var s=_.current;null!==s&&(_.didScheduleLegacyUpdate=!1,et(s))}}catch(e){throw Ye(t),e}finally{_.isBatchingLegacy=n}if(null!==i&&"object"==typeof i&&"function"==typeof i.then){var a=i,r=!1,o={then:function(e,i){r=!0,a.then((function(n){Ye(t),0===Je?Xe(n,e,i):e(n)}),(function(e){Ye(t),i(e)}))}};return Qe||"undefined"==typeof Promise||Promise.resolve().then((function(){})).then((function(){r||(Qe=!0,k("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))})),o}var c=i;if(Ye(t),0===Je){var p=_.current;return null!==p&&(et(p),_.current=null),{then:function(e,t){null===_.current?(_.current=[],Xe(c,e,t)):e(c)}}}return{then:function(e,t){e(c)}}},t.useCallback=function(e,t){return fe().useCallback(e,t)},t.useContext=function(e){var t=fe();if(void 0!==e._context){var i=e._context;i.Consumer===e?k("Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?"):i.Provider===e&&k("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?")}return t.useContext(e)},t.useDebugValue=function(e,t){return fe().useDebugValue(e,t)},t.useDeferredValue=function(e){return fe().useDeferredValue(e)},t.useEffect=function(e,t){return fe().useEffect(e,t)},t.useId=function(){return fe().useId()},t.useImperativeHandle=function(e,t,i){return fe().useImperativeHandle(e,t,i)},t.useInsertionEffect=function(e,t){return fe().useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return fe().useLayoutEffect(e,t)},t.useMemo=function(e,t){return fe().useMemo(e,t)},t.useReducer=function(e,t,i){return fe().useReducer(e,t,i)},t.useRef=function(e){return fe().useRef(e)},t.useState=function(e){return fe().useState(e)},t.useSyncExternalStore=function(e,t,i){return fe().useSyncExternalStore(e,t,i)},t.useTransition=function(){return fe().useTransition()},t.version="18.2.0","undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),pi;var e,t}ci={get exports(){return si},set exports(e){si=e}},"production"===process.env.NODE_ENV?ci.exports=ri():ci.exports=li();var ui=ti(si),mi=e=>{var{muted:t,stream:i}=e,n=function(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(i[n[s]]=e[n[s]])}return i}(e,["muted","stream"]);const s=si.useRef(null);return si.useEffect((()=>{s.current&&(s.current.srcObject!==i&&(s.current.srcObject=i),s.current.muted!==t&&(s.current.muted=Boolean(t)))}),[t,i,s]),ui.createElement("video",Object.assign({ref:s,autoPlay:!0,playsInline:!0},n))};const hi=EventTarget;class fi extends hi{constructor(e){super(),this._constraints=e,this.stream=new MediaStream,this._rtcManagers=[],navigator.mediaDevices.addEventListener("devicechange",this._updateDeviceList.bind(this))}addRtcManager(e){this._rtcManagers.push(e)}removeRtcManager(e){this._rtcManagers=this._rtcManagers.filter((t=>t!==e))}getCameraDeviceId(){var e;return null===(e=this.stream.getVideoTracks()[0])||void 0===e?void 0:e.getSettings().deviceId}getMicrophoneDeviceId(){var e;return null===(e=this.stream.getAudioTracks()[0])||void 0===e?void 0:e.getSettings().deviceId}isCameraEnabled(){var e;return!!(null===(e=this.stream.getVideoTracks()[0])||void 0===e?void 0:e.enabled)}isMicrophoneEnabled(){var e;return!!(null===(e=this.stream.getAudioTracks()[0])||void 0===e?void 0:e.enabled)}toggleCameraEnabled(e){const t=this.stream.getVideoTracks()[0];if(!t)return;const i=null!=e?e:!t.enabled;t.enabled=i,this.dispatchEvent(new CustomEvent("camera_enabled",{detail:{enabled:i}}))}toggleMichrophoneEnabled(e){const t=this.stream.getAudioTracks()[0];if(!t)return;const i=null!=e?e:!t.enabled;t.enabled=i,this.dispatchEvent(new CustomEvent("microphone_enabled",{detail:{enabled:i}}))}setCameraDevice(e){return Zt(this,void 0,void 0,(function*(){const t=(yield navigator.mediaDevices.getUserMedia({video:{deviceId:e}})).getVideoTracks()[0];if(t){const e=this.stream.getVideoTracks()[0];t.enabled=e.enabled,null==e||e.stop(),this._rtcManagers.forEach((i=>{i.replaceTrack(e,t)})),this.stream.removeTrack(e),this.stream.addTrack(t)}this.dispatchEvent(new CustomEvent("stream_updated",{detail:{stream:this.stream}}))}))}setMicrophoneDevice(e){return Zt(this,void 0,void 0,(function*(){const t=(yield navigator.mediaDevices.getUserMedia({audio:{deviceId:e}})).getAudioTracks()[0],i=this.stream.getAudioTracks()[0];i&&(t.enabled=i.enabled,i.stop(),this.stream.removeTrack(i)),this._rtcManagers.forEach((e=>{e.replaceTrack(i,t)})),this.stream.addTrack(t),this.dispatchEvent(new CustomEvent("stream_updated",{detail:{stream:this.stream}}))}))}_updateDeviceList(){return Zt(this,void 0,void 0,(function*(){try{const e=yield navigator.mediaDevices.enumerateDevices();this.dispatchEvent(new CustomEvent("device_list_updated",{detail:{cameraDevices:e.filter((e=>"videoinput"===e.kind)),microphoneDevices:e.filter((e=>"audioinput"===e.kind)),speakerDevices:e.filter((e=>"audiooutput"===e.kind))}}))}catch(e){throw this.dispatchEvent(new CustomEvent("device_list_update_error",{detail:{error:e}})),e}}))}start(){return Zt(this,void 0,void 0,(function*(){return(yield navigator.mediaDevices.getUserMedia(this._constraints)).getTracks().forEach((e=>this.stream.addTrack(e))),this._updateDeviceList(),this.dispatchEvent(new CustomEvent("stream_updated",{detail:{stream:this.stream}})),this.stream}))}stop(){var e;null===(e=this.stream)||void 0===e||e.getTracks().forEach((e=>{e.stop()}))}}const gi={cameraDeviceError:null,cameraDevices:[],isSettingCameraDevice:!1,isSettingMicrophoneDevice:!1,isStarting:!1,microphoneDeviceError:null,microphoneDevices:[],speakerDevices:[],startError:null};function vi(e,t){switch(t.type){case"DEVICE_LIST_UPDATED":return Object.assign(Object.assign({},e),t.payload);case"LOCAL_STREAM_UPDATED":return Object.assign(Object.assign({},e),{currentCameraDeviceId:t.payload.currentCameraDeviceId,currentMicrophoneDeviceId:t.payload.currentMicrophoneDeviceId,localStream:t.payload.stream});case"SET_CAMERA_DEVICE":return Object.assign(Object.assign({},e),{cameraDeviceError:null,isSettingCameraDevice:!0});case"SET_CAMERA_DEVICE_COMPLETE":return Object.assign(Object.assign({},e),{isSettingCameraDevice:!1});case"SET_CAMERA_DEVICE_ERROR":return Object.assign(Object.assign({},e),{cameraDeviceError:t.payload,isSettingCameraDevice:!1});case"SET_MICROPHONE_DEVICE":return Object.assign(Object.assign({},e),{isSettingMicrophoneDevice:!0,microphoneDeviceError:null});case"SET_MICROPHONE_DEVICE_COMPLETE":return Object.assign(Object.assign({},e),{isSettingMicrophoneDevice:!1});case"SET_MICROPHONE_DEVICE_ERROR":return Object.assign(Object.assign({},e),{isSettingMicrophoneDevice:!1,microphoneDeviceError:t.payload});case"START":return Object.assign(Object.assign({},e),{isStarting:!0,startError:null});case"START_COMPLETE":return Object.assign(Object.assign({},e),{isStarting:!1});case"START_ERROR":return Object.assign(Object.assign({},e),{isStarting:!1,startError:t.payload});default:return e}}function bi(e={audio:!0,video:!0}){const[t]=si.useState((()=>new fi(e))),[i,n]=si.useReducer(vi,gi);return si.useEffect((()=>{t.addEventListener("device_list_updated",(e=>{const{cameraDevices:t,microphoneDevices:i,speakerDevices:s}=e.detail;n({type:"DEVICE_LIST_UPDATED",payload:{cameraDevices:t,microphoneDevices:i,speakerDevices:s}})})),t.addEventListener("stream_updated",(e=>{const{stream:i}=e.detail;n({type:"LOCAL_STREAM_UPDATED",payload:{stream:i,currentCameraDeviceId:t.getCameraDeviceId(),currentMicrophoneDeviceId:t.getMicrophoneDeviceId()}})}));return(()=>{Zt(this,void 0,void 0,(function*(){n({type:"START"});try{yield t.start(),n({type:"START_COMPLETE"})}catch(e){n({type:"START_ERROR",payload:e})}}))})(),()=>{t.stop()}}),[]),{state:i,actions:{setCameraDevice:(...e)=>Zt(this,void 0,void 0,(function*(){n({type:"SET_CAMERA_DEVICE"});try{yield t.setCameraDevice(...e),n({type:"SET_CAMERA_DEVICE_COMPLETE"})}catch(e){n({type:"SET_CAMERA_DEVICE_ERROR",payload:e})}})),setMicrophoneDevice:(...e)=>Zt(this,void 0,void 0,(function*(){n({type:"SET_MICROPHONE_DEVICE"});try{yield t.setMicrophoneDevice(...e),n({type:"SET_MICROPHONE_DEVICE_COMPLETE"})}catch(e){n({type:"SET_MICROPHONE_DEVICE_ERROR",payload:e})}})),toggleCameraEnabled:(...e)=>t.toggleCameraEnabled(...e),toggleMicrophoneEnabled:(...e)=>t.toggleMichrophoneEnabled(...e)},_ref:t}}const _i="client_connection_status_changed",yi="stream_added",xi="rtc_manager_created",wi="rtc_manager_destroyed",Si="local_stream_track_added",Ri="local_stream_track_removed",Ci="connecting",ki="connection_failed",Ti="connection_successful",Pi="connection_disconnected",Ei="fetch_mediaserver_config",Oi="start_screenshare",Di="stop_screenshare",Ii="mediaserver_config",ji="room_joined",Li="ice_candidate",Mi="ice_endofcandidates",Ai="ready_to_receive_offer",Ni="sdp_answer",Bi="sdp_offer";let Fi=!0,Ui=!0;function zi(e,t,i){const n=e.match(t);return n&&n.length>=i&&parseInt(n[i],10)}function qi(e,t,i){if(!e.RTCPeerConnection)return;const n=e.RTCPeerConnection.prototype,s=n.addEventListener;n.addEventListener=function(e,n){if(e!==t)return s.apply(this,arguments);const a=e=>{const t=i(e);t&&(n.handleEvent?n.handleEvent(t):n(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(n,a),s.apply(this,[e,a])};const a=n.removeEventListener;n.removeEventListener=function(e,i){if(e!==t||!this._eventMap||!this._eventMap[t])return a.apply(this,arguments);if(!this._eventMap[t].has(i))return a.apply(this,arguments);const n=this._eventMap[t].get(i);return this._eventMap[t].delete(i),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,a.apply(this,[e,n])},Object.defineProperty(n,"on"+t,{get(){return this["_on"+t]},set(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}function $i(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(Fi=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function Vi(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(Ui=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function Wi(){if("object"==typeof window){if(Fi)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function Hi(e,t){Ui&&console.warn(e+" is deprecated, please use "+t+" instead.")}function Gi(e){return"[object Object]"===Object.prototype.toString.call(e)}function Ki(e){return Gi(e)?Object.keys(e).reduce((function(t,i){const n=Gi(e[i]),s=n?Ki(e[i]):e[i],a=n&&!Object.keys(s).length;return void 0===s||a?t:Object.assign(t,{[i]:s})}),{}):e}function Ji(e,t,i){t&&!i.has(t.id)&&(i.set(t.id,t),Object.keys(t).forEach((n=>{n.endsWith("Id")?Ji(e,e.get(t[n]),i):n.endsWith("Ids")&&t[n].forEach((t=>{Ji(e,e.get(t),i)}))})))}function Qi(e,t,i){const n=i?"outbound-rtp":"inbound-rtp",s=new Map;if(null===t)return s;const a=[];return e.forEach((e=>{"track"===e.type&&e.trackIdentifier===t.id&&a.push(e)})),a.forEach((t=>{e.forEach((i=>{i.type===n&&i.trackId===t.id&&Ji(e,i,s)}))})),s}const Yi=Wi;function Xi(e,t){const i=e&&e.navigator;if(!i.mediaDevices)return;const n=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;const t={};return Object.keys(e).forEach((i=>{if("require"===i||"advanced"===i||"mediaSource"===i)return;const n="object"==typeof e[i]?e[i]:{ideal:e[i]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);const s=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){t.optional=t.optional||[];let e={};"number"==typeof n.ideal?(e[s("min",i)]=n.ideal,t.optional.push(e),e={},e[s("max",i)]=n.ideal,t.optional.push(e)):(e[s("",i)]=n.ideal,t.optional.push(e))}void 0!==n.exact&&"number"!=typeof n.exact?(t.mandatory=t.mandatory||{},t.mandatory[s("",i)]=n.exact):["min","max"].forEach((e=>{void 0!==n[e]&&(t.mandatory=t.mandatory||{},t.mandatory[s(e,i)]=n[e])}))})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},s=function(e,s){if(t.version>=61)return s(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){const t=function(e,t,i){t in e&&!(i in e)&&(e[i]=e[t],delete e[t])};t((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),t(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"==typeof e.video){let a=e.video.facingMode;a=a&&("object"==typeof a?a:{ideal:a});const r=t.version<66;if(a&&("user"===a.exact||"environment"===a.exact||"user"===a.ideal||"environment"===a.ideal)&&(!i.mediaDevices.getSupportedConstraints||!i.mediaDevices.getSupportedConstraints().facingMode||r)){let t;if(delete e.video.facingMode,"environment"===a.exact||"environment"===a.ideal?t=["back","rear"]:"user"!==a.exact&&"user"!==a.ideal||(t=["front"]),t)return i.mediaDevices.enumerateDevices().then((i=>{let r=(i=i.filter((e=>"videoinput"===e.kind))).find((e=>t.some((t=>e.label.toLowerCase().includes(t)))));return!r&&i.length&&t.includes("back")&&(r=i[i.length-1]),r&&(e.video.deviceId=a.exact?{exact:r.deviceId}:{ideal:r.deviceId}),e.video=n(e.video),Yi("chrome: "+JSON.stringify(e)),s(e)}))}e.video=n(e.video)}return Yi("chrome: "+JSON.stringify(e)),s(e)},a=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(i.getUserMedia=function(e,t,n){s(e,(e=>{i.webkitGetUserMedia(e,t,(e=>{n&&n(a(e))}))}))}.bind(i),i.mediaDevices.getUserMedia){const e=i.mediaDevices.getUserMedia.bind(i.mediaDevices);i.mediaDevices.getUserMedia=function(t){return s(t,(t=>e(t).then((e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach((e=>{e.stop()})),new DOMException("","NotFoundError");return e}),(e=>Promise.reject(a(e))))))}}}function Zi(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function en(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",(i=>{let n;n=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===i.track.id)):{track:i.track};const s=new Event("track");s.track=i.track,s.receiver=n,s.transceiver={receiver:n},s.streams=[t.stream],this.dispatchEvent(s)})),t.stream.getTracks().forEach((i=>{let n;n=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===i.id)):{track:i};const s=new Event("track");s.track=i,s.receiver=n,s.transceiver={receiver:n},s.streams=[t.stream],this.dispatchEvent(s)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else qi(e,"track",(e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e)))}function tn(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const i=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){let s=i.apply(this,arguments);return s||(s=t(this,e),this._senders.push(s)),s};const n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){n.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],i.apply(this,[e]),e.getTracks().forEach((e=>{this._senders.push(t(this,e))}))};const n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach((e=>{const t=this._senders.find((t=>t.track===e));t&&this._senders.splice(this._senders.indexOf(t),1)}))}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function nn(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,i,n]=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof e))return t.apply(this,[]);const s=function(e){const t={};return e.result().forEach((e=>{const i={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((t=>{i[t]=e.stat(t)})),t[i.id]=i})),t},a=function(e){return new Map(Object.keys(e).map((t=>[t,e[t]])))};if(arguments.length>=2){const n=function(e){i(a(s(e)))};return t.apply(this,[n,e])}return new Promise(((e,i)=>{t.apply(this,[function(t){e(a(s(t)))},i])})).then(i,n)}}function sn(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const i=e.RTCPeerConnection.prototype.addTrack;i&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=i.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>Qi(t,e.track,!0)))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),qi(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>Qi(t,e.track,!1)))}}if(!("getStats"in e.RTCRtpSender.prototype)||!("getStats"in e.RTCRtpReceiver.prototype))return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){const e=arguments[0];let t,i,n;return this.getSenders().forEach((i=>{i.track===e&&(t?n=!0:t=i)})),this.getReceivers().forEach((t=>(t.track===e&&(i?n=!0:i=t),t.track===e))),n||t&&i?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():i?i.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function an(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((e=>this._shimmedLocalStreams[e][0]))};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,i){if(!i)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const n=t.apply(this,arguments);return this._shimmedLocalStreams[i.id]?-1===this._shimmedLocalStreams[i.id].indexOf(n)&&this._shimmedLocalStreams[i.id].push(n):this._shimmedLocalStreams[i.id]=[i,n],n};const i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")}));const t=this.getSenders();i.apply(this,arguments);const n=this.getSenders().filter((e=>-1===t.indexOf(e)));this._shimmedLocalStreams[e.id]=[e].concat(n)};const n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],n.apply(this,arguments)};const s=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((t=>{const i=this._shimmedLocalStreams[t].indexOf(e);-1!==i&&this._shimmedLocalStreams[t].splice(i,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]})),s.apply(this,arguments)}}function rn(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return an(e);const i=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=i.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map((e=>this._reverseStreams[e.id]))};const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){const i=new e.MediaStream(t.getTracks());this._streams[t.id]=i,this._reverseStreams[i.id]=t,t=i}n.apply(this,[t])};const s=e.RTCPeerConnection.prototype.removeStream;function a(e,t){let i=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const n=e._reverseStreams[t],s=e._streams[n.id];i=i.replace(new RegExp(s.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:i})}function r(e,t){let i=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const n=e._reverseStreams[t],s=e._streams[n.id];i=i.replace(new RegExp(n.id,"g"),s.id)})),new RTCSessionDescription({type:t.type,sdp:i})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},s.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,i){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const n=[].slice.call(arguments,1);if(1!==n.length||!n[0].getTracks().find((e=>e===t)))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");const s=this.getSenders().find((e=>e.track===t));if(s)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const a=this._streams[i.id];if(a)a.addTrack(t),Promise.resolve().then((()=>{this.dispatchEvent(new Event("negotiationneeded"))}));else{const n=new e.MediaStream([t]);this._streams[i.id]=n,this._reverseStreams[n.id]=i,this.addStream(n)}return this.getSenders().find((e=>e.track===t))},["createOffer","createAnswer"].forEach((function(t){const i=e.RTCPeerConnection.prototype[t],n={[t](){const e=arguments;return arguments.length&&"function"==typeof arguments[0]?i.apply(this,[t=>{const i=a(this,t);e[0].apply(null,[i])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):i.apply(this,arguments).then((e=>a(this,e)))}};e.RTCPeerConnection.prototype[t]=n[t]}));const o=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=r(this,arguments[0]),o.apply(this,arguments)):o.apply(this,arguments)};const c=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=c.get.apply(this);return""===e.type?e:a(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let t;this._streams=this._streams||{},Object.keys(this._streams).forEach((i=>{this._streams[i].getTracks().find((t=>e.track===t))&&(t=this._streams[i])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function on(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const i=e.RTCPeerConnection.prototype[t],n={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=n[t]}))}function cn(e,t){qi(e,"negotiationneeded",(e=>{const i=e.target;if(!(t.version<72||i.getConfiguration&&"plan-b"===i.getConfiguration().sdpSemantics)||"stable"===i.signalingState)return e}))}var pn=Object.freeze({__proto__:null,shimMediaStream:Zi,shimOnTrack:en,shimGetSendersWithDtmf:tn,shimGetStats:nn,shimSenderReceiverGetStats:sn,shimAddTrackRemoveTrackWithNative:an,shimAddTrackRemoveTrack:rn,shimPeerConnection:on,fixNegotiationNeeded:cn,shimGetUserMedia:Xi,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(i){return t(i).then((t=>{const n=i.video&&i.video.width,s=i.video&&i.video.height,a=i.video&&i.video.frameRate;return i.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:a||3}},n&&(i.video.mandatory.maxWidth=n),s&&(i.video.mandatory.maxHeight=s),e.navigator.mediaDevices.getUserMedia(i)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}});function dn(e,t){const i=e&&e.navigator,n=e&&e.MediaStreamTrack;if(i.getUserMedia=function(e,t,n){Hi("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),i.mediaDevices.getUserMedia(e).then(t,n)},!(t.version>55&&"autoGainControl"in i.mediaDevices.getSupportedConstraints())){const e=function(e,t,i){t in e&&!(i in e)&&(e[i]=e[t],delete e[t])},t=i.mediaDevices.getUserMedia.bind(i.mediaDevices);if(i.mediaDevices.getUserMedia=function(i){return"object"==typeof i&&"object"==typeof i.audio&&(i=JSON.parse(JSON.stringify(i)),e(i.audio,"autoGainControl","mozAutoGainControl"),e(i.audio,"noiseSuppression","mozNoiseSuppression")),t(i)},n&&n.prototype.getSettings){const t=n.prototype.getSettings;n.prototype.getSettings=function(){const i=t.apply(this,arguments);return e(i,"mozAutoGainControl","autoGainControl"),e(i,"mozNoiseSuppression","noiseSuppression"),i}}if(n&&n.prototype.applyConstraints){const t=n.prototype.applyConstraints;n.prototype.applyConstraints=function(i){return"audio"===this.kind&&"object"==typeof i&&(i=JSON.parse(JSON.stringify(i)),e(i,"autoGainControl","mozAutoGainControl"),e(i,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[i])}}}}function ln(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function un(e,t){if("object"!=typeof e||!e.RTCPeerConnection&&!e.mozRTCPeerConnection)return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const i=e.RTCPeerConnection.prototype[t],n={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=n[t]}));const i={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,s,a]=arguments;return n.apply(this,[e||null]).then((e=>{if(t.version<53&&!s)try{e.forEach((e=>{e.type=i[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach(((t,n)=>{e.set(n,Object.assign({},t,{type:i[t.type]||t.type}))}))}return e})).then(s,a)}}function mn(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const i=e.RTCPeerConnection.prototype.addTrack;i&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=i.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function hn(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),qi(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function fn(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){Hi("removeStream","removeTrack"),this.getSenders().forEach((t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)}))})}function gn(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function vn(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]),e=[...e];const i=e.length>0;i&&e.forEach((e=>{if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));const n=t.apply(this,arguments);if(i){const{sender:t}=n,i=t.getParameters();(!("encodings"in i)||1===i.encodings.length&&0===Object.keys(i.encodings[0]).length)&&(i.encodings=e,t.sendEncodings=e,this.setParametersPromises.push(t.setParameters(i).then((()=>{delete t.sendEncodings})).catch((()=>{delete t.sendEncodings}))))}return n})}function bn(e){if("object"!=typeof e||!e.RTCRtpSender)return;const t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){const e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function _n(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}function yn(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}var xn=Object.freeze({__proto__:null,shimOnTrack:ln,shimPeerConnection:un,shimSenderGetStats:mn,shimReceiverGetStats:hn,shimRemoveStream:fn,shimRTCDataChannel:gn,shimAddTransceiver:vn,shimGetParameters:bn,shimCreateOffer:_n,shimCreateAnswer:yn,shimGetUserMedia:dn,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(i){if(!i||!i.video){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===i.video?i.video={mediaSource:t}:i.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(i)})}});function wn(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((i=>t.call(this,i,e))),e.getVideoTracks().forEach((i=>t.call(this,i,e)))},e.RTCPeerConnection.prototype.addTrack=function(e,...i){return i&&i.forEach((e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const t=this._localStreams.indexOf(e);if(-1===t)return;this._localStreams.splice(t,1);const i=e.getTracks();this.getSenders().forEach((e=>{i.includes(e.track)&&this.removeTrack(e)}))})}}function Sn(e){if("object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach((e=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(e))return;this._remoteStreams.push(e);const t=new Event("addstream");t.stream=e,this.dispatchEvent(t)}))})}});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){const e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((t=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);const i=new Event("addstream");i.stream=t,e.dispatchEvent(i)}))}),t.apply(e,arguments)}}}function Rn(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,i=t.createOffer,n=t.createAnswer,s=t.setLocalDescription,a=t.setRemoteDescription,r=t.addIceCandidate;t.createOffer=function(e,t){const n=arguments.length>=2?arguments[2]:arguments[0],s=i.apply(this,[n]);return t?(s.then(e,t),Promise.resolve()):s},t.createAnswer=function(e,t){const i=arguments.length>=2?arguments[2]:arguments[0],s=n.apply(this,[i]);return t?(s.then(e,t),Promise.resolve()):s};let o=function(e,t,i){const n=s.apply(this,[e]);return i?(n.then(t,i),Promise.resolve()):n};t.setLocalDescription=o,o=function(e,t,i){const n=a.apply(this,[e]);return i?(n.then(t,i),Promise.resolve()):n},t.setRemoteDescription=o,o=function(e,t,i){const n=r.apply(this,[e]);return i?(n.then(t,i),Promise.resolve()):n},t.addIceCandidate=o}function Cn(e){const t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const e=t.mediaDevices,i=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>i(kn(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,i,n){t.mediaDevices.getUserMedia(e).then(i,n)}.bind(t))}function kn(e){return e&&void 0!==e.video?Object.assign({},e,{video:Ki(e.video)}):e}function Tn(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,i){if(e&&e.iceServers){const t=[];for(let i=0;i<e.iceServers.length;i++){let n=e.iceServers[i];!n.hasOwnProperty("urls")&&n.hasOwnProperty("url")?(Hi("RTCIceServer.url","RTCIceServer.urls"),n=JSON.parse(JSON.stringify(n)),n.urls=n.url,delete n.url,t.push(n)):t.push(e.iceServers[i])}e.iceServers=t}return new t(e,i)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}function Pn(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function En(e){const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);const t=this.getTransceivers().find((e=>"audio"===e.receiver.track.kind));!1===e.offerToReceiveAudio&&t?"sendrecv"===t.direction?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":"recvonly"===t.direction&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):!0!==e.offerToReceiveAudio||t||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);const i=this.getTransceivers().find((e=>"video"===e.receiver.track.kind));!1===e.offerToReceiveVideo&&i?"sendrecv"===i.direction?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":"recvonly"===i.direction&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):!0!==e.offerToReceiveVideo||i||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function On(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Dn=Object.freeze({__proto__:null,shimLocalStreamsAPI:wn,shimRemoteStreamsAPI:Sn,shimCallbacksAPI:Rn,shimGetUserMedia:Cn,shimConstraints:kn,shimRTCIceServerUrls:Tn,shimTrackEventTransceiver:Pn,shimCreateOfferLegacy:En,shimAudioContext:On}),In={};!function(e){const t={generateIdentifier:function(){return Math.random().toString(36).substring(2,12)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((e=>e.trim()))},t.splitSections=function(e){return e.split("\nm=").map(((e,t)=>(t>0?"m="+e:e).trim()+"\r\n"))},t.getDescription=function(e){const i=t.splitSections(e);return i&&i[0]},t.getMediaSections=function(e){const i=t.splitSections(e);return i.shift(),i},t.matchPrefix=function(e,i){return t.splitLines(e).filter((e=>0===e.indexOf(i)))},t.parseCandidate=function(e){let t;t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" ");const i={foundation:t[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]};for(let e=8;e<t.length;e+=2)switch(t[e]){case"raddr":i.relatedAddress=t[e+1];break;case"rport":i.relatedPort=parseInt(t[e+1],10);break;case"tcptype":i.tcpType=t[e+1];break;case"ufrag":i.ufrag=t[e+1],i.usernameFragment=t[e+1];break;default:void 0===i[t[e]]&&(i[t[e]]=t[e+1])}return i},t.writeCandidate=function(e){const t=[];t.push(e.foundation);const i=e.component;"rtp"===i?t.push(1):"rtcp"===i?t.push(2):t.push(i),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);const n=e.type;return t.push("typ"),t.push(n),"host"!==n&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substring(14).split(" ")},t.parseRtpMap=function(e){let t=e.substring(9).split(" ");const i={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),i.name=t[0],i.clockRate=parseInt(t[1],10),i.channels=3===t.length?parseInt(t[2],10):1,i.numChannels=i.channels,i},t.writeRtpMap=function(e){let t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);const i=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==i?"/"+i:"")+"\r\n"},t.parseExtmap=function(e){const t=e.substring(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1],attributes:t.slice(2).join(" ")}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+(e.attributes?" "+e.attributes:"")+"\r\n"},t.parseFmtp=function(e){const t={};let i;const n=e.substring(e.indexOf(" ")+1).split(";");for(let e=0;e<n.length;e++)i=n[e].trim().split("="),t[i[0].trim()]=i[1];return t},t.writeFmtp=function(e){let t="",i=e.payloadType;if(void 0!==e.preferredPayloadType&&(i=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){const n=[];Object.keys(e.parameters).forEach((t=>{void 0!==e.parameters[t]?n.push(t+"="+e.parameters[t]):n.push(t)})),t+="a=fmtp:"+i+" "+n.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){const t=e.substring(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){let t="",i=e.payloadType;return void 0!==e.preferredPayloadType&&(i=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((e=>{t+="a=rtcp-fb:"+i+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){const t=e.indexOf(" "),i={ssrc:parseInt(e.substring(7,t),10)},n=e.indexOf(":",t);return n>-1?(i.attribute=e.substring(t+1,n),i.value=e.substring(n+1)):i.attribute=e.substring(t+1),i},t.parseSsrcGroup=function(e){const t=e.substring(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((e=>parseInt(e,10)))}},t.getMid=function(e){const i=t.matchPrefix(e,"a=mid:")[0];if(i)return i.substring(6)},t.parseFingerprint=function(e){const t=e.substring(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},t.getDtlsParameters=function(e,i){return{role:"auto",fingerprints:t.matchPrefix(e+i,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){let i="a=setup:"+t+"\r\n";return e.fingerprints.forEach((e=>{i+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),i},t.parseCryptoLine=function(e){const t=e.substring(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;const t=e.substring(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,i){return t.matchPrefix(e+i,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,i){const n=t.matchPrefix(e+i,"a=ice-ufrag:")[0],s=t.matchPrefix(e+i,"a=ice-pwd:")[0];return n&&s?{usernameFragment:n.substring(12),password:s.substring(10)}:null},t.writeIceParameters=function(e){let t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},t.parseRtpParameters=function(e){const i={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=t.splitLines(e)[0].split(" ");for(let s=3;s<n.length;s++){const a=n[s],r=t.matchPrefix(e,"a=rtpmap:"+a+" ")[0];if(r){const n=t.parseRtpMap(r),s=t.matchPrefix(e,"a=fmtp:"+a+" ");switch(n.parameters=s.length?t.parseFmtp(s[0]):{},n.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+a+" ").map(t.parseRtcpFb),i.codecs.push(n),n.name.toUpperCase()){case"RED":case"ULPFEC":i.fecMechanisms.push(n.name.toUpperCase())}}}t.matchPrefix(e,"a=extmap:").forEach((e=>{i.headerExtensions.push(t.parseExtmap(e))}));const s=t.matchPrefix(e,"a=rtcp-fb:* ").map(t.parseRtcpFb);return i.codecs.forEach((e=>{s.forEach((t=>{e.rtcpFeedback.find((e=>e.type===t.type&&e.parameter===t.parameter))||e.rtcpFeedback.push(t)}))})),i},t.writeRtpDescription=function(e,i){let n="";n+="m="+e+" ",n+=i.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=i.codecs.map((e=>void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType)).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",i.codecs.forEach((e=>{n+=t.writeRtpMap(e),n+=t.writeFmtp(e),n+=t.writeRtcpFb(e)}));let s=0;return i.codecs.forEach((e=>{e.maxptime>s&&(s=e.maxptime)})),s>0&&(n+="a=maxptime:"+s+"\r\n"),i.headerExtensions&&i.headerExtensions.forEach((e=>{n+=t.writeExtmap(e)})),n},t.parseRtpEncodingParameters=function(e){const i=[],n=t.parseRtpParameters(e),s=-1!==n.fecMechanisms.indexOf("RED"),a=-1!==n.fecMechanisms.indexOf("ULPFEC"),r=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute)),o=r.length>0&&r[0].ssrc;let c;const p=t.matchPrefix(e,"a=ssrc-group:FID").map((e=>e.substring(17).split(" ").map((e=>parseInt(e,10)))));p.length>0&&p[0].length>1&&p[0][0]===o&&(c=p[0][1]),n.codecs.forEach((e=>{if("RTX"===e.name.toUpperCase()&&e.parameters.apt){let t={ssrc:o,codecPayloadType:parseInt(e.parameters.apt,10)};o&&c&&(t.rtx={ssrc:c}),i.push(t),s&&(t=JSON.parse(JSON.stringify(t)),t.fec={ssrc:o,mechanism:a?"red+ulpfec":"red"},i.push(t))}})),0===i.length&&o&&i.push({ssrc:o});let d=t.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substring(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substring(5),10)*.95-16e3:void 0,i.forEach((e=>{e.maxBitrate=d}))),i},t.parseRtcpParameters=function(e){const i={},n=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute))[0];n&&(i.cname=n.value,i.ssrc=n.ssrc);const s=t.matchPrefix(e,"a=rtcp-rsize");i.reducedSize=s.length>0,i.compound=0===s.length;const a=t.matchPrefix(e,"a=rtcp-mux");return i.mux=a.length>0,i},t.writeRtcpParameters=function(e){let t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},t.parseMsid=function(e){let i;const n=t.matchPrefix(e,"a=msid:");if(1===n.length)return i=n[0].substring(7).split(" "),{stream:i[0],track:i[1]};const s=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"msid"===e.attribute));return s.length>0?(i=s[0].value.split(" "),{stream:i[0],track:i[1]}):void 0},t.parseSctpDescription=function(e){const i=t.parseMLine(e),n=t.matchPrefix(e,"a=max-message-size:");let s;n.length>0&&(s=parseInt(n[0].substring(19),10)),isNaN(s)&&(s=65536);const a=t.matchPrefix(e,"a=sctp-port:");if(a.length>0)return{port:parseInt(a[0].substring(12),10),protocol:i.fmt,maxMessageSize:s};const r=t.matchPrefix(e,"a=sctpmap:");if(r.length>0){const e=r[0].substring(10).split(" ");return{port:parseInt(e[0],10),protocol:e[1],maxMessageSize:s}}},t.writeSctpDescription=function(e,t){let i=[];return i="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&i.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),i.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,22)},t.writeSessionBoilerplate=function(e,i,n){let s;const a=void 0!==i?i:2;s=e||t.generateSessionId();return"v=0\r\no="+(n||"thisisadapterortc")+" "+s+" "+a+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(e,i){const n=t.splitLines(e);for(let e=0;e<n.length;e++)switch(n[e]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[e].substring(2)}return i?t.getDirection(i):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substring(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){const i=t.splitLines(e)[0].substring(2).split(" ");return{kind:i[0],port:parseInt(i[1],10),protocol:i[2],fmt:i.slice(3).join(" ")}},t.parseOLine=function(e){const i=t.matchPrefix(e,"o=")[0].substring(2).split(" ");return{username:i[0],sessionId:i[1],sessionVersion:parseInt(i[2],10),netType:i[3],addressType:i[4],address:i[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;const i=t.splitLines(e);for(let e=0;e<i.length;e++)if(i[e].length<2||"="!==i[e].charAt(1))return!1;return!0},e.exports=t}({get exports(){return In},set exports(e){In=e}});var jn=In,Ln=v({__proto__:null,default:jn},[In]);function Mn(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;const t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){const i=new t(e),n=jn.parseCandidate(e.candidate),s=Object.assign(i,n);return s.toJSON=function(){return{candidate:s.candidate,sdpMid:s.sdpMid,sdpMLineIndex:s.sdpMLineIndex,usernameFragment:s.usernameFragment}},s}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,qi(e,"icecandidate",(t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t)))}function An(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||qi(e,"icecandidate",(e=>{if(e.candidate){const t=jn.parseCandidate(e.candidate.candidate);"relay"===t.type&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[t.priority>>24])}return e}))}function Nn(e,t){if(!e.RTCPeerConnection)return;"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const i=function(e){if(!e||!e.sdp)return!1;const t=jn.splitSections(e.sdp);return t.shift(),t.some((e=>{const t=jn.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))},n=function(e){const t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;const i=parseInt(t[1],10);return i!=i?-1:i},s=function(e){let i=65536;return"firefox"===t.browser&&(i=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),i},a=function(e,i){let n=65536;"firefox"===t.browser&&57===t.version&&(n=65535);const s=jn.matchPrefix(e.sdp,"a=max-message-size:");return s.length>0?n=parseInt(s[0].substr(19),10):"firefox"===t.browser&&-1!==i&&(n=2147483637),n},r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){const{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(i(arguments[0])){const e=n(arguments[0]),t=s(e),i=a(arguments[0],e);let r;r=0===t&&0===i?Number.POSITIVE_INFINITY:0===t||0===i?Math.max(t,i):Math.min(t,i);const o={};Object.defineProperty(o,"maxMessageSize",{get:()=>r}),this._sctp=o}return r.apply(this,arguments)}}function Bn(e){if(!e.RTCPeerConnection||!("createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const i=e.send;e.send=function(){const n=arguments[0],s=n.length||n.size||n.byteLength;if("open"===e.readyState&&t.sctp&&s>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return i.apply(e,arguments)}}const i=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const e=i.apply(this,arguments);return t(e,this),e},qi(e,"datachannel",(e=>(t(e.channel,e.target),e)))}function Fn(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;const t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((e=>{const i=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{const t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;const i=new Event("connectionstatechange",e);t.dispatchEvent(i)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),i.apply(this,arguments)}}))}function Un(e,t){if(!e.RTCPeerConnection)return;if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t.version>=605)return;const i=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){const i=t.sdp.split("\n").filter((e=>"a=extmap-allow-mixed"!==e.trim())).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:i}):t.sdp=i}return i.apply(this,arguments)}}function zn(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const i=e.RTCPeerConnection.prototype.addIceCandidate;i&&0!==i.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():i.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function qn(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const i=e.RTCPeerConnection.prototype.setLocalDescription;i&&0!==i.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){let e=arguments[0]||{};if("object"!=typeof e||e.type&&e.sdp)return i.apply(this,arguments);if(e={type:e.type,sdp:e.sdp},!e.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":e.type="offer";break;default:e.type="answer"}if(e.sdp||"offer"!==e.type&&"answer"!==e.type)return i.apply(this,[e]);const t="offer"===e.type?this.createOffer:this.createAnswer;return t.apply(this).then((e=>i.apply(this,[e])))})}var $n=Object.freeze({__proto__:null,shimRTCIceCandidate:Mn,shimRTCIceCandidateRelayProtocol:An,shimMaxMessageSize:Nn,shimSendThrowTypeError:Bn,shimConnectionState:Fn,removeExtmapAllowMixed:Un,shimAddIceCandidateNullOrEmpty:zn,shimParameterlessSetLocalDescription:qn});const Vn=function({window:e}={},t={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const i=Wi,n=function(e){const t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;const{navigator:i}=e;if(i.mozGetUserMedia)t.browser="firefox",t.version=zi(i.userAgent,/Firefox\/(\d+)\./,1);else if(i.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=zi(i.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!i.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=zi(i.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(e),s={browserDetails:n,commonShim:$n,extractVersion:zi,disableLog:$i,disableWarnings:Vi,sdp:Ln};switch(n.browser){case"chrome":if(!pn||!on||!t.shimChrome)return i("Chrome shim is not included in this adapter release."),s;if(null===n.version)return i("Chrome shim can not determine version, not shimming."),s;i("adapter.js shimming chrome."),s.browserShim=pn,zn(e,n),qn(e),Xi(e,n),Zi(e),on(e,n),en(e),rn(e,n),tn(e),nn(e),sn(e),cn(e,n),Mn(e),An(e),Fn(e),Nn(e,n),Bn(e),Un(e,n);break;case"firefox":if(!xn||!un||!t.shimFirefox)return i("Firefox shim is not included in this adapter release."),s;i("adapter.js shimming firefox."),s.browserShim=xn,zn(e,n),qn(e),dn(e,n),un(e,n),ln(e),fn(e),mn(e),hn(e),gn(e),vn(e),bn(e),_n(e),yn(e),Mn(e),Fn(e),Nn(e,n),Bn(e);break;case"safari":if(!Dn||!t.shimSafari)return i("Safari shim is not included in this adapter release."),s;i("adapter.js shimming safari."),s.browserShim=Dn,zn(e,n),qn(e),Tn(e),En(e),Rn(e),wn(e),Sn(e),Pn(e),Cn(e),On(e),Mn(e),An(e),Nn(e,n),Bn(e),Un(e,n);break;default:i("Unsupported browser!")}return s}({window:"undefined"==typeof window?void 0:window}),Wn=Object.create(null);Wn.open="0",Wn.close="1",Wn.ping="2",Wn.pong="3",Wn.message="4",Wn.upgrade="5",Wn.noop="6";const Hn=Object.create(null);Object.keys(Wn).forEach((e=>{Hn[Wn[e]]=e}));const Gn={type:"error",data:"parser error"},Kn=({type:e,data:t},i,n)=>{if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)){const e=Jn(t);return n(Qn(e,i))}return n(Wn[e]+(t||""))},Jn=e=>Buffer.isBuffer(e)?e:e instanceof ArrayBuffer?Buffer.from(e):Buffer.from(e.buffer,e.byteOffset,e.byteLength),Qn=(e,t)=>t?e:"b"+e.toString("base64"),Yn=(e,t)=>{if("string"!=typeof e)return{type:"message",data:Xn(e,t)};const i=e.charAt(0);if("b"===i){const i=Buffer.from(e.substring(1),"base64");return{type:"message",data:Xn(i,t)}}return Hn[i]?e.length>1?{type:Hn[i],data:e.substring(1)}:{type:Hn[i]}:Gn},Xn=(e,t)=>{const i=Buffer.isBuffer(e);return"arraybuffer"===t&&i?Zn(e):e},Zn=e=>{const t=new ArrayBuffer(e.length),i=new Uint8Array(t);for(let t=0;t<e.length;t++)i[t]=e[t];return t},es=String.fromCharCode(30);function ts(e){if(e)return function(e){for(var t in ts.prototype)e[t]=ts.prototype[t];return e}(e)}ts.prototype.on=ts.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},ts.prototype.once=function(e,t){function i(){this.off(e,i),t.apply(this,arguments)}return i.fn=t,this.on(e,i),this},ts.prototype.off=ts.prototype.removeListener=ts.prototype.removeAllListeners=ts.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var i,n=this._callbacks["$"+e];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var s=0;s<n.length;s++)if((i=n[s])===t||i.fn===t){n.splice(s,1);break}return 0===n.length&&delete this._callbacks["$"+e],this},ts.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),i=this._callbacks["$"+e],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(i){n=0;for(var s=(i=i.slice(0)).length;n<s;++n)i[n].apply(this,t)}return this},ts.prototype.emitReserved=ts.prototype.emit,ts.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},ts.prototype.hasListeners=function(e){return!!this.listeners(e).length};const is=global;function ns(e,...t){return t.reduce(((t,i)=>(e.hasOwnProperty(i)&&(t[i]=e[i]),t)),{})}const ss=is.setTimeout,as=is.clearTimeout;function rs(e,t){t.useNativeTimers?(e.setTimeoutFn=ss.bind(is),e.clearTimeoutFn=as.bind(is)):(e.setTimeoutFn=is.setTimeout.bind(is),e.clearTimeoutFn=is.clearTimeout.bind(is))}class os extends Error{constructor(e,t,i){super(e),this.description=t,this.context=i,this.type="TransportError"}}class cs extends ts{constructor(e){super(),this.writable=!1,rs(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,i){return super.emitReserved("error",new os(e,t,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=Yn(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}}const ps="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),ds={};let ls,us=0,ms=0;function hs(e){let t="";do{t=ps[e%64]+t,e=Math.floor(e/64)}while(e>0);return t}function fs(){const e=hs(+new Date);return e!==ls?(us=0,ls=e):e+"."+hs(us++)}for(;ms<64;ms++)ds[ps[ms]]=ms;function gs(e){let t="";for(let i in e)e.hasOwnProperty(i)&&(t.length&&(t+="&"),t+=encodeURIComponent(i)+"="+encodeURIComponent(e[i]));return t}
16
- /**
17
- * Wrapper for built-in http.js to emulate the browser XMLHttpRequest object.
18
- *
19
- * This can be used with JS designed for browsers to improve reuse of code and
20
- * allow the use of existing libraries.
21
- *
22
- * Usage: include("XMLHttpRequest.js") and use XMLHttpRequest per W3C specs.
23
- *
24
- * @author Dan DeFelippi <dan@driverdan.com>
25
- * @contributor David Ellis <d.f.ellis@ieee.org>
26
- * @license MIT
27
- */
28
- var vs=e,bs=t,_s=i.spawn,ys=xs;function xs(e){e=e||{};var t,i,a=this,r=n,o=s,c={},p=!1,d={"User-Agent":"node-XMLHttpRequest",Accept:"*/*"},l=Object.assign({},d),u=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","content-transfer-encoding","cookie","cookie2","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"],m=["TRACE","TRACK","CONNECT"],h=!1,f=!1,g=!1,v={};this.UNSENT=0,this.OPENED=1,this.HEADERS_RECEIVED=2,this.LOADING=3,this.DONE=4,this.readyState=this.UNSENT,this.onreadystatechange=null,this.responseText="",this.responseXML="",this.status=null,this.statusText=null;this.open=function(e,t,i,n,s){if(this.abort(),f=!1,g=!1,!function(e){return e&&-1===m.indexOf(e)}(e))throw new Error("SecurityError: Request method not allowed");c={method:e,url:t.toString(),async:"boolean"!=typeof i||i,user:n||null,password:s||null},b(this.OPENED)},this.setDisableHeaderCheck=function(e){p=e},this.setRequestHeader=function(e,t){if(this.readyState!=this.OPENED)throw new Error("INVALID_STATE_ERR: setRequestHeader can only be called when state is OPEN");if(!function(e){return p||e&&-1===u.indexOf(e.toLowerCase())}(e))return console.warn('Refused to set unsafe header "'+e+'"'),!1;if(h)throw new Error("INVALID_STATE_ERR: send flag is true");return l[e]=t,!0},this.getResponseHeader=function(e){return"string"==typeof e&&this.readyState>this.OPENED&&i.headers[e.toLowerCase()]&&!f?i.headers[e.toLowerCase()]:null},this.getAllResponseHeaders=function(){if(this.readyState<this.HEADERS_RECEIVED||f)return"";var e="";for(var t in i.headers)"set-cookie"!==t&&"set-cookie2"!==t&&(e+=t+": "+i.headers[t]+"\r\n");return e.substr(0,e.length-2)},this.getRequestHeader=function(e){return"string"==typeof e&&l[e]?l[e]:""},this.send=function(n){if(this.readyState!=this.OPENED)throw new Error("INVALID_STATE_ERR: connection must be opened before send() is called");if(h)throw new Error("INVALID_STATE_ERR: send has already been called");var s,p=!1,d=!1,u=bs.parse(c.url);switch(u.protocol){case"https:":p=!0;case"http:":s=u.hostname;break;case"file:":d=!0;break;case void 0:case"":s="localhost";break;default:throw new Error("Protocol not supported.")}if(d){if("GET"!==c.method)throw new Error("XMLHttpRequest: Only GET method is supported");if(c.async)vs.readFile(unescape(u.pathname),"utf8",(function(e,t){e?a.handleError(e,e.errno||-1):(a.status=200,a.responseText=t,b(a.DONE))}));else try{this.responseText=vs.readFileSync(unescape(u.pathname),"utf8"),this.status=200,b(a.DONE)}catch(e){this.handleError(e,e.errno||-1)}}else{var m=u.port||(p?443:80),g=u.pathname+(u.search?u.search:"");if(l.Host=s,p&&443===m||80===m||(l.Host+=":"+u.port),c.user){void 0===c.password&&(c.password="");var v=new Buffer(c.user+":"+c.password);l.Authorization="Basic "+v.toString("base64")}"GET"===c.method||"HEAD"===c.method?n=null:n?(l["Content-Length"]=Buffer.isBuffer(n)?n.length:Buffer.byteLength(n),l["Content-Type"]||(l["Content-Type"]="text/plain;charset=UTF-8")):"POST"===c.method&&(l["Content-Length"]=0);var _=e.agent||!1,y={host:s,port:m,path:g,method:c.method,headers:l,agent:_};if(p&&(y.pfx=e.pfx,y.key=e.key,y.passphrase=e.passphrase,y.cert=e.cert,y.ca=e.ca,y.ciphers=e.ciphers,y.rejectUnauthorized=!1!==e.rejectUnauthorized),f=!1,c.async){var x=p?o.request:r.request;h=!0,a.dispatchEvent("readystatechange");var w=function(n){if(302===(i=n).statusCode||303===i.statusCode||307===i.statusCode){c.url=i.headers.location;var r=bs.parse(c.url);s=r.hostname;var o={hostname:r.hostname,port:r.port,path:r.path,method:303===i.statusCode?"GET":c.method,headers:l};return p&&(o.pfx=e.pfx,o.key=e.key,o.passphrase=e.passphrase,o.cert=e.cert,o.ca=e.ca,o.ciphers=e.ciphers,o.rejectUnauthorized=!1!==e.rejectUnauthorized),void(t=x(o,w).on("error",S)).end()}i&&i.setEncoding&&i.setEncoding("utf8"),b(a.HEADERS_RECEIVED),a.status=i.statusCode,i.on("data",(function(e){e&&(a.responseText+=e),h&&b(a.LOADING)})),i.on("end",(function(){h&&(h=!1,b(a.DONE))})),i.on("error",(function(e){a.handleError(e)}))},S=function(e){a.handleError(e)};t=x(y,w).on("error",S),e.autoUnref&&t.on("socket",(e=>{e.unref()})),n&&t.write(n),t.end(),a.dispatchEvent("loadstart")}else{var R=".node-xmlhttprequest-content-"+process.pid,C=".node-xmlhttprequest-sync-"+process.pid;vs.writeFileSync(C,"","utf8");for(var k="var http = require('http'), https = require('https'), fs = require('fs');var doRequest = http"+(p?"s":"")+".request;var options = "+JSON.stringify(y)+";var responseText = '';var req = doRequest(options, function(response) {response.setEncoding('utf8');response.on('data', function(chunk) { responseText += chunk;});response.on('end', function() {fs.writeFileSync('"+R+"', 'NODE-XMLHTTPREQUEST-STATUS:' + response.statusCode + ',' + responseText, 'utf8');fs.unlinkSync('"+C+"');});response.on('error', function(error) {fs.writeFileSync('"+R+"', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('"+C+"');});}).on('error', function(error) {fs.writeFileSync('"+R+"', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('"+C+"');});"+(n?"req.write('"+JSON.stringify(n).slice(1,-1).replace(/'/g,"\\'")+"');":"")+"req.end();",T=_s(process.argv[0],["-e",k]);vs.existsSync(C););if(a.responseText=vs.readFileSync(R,"utf8"),T.stdin.end(),vs.unlinkSync(R),a.responseText.match(/^NODE-XMLHTTPREQUEST-ERROR:/)){var P=a.responseText.replace(/^NODE-XMLHTTPREQUEST-ERROR:/,"");a.handleError(P,503)}else a.status=a.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:([0-9]*),.*/,"$1"),a.responseText=a.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:[0-9]*,(.*)/,"$1"),b(a.DONE)}}},this.handleError=function(e,t){this.status=t||0,this.statusText=e,this.responseText=e.stack,f=!0,b(this.DONE)},this.abort=function(){t&&(t.abort(),t=null),l=Object.assign({},d),this.responseText="",this.responseXML="",f=g=!0,this.readyState===this.UNSENT||this.readyState===this.OPENED&&!h||this.readyState===this.DONE||(h=!1,b(this.DONE)),this.readyState=this.UNSENT},this.addEventListener=function(e,t){e in v||(v[e]=[]),v[e].push(t)},this.removeEventListener=function(e,t){e in v&&(v[e]=v[e].filter((function(e){return e!==t})))},this.dispatchEvent=function(e){if("function"==typeof a["on"+e]&&(this.readyState===this.DONE?setImmediate((function(){a["on"+e]()})):a["on"+e]()),e in v)for(let t=0,i=v[e].length;t<i;t++)this.readyState===this.DONE?setImmediate((function(){v[e][t].call(a)})):v[e][t].call(a)};var b=function(e){if(!(a.readyState===e||a.readyState===a.UNSENT&&g)&&(a.readyState=e,(c.async||a.readyState<a.OPENED||a.readyState===a.DONE)&&a.dispatchEvent("readystatechange"),a.readyState===a.DONE)){let e;e=g?"abort":f?"error":"load",a.dispatchEvent(e),a.dispatchEvent("loadend")}}}xs.XMLHttpRequest=xs;const ws=ys||v({__proto__:null,default:ys},[ys]);function Ss(){}const Rs=null!=new ws({xdomain:!1}).responseType;class Cs extends ts{constructor(e,t){super(),rs(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.async=!1!==t.async,this.data=void 0!==t.data?t.data:null,this.create()}create(){const e=ns(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd,e.xscheme=!!this.opts.xs;const t=this.xhr=new ws(e);try{t.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){t.setDisableHeaderCheck&&t.setDisableHeaderCheck(!0);for(let e in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(e)&&t.setRequestHeader(e,this.opts.extraHeaders[e])}}catch(e){}if("POST"===this.method)try{t.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{t.setRequestHeader("Accept","*/*")}catch(e){}"withCredentials"in t&&(t.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(t.timeout=this.opts.requestTimeout),t.onreadystatechange=()=>{4===t.readyState&&(200===t.status||1223===t.status?this.onLoad():this.setTimeoutFn((()=>{this.onError("number"==typeof t.status?t.status:0)}),0))},t.send(this.data)}catch(e){return void this.setTimeoutFn((()=>{this.onError(e)}),0)}"undefined"!=typeof document&&(this.index=Cs.requestsCount++,Cs.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=Ss,e)try{this.xhr.abort()}catch(e){}"undefined"!=typeof document&&delete Cs.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}if(Cs.requestsCount=0,Cs.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",ks);else if("function"==typeof addEventListener){addEventListener("onpagehide"in is?"pagehide":"unload",ks,!1)}function ks(){for(let e in Cs.requests)Cs.requests.hasOwnProperty(e)&&Cs.requests[e].abort()}var Ts={},Ps={get exports(){return Ts},set exports(e){Ts=e}},Es={BINARY_TYPES:["nodebuffer","arraybuffer","fragments"],EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}};const{EMPTY_BUFFER:Os}=Es;function Ds(e,t,i,n,s){for(let a=0;a<s;a++)i[n+a]=e[a]^t[3&a]}function Is(e,t){for(let i=0;i<e.length;i++)e[i]^=t[3&i]}if(Ps.exports={concat:function(e,t){if(0===e.length)return Os;if(1===e.length)return e[0];const i=Buffer.allocUnsafe(t);let n=0;for(let t=0;t<e.length;t++){const s=e[t];i.set(s,n),n+=s.length}return n<t?i.slice(0,n):i},mask:Ds,toArrayBuffer:function(e){return e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)},toBuffer:function e(t){if(e.readOnly=!0,Buffer.isBuffer(t))return t;let i;return t instanceof ArrayBuffer?i=Buffer.from(t):ArrayBuffer.isView(t)?i=Buffer.from(t.buffer,t.byteOffset,t.byteLength):(i=Buffer.from(t),e.readOnly=!1),i},unmask:Is},!process.env.WS_NO_BUFFER_UTIL)try{const e=require("bufferutil");Ts.mask=function(t,i,n,s,a){a<48?Ds(t,i,n,s,a):e.mask(t,i,n,s,a)},Ts.unmask=function(t,i){t.length<32?Is(t,i):e.unmask(t,i)}}catch(e){}const js=Symbol("kDone"),Ls=Symbol("kRun");const Ms=r,As=Ts,Ns=class{constructor(e){this[js]=()=>{this.pending--,this[Ls]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[Ls]()}[Ls](){if(this.pending!==this.concurrency&&this.jobs.length){const e=this.jobs.shift();this.pending++,e(this[js])}}},{kStatusCode:Bs}=Es,Fs=Buffer.from([0,0,255,255]),Us=Symbol("permessage-deflate"),zs=Symbol("total-length"),qs=Symbol("callback"),$s=Symbol("buffers"),Vs=Symbol("error");let Ws;var Hs=class{constructor(e,t,i){if(this._maxPayload=0|i,this._options=e||{},this._threshold=void 0!==this._options.threshold?this._options.threshold:1024,this._isServer=!!t,this._deflate=null,this._inflate=null,this.params=null,!Ws){const e=void 0!==this._options.concurrencyLimit?this._options.concurrencyLimit:10;Ws=new Ns(e)}}static get extensionName(){return"permessage-deflate"}offer(){const e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:null==this._options.clientMaxWindowBits&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){const e=this._deflate[qs];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){const t=this._options,i=e.find((e=>!(!1===t.serverNoContextTakeover&&e.server_no_context_takeover||e.server_max_window_bits&&(!1===t.serverMaxWindowBits||"number"==typeof t.serverMaxWindowBits&&t.serverMaxWindowBits>e.server_max_window_bits)||"number"==typeof t.clientMaxWindowBits&&!e.client_max_window_bits)));if(!i)throw new Error("None of the extension offers can be accepted");return t.serverNoContextTakeover&&(i.server_no_context_takeover=!0),t.clientNoContextTakeover&&(i.client_no_context_takeover=!0),"number"==typeof t.serverMaxWindowBits&&(i.server_max_window_bits=t.serverMaxWindowBits),"number"==typeof t.clientMaxWindowBits?i.client_max_window_bits=t.clientMaxWindowBits:!0!==i.client_max_window_bits&&!1!==t.clientMaxWindowBits||delete i.client_max_window_bits,i}acceptAsClient(e){const t=e[0];if(!1===this._options.clientNoContextTakeover&&t.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(t.client_max_window_bits){if(!1===this._options.clientMaxWindowBits||"number"==typeof this._options.clientMaxWindowBits&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"')}else"number"==typeof this._options.clientMaxWindowBits&&(t.client_max_window_bits=this._options.clientMaxWindowBits);return t}normalizeParams(e){return e.forEach((e=>{Object.keys(e).forEach((t=>{let i=e[t];if(i.length>1)throw new Error(`Parameter "${t}" must have only a single value`);if(i=i[0],"client_max_window_bits"===t){if(!0!==i){const e=+i;if(!Number.isInteger(e)||e<8||e>15)throw new TypeError(`Invalid value for parameter "${t}": ${i}`);i=e}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${t}": ${i}`)}else if("server_max_window_bits"===t){const e=+i;if(!Number.isInteger(e)||e<8||e>15)throw new TypeError(`Invalid value for parameter "${t}": ${i}`);i=e}else{if("client_no_context_takeover"!==t&&"server_no_context_takeover"!==t)throw new Error(`Unknown parameter "${t}"`);if(!0!==i)throw new TypeError(`Invalid value for parameter "${t}": ${i}`)}e[t]=i}))})),e}decompress(e,t,i){Ws.add((n=>{this._decompress(e,t,((e,t)=>{n(),i(e,t)}))}))}compress(e,t,i){Ws.add((n=>{this._compress(e,t,((e,t)=>{n(),i(e,t)}))}))}_decompress(e,t,i){const n=this._isServer?"client":"server";if(!this._inflate){const e=`${n}_max_window_bits`,t="number"!=typeof this.params[e]?Ms.Z_DEFAULT_WINDOWBITS:this.params[e];this._inflate=Ms.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[Us]=this,this._inflate[zs]=0,this._inflate[$s]=[],this._inflate.on("error",Js),this._inflate.on("data",Ks)}this._inflate[qs]=i,this._inflate.write(e),t&&this._inflate.write(Fs),this._inflate.flush((()=>{const e=this._inflate[Vs];if(e)return this._inflate.close(),this._inflate=null,void i(e);const s=As.concat(this._inflate[$s],this._inflate[zs]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[zs]=0,this._inflate[$s]=[],t&&this.params[`${n}_no_context_takeover`]&&this._inflate.reset()),i(null,s)}))}_compress(e,t,i){const n=this._isServer?"server":"client";if(!this._deflate){const e=`${n}_max_window_bits`,t="number"!=typeof this.params[e]?Ms.Z_DEFAULT_WINDOWBITS:this.params[e];this._deflate=Ms.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[zs]=0,this._deflate[$s]=[],this._deflate.on("data",Gs)}this._deflate[qs]=i,this._deflate.write(e),this._deflate.flush(Ms.Z_SYNC_FLUSH,(()=>{if(!this._deflate)return;let e=As.concat(this._deflate[$s],this._deflate[zs]);t&&(e=e.slice(0,e.length-4)),this._deflate[qs]=null,this._deflate[zs]=0,this._deflate[$s]=[],t&&this.params[`${n}_no_context_takeover`]&&this._deflate.reset(),i(null,e)}))}};function Gs(e){this[$s].push(e),this[zs]+=e.length}function Ks(e){this[zs]+=e.length,this[Us]._maxPayload<1||this[zs]<=this[Us]._maxPayload?this[$s].push(e):(this[Vs]=new RangeError("Max payload size exceeded"),this[Vs].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Vs][Bs]=1009,this.removeListener("data",Ks),this.reset())}function Js(e){this[Us]._inflate=null,e[Bs]=1007,this[qs](e)}var Qs={};function Ys(e){const t=e.length;let i=0;for(;i<t;)if(0==(128&e[i]))i++;else if(192==(224&e[i])){if(i+1===t||128!=(192&e[i+1])||192==(254&e[i]))return!1;i+=2}else if(224==(240&e[i])){if(i+2>=t||128!=(192&e[i+1])||128!=(192&e[i+2])||224===e[i]&&128==(224&e[i+1])||237===e[i]&&160==(224&e[i+1]))return!1;i+=3}else{if(240!=(248&e[i]))return!1;if(i+3>=t||128!=(192&e[i+1])||128!=(192&e[i+2])||128!=(192&e[i+3])||240===e[i]&&128==(240&e[i+1])||244===e[i]&&e[i+1]>143||e[i]>244)return!1;i+=4}return!0}if({get exports(){return Qs},set exports(e){Qs=e}}.exports={isValidStatusCode:function(e){return e>=1e3&&e<=1014&&1004!==e&&1005!==e&&1006!==e||e>=3e3&&e<=4999},isValidUTF8:Ys,tokenChars:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0]},!process.env.WS_NO_UTF_8_VALIDATE)try{const e=require("utf-8-validate");Qs.isValidUTF8=function(t){return t.length<150?Ys(t):e(t)}}catch(e){}const{Writable:Xs}=a,Zs=Hs,{BINARY_TYPES:ea,EMPTY_BUFFER:ta,kStatusCode:ia,kWebSocket:na}=Es,{concat:sa,toArrayBuffer:aa,unmask:ra}=Ts,{isValidStatusCode:oa,isValidUTF8:ca}=Qs;var pa=class extends Xs{constructor(e={}){super(),this._binaryType=e.binaryType||ea[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=0|e.maxPayload,this._skipUTF8Validation=!!e.skipUTF8Validation,this[na]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._state=0,this._loop=!1}_write(e,t,i){if(8===this._opcode&&0==this._state)return i();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(i)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){const t=this._buffers[0];return this._buffers[0]=t.slice(e),t.slice(0,e)}const t=Buffer.allocUnsafe(e);do{const i=this._buffers[0],n=t.length-e;e>=i.length?t.set(this._buffers.shift(),n):(t.set(new Uint8Array(i.buffer,i.byteOffset,e),n),this._buffers[0]=i.slice(e)),e-=i.length}while(e>0);return t}startLoop(e){let t;this._loop=!0;do{switch(this._state){case 0:t=this.getInfo();break;case 1:t=this.getPayloadLength16();break;case 2:t=this.getPayloadLength64();break;case 3:this.getMask();break;case 4:t=this.getData(e);break;default:return void(this._loop=!1)}}while(this._loop);e(t)}getInfo(){if(this._bufferedBytes<2)return void(this._loop=!1);const e=this.consume(2);if(0!=(48&e[0]))return this._loop=!1,da(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");const t=64==(64&e[0]);if(t&&!this._extensions[Zs.extensionName])return this._loop=!1,da(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._fin=128==(128&e[0]),this._opcode=15&e[0],this._payloadLength=127&e[1],0===this._opcode){if(t)return this._loop=!1,da(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(!this._fragmented)return this._loop=!1,da(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");this._opcode=this._fragmented}else if(1===this._opcode||2===this._opcode){if(this._fragmented)return this._loop=!1,da(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");this._compressed=t}else{if(!(this._opcode>7&&this._opcode<11))return this._loop=!1,da(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");if(!this._fin)return this._loop=!1,da(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");if(t)return this._loop=!1,da(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._payloadLength>125)return this._loop=!1,da(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH")}if(this._fin||this._fragmented||(this._fragmented=this._opcode),this._masked=128==(128&e[1]),this._isServer){if(!this._masked)return this._loop=!1,da(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK")}else if(this._masked)return this._loop=!1,da(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");if(126===this._payloadLength)this._state=1;else{if(127!==this._payloadLength)return this.haveLength();this._state=2}}getPayloadLength16(){if(!(this._bufferedBytes<2))return this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength();this._loop=!1}getPayloadLength64(){if(this._bufferedBytes<8)return void(this._loop=!1);const e=this.consume(8),t=e.readUInt32BE(0);return t>Math.pow(2,21)-1?(this._loop=!1,da(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=t*Math.pow(2,32)+e.readUInt32BE(4),this.haveLength())}haveLength(){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0))return this._loop=!1,da(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");this._masked?this._state=3:this._state=4}getMask(){this._bufferedBytes<4?this._loop=!1:(this._mask=this.consume(4),this._state=4)}getData(e){let t=ta;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength)return void(this._loop=!1);t=this.consume(this._payloadLength),this._masked&&0!=(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])&&ra(t,this._mask)}return this._opcode>7?this.controlMessage(t):this._compressed?(this._state=5,void this.decompress(t,e)):(t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage())}decompress(e,t){this._extensions[Zs.extensionName].decompress(e,this._fin,((e,i)=>{if(e)return t(e);if(i.length){if(this._messageLength+=i.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return t(da(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));this._fragments.push(i)}const n=this.dataMessage();if(n)return t(n);this.startLoop(t)}))}dataMessage(){if(this._fin){const e=this._messageLength,t=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],2===this._opcode){let i;i="nodebuffer"===this._binaryType?sa(t,e):"arraybuffer"===this._binaryType?aa(sa(t,e)):t,this.emit("message",i,!0)}else{const i=sa(t,e);if(!this._skipUTF8Validation&&!ca(i))return this._loop=!1,da(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("message",i,!1)}}this._state=0}controlMessage(e){if(8===this._opcode)if(this._loop=!1,0===e.length)this.emit("conclude",1005,ta),this.end();else{if(1===e.length)return da(RangeError,"invalid payload length 1",!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");{const t=e.readUInt16BE(0);if(!oa(t))return da(RangeError,`invalid status code ${t}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");const i=e.slice(2);if(!this._skipUTF8Validation&&!ca(i))return da(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("conclude",t,i),this.end()}}else 9===this._opcode?this.emit("ping",e):this.emit("pong",e);this._state=0}};function da(e,t,i,n,s){const a=new e(i?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(a,da),a.code=s,a[ia]=n,a}const{randomFillSync:la}=p,ua=Hs,{EMPTY_BUFFER:ma}=Es,{isValidStatusCode:ha}=Qs,{mask:fa,toBuffer:ga}=Ts,va=Symbol("kByteLength"),ba=Buffer.alloc(4);class _a{constructor(e,t,i){this._extensions=t||{},i&&(this._generateMask=i,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(e,t){let i,n,s=!1,a=2,r=!1;t.mask&&(i=t.maskBuffer||ba,t.generateMask?t.generateMask(i):la(i,0,4),r=0==(i[0]|i[1]|i[2]|i[3]),a=6),"string"==typeof e?n=t.mask&&!r||void 0===t[va]?(e=Buffer.from(e)).length:t[va]:(n=e.length,s=t.mask&&t.readOnly&&!r);let o=n;n>=65536?(a+=8,o=127):n>125&&(a+=2,o=126);const c=Buffer.allocUnsafe(s?n+a:a);return c[0]=t.fin?128|t.opcode:t.opcode,t.rsv1&&(c[0]|=64),c[1]=o,126===o?c.writeUInt16BE(n,2):127===o&&(c[2]=c[3]=0,c.writeUIntBE(n,4,6)),t.mask?(c[1]|=128,c[a-4]=i[0],c[a-3]=i[1],c[a-2]=i[2],c[a-1]=i[3],r?[c,e]:s?(fa(e,i,c,a,n),[c]):(fa(e,i,e,0,n),[c,e])):[c,e]}close(e,t,i,n){let s;if(void 0===e)s=ma;else{if("number"!=typeof e||!ha(e))throw new TypeError("First argument must be a valid error code number");if(void 0!==t&&t.length){const i=Buffer.byteLength(t);if(i>123)throw new RangeError("The message must not be greater than 123 bytes");s=Buffer.allocUnsafe(2+i),s.writeUInt16BE(e,0),"string"==typeof t?s.write(t,2):s.set(t,2)}else s=Buffer.allocUnsafe(2),s.writeUInt16BE(e,0)}const a={[va]:s.length,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._deflating?this.enqueue([this.dispatch,s,!1,a,n]):this.sendFrame(_a.frame(s,a),n)}ping(e,t,i){let n,s;if("string"==typeof e?(n=Buffer.byteLength(e),s=!1):(n=(e=ga(e)).length,s=ga.readOnly),n>125)throw new RangeError("The data size must not be greater than 125 bytes");const a={[va]:n,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:9,readOnly:s,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,a,i]):this.sendFrame(_a.frame(e,a),i)}pong(e,t,i){let n,s;if("string"==typeof e?(n=Buffer.byteLength(e),s=!1):(n=(e=ga(e)).length,s=ga.readOnly),n>125)throw new RangeError("The data size must not be greater than 125 bytes");const a={[va]:n,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:10,readOnly:s,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,a,i]):this.sendFrame(_a.frame(e,a),i)}send(e,t,i){const n=this._extensions[ua.extensionName];let s,a,r=t.binary?2:1,o=t.compress;if("string"==typeof e?(s=Buffer.byteLength(e),a=!1):(s=(e=ga(e)).length,a=ga.readOnly),this._firstFragment?(this._firstFragment=!1,o&&n&&n.params[n._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(o=s>=n._threshold),this._compress=o):(o=!1,r=0),t.fin&&(this._firstFragment=!0),n){const n={[va]:s,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:r,readOnly:a,rsv1:o};this._deflating?this.enqueue([this.dispatch,e,this._compress,n,i]):this.dispatch(e,this._compress,n,i)}else this.sendFrame(_a.frame(e,{[va]:s,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:r,readOnly:a,rsv1:!1}),i)}dispatch(e,t,i,n){if(!t)return void this.sendFrame(_a.frame(e,i),n);const s=this._extensions[ua.extensionName];this._bufferedBytes+=i[va],this._deflating=!0,s.compress(e,i.fin,((e,t)=>{if(this._socket.destroyed){const e=new Error("The socket was closed while data was being compressed");"function"==typeof n&&n(e);for(let t=0;t<this._queue.length;t++){const i=this._queue[t],n=i[i.length-1];"function"==typeof n&&n(e)}}else this._bufferedBytes-=i[va],this._deflating=!1,i.readOnly=!1,this.sendFrame(_a.frame(t,i),n),this.dequeue()}))}dequeue(){for(;!this._deflating&&this._queue.length;){const e=this._queue.shift();this._bufferedBytes-=e[3][va],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][va],this._queue.push(e)}sendFrame(e,t){2===e.length?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}}var ya=_a;const{kForOnEventAttribute:xa,kListener:wa}=Es,Sa=Symbol("kCode"),Ra=Symbol("kData"),Ca=Symbol("kError"),ka=Symbol("kMessage"),Ta=Symbol("kReason"),Pa=Symbol("kTarget"),Ea=Symbol("kType"),Oa=Symbol("kWasClean");class Da{constructor(e){this[Pa]=null,this[Ea]=e}get target(){return this[Pa]}get type(){return this[Ea]}}Object.defineProperty(Da.prototype,"target",{enumerable:!0}),Object.defineProperty(Da.prototype,"type",{enumerable:!0});class Ia extends Da{constructor(e,t={}){super(e),this[Sa]=void 0===t.code?0:t.code,this[Ta]=void 0===t.reason?"":t.reason,this[Oa]=void 0!==t.wasClean&&t.wasClean}get code(){return this[Sa]}get reason(){return this[Ta]}get wasClean(){return this[Oa]}}Object.defineProperty(Ia.prototype,"code",{enumerable:!0}),Object.defineProperty(Ia.prototype,"reason",{enumerable:!0}),Object.defineProperty(Ia.prototype,"wasClean",{enumerable:!0});class ja extends Da{constructor(e,t={}){super(e),this[Ca]=void 0===t.error?null:t.error,this[ka]=void 0===t.message?"":t.message}get error(){return this[Ca]}get message(){return this[ka]}}Object.defineProperty(ja.prototype,"error",{enumerable:!0}),Object.defineProperty(ja.prototype,"message",{enumerable:!0});class La extends Da{constructor(e,t={}){super(e),this[Ra]=void 0===t.data?null:t.data}get data(){return this[Ra]}}Object.defineProperty(La.prototype,"data",{enumerable:!0});const Ma={addEventListener(e,t,i={}){for(const n of this.listeners(e))if(!i[xa]&&n[wa]===t&&!n[xa])return;let n;if("message"===e)n=function(e,i){const n=new La("message",{data:i?e:e.toString()});n[Pa]=this,Na(t,this,n)};else if("close"===e)n=function(e,i){const n=new Ia("close",{code:e,reason:i.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});n[Pa]=this,Na(t,this,n)};else if("error"===e)n=function(e){const i=new ja("error",{error:e,message:e.message});i[Pa]=this,Na(t,this,i)};else{if("open"!==e)return;n=function(){const e=new Da("open");e[Pa]=this,Na(t,this,e)}}n[xa]=!!i[xa],n[wa]=t,i.once?this.once(e,n):this.on(e,n)},removeEventListener(e,t){for(const i of this.listeners(e))if(i[wa]===t&&!i[xa]){this.removeListener(e,i);break}}};var Aa={CloseEvent:Ia,ErrorEvent:ja,Event:Da,EventTarget:Ma,MessageEvent:La};function Na(e,t,i){"object"==typeof e&&e.handleEvent?e.handleEvent.call(e,i):e.call(t,i)}const{tokenChars:Ba}=Qs;function Fa(e,t,i){void 0===e[t]?e[t]=[i]:e[t].push(i)}var Ua={format:function(e){return Object.keys(e).map((t=>{let i=e[t];return Array.isArray(i)||(i=[i]),i.map((e=>[t].concat(Object.keys(e).map((t=>{let i=e[t];return Array.isArray(i)||(i=[i]),i.map((e=>!0===e?t:`${t}=${e}`)).join("; ")}))).join("; "))).join(", ")})).join(", ")},parse:function(e){const t=Object.create(null);let i,n,s=Object.create(null),a=!1,r=!1,o=!1,c=-1,p=-1,d=-1,l=0;for(;l<e.length;l++)if(p=e.charCodeAt(l),void 0===i)if(-1===d&&1===Ba[p])-1===c&&(c=l);else if(0===l||32!==p&&9!==p){if(59!==p&&44!==p)throw new SyntaxError(`Unexpected character at index ${l}`);{if(-1===c)throw new SyntaxError(`Unexpected character at index ${l}`);-1===d&&(d=l);const n=e.slice(c,d);44===p?(Fa(t,n,s),s=Object.create(null)):i=n,c=d=-1}}else-1===d&&-1!==c&&(d=l);else if(void 0===n)if(-1===d&&1===Ba[p])-1===c&&(c=l);else if(32===p||9===p)-1===d&&-1!==c&&(d=l);else if(59===p||44===p){if(-1===c)throw new SyntaxError(`Unexpected character at index ${l}`);-1===d&&(d=l),Fa(s,e.slice(c,d),!0),44===p&&(Fa(t,i,s),s=Object.create(null),i=void 0),c=d=-1}else{if(61!==p||-1===c||-1!==d)throw new SyntaxError(`Unexpected character at index ${l}`);n=e.slice(c,l),c=d=-1}else if(r){if(1!==Ba[p])throw new SyntaxError(`Unexpected character at index ${l}`);-1===c?c=l:a||(a=!0),r=!1}else if(o)if(1===Ba[p])-1===c&&(c=l);else if(34===p&&-1!==c)o=!1,d=l;else{if(92!==p)throw new SyntaxError(`Unexpected character at index ${l}`);r=!0}else if(34===p&&61===e.charCodeAt(l-1))o=!0;else if(-1===d&&1===Ba[p])-1===c&&(c=l);else if(-1===c||32!==p&&9!==p){if(59!==p&&44!==p)throw new SyntaxError(`Unexpected character at index ${l}`);{if(-1===c)throw new SyntaxError(`Unexpected character at index ${l}`);-1===d&&(d=l);let r=e.slice(c,d);a&&(r=r.replace(/\\/g,""),a=!1),Fa(s,n,r),44===p&&(Fa(t,i,s),s=Object.create(null),i=void 0),n=void 0,c=d=-1}}else-1===d&&(d=l);if(-1===c||o||32===p||9===p)throw new SyntaxError("Unexpected end of input");-1===d&&(d=l);const u=e.slice(c,d);return void 0===i?Fa(t,u,s):(void 0===n?Fa(s,u,!0):Fa(s,n,a?u.replace(/\\/g,""):u),Fa(t,i,s)),t}};const za=d,qa=s,$a=n,Va=o,Wa=c,{randomBytes:Ha,createHash:Ga}=p,{URL:Ka}=t,Ja=Hs,Qa=pa,Ya=ya,{BINARY_TYPES:Xa,EMPTY_BUFFER:Za,GUID:er,kForOnEventAttribute:tr,kListener:ir,kStatusCode:nr,kWebSocket:sr,NOOP:ar}=Es,{EventTarget:{addEventListener:rr,removeEventListener:or}}=Aa,{format:cr,parse:pr}=Ua,{toBuffer:dr}=Ts,lr=Symbol("kAborted"),ur=[8,13],mr=["CONNECTING","OPEN","CLOSING","CLOSED"],hr=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class fr extends za{constructor(e,t,i){super(),this._binaryType=Xa[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Za,this._closeTimer=null,this._extensions={},this._paused=!1,this._protocol="",this._readyState=fr.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,null!==e?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,void 0===t?t=[]:Array.isArray(t)||("object"==typeof t&&null!==t?(i=t,t=[]):t=[t]),gr(this,e,t,i)):this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(e){Xa.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,t,i){const n=new Qa({binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation});this._sender=new Ya(e,this._extensions,i.generateMask),this._receiver=n,this._socket=e,n[sr]=this,e[sr]=this,n.on("conclude",wr),n.on("drain",Sr),n.on("error",Rr),n.on("message",kr),n.on("ping",Tr),n.on("pong",Pr),e.setTimeout(0),e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",Or),e.on("data",Dr),e.on("end",Ir),e.on("error",jr),this._readyState=fr.OPEN,this.emit("open")}emitClose(){if(!this._socket)return this._readyState=fr.CLOSED,void this.emit("close",this._closeCode,this._closeMessage);this._extensions[Ja.extensionName]&&this._extensions[Ja.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=fr.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState!==fr.CLOSED){if(this.readyState===fr.CONNECTING){const e="WebSocket was closed before the connection was established";return yr(this,this._req,e)}this.readyState!==fr.CLOSING?(this._readyState=fr.CLOSING,this._sender.close(e,t,!this._isServer,(e=>{e||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())})),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),3e4)):this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end()}}pause(){this.readyState!==fr.CONNECTING&&this.readyState!==fr.CLOSED&&(this._paused=!0,this._socket.pause())}ping(e,t,i){if(this.readyState===fr.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof e?(i=e,e=t=void 0):"function"==typeof t&&(i=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState===fr.OPEN?(void 0===t&&(t=!this._isServer),this._sender.ping(e||Za,t,i)):xr(this,e,i)}pong(e,t,i){if(this.readyState===fr.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof e?(i=e,e=t=void 0):"function"==typeof t&&(i=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState===fr.OPEN?(void 0===t&&(t=!this._isServer),this._sender.pong(e||Za,t,i)):xr(this,e,i)}resume(){this.readyState!==fr.CONNECTING&&this.readyState!==fr.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,t,i){if(this.readyState===fr.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if("function"==typeof t&&(i=t,t={}),"number"==typeof e&&(e=e.toString()),this.readyState!==fr.OPEN)return void xr(this,e,i);const n={binary:"string"!=typeof e,mask:!this._isServer,compress:!0,fin:!0,...t};this._extensions[Ja.extensionName]||(n.compress=!1),this._sender.send(e||Za,n,i)}terminate(){if(this.readyState!==fr.CLOSED){if(this.readyState===fr.CONNECTING){const e="WebSocket was closed before the connection was established";return yr(this,this._req,e)}this._socket&&(this._readyState=fr.CLOSING,this._socket.destroy())}}}function gr(e,t,i,n){const s={protocolVersion:ur[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...n,createConnection:void 0,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(!ur.includes(s.protocolVersion))throw new RangeError(`Unsupported protocol version: ${s.protocolVersion} (supported versions: ${ur.join(", ")})`);let a;if(t instanceof Ka)a=t,e._url=t.href;else{try{a=new Ka(t)}catch(e){throw new SyntaxError(`Invalid URL: ${t}`)}e._url=t}const r="wss:"===a.protocol,o="ws+unix:"===a.protocol;let c;if("ws:"===a.protocol||r||o?o&&!a.pathname?c="The URL's pathname is empty":a.hash&&(c="The URL contains a fragment identifier"):c='The URL\'s protocol must be one of "ws:", "wss:", or "ws+unix:"',c){const t=new SyntaxError(c);if(0===e._redirects)throw t;return void vr(e,t)}const p=r?443:80,d=Ha(16).toString("base64"),l=r?qa.request:$a.request,u=new Set;let m,h;if(s.createConnection=r?_r:br,s.defaultPort=s.defaultPort||p,s.port=a.port||p,s.host=a.hostname.startsWith("[")?a.hostname.slice(1,-1):a.hostname,s.headers={...s.headers,"Sec-WebSocket-Version":s.protocolVersion,"Sec-WebSocket-Key":d,Connection:"Upgrade",Upgrade:"websocket"},s.path=a.pathname+a.search,s.timeout=s.handshakeTimeout,s.perMessageDeflate&&(m=new Ja(!0!==s.perMessageDeflate?s.perMessageDeflate:{},!1,s.maxPayload),s.headers["Sec-WebSocket-Extensions"]=cr({[Ja.extensionName]:m.offer()})),i.length){for(const e of i){if("string"!=typeof e||!hr.test(e)||u.has(e))throw new SyntaxError("An invalid or duplicated subprotocol was specified");u.add(e)}s.headers["Sec-WebSocket-Protocol"]=i.join(",")}if(s.origin&&(s.protocolVersion<13?s.headers["Sec-WebSocket-Origin"]=s.origin:s.headers.Origin=s.origin),(a.username||a.password)&&(s.auth=`${a.username}:${a.password}`),o){const e=s.path.split(":");s.socketPath=e[0],s.path=e[1]}if(s.followRedirects){if(0===e._redirects){e._originalIpc=o,e._originalSecure=r,e._originalHostOrSocketPath=o?s.socketPath:a.host;const t=n&&n.headers;if(n={...n,headers:{}},t)for(const[e,i]of Object.entries(t))n.headers[e.toLowerCase()]=i}else if(0===e.listenerCount("redirect")){const t=o?!!e._originalIpc&&s.socketPath===e._originalHostOrSocketPath:!e._originalIpc&&a.host===e._originalHostOrSocketPath;(!t||e._originalSecure&&!r)&&(delete s.headers.authorization,delete s.headers.cookie,t||delete s.headers.host,s.auth=void 0)}s.auth&&!n.headers.authorization&&(n.headers.authorization="Basic "+Buffer.from(s.auth).toString("base64")),h=e._req=l(s),e._redirects&&e.emit("redirect",e.url,h)}else h=e._req=l(s);s.timeout&&h.on("timeout",(()=>{yr(e,h,"Opening handshake has timed out")})),h.on("error",(t=>{null===h||h[lr]||(h=e._req=null,vr(e,t))})),h.on("response",(a=>{const r=a.headers.location,o=a.statusCode;if(r&&s.followRedirects&&o>=300&&o<400){if(++e._redirects>s.maxRedirects)return void yr(e,h,"Maximum redirects exceeded");let a;h.abort();try{a=new Ka(r,t)}catch(t){const i=new SyntaxError(`Invalid URL: ${r}`);return void vr(e,i)}gr(e,a,i,n)}else e.emit("unexpected-response",h,a)||yr(e,h,`Unexpected server response: ${a.statusCode}`)})),h.on("upgrade",((t,i,n)=>{if(e.emit("upgrade",t),e.readyState!==fr.CONNECTING)return;if(h=e._req=null,"websocket"!==t.headers.upgrade.toLowerCase())return void yr(e,i,"Invalid Upgrade header");const a=Ga("sha1").update(d+er).digest("base64");if(t.headers["sec-websocket-accept"]!==a)return void yr(e,i,"Invalid Sec-WebSocket-Accept header");const r=t.headers["sec-websocket-protocol"];let o;if(void 0!==r?u.size?u.has(r)||(o="Server sent an invalid subprotocol"):o="Server sent a subprotocol but none was requested":u.size&&(o="Server sent no subprotocol"),o)return void yr(e,i,o);r&&(e._protocol=r);const c=t.headers["sec-websocket-extensions"];if(void 0!==c){if(!m){return void yr(e,i,"Server sent a Sec-WebSocket-Extensions header but no extension was requested")}let t;try{t=pr(c)}catch(t){return void yr(e,i,"Invalid Sec-WebSocket-Extensions header")}const n=Object.keys(t);if(1!==n.length||n[0]!==Ja.extensionName){return void yr(e,i,"Server indicated an extension that was not requested")}try{m.accept(t[Ja.extensionName])}catch(t){return void yr(e,i,"Invalid Sec-WebSocket-Extensions header")}e._extensions[Ja.extensionName]=m}e.setSocket(i,n,{generateMask:s.generateMask,maxPayload:s.maxPayload,skipUTF8Validation:s.skipUTF8Validation})})),h.end()}function vr(e,t){e._readyState=fr.CLOSING,e.emit("error",t),e.emitClose()}function br(e){return e.path=e.socketPath,Va.connect(e)}function _r(e){return e.path=void 0,e.servername||""===e.servername||(e.servername=Va.isIP(e.host)?"":e.host),Wa.connect(e)}function yr(e,t,i){e._readyState=fr.CLOSING;const n=new Error(i);Error.captureStackTrace(n,yr),t.setHeader?(t[lr]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(vr,e,n)):(t.destroy(n),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function xr(e,t,i){if(t){const i=dr(t).length;e._socket?e._sender._bufferedBytes+=i:e._bufferedAmount+=i}if(i){i(new Error(`WebSocket is not open: readyState ${e.readyState} (${mr[e.readyState]})`))}}function wr(e,t){const i=this[sr];i._closeFrameReceived=!0,i._closeMessage=t,i._closeCode=e,void 0!==i._socket[sr]&&(i._socket.removeListener("data",Dr),process.nextTick(Er,i._socket),1005===e?i.close():i.close(e,t))}function Sr(){const e=this[sr];e.isPaused||e._socket.resume()}function Rr(e){const t=this[sr];void 0!==t._socket[sr]&&(t._socket.removeListener("data",Dr),process.nextTick(Er,t._socket),t.close(e[nr])),t.emit("error",e)}function Cr(){this[sr].emitClose()}function kr(e,t){this[sr].emit("message",e,t)}function Tr(e){const t=this[sr];t.pong(e,!t._isServer,ar),t.emit("ping",e)}function Pr(e){this[sr].emit("pong",e)}function Er(e){e.resume()}function Or(){const e=this[sr];let t;this.removeListener("close",Or),this.removeListener("data",Dr),this.removeListener("end",Ir),e._readyState=fr.CLOSING,this._readableState.endEmitted||e._closeFrameReceived||e._receiver._writableState.errorEmitted||null===(t=e._socket.read())||e._receiver.write(t),e._receiver.end(),this[sr]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",Cr),e._receiver.on("finish",Cr))}function Dr(e){this[sr]._receiver.write(e)||this.pause()}function Ir(){const e=this[sr];e._readyState=fr.CLOSING,e._receiver.end(),this.end()}function jr(){const e=this[sr];this.removeListener("error",jr),this.on("error",ar),e&&(e._readyState=fr.CLOSING,this.destroy())}Object.defineProperty(fr,"CONNECTING",{enumerable:!0,value:mr.indexOf("CONNECTING")}),Object.defineProperty(fr.prototype,"CONNECTING",{enumerable:!0,value:mr.indexOf("CONNECTING")}),Object.defineProperty(fr,"OPEN",{enumerable:!0,value:mr.indexOf("OPEN")}),Object.defineProperty(fr.prototype,"OPEN",{enumerable:!0,value:mr.indexOf("OPEN")}),Object.defineProperty(fr,"CLOSING",{enumerable:!0,value:mr.indexOf("CLOSING")}),Object.defineProperty(fr.prototype,"CLOSING",{enumerable:!0,value:mr.indexOf("CLOSING")}),Object.defineProperty(fr,"CLOSED",{enumerable:!0,value:mr.indexOf("CLOSED")}),Object.defineProperty(fr.prototype,"CLOSED",{enumerable:!0,value:mr.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach((e=>{Object.defineProperty(fr.prototype,e,{enumerable:!0})})),["open","error","close","message"].forEach((e=>{Object.defineProperty(fr.prototype,`on${e}`,{enumerable:!0,get(){for(const t of this.listeners(e))if(t[tr])return t[ir];return null},set(t){for(const t of this.listeners(e))if(t[tr]){this.removeListener(e,t);break}"function"==typeof t&&this.addEventListener(e,t,{[tr]:!0})}})})),fr.prototype.addEventListener=rr,fr.prototype.removeEventListener=or;const Lr=fr,Mr=process.nextTick,Ar="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();const Nr={websocket:class extends cs{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,i=Ar?{}:ns(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=new Lr(e,t,i)}catch(e){return this.emitReserved("error",e)}this.ws.binaryType=this.socket.binaryType||"nodebuffer",this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const i=e[t],n=t===e.length-1;Kn(i,this.supportsBinary,(e=>{const t={};if(i.options&&(t.compress=i.options.compress),this.opts.perMessageDeflate){("string"==typeof e?Buffer.byteLength(e):e.length)<this.opts.perMessageDeflate.threshold&&(t.compress=!1)}try{this.ws.send(e,t)}catch(e){}n&&Mr((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}uri(){let e=this.query||{};const t=this.opts.secure?"wss":"ws";let i="";this.opts.port&&("wss"===t&&443!==Number(this.opts.port)||"ws"===t&&80!==Number(this.opts.port))&&(i=":"+this.opts.port),this.opts.timestampRequests&&(e[this.opts.timestampParam]=fs()),this.supportsBinary||(e.b64=1);const n=gs(e);return t+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+i+this.opts.path+(n.length?"?"+n:"")}check(){return!!Lr}},polling:class extends cs{constructor(e){if(super(e),this.polling=!1,"undefined"!=typeof location){const t="https:"===location.protocol;let i=location.port;i||(i=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||i!==e.port,this.xs=e.secure!==t}const t=e&&e.forceBase64;this.supportsBinary=Rs&&!t}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let e=0;this.polling&&(e++,this.once("pollComplete",(function(){--e||t()}))),this.writable||(e++,this.once("drain",(function(){--e||t()})))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{const i=e.split(es),n=[];for(let e=0;e<i.length;e++){const s=Yn(i[e],t);if(n.push(s),"error"===s.type)break}return n})(e,this.socket.binaryType).forEach((e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)})),"closed"!==this.readyState&&(this.polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const i=e.length,n=new Array(i);let s=0;e.forEach(((e,a)=>{Kn(e,!1,(e=>{n[a]=e,++s===i&&t(n.join(es))}))}))})(e,(e=>{this.doWrite(e,(()=>{this.writable=!0,this.emitReserved("drain")}))}))}uri(){let e=this.query||{};const t=this.opts.secure?"https":"http";let i="";!1!==this.opts.timestampRequests&&(e[this.opts.timestampParam]=fs()),this.supportsBinary||e.sid||(e.b64=1),this.opts.port&&("https"===t&&443!==Number(this.opts.port)||"http"===t&&80!==Number(this.opts.port))&&(i=":"+this.opts.port);const n=gs(e);return t+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+i+this.opts.path+(n.length?"?"+n:"")}request(e={}){return Object.assign(e,{xd:this.xd,xs:this.xs},this.opts),new Cs(this.uri(),e)}doWrite(e,t){const i=this.request({method:"POST",data:e});i.on("success",t),i.on("error",((e,t)=>{this.onError("xhr post error",e,t)}))}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",((e,t)=>{this.onError("xhr poll error",e,t)})),this.pollXhr=e}}},Br=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Fr=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Ur(e){const t=e,i=e.indexOf("["),n=e.indexOf("]");-1!=i&&-1!=n&&(e=e.substring(0,i)+e.substring(i,n).replace(/:/g,";")+e.substring(n,e.length));let s=Br.exec(e||""),a={},r=14;for(;r--;)a[Fr[r]]=s[r]||"";return-1!=i&&-1!=n&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=function(e,t){const i=/\/{2,9}/g,n=t.replace(i,"/").split("/");"/"!=t.slice(0,1)&&0!==t.length||n.splice(0,1);"/"==t.slice(-1)&&n.splice(n.length-1,1);return n}(0,a.path),a.queryKey=function(e,t){const i={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(e,t,n){t&&(i[t]=n)})),i}(0,a.query),a}class zr extends ts{constructor(e,t={}){super(),this.writeBuffer=[],e&&"object"==typeof e&&(t=e,e=null),e?(e=Ur(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=Ur(t.host).host),rs(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},i=e.split("&");for(let e=0,n=i.length;e<n;e++){let n=i[e].split("=");t[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return t}(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,"function"==typeof addEventListener&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const i=Object.assign({},this.opts.transportOptions[e],this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new Nr[e](i)}open(){let e;if(this.opts.rememberUpgrade&&zr.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((()=>{this.emitReserved("error","No transports available")}),0);e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(e){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",(e=>this.onClose("transport close",e)))}probe(e){let t=this.createTransport(e),i=!1;zr.priorWebsocketSuccess=!1;const n=()=>{i||(t.send([{type:"ping",data:"probe"}]),t.once("packet",(e=>{if(!i)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;zr.priorWebsocketSuccess="websocket"===t.name,this.transport.pause((()=>{i||"closed"!==this.readyState&&(p(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())}))}else{const e=new Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}})))};function s(){i||(i=!0,p(),t.close(),t=null)}const a=e=>{const i=new Error("probe error: "+e);i.transport=t.name,s(),this.emitReserved("upgradeError",i)};function r(){a("transport closed")}function o(){a("socket closed")}function c(e){t&&e.name!==t.name&&s()}const p=()=>{t.removeListener("open",n),t.removeListener("error",a),t.removeListener("close",r),this.off("close",o),this.off("upgrading",c)};t.once("open",n),t.once("error",a),t.once("close",r),this.once("close",o),this.once("upgrading",c),t.open()}onOpen(){if(this.readyState="open",zr.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade){let e=0;const t=this.upgrades.length;for(;e<t;e++)this.probe(this.upgrades[e])}}onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.resetPingTimeout(),this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn((()=>{this.onClose("ping timeout")}),this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let i=0;i<this.writeBuffer.length;i++){const n=this.writeBuffer[i].data;if(n&&(e+="string"==typeof(t=n)?function(e){let t=0,i=0;for(let n=0,s=e.length;n<s;n++)t=e.charCodeAt(n),t<128?i+=1:t<2048?i+=2:t<55296||t>=57344?i+=3:(n++,i+=4);return i}(t):Math.ceil(1.33*(t.byteLength||t.size))),i>0&&e>this.maxPayload)return this.writeBuffer.slice(0,i);e+=2}var t;return this.writeBuffer}write(e,t,i){return this.sendPacket("message",e,t,i),this}send(e,t,i){return this.sendPacket("message",e,t,i),this}sendPacket(e,t,i,n){if("function"==typeof t&&(n=t,t=void 0),"function"==typeof i&&(n=i,i=null),"closing"===this.readyState||"closed"===this.readyState)return;(i=i||{}).compress=!1!==i.compress;const s={type:e,data:t,options:i};this.emitReserved("packetCreate",s),this.writeBuffer.push(s),n&&this.once("flush",n),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},i=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(()=>{this.upgrading?i():e()})):this.upgrading?i():e()),this}onError(e){zr.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const t=[];let i=0;const n=e.length;for(;i<n;i++)~this.transports.indexOf(e[i])&&t.push(e[i]);return t}}zr.protocol=4;const qr="function"==typeof ArrayBuffer,$r=Object.prototype.toString,Vr="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===$r.call(Blob),Wr="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===$r.call(File);function Hr(e){return qr&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||Vr&&e instanceof Blob||Wr&&e instanceof File}function Gr(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,i=e.length;t<i;t++)if(Gr(e[t]))return!0;return!1}if(Hr(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return Gr(e.toJSON(),!0);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&Gr(e[t]))return!0;return!1}function Kr(e){const t=[],i=e.data,n=e;return n.data=Jr(i,t),n.attachments=t.length,{packet:n,buffers:t}}function Jr(e,t){if(!e)return e;if(Hr(e)){const i={_placeholder:!0,num:t.length};return t.push(e),i}if(Array.isArray(e)){const i=new Array(e.length);for(let n=0;n<e.length;n++)i[n]=Jr(e[n],t);return i}if("object"==typeof e&&!(e instanceof Date)){const i={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(i[n]=Jr(e[n],t));return i}return e}function Qr(e,t){return e.data=Yr(e.data,t),delete e.attachments,e}function Yr(e,t){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}if(Array.isArray(e))for(let i=0;i<e.length;i++)e[i]=Yr(e[i],t);else if("object"==typeof e)for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(e[i]=Yr(e[i],t));return e}var Xr;!function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"}(Xr||(Xr={}));class Zr extends ts{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const i=t.type===Xr.BINARY_EVENT;i||t.type===Xr.BINARY_ACK?(t.type=i?Xr.EVENT:Xr.ACK,this.reconstructor=new eo(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!Hr(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0;const i={type:Number(e.charAt(0))};if(void 0===Xr[i.type])throw new Error("unknown packet type "+i.type);if(i.type===Xr.BINARY_EVENT||i.type===Xr.BINARY_ACK){const n=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const s=e.substring(n,t);if(s!=Number(s)||"-"!==e.charAt(t))throw new Error("Illegal attachments");i.attachments=Number(s)}if("/"===e.charAt(t+1)){const n=t+1;for(;++t;){if(","===e.charAt(t))break;if(t===e.length)break}i.nsp=e.substring(n,t)}else i.nsp="/";const n=e.charAt(t+1);if(""!==n&&Number(n)==n){const n=t+1;for(;++t;){const i=e.charAt(t);if(null==i||Number(i)!=i){--t;break}if(t===e.length)break}i.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){const n=this.tryParse(e.substr(t));if(!Zr.isPayloadValid(i.type,n))throw new Error("invalid payload");i.data=n}return i}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case Xr.CONNECT:return"object"==typeof t;case Xr.DISCONNECT:return void 0===t;case Xr.CONNECT_ERROR:return"string"==typeof t||"object"==typeof t;case Xr.EVENT:case Xr.BINARY_EVENT:return Array.isArray(t)&&t.length>0;case Xr.ACK:case Xr.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class eo{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=Qr(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var to=Object.freeze({__proto__:null,protocol:5,get PacketType(){return Xr},Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==Xr.EVENT&&e.type!==Xr.ACK||!Gr(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===Xr.EVENT?Xr.BINARY_EVENT:Xr.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==Xr.BINARY_EVENT&&e.type!==Xr.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=Kr(e),i=this.encodeAsString(t.packet),n=t.buffers;return n.unshift(i),n}},Decoder:Zr});function io(e,t,i){return e.on(t,i),function(){e.off(t,i)}}const no=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class so extends ts{constructor(e,t,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[io(e,"open",this.onopen.bind(this)),io(e,"packet",this.onpacket.bind(this)),io(e,"error",this.onerror.bind(this)),io(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){if(no.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const i={type:Xr.EVENT,data:t,options:{}};if(i.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,n=t.pop();this._registerAckCallback(e,n),i.id=e}const n=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!n||!this.connected)||(this.connected?(this.notifyOutgoingListeners(i),this.packet(i)):this.sendBuffer.push(i)),this.flags={},this}_registerAckCallback(e,t){var i;const n=null!==(i=this.flags.timeout)&&void 0!==i?i:this._opts.ackTimeout;if(void 0===n)return void(this.acks[e]=t);const s=this.io.setTimeoutFn((()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,new Error("operation has timed out"))}),n);this.acks[e]=(...e)=>{this.io.clearTimeoutFn(s),t.apply(this,[null,...e])}}emitWithAck(e,...t){const i=void 0!==this.flags.timeout||void 0!==this._opts.ackTimeout;return new Promise(((n,s)=>{t.push(((e,t)=>i?e?s(e):n(t):n(e))),this.emit(e,...t)}))}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const i={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push(((e,...n)=>{if(i!==this._queue[0])return;return null!==e?i.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...n)),i.pending=!1,this._drainQueue()})),this._queue.push(i),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth((e=>{this._sendConnectPacket(e)})):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Xr.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Xr.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Xr.EVENT:case Xr.BINARY_EVENT:this.onevent(e);break;case Xr.ACK:case Xr.BINARY_ACK:this.onack(e);break;case Xr.DISCONNECT:this.ondisconnect();break;case Xr.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const i of t)i.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let i=!1;return function(...n){i||(i=!0,t.packet({type:Xr.ACK,id:e,data:n}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach((e=>this.emitEvent(e))),this.receiveBuffer=[],this.sendBuffer.forEach((e=>{this.notifyOutgoingListeners(e),this.packet(e)})),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach((e=>e())),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Xr.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let i=0;i<t.length;i++)if(e===t[i])return t.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let i=0;i<t.length;i++)if(e===t[i])return t.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const i of t)i.apply(this,e.data)}}}function ao(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}ao.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),i=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-i:e+i}return 0|Math.min(e,this.max)},ao.prototype.reset=function(){this.attempts=0},ao.prototype.setMin=function(e){this.ms=e},ao.prototype.setMax=function(e){this.max=e},ao.prototype.setJitter=function(e){this.jitter=e};class ro extends ts{constructor(e,t){var i;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,rs(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(i=t.randomizationFactor)&&void 0!==i?i:.5),this.backoff=new ao({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const n=t.parser||to;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new zr(this.uri,this.opts);const t=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const n=io(t,"open",(function(){i.onopen(),e&&e()})),s=io(t,"error",(t=>{i.cleanup(),i._readyState="closed",this.emitReserved("error",t),e?e(t):i.maybeReconnectOnOpen()}));if(!1!==this._timeout){const e=this._timeout;0===e&&n();const i=this.setTimeoutFn((()=>{n(),t.close(),t.emit("error",new Error("timeout"))}),e);this.opts.autoUnref&&i.unref(),this.subs.push((function(){clearTimeout(i)}))}return this.subs.push(n),this.subs.push(s),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(io(e,"ping",this.onping.bind(this)),io(e,"data",this.ondata.bind(this)),io(e,"error",this.onerror.bind(this)),io(e,"close",this.onclose.bind(this)),io(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){Mr((()=>{this.emitReserved("packet",e)}),this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let i=this.nsps[e];return i?this._autoConnect&&!i.active&&i.connect():(i=new so(this,e,t),this.nsps[e]=i),i}_destroy(e){const t=Object.keys(this.nsps);for(const e of t){if(this.nsps[e].active)return}this._close()}_packet(e){const t=this.encoder.encode(e);for(let i=0;i<t.length;i++)this.engine.write(t[i],e.options)}cleanup(){this.subs.forEach((e=>e())),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const i=this.setTimeoutFn((()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open((t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()})))}),t);this.opts.autoUnref&&i.unref(),this.subs.push((function(){clearTimeout(i)}))}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const oo={};function co(e,t){"object"==typeof e&&(t=e,e=void 0);const i=function(e,t="",i){let n=e;i=i||"undefined"!=typeof location&&location,null==e&&(e=i.protocol+"//"+i.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?i.protocol+e:i.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==i?i.protocol+"//"+e:"https://"+e),n=Ur(e)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";const s=-1!==n.host.indexOf(":")?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+s+":"+n.port+t,n.href=n.protocol+"://"+s+(i&&i.port===n.port?"":":"+n.port),n}(e,(t=t||{}).path||"/socket.io"),n=i.source,s=i.id,a=i.path,r=oo[s]&&a in oo[s].nsps;let o;return t.forceNew||t["force new connection"]||!1===t.multiplex||r?o=new ro(n,t):(oo[s]||(oo[s]=new ro(n,t)),o=oo[s]),i.query&&!t.query&&(t.query=i.queryKey),o.socket(i.path,t)}Object.assign(co,{Manager:ro,Socket:so,io:co,connect:co});class po{constructor(e,t){t&&!t.transports&&(t.transports=["websocket"]),this._socket=co(e,t),this._socket.io.on("reconnect",(()=>{this._socket.sendBuffer=[]})),this._socket.io.on("reconnect_attempt",(()=>{this._wasConnectedUsingWebsocket?(this._socket.io.opts.transports=["websocket"],"safari"!==Vn.browserDetails.browser&&delete this._wasConnectedUsingWebsocket):this._socket.io.opts.transports=["polling","websocket"]})),this._socket.on("connect",(()=>{"websocket"===this.getTransport()&&(this._wasConnectedUsingWebsocket=!0)}))}connect(){this.isConnected()||this.isConnecting()||this._socket.open()}disconnect(){this._socket.disconnect()}disconnectOnConnect(){this._socket.once("connect",(()=>{this._socket.disconnect()}))}emit(){this._socket.emit.apply(this._socket,arguments)}emitIfConnected(e,t){this.isConnected()&&this.emit(e,t)}getTransport(){return this._socket&&this._socket.io&&this._socket.io.engine&&this._socket.io.engine.transport&&this._socket.io.engine.transport.name}getManager(){return this._socket.io}isConnecting(){return this._socket&&this._socket.connecting}isConnected(){return this._socket&&this._socket.connected}on(e,t){return this._socket.on(e,t),()=>{this._socket.off(e,t)}}once(e,t){this._socket.once(e,t)}off(e,t){this._socket.off(e,t)}}var lo="connection_blocked_by_network",uo="dominant_speaker";const mo=Vn.browserDetails.browser,ho=Vn.browserDetails.version;function fo(e,t){let i=e.match(/a=ssrc-group:FID (\d+) (\d+)\r\n/),n=t.match(/a=ssrc-group:FID (\d+) (\d+)\r\n/);i||(i=e.match(/a=ssrc:(\d+) cname:(.*)\r\n/g)[1].match(/a=ssrc:(\d+)/),n=t.match(/a=ssrc:(\d+) cname:(.*)\r\n/g)[1].match(/a=ssrc:(\d+)/));for(let e=1;e<i.length;e++)t=t.replace(new RegExp(n[e],"g"),i[e]);return t}function go(e){return"firefox"!==mo?e:jn.splitLines(e.trim()).map((e=>e.startsWith("a=msid-semantic:")?"a=msid-semantic: WMS *":e)).join("\r\n")+"\r\n"}const vo=console;function bo(e,t){const i=e.getSenders().find((e=>e.track&&"video"===e.track.kind));if(!i)return Promise.resolve();const n=i.getParameters();return n.encodings&&0===n.encodings.length?Promise.resolve():(n.encodings||(n.encodings=[{}]),0===t?delete n.encodings[0].maxBitrate:n.encodings[0].maxBitrate=1e3*t,i.setParameters(n).catch((e=>{vo.error("setParameters err: ",e)})))}const _o=console;class yo{constructor({peerConnectionId:e,bandwidth:t,maximumTurnBandwidth:i,deprioritizeH264Encoding:n}){this.peerConnectionId=e,this.relayCandidateSeen=!1,this.pc=null,this.wasEverConnected=!1,this.connectionStatus=null,this.stats={totalSent:0,totalRecv:0},this.bandwidth=t||0,this.maximumTurnBandwidth=i,this.pending=[],this.isOperationPending=!1,this.streamIds=[],this.streams=[],this.earlyIceCandidates=[],this.afterConnected=new Promise((e=>{this.registerConnected=e})),this.offerOptions={offerToReceiveAudio:!0,offerToReceiveVideo:!0},this._deprioritizeH264Encoding=n}setAndGetPeerConnection({clientId:e,constraints:t,peerConnectionConfig:i,shouldAddLocalVideo:n}){return this.peerConnectionConfig=i,this.shouldAddLocalVideo=n,this.clientId=e,this.pc=new RTCPeerConnection(i,t),this.signalingState=this.pc.signalingState,this.pc.addEventListener("signalingstatechange",(()=>{if(this.signalingState!==this.pc.signalingState&&(this.signalingState=this.pc.signalingState,"stable"===this.pc.signalingState)){this.isOperationPending=!1;const e=this.pending.shift();e&&e.apply()}})),this.pc}addStream(e){this.streamIds.push(e.id),this.streams.push(e),RTCPeerConnection.prototype.addTrack?(e.getAudioTracks().forEach((t=>{this.pc.addTrack(t,e)})),e.getVideoTracks().forEach((t=>{this.pc.addTrack(t,e)}))):this.pc.addStream(e)}addTrack(e,t){t||(t=this.streams[0]),t.addTrack(e),this.pc.addTrack(e,t)}removeTrack(e){this.streams[0].removeTrack(e);const t=this.pc.getSenders().find((t=>t.track===e));t&&this.pc.removeTrack(t)}removeStream(e){for(let t=0;t<this.streamIds.length;t++)this.streamIds[t]===e.id&&(this.streamIds.splice(t,1),this.streams.splice(t,1));this.pc&&(this.pc.removeTrack?e.getTracks().forEach((e=>{const t=this.pc.getSenders().find((t=>t.track===e));t&&this.pc.removeTrack(t)})):this.pc.removeStream&&this.pc.removeStream(e))}_setRemoteDescription(e){return this._deprioritizeH264Encoding&&(e.sdp=function(e){return jn.splitSections(e).map((e=>{if("video"!==jn.getKind(e))return e;const t=jn.matchPrefix(e,"a=rtpmap:").map((e=>jn.parseRtpMap(e))).filter((e=>/h264/i.test(e.name))).map((e=>""+e.payloadType));if(!t.length)return e;const i=jn.matchPrefix(e,"m=video")[0],n=/(\s\d+)+$/i.exec(i)[0],s=[...n.split(" ").filter((e=>e&&!t.includes(e))),...t].join(" "),a=i.replace(n," "+s);return e.replace(i,a)})).join("")}(e.sdp)),this.srdComplete=this.pc.setRemoteDescription(e),this.srdComplete.then((()=>{this.earlyIceCandidates.forEach((e=>this.pc.addIceCandidate(e))),this.earlyIceCandidates=[]}))}handleOffer(e){if(!this.canModifyPeerConnection())return new Promise((t=>{this.pending.push((()=>this.handleOffer(e).then(t)))}));this.isOperationPending=!0;let t=e.sdp;t=function(e){return"safari"!==mo&&("firefox"!==mo||ho>=63||60===ho)?e:jn.splitLines(e.trim()).filter((e=>!e.startsWith("a=extmap:")||"urn:ietf:params:rtp-hdrext:sdes:mid"!==jn.parseExtmap(e).uri)).join("\r\n")+"\r\n"}(t),t=go(t);const i={type:e.type,sdp:t};let n;return this._setRemoteDescription(i).then((()=>this.pc.createAnswer())).then((e=>(n=e,this.pc.setLocalDescription(e)))).then((()=>bo(this.pc,this.bandwidth))).then((()=>n))}handleAnswer(e){if(this.pendingOffer){const t=this.pendingOffer;return delete this.pendingOffer,this.pc.setLocalDescription(t).then((()=>this.handleAnswer(e)))}let t=e.sdp;t=go(t);const i={type:e.type,sdp:t};return this._setRemoteDescription(i).then((()=>bo(this.pc,this.bandwidth)),(e=>{_o.warn("Could not set remote description from remote answer: ",e)}))}addIceCandidate(e){this.srdComplete?this.srdComplete.then((()=>{"closed"!==this.pc.signalingState&&("safari"===Vn.browserDetails.browser&&e&&""===e.candidate||this.pc.addIceCandidate(e).catch((t=>{_o.warn("Failed to add ICE candidate ('%s'): %s",e?e.candidate:null,t)})))})):this.earlyIceCandidates.push(e)}canModifyPeerConnection(){return"stable"===this.pc.signalingState&&!this.isOperationPending}close(){const e=this.pc;if(e){e.oniceconnectionstatechange=null,e.onicecandidate=null,e.ontrack=null;try{e.close()}catch(e){console.warn("failures during close of session",e)}}}hasConnectedPeerConnection(){return this.pc&&"connected"===this.pc.connectionState}replaceTrack(e,t){const i=this.pc;if(!i)return!1;const n=i.getSenders();function s(i){const s=e=>e&&`id:${e.id},kind:${e.kind},state:${e.readyState}`;_o.warn(`${i}. newTrack:${s(t)}, oldTrack:${s(e)}, sender tracks: ${JSON.stringify(n.map((e=>`s ${s(e.track)}`)))}, sender first codecs: ${JSON.stringify(n.map((e=>(e.getParameters().codecs||[])[0])))}`)}if(n.length||s("No senders!"),e||(e=(n.find((e=>e.track&&e.track.kind===t.kind))||{}).track)||s("No sender with same kind! Add new track then."),window.RTCRtpSender&&window.RTCRtpSender.prototype.replaceTrack){if(e){const i=()=>{for(let i=0;i<n.length;i++){const a=n[i],r=a.track;if(a||r||s("One of the tracks is null!"),r.id===t.id)return Promise.resolve(t);if(r.id===e.id)return n[i].replaceTrack(t)}return null};let a=i();if(a)return a;let r=null,o=null;a=new Promise(((e,t)=>{r=e,o=t}));let c=0,p=setInterval((async()=>{const e=i();if(!e)return void(3<++c&&(clearInterval(p),p=null,s("No sender track to replace"),o("No sender track to replace")));clearInterval(p),p=null;const t=await e;r(t)}),1e3);return a}const a=this.streams.find((e=>e.getTracks().find((e=>e.id===t.id))))||this.streams[0];return a?i.addTrack(t,a):(s("No stream?"),Promise.reject(new Error("replaceTrack: No stream?")))}if(!this.canModifyPeerConnection())return void this.pending.push((()=>{this.replaceTrack(e,t)}));this.isOperationPending=!0;const a=i.onnegotiationneeded;return i.onnegotiationneeded=null,this.removeTrack(e),this.addTrack(t),setTimeout((()=>{i.onnegotiationneeded=a}),0),"offer"===i.localDescription.type?i.createOffer().then((e=>(e.sdp=fo(i.localDescription.sdp,e.sdp),i.setLocalDescription(e)))).then((()=>this._setRemoteDescription(i.remoteDescription))):this._setRemoteDescription(i.remoteDescription).then((()=>i.createAnswer())).then((e=>(e.sdp=fo(i.localDescription.sdp,e.sdp),i.setLocalDescription(e))))}maybeRestrictRelayBandwidth(){var e;this.pc.getStats&&(e=this.pc,e.getStats(null).then((e=>{let t,i;return e.forEach((n=>{if("transport"===n.type&&n.selectedCandidatePairId){const s=e.get(n.selectedCandidatePairId);if(!s)return;return t=e.get(s.localCandidateId).candidateType,void(i=e.get(s.remoteCandidateId).candidateType)}"candidate-pair"===n.type&&n.selected&&(t=e.get(n.localCandidateId).candidateType,i=e.get(n.remoteCandidateId).candidateType)})),"relay"===t||"relayed"===t||"relay"===i||"relayed"===i}))).then((e=>{e&&0===this.bandwidth&&this.changeBandwidth(this.maximumTurnBandwidth)}))}changeBandwidth(e){e!==this.bandwidth&&(this.canModifyPeerConnection()?(this.bandwidth=e,this.pc.localDescription&&""!==this.pc.localDescription.type&&bo(this.pc,this.bandwidth)):this.pending.push((()=>this.changeBandwidth(e))))}}process.env.AWF_BASE_URL,process.env.AWF_API_BASE_URL,process.env.AP_ROOM_BASE_URL;const xo=console,wo=Vn.browserDetails.browser,So=Vn.browserDetails.version;const Ro=console,Co=Vn.browserDetails.browser;class ko extends class{constructor({selfId:e,room:t,emitter:i,serverSocket:n,webrtcProvider:s,features:a}){u.ok(e,"selfId is required"),u.ok(t,"room is required"),u.ok(i&&i.emit,"emitter is required"),u.ok(n instanceof po,"serverSocket is required"),u.ok(s,"webrtcProvider is required");const{name:r,session:o,iceServers:c,sfuServer:p,mediaserverConfigTtlSeconds:d}=t;this._selfId=e,this._roomName=r,this._roomSessionId=o&&o.id,this.peerConnections={},this.localStreams={},this.enabledLocalStreamIds=[],this._socketListenerDeregisterFunctions=[],this._emitter=i,this._serverSocket=n,this._webrtcProvider=s,this._features=a||{},this.offerOptions={offerToReceiveAudio:!0,offerToReceiveVideo:!0},this._pendingActionsForConnectedPeerConnections=[],this._updateAndScheduleMediaServersRefresh({sfuServer:p,iceServers:c.iceServers||[],mediaserverConfigTtlSeconds:d})}numberOfPeerconnections(){return Object.keys(this.peerConnections).length}numberOfRemotePeers(){return Object.values(this.peerConnections).filter((e=>e.clientId!==this._selfId)).length}_setConnectionStatus(e,t,i){const n=e.connectionStatus;n!==t&&e.peerConnectionId!==this._selfId&&(n===Pi&&t===Ci||(e.connectionStatus=t,setTimeout((()=>{this._emit(_i,{streamIds:e.streamIds,clientId:i,status:t,previous:n})}),0)))}_emitServerEvent(e,t,i){this._serverSocket.emit(e,t,i)}_emit(e,t){this._emitter.emit(e,t)}isInitializedWith({selfId:e,roomName:t,isSfu:i}){return this._selfId===e&&this._roomName===t&&i===!!this._sfuServer}supportsScreenShareAudio(){return!0}_addEnabledLocalStreamId(e){this.enabledLocalStreamIds.push(e)}_deleteEnabledLocalStreamId(e){const t=this.enabledLocalStreamIds.indexOf(e);-1!==t&&this.enabledLocalStreamIds.splice(t,1)}_getSession(e){return e in this.peerConnections?this.peerConnections[e]:null}_getOrCreateSession(e,t){let i=this.peerConnections[e];if(void 0===i){const n="safari"===wo&&So>=14&&this._features.deprioritizeH264OnSafari;this.peerConnections[e]=i=new yo({peerConnectionId:e,bandwidth:t,maximumTurnBandwidth:this._features.restrictBandwidthWhenUsingRelay?512:768,deprioritizeH264Encoding:n})}return i}_getLocalCameraStream(){return this.localStreams[0]}_getNonLocalCameraStreamIds(){return Object.keys(this.localStreams).filter((e=>"0"!==e))}_isScreensharingLocally(){return this._getNonLocalCameraStreamIds().length>0}_getFirstLocalNonCameraStream(){const e=this._getNonLocalCameraStreamIds();return 0===e.length?null:this.localStreams[e[0]]}_transformIncomingSdp(e){return{type:e.type,sdp:e.sdpU}}_transformOutgoingSdp(e){return{type:e.type,sdpU:e.sdp}}_createSession({clientId:e,initialBandwidth:t,isOfferer:i,peerConnectionId:n,shouldAddLocalVideo:s}){if(!n)throw new Error("peerConnectionId is missing");if(!e)throw new Error("clientId is missing");const a=this._getOrCreateSession(n,t),r={optional:[]};"chrome"===wo&&r.optional.push({googCpuOveruseDetection:!0});const o={iceServers:this._iceServers};if(this._features.turnServerOverrideHost){const e=this._features.turnServerOverrideHost,t=e.indexOf(":")>0?"":":443",i=":"+e+t;o.iceServers=o.iceServers.map((e=>{const t=Object.assign({},e);return t.url&&(t.url=t.url.replace(/:[^?]*/,i)),t.urls&&(t.urls=t.urls.map((e=>e.replace(/:[^?]*/,i)))),t}))}if(this._features.useOnlyTURN){o.iceTransportPolicy="relay";const e={onlyudp:/^turn:.*transport=udp$/,onlytcp:/^turn:.*transport=tcp$/,onlytls:/^turns:.*transport=tcp$/}[this._features.useOnlyTURN];e&&(o.iceServers=o.iceServers.filter((t=>t.url&&t.url.match(e))))}"chrome"===wo&&(o.sdpSemantics="unified-plan");const c=a.setAndGetPeerConnection({constraints:r,peerConnectionConfig:o,shouldAddLocalVideo:s,clientId:e});c.ontrack=t=>{const i=t.streams[0];"default"===i.id&&0===i.getAudioTracks().length||-1===a.streamIds.indexOf(i.id)&&(a.streamIds.push(i.id),this._emit(yi,{clientId:e,stream:i}),a.connectionStatus===Ti&&setTimeout((()=>{this._emit(_i,{streamIds:a.streamIds,clientId:e,status:a.connectionStatus,previous:Ci})}),0))},c.oniceconnectionstatechange=()=>{let t;const i=a.connectionStatus;switch(c.iceConnectionState){case"checking":t=Ci;break;case"connected":case"completed":t=Ti,a.wasEverConnected||(this._pendingActionsForConnectedPeerConnections.forEach((e=>{"function"==typeof e&&e()})),this._pendingActionsForConnectedPeerConnections=[]),!a.wasEverConnected&&(c.iceConnectionState.match(/connected|completed/)||"chrome"===wo&&c.localDescription&&"answer"===c.localDescription.type)&&(a.wasEverConnected=!0,"false"!==this._features.bandwidth&&this.maybeRestrictRelayBandwidth(a)),a.registerConnected();break;case"disconnected":t=Pi,setTimeout((()=>{"disconnected"===c.iceConnectionState&&this._maybeRestartIce(e,a)}),2e3);break;case"failed":t=ki,i!==t&&this._maybeRestartIce(e,a),null!==a.relayCandidateSeen||a.wasEverConnected||this._emit(lo);break;default:return}this._setConnectionStatus(a,t,e)},c.onconnectionstate=()=>{switch(c.connectionState){case"connected":a.registerConnected();break;case"failed":const t=ki;null!==a.relayCandidateSeen||a.wasEverConnected||this._emit(lo),this._setConnectionStatus(a,t,e)}};const p=this.localStreams[0];return s&&p&&a.addStream(p),s&&Object.keys(this.localStreams).forEach((e=>{if("0"===e)return;const t=this.localStreams[e];i?a.addStream(t):a.afterConnected.then((()=>{this._emitServerEvent(Oi,{receiverId:a.clientId,streamId:t.id,hasAudioTrack:!!t.getAudioTracks().length}),this._withForcedRenegotiation(a,(()=>a.addStream(t)))}))})),a}_cleanup(e){const t=this._getSession(e);t?(t.close(),delete this.peerConnections[e]):xo.warn("No RTCPeerConnection in RTCManager.disconnect()",e)}_forEachPeerConnection(e){Object.keys(this.peerConnections).forEach((t=>{const i=this.peerConnections[t];e(i)}))}_addStreamToPeerConnections(e){this._forEachPeerConnection((t=>{this._withForcedRenegotiation(t,(()=>t.addStream(e)))}))}_addTrackToPeerConnections(e,t){this._forEachPeerConnection((i=>{this._withForcedRenegotiation(i,(()=>i.addTrack(e,t)))}))}_replaceTrackToPeerConnections(e,t){const i=[];return this._forEachPeerConnection((n=>{if(!n.hasConnectedPeerConnection()){xo.log("Session doesn't have a connected PeerConnection, adding pending action!");const s=this._pendingActionsForConnectedPeerConnections;if(!s)return void xo.warn("No pending action is created to repalce track, because the pending actions array is null");const a=new Promise(((i,a)=>{s.push((()=>{const s=n.replaceTrack(e,t);if(!s)return xo.error("replaceTrack returned false!"),void a("ReplaceTrack returned false");s.then((e=>i(e))).catch((e=>a(e)))}))}));return void i.push(a)}const s=n.replaceTrack(e,t);s?i.push(s):xo.error("replaceTrack returned false!")})),Promise.all(i)}_removeStreamFromPeerConnections(e){this._forEachPeerConnection((t=>{this._withForcedRenegotiation(t,(()=>t.removeStream(e)))}))}_removeTrackFromPeerConnections(e){this._forEachPeerConnection((t=>{this._withForcedRenegotiation(t,(()=>t.removeTrack(e)))}))}_addLocalStream(e,t){this._addEnabledLocalStreamId(e),this.localStreams[e]=t}_removeLocalStream(e){delete this.localStreams[e],this._deleteEnabledLocalStreamId(e)}maybeRestrictRelayBandwidth(e){e.maybeRestrictRelayBandwidth()}addNewStream(e,t){t!==this.localStreams[e]&&(this._addLocalStream(e,t),"0"!==e?this._shareScreen(e,t):this._addStreamToPeerConnections(t))}removeStream(e,t){this._removeLocalStream(e,t)}replaceTrack(e,t){return this._replaceTrackToPeerConnections(e,t)}accept({clientId:e,shouldAddLocalVideo:t}){return this.acceptNewStream({streamId:e,clientId:e,shouldAddLocalVideo:t})}disconnectAll(){Object.keys(this.peerConnections).forEach((e=>{this.disconnect(e)})),this.peerConnections={},this._socketListenerDeregisterFunctions.forEach((e=>{e()})),this._socketListenerDeregisterFunctions=[]}stopOrResumeAudio(){}stopOrResumeVideo(){}fixChromeAudio(e){if("chrome"!==wo)return;const t=this._getLocalCameraStream(),i=t.getAudioTracks()[0];return i&&"ended"===i.readyState?navigator.mediaDevices.getUserMedia({audio:e}).then((e=>{const n=e.getAudioTracks()[0];return n.enabled=i.enabled,t.removeTrack(i),t.addTrack(n),this.replaceTrack(i,n)})):void 0}_updateAndScheduleMediaServersRefresh({iceServers:e,sfuServer:t,mediaserverConfigTtlSeconds:i}){this._iceServers=e,this._sfuServer=t,this._mediaserverConfigTtlSeconds=i,this._clearMediaServersRefresh(),i&&(this._fetchMediaServersTimer=setTimeout((()=>this._emitServerEvent(Ei)),1e3*i))}_clearMediaServersRefresh(){this._fetchMediaServersTimer&&(clearTimeout(this._fetchMediaServersTimer),this._fetchMediaServersTimer=null)}setupSocketListeners(){this._socketListenerDeregisterFunctions=[()=>this._clearMediaServersRefresh(),this._serverSocket.on(Ii,(e=>{e.error?xo.warn("FETCH_MEDIASERVER_CONFIG failed:",e.error):this._updateAndScheduleMediaServersRefresh(e)})),this._serverSocket.on(Ai,(e=>{this._connect(e.clientId)})),this._serverSocket.on(Li,(e=>{const t=this._getSession(e.clientId);t?t.addIceCandidate(e.message):xo.warn("No RTCPeerConnection on ICE_CANDIDATE",e)})),this._serverSocket.on(Mi,(e=>{const t=this._getSession(e.clientId);t?t.addIceCandidate(null):xo.warn("No RTCPeerConnection on ICE_END_OF_CANDIDATES",e)})),this._serverSocket.on(Bi,(e=>{const t=this._getSession(e.clientId);if(!t)return void xo.warn("No RTCPeerConnection on SDP_OFFER",e);const i=this._transformIncomingSdp(e.message,t.pc);t.handleOffer(i).then((t=>{this._emitServerEvent(Ni,{receiverId:e.clientId,message:this._transformOutgoingSdp(t)})}))})),this._serverSocket.on(Ni,(e=>{const t=this._getSession(e.clientId);if(!t)return void xo.warn("No RTCPeerConnection on SDP_ANSWER",e);const i=this._transformIncomingSdp(e.message,t.pc);t.handleAnswer(i)}))]}setRoomSessionId(e){this._roomSessionId=e}}{_connect(e){let t=this._getSession(e),i=t&&t.bandwidth||0;return t?(Ro.warn("Replacing peer session",e),this._cleanup(e)):i=this._changeBandwidthForAllClients(!0),t=this._createP2pSession(e,i,!0,!0),this._negotiatePeerConnection(e,t),Promise.resolve(t)}_maybeRestartIce(e,t){const i=t.pc;"disconnected"!==i.iceConnectionState&&"failed"!==i.iceConnectionState||"offer"===i.localDescription.type&&(t.wasEverConnected=!1,t.relayCandidateSeen=!1,this._negotiatePeerConnection(e,t,Object.assign({},this.offerOptions,{iceRestart:!0})))}_negotiatePeerConnection(e,t,i){if(!t)return void Ro.warn("No RTCPeerConnection in negotiatePeerConnection()",e);const n=t.pc;t.canModifyPeerConnection()?(t.isOperationPending=!0,n.createOffer(i||this.offerOptions).then((i=>{this._emitServerEvent(Bi,{receiverId:e,message:this._transformOutgoingSdp(i)}),"chrome"===Co&&n.getSenders().filter((e=>e.track&&"video"===e.track.kind)).length>=2?t.pendingOffer=i:n.setLocalDescription(i).catch((e=>{Ro.warn("RTCPeerConnection.setLocalDescription() failed with local offer",e)}))})).catch((e=>{Ro.warn("RTCPeerConnection.createOffer() failed to create local offer",e)}))):t.pending.push((()=>{this._negotiatePeerConnection(e,t,i)}))}_withForcedRenegotiation(e,t){const i=e.pc,n=i.onnegotationneeded;i.onnegotiationneeded=null,t(),this._negotiatePeerConnection(e.clientId,e),setTimeout((()=>i.onnegotiationneeded=n),0)}_changeBandwidthForAllClients(e){let t=this.numberOfPeerconnections();if(e&&(t+=1),0===t)return 0;t>7&&(t=7);const i=this._features.bandwidth?parseInt(this._features.bandwidth,10):{1:0,2:this._features.highP2PBandwidth?768:384,3:this._features.highP2PBandwidth?512:256,4:192,5:128,6:128,7:64}[t];return void 0===i?0:(this._forEachPeerConnection((e=>{e.changeBandwidth(i)})),i)}_createP2pSession(e,t,i,n){const s=this._createSession({peerConnectionId:e,clientId:e,initialBandwidth:t,shouldAddLocalVideo:i,isOfferer:n}),a=s.pc,r=this.localStreams[0];return i&&r&&!r.getVideoTracks().length&&this._stoppedVideoTrack&&a.addTrack(this._stoppedVideoTrack,r),a.onicecandidate=t=>{t.candidate?(s.relayCandidateSeen=s.relayCandidateSeen||"relay"===t.candidate.type,this._emitServerEvent(Li,{receiverId:e,message:t.candidate})):this._emitServerEvent(Mi,{receiverId:e})},a.onnegotiationneeded=()=>{"new"!==a.iceConnectionState&&s.connectionStatus&&this._negotiatePeerConnection(e,s)},s}acceptNewStream({streamId:e,clientId:t,shouldAddLocalVideo:i}){let n=this._getSession(t);if(n&&e!==t)return n;let s=n&&n.bandwidth||0;return n?(Ro.warn("Replacing peer session",t),this._cleanup(t)):s=this._changeBandwidthForAllClients(!0),n=this._createP2pSession(t,s,i),this._emitServerEvent(Ai,{receiverId:t}),n}disconnect(e){this._cleanup(e),this._changeBandwidthForAllClients(!1);0===this.numberOfPeerconnections()&&setTimeout((()=>{this.numberOfPeerconnections()}),6e4)}updateStreamResolution(){}stopOrResumeAudio(){}stopOrResumeVideo(e,t){if("chrome"===Co)if(!1===t)setTimeout((()=>{e.getVideoTracks().forEach((t=>{!1===t.enabled&&(t.stop(),e.removeTrack(t),this._emit(Ri,{stream:e,track:t}),this._stoppedVideoTrack=t)}))}),5e3);else if(this._features.simplifiedVegaClientOn){const t=e.getVideoTracks()?.[0];this._stoppedVideoTrack?(this._replaceTrackToPeerConnections(this._stoppedVideoTrack,t),delete this._stoppedVideoTrack,this._emit(Si,{streamId:e.id,tracks:[t],screenShare:!1})):t||this._addTrackToPeerConnections(t)}else if(0===e.getVideoTracks().length){const t=this._webrtcProvider.getMediaConstraints().video;if(!t)return;navigator.mediaDevices.getUserMedia({video:t}).then((t=>{const i=t.getVideoTracks()[0];e.addTrack(i),this._emit(Si,{streamId:e.id,tracks:[i],screenShare:!1}),this._stoppedVideoTrack?(this._replaceTrackToPeerConnections(this._stoppedVideoTrack,i),delete this._stoppedVideoTrack):this._addTrackToPeerConnections(i)}))}}_shareScreen(e,t){this._emitServerEvent(Oi,{streamId:e,hasAudioTrack:!!t.getAudioTracks().length}),this._addStreamToPeerConnections(t)}removeStream(e,t,i){super.removeStream(e,t),this._removeStreamFromPeerConnections(t),this._emitServerEvent(Di,{streamId:e,requestedByClientId:i})}}var To,Po,Eo,Oo,Do,Io={},jo={},Lo={},Mo={get exports(){return Lo},set exports(e){Lo=e}};function Ao(){if(Po)return To;Po=1;var e=1e3,t=60*e,i=60*t,n=24*i,s=7*n,a=365.25*n;function r(e,t,i,n){var s=t>=1.5*i;return Math.round(e/i)+" "+n+(s?"s":"")}return To=function(o,c){c=c||{};var p=typeof o;if("string"===p&&o.length>0)return function(r){if((r=String(r)).length>100)return;var o=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(!o)return;var c=parseFloat(o[1]);switch((o[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*a;case"weeks":case"week":case"w":return c*s;case"days":case"day":case"d":return c*n;case"hours":case"hour":case"hrs":case"hr":case"h":return c*i;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(o);if("number"===p&&isFinite(o))return c.long?function(s){var a=Math.abs(s);if(a>=n)return r(s,a,n,"day");if(a>=i)return r(s,a,i,"hour");if(a>=t)return r(s,a,t,"minute");if(a>=e)return r(s,a,e,"second");return s+" ms"}(o):function(s){var a=Math.abs(s);if(a>=n)return Math.round(s/n)+"d";if(a>=i)return Math.round(s/i)+"h";if(a>=t)return Math.round(s/t)+"m";if(a>=e)return Math.round(s/e)+"s";return s+"ms"}(o);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(o))}}function No(){if(Oo)return Eo;return Oo=1,Eo=function(e){function t(e){let n,s,a,r=null;function o(...e){if(!o.enabled)return;const i=o,s=Number(new Date),a=s-(n||s);i.diff=a,i.prev=n,i.curr=s,n=s,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let r=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,s)=>{if("%%"===n)return"%";r++;const a=t.formatters[s];if("function"==typeof a){const t=e[r];n=a.call(i,t),e.splice(r,1),r--}return n})),t.formatArgs.call(i,e);(i.log||t.log).apply(i,e)}return o.namespace=e,o.useColors=t.useColors(),o.color=t.selectColor(e),o.extend=i,o.destroy=t.destroy,Object.defineProperty(o,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==r?r:(s!==t.namespaces&&(s=t.namespaces,a=t.enabled(e)),a),set:e=>{r=e}}),"function"==typeof t.init&&t.init(o),o}function i(e,i){const n=t(this.namespace+(void 0===i?":":i)+e);return n.log=this.log,n}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let i;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),s=n.length;for(i=0;i<s;i++)n[i]&&("-"===(e=n[i].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let i,n;for(i=0,n=t.skips.length;i<n;i++)if(t.skips[i].test(e))return!1;for(i=0,n=t.names.length;i<n;i++)if(t.names[i].test(e))return!0;return!1},t.humanize=Ao(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((i=>{t[i]=e[i]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let i=0;for(let t=0;t<e.length;t++)i=(i<<5)-i+e.charCodeAt(t),i|=0;return t.colors[Math.abs(i)%t.colors.length]},t.enable(t.load()),t},Eo}var Bo,Fo,Uo,zo,qo,$o={},Vo={get exports(){return $o},set exports(e){$o=e}};function Wo(){return Fo?Bo:(Fo=1,Bo=(e,t=process.argv)=>{const i=e.startsWith("-")?"":1===e.length?"-":"--",n=t.indexOf(i+e),s=t.indexOf("--");return-1!==n&&(-1===s||n<s)})}function Ho(){return qo||(qo=1,function(e,t){const i=m,n=h;t.init=function(e){e.inspectOpts={};const i=Object.keys(t.inspectOpts);for(let n=0;n<i.length;n++)e.inspectOpts[i[n]]=t.inspectOpts[i[n]]},t.log=function(...e){return process.stderr.write(n.format(...e)+"\n")},t.formatArgs=function(i){const{namespace:n,useColors:s}=this;if(s){const t=this.color,s="[3"+(t<8?t:"8;5;"+t),a=` ${s};1m${n} `;i[0]=a+i[0].split("\n").join("\n"+a),i.push(s+"m+"+e.exports.humanize(this.diff)+"")}else i[0]=function(){if(t.inspectOpts.hideDate)return"";return(new Date).toISOString()+" "}()+n+" "+i[0]},t.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},t.load=function(){return process.env.DEBUG},t.useColors=function(){return"colors"in t.inspectOpts?Boolean(t.inspectOpts.colors):i.isatty(process.stderr.fd)},t.destroy=n.deprecate((()=>{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=function(){if(zo)return Uo;zo=1;const e=f,t=m,i=Wo(),{env:n}=process;let s;function a(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function r(t,a){if(0===s)return 0;if(i("color=16m")||i("color=full")||i("color=truecolor"))return 3;if(i("color=256"))return 2;if(t&&!a&&void 0===s)return 0;const r=s||0;if("dumb"===n.TERM)return r;if("win32"===process.platform){const t=e.release().split(".");return Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in n)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((e=>e in n))||"codeship"===n.CI_NAME?1:r;if("TEAMCITY_VERSION"in n)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(n.TEAMCITY_VERSION)?1:0;if("truecolor"===n.COLORTERM)return 3;if("TERM_PROGRAM"in n){const e=parseInt((n.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(n.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(n.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(n.TERM)||"COLORTERM"in n?1:r}return i("no-color")||i("no-colors")||i("color=false")||i("color=never")?s=0:(i("color")||i("colors")||i("color=true")||i("color=always"))&&(s=1),"FORCE_COLOR"in n&&(s="true"===n.FORCE_COLOR?1:"false"===n.FORCE_COLOR?0:0===n.FORCE_COLOR.length?1:Math.min(parseInt(n.FORCE_COLOR,10),3)),Uo={supportsColor:function(e){return a(r(e,e&&e.isTTY))},stdout:a(r(!0,t.isatty(1))),stderr:a(r(!0,t.isatty(2)))},Uo}();e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const i=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let n=process.env[t];return n=!!/^(yes|on|true|enabled)$/i.test(n)||!/^(no|off|false|disabled)$/i.test(n)&&("null"===n?null:Number(n)),e[i]=n,e}),{}),e.exports=No()(t);const{formatters:s}=e.exports;s.o=function(e){return this.inspectOpts.colors=this.useColors,n.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},s.O=function(e){return this.inspectOpts.colors=this.useColors,n.inspect(e,this.inspectOpts)}}(Vo,$o)),$o}!function(e){"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?e.exports=(Do||(Do=1,function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const i="color: "+this.color;t.splice(1,0,i,"color: inherit");let n=0,s=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(s=n))})),t.splice(s,0,i)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=No()(t);const{formatters:i}=e.exports;i.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(Mo,Lo)),Lo):e.exports=Ho()}({get exports(){return jo},set exports(e){jo=e}});var Go={};const Ko={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},Jo={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},Qo={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},Yo={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},Xo={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class Zo{static getFirstMatch(e,t){const i=t.match(e);return i&&i.length>0&&i[1]||""}static getSecondMatch(e,t){const i=t.match(e);return i&&i.length>1&&i[2]||""}static matchAndReturnConst(e,t,i){if(e.test(t))return i}static getWindowsVersionName(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}static getMacOSVersionName(e){const t=e.split(".").splice(0,2).map((e=>parseInt(e,10)||0));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}}static getAndroidVersionName(e){const t=e.split(".").splice(0,2).map((e=>parseInt(e,10)||0));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0}static getVersionPrecision(e){return e.split(".").length}static compareVersions(e,t,i=!1){const n=Zo.getVersionPrecision(e),s=Zo.getVersionPrecision(t);let a=Math.max(n,s),r=0;const o=Zo.map([e,t],(e=>{const t=a-Zo.getVersionPrecision(e),i=e+new Array(t+1).join(".0");return Zo.map(i.split("."),(e=>new Array(20-e.length).join("0")+e)).reverse()}));for(i&&(r=a-Math.min(n,s)),a-=1;a>=r;){if(o[0][a]>o[1][a])return 1;if(o[0][a]===o[1][a]){if(a===r)return 0;a-=1}else if(o[0][a]<o[1][a])return-1}}static map(e,t){const i=[];let n;if(Array.prototype.map)return Array.prototype.map.call(e,t);for(n=0;n<e.length;n+=1)i.push(t(e[n]));return i}static find(e,t){let i,n;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(i=0,n=e.length;i<n;i+=1){const n=e[i];if(t(n,i))return n}}static assign(e,...t){const i=e;let n,s;if(Object.assign)return Object.assign(e,...t);for(n=0,s=t.length;n<s;n+=1){const e=t[n];if("object"==typeof e&&null!==e){Object.keys(e).forEach((t=>{i[t]=e[t]}))}}return e}static getBrowserAlias(e){return Ko[e]}static getBrowserTypeByAlias(e){return Jo[e]||""}}const ec=/version\/(\d+(\.?_?\d+)+)/i,tc=[{test:[/googlebot/i],describe(e){const t={name:"Googlebot"},i=Zo.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||Zo.getFirstMatch(ec,e);return i&&(t.version=i),t}},{test:[/opera/i],describe(e){const t={name:"Opera"},i=Zo.getFirstMatch(ec,e)||Zo.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/opr\/|opios/i],describe(e){const t={name:"Opera"},i=Zo.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||Zo.getFirstMatch(ec,e);return i&&(t.version=i),t}},{test:[/SamsungBrowser/i],describe(e){const t={name:"Samsung Internet for Android"},i=Zo.getFirstMatch(ec,e)||Zo.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/Whale/i],describe(e){const t={name:"NAVER Whale Browser"},i=Zo.getFirstMatch(ec,e)||Zo.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/MZBrowser/i],describe(e){const t={name:"MZ Browser"},i=Zo.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||Zo.getFirstMatch(ec,e);return i&&(t.version=i),t}},{test:[/focus/i],describe(e){const t={name:"Focus"},i=Zo.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||Zo.getFirstMatch(ec,e);return i&&(t.version=i),t}},{test:[/swing/i],describe(e){const t={name:"Swing"},i=Zo.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||Zo.getFirstMatch(ec,e);return i&&(t.version=i),t}},{test:[/coast/i],describe(e){const t={name:"Opera Coast"},i=Zo.getFirstMatch(ec,e)||Zo.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(e){const t={name:"Opera Touch"},i=Zo.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||Zo.getFirstMatch(ec,e);return i&&(t.version=i),t}},{test:[/yabrowser/i],describe(e){const t={name:"Yandex Browser"},i=Zo.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||Zo.getFirstMatch(ec,e);return i&&(t.version=i),t}},{test:[/ucbrowser/i],describe(e){const t={name:"UC Browser"},i=Zo.getFirstMatch(ec,e)||Zo.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/Maxthon|mxios/i],describe(e){const t={name:"Maxthon"},i=Zo.getFirstMatch(ec,e)||Zo.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/epiphany/i],describe(e){const t={name:"Epiphany"},i=Zo.getFirstMatch(ec,e)||Zo.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/puffin/i],describe(e){const t={name:"Puffin"},i=Zo.getFirstMatch(ec,e)||Zo.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/sleipnir/i],describe(e){const t={name:"Sleipnir"},i=Zo.getFirstMatch(ec,e)||Zo.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/k-meleon/i],describe(e){const t={name:"K-Meleon"},i=Zo.getFirstMatch(ec,e)||Zo.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/micromessenger/i],describe(e){const t={name:"WeChat"},i=Zo.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||Zo.getFirstMatch(ec,e);return i&&(t.version=i),t}},{test:[/qqbrowser/i],describe(e){const t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},i=Zo.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||Zo.getFirstMatch(ec,e);return i&&(t.version=i),t}},{test:[/msie|trident/i],describe(e){const t={name:"Internet Explorer"},i=Zo.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/\sedg\//i],describe(e){const t={name:"Microsoft Edge"},i=Zo.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/edg([ea]|ios)/i],describe(e){const t={name:"Microsoft Edge"},i=Zo.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/vivaldi/i],describe(e){const t={name:"Vivaldi"},i=Zo.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/seamonkey/i],describe(e){const t={name:"SeaMonkey"},i=Zo.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/sailfish/i],describe(e){const t={name:"Sailfish"},i=Zo.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return i&&(t.version=i),t}},{test:[/silk/i],describe(e){const t={name:"Amazon Silk"},i=Zo.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/phantom/i],describe(e){const t={name:"PhantomJS"},i=Zo.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/slimerjs/i],describe(e){const t={name:"SlimerJS"},i=Zo.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(e){const t={name:"BlackBerry"},i=Zo.getFirstMatch(ec,e)||Zo.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/(web|hpw)[o0]s/i],describe(e){const t={name:"WebOS Browser"},i=Zo.getFirstMatch(ec,e)||Zo.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/bada/i],describe(e){const t={name:"Bada"},i=Zo.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/tizen/i],describe(e){const t={name:"Tizen"},i=Zo.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||Zo.getFirstMatch(ec,e);return i&&(t.version=i),t}},{test:[/qupzilla/i],describe(e){const t={name:"QupZilla"},i=Zo.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||Zo.getFirstMatch(ec,e);return i&&(t.version=i),t}},{test:[/firefox|iceweasel|fxios/i],describe(e){const t={name:"Firefox"},i=Zo.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/electron/i],describe(e){const t={name:"Electron"},i=Zo.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/MiuiBrowser/i],describe(e){const t={name:"Miui"},i=Zo.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/chromium/i],describe(e){const t={name:"Chromium"},i=Zo.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||Zo.getFirstMatch(ec,e);return i&&(t.version=i),t}},{test:[/chrome|crios|crmo/i],describe(e){const t={name:"Chrome"},i=Zo.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/GSA/i],describe(e){const t={name:"Google Search"},i=Zo.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test(e){const t=!e.test(/like android/i),i=e.test(/android/i);return t&&i},describe(e){const t={name:"Android Browser"},i=Zo.getFirstMatch(ec,e);return i&&(t.version=i),t}},{test:[/playstation 4/i],describe(e){const t={name:"PlayStation 4"},i=Zo.getFirstMatch(ec,e);return i&&(t.version=i),t}},{test:[/safari|applewebkit/i],describe(e){const t={name:"Safari"},i=Zo.getFirstMatch(ec,e);return i&&(t.version=i),t}},{test:[/.*/i],describe(e){const t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:Zo.getFirstMatch(t,e),version:Zo.getSecondMatch(t,e)}}}];var ic=[{test:[/Roku\/DVP/],describe(e){const t=Zo.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:Yo.Roku,version:t}}},{test:[/windows phone/i],describe(e){const t=Zo.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:Yo.WindowsPhone,version:t}}},{test:[/windows /i],describe(e){const t=Zo.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),i=Zo.getWindowsVersionName(t);return{name:Yo.Windows,version:t,versionName:i}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(e){const t={name:Yo.iOS},i=Zo.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return i&&(t.version=i),t}},{test:[/macintosh/i],describe(e){const t=Zo.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),i=Zo.getMacOSVersionName(t),n={name:Yo.MacOS,version:t};return i&&(n.versionName=i),n}},{test:[/(ipod|iphone|ipad)/i],describe(e){const t=Zo.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:Yo.iOS,version:t}}},{test(e){const t=!e.test(/like android/i),i=e.test(/android/i);return t&&i},describe(e){const t=Zo.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),i=Zo.getAndroidVersionName(t),n={name:Yo.Android,version:t};return i&&(n.versionName=i),n}},{test:[/(web|hpw)[o0]s/i],describe(e){const t=Zo.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),i={name:Yo.WebOS};return t&&t.length&&(i.version=t),i}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(e){const t=Zo.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||Zo.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||Zo.getFirstMatch(/\bbb(\d+)/i,e);return{name:Yo.BlackBerry,version:t}}},{test:[/bada/i],describe(e){const t=Zo.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:Yo.Bada,version:t}}},{test:[/tizen/i],describe(e){const t=Zo.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:Yo.Tizen,version:t}}},{test:[/linux/i],describe:()=>({name:Yo.Linux})},{test:[/CrOS/],describe:()=>({name:Yo.ChromeOS})},{test:[/PlayStation 4/],describe(e){const t=Zo.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:Yo.PlayStation4,version:t}}}],nc=[{test:[/googlebot/i],describe:()=>({type:"bot",vendor:"Google"})},{test:[/huawei/i],describe(e){const t=Zo.getFirstMatch(/(can-l01)/i,e)&&"Nova",i={type:Qo.mobile,vendor:"Huawei"};return t&&(i.model=t),i}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:()=>({type:Qo.tablet,vendor:"Nexus"})},{test:[/ipad/i],describe:()=>({type:Qo.tablet,vendor:"Apple",model:"iPad"})},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:()=>({type:Qo.tablet,vendor:"Apple",model:"iPad"})},{test:[/kftt build/i],describe:()=>({type:Qo.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"})},{test:[/silk/i],describe:()=>({type:Qo.tablet,vendor:"Amazon"})},{test:[/tablet(?! pc)/i],describe:()=>({type:Qo.tablet})},{test(e){const t=e.test(/ipod|iphone/i),i=e.test(/like (ipod|iphone)/i);return t&&!i},describe(e){const t=Zo.getFirstMatch(/(ipod|iphone)/i,e);return{type:Qo.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:()=>({type:Qo.mobile,vendor:"Nexus"})},{test:[/[^-]mobi/i],describe:()=>({type:Qo.mobile})},{test:e=>"blackberry"===e.getBrowserName(!0),describe:()=>({type:Qo.mobile,vendor:"BlackBerry"})},{test:e=>"bada"===e.getBrowserName(!0),describe:()=>({type:Qo.mobile})},{test:e=>"windows phone"===e.getBrowserName(),describe:()=>({type:Qo.mobile,vendor:"Microsoft"})},{test(e){const t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:()=>({type:Qo.tablet})},{test:e=>"android"===e.getOSName(!0),describe:()=>({type:Qo.mobile})},{test:e=>"macos"===e.getOSName(!0),describe:()=>({type:Qo.desktop,vendor:"Apple"})},{test:e=>"windows"===e.getOSName(!0),describe:()=>({type:Qo.desktop})},{test:e=>"linux"===e.getOSName(!0),describe:()=>({type:Qo.desktop})},{test:e=>"playstation 4"===e.getOSName(!0),describe:()=>({type:Qo.tv})},{test:e=>"roku"===e.getOSName(!0),describe:()=>({type:Qo.tv})}],sc=[{test:e=>"microsoft edge"===e.getBrowserName(!0),describe(e){if(/\sedg\//i.test(e))return{name:Xo.Blink};const t=Zo.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:Xo.EdgeHTML,version:t}}},{test:[/trident/i],describe(e){const t={name:Xo.Trident},i=Zo.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:e=>e.test(/presto/i),describe(e){const t={name:Xo.Presto},i=Zo.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test(e){const t=e.test(/gecko/i),i=e.test(/like gecko/i);return t&&!i},describe(e){const t={name:Xo.Gecko},i=Zo.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/(apple)?webkit\/537\.36/i],describe:()=>({name:Xo.Blink})},{test:[/(apple)?webkit/i],describe(e){const t={name:Xo.WebKit},i=Zo.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}}];class ac{constructor(e,t=!1){if(null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}getUA(){return this._ua}test(e){return e.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const e=Zo.find(tc,(e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some((e=>this.test(e)));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.browser=e.describe(this.getUA())),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()}parseOS(){this.parsedResult.os={};const e=Zo.find(ic,(e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some((e=>this.test(e)));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.os=e.describe(this.getUA())),this.parsedResult.os}getOSName(e){const{name:t}=this.getOS();return e?String(t).toLowerCase()||"":t||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(e=!1){const{type:t}=this.getPlatform();return e?String(t).toLowerCase()||"":t||""}parsePlatform(){this.parsedResult.platform={};const e=Zo.find(nc,(e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some((e=>this.test(e)));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.platform=e.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const e=Zo.find(sc,(e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some((e=>this.test(e)));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.engine=e.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return Zo.assign({},this.parsedResult)}satisfies(e){const t={};let i=0;const n={};let s=0;if(Object.keys(e).forEach((a=>{const r=e[a];"string"==typeof r?(n[a]=r,s+=1):"object"==typeof r&&(t[a]=r,i+=1)})),i>0){const e=Object.keys(t),i=Zo.find(e,(e=>this.isOS(e)));if(i){const e=this.satisfies(t[i]);if(void 0!==e)return e}const n=Zo.find(e,(e=>this.isPlatform(e)));if(n){const e=this.satisfies(t[n]);if(void 0!==e)return e}}if(s>0){const e=Object.keys(n),t=Zo.find(e,(e=>this.isBrowser(e,!0)));if(void 0!==t)return this.compareVersion(n[t])}}isBrowser(e,t=!1){const i=this.getBrowserName().toLowerCase();let n=e.toLowerCase();const s=Zo.getBrowserTypeByAlias(n);return t&&s&&(n=s.toLowerCase()),n===i}compareVersion(e){let t=[0],i=e,n=!1;const s=this.getBrowserVersion();if("string"==typeof s)return">"===e[0]||"<"===e[0]?(i=e.substr(1),"="===e[1]?(n=!0,i=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?i=e.substr(1):"~"===e[0]&&(n=!0,i=e.substr(1)),t.indexOf(Zo.compareVersions(s,i,n))>-1}isOS(e){return this.getOSName(!0)===String(e).toLowerCase()}isPlatform(e){return this.getPlatformType(!0)===String(e).toLowerCase()}isEngine(e){return this.getEngineName(!0)===String(e).toLowerCase()}is(e,t=!1){return this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)}some(e=[]){return e.some((e=>this.is(e)))}}
29
- /*!
30
- * Bowser - a browser detector
31
- * https://github.com/lancedikson/bowser
32
- * MIT License | (c) Dustin Diaz 2012-2015
33
- * MIT License | (c) Denis Demchenko 2015-2019
34
- */var rc=ii(Object.freeze({__proto__:null,default:class{static getParser(e,t=!1){if("string"!=typeof e)throw new Error("UserAgent should be a string");return new ac(e,t)}static parse(e){return new ac(e).getResult()}static get BROWSER_MAP(){return Jo}static get ENGINE_MAP(){return Xo}static get OS_MAP(){return Yo}static get PLATFORMS_MAP(){return Qo}}})),oc={},cc=ei&&ei.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(oc,"__esModule",{value:!0}),oc.Logger=void 0;const pc=cc(jo),dc="mediasoup-client";oc.Logger=class{constructor(e){e?(this._debug=(0,pc.default)(`${dc}:${e}`),this._warn=(0,pc.default)(`${dc}:WARN:${e}`),this._error=(0,pc.default)(`${dc}:ERROR:${e}`)):(this._debug=(0,pc.default)(dc),this._warn=(0,pc.default)(`${dc}:WARN`),this._error=(0,pc.default)(`${dc}:ERROR`)),this._debug.log=console.info.bind(console),this._warn.log=console.warn.bind(console),this._error.log=console.error.bind(console)}get debug(){return this._debug}get warn(){return this._warn}get error(){return this._error}};var lc={};Object.defineProperty(lc,"__esModule",{value:!0}),lc.EnhancedEventEmitter=void 0;const uc=d,mc=new oc.Logger("EnhancedEventEmitter");class hc extends uc.EventEmitter{constructor(){super(),this.setMaxListeners(1/0)}emit(e,...t){return super.emit(e,...t)}safeEmit(e,...t){const i=super.listenerCount(e);try{return super.emit(e,...t)}catch(t){return mc.error("safeEmit() | event listener threw an error [eventName:%s]:%o",e,t),Boolean(i)}}on(e,t){return super.on(e,t),this}off(e,t){return super.off(e,t),this}addListener(e,t){return super.on(e,t),this}prependListener(e,t){return super.prependListener(e,t),this}once(e,t){return super.once(e,t),this}prependOnceListener(e,t){return super.prependOnceListener(e,t),this}removeListener(e,t){return super.off(e,t),this}removeAllListeners(e){return super.removeAllListeners(e),this}listenerCount(e){return super.listenerCount(e)}listeners(e){return super.listeners(e)}rawListeners(e){return super.rawListeners(e)}}lc.EnhancedEventEmitter=hc;var fc={};Object.defineProperty(fc,"__esModule",{value:!0}),fc.InvalidStateError=fc.UnsupportedError=void 0;class gc extends Error{constructor(e){super(e),this.name="UnsupportedError",Error.hasOwnProperty("captureStackTrace")?Error.captureStackTrace(this,gc):this.stack=new Error(e).stack}}fc.UnsupportedError=gc;class vc extends Error{constructor(e){super(e),this.name="InvalidStateError",Error.hasOwnProperty("captureStackTrace")?Error.captureStackTrace(this,vc):this.stack=new Error(e).stack}}fc.InvalidStateError=vc;var bc={};Object.defineProperty(bc,"__esModule",{value:!0}),bc.generateRandomNumber=bc.clone=void 0,bc.clone=function(e,t){return void 0===e?t:JSON.parse(JSON.stringify(e))},bc.generateRandomNumber=function(){return Math.round(1e7*Math.random())};var _c={},yc={};!function(e){const t=jo("h264-profile-level-id");t.log=console.info.bind(console);e.ProfileConstrainedBaseline=1,e.ProfileBaseline=2,e.ProfileMain=3,e.ProfileConstrainedHigh=4,e.ProfileHigh=5;const i=10;e.Level1_b=0,e.Level1=10,e.Level1_1=11,e.Level1_2=12,e.Level1_3=13,e.Level2=20,e.Level2_1=21,e.Level2_2=22,e.Level3=30,e.Level3_1=31,e.Level3_2=32,e.Level4=40,e.Level4_1=41,e.Level4_2=42,e.Level5=50,e.Level5_1=51,e.Level5_2=52;class n{constructor(e,t){this.profile=e,this.level=t}}e.ProfileLevelId=n;const s=new n(1,31);class a{constructor(e){this._mask=~c("x",e),this._maskedValue=c("1",e)}isMatch(e){return this._maskedValue===(e&this._mask)}}class r{constructor(e,t,i){this.profile_idc=e,this.profile_iop=t,this.profile=i}}const o=[new r(66,new a("x1xx0000"),1),new r(77,new a("1xxx0000"),1),new r(88,new a("11xx0000"),1),new r(66,new a("x0xx0000"),2),new r(88,new a("10xx0000"),2),new r(77,new a("0x0x0000"),3),new r(100,new a("00000000"),5),new r(100,new a("00001100"),4)];function c(e,t){return(t[0]===e)<<7|(t[1]===e)<<6|(t[2]===e)<<5|(t[3]===e)<<4|(t[4]===e)<<3|(t[5]===e)<<2|(t[6]===e)<<1|(t[7]===e)<<0}function p(e={}){const t=e["level-asymmetry-allowed"];return 1===t||"1"===t}e.parseProfileLevelId=function(e){if("string"!=typeof e||6!==e.length)return null;const i=parseInt(e,16);if(0===i)return null;const s=255&i,a=i>>8&255,r=i>>16&255;let c;switch(s){case 11:c=0!=(16&a)?0:11;break;case 10:case 12:case 13:case 20:case 21:case 22:case 30:case 31:case 32:case 40:case 41:case 42:case 50:case 51:case 52:c=s;break;default:return t("parseProfileLevelId() | unrecognized level_idc:%s",s),null}for(const e of o)if(r===e.profile_idc&&e.profile_iop.isMatch(a))return new n(e.profile,c);return t("parseProfileLevelId() | unrecognized profile_idc/profile_iop combination"),null},e.profileLevelIdToString=function(e){if(0==e.level)switch(e.profile){case 1:return"42f00b";case 2:return"42100b";case 3:return"4d100b";default:return t("profileLevelIdToString() | Level 1_b not is allowed for profile:%s",e.profile),null}let i;switch(e.profile){case 1:i="42e0";break;case 2:i="4200";break;case 3:i="4d00";break;case 4:i="640c";break;case 5:i="6400";break;default:return t("profileLevelIdToString() | unrecognized profile:%s",e.profile),null}let n=e.level.toString(16);return 1===n.length&&(n=`0${n}`),`${i}${n}`},e.parseSdpProfileLevelId=function(t={}){const i=t["profile-level-id"];return i?e.parseProfileLevelId(i):s},e.isSameProfile=function(t={},i={}){const n=e.parseSdpProfileLevelId(t),s=e.parseSdpProfileLevelId(i);return Boolean(n&&s&&n.profile===s.profile)},e.generateProfileLevelIdForAnswer=function(s={},a={}){if(!s["profile-level-id"]&&!a["profile-level-id"])return t("generateProfileLevelIdForAnswer() | no profile-level-id in local and remote params"),null;const r=e.parseSdpProfileLevelId(s),o=e.parseSdpProfileLevelId(a);if(!r)throw new TypeError("invalid local_profile_level_id");if(!o)throw new TypeError("invalid remote_profile_level_id");if(r.profile!==o.profile)throw new TypeError("H264 Profile mismatch");const c=p(s)&&p(a),d=r.level,l=o.level,u=function(e,t){return 0===e?t!==i&&0!==t:0===t?e!==i:e<t}(m=d,h=l)?m:h;var m,h;const f=c?d:u;return t("generateProfileLevelIdForAnswer() | result: [profile:%s, level:%s]",r.profile,f),e.profileLevelIdToString(new n(r.profile,f))}}(yc);var xc=ei&&ei.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,s)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),wc=ei&&ei.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Sc=ei&&ei.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&xc(t,e,i);return wc(t,e),t};Object.defineProperty(_c,"__esModule",{value:!0}),_c.canReceive=_c.canSend=_c.generateProbatorRtpParameters=_c.reduceCodecs=_c.getSendingRemoteRtpParameters=_c.getSendingRtpParameters=_c.getRecvRtpCapabilities=_c.getExtendedRtpCapabilities=_c.validateSctpStreamParameters=_c.validateSctpParameters=_c.validateNumSctpStreams=_c.validateSctpCapabilities=_c.validateRtcpParameters=_c.validateRtpEncodingParameters=_c.validateRtpHeaderExtensionParameters=_c.validateRtpCodecParameters=_c.validateRtpParameters=_c.validateRtpHeaderExtension=_c.validateRtcpFeedback=_c.validateRtpCodecCapability=_c.validateRtpCapabilities=void 0;const Rc=Sc(yc),Cc=Sc(bc);function kc(e){const t=new RegExp("^(audio|video)/(.+)","i");if("object"!=typeof e)throw new TypeError("codec is not an object");if(!e.mimeType||"string"!=typeof e.mimeType)throw new TypeError("missing codec.mimeType");const i=t.exec(e.mimeType);if(!i)throw new TypeError("invalid codec.mimeType");if(e.kind=i[1].toLowerCase(),e.preferredPayloadType&&"number"!=typeof e.preferredPayloadType)throw new TypeError("invalid codec.preferredPayloadType");if("number"!=typeof e.clockRate)throw new TypeError("missing codec.clockRate");"audio"===e.kind?"number"!=typeof e.channels&&(e.channels=1):delete e.channels,e.parameters&&"object"==typeof e.parameters||(e.parameters={});for(const t of Object.keys(e.parameters)){let i=e.parameters[t];if(void 0===i&&(e.parameters[t]="",i=""),"string"!=typeof i&&"number"!=typeof i)throw new TypeError(`invalid codec parameter [key:${t}s, value:${i}]`);if("apt"===t&&"number"!=typeof i)throw new TypeError("invalid codec apt parameter")}e.rtcpFeedback&&Array.isArray(e.rtcpFeedback)||(e.rtcpFeedback=[]);for(const t of e.rtcpFeedback)Tc(t)}function Tc(e){if("object"!=typeof e)throw new TypeError("fb is not an object");if(!e.type||"string"!=typeof e.type)throw new TypeError("missing fb.type");e.parameter&&"string"==typeof e.parameter||(e.parameter="")}function Pc(e){if("object"!=typeof e)throw new TypeError("ext is not an object");if("audio"!==e.kind&&"video"!==e.kind)throw new TypeError("invalid ext.kind");if(!e.uri||"string"!=typeof e.uri)throw new TypeError("missing ext.uri");if("number"!=typeof e.preferredId)throw new TypeError("missing ext.preferredId");if(e.preferredEncrypt&&"boolean"!=typeof e.preferredEncrypt)throw new TypeError("invalid ext.preferredEncrypt");if(e.preferredEncrypt||(e.preferredEncrypt=!1),e.direction&&"string"!=typeof e.direction)throw new TypeError("invalid ext.direction");e.direction||(e.direction="sendrecv")}function Ec(e){if("object"!=typeof e)throw new TypeError("params is not an object");if(e.mid&&"string"!=typeof e.mid)throw new TypeError("params.mid is not a string");if(!Array.isArray(e.codecs))throw new TypeError("missing params.codecs");for(const t of e.codecs)Oc(t);if(e.headerExtensions&&!Array.isArray(e.headerExtensions))throw new TypeError("params.headerExtensions is not an array");e.headerExtensions||(e.headerExtensions=[]);for(const t of e.headerExtensions)Dc(t);if(e.encodings&&!Array.isArray(e.encodings))throw new TypeError("params.encodings is not an array");e.encodings||(e.encodings=[]);for(const t of e.encodings)Ic(t);if(e.rtcp&&"object"!=typeof e.rtcp)throw new TypeError("params.rtcp is not an object");e.rtcp||(e.rtcp={}),jc(e.rtcp)}function Oc(e){const t=new RegExp("^(audio|video)/(.+)","i");if("object"!=typeof e)throw new TypeError("codec is not an object");if(!e.mimeType||"string"!=typeof e.mimeType)throw new TypeError("missing codec.mimeType");const i=t.exec(e.mimeType);if(!i)throw new TypeError("invalid codec.mimeType");if("number"!=typeof e.payloadType)throw new TypeError("missing codec.payloadType");if("number"!=typeof e.clockRate)throw new TypeError("missing codec.clockRate");"audio"===i[1].toLowerCase()?"number"!=typeof e.channels&&(e.channels=1):delete e.channels,e.parameters&&"object"==typeof e.parameters||(e.parameters={});for(const t of Object.keys(e.parameters)){let i=e.parameters[t];if(void 0===i&&(e.parameters[t]="",i=""),"string"!=typeof i&&"number"!=typeof i)throw new TypeError(`invalid codec parameter [key:${t}s, value:${i}]`);if("apt"===t&&"number"!=typeof i)throw new TypeError("invalid codec apt parameter")}e.rtcpFeedback&&Array.isArray(e.rtcpFeedback)||(e.rtcpFeedback=[]);for(const t of e.rtcpFeedback)Tc(t)}function Dc(e){if("object"!=typeof e)throw new TypeError("ext is not an object");if(!e.uri||"string"!=typeof e.uri)throw new TypeError("missing ext.uri");if("number"!=typeof e.id)throw new TypeError("missing ext.id");if(e.encrypt&&"boolean"!=typeof e.encrypt)throw new TypeError("invalid ext.encrypt");e.encrypt||(e.encrypt=!1),e.parameters&&"object"==typeof e.parameters||(e.parameters={});for(const t of Object.keys(e.parameters)){let i=e.parameters[t];if(void 0===i&&(e.parameters[t]="",i=""),"string"!=typeof i&&"number"!=typeof i)throw new TypeError("invalid header extension parameter")}}function Ic(e){if("object"!=typeof e)throw new TypeError("encoding is not an object");if(e.ssrc&&"number"!=typeof e.ssrc)throw new TypeError("invalid encoding.ssrc");if(e.rid&&"string"!=typeof e.rid)throw new TypeError("invalid encoding.rid");if(e.rtx&&"object"!=typeof e.rtx)throw new TypeError("invalid encoding.rtx");if(e.rtx&&"number"!=typeof e.rtx.ssrc)throw new TypeError("missing encoding.rtx.ssrc");if(e.dtx&&"boolean"==typeof e.dtx||(e.dtx=!1),e.scalabilityMode&&"string"!=typeof e.scalabilityMode)throw new TypeError("invalid encoding.scalabilityMode")}function jc(e){if("object"!=typeof e)throw new TypeError("rtcp is not an object");if(e.cname&&"string"!=typeof e.cname)throw new TypeError("invalid rtcp.cname");e.reducedSize&&"boolean"==typeof e.reducedSize||(e.reducedSize=!0)}function Lc(e){if("object"!=typeof e)throw new TypeError("numStreams is not an object");if("number"!=typeof e.OS)throw new TypeError("missing numStreams.OS");if("number"!=typeof e.MIS)throw new TypeError("missing numStreams.MIS")}function Mc(e){return!!e&&/.+\/rtx$/i.test(e.mimeType)}function Ac(e,t,{strict:i=!1,modify:n=!1}={}){const s=e.mimeType.toLowerCase();if(s!==t.mimeType.toLowerCase())return!1;if(e.clockRate!==t.clockRate)return!1;if(e.channels!==t.channels)return!1;switch(s){case"video/h264":if(i){if((e.parameters["packetization-mode"]||0)!==(t.parameters["packetization-mode"]||0))return!1;if(!Rc.isSameProfile(e.parameters,t.parameters))return!1;let i;try{i=Rc.generateProfileLevelIdForAnswer(e.parameters,t.parameters)}catch(e){return!1}n&&(i?(e.parameters["profile-level-id"]=i,t.parameters["profile-level-id"]=i):(delete e.parameters["profile-level-id"],delete t.parameters["profile-level-id"]))}break;case"video/vp9":if(i){if((e.parameters["profile-id"]||0)!==(t.parameters["profile-id"]||0))return!1}}return!0}function Nc(e,t){return(!e.kind||!t.kind||e.kind===t.kind)&&e.uri===t.uri}function Bc(e,t){const i=[];for(const n of e.rtcpFeedback||[]){const e=(t.rtcpFeedback||[]).find((e=>e.type===n.type&&(e.parameter===n.parameter||!e.parameter&&!n.parameter)));e&&i.push(e)}return i}_c.validateRtpCapabilities=function(e){if("object"!=typeof e)throw new TypeError("caps is not an object");if(e.codecs&&!Array.isArray(e.codecs))throw new TypeError("caps.codecs is not an array");e.codecs||(e.codecs=[]);for(const t of e.codecs)kc(t);if(e.headerExtensions&&!Array.isArray(e.headerExtensions))throw new TypeError("caps.headerExtensions is not an array");e.headerExtensions||(e.headerExtensions=[]);for(const t of e.headerExtensions)Pc(t)},_c.validateRtpCodecCapability=kc,_c.validateRtcpFeedback=Tc,_c.validateRtpHeaderExtension=Pc,_c.validateRtpParameters=Ec,_c.validateRtpCodecParameters=Oc,_c.validateRtpHeaderExtensionParameters=Dc,_c.validateRtpEncodingParameters=Ic,_c.validateRtcpParameters=jc,_c.validateSctpCapabilities=function(e){if("object"!=typeof e)throw new TypeError("caps is not an object");if(!e.numStreams||"object"!=typeof e.numStreams)throw new TypeError("missing caps.numStreams");Lc(e.numStreams)},_c.validateNumSctpStreams=Lc,_c.validateSctpParameters=function(e){if("object"!=typeof e)throw new TypeError("params is not an object");if("number"!=typeof e.port)throw new TypeError("missing params.port");if("number"!=typeof e.OS)throw new TypeError("missing params.OS");if("number"!=typeof e.MIS)throw new TypeError("missing params.MIS");if("number"!=typeof e.maxMessageSize)throw new TypeError("missing params.maxMessageSize")},_c.validateSctpStreamParameters=function(e){if("object"!=typeof e)throw new TypeError("params is not an object");if("number"!=typeof e.streamId)throw new TypeError("missing params.streamId");let t=!1;if("boolean"==typeof e.ordered?t=!0:e.ordered=!0,e.maxPacketLifeTime&&"number"!=typeof e.maxPacketLifeTime)throw new TypeError("invalid params.maxPacketLifeTime");if(e.maxRetransmits&&"number"!=typeof e.maxRetransmits)throw new TypeError("invalid params.maxRetransmits");if(e.maxPacketLifeTime&&e.maxRetransmits)throw new TypeError("cannot provide both maxPacketLifeTime and maxRetransmits");if(t&&e.ordered&&(e.maxPacketLifeTime||e.maxRetransmits))throw new TypeError("cannot be ordered with maxPacketLifeTime or maxRetransmits");if(t||!e.maxPacketLifeTime&&!e.maxRetransmits||(e.ordered=!1),e.label&&"string"!=typeof e.label)throw new TypeError("invalid params.label");if(e.protocol&&"string"!=typeof e.protocol)throw new TypeError("invalid params.protocol")},_c.getExtendedRtpCapabilities=function(e,t){const i={codecs:[],headerExtensions:[]};for(const n of t.codecs||[]){if(Mc(n))continue;const t=(e.codecs||[]).find((e=>Ac(e,n,{strict:!0,modify:!0})));if(!t)continue;const s={mimeType:t.mimeType,kind:t.kind,clockRate:t.clockRate,channels:t.channels,localPayloadType:t.preferredPayloadType,localRtxPayloadType:void 0,remotePayloadType:n.preferredPayloadType,remoteRtxPayloadType:void 0,localParameters:t.parameters,remoteParameters:n.parameters,rtcpFeedback:Bc(t,n)};i.codecs.push(s)}for(const n of i.codecs){const i=e.codecs.find((e=>Mc(e)&&e.parameters.apt===n.localPayloadType)),s=t.codecs.find((e=>Mc(e)&&e.parameters.apt===n.remotePayloadType));i&&s&&(n.localRtxPayloadType=i.preferredPayloadType,n.remoteRtxPayloadType=s.preferredPayloadType)}for(const n of t.headerExtensions){const t=e.headerExtensions.find((e=>Nc(e,n)));if(!t)continue;const s={kind:n.kind,uri:n.uri,sendId:t.preferredId,recvId:n.preferredId,encrypt:t.preferredEncrypt,direction:"sendrecv"};switch(n.direction){case"sendrecv":s.direction="sendrecv";break;case"recvonly":s.direction="sendonly";break;case"sendonly":s.direction="recvonly";break;case"inactive":s.direction="inactive"}i.headerExtensions.push(s)}return i},_c.getRecvRtpCapabilities=function(e){const t={codecs:[],headerExtensions:[]};for(const i of e.codecs){const e={mimeType:i.mimeType,kind:i.kind,preferredPayloadType:i.remotePayloadType,clockRate:i.clockRate,channels:i.channels,parameters:i.localParameters,rtcpFeedback:i.rtcpFeedback};if(t.codecs.push(e),!i.remoteRtxPayloadType)continue;const n={mimeType:`${i.kind}/rtx`,kind:i.kind,preferredPayloadType:i.remoteRtxPayloadType,clockRate:i.clockRate,parameters:{apt:i.remotePayloadType},rtcpFeedback:[]};t.codecs.push(n)}for(const i of e.headerExtensions){if("sendrecv"!==i.direction&&"recvonly"!==i.direction)continue;const e={kind:i.kind,uri:i.uri,preferredId:i.recvId,preferredEncrypt:i.encrypt,direction:i.direction};t.headerExtensions.push(e)}return t},_c.getSendingRtpParameters=function(e,t){const i={mid:void 0,codecs:[],headerExtensions:[],encodings:[],rtcp:{}};for(const n of t.codecs){if(n.kind!==e)continue;const t={mimeType:n.mimeType,payloadType:n.localPayloadType,clockRate:n.clockRate,channels:n.channels,parameters:n.localParameters,rtcpFeedback:n.rtcpFeedback};if(i.codecs.push(t),n.localRtxPayloadType){const e={mimeType:`${n.kind}/rtx`,payloadType:n.localRtxPayloadType,clockRate:n.clockRate,parameters:{apt:n.localPayloadType},rtcpFeedback:[]};i.codecs.push(e)}}for(const n of t.headerExtensions){if(n.kind&&n.kind!==e||"sendrecv"!==n.direction&&"sendonly"!==n.direction)continue;const t={uri:n.uri,id:n.sendId,encrypt:n.encrypt,parameters:{}};i.headerExtensions.push(t)}return i},_c.getSendingRemoteRtpParameters=function(e,t){const i={mid:void 0,codecs:[],headerExtensions:[],encodings:[],rtcp:{}};for(const n of t.codecs){if(n.kind!==e)continue;const t={mimeType:n.mimeType,payloadType:n.localPayloadType,clockRate:n.clockRate,channels:n.channels,parameters:n.remoteParameters,rtcpFeedback:n.rtcpFeedback};if(i.codecs.push(t),n.localRtxPayloadType){const e={mimeType:`${n.kind}/rtx`,payloadType:n.localRtxPayloadType,clockRate:n.clockRate,parameters:{apt:n.localPayloadType},rtcpFeedback:[]};i.codecs.push(e)}}for(const n of t.headerExtensions){if(n.kind&&n.kind!==e||"sendrecv"!==n.direction&&"sendonly"!==n.direction)continue;const t={uri:n.uri,id:n.sendId,encrypt:n.encrypt,parameters:{}};i.headerExtensions.push(t)}if(i.headerExtensions.some((e=>"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"===e.uri)))for(const e of i.codecs)e.rtcpFeedback=(e.rtcpFeedback||[]).filter((e=>"goog-remb"!==e.type));else if(i.headerExtensions.some((e=>"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"===e.uri)))for(const e of i.codecs)e.rtcpFeedback=(e.rtcpFeedback||[]).filter((e=>"transport-cc"!==e.type));else for(const e of i.codecs)e.rtcpFeedback=(e.rtcpFeedback||[]).filter((e=>"transport-cc"!==e.type&&"goog-remb"!==e.type));return i},_c.reduceCodecs=function(e,t){const i=[];if(t){for(let n=0;n<e.length;++n)if(Ac(e[n],t)){i.push(e[n]),Mc(e[n+1])&&i.push(e[n+1]);break}if(0===i.length)throw new TypeError("no matching codec found")}else i.push(e[0]),Mc(e[1])&&i.push(e[1]);return i},_c.generateProbatorRtpParameters=function(e){Ec(e=Cc.clone(e,{}));const t={mid:"probator",codecs:[],headerExtensions:[],encodings:[{ssrc:1234}],rtcp:{cname:"probator"}};return t.codecs.push(e.codecs[0]),t.codecs[0].payloadType=127,t.headerExtensions=e.headerExtensions,t},_c.canSend=function(e,t){return t.codecs.some((t=>t.kind===e))},_c.canReceive=function(e,t){if(Ec(e),0===e.codecs.length)return!1;const i=e.codecs[0];return t.codecs.some((e=>e.remotePayloadType===i.payloadType))};var Fc={},Uc={},zc={},qc=ei&&ei.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(zc,"__esModule",{value:!0}),zc.Logger=void 0;const $c=qc(jo),Vc="awaitqueue";zc.Logger=class{constructor(e){e?(this._debug=(0,$c.default)(`awaitqueue:${e}`),this._warn=(0,$c.default)(`awaitqueue:WARN:${e}`),this._error=(0,$c.default)(`awaitqueue:ERROR:${e}`)):(this._debug=(0,$c.default)(Vc),this._warn=(0,$c.default)("awaitqueue:WARN"),this._error=(0,$c.default)("awaitqueue:ERROR")),this._debug.log=console.info.bind(console),this._warn.log=console.warn.bind(console),this._error.log=console.error.bind(console)}get debug(){return this._debug}get warn(){return this._warn}get error(){return this._error}},Object.defineProperty(Uc,"__esModule",{value:!0}),Uc.AwaitQueue=Uc.AwaitQueueRemovedTaskError=Uc.AwaitQueueStoppedError=void 0;const Wc=new zc.Logger;class Hc extends Error{constructor(e){super(null!=e?e:"AwaitQueue stopped"),this.name="AwaitQueueStoppedError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,Hc)}}Uc.AwaitQueueStoppedError=Hc;class Gc extends Error{constructor(e){super(null!=e?e:"AwaitQueue task removed"),this.name="AwaitQueueRemovedTaskError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,Gc)}}Uc.AwaitQueueRemovedTaskError=Gc;
35
- /*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
36
- let Kc;Uc.AwaitQueue=class{constructor(){this.pendingTasks=new Map,this.nextTaskId=0,this.stopping=!1}get size(){return this.pendingTasks.size}async push(e,t){if(t=null!=t?t:e.name,Wc.debug(`push() [name:${t}]`),"function"!=typeof e)throw new TypeError("given task is not a function");if(t)try{Object.defineProperty(e,"name",{value:t})}catch(e){}return new Promise(((i,n)=>{const s={id:this.nextTaskId++,task:e,name:t,enqueuedAt:Date.now(),executedAt:void 0,completed:!1,resolve:e=>{if(s.completed)return;s.completed=!0,this.pendingTasks.delete(s.id),Wc.debug(`resolving task [name:${s.name}]`),i(e);const[t]=this.pendingTasks.values();t&&!t.executedAt&&this.execute(t)},reject:e=>{if(!s.completed&&(s.completed=!0,this.pendingTasks.delete(s.id),Wc.debug(`rejecting task [name:${s.name}]: %s`,String(e)),n(e),!this.stopping)){const[e]=this.pendingTasks.values();e&&!e.executedAt&&this.execute(e)}}};this.pendingTasks.set(s.id,s),1===this.pendingTasks.size&&this.execute(s)}))}stop(){Wc.debug("stop()"),this.stopping=!0;for(const e of this.pendingTasks.values())Wc.debug(`stop() | stopping task [name:${e.name}]`),e.reject(new Hc);this.stopping=!1}remove(e){Wc.debug(`remove() [taskIdx:${e}]`);const t=Array.from(this.pendingTasks.values())[e];t?t.reject(new Gc):Wc.debug(`stop() | no task with given idx [taskIdx:${e}]`)}dump(){const e=Date.now();let t=0;return Array.from(this.pendingTasks.values()).map((i=>({idx:t++,task:i.task,name:i.name,enqueuedTime:i.executedAt?i.executedAt-i.enqueuedAt:e-i.enqueuedAt,executionTime:i.executedAt?e-i.executedAt:0})))}async execute(e){if(Wc.debug(`execute() [name:${e.name}]`),e.executedAt)throw new Error("task already being executed");e.executedAt=Date.now();try{const t=await e.task();e.resolve(t)}catch(t){e.reject(t)}}};var Jc="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:ei):e=>(Kc||(Kc=Promise.resolve())).then(e).catch((e=>setTimeout((()=>{throw e}),0))),Qc={};Object.defineProperty(Qc,"__esModule",{value:!0}),Qc.Producer=void 0;const Yc=lc,Xc=fc,Zc=new oc.Logger("Producer");class ep extends Yc.EnhancedEventEmitter{constructor({id:e,localId:t,rtpSender:i,track:n,rtpParameters:s,stopTracks:a,disableTrackOnPause:r,zeroRtpOnPause:o,appData:c}){super(),this._closed=!1,this._observer=new Yc.EnhancedEventEmitter,Zc.debug("constructor()"),this._id=e,this._localId=t,this._rtpSender=i,this._track=n,this._kind=n.kind,this._rtpParameters=s,this._paused=!!r&&!n.enabled,this._maxSpatialLayer=void 0,this._stopTracks=a,this._disableTrackOnPause=r,this._zeroRtpOnPause=o,this._appData=c||{},this.onTrackEnded=this.onTrackEnded.bind(this),this.handleTrack()}get id(){return this._id}get localId(){return this._localId}get closed(){return this._closed}get kind(){return this._kind}get rtpSender(){return this._rtpSender}get track(){return this._track}get rtpParameters(){return this._rtpParameters}get paused(){return this._paused}get maxSpatialLayer(){return this._maxSpatialLayer}get appData(){return this._appData}set appData(e){throw new Error("cannot override appData object")}get observer(){return this._observer}close(){this._closed||(Zc.debug("close()"),this._closed=!0,this.destroyTrack(),this.emit("@close"),this._observer.safeEmit("close"))}transportClosed(){this._closed||(Zc.debug("transportClosed()"),this._closed=!0,this.destroyTrack(),this.safeEmit("transportclose"),this._observer.safeEmit("close"))}async getStats(){if(this._closed)throw new Xc.InvalidStateError("closed");return new Promise(((e,t)=>{this.safeEmit("@getstats",e,t)}))}pause(){Zc.debug("pause()"),this._closed?Zc.error("pause() | Producer closed"):(this._paused=!0,this._track&&this._disableTrackOnPause&&(this._track.enabled=!1),this._zeroRtpOnPause&&new Promise(((e,t)=>{this.safeEmit("@pause",e,t)})).catch((()=>{})),this._observer.safeEmit("pause"))}resume(){Zc.debug("resume()"),this._closed?Zc.error("resume() | Producer closed"):(this._paused=!1,this._track&&this._disableTrackOnPause&&(this._track.enabled=!0),this._zeroRtpOnPause&&new Promise(((e,t)=>{this.safeEmit("@resume",e,t)})).catch((()=>{})),this._observer.safeEmit("resume"))}async replaceTrack({track:e}){if(Zc.debug("replaceTrack() [track:%o]",e),this._closed){if(e&&this._stopTracks)try{e.stop()}catch(e){}throw new Xc.InvalidStateError("closed")}if(e&&"ended"===e.readyState)throw new Xc.InvalidStateError("track ended");e!==this._track?(await new Promise(((t,i)=>{this.safeEmit("@replacetrack",e,t,i)})),this.destroyTrack(),this._track=e,this._track&&this._disableTrackOnPause&&(this._paused?this._paused&&(this._track.enabled=!1):this._track.enabled=!0),this.handleTrack()):Zc.debug("replaceTrack() | same track, ignored")}async setMaxSpatialLayer(e){if(this._closed)throw new Xc.InvalidStateError("closed");if("video"!==this._kind)throw new Xc.UnsupportedError("not a video Producer");if("number"!=typeof e)throw new TypeError("invalid spatialLayer");e!==this._maxSpatialLayer&&(await new Promise(((t,i)=>{this.safeEmit("@setmaxspatiallayer",e,t,i)})).catch((()=>{})),this._maxSpatialLayer=e)}async setRtpEncodingParameters(e){if(this._closed)throw new Xc.InvalidStateError("closed");if("object"!=typeof e)throw new TypeError("invalid params");await new Promise(((t,i)=>{this.safeEmit("@setrtpencodingparameters",e,t,i)}))}onTrackEnded(){Zc.debug('track "ended" event'),this.safeEmit("trackended"),this._observer.safeEmit("trackended")}handleTrack(){this._track&&this._track.addEventListener("ended",this.onTrackEnded)}destroyTrack(){if(this._track)try{this._track.removeEventListener("ended",this.onTrackEnded),this._stopTracks&&this._track.stop()}catch(e){}}}Qc.Producer=ep;var tp={};Object.defineProperty(tp,"__esModule",{value:!0}),tp.Consumer=void 0;const ip=lc,np=fc,sp=new oc.Logger("Consumer");class ap extends ip.EnhancedEventEmitter{constructor({id:e,localId:t,producerId:i,rtpReceiver:n,track:s,rtpParameters:a,appData:r}){super(),this._closed=!1,this._observer=new ip.EnhancedEventEmitter,sp.debug("constructor()"),this._id=e,this._localId=t,this._producerId=i,this._rtpReceiver=n,this._track=s,this._rtpParameters=a,this._paused=!s.enabled,this._appData=r||{},this.onTrackEnded=this.onTrackEnded.bind(this),this.handleTrack()}get id(){return this._id}get localId(){return this._localId}get producerId(){return this._producerId}get closed(){return this._closed}get kind(){return this._track.kind}get rtpReceiver(){return this._rtpReceiver}get track(){return this._track}get rtpParameters(){return this._rtpParameters}get paused(){return this._paused}get appData(){return this._appData}set appData(e){throw new Error("cannot override appData object")}get observer(){return this._observer}close(){this._closed||(sp.debug("close()"),this._closed=!0,this.destroyTrack(),this.emit("@close"),this._observer.safeEmit("close"))}transportClosed(){this._closed||(sp.debug("transportClosed()"),this._closed=!0,this.destroyTrack(),this.safeEmit("transportclose"),this._observer.safeEmit("close"))}async getStats(){if(this._closed)throw new np.InvalidStateError("closed");return new Promise(((e,t)=>{this.safeEmit("@getstats",e,t)}))}pause(){sp.debug("pause()"),this._closed?sp.error("pause() | Consumer closed"):this._paused?sp.debug("pause() | Consumer is already paused"):(this._paused=!0,this._track.enabled=!1,this.emit("@pause"),this._observer.safeEmit("pause"))}resume(){sp.debug("resume()"),this._closed?sp.error("resume() | Consumer closed"):this._paused?(this._paused=!1,this._track.enabled=!0,this.emit("@resume"),this._observer.safeEmit("resume")):sp.debug("resume() | Consumer is already resumed")}onTrackEnded(){sp.debug('track "ended" event'),this.safeEmit("trackended"),this._observer.safeEmit("trackended")}handleTrack(){this._track.addEventListener("ended",this.onTrackEnded)}destroyTrack(){try{this._track.removeEventListener("ended",this.onTrackEnded),this._track.stop()}catch(e){}}}tp.Consumer=ap;var rp={};Object.defineProperty(rp,"__esModule",{value:!0}),rp.DataProducer=void 0;const op=lc,cp=fc,pp=new oc.Logger("DataProducer");class dp extends op.EnhancedEventEmitter{constructor({id:e,dataChannel:t,sctpStreamParameters:i,appData:n}){super(),this._closed=!1,this._observer=new op.EnhancedEventEmitter,pp.debug("constructor()"),this._id=e,this._dataChannel=t,this._sctpStreamParameters=i,this._appData=n||{},this.handleDataChannel()}get id(){return this._id}get closed(){return this._closed}get sctpStreamParameters(){return this._sctpStreamParameters}get readyState(){return this._dataChannel.readyState}get label(){return this._dataChannel.label}get protocol(){return this._dataChannel.protocol}get bufferedAmount(){return this._dataChannel.bufferedAmount}get bufferedAmountLowThreshold(){return this._dataChannel.bufferedAmountLowThreshold}set bufferedAmountLowThreshold(e){this._dataChannel.bufferedAmountLowThreshold=e}get appData(){return this._appData}set appData(e){throw new Error("cannot override appData object")}get observer(){return this._observer}close(){this._closed||(pp.debug("close()"),this._closed=!0,this._dataChannel.close(),this.emit("@close"),this._observer.safeEmit("close"))}transportClosed(){this._closed||(pp.debug("transportClosed()"),this._closed=!0,this._dataChannel.close(),this.safeEmit("transportclose"),this._observer.safeEmit("close"))}send(e){if(pp.debug("send()"),this._closed)throw new cp.InvalidStateError("closed");this._dataChannel.send(e)}handleDataChannel(){this._dataChannel.addEventListener("open",(()=>{this._closed||(pp.debug('DataChannel "open" event'),this.safeEmit("open"))})),this._dataChannel.addEventListener("error",(e=>{if(this._closed)return;let{error:t}=e;t||(t=new Error("unknown DataChannel error")),"sctp-failure"===t.errorDetail?pp.error("DataChannel SCTP error [sctpCauseCode:%s]: %s",t.sctpCauseCode,t.message):pp.error('DataChannel "error" event: %o',t),this.safeEmit("error",t)})),this._dataChannel.addEventListener("close",(()=>{this._closed||(pp.warn('DataChannel "close" event'),this._closed=!0,this.emit("@close"),this.safeEmit("close"),this._observer.safeEmit("close"))})),this._dataChannel.addEventListener("message",(()=>{this._closed||pp.warn('DataChannel "message" event in a DataProducer, message discarded')})),this._dataChannel.addEventListener("bufferedamountlow",(()=>{this._closed||this.safeEmit("bufferedamountlow")}))}}rp.DataProducer=dp;var lp={};Object.defineProperty(lp,"__esModule",{value:!0}),lp.DataConsumer=void 0;const up=lc,mp=new oc.Logger("DataConsumer");class hp extends up.EnhancedEventEmitter{constructor({id:e,dataProducerId:t,dataChannel:i,sctpStreamParameters:n,appData:s}){super(),this._closed=!1,this._observer=new up.EnhancedEventEmitter,mp.debug("constructor()"),this._id=e,this._dataProducerId=t,this._dataChannel=i,this._sctpStreamParameters=n,this._appData=s||{},this.handleDataChannel()}get id(){return this._id}get dataProducerId(){return this._dataProducerId}get closed(){return this._closed}get sctpStreamParameters(){return this._sctpStreamParameters}get readyState(){return this._dataChannel.readyState}get label(){return this._dataChannel.label}get protocol(){return this._dataChannel.protocol}get binaryType(){return this._dataChannel.binaryType}set binaryType(e){this._dataChannel.binaryType=e}get appData(){return this._appData}set appData(e){throw new Error("cannot override appData object")}get observer(){return this._observer}close(){this._closed||(mp.debug("close()"),this._closed=!0,this._dataChannel.close(),this.emit("@close"),this._observer.safeEmit("close"))}transportClosed(){this._closed||(mp.debug("transportClosed()"),this._closed=!0,this._dataChannel.close(),this.safeEmit("transportclose"),this._observer.safeEmit("close"))}handleDataChannel(){this._dataChannel.addEventListener("open",(()=>{this._closed||(mp.debug('DataChannel "open" event'),this.safeEmit("open"))})),this._dataChannel.addEventListener("error",(e=>{if(this._closed)return;let{error:t}=e;t||(t=new Error("unknown DataChannel error")),"sctp-failure"===t.errorDetail?mp.error("DataChannel SCTP error [sctpCauseCode:%s]: %s",t.sctpCauseCode,t.message):mp.error('DataChannel "error" event: %o',t),this.safeEmit("error",t)})),this._dataChannel.addEventListener("close",(()=>{this._closed||(mp.warn('DataChannel "close" event'),this._closed=!0,this.emit("@close"),this.safeEmit("close"),this._observer.safeEmit("close"))})),this._dataChannel.addEventListener("message",(e=>{this._closed||this.safeEmit("message",e.data)}))}}lp.DataConsumer=hp;var fp=ei&&ei.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,s)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),gp=ei&&ei.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),vp=ei&&ei.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&fp(t,e,i);return gp(t,e),t},bp=ei&&ei.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Fc,"__esModule",{value:!0}),Fc.Transport=void 0;const _p=Uc,yp=bp(Jc),xp=oc,wp=lc,Sp=fc,Rp=vp(bc),Cp=vp(_c),kp=Qc,Tp=tp,Pp=rp,Ep=lp,Op=new xp.Logger("Transport");class Dp{constructor(e){this.consumerOptions=e,this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}class Ip extends wp.EnhancedEventEmitter{constructor({direction:e,id:t,iceParameters:i,iceCandidates:n,dtlsParameters:s,sctpParameters:a,iceServers:r,iceTransportPolicy:o,additionalSettings:c,proprietaryConstraints:p,appData:d,handlerFactory:l,extendedRtpCapabilities:u,canProduceByKind:m}){super(),this._closed=!1,this._connectionState="new",this._producers=new Map,this._consumers=new Map,this._dataProducers=new Map,this._dataConsumers=new Map,this._probatorConsumerCreated=!1,this._awaitQueue=new _p.AwaitQueue,this._pendingConsumerTasks=[],this._consumerCreationInProgress=!1,this._pendingPauseConsumers=new Map,this._consumerPauseInProgress=!1,this._pendingResumeConsumers=new Map,this._consumerResumeInProgress=!1,this._pendingCloseConsumers=new Map,this._consumerCloseInProgress=!1,this._observer=new wp.EnhancedEventEmitter,Op.debug("constructor() [id:%s, direction:%s]",t,e),this._id=t,this._direction=e,this._extendedRtpCapabilities=u,this._canProduceByKind=m,this._maxSctpMessageSize=a?a.maxMessageSize:null,delete(c=Rp.clone(c,{})).iceServers,delete c.iceTransportPolicy,delete c.bundlePolicy,delete c.rtcpMuxPolicy,delete c.sdpSemantics,this._handler=l(),this._handler.run({direction:e,iceParameters:i,iceCandidates:n,dtlsParameters:s,sctpParameters:a,iceServers:r,iceTransportPolicy:o,additionalSettings:c,proprietaryConstraints:p,extendedRtpCapabilities:u}),this._appData=d||{},this.handleHandler()}get id(){return this._id}get closed(){return this._closed}get direction(){return this._direction}get handler(){return this._handler}get connectionState(){return this._connectionState}get appData(){return this._appData}set appData(e){throw new Error("cannot override appData object")}get observer(){return this._observer}close(){if(!this._closed){Op.debug("close()"),this._closed=!0,this._awaitQueue.stop(),this._handler.close();for(const e of this._producers.values())e.transportClosed();this._producers.clear();for(const e of this._consumers.values())e.transportClosed();this._consumers.clear();for(const e of this._dataProducers.values())e.transportClosed();this._dataProducers.clear();for(const e of this._dataConsumers.values())e.transportClosed();this._dataConsumers.clear(),this._observer.safeEmit("close")}}async getStats(){if(this._closed)throw new Sp.InvalidStateError("closed");return this._handler.getTransportStats()}async restartIce({iceParameters:e}){if(Op.debug("restartIce()"),this._closed)throw new Sp.InvalidStateError("closed");if(!e)throw new TypeError("missing iceParameters");return this._awaitQueue.push((async()=>this._handler.restartIce(e)),"transport.restartIce()")}async updateIceServers({iceServers:e}={}){if(Op.debug("updateIceServers()"),this._closed)throw new Sp.InvalidStateError("closed");if(!Array.isArray(e))throw new TypeError("missing iceServers");return this._awaitQueue.push((async()=>this._handler.updateIceServers(e)),"transport.updateIceServers()")}async produce({track:e,encodings:t,codecOptions:i,codec:n,stopTracks:s=!0,disableTrackOnPause:a=!0,zeroRtpOnPause:r=!1,appData:o={}}={}){if(Op.debug("produce() [track:%o]",e),this._closed)throw new Sp.InvalidStateError("closed");if(!e)throw new TypeError("missing track");if("send"!==this._direction)throw new Sp.UnsupportedError("not a sending Transport");if(!this._canProduceByKind[e.kind])throw new Sp.UnsupportedError(`cannot produce ${e.kind}`);if("ended"===e.readyState)throw new Sp.InvalidStateError("track ended");if(0===this.listenerCount("connect")&&"new"===this._connectionState)throw new TypeError('no "connect" listener set into this transport');if(0===this.listenerCount("produce"))throw new TypeError('no "produce" listener set into this transport');if(o&&"object"!=typeof o)throw new TypeError("if given, appData must be an object");return this._awaitQueue.push((async()=>{let c;if(t&&!Array.isArray(t))throw TypeError("encodings must be an array");t&&0===t.length?c=void 0:t&&(c=t.map((e=>{const t={active:!0};return!1===e.active&&(t.active=!1),"boolean"==typeof e.dtx&&(t.dtx=e.dtx),"string"==typeof e.scalabilityMode&&(t.scalabilityMode=e.scalabilityMode),"number"==typeof e.scaleResolutionDownBy&&(t.scaleResolutionDownBy=e.scaleResolutionDownBy),"number"==typeof e.maxBitrate&&(t.maxBitrate=e.maxBitrate),"number"==typeof e.maxFramerate&&(t.maxFramerate=e.maxFramerate),"boolean"==typeof e.adaptivePtime&&(t.adaptivePtime=e.adaptivePtime),"string"==typeof e.priority&&(t.priority=e.priority),"string"==typeof e.networkPriority&&(t.networkPriority=e.networkPriority),t})));const{localId:p,rtpParameters:d,rtpSender:l}=await this._handler.send({track:e,encodings:c,codecOptions:i,codec:n});try{Cp.validateRtpParameters(d);const{id:t}=await new Promise(((t,i)=>{this.safeEmit("produce",{kind:e.kind,rtpParameters:d,appData:o},t,i)})),i=new kp.Producer({id:t,localId:p,rtpSender:l,track:e,rtpParameters:d,stopTracks:s,disableTrackOnPause:a,zeroRtpOnPause:r,appData:o});return this._producers.set(i.id,i),this.handleProducer(i),this._observer.safeEmit("newproducer",i),i}catch(e){throw this._handler.stopSending(p).catch((()=>{})),e}}),"transport.produce()").catch((t=>{if(s)try{e.stop()}catch(e){}throw t}))}async consume({id:e,producerId:t,kind:i,rtpParameters:n,streamId:s,appData:a={}}){if(Op.debug("consume()"),n=Rp.clone(n,void 0),this._closed)throw new Sp.InvalidStateError("closed");if("recv"!==this._direction)throw new Sp.UnsupportedError("not a receiving Transport");if("string"!=typeof e)throw new TypeError("missing id");if("string"!=typeof t)throw new TypeError("missing producerId");if("audio"!==i&&"video"!==i)throw new TypeError(`invalid kind '${i}'`);if(0===this.listenerCount("connect")&&"new"===this._connectionState)throw new TypeError('no "connect" listener set into this transport');if(a&&"object"!=typeof a)throw new TypeError("if given, appData must be an object");if(!Cp.canReceive(n,this._extendedRtpCapabilities))throw new Sp.UnsupportedError("cannot consume this Producer");const r=new Dp({id:e,producerId:t,kind:i,rtpParameters:n,streamId:s,appData:a});return this._pendingConsumerTasks.push(r),(0,yp.default)((()=>{if(this._closed)throw new Sp.InvalidStateError("closed");!1===this._consumerCreationInProgress&&this.createPendingConsumers()})),r.promise}async produceData({ordered:e=!0,maxPacketLifeTime:t,maxRetransmits:i,label:n="",protocol:s="",appData:a={}}={}){if(Op.debug("produceData()"),this._closed)throw new Sp.InvalidStateError("closed");if("send"!==this._direction)throw new Sp.UnsupportedError("not a sending Transport");if(!this._maxSctpMessageSize)throw new Sp.UnsupportedError("SCTP not enabled by remote Transport");if(0===this.listenerCount("connect")&&"new"===this._connectionState)throw new TypeError('no "connect" listener set into this transport');if(0===this.listenerCount("producedata"))throw new TypeError('no "producedata" listener set into this transport');if(a&&"object"!=typeof a)throw new TypeError("if given, appData must be an object");return(t||i)&&(e=!1),this._awaitQueue.push((async()=>{const{dataChannel:r,sctpStreamParameters:o}=await this._handler.sendDataChannel({ordered:e,maxPacketLifeTime:t,maxRetransmits:i,label:n,protocol:s});Cp.validateSctpStreamParameters(o);const{id:c}=await new Promise(((e,t)=>{this.safeEmit("producedata",{sctpStreamParameters:o,label:n,protocol:s,appData:a},e,t)})),p=new Pp.DataProducer({id:c,dataChannel:r,sctpStreamParameters:o,appData:a});return this._dataProducers.set(p.id,p),this.handleDataProducer(p),this._observer.safeEmit("newdataproducer",p),p}),"transport.produceData()")}async consumeData({id:e,dataProducerId:t,sctpStreamParameters:i,label:n="",protocol:s="",appData:a={}}){if(Op.debug("consumeData()"),i=Rp.clone(i,void 0),this._closed)throw new Sp.InvalidStateError("closed");if("recv"!==this._direction)throw new Sp.UnsupportedError("not a receiving Transport");if(!this._maxSctpMessageSize)throw new Sp.UnsupportedError("SCTP not enabled by remote Transport");if("string"!=typeof e)throw new TypeError("missing id");if("string"!=typeof t)throw new TypeError("missing dataProducerId");if(0===this.listenerCount("connect")&&"new"===this._connectionState)throw new TypeError('no "connect" listener set into this transport');if(a&&"object"!=typeof a)throw new TypeError("if given, appData must be an object");return Cp.validateSctpStreamParameters(i),this._awaitQueue.push((async()=>{const{dataChannel:r}=await this._handler.receiveDataChannel({sctpStreamParameters:i,label:n,protocol:s}),o=new Ep.DataConsumer({id:e,dataProducerId:t,dataChannel:r,sctpStreamParameters:i,appData:a});return this._dataConsumers.set(o.id,o),this.handleDataConsumer(o),this._observer.safeEmit("newdataconsumer",o),o}),"transport.consumeData()")}async createPendingConsumers(){this._consumerCreationInProgress=!0,this._awaitQueue.push((async()=>{if(0===this._pendingConsumerTasks.length)return void Op.debug("createPendingConsumers() | there is no Consumer to be created");const e=[...this._pendingConsumerTasks];let t;this._pendingConsumerTasks=[];const i=[];for(const t of e){const{id:e,kind:n,rtpParameters:s,streamId:a}=t.consumerOptions;i.push({trackId:e,kind:n,rtpParameters:s,streamId:a})}try{const n=await this._handler.receive(i);for(let i=0;i<n.length;i++){const s=e[i],a=n[i],{id:r,producerId:o,kind:c,rtpParameters:p,appData:d}=s.consumerOptions,{localId:l,rtpReceiver:u,track:m}=a,h=new Tp.Consumer({id:r,localId:l,producerId:o,rtpReceiver:u,track:m,rtpParameters:p,appData:d});this._consumers.set(h.id,h),this.handleConsumer(h),this._probatorConsumerCreated||t||"video"!==c||(t=h),this._observer.safeEmit("newconsumer",h),s.resolve(h)}}catch(t){for(const i of e)i.reject(t)}if(t)try{const e=Cp.generateProbatorRtpParameters(t.rtpParameters);await this._handler.receive([{trackId:"probator",kind:"video",rtpParameters:e}]),Op.debug("createPendingConsumers() | Consumer for RTP probation created"),this._probatorConsumerCreated=!0}catch(e){Op.error("createPendingConsumers() | failed to create Consumer for RTP probation:%o",e)}}),"transport.createPendingConsumers()").then((()=>{this._consumerCreationInProgress=!1,this._pendingConsumerTasks.length>0&&this.createPendingConsumers()})).catch((()=>{}))}pausePendingConsumers(){this._consumerPauseInProgress=!0,this._awaitQueue.push((async()=>{if(0===this._pendingPauseConsumers.size)return void Op.debug("pausePendingConsumers() | there is no Consumer to be paused");const e=Array.from(this._pendingPauseConsumers.values());this._pendingPauseConsumers.clear();try{const t=e.map((e=>e.localId));await this._handler.pauseReceiving(t)}catch(e){Op.error("pausePendingConsumers() | failed to pause Consumers:",e)}}),"transport.pausePendingConsumers").then((()=>{this._consumerPauseInProgress=!1,this._pendingPauseConsumers.size>0&&this.pausePendingConsumers()})).catch((()=>{}))}resumePendingConsumers(){this._consumerResumeInProgress=!0,this._awaitQueue.push((async()=>{if(0===this._pendingResumeConsumers.size)return void Op.debug("resumePendingConsumers() | there is no Consumer to be resumed");const e=Array.from(this._pendingResumeConsumers.values());this._pendingResumeConsumers.clear();try{const t=e.map((e=>e.localId));await this._handler.resumeReceiving(t)}catch(e){Op.error("resumePendingConsumers() | failed to resume Consumers:",e)}}),"transport.resumePendingConsumers").then((()=>{this._consumerResumeInProgress=!1,this._pendingResumeConsumers.size>0&&this.resumePendingConsumers()})).catch((()=>{}))}closePendingConsumers(){this._consumerCloseInProgress=!0,this._awaitQueue.push((async()=>{if(0===this._pendingCloseConsumers.size)return void Op.debug("closePendingConsumers() | there is no Consumer to be closed");const e=Array.from(this._pendingCloseConsumers.values());this._pendingCloseConsumers.clear();try{await this._handler.stopReceiving(e.map((e=>e.localId)))}catch(e){Op.error("closePendingConsumers() | failed to close Consumers:",e)}}),"transport.closePendingConsumers").then((()=>{this._consumerCloseInProgress=!1,this._pendingCloseConsumers.size>0&&this.closePendingConsumers()})).catch((()=>{}))}handleHandler(){const e=this._handler;e.on("@connect",(({dtlsParameters:e},t,i)=>{this._closed?i(new Sp.InvalidStateError("closed")):this.safeEmit("connect",{dtlsParameters:e},t,i)})),e.on("@connectionstatechange",(e=>{e!==this._connectionState&&(Op.debug("connection state changed to %s",e),this._connectionState=e,this._closed||this.safeEmit("connectionstatechange",e))}))}handleProducer(e){e.on("@close",(()=>{this._producers.delete(e.id),this._closed||this._awaitQueue.push((async()=>this._handler.stopSending(e.localId)),"producer @close event").catch((e=>Op.warn("producer.close() failed:%o",e)))})),e.on("@pause",((t,i)=>{this._awaitQueue.push((async()=>this._handler.pauseSending(e.localId)),"producer @pause event").then(t).catch(i)})),e.on("@resume",((t,i)=>{this._awaitQueue.push((async()=>this._handler.resumeSending(e.localId)),"producer @resume event").then(t).catch(i)})),e.on("@replacetrack",((t,i,n)=>{this._awaitQueue.push((async()=>this._handler.replaceTrack(e.localId,t)),"producer @replacetrack event").then(i).catch(n)})),e.on("@setmaxspatiallayer",((t,i,n)=>{this._awaitQueue.push((async()=>this._handler.setMaxSpatialLayer(e.localId,t)),"producer @setmaxspatiallayer event").then(i).catch(n)})),e.on("@setrtpencodingparameters",((t,i,n)=>{this._awaitQueue.push((async()=>this._handler.setRtpEncodingParameters(e.localId,t)),"producer @setrtpencodingparameters event").then(i).catch(n)})),e.on("@getstats",((t,i)=>{if(this._closed)return i(new Sp.InvalidStateError("closed"));this._handler.getSenderStats(e.localId).then(t).catch(i)}))}handleConsumer(e){e.on("@close",(()=>{this._consumers.delete(e.id),this._pendingPauseConsumers.delete(e.id),this._pendingResumeConsumers.delete(e.id),this._closed||(this._pendingCloseConsumers.set(e.id,e),!1===this._consumerCloseInProgress&&this.closePendingConsumers())})),e.on("@pause",(()=>{this._pendingResumeConsumers.has(e.id)&&this._pendingResumeConsumers.delete(e.id),this._pendingPauseConsumers.set(e.id,e),(0,yp.default)((()=>{this._closed||!1===this._consumerPauseInProgress&&this.pausePendingConsumers()}))})),e.on("@resume",(()=>{this._pendingPauseConsumers.has(e.id)&&this._pendingPauseConsumers.delete(e.id),this._pendingResumeConsumers.set(e.id,e),(0,yp.default)((()=>{this._closed||!1===this._consumerResumeInProgress&&this.resumePendingConsumers()}))})),e.on("@getstats",((t,i)=>{if(this._closed)return i(new Sp.InvalidStateError("closed"));this._handler.getReceiverStats(e.localId).then(t).catch(i)}))}handleDataProducer(e){e.on("@close",(()=>{this._dataProducers.delete(e.id)}))}handleDataConsumer(e){e.on("@close",(()=>{this._dataConsumers.delete(e.id)}))}}Fc.Transport=Ip;var jp={},Lp={},Mp={},Ap={},Np={get exports(){return Ap},set exports(e){Ap=e}}.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),t+=null!=e["network-id"]?" network-id %d":"%v",t+=null!=e["network-cost"]?" network-cost %d":"%v"}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",t+=null!=e.rateNumerator?" rate=%s":"",t+=null!=e.rateDenominator?"/%s":""}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(Np).forEach((function(e){Np[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))})),function(e){var t=function(e){return String(Number(e))===e?Number(e):e},i=function(e,i,n){var s=e.name&&e.names;e.push&&!i[e.push]?i[e.push]=[]:s&&!i[e.name]&&(i[e.name]={});var a=e.push?{}:s?i[e.name]:i;!function(e,i,n,s){if(s&&!n)i[s]=t(e[1]);else for(var a=0;a<n.length;a+=1)null!=e[a+1]&&(i[n[a]]=t(e[a+1]))}(n.match(e.reg),a,e.names,e.name),e.push&&i[e.push].push(a)},n=Ap,s=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},a=[],r=t;return e.split(/(\r\n|\r|\n)/).filter(s).forEach((function(e){var t=e[0],s=e.slice(2);"m"===t&&(a.push({rtp:[],fmtp:[]}),r=a[a.length-1]);for(var o=0;o<(n[t]||[]).length;o+=1){var c=n[t][o];if(c.reg.test(s))return i(c,r,s)}})),t.media=a,t};var a=function(e,i){var n=i.split(/=(.+)/,2);return 2===n.length?e[n[0]]=t(n[1]):1===n.length&&i.length>1&&(e[n[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(a,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var i=[],n=e.split(" ").map(t),s=0;s<n.length;s+=3)i.push({component:n[s],ip:n[s+1],port:n[s+2]});return i},e.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(a,{})}))},e.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var i,n=!1;return"~"!==e[0]?i=t(e):(i=t(e.substring(1,e.length)),n=!0),{scid:i,paused:n}}))}))}}(Mp);var Bp=Ap,Fp=/%[sdv%]/g,Up=function(e){var t=1,i=arguments,n=i.length;return e.replace(Fp,(function(e){if(t>=n)return e;var s=i[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(s);case"%d":return Number(s);case"%v":return""}}))},zp=function(e,t,i){var n=[e+"="+(t.format instanceof Function?t.format(t.push?i:i[t.name]):t.format)];if(t.names)for(var s=0;s<t.names.length;s+=1){var a=t.names[s];t.name?n.push(i[t.name][a]):n.push(i[t.names[s]])}else n.push(i[t.name]);return Up.apply(null,n)},qp=["v","o","s","i","u","e","p","c","b","t","r","z","a"],$p=["i","c","b","a"],Vp=Mp,Wp=function(e,t){t=t||{},null==e.version&&(e.version=0),null==e.name&&(e.name=" "),e.media.forEach((function(e){null==e.payloads&&(e.payloads="")}));var i=t.outerOrder||qp,n=t.innerOrder||$p,s=[];return i.forEach((function(t){Bp[t].forEach((function(i){i.name in e&&null!=e[i.name]?s.push(zp(t,i,e)):i.push in e&&null!=e[i.push]&&e[i.push].forEach((function(e){s.push(zp(t,i,e))}))}))})),e.media.forEach((function(e){s.push(zp("m",Bp.m[0],e)),n.forEach((function(t){Bp[t].forEach((function(i){i.name in e&&null!=e[i.name]?s.push(zp(t,i,e)):i.push in e&&null!=e[i.push]&&e[i.push].forEach((function(e){s.push(zp(t,i,e))}))}))}))})),s.join("\r\n")+"\r\n"};Lp.write=Wp,Lp.parse=Vp.parse,Lp.parseParams=Vp.parseParams,Lp.parseFmtpConfig=Vp.parseFmtpConfig,Lp.parsePayloads=Vp.parsePayloads,Lp.parseRemoteCandidates=Vp.parseRemoteCandidates,Lp.parseImageAttributes=Vp.parseImageAttributes,Lp.parseSimulcastStreamList=Vp.parseSimulcastStreamList;var Hp={},Gp=ei&&ei.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,s)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),Kp=ei&&ei.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Jp=ei&&ei.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&Gp(t,e,i);return Kp(t,e),t};Object.defineProperty(Hp,"__esModule",{value:!0}),Hp.applyCodecParameters=Hp.getCname=Hp.extractDtlsParameters=Hp.extractRtpCapabilities=void 0;const Qp=Jp(Lp);Hp.extractRtpCapabilities=function({sdpObject:e}){const t=new Map,i=[];let n=!1,s=!1;for(const a of e.media){const e=a.type;switch(e){case"audio":if(n)continue;n=!0;break;case"video":if(s)continue;s=!0;break;default:continue}for(const i of a.rtp){const n={kind:e,mimeType:`${e}/${i.codec}`,preferredPayloadType:i.payload,clockRate:i.rate,channels:i.encoding,parameters:{},rtcpFeedback:[]};t.set(n.preferredPayloadType,n)}for(const e of a.fmtp||[]){const i=Qp.parseParams(e.config),n=t.get(e.payload);n&&(i&&i.hasOwnProperty("profile-level-id")&&(i["profile-level-id"]=String(i["profile-level-id"])),n.parameters=i)}for(const i of a.rtcpFb||[]){const n={type:i.type,parameter:i.subtype};if(n.parameter||delete n.parameter,"*"!==i.payload){const e=t.get(i.payload);if(!e)continue;e.rtcpFeedback.push(n)}else for(const i of t.values())i.kind!==e||/.+\/rtx$/i.test(i.mimeType)||i.rtcpFeedback.push(n)}for(const t of a.ext||[]){if(t["encrypt-uri"])continue;const n={kind:e,uri:t.uri,preferredId:t.value};i.push(n)}}return{codecs:Array.from(t.values()),headerExtensions:i}},Hp.extractDtlsParameters=function({sdpObject:e}){const t=(e.media||[]).find((e=>e.iceUfrag&&0!==e.port));if(!t)throw new Error("no active media section found");const i=t.fingerprint||e.fingerprint;let n;switch(t.setup){case"active":n="client";break;case"passive":n="server";break;case"actpass":n="auto"}return{role:n,fingerprints:[{algorithm:i.type,value:i.hash}]}},Hp.getCname=function({offerMediaObject:e}){const t=(e.ssrcs||[]).find((e=>"cname"===e.attribute));return t?t.value:""},Hp.applyCodecParameters=function({offerRtpParameters:e,answerMediaObject:t}){for(const i of e.codecs){const e=i.mimeType.toLowerCase();if("audio/opus"!==e)continue;if(!(t.rtp||[]).find((e=>e.payload===i.payloadType)))continue;t.fmtp=t.fmtp||[];let n=t.fmtp.find((e=>e.payload===i.payloadType));n||(n={payload:i.payloadType,config:""},t.fmtp.push(n));const s=Qp.parseParams(n.config);switch(e){case"audio/opus":{const e=i.parameters["sprop-stereo"];void 0!==e&&(s.stereo=e?1:0);break}}n.config="";for(const e of Object.keys(s))n.config&&(n.config+=";"),n.config+=`${e}=${s[e]}`}};var Yp={};Object.defineProperty(Yp,"__esModule",{value:!0}),Yp.addLegacySimulcast=Yp.getRtpEncodings=void 0,Yp.getRtpEncodings=function({offerMediaObject:e}){const t=new Set;for(const i of e.ssrcs||[]){const e=i.id;t.add(e)}if(0===t.size)throw new Error("no a=ssrc lines found");const i=new Map;for(const n of e.ssrcGroups||[]){if("FID"!==n.semantics)continue;let[e,s]=n.ssrcs.split(/\s+/);e=Number(e),s=Number(s),t.has(e)&&(t.delete(e),t.delete(s),i.set(e,s))}for(const e of t)i.set(e,null);const n=[];for(const[e,t]of i){const i={ssrc:e};t&&(i.rtx={ssrc:t}),n.push(i)}return n},Yp.addLegacySimulcast=function({offerMediaObject:e,numStreams:t}){if(t<=1)throw new TypeError("numStreams must be greater than 1");const i=(e.ssrcs||[]).find((e=>"msid"===e.attribute));if(!i)throw new Error("a=ssrc line with msid information not found");const[n,s]=i.value.split(" "),a=i.id;let r;(e.ssrcGroups||[]).some((e=>{if("FID"!==e.semantics)return!1;const t=e.ssrcs.split(/\s+/);return Number(t[0])===a&&(r=Number(t[1]),!0)}));const o=e.ssrcs.find((e=>"cname"===e.attribute));if(!o)throw new Error("a=ssrc line with cname information not found");const c=o.value,p=[],d=[];for(let e=0;e<t;++e)p.push(a+e),r&&d.push(r+e);e.ssrcGroups=[],e.ssrcs=[],e.ssrcGroups.push({semantics:"SIM",ssrcs:p.join(" ")});for(let t=0;t<p.length;++t){const i=p[t];e.ssrcs.push({id:i,attribute:"cname",value:c}),e.ssrcs.push({id:i,attribute:"msid",value:`${n} ${s}`})}for(let t=0;t<d.length;++t){const i=p[t],a=d[t];e.ssrcs.push({id:a,attribute:"cname",value:c}),e.ssrcs.push({id:a,attribute:"msid",value:`${n} ${s}`}),e.ssrcGroups.push({semantics:"FID",ssrcs:`${i} ${a}`})}};var Xp={};Object.defineProperty(Xp,"__esModule",{value:!0}),Xp.addNackSuppportForOpus=void 0,Xp.addNackSuppportForOpus=function(e){var t;for(const i of e.codecs||[])"audio/opus"!==i.mimeType.toLowerCase()&&"audio/multiopus"!==i.mimeType.toLowerCase()||(null===(t=i.rtcpFeedback)||void 0===t?void 0:t.some((e=>"nack"===e.type&&!e.parameter)))||(i.rtcpFeedback||(i.rtcpFeedback=[]),i.rtcpFeedback.push({type:"nack"}))};var Zp={};Object.defineProperty(Zp,"__esModule",{value:!0}),Zp.HandlerInterface=void 0;const ed=lc;class td extends ed.EnhancedEventEmitter{constructor(){super()}}Zp.HandlerInterface=td;var id={},nd={},sd=ei&&ei.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,s)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),ad=ei&&ei.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),rd=ei&&ei.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&sd(t,e,i);return ad(t,e),t};Object.defineProperty(nd,"__esModule",{value:!0}),nd.OfferMediaSection=nd.AnswerMediaSection=nd.MediaSection=void 0;const od=rd(Lp),cd=rd(bc);class pd{constructor({iceParameters:e,iceCandidates:t,dtlsParameters:i,planB:n=!1}){if(this._mediaObject={},this._planB=n,e&&this.setIceParameters(e),t){this._mediaObject.candidates=[];for(const e of t){const t={component:1};t.foundation=e.foundation,t.ip=e.ip,t.port=e.port,t.priority=e.priority,t.transport=e.protocol,t.type=e.type,e.tcpType&&(t.tcptype=e.tcpType),this._mediaObject.candidates.push(t)}this._mediaObject.endOfCandidates="end-of-candidates",this._mediaObject.iceOptions="renomination"}i&&this.setDtlsRole(i.role)}get mid(){return String(this._mediaObject.mid)}get closed(){return 0===this._mediaObject.port}getObject(){return this._mediaObject}setIceParameters(e){this._mediaObject.iceUfrag=e.usernameFragment,this._mediaObject.icePwd=e.password}pause(){this._mediaObject.direction="inactive"}disable(){this.pause(),delete this._mediaObject.ext,delete this._mediaObject.ssrcs,delete this._mediaObject.ssrcGroups,delete this._mediaObject.simulcast,delete this._mediaObject.simulcast_03,delete this._mediaObject.rids,delete this._mediaObject.extmapAllowMixed}close(){this.disable(),this._mediaObject.port=0}}nd.MediaSection=pd;nd.AnswerMediaSection=class extends pd{constructor({iceParameters:e,iceCandidates:t,dtlsParameters:i,sctpParameters:n,plainRtpParameters:s,planB:a=!1,offerMediaObject:r,offerRtpParameters:o,answerRtpParameters:c,codecOptions:p,extmapAllowMixed:d=!1}){switch(super({iceParameters:e,iceCandidates:t,dtlsParameters:i,planB:a}),this._mediaObject.mid=String(r.mid),this._mediaObject.type=r.type,this._mediaObject.protocol=r.protocol,s?(this._mediaObject.connection={ip:s.ip,version:s.ipVersion},this._mediaObject.port=s.port):(this._mediaObject.connection={ip:"127.0.0.1",version:4},this._mediaObject.port=7),r.type){case"audio":case"video":this._mediaObject.direction="recvonly",this._mediaObject.rtp=[],this._mediaObject.rtcpFb=[],this._mediaObject.fmtp=[];for(const e of c.codecs){const t={payload:e.payloadType,codec:dd(e),rate:e.clockRate};e.channels>1&&(t.encoding=e.channels),this._mediaObject.rtp.push(t);const i=cd.clone(e.parameters,{});let n=cd.clone(e.rtcpFeedback,[]);if(p){const{opusStereo:t,opusFec:s,opusDtx:a,opusMaxPlaybackRate:r,opusMaxAverageBitrate:c,opusPtime:d,opusNack:l,videoGoogleStartBitrate:u,videoGoogleMaxBitrate:m,videoGoogleMinBitrate:h}=p,f=o.codecs.find((t=>t.payloadType===e.payloadType));switch(e.mimeType.toLowerCase()){case"audio/opus":case"audio/multiopus":void 0!==t&&(f.parameters["sprop-stereo"]=t?1:0,i.stereo=t?1:0),void 0!==s&&(f.parameters.useinbandfec=s?1:0,i.useinbandfec=s?1:0),void 0!==a&&(f.parameters.usedtx=a?1:0,i.usedtx=a?1:0),void 0!==r&&(i.maxplaybackrate=r),void 0!==c&&(i.maxaveragebitrate=c),void 0!==d&&(f.parameters.ptime=d,i.ptime=d),l||(f.rtcpFeedback=f.rtcpFeedback.filter((e=>"nack"!==e.type||e.parameter)),n=n.filter((e=>"nack"!==e.type||e.parameter)));break;case"video/vp8":case"video/vp9":case"video/h264":case"video/h265":void 0!==u&&(i["x-google-start-bitrate"]=u),void 0!==m&&(i["x-google-max-bitrate"]=m),void 0!==h&&(i["x-google-min-bitrate"]=h)}}const s={payload:e.payloadType,config:""};for(const e of Object.keys(i))s.config&&(s.config+=";"),s.config+=`${e}=${i[e]}`;s.config&&this._mediaObject.fmtp.push(s);for(const t of n)this._mediaObject.rtcpFb.push({payload:e.payloadType,type:t.type,subtype:t.parameter})}this._mediaObject.payloads=c.codecs.map((e=>e.payloadType)).join(" "),this._mediaObject.ext=[];for(const e of c.headerExtensions){(r.ext||[]).some((t=>t.uri===e.uri))&&this._mediaObject.ext.push({uri:e.uri,value:e.id})}if(d&&"extmap-allow-mixed"===r.extmapAllowMixed&&(this._mediaObject.extmapAllowMixed="extmap-allow-mixed"),r.simulcast){this._mediaObject.simulcast={dir1:"recv",list1:r.simulcast.list1},this._mediaObject.rids=[];for(const e of r.rids||[])"send"===e.direction&&this._mediaObject.rids.push({id:e.id,direction:"recv"})}else if(r.simulcast_03){this._mediaObject.simulcast_03={value:r.simulcast_03.value.replace(/send/g,"recv")},this._mediaObject.rids=[];for(const e of r.rids||[])"send"===e.direction&&this._mediaObject.rids.push({id:e.id,direction:"recv"})}this._mediaObject.rtcpMux="rtcp-mux",this._mediaObject.rtcpRsize="rtcp-rsize",this._planB&&"video"===this._mediaObject.type&&(this._mediaObject.xGoogleFlag="conference");break;case"application":"number"==typeof r.sctpPort?(this._mediaObject.payloads="webrtc-datachannel",this._mediaObject.sctpPort=n.port,this._mediaObject.maxMessageSize=n.maxMessageSize):r.sctpmap&&(this._mediaObject.payloads=n.port,this._mediaObject.sctpmap={app:"webrtc-datachannel",sctpmapNumber:n.port,maxMessageSize:n.maxMessageSize})}}setDtlsRole(e){switch(e){case"client":this._mediaObject.setup="active";break;case"server":this._mediaObject.setup="passive";break;case"auto":this._mediaObject.setup="actpass"}}resume(){this._mediaObject.direction="recvonly"}muxSimulcastStreams(e){var t;if(!this._mediaObject.simulcast||!this._mediaObject.simulcast.list1)return;const i={};for(const t of e)t.rid&&(i[t.rid]=t);const n=this._mediaObject.simulcast.list1,s=od.parseSimulcastStreamList(n);for(const e of s)for(const n of e)n.paused=!(null===(t=i[n.scid])||void 0===t?void 0:t.active);this._mediaObject.simulcast.list1=s.map((e=>e.map((e=>`${e.paused?"~":""}${e.scid}`)).join(","))).join(";")}};function dd(e){const t=new RegExp("^(audio|video)/(.+)","i").exec(e.mimeType);if(!t)throw new TypeError("invalid codec.mimeType");return t[2]}nd.OfferMediaSection=class extends pd{constructor({iceParameters:e,iceCandidates:t,dtlsParameters:i,sctpParameters:n,plainRtpParameters:s,planB:a=!1,mid:r,kind:o,offerRtpParameters:c,streamId:p,trackId:d,oldDataChannelSpec:l=!1}){switch(super({iceParameters:e,iceCandidates:t,dtlsParameters:i,planB:a}),this._mediaObject.mid=String(r),this._mediaObject.type=o,s?(this._mediaObject.connection={ip:s.ip,version:s.ipVersion},this._mediaObject.protocol="RTP/AVP",this._mediaObject.port=s.port):(this._mediaObject.connection={ip:"127.0.0.1",version:4},this._mediaObject.protocol=n?"UDP/DTLS/SCTP":"UDP/TLS/RTP/SAVPF",this._mediaObject.port=7),o){case"audio":case"video":{this._mediaObject.direction="sendonly",this._mediaObject.rtp=[],this._mediaObject.rtcpFb=[],this._mediaObject.fmtp=[],this._planB||(this._mediaObject.msid=`${p||"-"} ${d}`);for(const e of c.codecs){const t={payload:e.payloadType,codec:dd(e),rate:e.clockRate};e.channels>1&&(t.encoding=e.channels),this._mediaObject.rtp.push(t);const i={payload:e.payloadType,config:""};for(const t of Object.keys(e.parameters))i.config&&(i.config+=";"),i.config+=`${t}=${e.parameters[t]}`;i.config&&this._mediaObject.fmtp.push(i);for(const t of e.rtcpFeedback)this._mediaObject.rtcpFb.push({payload:e.payloadType,type:t.type,subtype:t.parameter})}this._mediaObject.payloads=c.codecs.map((e=>e.payloadType)).join(" "),this._mediaObject.ext=[];for(const e of c.headerExtensions)this._mediaObject.ext.push({uri:e.uri,value:e.id});this._mediaObject.rtcpMux="rtcp-mux",this._mediaObject.rtcpRsize="rtcp-rsize";const e=c.encodings[0],t=e.ssrc,i=e.rtx&&e.rtx.ssrc?e.rtx.ssrc:void 0;this._mediaObject.ssrcs=[],this._mediaObject.ssrcGroups=[],c.rtcp.cname&&this._mediaObject.ssrcs.push({id:t,attribute:"cname",value:c.rtcp.cname}),this._planB&&this._mediaObject.ssrcs.push({id:t,attribute:"msid",value:`${p||"-"} ${d}`}),i&&(c.rtcp.cname&&this._mediaObject.ssrcs.push({id:i,attribute:"cname",value:c.rtcp.cname}),this._planB&&this._mediaObject.ssrcs.push({id:i,attribute:"msid",value:`${p||"-"} ${d}`}),this._mediaObject.ssrcGroups.push({semantics:"FID",ssrcs:`${t} ${i}`}));break}case"application":l?(this._mediaObject.payloads=n.port,this._mediaObject.sctpmap={app:"webrtc-datachannel",sctpmapNumber:n.port,maxMessageSize:n.maxMessageSize}):(this._mediaObject.payloads="webrtc-datachannel",this._mediaObject.sctpPort=n.port,this._mediaObject.maxMessageSize=n.maxMessageSize)}}setDtlsRole(e){this._mediaObject.setup="actpass"}resume(){this._mediaObject.direction="sendonly"}planBReceive({offerRtpParameters:e,streamId:t,trackId:i}){const n=e.encodings[0],s=n.ssrc,a=n.rtx&&n.rtx.ssrc?n.rtx.ssrc:void 0,r=this._mediaObject.payloads.split(" ");for(const t of e.codecs){if(r.includes(String(t.payloadType)))continue;const e={payload:t.payloadType,codec:dd(t),rate:t.clockRate};t.channels>1&&(e.encoding=t.channels),this._mediaObject.rtp.push(e);const i={payload:t.payloadType,config:""};for(const e of Object.keys(t.parameters))i.config&&(i.config+=";"),i.config+=`${e}=${t.parameters[e]}`;i.config&&this._mediaObject.fmtp.push(i);for(const e of t.rtcpFeedback)this._mediaObject.rtcpFb.push({payload:t.payloadType,type:e.type,subtype:e.parameter})}this._mediaObject.payloads+=` ${e.codecs.filter((e=>!this._mediaObject.payloads.includes(e.payloadType))).map((e=>e.payloadType)).join(" ")}`,this._mediaObject.payloads=this._mediaObject.payloads.trim(),e.rtcp.cname&&this._mediaObject.ssrcs.push({id:s,attribute:"cname",value:e.rtcp.cname}),this._mediaObject.ssrcs.push({id:s,attribute:"msid",value:`${t||"-"} ${i}`}),a&&(e.rtcp.cname&&this._mediaObject.ssrcs.push({id:a,attribute:"cname",value:e.rtcp.cname}),this._mediaObject.ssrcs.push({id:a,attribute:"msid",value:`${t||"-"} ${i}`}),this._mediaObject.ssrcGroups.push({semantics:"FID",ssrcs:`${s} ${a}`}))}planBStopReceiving({offerRtpParameters:e}){const t=e.encodings[0],i=t.ssrc,n=t.rtx&&t.rtx.ssrc?t.rtx.ssrc:void 0;this._mediaObject.ssrcs=this._mediaObject.ssrcs.filter((e=>e.id!==i&&e.id!==n)),n&&(this._mediaObject.ssrcGroups=this._mediaObject.ssrcGroups.filter((e=>e.ssrcs!==`${i} ${n}`)))}};var ld=ei&&ei.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,s)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),ud=ei&&ei.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),md=ei&&ei.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&ld(t,e,i);return ud(t,e),t};Object.defineProperty(id,"__esModule",{value:!0}),id.RemoteSdp=void 0;const hd=md(Lp),fd=nd,gd=new oc.Logger("RemoteSdp");id.RemoteSdp=class{constructor({iceParameters:e,iceCandidates:t,dtlsParameters:i,sctpParameters:n,plainRtpParameters:s,planB:a=!1}){if(this._mediaSections=[],this._midToIndex=new Map,this._iceParameters=e,this._iceCandidates=t,this._dtlsParameters=i,this._sctpParameters=n,this._plainRtpParameters=s,this._planB=a,this._sdpObject={version:0,origin:{address:"0.0.0.0",ipVer:4,netType:"IN",sessionId:1e4,sessionVersion:0,username:"mediasoup-client"},name:"-",timing:{start:0,stop:0},media:[]},e&&e.iceLite&&(this._sdpObject.icelite="ice-lite"),i){this._sdpObject.msidSemantic={semantic:"WMS",token:"*"};const e=this._dtlsParameters.fingerprints.length;this._sdpObject.fingerprint={type:i.fingerprints[e-1].algorithm,hash:i.fingerprints[e-1].value},this._sdpObject.groups=[{type:"BUNDLE",mids:""}]}s&&(this._sdpObject.origin.address=s.ip,this._sdpObject.origin.ipVer=s.ipVersion)}updateIceParameters(e){gd.debug("updateIceParameters() [iceParameters:%o]",e),this._iceParameters=e,this._sdpObject.icelite=e.iceLite?"ice-lite":void 0;for(const t of this._mediaSections)t.setIceParameters(e)}updateDtlsRole(e){gd.debug("updateDtlsRole() [role:%s]",e),this._dtlsParameters.role=e;for(const t of this._mediaSections)t.setDtlsRole(e)}getNextMediaSectionIdx(){for(let e=0;e<this._mediaSections.length;++e){const t=this._mediaSections[e];if(t.closed)return{idx:e,reuseMid:t.mid}}return{idx:this._mediaSections.length}}send({offerMediaObject:e,reuseMid:t,offerRtpParameters:i,answerRtpParameters:n,codecOptions:s,extmapAllowMixed:a=!1}){const r=new fd.AnswerMediaSection({iceParameters:this._iceParameters,iceCandidates:this._iceCandidates,dtlsParameters:this._dtlsParameters,plainRtpParameters:this._plainRtpParameters,planB:this._planB,offerMediaObject:e,offerRtpParameters:i,answerRtpParameters:n,codecOptions:s,extmapAllowMixed:a});t?this._replaceMediaSection(r,t):this._midToIndex.has(r.mid)?this._replaceMediaSection(r):this._addMediaSection(r)}receive({mid:e,kind:t,offerRtpParameters:i,streamId:n,trackId:s}){const a=this._midToIndex.get(e);let r;if(void 0!==a&&(r=this._mediaSections[a]),r)r.planBReceive({offerRtpParameters:i,streamId:n,trackId:s}),this._replaceMediaSection(r);else{r=new fd.OfferMediaSection({iceParameters:this._iceParameters,iceCandidates:this._iceCandidates,dtlsParameters:this._dtlsParameters,plainRtpParameters:this._plainRtpParameters,planB:this._planB,mid:e,kind:t,offerRtpParameters:i,streamId:n,trackId:s});const a=this._mediaSections.find((e=>e.closed));a?this._replaceMediaSection(r,a.mid):this._addMediaSection(r)}}pauseMediaSection(e){this._findMediaSection(e).pause()}resumeSendingMediaSection(e){this._findMediaSection(e).resume()}resumeReceivingMediaSection(e){this._findMediaSection(e).resume()}disableMediaSection(e){this._findMediaSection(e).disable()}closeMediaSection(e){const t=this._findMediaSection(e);return e===this._firstMid?(gd.debug("closeMediaSection() | cannot close first media section, disabling it instead [mid:%s]",e),this.disableMediaSection(e),!1):(t.close(),this._regenerateBundleMids(),!0)}muxMediaSectionSimulcast(e,t){const i=this._findMediaSection(e);i.muxSimulcastStreams(t),this._replaceMediaSection(i)}planBStopReceiving({mid:e,offerRtpParameters:t}){const i=this._findMediaSection(e);i.planBStopReceiving({offerRtpParameters:t}),this._replaceMediaSection(i)}sendSctpAssociation({offerMediaObject:e}){const t=new fd.AnswerMediaSection({iceParameters:this._iceParameters,iceCandidates:this._iceCandidates,dtlsParameters:this._dtlsParameters,sctpParameters:this._sctpParameters,plainRtpParameters:this._plainRtpParameters,offerMediaObject:e});this._addMediaSection(t)}receiveSctpAssociation({oldDataChannelSpec:e=!1}={}){const t=new fd.OfferMediaSection({iceParameters:this._iceParameters,iceCandidates:this._iceCandidates,dtlsParameters:this._dtlsParameters,sctpParameters:this._sctpParameters,plainRtpParameters:this._plainRtpParameters,mid:"datachannel",kind:"application",oldDataChannelSpec:e});this._addMediaSection(t)}getSdp(){return this._sdpObject.origin.sessionVersion++,hd.write(this._sdpObject)}_addMediaSection(e){this._firstMid||(this._firstMid=e.mid),this._mediaSections.push(e),this._midToIndex.set(e.mid,this._mediaSections.length-1),this._sdpObject.media.push(e.getObject()),this._regenerateBundleMids()}_replaceMediaSection(e,t){if("string"==typeof t){const i=this._midToIndex.get(t);if(void 0===i)throw new Error(`no media section found for reuseMid '${t}'`);const n=this._mediaSections[i];this._mediaSections[i]=e,this._midToIndex.delete(n.mid),this._midToIndex.set(e.mid,i),this._sdpObject.media[i]=e.getObject(),this._regenerateBundleMids()}else{const t=this._midToIndex.get(e.mid);if(void 0===t)throw new Error(`no media section found with mid '${e.mid}'`);this._mediaSections[t]=e,this._sdpObject.media[t]=e.getObject()}}_findMediaSection(e){const t=this._midToIndex.get(e);if(void 0===t)throw new Error(`no media section found with mid '${e}'`);return this._mediaSections[t]}_regenerateBundleMids(){this._dtlsParameters&&(this._sdpObject.groups[0].mids=this._mediaSections.filter((e=>!e.closed)).map((e=>e.mid)).join(" "))}};var vd={};Object.defineProperty(vd,"__esModule",{value:!0}),vd.parse=void 0;const bd=new RegExp("^[LS]([1-9]\\d{0,1})T([1-9]\\d{0,1})");vd.parse=function(e){const t=bd.exec(e||"");return t?{spatialLayers:Number(t[1]),temporalLayers:Number(t[2])}:{spatialLayers:1,temporalLayers:1}};var _d=ei&&ei.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,s)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),yd=ei&&ei.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),xd=ei&&ei.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&_d(t,e,i);return yd(t,e),t};Object.defineProperty(jp,"__esModule",{value:!0}),jp.Chrome111=void 0;const wd=xd(Lp),Sd=oc,Rd=xd(bc),Cd=xd(_c),kd=xd(Hp),Td=xd(Yp),Pd=xd(Xp),Ed=Zp,Od=id,Dd=vd,Id=new Sd.Logger("Chrome111"),jd={OS:1024,MIS:1024};class Ld extends Ed.HandlerInterface{static createFactory(){return()=>new Ld}constructor(){super(),this._mapMidTransceiver=new Map,this._sendStream=new MediaStream,this._hasDataChannelMediaSection=!1,this._nextSendSctpStreamId=0,this._transportReady=!1}get name(){return"Chrome111"}close(){if(Id.debug("close()"),this._pc)try{this._pc.close()}catch(e){}this.emit("@close")}async getNativeRtpCapabilities(){Id.debug("getNativeRtpCapabilities()");const e=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"});try{e.addTransceiver("audio"),e.addTransceiver("video");const t=await e.createOffer();try{e.close()}catch(e){}const i=wd.parse(t.sdp),n=kd.extractRtpCapabilities({sdpObject:i});return Pd.addNackSuppportForOpus(n),n}catch(t){try{e.close()}catch(e){}throw t}}async getNativeSctpCapabilities(){return Id.debug("getNativeSctpCapabilities()"),{numStreams:jd}}run({direction:e,iceParameters:t,iceCandidates:i,dtlsParameters:n,sctpParameters:s,iceServers:a,iceTransportPolicy:r,additionalSettings:o,proprietaryConstraints:c,extendedRtpCapabilities:p}){Id.debug("run()"),this._direction=e,this._remoteSdp=new Od.RemoteSdp({iceParameters:t,iceCandidates:i,dtlsParameters:n,sctpParameters:s}),this._sendingRtpParametersByKind={audio:Cd.getSendingRtpParameters("audio",p),video:Cd.getSendingRtpParameters("video",p)},this._sendingRemoteRtpParametersByKind={audio:Cd.getSendingRemoteRtpParameters("audio",p),video:Cd.getSendingRemoteRtpParameters("video",p)},n.role&&"auto"!==n.role&&(this._forcedLocalDtlsRole="server"===n.role?"client":"server"),this._pc=new RTCPeerConnection({iceServers:a||[],iceTransportPolicy:r||"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",...o},c),this._pc.connectionState?this._pc.addEventListener("connectionstatechange",(()=>{this.emit("@connectionstatechange",this._pc.connectionState)})):(Id.warn("run() | pc.connectionState not supported, using pc.iceConnectionState"),this._pc.addEventListener("iceconnectionstatechange",(()=>{switch(this._pc.iceConnectionState){case"checking":this.emit("@connectionstatechange","connecting");break;case"connected":case"completed":this.emit("@connectionstatechange","connected");break;case"failed":this.emit("@connectionstatechange","failed");break;case"disconnected":this.emit("@connectionstatechange","disconnected");break;case"closed":this.emit("@connectionstatechange","closed")}})))}async updateIceServers(e){Id.debug("updateIceServers()");const t=this._pc.getConfiguration();t.iceServers=e,this._pc.setConfiguration(t)}async restartIce(e){if(Id.debug("restartIce()"),this._remoteSdp.updateIceParameters(e),this._transportReady)if("send"===this._direction){const e=await this._pc.createOffer({iceRestart:!0});Id.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e);const t={type:"answer",sdp:this._remoteSdp.getSdp()};Id.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setRemoteDescription(t)}else{const e={type:"offer",sdp:this._remoteSdp.getSdp()};Id.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();Id.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",t),await this._pc.setLocalDescription(t)}}async getTransportStats(){return this._pc.getStats()}async send({track:e,encodings:t,codecOptions:i,codec:n}){var s;if(this.assertSendDirection(),Id.debug("send() [kind:%s, track.id:%s]",e.kind,e.id),t&&t.length>1){t.forEach(((e,t)=>{e.rid=`r${t}`}));let e=1,i=1;for(const e of t){const t=e.scalabilityMode?(0,Dd.parse)(e.scalabilityMode).temporalLayers:3;t>i&&(i=t)}for(const n of t)n.rid="r"+e++,n.scalabilityMode=`L1T${i}`}const a=Rd.clone(this._sendingRtpParametersByKind[e.kind],{});a.codecs=Cd.reduceCodecs(a.codecs,n);const r=Rd.clone(this._sendingRemoteRtpParametersByKind[e.kind],{});r.codecs=Cd.reduceCodecs(r.codecs,n);const o=this._remoteSdp.getNextMediaSectionIdx(),c=this._pc.addTransceiver(e,{direction:"sendonly",streams:[this._sendStream],sendEncodings:t}),p=await this._pc.createOffer();let d=wd.parse(p.sdp);this._transportReady||await this.setupTransport({localDtlsRole:null!==(s=this._forcedLocalDtlsRole)&&void 0!==s?s:"client",localSdpObject:d}),Id.debug("send() | calling pc.setLocalDescription() [offer:%o]",p),await this._pc.setLocalDescription(p);const l=c.mid;a.mid=l,d=wd.parse(this._pc.localDescription.sdp);const u=d.media[o.idx];if(a.rtcp.cname=kd.getCname({offerMediaObject:u}),t)if(1===t.length){const e=Td.getRtpEncodings({offerMediaObject:u});Object.assign(e[0],t[0]),a.encodings=e}else a.encodings=t;else a.encodings=Td.getRtpEncodings({offerMediaObject:u});this._remoteSdp.send({offerMediaObject:u,reuseMid:o.reuseMid,offerRtpParameters:a,answerRtpParameters:r,codecOptions:i,extmapAllowMixed:!0});const m={type:"answer",sdp:this._remoteSdp.getSdp()};return Id.debug("send() | calling pc.setRemoteDescription() [answer:%o]",m),await this._pc.setRemoteDescription(m),this._mapMidTransceiver.set(l,c),{localId:l,rtpParameters:a,rtpSender:c.sender}}async stopSending(e){this.assertSendDirection(),Id.debug("stopSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");t.sender.replaceTrack(null),this._pc.removeTrack(t.sender);if(this._remoteSdp.closeMediaSection(t.mid))try{t.stop()}catch(e){}const i=await this._pc.createOffer();Id.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",i),await this._pc.setLocalDescription(i);const n={type:"answer",sdp:this._remoteSdp.getSdp()};Id.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",n),await this._pc.setRemoteDescription(n),this._mapMidTransceiver.delete(e)}async pauseSending(e){this.assertSendDirection(),Id.debug("pauseSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");t.direction="inactive",this._remoteSdp.pauseMediaSection(e);const i=await this._pc.createOffer();Id.debug("pauseSending() | calling pc.setLocalDescription() [offer:%o]",i),await this._pc.setLocalDescription(i);const n={type:"answer",sdp:this._remoteSdp.getSdp()};Id.debug("pauseSending() | calling pc.setRemoteDescription() [answer:%o]",n),await this._pc.setRemoteDescription(n)}async resumeSending(e){this.assertSendDirection(),Id.debug("resumeSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(this._remoteSdp.resumeSendingMediaSection(e),!t)throw new Error("associated RTCRtpTransceiver not found");t.direction="sendonly";const i=await this._pc.createOffer();Id.debug("resumeSending() | calling pc.setLocalDescription() [offer:%o]",i),await this._pc.setLocalDescription(i);const n={type:"answer",sdp:this._remoteSdp.getSdp()};Id.debug("resumeSending() | calling pc.setRemoteDescription() [answer:%o]",n),await this._pc.setRemoteDescription(n)}async replaceTrack(e,t){this.assertSendDirection(),t?Id.debug("replaceTrack() [localId:%s, track.id:%s]",e,t.id):Id.debug("replaceTrack() [localId:%s, no track]",e);const i=this._mapMidTransceiver.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");await i.sender.replaceTrack(t)}async setMaxSpatialLayer(e,t){this.assertSendDirection(),Id.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",e,t);const i=this._mapMidTransceiver.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");const n=i.sender.getParameters();n.encodings.forEach(((e,i)=>{e.active=i<=t})),await i.sender.setParameters(n),this._remoteSdp.muxMediaSectionSimulcast(e,n.encodings);const s=await this._pc.createOffer();Id.debug("setMaxSpatialLayer() | calling pc.setLocalDescription() [offer:%o]",s),await this._pc.setLocalDescription(s);const a={type:"answer",sdp:this._remoteSdp.getSdp()};Id.debug("setMaxSpatialLayer() | calling pc.setRemoteDescription() [answer:%o]",a),await this._pc.setRemoteDescription(a)}async setRtpEncodingParameters(e,t){this.assertSendDirection(),Id.debug("setRtpEncodingParameters() [localId:%s, params:%o]",e,t);const i=this._mapMidTransceiver.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");const n=i.sender.getParameters();n.encodings.forEach(((e,i)=>{n.encodings[i]={...e,...t}})),await i.sender.setParameters(n),this._remoteSdp.muxMediaSectionSimulcast(e,n.encodings);const s=await this._pc.createOffer();Id.debug("setRtpEncodingParameters() | calling pc.setLocalDescription() [offer:%o]",s),await this._pc.setLocalDescription(s);const a={type:"answer",sdp:this._remoteSdp.getSdp()};Id.debug("setRtpEncodingParameters() | calling pc.setRemoteDescription() [answer:%o]",a),await this._pc.setRemoteDescription(a)}async getSenderStats(e){this.assertSendDirection();const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.sender.getStats()}async sendDataChannel({ordered:e,maxPacketLifeTime:t,maxRetransmits:i,label:n,protocol:s}){var a;this.assertSendDirection();const r={negotiated:!0,id:this._nextSendSctpStreamId,ordered:e,maxPacketLifeTime:t,maxRetransmits:i,protocol:s};Id.debug("sendDataChannel() [options:%o]",r);const o=this._pc.createDataChannel(n,r);if(this._nextSendSctpStreamId=++this._nextSendSctpStreamId%jd.MIS,!this._hasDataChannelMediaSection){const e=await this._pc.createOffer(),t=wd.parse(e.sdp),i=t.media.find((e=>"application"===e.type));this._transportReady||await this.setupTransport({localDtlsRole:null!==(a=this._forcedLocalDtlsRole)&&void 0!==a?a:"client",localSdpObject:t}),Id.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e),this._remoteSdp.sendSctpAssociation({offerMediaObject:i});const n={type:"answer",sdp:this._remoteSdp.getSdp()};Id.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",n),await this._pc.setRemoteDescription(n),this._hasDataChannelMediaSection=!0}return{dataChannel:o,sctpStreamParameters:{streamId:r.id,ordered:r.ordered,maxPacketLifeTime:r.maxPacketLifeTime,maxRetransmits:r.maxRetransmits}}}async receive(e){var t;this.assertRecvDirection();const i=[],n=new Map;for(const t of e){const{trackId:e,kind:i,rtpParameters:s,streamId:a}=t;Id.debug("receive() [trackId:%s, kind:%s]",e,i);const r=s.mid||String(this._mapMidTransceiver.size);n.set(e,r),this._remoteSdp.receive({mid:r,kind:i,offerRtpParameters:s,streamId:a||s.rtcp.cname,trackId:e})}const s={type:"offer",sdp:this._remoteSdp.getSdp()};Id.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",s),await this._pc.setRemoteDescription(s);let a=await this._pc.createAnswer();const r=wd.parse(a.sdp);for(const t of e){const{trackId:e,rtpParameters:i}=t,s=n.get(e),a=r.media.find((e=>String(e.mid)===s));kd.applyCodecParameters({offerRtpParameters:i,answerMediaObject:a})}a={type:"answer",sdp:wd.write(r)},this._transportReady||await this.setupTransport({localDtlsRole:null!==(t=this._forcedLocalDtlsRole)&&void 0!==t?t:"client",localSdpObject:r}),Id.debug("receive() | calling pc.setLocalDescription() [answer:%o]",a),await this._pc.setLocalDescription(a);for(const t of e){const{trackId:e}=t,s=n.get(e),a=this._pc.getTransceivers().find((e=>e.mid===s));if(!a)throw new Error("new RTCRtpTransceiver not found");this._mapMidTransceiver.set(s,a),i.push({localId:s,track:a.receiver.track,rtpReceiver:a.receiver})}return i}async stopReceiving(e){this.assertRecvDirection();for(const t of e){Id.debug("stopReceiving() [localId:%s]",t);const e=this._mapMidTransceiver.get(t);if(!e)throw new Error("associated RTCRtpTransceiver not found");this._remoteSdp.closeMediaSection(e.mid)}const t={type:"offer",sdp:this._remoteSdp.getSdp()};Id.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const i=await this._pc.createAnswer();Id.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",i),await this._pc.setLocalDescription(i);for(const t of e)this._mapMidTransceiver.delete(t)}async pauseReceiving(e){this.assertRecvDirection();for(const t of e){Id.debug("pauseReceiving() [localId:%s]",t);const e=this._mapMidTransceiver.get(t);if(!e)throw new Error("associated RTCRtpTransceiver not found");e.direction="inactive",this._remoteSdp.pauseMediaSection(t)}const t={type:"offer",sdp:this._remoteSdp.getSdp()};Id.debug("pauseReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const i=await this._pc.createAnswer();Id.debug("pauseReceiving() | calling pc.setLocalDescription() [answer:%o]",i),await this._pc.setLocalDescription(i)}async resumeReceiving(e){this.assertRecvDirection();for(const t of e){Id.debug("resumeReceiving() [localId:%s]",t);const e=this._mapMidTransceiver.get(t);if(!e)throw new Error("associated RTCRtpTransceiver not found");e.direction="recvonly",this._remoteSdp.resumeReceivingMediaSection(t)}const t={type:"offer",sdp:this._remoteSdp.getSdp()};Id.debug("resumeReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const i=await this._pc.createAnswer();Id.debug("resumeReceiving() | calling pc.setLocalDescription() [answer:%o]",i),await this._pc.setLocalDescription(i)}async getReceiverStats(e){this.assertRecvDirection();const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.receiver.getStats()}async receiveDataChannel({sctpStreamParameters:e,label:t,protocol:i}){var n;this.assertRecvDirection();const{streamId:s,ordered:a,maxPacketLifeTime:r,maxRetransmits:o}=e,c={negotiated:!0,id:s,ordered:a,maxPacketLifeTime:r,maxRetransmits:o,protocol:i};Id.debug("receiveDataChannel() [options:%o]",c);const p=this._pc.createDataChannel(t,c);if(!this._hasDataChannelMediaSection){this._remoteSdp.receiveSctpAssociation();const e={type:"offer",sdp:this._remoteSdp.getSdp()};Id.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();if(!this._transportReady){const e=wd.parse(t.sdp);await this.setupTransport({localDtlsRole:null!==(n=this._forcedLocalDtlsRole)&&void 0!==n?n:"client",localSdpObject:e})}Id.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setLocalDescription(t),this._hasDataChannelMediaSection=!0}return{dataChannel:p}}async setupTransport({localDtlsRole:e,localSdpObject:t}){t||(t=wd.parse(this._pc.localDescription.sdp));const i=kd.extractDtlsParameters({sdpObject:t});i.role=e,this._remoteSdp.updateDtlsRole("client"===e?"server":"client"),await new Promise(((e,t)=>{this.safeEmit("@connect",{dtlsParameters:i},e,t)})),this._transportReady=!0}assertSendDirection(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}assertRecvDirection(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}}jp.Chrome111=Ld;var Md={},Ad=ei&&ei.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,s)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),Nd=ei&&ei.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Bd=ei&&ei.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&Ad(t,e,i);return Nd(t,e),t};Object.defineProperty(Md,"__esModule",{value:!0}),Md.Chrome74=void 0;const Fd=Bd(Lp),Ud=oc,zd=Bd(bc),qd=Bd(_c),$d=Bd(Hp),Vd=Bd(Yp),Wd=Bd(Xp),Hd=Zp,Gd=id,Kd=vd,Jd=new Ud.Logger("Chrome74"),Qd={OS:1024,MIS:1024};class Yd extends Hd.HandlerInterface{static createFactory(){return()=>new Yd}constructor(){super(),this._mapMidTransceiver=new Map,this._sendStream=new MediaStream,this._hasDataChannelMediaSection=!1,this._nextSendSctpStreamId=0,this._transportReady=!1}get name(){return"Chrome74"}close(){if(Jd.debug("close()"),this._pc)try{this._pc.close()}catch(e){}this.emit("@close")}async getNativeRtpCapabilities(){Jd.debug("getNativeRtpCapabilities()");const e=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"});try{e.addTransceiver("audio"),e.addTransceiver("video");const t=await e.createOffer();try{e.close()}catch(e){}const i=Fd.parse(t.sdp),n=$d.extractRtpCapabilities({sdpObject:i});return Wd.addNackSuppportForOpus(n),n}catch(t){try{e.close()}catch(e){}throw t}}async getNativeSctpCapabilities(){return Jd.debug("getNativeSctpCapabilities()"),{numStreams:Qd}}run({direction:e,iceParameters:t,iceCandidates:i,dtlsParameters:n,sctpParameters:s,iceServers:a,iceTransportPolicy:r,additionalSettings:o,proprietaryConstraints:c,extendedRtpCapabilities:p}){Jd.debug("run()"),this._direction=e,this._remoteSdp=new Gd.RemoteSdp({iceParameters:t,iceCandidates:i,dtlsParameters:n,sctpParameters:s}),this._sendingRtpParametersByKind={audio:qd.getSendingRtpParameters("audio",p),video:qd.getSendingRtpParameters("video",p)},this._sendingRemoteRtpParametersByKind={audio:qd.getSendingRemoteRtpParameters("audio",p),video:qd.getSendingRemoteRtpParameters("video",p)},n.role&&"auto"!==n.role&&(this._forcedLocalDtlsRole="server"===n.role?"client":"server"),this._pc=new RTCPeerConnection({iceServers:a||[],iceTransportPolicy:r||"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",...o},c),this._pc.connectionState?this._pc.addEventListener("connectionstatechange",(()=>{this.emit("@connectionstatechange",this._pc.connectionState)})):(Jd.warn("run() | pc.connectionState not supported, using pc.iceConnectionState"),this._pc.addEventListener("iceconnectionstatechange",(()=>{switch(this._pc.iceConnectionState){case"checking":this.emit("@connectionstatechange","connecting");break;case"connected":case"completed":this.emit("@connectionstatechange","connected");break;case"failed":this.emit("@connectionstatechange","failed");break;case"disconnected":this.emit("@connectionstatechange","disconnected");break;case"closed":this.emit("@connectionstatechange","closed")}})))}async updateIceServers(e){Jd.debug("updateIceServers()");const t=this._pc.getConfiguration();t.iceServers=e,this._pc.setConfiguration(t)}async restartIce(e){if(Jd.debug("restartIce()"),this._remoteSdp.updateIceParameters(e),this._transportReady)if("send"===this._direction){const e=await this._pc.createOffer({iceRestart:!0});Jd.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e);const t={type:"answer",sdp:this._remoteSdp.getSdp()};Jd.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setRemoteDescription(t)}else{const e={type:"offer",sdp:this._remoteSdp.getSdp()};Jd.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();Jd.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",t),await this._pc.setLocalDescription(t)}}async getTransportStats(){return this._pc.getStats()}async send({track:e,encodings:t,codecOptions:i,codec:n}){var s;this.assertSendDirection(),Jd.debug("send() [kind:%s, track.id:%s]",e.kind,e.id),t&&t.length>1&&t.forEach(((e,t)=>{e.rid=`r${t}`}));const a=zd.clone(this._sendingRtpParametersByKind[e.kind],{});a.codecs=qd.reduceCodecs(a.codecs,n);const r=zd.clone(this._sendingRemoteRtpParametersByKind[e.kind],{});r.codecs=qd.reduceCodecs(r.codecs,n);const o=this._remoteSdp.getNextMediaSectionIdx(),c=this._pc.addTransceiver(e,{direction:"sendonly",streams:[this._sendStream],sendEncodings:t});let p,d=await this._pc.createOffer(),l=Fd.parse(d.sdp);this._transportReady||await this.setupTransport({localDtlsRole:null!==(s=this._forcedLocalDtlsRole)&&void 0!==s?s:"client",localSdpObject:l});let u=!1;const m=(0,Kd.parse)((t||[{}])[0].scalabilityMode);t&&1===t.length&&m.spatialLayers>1&&"video/vp9"===a.codecs[0].mimeType.toLowerCase()&&(Jd.debug("send() | enabling legacy simulcast for VP9 SVC"),u=!0,l=Fd.parse(d.sdp),p=l.media[o.idx],Vd.addLegacySimulcast({offerMediaObject:p,numStreams:m.spatialLayers}),d={type:"offer",sdp:Fd.write(l)}),Jd.debug("send() | calling pc.setLocalDescription() [offer:%o]",d),await this._pc.setLocalDescription(d);const h=c.mid;if(a.mid=h,l=Fd.parse(this._pc.localDescription.sdp),p=l.media[o.idx],a.rtcp.cname=$d.getCname({offerMediaObject:p}),t)if(1===t.length){let e=Vd.getRtpEncodings({offerMediaObject:p});Object.assign(e[0],t[0]),u&&(e=[e[0]]),a.encodings=e}else a.encodings=t;else a.encodings=Vd.getRtpEncodings({offerMediaObject:p});if(a.encodings.length>1&&("video/vp8"===a.codecs[0].mimeType.toLowerCase()||"video/h264"===a.codecs[0].mimeType.toLowerCase()))for(const e of a.encodings)e.scalabilityMode?e.scalabilityMode=`L1T${m.temporalLayers}`:e.scalabilityMode="L1T3";this._remoteSdp.send({offerMediaObject:p,reuseMid:o.reuseMid,offerRtpParameters:a,answerRtpParameters:r,codecOptions:i,extmapAllowMixed:!0});const f={type:"answer",sdp:this._remoteSdp.getSdp()};return Jd.debug("send() | calling pc.setRemoteDescription() [answer:%o]",f),await this._pc.setRemoteDescription(f),this._mapMidTransceiver.set(h,c),{localId:h,rtpParameters:a,rtpSender:c.sender}}async stopSending(e){this.assertSendDirection(),Jd.debug("stopSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");t.sender.replaceTrack(null),this._pc.removeTrack(t.sender);if(this._remoteSdp.closeMediaSection(t.mid))try{t.stop()}catch(e){}const i=await this._pc.createOffer();Jd.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",i),await this._pc.setLocalDescription(i);const n={type:"answer",sdp:this._remoteSdp.getSdp()};Jd.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",n),await this._pc.setRemoteDescription(n),this._mapMidTransceiver.delete(e)}async pauseSending(e){this.assertSendDirection(),Jd.debug("pauseSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");t.direction="inactive",this._remoteSdp.pauseMediaSection(e);const i=await this._pc.createOffer();Jd.debug("pauseSending() | calling pc.setLocalDescription() [offer:%o]",i),await this._pc.setLocalDescription(i);const n={type:"answer",sdp:this._remoteSdp.getSdp()};Jd.debug("pauseSending() | calling pc.setRemoteDescription() [answer:%o]",n),await this._pc.setRemoteDescription(n)}async resumeSending(e){this.assertSendDirection(),Jd.debug("resumeSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(this._remoteSdp.resumeSendingMediaSection(e),!t)throw new Error("associated RTCRtpTransceiver not found");t.direction="sendonly";const i=await this._pc.createOffer();Jd.debug("resumeSending() | calling pc.setLocalDescription() [offer:%o]",i),await this._pc.setLocalDescription(i);const n={type:"answer",sdp:this._remoteSdp.getSdp()};Jd.debug("resumeSending() | calling pc.setRemoteDescription() [answer:%o]",n),await this._pc.setRemoteDescription(n)}async replaceTrack(e,t){this.assertSendDirection(),t?Jd.debug("replaceTrack() [localId:%s, track.id:%s]",e,t.id):Jd.debug("replaceTrack() [localId:%s, no track]",e);const i=this._mapMidTransceiver.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");await i.sender.replaceTrack(t)}async setMaxSpatialLayer(e,t){this.assertSendDirection(),Jd.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",e,t);const i=this._mapMidTransceiver.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");const n=i.sender.getParameters();n.encodings.forEach(((e,i)=>{e.active=i<=t})),await i.sender.setParameters(n),this._remoteSdp.muxMediaSectionSimulcast(e,n.encodings);const s=await this._pc.createOffer();Jd.debug("setMaxSpatialLayer() | calling pc.setLocalDescription() [offer:%o]",s),await this._pc.setLocalDescription(s);const a={type:"answer",sdp:this._remoteSdp.getSdp()};Jd.debug("setMaxSpatialLayer() | calling pc.setRemoteDescription() [answer:%o]",a),await this._pc.setRemoteDescription(a)}async setRtpEncodingParameters(e,t){this.assertSendDirection(),Jd.debug("setRtpEncodingParameters() [localId:%s, params:%o]",e,t);const i=this._mapMidTransceiver.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");const n=i.sender.getParameters();n.encodings.forEach(((e,i)=>{n.encodings[i]={...e,...t}})),await i.sender.setParameters(n),this._remoteSdp.muxMediaSectionSimulcast(e,n.encodings);const s=await this._pc.createOffer();Jd.debug("setRtpEncodingParameters() | calling pc.setLocalDescription() [offer:%o]",s),await this._pc.setLocalDescription(s);const a={type:"answer",sdp:this._remoteSdp.getSdp()};Jd.debug("setRtpEncodingParameters() | calling pc.setRemoteDescription() [answer:%o]",a),await this._pc.setRemoteDescription(a)}async getSenderStats(e){this.assertSendDirection();const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.sender.getStats()}async sendDataChannel({ordered:e,maxPacketLifeTime:t,maxRetransmits:i,label:n,protocol:s}){var a;this.assertSendDirection();const r={negotiated:!0,id:this._nextSendSctpStreamId,ordered:e,maxPacketLifeTime:t,maxRetransmits:i,protocol:s};Jd.debug("sendDataChannel() [options:%o]",r);const o=this._pc.createDataChannel(n,r);if(this._nextSendSctpStreamId=++this._nextSendSctpStreamId%Qd.MIS,!this._hasDataChannelMediaSection){const e=await this._pc.createOffer(),t=Fd.parse(e.sdp),i=t.media.find((e=>"application"===e.type));this._transportReady||await this.setupTransport({localDtlsRole:null!==(a=this._forcedLocalDtlsRole)&&void 0!==a?a:"client",localSdpObject:t}),Jd.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e),this._remoteSdp.sendSctpAssociation({offerMediaObject:i});const n={type:"answer",sdp:this._remoteSdp.getSdp()};Jd.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",n),await this._pc.setRemoteDescription(n),this._hasDataChannelMediaSection=!0}return{dataChannel:o,sctpStreamParameters:{streamId:r.id,ordered:r.ordered,maxPacketLifeTime:r.maxPacketLifeTime,maxRetransmits:r.maxRetransmits}}}async receive(e){var t;this.assertRecvDirection();const i=[],n=new Map;for(const t of e){const{trackId:e,kind:i,rtpParameters:s,streamId:a}=t;Jd.debug("receive() [trackId:%s, kind:%s]",e,i);const r=s.mid||String(this._mapMidTransceiver.size);n.set(e,r),this._remoteSdp.receive({mid:r,kind:i,offerRtpParameters:s,streamId:a||s.rtcp.cname,trackId:e})}const s={type:"offer",sdp:this._remoteSdp.getSdp()};Jd.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",s),await this._pc.setRemoteDescription(s);let a=await this._pc.createAnswer();const r=Fd.parse(a.sdp);for(const t of e){const{trackId:e,rtpParameters:i}=t,s=n.get(e),a=r.media.find((e=>String(e.mid)===s));$d.applyCodecParameters({offerRtpParameters:i,answerMediaObject:a})}a={type:"answer",sdp:Fd.write(r)},this._transportReady||await this.setupTransport({localDtlsRole:null!==(t=this._forcedLocalDtlsRole)&&void 0!==t?t:"client",localSdpObject:r}),Jd.debug("receive() | calling pc.setLocalDescription() [answer:%o]",a),await this._pc.setLocalDescription(a);for(const t of e){const{trackId:e}=t,s=n.get(e),a=this._pc.getTransceivers().find((e=>e.mid===s));if(!a)throw new Error("new RTCRtpTransceiver not found");this._mapMidTransceiver.set(s,a),i.push({localId:s,track:a.receiver.track,rtpReceiver:a.receiver})}return i}async stopReceiving(e){this.assertRecvDirection();for(const t of e){Jd.debug("stopReceiving() [localId:%s]",t);const e=this._mapMidTransceiver.get(t);if(!e)throw new Error("associated RTCRtpTransceiver not found");this._remoteSdp.closeMediaSection(e.mid)}const t={type:"offer",sdp:this._remoteSdp.getSdp()};Jd.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const i=await this._pc.createAnswer();Jd.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",i),await this._pc.setLocalDescription(i);for(const t of e)this._mapMidTransceiver.delete(t)}async pauseReceiving(e){this.assertRecvDirection();for(const t of e){Jd.debug("pauseReceiving() [localId:%s]",t);const e=this._mapMidTransceiver.get(t);if(!e)throw new Error("associated RTCRtpTransceiver not found");e.direction="inactive",this._remoteSdp.pauseMediaSection(t)}const t={type:"offer",sdp:this._remoteSdp.getSdp()};Jd.debug("pauseReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const i=await this._pc.createAnswer();Jd.debug("pauseReceiving() | calling pc.setLocalDescription() [answer:%o]",i),await this._pc.setLocalDescription(i)}async resumeReceiving(e){this.assertRecvDirection();for(const t of e){Jd.debug("resumeReceiving() [localId:%s]",t);const e=this._mapMidTransceiver.get(t);if(!e)throw new Error("associated RTCRtpTransceiver not found");e.direction="recvonly",this._remoteSdp.resumeReceivingMediaSection(t)}const t={type:"offer",sdp:this._remoteSdp.getSdp()};Jd.debug("resumeReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const i=await this._pc.createAnswer();Jd.debug("resumeReceiving() | calling pc.setLocalDescription() [answer:%o]",i),await this._pc.setLocalDescription(i)}async getReceiverStats(e){this.assertRecvDirection();const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.receiver.getStats()}async receiveDataChannel({sctpStreamParameters:e,label:t,protocol:i}){var n;this.assertRecvDirection();const{streamId:s,ordered:a,maxPacketLifeTime:r,maxRetransmits:o}=e,c={negotiated:!0,id:s,ordered:a,maxPacketLifeTime:r,maxRetransmits:o,protocol:i};Jd.debug("receiveDataChannel() [options:%o]",c);const p=this._pc.createDataChannel(t,c);if(!this._hasDataChannelMediaSection){this._remoteSdp.receiveSctpAssociation();const e={type:"offer",sdp:this._remoteSdp.getSdp()};Jd.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();if(!this._transportReady){const e=Fd.parse(t.sdp);await this.setupTransport({localDtlsRole:null!==(n=this._forcedLocalDtlsRole)&&void 0!==n?n:"client",localSdpObject:e})}Jd.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setLocalDescription(t),this._hasDataChannelMediaSection=!0}return{dataChannel:p}}async setupTransport({localDtlsRole:e,localSdpObject:t}){t||(t=Fd.parse(this._pc.localDescription.sdp));const i=$d.extractDtlsParameters({sdpObject:t});i.role=e,this._remoteSdp.updateDtlsRole("client"===e?"server":"client"),await new Promise(((e,t)=>{this.safeEmit("@connect",{dtlsParameters:i},e,t)})),this._transportReady=!0}assertSendDirection(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}assertRecvDirection(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}}Md.Chrome74=Yd;var Xd={},Zd=ei&&ei.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,s)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),el=ei&&ei.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),tl=ei&&ei.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&Zd(t,e,i);return el(t,e),t};Object.defineProperty(Xd,"__esModule",{value:!0}),Xd.Chrome70=void 0;const il=tl(Lp),nl=oc,sl=tl(bc),al=tl(_c),rl=tl(Hp),ol=tl(Yp),cl=Zp,pl=id,dl=vd,ll=new nl.Logger("Chrome70"),ul={OS:1024,MIS:1024};class ml extends cl.HandlerInterface{static createFactory(){return()=>new ml}constructor(){super(),this._mapMidTransceiver=new Map,this._sendStream=new MediaStream,this._hasDataChannelMediaSection=!1,this._nextSendSctpStreamId=0,this._transportReady=!1}get name(){return"Chrome70"}close(){if(ll.debug("close()"),this._pc)try{this._pc.close()}catch(e){}this.emit("@close")}async getNativeRtpCapabilities(){ll.debug("getNativeRtpCapabilities()");const e=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"});try{e.addTransceiver("audio"),e.addTransceiver("video");const t=await e.createOffer();try{e.close()}catch(e){}const i=il.parse(t.sdp);return rl.extractRtpCapabilities({sdpObject:i})}catch(t){try{e.close()}catch(e){}throw t}}async getNativeSctpCapabilities(){return ll.debug("getNativeSctpCapabilities()"),{numStreams:ul}}run({direction:e,iceParameters:t,iceCandidates:i,dtlsParameters:n,sctpParameters:s,iceServers:a,iceTransportPolicy:r,additionalSettings:o,proprietaryConstraints:c,extendedRtpCapabilities:p}){ll.debug("run()"),this._direction=e,this._remoteSdp=new pl.RemoteSdp({iceParameters:t,iceCandidates:i,dtlsParameters:n,sctpParameters:s}),this._sendingRtpParametersByKind={audio:al.getSendingRtpParameters("audio",p),video:al.getSendingRtpParameters("video",p)},this._sendingRemoteRtpParametersByKind={audio:al.getSendingRemoteRtpParameters("audio",p),video:al.getSendingRemoteRtpParameters("video",p)},n.role&&"auto"!==n.role&&(this._forcedLocalDtlsRole="server"===n.role?"client":"server"),this._pc=new RTCPeerConnection({iceServers:a||[],iceTransportPolicy:r||"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",...o},c),this._pc.connectionState?this._pc.addEventListener("connectionstatechange",(()=>{this.emit("@connectionstatechange",this._pc.connectionState)})):this._pc.addEventListener("iceconnectionstatechange",(()=>{switch(ll.warn("run() | pc.connectionState not supported, using pc.iceConnectionState"),this._pc.iceConnectionState){case"checking":this.emit("@connectionstatechange","connecting");break;case"connected":case"completed":this.emit("@connectionstatechange","connected");break;case"failed":this.emit("@connectionstatechange","failed");break;case"disconnected":this.emit("@connectionstatechange","disconnected");break;case"closed":this.emit("@connectionstatechange","closed")}}))}async updateIceServers(e){ll.debug("updateIceServers()");const t=this._pc.getConfiguration();t.iceServers=e,this._pc.setConfiguration(t)}async restartIce(e){if(ll.debug("restartIce()"),this._remoteSdp.updateIceParameters(e),this._transportReady)if("send"===this._direction){const e=await this._pc.createOffer({iceRestart:!0});ll.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e);const t={type:"answer",sdp:this._remoteSdp.getSdp()};ll.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setRemoteDescription(t)}else{const e={type:"offer",sdp:this._remoteSdp.getSdp()};ll.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();ll.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",t),await this._pc.setLocalDescription(t)}}async getTransportStats(){return this._pc.getStats()}async send({track:e,encodings:t,codecOptions:i,codec:n}){var s;this.assertSendDirection(),ll.debug("send() [kind:%s, track.id:%s]",e.kind,e.id);const a=sl.clone(this._sendingRtpParametersByKind[e.kind],{});a.codecs=al.reduceCodecs(a.codecs,n);const r=sl.clone(this._sendingRemoteRtpParametersByKind[e.kind],{});r.codecs=al.reduceCodecs(r.codecs,n);const o=this._remoteSdp.getNextMediaSectionIdx(),c=this._pc.addTransceiver(e,{direction:"sendonly",streams:[this._sendStream]});let p,d=await this._pc.createOffer(),l=il.parse(d.sdp);this._transportReady||await this.setupTransport({localDtlsRole:null!==(s=this._forcedLocalDtlsRole)&&void 0!==s?s:"client",localSdpObject:l}),t&&t.length>1&&(ll.debug("send() | enabling legacy simulcast"),l=il.parse(d.sdp),p=l.media[o.idx],ol.addLegacySimulcast({offerMediaObject:p,numStreams:t.length}),d={type:"offer",sdp:il.write(l)});let u=!1;const m=(0,dl.parse)((t||[{}])[0].scalabilityMode);if(t&&1===t.length&&m.spatialLayers>1&&"video/vp9"===a.codecs[0].mimeType.toLowerCase()&&(ll.debug("send() | enabling legacy simulcast for VP9 SVC"),u=!0,l=il.parse(d.sdp),p=l.media[o.idx],ol.addLegacySimulcast({offerMediaObject:p,numStreams:m.spatialLayers}),d={type:"offer",sdp:il.write(l)}),ll.debug("send() | calling pc.setLocalDescription() [offer:%o]",d),await this._pc.setLocalDescription(d),t){ll.debug("send() | applying given encodings");const e=c.sender.getParameters();for(let i=0;i<(e.encodings||[]).length;++i){const n=e.encodings[i],s=t[i];if(!s)break;e.encodings[i]=Object.assign(n,s)}await c.sender.setParameters(e)}const h=c.mid;if(a.mid=h,l=il.parse(this._pc.localDescription.sdp),p=l.media[o.idx],a.rtcp.cname=rl.getCname({offerMediaObject:p}),a.encodings=ol.getRtpEncodings({offerMediaObject:p}),t)for(let e=0;e<a.encodings.length;++e)t[e]&&Object.assign(a.encodings[e],t[e]);if(u&&(a.encodings=[a.encodings[0]]),a.encodings.length>1&&("video/vp8"===a.codecs[0].mimeType.toLowerCase()||"video/h264"===a.codecs[0].mimeType.toLowerCase()))for(const e of a.encodings)e.scalabilityMode="L1T3";this._remoteSdp.send({offerMediaObject:p,reuseMid:o.reuseMid,offerRtpParameters:a,answerRtpParameters:r,codecOptions:i});const f={type:"answer",sdp:this._remoteSdp.getSdp()};return ll.debug("send() | calling pc.setRemoteDescription() [answer:%o]",f),await this._pc.setRemoteDescription(f),this._mapMidTransceiver.set(h,c),{localId:h,rtpParameters:a,rtpSender:c.sender}}async stopSending(e){this.assertSendDirection(),ll.debug("stopSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");t.sender.replaceTrack(null),this._pc.removeTrack(t.sender);if(this._remoteSdp.closeMediaSection(t.mid))try{t.stop()}catch(e){}const i=await this._pc.createOffer();ll.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",i),await this._pc.setLocalDescription(i);const n={type:"answer",sdp:this._remoteSdp.getSdp()};ll.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",n),await this._pc.setRemoteDescription(n),this._mapMidTransceiver.delete(e)}async pauseSending(e){}async resumeSending(e){}async replaceTrack(e,t){this.assertSendDirection(),t?ll.debug("replaceTrack() [localId:%s, track.id:%s]",e,t.id):ll.debug("replaceTrack() [localId:%s, no track]",e);const i=this._mapMidTransceiver.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");await i.sender.replaceTrack(t)}async setMaxSpatialLayer(e,t){this.assertSendDirection(),ll.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",e,t);const i=this._mapMidTransceiver.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");const n=i.sender.getParameters();n.encodings.forEach(((e,i)=>{e.active=i<=t})),await i.sender.setParameters(n),this._remoteSdp.muxMediaSectionSimulcast(e,n.encodings);const s=await this._pc.createOffer();ll.debug("setMaxSpatialLayer() | calling pc.setLocalDescription() [offer:%o]",s),await this._pc.setLocalDescription(s);const a={type:"answer",sdp:this._remoteSdp.getSdp()};ll.debug("setMaxSpatialLayer() | calling pc.setRemoteDescription() [answer:%o]",a),await this._pc.setRemoteDescription(a)}async setRtpEncodingParameters(e,t){this.assertSendDirection(),ll.debug("setRtpEncodingParameters() [localId:%s, params:%o]",e,t);const i=this._mapMidTransceiver.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");const n=i.sender.getParameters();n.encodings.forEach(((e,i)=>{n.encodings[i]={...e,...t}})),await i.sender.setParameters(n),this._remoteSdp.muxMediaSectionSimulcast(e,n.encodings);const s=await this._pc.createOffer();ll.debug("setRtpEncodingParameters() | calling pc.setLocalDescription() [offer:%o]",s),await this._pc.setLocalDescription(s);const a={type:"answer",sdp:this._remoteSdp.getSdp()};ll.debug("setRtpEncodingParameters() | calling pc.setRemoteDescription() [answer:%o]",a),await this._pc.setRemoteDescription(a)}async getSenderStats(e){this.assertSendDirection();const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.sender.getStats()}async sendDataChannel({ordered:e,maxPacketLifeTime:t,maxRetransmits:i,label:n,protocol:s}){var a;this.assertSendDirection();const r={negotiated:!0,id:this._nextSendSctpStreamId,ordered:e,maxPacketLifeTime:t,maxRetransmitTime:t,maxRetransmits:i,protocol:s};ll.debug("sendDataChannel() [options:%o]",r);const o=this._pc.createDataChannel(n,r);if(this._nextSendSctpStreamId=++this._nextSendSctpStreamId%ul.MIS,!this._hasDataChannelMediaSection){const e=await this._pc.createOffer(),t=il.parse(e.sdp),i=t.media.find((e=>"application"===e.type));this._transportReady||await this.setupTransport({localDtlsRole:null!==(a=this._forcedLocalDtlsRole)&&void 0!==a?a:"client",localSdpObject:t}),ll.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e),this._remoteSdp.sendSctpAssociation({offerMediaObject:i});const n={type:"answer",sdp:this._remoteSdp.getSdp()};ll.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",n),await this._pc.setRemoteDescription(n),this._hasDataChannelMediaSection=!0}return{dataChannel:o,sctpStreamParameters:{streamId:r.id,ordered:r.ordered,maxPacketLifeTime:r.maxPacketLifeTime,maxRetransmits:r.maxRetransmits}}}async receive(e){var t;this.assertRecvDirection();const i=[],n=new Map;for(const t of e){const{trackId:e,kind:i,rtpParameters:s,streamId:a}=t;ll.debug("receive() [trackId:%s, kind:%s]",e,i);const r=s.mid||String(this._mapMidTransceiver.size);n.set(e,r),this._remoteSdp.receive({mid:r,kind:i,offerRtpParameters:s,streamId:a||s.rtcp.cname,trackId:e})}const s={type:"offer",sdp:this._remoteSdp.getSdp()};ll.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",s),await this._pc.setRemoteDescription(s);let a=await this._pc.createAnswer();const r=il.parse(a.sdp);for(const t of e){const{trackId:e,rtpParameters:i}=t,s=n.get(e),a=r.media.find((e=>String(e.mid)===s));rl.applyCodecParameters({offerRtpParameters:i,answerMediaObject:a})}a={type:"answer",sdp:il.write(r)},this._transportReady||await this.setupTransport({localDtlsRole:null!==(t=this._forcedLocalDtlsRole)&&void 0!==t?t:"client",localSdpObject:r}),ll.debug("receive() | calling pc.setLocalDescription() [answer:%o]",a),await this._pc.setLocalDescription(a);for(const t of e){const{trackId:e}=t,s=n.get(e),a=this._pc.getTransceivers().find((e=>e.mid===s));if(!a)throw new Error("new RTCRtpTransceiver not found");this._mapMidTransceiver.set(s,a),i.push({localId:s,track:a.receiver.track,rtpReceiver:a.receiver})}return i}async stopReceiving(e){this.assertRecvDirection();for(const t of e){ll.debug("stopReceiving() [localId:%s]",t);const e=this._mapMidTransceiver.get(t);if(!e)throw new Error("associated RTCRtpTransceiver not found");this._remoteSdp.closeMediaSection(e.mid)}const t={type:"offer",sdp:this._remoteSdp.getSdp()};ll.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const i=await this._pc.createAnswer();ll.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",i),await this._pc.setLocalDescription(i);for(const t of e)this._mapMidTransceiver.delete(t)}async pauseReceiving(e){}async resumeReceiving(e){}async getReceiverStats(e){this.assertRecvDirection();const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.receiver.getStats()}async receiveDataChannel({sctpStreamParameters:e,label:t,protocol:i}){var n;this.assertRecvDirection();const{streamId:s,ordered:a,maxPacketLifeTime:r,maxRetransmits:o}=e,c={negotiated:!0,id:s,ordered:a,maxPacketLifeTime:r,maxRetransmitTime:r,maxRetransmits:o,protocol:i};ll.debug("receiveDataChannel() [options:%o]",c);const p=this._pc.createDataChannel(t,c);if(!this._hasDataChannelMediaSection){this._remoteSdp.receiveSctpAssociation();const e={type:"offer",sdp:this._remoteSdp.getSdp()};ll.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();if(!this._transportReady){const e=il.parse(t.sdp);await this.setupTransport({localDtlsRole:null!==(n=this._forcedLocalDtlsRole)&&void 0!==n?n:"client",localSdpObject:e})}ll.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setLocalDescription(t),this._hasDataChannelMediaSection=!0}return{dataChannel:p}}async setupTransport({localDtlsRole:e,localSdpObject:t}){t||(t=il.parse(this._pc.localDescription.sdp));const i=rl.extractDtlsParameters({sdpObject:t});i.role=e,this._remoteSdp.updateDtlsRole("client"===e?"server":"client"),await new Promise(((e,t)=>{this.safeEmit("@connect",{dtlsParameters:i},e,t)})),this._transportReady=!0}assertSendDirection(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}assertRecvDirection(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}}Xd.Chrome70=ml;var hl={},fl={};Object.defineProperty(fl,"__esModule",{value:!0}),fl.addLegacySimulcast=fl.getRtpEncodings=void 0,fl.getRtpEncodings=function({offerMediaObject:e,track:t}){const i=new Set;for(const n of e.ssrcs||[]){if("msid"!==n.attribute)continue;if(n.value.split(" ")[1]===t.id){const e=n.id;i.add(e)}}if(0===i.size)throw new Error(`a=ssrc line with msid information not found [track.id:${t.id}]`);const n=new Map;for(const t of e.ssrcGroups||[]){if("FID"!==t.semantics)continue;let[e,s]=t.ssrcs.split(/\s+/);e=Number(e),s=Number(s),i.has(e)&&(i.delete(e),i.delete(s),n.set(e,s))}for(const e of i)n.set(e,null);const s=[];for(const[e,t]of n){const i={ssrc:e};t&&(i.rtx={ssrc:t}),s.push(i)}return s},fl.addLegacySimulcast=function({offerMediaObject:e,track:t,numStreams:i}){if(i<=1)throw new TypeError("numStreams must be greater than 1");let n,s,a;if(!(e.ssrcs||[]).find((e=>{if("msid"!==e.attribute)return!1;return e.value.split(" ")[1]===t.id&&(n=e.id,a=e.value.split(" ")[0],!0)})))throw new Error(`a=ssrc line with msid information not found [track.id:${t.id}]`);(e.ssrcGroups||[]).some((e=>{if("FID"!==e.semantics)return!1;const t=e.ssrcs.split(/\s+/);return Number(t[0])===n&&(s=Number(t[1]),!0)}));const r=e.ssrcs.find((e=>"cname"===e.attribute&&e.id===n));if(!r)throw new Error(`a=ssrc line with cname information not found [track.id:${t.id}]`);const o=r.value,c=[],p=[];for(let e=0;e<i;++e)c.push(n+e),s&&p.push(s+e);e.ssrcGroups=e.ssrcGroups||[],e.ssrcs=e.ssrcs||[],e.ssrcGroups.push({semantics:"SIM",ssrcs:c.join(" ")});for(let i=0;i<c.length;++i){const n=c[i];e.ssrcs.push({id:n,attribute:"cname",value:o}),e.ssrcs.push({id:n,attribute:"msid",value:`${a} ${t.id}`})}for(let i=0;i<p.length;++i){const n=c[i],s=p[i];e.ssrcs.push({id:s,attribute:"cname",value:o}),e.ssrcs.push({id:s,attribute:"msid",value:`${a} ${t.id}`}),e.ssrcGroups.push({semantics:"FID",ssrcs:`${n} ${s}`})}};var gl=ei&&ei.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,s)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),vl=ei&&ei.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),bl=ei&&ei.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&gl(t,e,i);return vl(t,e),t};Object.defineProperty(hl,"__esModule",{value:!0}),hl.Chrome67=void 0;const _l=bl(Lp),yl=oc,xl=bl(bc),wl=bl(_c),Sl=bl(Hp),Rl=bl(fl),Cl=Zp,kl=id,Tl=new yl.Logger("Chrome67"),Pl={OS:1024,MIS:1024};class El extends Cl.HandlerInterface{static createFactory(){return()=>new El}constructor(){super(),this._sendStream=new MediaStream,this._mapSendLocalIdRtpSender=new Map,this._nextSendLocalId=0,this._mapRecvLocalIdInfo=new Map,this._hasDataChannelMediaSection=!1,this._nextSendSctpStreamId=0,this._transportReady=!1}get name(){return"Chrome67"}close(){if(Tl.debug("close()"),this._pc)try{this._pc.close()}catch(e){}this.emit("@close")}async getNativeRtpCapabilities(){Tl.debug("getNativeRtpCapabilities()");const e=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"plan-b"});try{const t=await e.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0});try{e.close()}catch(e){}const i=_l.parse(t.sdp);return Sl.extractRtpCapabilities({sdpObject:i})}catch(t){try{e.close()}catch(e){}throw t}}async getNativeSctpCapabilities(){return Tl.debug("getNativeSctpCapabilities()"),{numStreams:Pl}}run({direction:e,iceParameters:t,iceCandidates:i,dtlsParameters:n,sctpParameters:s,iceServers:a,iceTransportPolicy:r,additionalSettings:o,proprietaryConstraints:c,extendedRtpCapabilities:p}){Tl.debug("run()"),this._direction=e,this._remoteSdp=new kl.RemoteSdp({iceParameters:t,iceCandidates:i,dtlsParameters:n,sctpParameters:s,planB:!0}),this._sendingRtpParametersByKind={audio:wl.getSendingRtpParameters("audio",p),video:wl.getSendingRtpParameters("video",p)},this._sendingRemoteRtpParametersByKind={audio:wl.getSendingRemoteRtpParameters("audio",p),video:wl.getSendingRemoteRtpParameters("video",p)},n.role&&"auto"!==n.role&&(this._forcedLocalDtlsRole="server"===n.role?"client":"server"),this._pc=new RTCPeerConnection({iceServers:a||[],iceTransportPolicy:r||"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"plan-b",...o},c),this._pc.connectionState?this._pc.addEventListener("connectionstatechange",(()=>{this.emit("@connectionstatechange",this._pc.connectionState)})):this._pc.addEventListener("iceconnectionstatechange",(()=>{switch(Tl.warn("run() | pc.connectionState not supported, using pc.iceConnectionState"),this._pc.iceConnectionState){case"checking":this.emit("@connectionstatechange","connecting");break;case"connected":case"completed":this.emit("@connectionstatechange","connected");break;case"failed":this.emit("@connectionstatechange","failed");break;case"disconnected":this.emit("@connectionstatechange","disconnected");break;case"closed":this.emit("@connectionstatechange","closed")}}))}async updateIceServers(e){Tl.debug("updateIceServers()");const t=this._pc.getConfiguration();t.iceServers=e,this._pc.setConfiguration(t)}async restartIce(e){if(Tl.debug("restartIce()"),this._remoteSdp.updateIceParameters(e),this._transportReady)if("send"===this._direction){const e=await this._pc.createOffer({iceRestart:!0});Tl.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e);const t={type:"answer",sdp:this._remoteSdp.getSdp()};Tl.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setRemoteDescription(t)}else{const e={type:"offer",sdp:this._remoteSdp.getSdp()};Tl.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();Tl.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",t),await this._pc.setLocalDescription(t)}}async getTransportStats(){return this._pc.getStats()}async send({track:e,encodings:t,codecOptions:i,codec:n}){var s;this.assertSendDirection(),Tl.debug("send() [kind:%s, track.id:%s]",e.kind,e.id),n&&Tl.warn("send() | codec selection is not available in %s handler",this.name),this._sendStream.addTrack(e),this._pc.addTrack(e,this._sendStream);let a,r=await this._pc.createOffer(),o=_l.parse(r.sdp);const c=xl.clone(this._sendingRtpParametersByKind[e.kind],{});c.codecs=wl.reduceCodecs(c.codecs);const p=xl.clone(this._sendingRemoteRtpParametersByKind[e.kind],{});if(p.codecs=wl.reduceCodecs(p.codecs),this._transportReady||await this.setupTransport({localDtlsRole:null!==(s=this._forcedLocalDtlsRole)&&void 0!==s?s:"client",localSdpObject:o}),"video"===e.kind&&t&&t.length>1&&(Tl.debug("send() | enabling simulcast"),o=_l.parse(r.sdp),a=o.media.find((e=>"video"===e.type)),Rl.addLegacySimulcast({offerMediaObject:a,track:e,numStreams:t.length}),r={type:"offer",sdp:_l.write(o)}),Tl.debug("send() | calling pc.setLocalDescription() [offer:%o]",r),await this._pc.setLocalDescription(r),o=_l.parse(this._pc.localDescription.sdp),a=o.media.find((t=>t.type===e.kind)),c.rtcp.cname=Sl.getCname({offerMediaObject:a}),c.encodings=Rl.getRtpEncodings({offerMediaObject:a,track:e}),t)for(let e=0;e<c.encodings.length;++e)t[e]&&Object.assign(c.encodings[e],t[e]);if(c.encodings.length>1&&"video/vp8"===c.codecs[0].mimeType.toLowerCase())for(const e of c.encodings)e.scalabilityMode="L1T3";this._remoteSdp.send({offerMediaObject:a,offerRtpParameters:c,answerRtpParameters:p,codecOptions:i});const d={type:"answer",sdp:this._remoteSdp.getSdp()};Tl.debug("send() | calling pc.setRemoteDescription() [answer:%o]",d),await this._pc.setRemoteDescription(d);const l=String(this._nextSendLocalId);this._nextSendLocalId++;const u=this._pc.getSenders().find((t=>t.track===e));return this._mapSendLocalIdRtpSender.set(l,u),{localId:l,rtpParameters:c,rtpSender:u}}async stopSending(e){this.assertSendDirection(),Tl.debug("stopSending() [localId:%s]",e);const t=this._mapSendLocalIdRtpSender.get(e);if(!t)throw new Error("associated RTCRtpSender not found");this._pc.removeTrack(t),t.track&&this._sendStream.removeTrack(t.track),this._mapSendLocalIdRtpSender.delete(e);const i=await this._pc.createOffer();Tl.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",i);try{await this._pc.setLocalDescription(i)}catch(e){if(0===this._sendStream.getTracks().length)return void Tl.warn("stopSending() | ignoring expected error due no sending tracks: %s",e.toString());throw e}if("stable"===this._pc.signalingState)return;const n={type:"answer",sdp:this._remoteSdp.getSdp()};Tl.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",n),await this._pc.setRemoteDescription(n)}async pauseSending(e){}async resumeSending(e){}async replaceTrack(e,t){this.assertSendDirection(),t?Tl.debug("replaceTrack() [localId:%s, track.id:%s]",e,t.id):Tl.debug("replaceTrack() [localId:%s, no track]",e);const i=this._mapSendLocalIdRtpSender.get(e);if(!i)throw new Error("associated RTCRtpSender not found");const n=i.track;await i.replaceTrack(t),n&&this._sendStream.removeTrack(n),t&&this._sendStream.addTrack(t)}async setMaxSpatialLayer(e,t){this.assertSendDirection(),Tl.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",e,t);const i=this._mapSendLocalIdRtpSender.get(e);if(!i)throw new Error("associated RTCRtpSender not found");const n=i.getParameters();n.encodings.forEach(((e,i)=>{e.active=i<=t})),await i.setParameters(n)}async setRtpEncodingParameters(e,t){this.assertSendDirection(),Tl.debug("setRtpEncodingParameters() [localId:%s, params:%o]",e,t);const i=this._mapSendLocalIdRtpSender.get(e);if(!i)throw new Error("associated RTCRtpSender not found");const n=i.getParameters();n.encodings.forEach(((e,i)=>{n.encodings[i]={...e,...t}})),await i.setParameters(n)}async getSenderStats(e){this.assertSendDirection();const t=this._mapSendLocalIdRtpSender.get(e);if(!t)throw new Error("associated RTCRtpSender not found");return t.getStats()}async sendDataChannel({ordered:e,maxPacketLifeTime:t,maxRetransmits:i,label:n,protocol:s}){var a;this.assertSendDirection();const r={negotiated:!0,id:this._nextSendSctpStreamId,ordered:e,maxPacketLifeTime:t,maxRetransmitTime:t,maxRetransmits:i,protocol:s};Tl.debug("sendDataChannel() [options:%o]",r);const o=this._pc.createDataChannel(n,r);if(this._nextSendSctpStreamId=++this._nextSendSctpStreamId%Pl.MIS,!this._hasDataChannelMediaSection){const e=await this._pc.createOffer(),t=_l.parse(e.sdp),i=t.media.find((e=>"application"===e.type));this._transportReady||await this.setupTransport({localDtlsRole:null!==(a=this._forcedLocalDtlsRole)&&void 0!==a?a:"client",localSdpObject:t}),Tl.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e),this._remoteSdp.sendSctpAssociation({offerMediaObject:i});const n={type:"answer",sdp:this._remoteSdp.getSdp()};Tl.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",n),await this._pc.setRemoteDescription(n),this._hasDataChannelMediaSection=!0}return{dataChannel:o,sctpStreamParameters:{streamId:r.id,ordered:r.ordered,maxPacketLifeTime:r.maxPacketLifeTime,maxRetransmits:r.maxRetransmits}}}async receive(e){var t;this.assertRecvDirection();const i=[];for(const t of e){const{trackId:e,kind:i,rtpParameters:n,streamId:s}=t;Tl.debug("receive() [trackId:%s, kind:%s]",e,i);const a=i;this._remoteSdp.receive({mid:a,kind:i,offerRtpParameters:n,streamId:s||n.rtcp.cname,trackId:e})}const n={type:"offer",sdp:this._remoteSdp.getSdp()};Tl.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",n),await this._pc.setRemoteDescription(n);let s=await this._pc.createAnswer();const a=_l.parse(s.sdp);for(const t of e){const{kind:e,rtpParameters:i}=t,n=e,s=a.media.find((e=>String(e.mid)===n));Sl.applyCodecParameters({offerRtpParameters:i,answerMediaObject:s})}s={type:"answer",sdp:_l.write(a)},this._transportReady||await this.setupTransport({localDtlsRole:null!==(t=this._forcedLocalDtlsRole)&&void 0!==t?t:"client",localSdpObject:a}),Tl.debug("receive() | calling pc.setLocalDescription() [answer:%o]",s),await this._pc.setLocalDescription(s);for(const t of e){const{kind:e,trackId:n,rtpParameters:s}=t,a=n,r=e,o=this._pc.getReceivers().find((e=>e.track&&e.track.id===a));if(!o)throw new Error("new RTCRtpReceiver not");this._mapRecvLocalIdInfo.set(a,{mid:r,rtpParameters:s,rtpReceiver:o}),i.push({localId:a,track:o.track,rtpReceiver:o})}return i}async stopReceiving(e){this.assertRecvDirection();for(const t of e){Tl.debug("stopReceiving() [localId:%s]",t);const{mid:e,rtpParameters:i}=this._mapRecvLocalIdInfo.get(t)||{};this._mapRecvLocalIdInfo.delete(t),this._remoteSdp.planBStopReceiving({mid:e,offerRtpParameters:i})}const t={type:"offer",sdp:this._remoteSdp.getSdp()};Tl.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const i=await this._pc.createAnswer();Tl.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",i),await this._pc.setLocalDescription(i)}async pauseReceiving(e){}async resumeReceiving(e){}async getReceiverStats(e){this.assertRecvDirection();const{rtpReceiver:t}=this._mapRecvLocalIdInfo.get(e)||{};if(!t)throw new Error("associated RTCRtpReceiver not found");return t.getStats()}async receiveDataChannel({sctpStreamParameters:e,label:t,protocol:i}){var n;this.assertRecvDirection();const{streamId:s,ordered:a,maxPacketLifeTime:r,maxRetransmits:o}=e,c={negotiated:!0,id:s,ordered:a,maxPacketLifeTime:r,maxRetransmitTime:r,maxRetransmits:o,protocol:i};Tl.debug("receiveDataChannel() [options:%o]",c);const p=this._pc.createDataChannel(t,c);if(!this._hasDataChannelMediaSection){this._remoteSdp.receiveSctpAssociation({oldDataChannelSpec:!0});const e={type:"offer",sdp:this._remoteSdp.getSdp()};Tl.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();if(!this._transportReady){const e=_l.parse(t.sdp);await this.setupTransport({localDtlsRole:null!==(n=this._forcedLocalDtlsRole)&&void 0!==n?n:"client",localSdpObject:e})}Tl.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setLocalDescription(t),this._hasDataChannelMediaSection=!0}return{dataChannel:p}}async setupTransport({localDtlsRole:e,localSdpObject:t}){t||(t=_l.parse(this._pc.localDescription.sdp));const i=Sl.extractDtlsParameters({sdpObject:t});i.role=e,this._remoteSdp.updateDtlsRole("client"===e?"server":"client"),await new Promise(((e,t)=>{this.safeEmit("@connect",{dtlsParameters:i},e,t)})),this._transportReady=!0}assertSendDirection(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}assertRecvDirection(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}}hl.Chrome67=El;var Ol={},Dl=ei&&ei.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,s)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),Il=ei&&ei.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),jl=ei&&ei.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&Dl(t,e,i);return Il(t,e),t};Object.defineProperty(Ol,"__esModule",{value:!0}),Ol.Chrome55=void 0;const Ll=jl(Lp),Ml=oc,Al=fc,Nl=jl(bc),Bl=jl(_c),Fl=jl(Hp),Ul=jl(fl),zl=Zp,ql=id,$l=new Ml.Logger("Chrome55"),Vl={OS:1024,MIS:1024};class Wl extends zl.HandlerInterface{static createFactory(){return()=>new Wl}constructor(){super(),this._sendStream=new MediaStream,this._mapSendLocalIdTrack=new Map,this._nextSendLocalId=0,this._mapRecvLocalIdInfo=new Map,this._hasDataChannelMediaSection=!1,this._nextSendSctpStreamId=0,this._transportReady=!1}get name(){return"Chrome55"}close(){if($l.debug("close()"),this._pc)try{this._pc.close()}catch(e){}this.emit("@close")}async getNativeRtpCapabilities(){$l.debug("getNativeRtpCapabilities()");const e=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"plan-b"});try{const t=await e.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0});try{e.close()}catch(e){}const i=Ll.parse(t.sdp);return Fl.extractRtpCapabilities({sdpObject:i})}catch(t){try{e.close()}catch(e){}throw t}}async getNativeSctpCapabilities(){return $l.debug("getNativeSctpCapabilities()"),{numStreams:Vl}}run({direction:e,iceParameters:t,iceCandidates:i,dtlsParameters:n,sctpParameters:s,iceServers:a,iceTransportPolicy:r,additionalSettings:o,proprietaryConstraints:c,extendedRtpCapabilities:p}){$l.debug("run()"),this._direction=e,this._remoteSdp=new ql.RemoteSdp({iceParameters:t,iceCandidates:i,dtlsParameters:n,sctpParameters:s,planB:!0}),this._sendingRtpParametersByKind={audio:Bl.getSendingRtpParameters("audio",p),video:Bl.getSendingRtpParameters("video",p)},this._sendingRemoteRtpParametersByKind={audio:Bl.getSendingRemoteRtpParameters("audio",p),video:Bl.getSendingRemoteRtpParameters("video",p)},n.role&&"auto"!==n.role&&(this._forcedLocalDtlsRole="server"===n.role?"client":"server"),this._pc=new RTCPeerConnection({iceServers:a||[],iceTransportPolicy:r||"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"plan-b",...o},c),this._pc.connectionState?this._pc.addEventListener("connectionstatechange",(()=>{this.emit("@connectionstatechange",this._pc.connectionState)})):this._pc.addEventListener("iceconnectionstatechange",(()=>{switch($l.warn("run() | pc.connectionState not supported, using pc.iceConnectionState"),this._pc.iceConnectionState){case"checking":this.emit("@connectionstatechange","connecting");break;case"connected":case"completed":this.emit("@connectionstatechange","connected");break;case"failed":this.emit("@connectionstatechange","failed");break;case"disconnected":this.emit("@connectionstatechange","disconnected");break;case"closed":this.emit("@connectionstatechange","closed")}}))}async updateIceServers(e){$l.debug("updateIceServers()");const t=this._pc.getConfiguration();t.iceServers=e,this._pc.setConfiguration(t)}async restartIce(e){if($l.debug("restartIce()"),this._remoteSdp.updateIceParameters(e),this._transportReady)if("send"===this._direction){const e=await this._pc.createOffer({iceRestart:!0});$l.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e);const t={type:"answer",sdp:this._remoteSdp.getSdp()};$l.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setRemoteDescription(t)}else{const e={type:"offer",sdp:this._remoteSdp.getSdp()};$l.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();$l.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",t),await this._pc.setLocalDescription(t)}}async getTransportStats(){return this._pc.getStats()}async send({track:e,encodings:t,codecOptions:i,codec:n}){var s;this.assertSendDirection(),$l.debug("send() [kind:%s, track.id:%s]",e.kind,e.id),n&&$l.warn("send() | codec selection is not available in %s handler",this.name),this._sendStream.addTrack(e),this._pc.addStream(this._sendStream);let a,r=await this._pc.createOffer(),o=Ll.parse(r.sdp);const c=Nl.clone(this._sendingRtpParametersByKind[e.kind],{});c.codecs=Bl.reduceCodecs(c.codecs);const p=Nl.clone(this._sendingRemoteRtpParametersByKind[e.kind],{});if(p.codecs=Bl.reduceCodecs(p.codecs),this._transportReady||await this.setupTransport({localDtlsRole:null!==(s=this._forcedLocalDtlsRole)&&void 0!==s?s:"client",localSdpObject:o}),"video"===e.kind&&t&&t.length>1&&($l.debug("send() | enabling simulcast"),o=Ll.parse(r.sdp),a=o.media.find((e=>"video"===e.type)),Ul.addLegacySimulcast({offerMediaObject:a,track:e,numStreams:t.length}),r={type:"offer",sdp:Ll.write(o)}),$l.debug("send() | calling pc.setLocalDescription() [offer:%o]",r),await this._pc.setLocalDescription(r),o=Ll.parse(this._pc.localDescription.sdp),a=o.media.find((t=>t.type===e.kind)),c.rtcp.cname=Fl.getCname({offerMediaObject:a}),c.encodings=Ul.getRtpEncodings({offerMediaObject:a,track:e}),t)for(let e=0;e<c.encodings.length;++e)t[e]&&Object.assign(c.encodings[e],t[e]);if(c.encodings.length>1&&"video/vp8"===c.codecs[0].mimeType.toLowerCase())for(const e of c.encodings)e.scalabilityMode="L1T3";this._remoteSdp.send({offerMediaObject:a,offerRtpParameters:c,answerRtpParameters:p,codecOptions:i});const d={type:"answer",sdp:this._remoteSdp.getSdp()};$l.debug("send() | calling pc.setRemoteDescription() [answer:%o]",d),await this._pc.setRemoteDescription(d);const l=String(this._nextSendLocalId);return this._nextSendLocalId++,this._mapSendLocalIdTrack.set(l,e),{localId:l,rtpParameters:c}}async stopSending(e){this.assertSendDirection(),$l.debug("stopSending() [localId:%s]",e);const t=this._mapSendLocalIdTrack.get(e);if(!t)throw new Error("track not found");this._mapSendLocalIdTrack.delete(e),this._sendStream.removeTrack(t),this._pc.addStream(this._sendStream);const i=await this._pc.createOffer();$l.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",i);try{await this._pc.setLocalDescription(i)}catch(e){if(0===this._sendStream.getTracks().length)return void $l.warn("stopSending() | ignoring expected error due no sending tracks: %s",e.toString());throw e}if("stable"===this._pc.signalingState)return;const n={type:"answer",sdp:this._remoteSdp.getSdp()};$l.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",n),await this._pc.setRemoteDescription(n)}async pauseSending(e){}async resumeSending(e){}async replaceTrack(e,t){throw new Al.UnsupportedError("not implemented")}async setMaxSpatialLayer(e,t){throw new Al.UnsupportedError(" not implemented")}async setRtpEncodingParameters(e,t){throw new Al.UnsupportedError("not supported")}async getSenderStats(e){throw new Al.UnsupportedError("not implemented")}async sendDataChannel({ordered:e,maxPacketLifeTime:t,maxRetransmits:i,label:n,protocol:s}){var a;this.assertSendDirection();const r={negotiated:!0,id:this._nextSendSctpStreamId,ordered:e,maxPacketLifeTime:t,maxRetransmitTime:t,maxRetransmits:i,protocol:s};$l.debug("sendDataChannel() [options:%o]",r);const o=this._pc.createDataChannel(n,r);if(this._nextSendSctpStreamId=++this._nextSendSctpStreamId%Vl.MIS,!this._hasDataChannelMediaSection){const e=await this._pc.createOffer(),t=Ll.parse(e.sdp),i=t.media.find((e=>"application"===e.type));this._transportReady||await this.setupTransport({localDtlsRole:null!==(a=this._forcedLocalDtlsRole)&&void 0!==a?a:"client",localSdpObject:t}),$l.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e),this._remoteSdp.sendSctpAssociation({offerMediaObject:i});const n={type:"answer",sdp:this._remoteSdp.getSdp()};$l.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",n),await this._pc.setRemoteDescription(n),this._hasDataChannelMediaSection=!0}return{dataChannel:o,sctpStreamParameters:{streamId:r.id,ordered:r.ordered,maxPacketLifeTime:r.maxPacketLifeTime,maxRetransmits:r.maxRetransmits}}}async receive(e){var t;this.assertRecvDirection();const i=[];for(const t of e){const{trackId:e,kind:i,rtpParameters:n,streamId:s}=t;$l.debug("receive() [trackId:%s, kind:%s]",e,i);const a=i;this._remoteSdp.receive({mid:a,kind:i,offerRtpParameters:n,streamId:s||n.rtcp.cname,trackId:e})}const n={type:"offer",sdp:this._remoteSdp.getSdp()};$l.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",n),await this._pc.setRemoteDescription(n);let s=await this._pc.createAnswer();const a=Ll.parse(s.sdp);for(const t of e){const{kind:e,rtpParameters:i}=t,n=e,s=a.media.find((e=>String(e.mid)===n));Fl.applyCodecParameters({offerRtpParameters:i,answerMediaObject:s})}s={type:"answer",sdp:Ll.write(a)},this._transportReady||await this.setupTransport({localDtlsRole:null!==(t=this._forcedLocalDtlsRole)&&void 0!==t?t:"client",localSdpObject:a}),$l.debug("receive() | calling pc.setLocalDescription() [answer:%o]",s),await this._pc.setLocalDescription(s);for(const t of e){const{kind:e,trackId:n,rtpParameters:s}=t,a=e,r=n,o=t.streamId||s.rtcp.cname,c=this._pc.getRemoteStreams().find((e=>e.id===o)).getTrackById(r);if(!c)throw new Error("remote track not found");this._mapRecvLocalIdInfo.set(r,{mid:a,rtpParameters:s}),i.push({localId:r,track:c})}return i}async stopReceiving(e){this.assertRecvDirection();for(const t of e){$l.debug("stopReceiving() [localId:%s]",t);const{mid:e,rtpParameters:i}=this._mapRecvLocalIdInfo.get(t)||{};this._mapRecvLocalIdInfo.delete(t),this._remoteSdp.planBStopReceiving({mid:e,offerRtpParameters:i})}const t={type:"offer",sdp:this._remoteSdp.getSdp()};$l.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const i=await this._pc.createAnswer();$l.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",i),await this._pc.setLocalDescription(i)}async pauseReceiving(e){}async resumeReceiving(e){}async getReceiverStats(e){throw new Al.UnsupportedError("not implemented")}async receiveDataChannel({sctpStreamParameters:e,label:t,protocol:i}){var n;this.assertRecvDirection();const{streamId:s,ordered:a,maxPacketLifeTime:r,maxRetransmits:o}=e,c={negotiated:!0,id:s,ordered:a,maxPacketLifeTime:r,maxRetransmitTime:r,maxRetransmits:o,protocol:i};$l.debug("receiveDataChannel() [options:%o]",c);const p=this._pc.createDataChannel(t,c);if(!this._hasDataChannelMediaSection){this._remoteSdp.receiveSctpAssociation({oldDataChannelSpec:!0});const e={type:"offer",sdp:this._remoteSdp.getSdp()};$l.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();if(!this._transportReady){const e=Ll.parse(t.sdp);await this.setupTransport({localDtlsRole:null!==(n=this._forcedLocalDtlsRole)&&void 0!==n?n:"client",localSdpObject:e})}$l.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setLocalDescription(t),this._hasDataChannelMediaSection=!0}return{dataChannel:p}}async setupTransport({localDtlsRole:e,localSdpObject:t}){t||(t=Ll.parse(this._pc.localDescription.sdp));const i=Fl.extractDtlsParameters({sdpObject:t});i.role=e,this._remoteSdp.updateDtlsRole("client"===e?"server":"client"),await new Promise(((e,t)=>{this.safeEmit("@connect",{dtlsParameters:i},e,t)})),this._transportReady=!0}assertSendDirection(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}assertRecvDirection(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}}Ol.Chrome55=Wl;var Hl={},Gl=ei&&ei.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,s)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),Kl=ei&&ei.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Jl=ei&&ei.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&Gl(t,e,i);return Kl(t,e),t};Object.defineProperty(Hl,"__esModule",{value:!0}),Hl.Firefox60=void 0;const Ql=Jl(Lp),Yl=oc,Xl=fc,Zl=Jl(bc),eu=Jl(_c),tu=Jl(Hp),iu=Jl(Yp),nu=Zp,su=id,au=vd,ru=new Yl.Logger("Firefox60"),ou={OS:16,MIS:2048};class cu extends nu.HandlerInterface{static createFactory(){return()=>new cu}constructor(){super(),this._mapMidTransceiver=new Map,this._sendStream=new MediaStream,this._hasDataChannelMediaSection=!1,this._nextSendSctpStreamId=0,this._transportReady=!1}get name(){return"Firefox60"}close(){if(ru.debug("close()"),this._pc)try{this._pc.close()}catch(e){}this.emit("@close")}async getNativeRtpCapabilities(){ru.debug("getNativeRtpCapabilities()");const e=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"}),t=document.createElement("canvas");t.getContext("2d");const i=t.captureStream().getVideoTracks()[0];try{e.addTransceiver("audio",{direction:"sendrecv"});const n=e.addTransceiver(i,{direction:"sendrecv"}),s=n.sender.getParameters(),a=[{rid:"r0",maxBitrate:1e5},{rid:"r1",maxBitrate:5e5}];s.encodings=a,await n.sender.setParameters(s);const r=await e.createOffer();try{t.remove()}catch(e){}try{i.stop()}catch(e){}try{e.close()}catch(e){}const o=Ql.parse(r.sdp);return tu.extractRtpCapabilities({sdpObject:o})}catch(n){try{t.remove()}catch(e){}try{i.stop()}catch(e){}try{e.close()}catch(e){}throw n}}async getNativeSctpCapabilities(){return ru.debug("getNativeSctpCapabilities()"),{numStreams:ou}}run({direction:e,iceParameters:t,iceCandidates:i,dtlsParameters:n,sctpParameters:s,iceServers:a,iceTransportPolicy:r,additionalSettings:o,proprietaryConstraints:c,extendedRtpCapabilities:p}){ru.debug("run()"),this._direction=e,this._remoteSdp=new su.RemoteSdp({iceParameters:t,iceCandidates:i,dtlsParameters:n,sctpParameters:s}),this._sendingRtpParametersByKind={audio:eu.getSendingRtpParameters("audio",p),video:eu.getSendingRtpParameters("video",p)},this._sendingRemoteRtpParametersByKind={audio:eu.getSendingRemoteRtpParameters("audio",p),video:eu.getSendingRemoteRtpParameters("video",p)},this._pc=new RTCPeerConnection({iceServers:a||[],iceTransportPolicy:r||"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",...o},c),this._pc.connectionState?this._pc.addEventListener("connectionstatechange",(()=>{this.emit("@connectionstatechange",this._pc.connectionState)})):this._pc.addEventListener("iceconnectionstatechange",(()=>{switch(ru.warn("run() | pc.connectionState not supported, using pc.iceConnectionState"),this._pc.iceConnectionState){case"checking":this.emit("@connectionstatechange","connecting");break;case"connected":case"completed":this.emit("@connectionstatechange","connected");break;case"failed":this.emit("@connectionstatechange","failed");break;case"disconnected":this.emit("@connectionstatechange","disconnected");break;case"closed":this.emit("@connectionstatechange","closed")}}))}async updateIceServers(e){throw new Xl.UnsupportedError("not supported")}async restartIce(e){if(ru.debug("restartIce()"),this._remoteSdp.updateIceParameters(e),this._transportReady)if("send"===this._direction){const e=await this._pc.createOffer({iceRestart:!0});ru.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e);const t={type:"answer",sdp:this._remoteSdp.getSdp()};ru.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setRemoteDescription(t)}else{const e={type:"offer",sdp:this._remoteSdp.getSdp()};ru.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();ru.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",t),await this._pc.setLocalDescription(t)}}async getTransportStats(){return this._pc.getStats()}async send({track:e,encodings:t,codecOptions:i,codec:n}){this.assertSendDirection(),ru.debug("send() [kind:%s, track.id:%s]",e.kind,e.id),t&&(t=Zl.clone(t,[])).length>1&&(t.forEach(((e,t)=>{e.rid=`r${t}`})),t.reverse());const s=Zl.clone(this._sendingRtpParametersByKind[e.kind],{});s.codecs=eu.reduceCodecs(s.codecs,n);const a=Zl.clone(this._sendingRemoteRtpParametersByKind[e.kind],{});a.codecs=eu.reduceCodecs(a.codecs,n);const r=this._pc.addTransceiver(e,{direction:"sendonly",streams:[this._sendStream]});if(t){const e=r.sender.getParameters();e.encodings=t,await r.sender.setParameters(e)}const o=await this._pc.createOffer();let c=Ql.parse(o.sdp);this._transportReady||await this.setupTransport({localDtlsRole:"client",localSdpObject:c});const p=(0,au.parse)((t||[{}])[0].scalabilityMode);ru.debug("send() | calling pc.setLocalDescription() [offer:%o]",o),await this._pc.setLocalDescription(o);const d=r.mid;s.mid=d,c=Ql.parse(this._pc.localDescription.sdp);const l=c.media[c.media.length-1];if(s.rtcp.cname=tu.getCname({offerMediaObject:l}),t)if(1===t.length){const e=iu.getRtpEncodings({offerMediaObject:l});Object.assign(e[0],t[0]),s.encodings=e}else s.encodings=t.reverse();else s.encodings=iu.getRtpEncodings({offerMediaObject:l});if(s.encodings.length>1&&("video/vp8"===s.codecs[0].mimeType.toLowerCase()||"video/h264"===s.codecs[0].mimeType.toLowerCase()))for(const e of s.encodings)e.scalabilityMode?e.scalabilityMode=`L1T${p.temporalLayers}`:e.scalabilityMode="L1T3";this._remoteSdp.send({offerMediaObject:l,offerRtpParameters:s,answerRtpParameters:a,codecOptions:i,extmapAllowMixed:!0});const u={type:"answer",sdp:this._remoteSdp.getSdp()};return ru.debug("send() | calling pc.setRemoteDescription() [answer:%o]",u),await this._pc.setRemoteDescription(u),this._mapMidTransceiver.set(d,r),{localId:d,rtpParameters:s,rtpSender:r.sender}}async stopSending(e){ru.debug("stopSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated transceiver not found");t.sender.replaceTrack(null),this._pc.removeTrack(t.sender),this._remoteSdp.disableMediaSection(t.mid);const i=await this._pc.createOffer();ru.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",i),await this._pc.setLocalDescription(i);const n={type:"answer",sdp:this._remoteSdp.getSdp()};ru.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",n),await this._pc.setRemoteDescription(n),this._mapMidTransceiver.delete(e)}async pauseSending(e){this.assertSendDirection(),ru.debug("pauseSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");t.direction="inactive",this._remoteSdp.pauseMediaSection(e);const i=await this._pc.createOffer();ru.debug("pauseSending() | calling pc.setLocalDescription() [offer:%o]",i),await this._pc.setLocalDescription(i);const n={type:"answer",sdp:this._remoteSdp.getSdp()};ru.debug("pauseSending() | calling pc.setRemoteDescription() [answer:%o]",n),await this._pc.setRemoteDescription(n)}async resumeSending(e){this.assertSendDirection(),ru.debug("resumeSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");t.direction="sendonly",this._remoteSdp.resumeSendingMediaSection(e);const i=await this._pc.createOffer();ru.debug("resumeSending() | calling pc.setLocalDescription() [offer:%o]",i),await this._pc.setLocalDescription(i);const n={type:"answer",sdp:this._remoteSdp.getSdp()};ru.debug("resumeSending() | calling pc.setRemoteDescription() [answer:%o]",n),await this._pc.setRemoteDescription(n)}async replaceTrack(e,t){this.assertSendDirection(),t?ru.debug("replaceTrack() [localId:%s, track.id:%s]",e,t.id):ru.debug("replaceTrack() [localId:%s, no track]",e);const i=this._mapMidTransceiver.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");await i.sender.replaceTrack(t)}async setMaxSpatialLayer(e,t){this.assertSendDirection(),ru.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",e,t);const i=this._mapMidTransceiver.get(e);if(!i)throw new Error("associated transceiver not found");const n=i.sender.getParameters();t=n.encodings.length-1-t,n.encodings.forEach(((e,i)=>{e.active=i>=t})),await i.sender.setParameters(n),this._remoteSdp.muxMediaSectionSimulcast(e,n.encodings);const s=await this._pc.createOffer();ru.debug("setMaxSpatialLayer() | calling pc.setLocalDescription() [offer:%o]",s),await this._pc.setLocalDescription(s);const a={type:"answer",sdp:this._remoteSdp.getSdp()};ru.debug("setMaxSpatialLayer() | calling pc.setRemoteDescription() [answer:%o]",a),await this._pc.setRemoteDescription(a)}async setRtpEncodingParameters(e,t){this.assertSendDirection(),ru.debug("setRtpEncodingParameters() [localId:%s, params:%o]",e,t);const i=this._mapMidTransceiver.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");const n=i.sender.getParameters();n.encodings.forEach(((e,i)=>{n.encodings[i]={...e,...t}})),await i.sender.setParameters(n),this._remoteSdp.muxMediaSectionSimulcast(e,n.encodings);const s=await this._pc.createOffer();ru.debug("setRtpEncodingParameters() | calling pc.setLocalDescription() [offer:%o]",s),await this._pc.setLocalDescription(s);const a={type:"answer",sdp:this._remoteSdp.getSdp()};ru.debug("setRtpEncodingParameters() | calling pc.setRemoteDescription() [answer:%o]",a),await this._pc.setRemoteDescription(a)}async getSenderStats(e){this.assertSendDirection();const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.sender.getStats()}async sendDataChannel({ordered:e,maxPacketLifeTime:t,maxRetransmits:i,label:n,protocol:s}){this.assertSendDirection();const a={negotiated:!0,id:this._nextSendSctpStreamId,ordered:e,maxPacketLifeTime:t,maxRetransmits:i,protocol:s};ru.debug("sendDataChannel() [options:%o]",a);const r=this._pc.createDataChannel(n,a);if(this._nextSendSctpStreamId=++this._nextSendSctpStreamId%ou.MIS,!this._hasDataChannelMediaSection){const e=await this._pc.createOffer(),t=Ql.parse(e.sdp),i=t.media.find((e=>"application"===e.type));this._transportReady||await this.setupTransport({localDtlsRole:"client",localSdpObject:t}),ru.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e),this._remoteSdp.sendSctpAssociation({offerMediaObject:i});const n={type:"answer",sdp:this._remoteSdp.getSdp()};ru.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",n),await this._pc.setRemoteDescription(n),this._hasDataChannelMediaSection=!0}return{dataChannel:r,sctpStreamParameters:{streamId:a.id,ordered:a.ordered,maxPacketLifeTime:a.maxPacketLifeTime,maxRetransmits:a.maxRetransmits}}}async receive(e){this.assertRecvDirection();const t=[],i=new Map;for(const t of e){const{trackId:e,kind:n,rtpParameters:s,streamId:a}=t;ru.debug("receive() [trackId:%s, kind:%s]",e,n);const r=s.mid||String(this._mapMidTransceiver.size);i.set(e,r),this._remoteSdp.receive({mid:r,kind:n,offerRtpParameters:s,streamId:a||s.rtcp.cname,trackId:e})}const n={type:"offer",sdp:this._remoteSdp.getSdp()};ru.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",n),await this._pc.setRemoteDescription(n);let s=await this._pc.createAnswer();const a=Ql.parse(s.sdp);for(const t of e){const{trackId:e,rtpParameters:n}=t,r=i.get(e),o=a.media.find((e=>String(e.mid)===r));tu.applyCodecParameters({offerRtpParameters:n,answerMediaObject:o}),s={type:"answer",sdp:Ql.write(a)}}this._transportReady||await this.setupTransport({localDtlsRole:"client",localSdpObject:a}),ru.debug("receive() | calling pc.setLocalDescription() [answer:%o]",s),await this._pc.setLocalDescription(s);for(const n of e){const{trackId:e}=n,s=i.get(e),a=this._pc.getTransceivers().find((e=>e.mid===s));if(!a)throw new Error("new RTCRtpTransceiver not found");this._mapMidTransceiver.set(s,a),t.push({localId:s,track:a.receiver.track,rtpReceiver:a.receiver})}return t}async stopReceiving(e){this.assertRecvDirection();for(const t of e){ru.debug("stopReceiving() [localId:%s]",t);const e=this._mapMidTransceiver.get(t);if(!e)throw new Error("associated RTCRtpTransceiver not found");this._remoteSdp.closeMediaSection(e.mid)}const t={type:"offer",sdp:this._remoteSdp.getSdp()};ru.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const i=await this._pc.createAnswer();ru.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",i),await this._pc.setLocalDescription(i);for(const t of e)this._mapMidTransceiver.delete(t)}async pauseReceiving(e){this.assertRecvDirection();for(const t of e){ru.debug("pauseReceiving() [localId:%s]",t);const e=this._mapMidTransceiver.get(t);if(!e)throw new Error("associated RTCRtpTransceiver not found");e.direction="inactive",this._remoteSdp.pauseMediaSection(t)}const t={type:"offer",sdp:this._remoteSdp.getSdp()};ru.debug("pauseReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const i=await this._pc.createAnswer();ru.debug("pauseReceiving() | calling pc.setLocalDescription() [answer:%o]",i),await this._pc.setLocalDescription(i)}async resumeReceiving(e){this.assertRecvDirection();for(const t of e){ru.debug("resumeReceiving() [localId:%s]",t);const e=this._mapMidTransceiver.get(t);if(!e)throw new Error("associated RTCRtpTransceiver not found");e.direction="recvonly",this._remoteSdp.resumeReceivingMediaSection(t)}const t={type:"offer",sdp:this._remoteSdp.getSdp()};ru.debug("resumeReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const i=await this._pc.createAnswer();ru.debug("resumeReceiving() | calling pc.setLocalDescription() [answer:%o]",i),await this._pc.setLocalDescription(i)}async getReceiverStats(e){this.assertRecvDirection();const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.receiver.getStats()}async receiveDataChannel({sctpStreamParameters:e,label:t,protocol:i}){this.assertRecvDirection();const{streamId:n,ordered:s,maxPacketLifeTime:a,maxRetransmits:r}=e,o={negotiated:!0,id:n,ordered:s,maxPacketLifeTime:a,maxRetransmits:r,protocol:i};ru.debug("receiveDataChannel() [options:%o]",o);const c=this._pc.createDataChannel(t,o);if(!this._hasDataChannelMediaSection){this._remoteSdp.receiveSctpAssociation();const e={type:"offer",sdp:this._remoteSdp.getSdp()};ru.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();if(!this._transportReady){const e=Ql.parse(t.sdp);await this.setupTransport({localDtlsRole:"client",localSdpObject:e})}ru.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setLocalDescription(t),this._hasDataChannelMediaSection=!0}return{dataChannel:c}}async setupTransport({localDtlsRole:e,localSdpObject:t}){t||(t=Ql.parse(this._pc.localDescription.sdp));const i=tu.extractDtlsParameters({sdpObject:t});i.role=e,this._remoteSdp.updateDtlsRole("client"===e?"server":"client"),await new Promise(((e,t)=>{this.safeEmit("@connect",{dtlsParameters:i},e,t)})),this._transportReady=!0}assertSendDirection(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}assertRecvDirection(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}}Hl.Firefox60=cu;var pu={},du=ei&&ei.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,s)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),lu=ei&&ei.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),uu=ei&&ei.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&du(t,e,i);return lu(t,e),t};Object.defineProperty(pu,"__esModule",{value:!0}),pu.Safari12=void 0;const mu=uu(Lp),hu=oc,fu=uu(bc),gu=uu(_c),vu=uu(Hp),bu=uu(Yp),_u=uu(Xp),yu=Zp,xu=id,wu=vd,Su=new hu.Logger("Safari12"),Ru={OS:1024,MIS:1024};class Cu extends yu.HandlerInterface{static createFactory(){return()=>new Cu}constructor(){super(),this._mapMidTransceiver=new Map,this._sendStream=new MediaStream,this._hasDataChannelMediaSection=!1,this._nextSendSctpStreamId=0,this._transportReady=!1}get name(){return"Safari12"}close(){if(Su.debug("close()"),this._pc)try{this._pc.close()}catch(e){}this.emit("@close")}async getNativeRtpCapabilities(){Su.debug("getNativeRtpCapabilities()");const e=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"});try{e.addTransceiver("audio"),e.addTransceiver("video");const t=await e.createOffer();try{e.close()}catch(e){}const i=mu.parse(t.sdp),n=vu.extractRtpCapabilities({sdpObject:i});return _u.addNackSuppportForOpus(n),n}catch(t){try{e.close()}catch(e){}throw t}}async getNativeSctpCapabilities(){return Su.debug("getNativeSctpCapabilities()"),{numStreams:Ru}}run({direction:e,iceParameters:t,iceCandidates:i,dtlsParameters:n,sctpParameters:s,iceServers:a,iceTransportPolicy:r,additionalSettings:o,proprietaryConstraints:c,extendedRtpCapabilities:p}){Su.debug("run()"),this._direction=e,this._remoteSdp=new xu.RemoteSdp({iceParameters:t,iceCandidates:i,dtlsParameters:n,sctpParameters:s}),this._sendingRtpParametersByKind={audio:gu.getSendingRtpParameters("audio",p),video:gu.getSendingRtpParameters("video",p)},this._sendingRemoteRtpParametersByKind={audio:gu.getSendingRemoteRtpParameters("audio",p),video:gu.getSendingRemoteRtpParameters("video",p)},n.role&&"auto"!==n.role&&(this._forcedLocalDtlsRole="server"===n.role?"client":"server"),this._pc=new RTCPeerConnection({iceServers:a||[],iceTransportPolicy:r||"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",...o},c),this._pc.connectionState?this._pc.addEventListener("connectionstatechange",(()=>{this.emit("@connectionstatechange",this._pc.connectionState)})):this._pc.addEventListener("iceconnectionstatechange",(()=>{switch(Su.warn("run() | pc.connectionState not supported, using pc.iceConnectionState"),this._pc.iceConnectionState){case"checking":this.emit("@connectionstatechange","connecting");break;case"connected":case"completed":this.emit("@connectionstatechange","connected");break;case"failed":this.emit("@connectionstatechange","failed");break;case"disconnected":this.emit("@connectionstatechange","disconnected");break;case"closed":this.emit("@connectionstatechange","closed")}}))}async updateIceServers(e){Su.debug("updateIceServers()");const t=this._pc.getConfiguration();t.iceServers=e,this._pc.setConfiguration(t)}async restartIce(e){if(Su.debug("restartIce()"),this._remoteSdp.updateIceParameters(e),this._transportReady)if("send"===this._direction){const e=await this._pc.createOffer({iceRestart:!0});Su.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e);const t={type:"answer",sdp:this._remoteSdp.getSdp()};Su.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setRemoteDescription(t)}else{const e={type:"offer",sdp:this._remoteSdp.getSdp()};Su.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();Su.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",t),await this._pc.setLocalDescription(t)}}async getTransportStats(){return this._pc.getStats()}async send({track:e,encodings:t,codecOptions:i,codec:n}){var s;this.assertSendDirection(),Su.debug("send() [kind:%s, track.id:%s]",e.kind,e.id);const a=fu.clone(this._sendingRtpParametersByKind[e.kind],{});a.codecs=gu.reduceCodecs(a.codecs,n);const r=fu.clone(this._sendingRemoteRtpParametersByKind[e.kind],{});r.codecs=gu.reduceCodecs(r.codecs,n);const o=this._remoteSdp.getNextMediaSectionIdx(),c=this._pc.addTransceiver(e,{direction:"sendonly",streams:[this._sendStream]});let p,d=await this._pc.createOffer(),l=mu.parse(d.sdp);this._transportReady||await this.setupTransport({localDtlsRole:null!==(s=this._forcedLocalDtlsRole)&&void 0!==s?s:"client",localSdpObject:l});const u=(0,wu.parse)((t||[{}])[0].scalabilityMode);t&&t.length>1&&(Su.debug("send() | enabling legacy simulcast"),l=mu.parse(d.sdp),p=l.media[o.idx],bu.addLegacySimulcast({offerMediaObject:p,numStreams:t.length}),d={type:"offer",sdp:mu.write(l)}),Su.debug("send() | calling pc.setLocalDescription() [offer:%o]",d),await this._pc.setLocalDescription(d);const m=c.mid;if(a.mid=m,l=mu.parse(this._pc.localDescription.sdp),p=l.media[o.idx],a.rtcp.cname=vu.getCname({offerMediaObject:p}),a.encodings=bu.getRtpEncodings({offerMediaObject:p}),t)for(let e=0;e<a.encodings.length;++e)t[e]&&Object.assign(a.encodings[e],t[e]);if(a.encodings.length>1&&("video/vp8"===a.codecs[0].mimeType.toLowerCase()||"video/h264"===a.codecs[0].mimeType.toLowerCase()))for(const e of a.encodings)e.scalabilityMode?e.scalabilityMode=`L1T${u.temporalLayers}`:e.scalabilityMode="L1T3";this._remoteSdp.send({offerMediaObject:p,reuseMid:o.reuseMid,offerRtpParameters:a,answerRtpParameters:r,codecOptions:i});const h={type:"answer",sdp:this._remoteSdp.getSdp()};return Su.debug("send() | calling pc.setRemoteDescription() [answer:%o]",h),await this._pc.setRemoteDescription(h),this._mapMidTransceiver.set(m,c),{localId:m,rtpParameters:a,rtpSender:c.sender}}async stopSending(e){this.assertSendDirection(),Su.debug("stopSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");t.sender.replaceTrack(null),this._pc.removeTrack(t.sender);if(this._remoteSdp.closeMediaSection(t.mid))try{t.stop()}catch(e){}const i=await this._pc.createOffer();Su.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",i),await this._pc.setLocalDescription(i);const n={type:"answer",sdp:this._remoteSdp.getSdp()};Su.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",n),await this._pc.setRemoteDescription(n),this._mapMidTransceiver.delete(e)}async pauseSending(e){this.assertSendDirection(),Su.debug("pauseSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");t.direction="inactive",this._remoteSdp.pauseMediaSection(e);const i=await this._pc.createOffer();Su.debug("pauseSending() | calling pc.setLocalDescription() [offer:%o]",i),await this._pc.setLocalDescription(i);const n={type:"answer",sdp:this._remoteSdp.getSdp()};Su.debug("pauseSending() | calling pc.setRemoteDescription() [answer:%o]",n),await this._pc.setRemoteDescription(n)}async resumeSending(e){this.assertSendDirection(),Su.debug("resumeSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");t.direction="sendonly",this._remoteSdp.resumeSendingMediaSection(e);const i=await this._pc.createOffer();Su.debug("resumeSending() | calling pc.setLocalDescription() [offer:%o]",i),await this._pc.setLocalDescription(i);const n={type:"answer",sdp:this._remoteSdp.getSdp()};Su.debug("resumeSending() | calling pc.setRemoteDescription() [answer:%o]",n),await this._pc.setRemoteDescription(n)}async replaceTrack(e,t){this.assertSendDirection(),t?Su.debug("replaceTrack() [localId:%s, track.id:%s]",e,t.id):Su.debug("replaceTrack() [localId:%s, no track]",e);const i=this._mapMidTransceiver.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");await i.sender.replaceTrack(t)}async setMaxSpatialLayer(e,t){this.assertSendDirection(),Su.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",e,t);const i=this._mapMidTransceiver.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");const n=i.sender.getParameters();n.encodings.forEach(((e,i)=>{e.active=i<=t})),await i.sender.setParameters(n),this._remoteSdp.muxMediaSectionSimulcast(e,n.encodings);const s=await this._pc.createOffer();Su.debug("setMaxSpatialLayer() | calling pc.setLocalDescription() [offer:%o]",s),await this._pc.setLocalDescription(s);const a={type:"answer",sdp:this._remoteSdp.getSdp()};Su.debug("setMaxSpatialLayer() | calling pc.setRemoteDescription() [answer:%o]",a),await this._pc.setRemoteDescription(a)}async setRtpEncodingParameters(e,t){this.assertSendDirection(),Su.debug("setRtpEncodingParameters() [localId:%s, params:%o]",e,t);const i=this._mapMidTransceiver.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");const n=i.sender.getParameters();n.encodings.forEach(((e,i)=>{n.encodings[i]={...e,...t}})),await i.sender.setParameters(n),this._remoteSdp.muxMediaSectionSimulcast(e,n.encodings);const s=await this._pc.createOffer();Su.debug("setRtpEncodingParameters() | calling pc.setLocalDescription() [offer:%o]",s),await this._pc.setLocalDescription(s);const a={type:"answer",sdp:this._remoteSdp.getSdp()};Su.debug("setRtpEncodingParameters() | calling pc.setRemoteDescription() [answer:%o]",a),await this._pc.setRemoteDescription(a)}async getSenderStats(e){this.assertSendDirection();const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.sender.getStats()}async sendDataChannel({ordered:e,maxPacketLifeTime:t,maxRetransmits:i,label:n,protocol:s}){var a;this.assertSendDirection();const r={negotiated:!0,id:this._nextSendSctpStreamId,ordered:e,maxPacketLifeTime:t,maxRetransmits:i,protocol:s};Su.debug("sendDataChannel() [options:%o]",r);const o=this._pc.createDataChannel(n,r);if(this._nextSendSctpStreamId=++this._nextSendSctpStreamId%Ru.MIS,!this._hasDataChannelMediaSection){const e=await this._pc.createOffer(),t=mu.parse(e.sdp),i=t.media.find((e=>"application"===e.type));this._transportReady||await this.setupTransport({localDtlsRole:null!==(a=this._forcedLocalDtlsRole)&&void 0!==a?a:"client",localSdpObject:t}),Su.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e),this._remoteSdp.sendSctpAssociation({offerMediaObject:i});const n={type:"answer",sdp:this._remoteSdp.getSdp()};Su.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",n),await this._pc.setRemoteDescription(n),this._hasDataChannelMediaSection=!0}return{dataChannel:o,sctpStreamParameters:{streamId:r.id,ordered:r.ordered,maxPacketLifeTime:r.maxPacketLifeTime,maxRetransmits:r.maxRetransmits}}}async receive(e){var t;this.assertRecvDirection();const i=[],n=new Map;for(const t of e){const{trackId:e,kind:i,rtpParameters:s,streamId:a}=t;Su.debug("receive() [trackId:%s, kind:%s]",e,i);const r=s.mid||String(this._mapMidTransceiver.size);n.set(e,r),this._remoteSdp.receive({mid:r,kind:i,offerRtpParameters:s,streamId:a||s.rtcp.cname,trackId:e})}const s={type:"offer",sdp:this._remoteSdp.getSdp()};Su.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",s),await this._pc.setRemoteDescription(s);let a=await this._pc.createAnswer();const r=mu.parse(a.sdp);for(const t of e){const{trackId:e,rtpParameters:i}=t,s=n.get(e),a=r.media.find((e=>String(e.mid)===s));vu.applyCodecParameters({offerRtpParameters:i,answerMediaObject:a})}a={type:"answer",sdp:mu.write(r)},this._transportReady||await this.setupTransport({localDtlsRole:null!==(t=this._forcedLocalDtlsRole)&&void 0!==t?t:"client",localSdpObject:r}),Su.debug("receive() | calling pc.setLocalDescription() [answer:%o]",a),await this._pc.setLocalDescription(a);for(const t of e){const{trackId:e}=t,s=n.get(e),a=this._pc.getTransceivers().find((e=>e.mid===s));if(!a)throw new Error("new RTCRtpTransceiver not found");this._mapMidTransceiver.set(s,a),i.push({localId:s,track:a.receiver.track,rtpReceiver:a.receiver})}return i}async stopReceiving(e){this.assertRecvDirection();for(const t of e){Su.debug("stopReceiving() [localId:%s]",t);const e=this._mapMidTransceiver.get(t);if(!e)throw new Error("associated RTCRtpTransceiver not found");this._remoteSdp.closeMediaSection(e.mid)}const t={type:"offer",sdp:this._remoteSdp.getSdp()};Su.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const i=await this._pc.createAnswer();Su.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",i),await this._pc.setLocalDescription(i);for(const t of e)this._mapMidTransceiver.delete(t)}async pauseReceiving(e){this.assertRecvDirection();for(const t of e){Su.debug("pauseReceiving() [localId:%s]",t);const e=this._mapMidTransceiver.get(t);if(!e)throw new Error("associated RTCRtpTransceiver not found");e.direction="inactive",this._remoteSdp.pauseMediaSection(t)}const t={type:"offer",sdp:this._remoteSdp.getSdp()};Su.debug("pauseReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const i=await this._pc.createAnswer();Su.debug("pauseReceiving() | calling pc.setLocalDescription() [answer:%o]",i),await this._pc.setLocalDescription(i)}async resumeReceiving(e){this.assertRecvDirection();for(const t of e){Su.debug("resumeReceiving() [localId:%s]",t);const e=this._mapMidTransceiver.get(t);if(!e)throw new Error("associated RTCRtpTransceiver not found");e.direction="recvonly",this._remoteSdp.resumeReceivingMediaSection(t)}const t={type:"offer",sdp:this._remoteSdp.getSdp()};Su.debug("resumeReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const i=await this._pc.createAnswer();Su.debug("resumeReceiving() | calling pc.setLocalDescription() [answer:%o]",i),await this._pc.setLocalDescription(i)}async getReceiverStats(e){this.assertRecvDirection();const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.receiver.getStats()}async receiveDataChannel({sctpStreamParameters:e,label:t,protocol:i}){var n;this.assertRecvDirection();const{streamId:s,ordered:a,maxPacketLifeTime:r,maxRetransmits:o}=e,c={negotiated:!0,id:s,ordered:a,maxPacketLifeTime:r,maxRetransmits:o,protocol:i};Su.debug("receiveDataChannel() [options:%o]",c);const p=this._pc.createDataChannel(t,c);if(!this._hasDataChannelMediaSection){this._remoteSdp.receiveSctpAssociation();const e={type:"offer",sdp:this._remoteSdp.getSdp()};Su.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();if(!this._transportReady){const e=mu.parse(t.sdp);await this.setupTransport({localDtlsRole:null!==(n=this._forcedLocalDtlsRole)&&void 0!==n?n:"client",localSdpObject:e})}Su.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setLocalDescription(t),this._hasDataChannelMediaSection=!0}return{dataChannel:p}}async setupTransport({localDtlsRole:e,localSdpObject:t}){t||(t=mu.parse(this._pc.localDescription.sdp));const i=vu.extractDtlsParameters({sdpObject:t});i.role=e,this._remoteSdp.updateDtlsRole("client"===e?"server":"client"),await new Promise(((e,t)=>{this.safeEmit("@connect",{dtlsParameters:i},e,t)})),this._transportReady=!0}assertSendDirection(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}assertRecvDirection(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}}pu.Safari12=Cu;var ku={},Tu=ei&&ei.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,s)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),Pu=ei&&ei.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Eu=ei&&ei.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&Tu(t,e,i);return Pu(t,e),t};Object.defineProperty(ku,"__esModule",{value:!0}),ku.Safari11=void 0;const Ou=Eu(Lp),Du=oc,Iu=Eu(bc),ju=Eu(_c),Lu=Eu(Hp),Mu=Eu(fl),Au=Zp,Nu=id,Bu=new Du.Logger("Safari11"),Fu={OS:1024,MIS:1024};class Uu extends Au.HandlerInterface{static createFactory(){return()=>new Uu}constructor(){super(),this._sendStream=new MediaStream,this._mapSendLocalIdRtpSender=new Map,this._nextSendLocalId=0,this._mapRecvLocalIdInfo=new Map,this._hasDataChannelMediaSection=!1,this._nextSendSctpStreamId=0,this._transportReady=!1}get name(){return"Safari11"}close(){if(Bu.debug("close()"),this._pc)try{this._pc.close()}catch(e){}this.emit("@close")}async getNativeRtpCapabilities(){Bu.debug("getNativeRtpCapabilities()");const e=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"plan-b"});try{const t=await e.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0});try{e.close()}catch(e){}const i=Ou.parse(t.sdp);return Lu.extractRtpCapabilities({sdpObject:i})}catch(t){try{e.close()}catch(e){}throw t}}async getNativeSctpCapabilities(){return Bu.debug("getNativeSctpCapabilities()"),{numStreams:Fu}}run({direction:e,iceParameters:t,iceCandidates:i,dtlsParameters:n,sctpParameters:s,iceServers:a,iceTransportPolicy:r,additionalSettings:o,proprietaryConstraints:c,extendedRtpCapabilities:p}){Bu.debug("run()"),this._direction=e,this._remoteSdp=new Nu.RemoteSdp({iceParameters:t,iceCandidates:i,dtlsParameters:n,sctpParameters:s,planB:!0}),this._sendingRtpParametersByKind={audio:ju.getSendingRtpParameters("audio",p),video:ju.getSendingRtpParameters("video",p)},this._sendingRemoteRtpParametersByKind={audio:ju.getSendingRemoteRtpParameters("audio",p),video:ju.getSendingRemoteRtpParameters("video",p)},n.role&&"auto"!==n.role&&(this._forcedLocalDtlsRole="server"===n.role?"client":"server"),this._pc=new RTCPeerConnection({iceServers:a||[],iceTransportPolicy:r||"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",...o},c),this._pc.connectionState?this._pc.addEventListener("connectionstatechange",(()=>{this.emit("@connectionstatechange",this._pc.connectionState)})):this._pc.addEventListener("iceconnectionstatechange",(()=>{switch(Bu.warn("run() | pc.connectionState not supported, using pc.iceConnectionState"),this._pc.iceConnectionState){case"checking":this.emit("@connectionstatechange","connecting");break;case"connected":case"completed":this.emit("@connectionstatechange","connected");break;case"failed":this.emit("@connectionstatechange","failed");break;case"disconnected":this.emit("@connectionstatechange","disconnected");break;case"closed":this.emit("@connectionstatechange","closed")}}))}async updateIceServers(e){Bu.debug("updateIceServers()");const t=this._pc.getConfiguration();t.iceServers=e,this._pc.setConfiguration(t)}async restartIce(e){if(Bu.debug("restartIce()"),this._remoteSdp.updateIceParameters(e),this._transportReady)if("send"===this._direction){const e=await this._pc.createOffer({iceRestart:!0});Bu.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e);const t={type:"answer",sdp:this._remoteSdp.getSdp()};Bu.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setRemoteDescription(t)}else{const e={type:"offer",sdp:this._remoteSdp.getSdp()};Bu.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();Bu.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",t),await this._pc.setLocalDescription(t)}}async getTransportStats(){return this._pc.getStats()}async send({track:e,encodings:t,codecOptions:i,codec:n}){var s;this.assertSendDirection(),Bu.debug("send() [kind:%s, track.id:%s]",e.kind,e.id),n&&Bu.warn("send() | codec selection is not available in %s handler",this.name),this._sendStream.addTrack(e),this._pc.addTrack(e,this._sendStream);let a,r=await this._pc.createOffer(),o=Ou.parse(r.sdp);const c=Iu.clone(this._sendingRtpParametersByKind[e.kind],{});c.codecs=ju.reduceCodecs(c.codecs);const p=Iu.clone(this._sendingRemoteRtpParametersByKind[e.kind],{});if(p.codecs=ju.reduceCodecs(p.codecs),this._transportReady||await this.setupTransport({localDtlsRole:null!==(s=this._forcedLocalDtlsRole)&&void 0!==s?s:"client",localSdpObject:o}),"video"===e.kind&&t&&t.length>1&&(Bu.debug("send() | enabling simulcast"),o=Ou.parse(r.sdp),a=o.media.find((e=>"video"===e.type)),Mu.addLegacySimulcast({offerMediaObject:a,track:e,numStreams:t.length}),r={type:"offer",sdp:Ou.write(o)}),Bu.debug("send() | calling pc.setLocalDescription() [offer:%o]",r),await this._pc.setLocalDescription(r),o=Ou.parse(this._pc.localDescription.sdp),a=o.media.find((t=>t.type===e.kind)),c.rtcp.cname=Lu.getCname({offerMediaObject:a}),c.encodings=Mu.getRtpEncodings({offerMediaObject:a,track:e}),t)for(let e=0;e<c.encodings.length;++e)t[e]&&Object.assign(c.encodings[e],t[e]);if(c.encodings.length>1&&"video/vp8"===c.codecs[0].mimeType.toLowerCase())for(const e of c.encodings)e.scalabilityMode="L1T3";this._remoteSdp.send({offerMediaObject:a,offerRtpParameters:c,answerRtpParameters:p,codecOptions:i});const d={type:"answer",sdp:this._remoteSdp.getSdp()};Bu.debug("send() | calling pc.setRemoteDescription() [answer:%o]",d),await this._pc.setRemoteDescription(d);const l=String(this._nextSendLocalId);this._nextSendLocalId++;const u=this._pc.getSenders().find((t=>t.track===e));return this._mapSendLocalIdRtpSender.set(l,u),{localId:l,rtpParameters:c,rtpSender:u}}async stopSending(e){this.assertSendDirection();const t=this._mapSendLocalIdRtpSender.get(e);if(!t)throw new Error("associated RTCRtpSender not found");t.track&&this._sendStream.removeTrack(t.track),this._mapSendLocalIdRtpSender.delete(e);const i=await this._pc.createOffer();Bu.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",i);try{await this._pc.setLocalDescription(i)}catch(e){if(0===this._sendStream.getTracks().length)return void Bu.warn("stopSending() | ignoring expected error due no sending tracks: %s",e.toString());throw e}if("stable"===this._pc.signalingState)return;const n={type:"answer",sdp:this._remoteSdp.getSdp()};Bu.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",n),await this._pc.setRemoteDescription(n)}async pauseSending(e){}async resumeSending(e){}async replaceTrack(e,t){this.assertSendDirection(),t?Bu.debug("replaceTrack() [localId:%s, track.id:%s]",e,t.id):Bu.debug("replaceTrack() [localId:%s, no track]",e);const i=this._mapSendLocalIdRtpSender.get(e);if(!i)throw new Error("associated RTCRtpSender not found");const n=i.track;await i.replaceTrack(t),n&&this._sendStream.removeTrack(n),t&&this._sendStream.addTrack(t)}async setMaxSpatialLayer(e,t){this.assertSendDirection(),Bu.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",e,t);const i=this._mapSendLocalIdRtpSender.get(e);if(!i)throw new Error("associated RTCRtpSender not found");const n=i.getParameters();n.encodings.forEach(((e,i)=>{e.active=i<=t})),await i.setParameters(n)}async setRtpEncodingParameters(e,t){this.assertSendDirection(),Bu.debug("setRtpEncodingParameters() [localId:%s, params:%o]",e,t);const i=this._mapSendLocalIdRtpSender.get(e);if(!i)throw new Error("associated RTCRtpSender not found");const n=i.getParameters();n.encodings.forEach(((e,i)=>{n.encodings[i]={...e,...t}})),await i.setParameters(n)}async getSenderStats(e){this.assertSendDirection();const t=this._mapSendLocalIdRtpSender.get(e);if(!t)throw new Error("associated RTCRtpSender not found");return t.getStats()}async sendDataChannel({ordered:e,maxPacketLifeTime:t,maxRetransmits:i,label:n,protocol:s}){var a;this.assertSendDirection();const r={negotiated:!0,id:this._nextSendSctpStreamId,ordered:e,maxPacketLifeTime:t,maxRetransmits:i,protocol:s};Bu.debug("sendDataChannel() [options:%o]",r);const o=this._pc.createDataChannel(n,r);if(this._nextSendSctpStreamId=++this._nextSendSctpStreamId%Fu.MIS,!this._hasDataChannelMediaSection){const e=await this._pc.createOffer(),t=Ou.parse(e.sdp),i=t.media.find((e=>"application"===e.type));this._transportReady||await this.setupTransport({localDtlsRole:null!==(a=this._forcedLocalDtlsRole)&&void 0!==a?a:"client",localSdpObject:t}),Bu.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e),this._remoteSdp.sendSctpAssociation({offerMediaObject:i});const n={type:"answer",sdp:this._remoteSdp.getSdp()};Bu.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",n),await this._pc.setRemoteDescription(n),this._hasDataChannelMediaSection=!0}return{dataChannel:o,sctpStreamParameters:{streamId:r.id,ordered:r.ordered,maxPacketLifeTime:r.maxPacketLifeTime,maxRetransmits:r.maxRetransmits}}}async receive(e){var t;this.assertRecvDirection();const i=[];for(const t of e){const{trackId:e,kind:i,rtpParameters:n,streamId:s}=t;Bu.debug("receive() [trackId:%s, kind:%s]",e,i);const a=i;this._remoteSdp.receive({mid:a,kind:i,offerRtpParameters:n,streamId:s||n.rtcp.cname,trackId:e})}const n={type:"offer",sdp:this._remoteSdp.getSdp()};Bu.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",n),await this._pc.setRemoteDescription(n);let s=await this._pc.createAnswer();const a=Ou.parse(s.sdp);for(const t of e){const{kind:e,rtpParameters:i}=t,n=e,s=a.media.find((e=>String(e.mid)===n));Lu.applyCodecParameters({offerRtpParameters:i,answerMediaObject:s})}s={type:"answer",sdp:Ou.write(a)},this._transportReady||await this.setupTransport({localDtlsRole:null!==(t=this._forcedLocalDtlsRole)&&void 0!==t?t:"client",localSdpObject:a}),Bu.debug("receive() | calling pc.setLocalDescription() [answer:%o]",s),await this._pc.setLocalDescription(s);for(const t of e){const{kind:e,trackId:n,rtpParameters:s}=t,a=e,r=n,o=this._pc.getReceivers().find((e=>e.track&&e.track.id===r));if(!o)throw new Error("new RTCRtpReceiver not");this._mapRecvLocalIdInfo.set(r,{mid:a,rtpParameters:s,rtpReceiver:o}),i.push({localId:r,track:o.track,rtpReceiver:o})}return i}async stopReceiving(e){this.assertRecvDirection();for(const t of e){Bu.debug("stopReceiving() [localId:%s]",t);const{mid:e,rtpParameters:i}=this._mapRecvLocalIdInfo.get(t)||{};this._mapRecvLocalIdInfo.delete(t),this._remoteSdp.planBStopReceiving({mid:e,offerRtpParameters:i})}const t={type:"offer",sdp:this._remoteSdp.getSdp()};Bu.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const i=await this._pc.createAnswer();Bu.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",i),await this._pc.setLocalDescription(i)}async getReceiverStats(e){this.assertRecvDirection();const{rtpReceiver:t}=this._mapRecvLocalIdInfo.get(e)||{};if(!t)throw new Error("associated RTCRtpReceiver not found");return t.getStats()}async pauseReceiving(e){}async resumeReceiving(e){}async receiveDataChannel({sctpStreamParameters:e,label:t,protocol:i}){var n;this.assertRecvDirection();const{streamId:s,ordered:a,maxPacketLifeTime:r,maxRetransmits:o}=e,c={negotiated:!0,id:s,ordered:a,maxPacketLifeTime:r,maxRetransmits:o,protocol:i};Bu.debug("receiveDataChannel() [options:%o]",c);const p=this._pc.createDataChannel(t,c);if(!this._hasDataChannelMediaSection){this._remoteSdp.receiveSctpAssociation({oldDataChannelSpec:!0});const e={type:"offer",sdp:this._remoteSdp.getSdp()};Bu.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();if(!this._transportReady){const e=Ou.parse(t.sdp);await this.setupTransport({localDtlsRole:null!==(n=this._forcedLocalDtlsRole)&&void 0!==n?n:"client",localSdpObject:e})}Bu.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setLocalDescription(t),this._hasDataChannelMediaSection=!0}return{dataChannel:p}}async setupTransport({localDtlsRole:e,localSdpObject:t}){t||(t=Ou.parse(this._pc.localDescription.sdp));const i=Lu.extractDtlsParameters({sdpObject:t});i.role=e,this._remoteSdp.updateDtlsRole("client"===e?"server":"client"),await new Promise(((e,t)=>{this.safeEmit("@connect",{dtlsParameters:i},e,t)})),this._transportReady=!0}assertSendDirection(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}assertRecvDirection(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}}ku.Safari11=Uu;var zu={},qu={},$u=ei&&ei.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,s)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),Vu=ei&&ei.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Wu=ei&&ei.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&$u(t,e,i);return Vu(t,e),t};Object.defineProperty(qu,"__esModule",{value:!0}),qu.mangleRtpParameters=qu.getCapabilities=void 0;const Hu=Wu(bc);qu.getCapabilities=function(){const e=RTCRtpReceiver.getCapabilities(),t=Hu.clone(e,{});for(const e of t.codecs){if(e.channels=e.numChannels,delete e.numChannels,e.mimeType=e.mimeType||`${e.kind}/${e.name}`,e.parameters){const t=e.parameters;t.apt&&(t.apt=Number(t.apt)),t["packetization-mode"]&&(t["packetization-mode"]=Number(t["packetization-mode"]))}for(const t of e.rtcpFeedback||[])t.parameter||(t.parameter="")}return t},qu.mangleRtpParameters=function(e){const t=Hu.clone(e,{});t.mid&&(t.muxId=t.mid,delete t.mid);for(const e of t.codecs)e.channels&&(e.numChannels=e.channels,delete e.channels),e.mimeType&&!e.name&&(e.name=e.mimeType.split("/")[1]),delete e.mimeType;return t};var Gu=ei&&ei.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,s)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),Ku=ei&&ei.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Ju=ei&&ei.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&Gu(t,e,i);return Ku(t,e),t};Object.defineProperty(zu,"__esModule",{value:!0}),zu.Edge11=void 0;const Qu=oc,Yu=fc,Xu=Ju(bc),Zu=Ju(_c),em=Ju(qu),tm=Zp,im=new Qu.Logger("Edge11");class nm extends tm.HandlerInterface{static createFactory(){return()=>new nm}constructor(){super(),this._rtpSenders=new Map,this._rtpReceivers=new Map,this._nextSendLocalId=0,this._transportReady=!1}get name(){return"Edge11"}close(){im.debug("close()");try{this._iceGatherer.close()}catch(e){}try{this._iceTransport.stop()}catch(e){}try{this._dtlsTransport.stop()}catch(e){}for(const e of this._rtpSenders.values())try{e.stop()}catch(e){}for(const e of this._rtpReceivers.values())try{e.stop()}catch(e){}this.emit("@close")}async getNativeRtpCapabilities(){return im.debug("getNativeRtpCapabilities()"),em.getCapabilities()}async getNativeSctpCapabilities(){return im.debug("getNativeSctpCapabilities()"),{numStreams:{OS:0,MIS:0}}}run({direction:e,iceParameters:t,iceCandidates:i,dtlsParameters:n,sctpParameters:s,iceServers:a,iceTransportPolicy:r,additionalSettings:o,proprietaryConstraints:c,extendedRtpCapabilities:p}){im.debug("run()"),this._sendingRtpParametersByKind={audio:Zu.getSendingRtpParameters("audio",p),video:Zu.getSendingRtpParameters("video",p)},this._remoteIceParameters=t,this._remoteIceCandidates=i,this._remoteDtlsParameters=n,this._cname=`CNAME-${Xu.generateRandomNumber()}`,this.setIceGatherer({iceServers:a,iceTransportPolicy:r}),this.setIceTransport(),this.setDtlsTransport()}async updateIceServers(e){throw new Yu.UnsupportedError("not supported")}async restartIce(e){if(im.debug("restartIce()"),this._remoteIceParameters=e,this._transportReady){im.debug("restartIce() | calling iceTransport.start()"),this._iceTransport.start(this._iceGatherer,e,"controlling");for(const e of this._remoteIceCandidates)this._iceTransport.addRemoteCandidate(e);this._iceTransport.addRemoteCandidate({})}}async getTransportStats(){return this._iceTransport.getStats()}async send({track:e,encodings:t,codecOptions:i,codec:n}){im.debug("send() [kind:%s, track.id:%s]",e.kind,e.id),this._transportReady||await this.setupTransport({localDtlsRole:"server"}),im.debug("send() | calling new RTCRtpSender()");const s=new RTCRtpSender(e,this._dtlsTransport),a=Xu.clone(this._sendingRtpParametersByKind[e.kind],{});a.codecs=Zu.reduceCodecs(a.codecs,n);const r=a.codecs.some((e=>/.+\/rtx$/i.test(e.mimeType)));t||(t=[{}]);for(const e of t)e.ssrc=Xu.generateRandomNumber(),r&&(e.rtx={ssrc:Xu.generateRandomNumber()});a.encodings=t,a.rtcp={cname:this._cname,reducedSize:!0,mux:!0};const o=em.mangleRtpParameters(a);im.debug("send() | calling rtpSender.send() [params:%o]",o),await s.send(o);const c=String(this._nextSendLocalId);return this._nextSendLocalId++,this._rtpSenders.set(c,s),{localId:c,rtpParameters:a,rtpSender:s}}async stopSending(e){im.debug("stopSending() [localId:%s]",e);const t=this._rtpSenders.get(e);if(!t)throw new Error("RTCRtpSender not found");this._rtpSenders.delete(e);try{im.debug("stopSending() | calling rtpSender.stop()"),t.stop()}catch(e){throw im.warn("stopSending() | rtpSender.stop() failed:%o",e),e}}async pauseSending(e){}async resumeSending(e){}async replaceTrack(e,t){t?im.debug("replaceTrack() [localId:%s, track.id:%s]",e,t.id):im.debug("replaceTrack() [localId:%s, no track]",e);const i=this._rtpSenders.get(e);if(!i)throw new Error("RTCRtpSender not found");i.setTrack(t)}async setMaxSpatialLayer(e,t){im.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",e,t);const i=this._rtpSenders.get(e);if(!i)throw new Error("RTCRtpSender not found");const n=i.getParameters();n.encodings.forEach(((e,i)=>{e.active=i<=t})),await i.setParameters(n)}async setRtpEncodingParameters(e,t){im.debug("setRtpEncodingParameters() [localId:%s, params:%o]",e,t);const i=this._rtpSenders.get(e);if(!i)throw new Error("RTCRtpSender not found");const n=i.getParameters();n.encodings.forEach(((e,i)=>{n.encodings[i]={...e,...t}})),await i.setParameters(n)}async getSenderStats(e){const t=this._rtpSenders.get(e);if(!t)throw new Error("RTCRtpSender not found");return t.getStats()}async sendDataChannel(e){throw new Yu.UnsupportedError("not implemented")}async receive(e){const t=[];for(const t of e){const{trackId:e,kind:i}=t;im.debug("receive() [trackId:%s, kind:%s]",e,i)}this._transportReady||await this.setupTransport({localDtlsRole:"server"});for(const i of e){const{trackId:e,kind:n,rtpParameters:s}=i;im.debug("receive() | calling new RTCRtpReceiver()");const a=new RTCRtpReceiver(this._dtlsTransport,n);a.addEventListener("error",(e=>{im.error('rtpReceiver "error" event [event:%o]',e)}));const r=em.mangleRtpParameters(s);im.debug("receive() | calling rtpReceiver.receive() [params:%o]",r),await a.receive(r);const o=e;this._rtpReceivers.set(o,a),t.push({localId:o,track:a.track,rtpReceiver:a})}return t}async stopReceiving(e){for(const t of e){im.debug("stopReceiving() [localId:%s]",t);const e=this._rtpReceivers.get(t);if(!e)throw new Error("RTCRtpReceiver not found");this._rtpReceivers.delete(t);try{im.debug("stopReceiving() | calling rtpReceiver.stop()"),e.stop()}catch(e){im.warn("stopReceiving() | rtpReceiver.stop() failed:%o",e)}}}async pauseReceiving(e){}async resumeReceiving(e){}async getReceiverStats(e){const t=this._rtpReceivers.get(e);if(!t)throw new Error("RTCRtpReceiver not found");return t.getStats()}async receiveDataChannel(e){throw new Yu.UnsupportedError("not implemented")}setIceGatherer({iceServers:e,iceTransportPolicy:t}){const i=new RTCIceGatherer({iceServers:e||[],gatherPolicy:t||"all"});i.addEventListener("error",(e=>{im.error('iceGatherer "error" event [event:%o]',e)}));try{i.gather()}catch(e){im.debug("setIceGatherer() | iceGatherer.gather() failed: %s",e.toString())}this._iceGatherer=i}setIceTransport(){const e=new RTCIceTransport(this._iceGatherer);e.addEventListener("statechange",(()=>{switch(e.state){case"checking":this.emit("@connectionstatechange","connecting");break;case"connected":case"completed":this.emit("@connectionstatechange","connected");break;case"failed":this.emit("@connectionstatechange","failed");break;case"disconnected":this.emit("@connectionstatechange","disconnected");break;case"closed":this.emit("@connectionstatechange","closed")}})),e.addEventListener("icestatechange",(()=>{switch(e.state){case"checking":this.emit("@connectionstatechange","connecting");break;case"connected":case"completed":this.emit("@connectionstatechange","connected");break;case"failed":this.emit("@connectionstatechange","failed");break;case"disconnected":this.emit("@connectionstatechange","disconnected");break;case"closed":this.emit("@connectionstatechange","closed")}})),e.addEventListener("candidatepairchange",(e=>{im.debug('iceTransport "candidatepairchange" event [pair:%o]',e.pair)})),this._iceTransport=e}setDtlsTransport(){const e=new RTCDtlsTransport(this._iceTransport);e.addEventListener("statechange",(()=>{im.debug('dtlsTransport "statechange" event [state:%s]',e.state)})),e.addEventListener("dtlsstatechange",(()=>{im.debug('dtlsTransport "dtlsstatechange" event [state:%s]',e.state),"closed"===e.state&&this.emit("@connectionstatechange","closed")})),e.addEventListener("error",(e=>{im.error('dtlsTransport "error" event [event:%o]',e)})),this._dtlsTransport=e}async setupTransport({localDtlsRole:e}){im.debug("setupTransport()");const t=this._dtlsTransport.getLocalParameters();t.role=e,await new Promise(((e,i)=>{this.safeEmit("@connect",{dtlsParameters:t},e,i)})),this._iceTransport.start(this._iceGatherer,this._remoteIceParameters,"controlling");for(const e of this._remoteIceCandidates)this._iceTransport.addRemoteCandidate(e);this._iceTransport.addRemoteCandidate({}),this._remoteDtlsParameters.fingerprints=this._remoteDtlsParameters.fingerprints.filter((e=>"sha-256"===e.algorithm||"sha-384"===e.algorithm||"sha-512"===e.algorithm)),this._dtlsTransport.start(this._remoteDtlsParameters),this._transportReady=!0}}zu.Edge11=nm;var sm={},am=ei&&ei.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,s)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),rm=ei&&ei.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),om=ei&&ei.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&am(t,e,i);return rm(t,e),t};Object.defineProperty(sm,"__esModule",{value:!0}),sm.ReactNativeUnifiedPlan=void 0;const cm=om(Lp),pm=oc,dm=om(bc),lm=om(_c),um=om(Hp),mm=om(Yp),hm=om(Xp),fm=Zp,gm=id,vm=vd,bm=new pm.Logger("ReactNativeUnifiedPlan"),_m={OS:1024,MIS:1024};class ym extends fm.HandlerInterface{static createFactory(){return()=>new ym}constructor(){super(),this._mapMidTransceiver=new Map,this._sendStream=new MediaStream,this._hasDataChannelMediaSection=!1,this._nextSendSctpStreamId=0,this._transportReady=!1}get name(){return"ReactNativeUnifiedPlan"}close(){if(bm.debug("close()"),this._sendStream.release(!1),this._pc)try{this._pc.close()}catch(e){}this.emit("@close")}async getNativeRtpCapabilities(){bm.debug("getNativeRtpCapabilities()");const e=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"});try{e.addTransceiver("audio"),e.addTransceiver("video");const t=await e.createOffer();try{e.close()}catch(e){}const i=cm.parse(t.sdp),n=um.extractRtpCapabilities({sdpObject:i});return hm.addNackSuppportForOpus(n),n}catch(t){try{e.close()}catch(e){}throw t}}async getNativeSctpCapabilities(){return bm.debug("getNativeSctpCapabilities()"),{numStreams:_m}}run({direction:e,iceParameters:t,iceCandidates:i,dtlsParameters:n,sctpParameters:s,iceServers:a,iceTransportPolicy:r,additionalSettings:o,proprietaryConstraints:c,extendedRtpCapabilities:p}){bm.debug("run()"),this._direction=e,this._remoteSdp=new gm.RemoteSdp({iceParameters:t,iceCandidates:i,dtlsParameters:n,sctpParameters:s}),this._sendingRtpParametersByKind={audio:lm.getSendingRtpParameters("audio",p),video:lm.getSendingRtpParameters("video",p)},this._sendingRemoteRtpParametersByKind={audio:lm.getSendingRemoteRtpParameters("audio",p),video:lm.getSendingRemoteRtpParameters("video",p)},n.role&&"auto"!==n.role&&(this._forcedLocalDtlsRole="server"===n.role?"client":"server"),this._pc=new RTCPeerConnection({iceServers:a||[],iceTransportPolicy:r||"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",...o},c),this._pc.connectionState?this._pc.addEventListener("connectionstatechange",(()=>{this.emit("@connectionstatechange",this._pc.connectionState)})):this._pc.addEventListener("iceconnectionstatechange",(()=>{switch(bm.warn("run() | pc.connectionState not supported, using pc.iceConnectionState"),this._pc.iceConnectionState){case"checking":this.emit("@connectionstatechange","connecting");break;case"connected":case"completed":this.emit("@connectionstatechange","connected");break;case"failed":this.emit("@connectionstatechange","failed");break;case"disconnected":this.emit("@connectionstatechange","disconnected");break;case"closed":this.emit("@connectionstatechange","closed")}}))}async updateIceServers(e){bm.debug("updateIceServers()");const t=this._pc.getConfiguration();t.iceServers=e,this._pc.setConfiguration(t)}async restartIce(e){if(bm.debug("restartIce()"),this._remoteSdp.updateIceParameters(e),this._transportReady)if("send"===this._direction){const e=await this._pc.createOffer({iceRestart:!0});bm.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e);const t={type:"answer",sdp:this._remoteSdp.getSdp()};bm.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setRemoteDescription(t)}else{const e={type:"offer",sdp:this._remoteSdp.getSdp()};bm.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();bm.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",t),await this._pc.setLocalDescription(t)}}async getTransportStats(){return this._pc.getStats()}async send({track:e,encodings:t,codecOptions:i,codec:n}){var s;this.assertSendDirection(),bm.debug("send() [kind:%s, track.id:%s]",e.kind,e.id),t&&t.length>1&&t.forEach(((e,t)=>{e.rid=`r${t}`}));const a=dm.clone(this._sendingRtpParametersByKind[e.kind],{});a.codecs=lm.reduceCodecs(a.codecs,n);const r=dm.clone(this._sendingRemoteRtpParametersByKind[e.kind],{});r.codecs=lm.reduceCodecs(r.codecs,n);const o=this._remoteSdp.getNextMediaSectionIdx(),c=this._pc.addTransceiver(e,{direction:"sendonly",streams:[this._sendStream],sendEncodings:t});let p,d=await this._pc.createOffer(),l=cm.parse(d.sdp);this._transportReady||await this.setupTransport({localDtlsRole:null!==(s=this._forcedLocalDtlsRole)&&void 0!==s?s:"client",localSdpObject:l});let u=!1;const m=(0,vm.parse)((t||[{}])[0].scalabilityMode);t&&1===t.length&&m.spatialLayers>1&&"video/vp9"===a.codecs[0].mimeType.toLowerCase()&&(bm.debug("send() | enabling legacy simulcast for VP9 SVC"),u=!0,l=cm.parse(d.sdp),p=l.media[o.idx],mm.addLegacySimulcast({offerMediaObject:p,numStreams:m.spatialLayers}),d={type:"offer",sdp:cm.write(l)}),bm.debug("send() | calling pc.setLocalDescription() [offer:%o]",d),await this._pc.setLocalDescription(d);const h=c.mid;if(a.mid=h,l=cm.parse(this._pc.localDescription.sdp),p=l.media[o.idx],a.rtcp.cname=um.getCname({offerMediaObject:p}),t)if(1===t.length){let e=mm.getRtpEncodings({offerMediaObject:p});Object.assign(e[0],t[0]),u&&(e=[e[0]]),a.encodings=e}else a.encodings=t;else a.encodings=mm.getRtpEncodings({offerMediaObject:p});if(a.encodings.length>1&&("video/vp8"===a.codecs[0].mimeType.toLowerCase()||"video/h264"===a.codecs[0].mimeType.toLowerCase()))for(const e of a.encodings)e.scalabilityMode?e.scalabilityMode=`L1T${m.temporalLayers}`:e.scalabilityMode="L1T3";this._remoteSdp.send({offerMediaObject:p,reuseMid:o.reuseMid,offerRtpParameters:a,answerRtpParameters:r,codecOptions:i,extmapAllowMixed:!0});const f={type:"answer",sdp:this._remoteSdp.getSdp()};return bm.debug("send() | calling pc.setRemoteDescription() [answer:%o]",f),await this._pc.setRemoteDescription(f),this._mapMidTransceiver.set(h,c),{localId:h,rtpParameters:a,rtpSender:c.sender}}async stopSending(e){this.assertSendDirection(),bm.debug("stopSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");t.sender.replaceTrack(null),this._pc.removeTrack(t.sender);if(this._remoteSdp.closeMediaSection(t.mid))try{t.stop()}catch(e){}const i=await this._pc.createOffer();bm.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",i),await this._pc.setLocalDescription(i);const n={type:"answer",sdp:this._remoteSdp.getSdp()};bm.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",n),await this._pc.setRemoteDescription(n),this._mapMidTransceiver.delete(e)}async pauseSending(e){this.assertSendDirection(),bm.debug("pauseSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");t.direction="inactive",this._remoteSdp.pauseMediaSection(e);const i=await this._pc.createOffer();bm.debug("pauseSending() | calling pc.setLocalDescription() [offer:%o]",i),await this._pc.setLocalDescription(i);const n={type:"answer",sdp:this._remoteSdp.getSdp()};bm.debug("pauseSending() | calling pc.setRemoteDescription() [answer:%o]",n),await this._pc.setRemoteDescription(n)}async resumeSending(e){this.assertSendDirection(),bm.debug("resumeSending() [localId:%s]",e);const t=this._mapMidTransceiver.get(e);if(this._remoteSdp.resumeSendingMediaSection(e),!t)throw new Error("associated RTCRtpTransceiver not found");t.direction="sendonly";const i=await this._pc.createOffer();bm.debug("resumeSending() | calling pc.setLocalDescription() [offer:%o]",i),await this._pc.setLocalDescription(i);const n={type:"answer",sdp:this._remoteSdp.getSdp()};bm.debug("resumeSending() | calling pc.setRemoteDescription() [answer:%o]",n),await this._pc.setRemoteDescription(n)}async replaceTrack(e,t){this.assertSendDirection(),t?bm.debug("replaceTrack() [localId:%s, track.id:%s]",e,t.id):bm.debug("replaceTrack() [localId:%s, no track]",e);const i=this._mapMidTransceiver.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");await i.sender.replaceTrack(t)}async setMaxSpatialLayer(e,t){this.assertSendDirection(),bm.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",e,t);const i=this._mapMidTransceiver.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");const n=i.sender.getParameters();n.encodings.forEach(((e,i)=>{e.active=i<=t})),await i.sender.setParameters(n),this._remoteSdp.muxMediaSectionSimulcast(e,n.encodings);const s=await this._pc.createOffer();bm.debug("setMaxSpatialLayer() | calling pc.setLocalDescription() [offer:%o]",s),await this._pc.setLocalDescription(s);const a={type:"answer",sdp:this._remoteSdp.getSdp()};bm.debug("setMaxSpatialLayer() | calling pc.setRemoteDescription() [answer:%o]",a),await this._pc.setRemoteDescription(a)}async setRtpEncodingParameters(e,t){this.assertSendDirection(),bm.debug("setRtpEncodingParameters() [localId:%s, params:%o]",e,t);const i=this._mapMidTransceiver.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");const n=i.sender.getParameters();n.encodings.forEach(((e,i)=>{n.encodings[i]={...e,...t}})),await i.sender.setParameters(n),this._remoteSdp.muxMediaSectionSimulcast(e,n.encodings);const s=await this._pc.createOffer();bm.debug("setRtpEncodingParameters() | calling pc.setLocalDescription() [offer:%o]",s),await this._pc.setLocalDescription(s);const a={type:"answer",sdp:this._remoteSdp.getSdp()};bm.debug("setRtpEncodingParameters() | calling pc.setRemoteDescription() [answer:%o]",a),await this._pc.setRemoteDescription(a)}async getSenderStats(e){this.assertSendDirection();const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.sender.getStats()}async sendDataChannel({ordered:e,maxPacketLifeTime:t,maxRetransmits:i,label:n,protocol:s}){var a;this.assertSendDirection();const r={negotiated:!0,id:this._nextSendSctpStreamId,ordered:e,maxPacketLifeTime:t,maxRetransmits:i,protocol:s};bm.debug("sendDataChannel() [options:%o]",r);const o=this._pc.createDataChannel(n,r);if(this._nextSendSctpStreamId=++this._nextSendSctpStreamId%_m.MIS,!this._hasDataChannelMediaSection){const e=await this._pc.createOffer(),t=cm.parse(e.sdp),i=t.media.find((e=>"application"===e.type));this._transportReady||await this.setupTransport({localDtlsRole:null!==(a=this._forcedLocalDtlsRole)&&void 0!==a?a:"client",localSdpObject:t}),bm.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e),this._remoteSdp.sendSctpAssociation({offerMediaObject:i});const n={type:"answer",sdp:this._remoteSdp.getSdp()};bm.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",n),await this._pc.setRemoteDescription(n),this._hasDataChannelMediaSection=!0}return{dataChannel:o,sctpStreamParameters:{streamId:r.id,ordered:r.ordered,maxPacketLifeTime:r.maxPacketLifeTime,maxRetransmits:r.maxRetransmits}}}async receive(e){var t;this.assertRecvDirection();const i=[],n=new Map;for(const t of e){const{trackId:e,kind:i,rtpParameters:s,streamId:a}=t;bm.debug("receive() [trackId:%s, kind:%s]",e,i);const r=s.mid||String(this._mapMidTransceiver.size);n.set(e,r),this._remoteSdp.receive({mid:r,kind:i,offerRtpParameters:s,streamId:a||s.rtcp.cname,trackId:e})}const s={type:"offer",sdp:this._remoteSdp.getSdp()};bm.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",s),await this._pc.setRemoteDescription(s);let a=await this._pc.createAnswer();const r=cm.parse(a.sdp);for(const t of e){const{trackId:e,rtpParameters:i}=t,s=n.get(e),a=r.media.find((e=>String(e.mid)===s));um.applyCodecParameters({offerRtpParameters:i,answerMediaObject:a})}a={type:"answer",sdp:cm.write(r)},this._transportReady||await this.setupTransport({localDtlsRole:null!==(t=this._forcedLocalDtlsRole)&&void 0!==t?t:"client",localSdpObject:r}),bm.debug("receive() | calling pc.setLocalDescription() [answer:%o]",a),await this._pc.setLocalDescription(a);for(const t of e){const{trackId:e}=t,s=n.get(e),a=this._pc.getTransceivers().find((e=>e.mid===s));if(!a)throw new Error("new RTCRtpTransceiver not found");this._mapMidTransceiver.set(s,a),i.push({localId:s,track:a.receiver.track,rtpReceiver:a.receiver})}return i}async stopReceiving(e){this.assertRecvDirection();for(const t of e){bm.debug("stopReceiving() [localId:%s]",t);const e=this._mapMidTransceiver.get(t);if(!e)throw new Error("associated RTCRtpTransceiver not found");this._remoteSdp.closeMediaSection(e.mid)}const t={type:"offer",sdp:this._remoteSdp.getSdp()};bm.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const i=await this._pc.createAnswer();bm.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",i),await this._pc.setLocalDescription(i);for(const t of e)this._mapMidTransceiver.delete(t)}async pauseReceiving(e){this.assertRecvDirection();for(const t of e){bm.debug("pauseReceiving() [localId:%s]",t);const e=this._mapMidTransceiver.get(t);if(!e)throw new Error("associated RTCRtpTransceiver not found");e.direction="inactive",this._remoteSdp.pauseMediaSection(t)}const t={type:"offer",sdp:this._remoteSdp.getSdp()};bm.debug("pauseReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const i=await this._pc.createAnswer();bm.debug("pauseReceiving() | calling pc.setLocalDescription() [answer:%o]",i),await this._pc.setLocalDescription(i)}async resumeReceiving(e){this.assertRecvDirection();for(const t of e){bm.debug("resumeReceiving() [localId:%s]",t);const e=this._mapMidTransceiver.get(t);if(!e)throw new Error("associated RTCRtpTransceiver not found");e.direction="recvonly",this._remoteSdp.resumeReceivingMediaSection(t)}const t={type:"offer",sdp:this._remoteSdp.getSdp()};bm.debug("resumeReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const i=await this._pc.createAnswer();bm.debug("resumeReceiving() | calling pc.setLocalDescription() [answer:%o]",i),await this._pc.setLocalDescription(i)}async getReceiverStats(e){this.assertRecvDirection();const t=this._mapMidTransceiver.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.receiver.getStats()}async receiveDataChannel({sctpStreamParameters:e,label:t,protocol:i}){var n;this.assertRecvDirection();const{streamId:s,ordered:a,maxPacketLifeTime:r,maxRetransmits:o}=e,c={negotiated:!0,id:s,ordered:a,maxPacketLifeTime:r,maxRetransmits:o,protocol:i};bm.debug("receiveDataChannel() [options:%o]",c);const p=this._pc.createDataChannel(t,c);if(!this._hasDataChannelMediaSection){this._remoteSdp.receiveSctpAssociation();const e={type:"offer",sdp:this._remoteSdp.getSdp()};bm.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();if(!this._transportReady){const e=cm.parse(t.sdp);await this.setupTransport({localDtlsRole:null!==(n=this._forcedLocalDtlsRole)&&void 0!==n?n:"client",localSdpObject:e})}bm.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setLocalDescription(t),this._hasDataChannelMediaSection=!0}return{dataChannel:p}}async setupTransport({localDtlsRole:e,localSdpObject:t}){t||(t=cm.parse(this._pc.localDescription.sdp));const i=um.extractDtlsParameters({sdpObject:t});i.role=e,this._remoteSdp.updateDtlsRole("client"===e?"server":"client"),await new Promise(((e,t)=>{this.safeEmit("@connect",{dtlsParameters:i},e,t)})),this._transportReady=!0}assertSendDirection(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}assertRecvDirection(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}}sm.ReactNativeUnifiedPlan=ym;var xm={},wm=ei&&ei.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,s)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),Sm=ei&&ei.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Rm=ei&&ei.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&wm(t,e,i);return Sm(t,e),t};Object.defineProperty(xm,"__esModule",{value:!0}),xm.ReactNative=void 0;const Cm=Rm(Lp),km=oc,Tm=fc,Pm=Rm(bc),Em=Rm(_c),Om=Rm(Hp),Dm=Rm(fl),Im=Zp,jm=id,Lm=new km.Logger("ReactNative"),Mm={OS:1024,MIS:1024};class Am extends Im.HandlerInterface{static createFactory(){return()=>new Am}constructor(){super(),this._sendStream=new MediaStream,this._mapSendLocalIdTrack=new Map,this._nextSendLocalId=0,this._mapRecvLocalIdInfo=new Map,this._hasDataChannelMediaSection=!1,this._nextSendSctpStreamId=0,this._transportReady=!1}get name(){return"ReactNative"}close(){if(Lm.debug("close()"),this._sendStream.release(!1),this._pc)try{this._pc.close()}catch(e){}this.emit("@close")}async getNativeRtpCapabilities(){Lm.debug("getNativeRtpCapabilities()");const e=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"plan-b"});try{const t=await e.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0});try{e.close()}catch(e){}const i=Cm.parse(t.sdp);return Om.extractRtpCapabilities({sdpObject:i})}catch(t){try{e.close()}catch(e){}throw t}}async getNativeSctpCapabilities(){return Lm.debug("getNativeSctpCapabilities()"),{numStreams:Mm}}run({direction:e,iceParameters:t,iceCandidates:i,dtlsParameters:n,sctpParameters:s,iceServers:a,iceTransportPolicy:r,additionalSettings:o,proprietaryConstraints:c,extendedRtpCapabilities:p}){Lm.debug("run()"),this._direction=e,this._remoteSdp=new jm.RemoteSdp({iceParameters:t,iceCandidates:i,dtlsParameters:n,sctpParameters:s,planB:!0}),this._sendingRtpParametersByKind={audio:Em.getSendingRtpParameters("audio",p),video:Em.getSendingRtpParameters("video",p)},this._sendingRemoteRtpParametersByKind={audio:Em.getSendingRemoteRtpParameters("audio",p),video:Em.getSendingRemoteRtpParameters("video",p)},n.role&&"auto"!==n.role&&(this._forcedLocalDtlsRole="server"===n.role?"client":"server"),this._pc=new RTCPeerConnection({iceServers:a||[],iceTransportPolicy:r||"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"plan-b",...o},c),this._pc.connectionState?this._pc.addEventListener("connectionstatechange",(()=>{this.emit("@connectionstatechange",this._pc.connectionState)})):this._pc.addEventListener("iceconnectionstatechange",(()=>{switch(Lm.warn("run() | pc.connectionState not supported, using pc.iceConnectionState"),this._pc.iceConnectionState){case"checking":this.emit("@connectionstatechange","connecting");break;case"connected":case"completed":this.emit("@connectionstatechange","connected");break;case"failed":this.emit("@connectionstatechange","failed");break;case"disconnected":this.emit("@connectionstatechange","disconnected");break;case"closed":this.emit("@connectionstatechange","closed")}}))}async updateIceServers(e){Lm.debug("updateIceServers()");const t=this._pc.getConfiguration();t.iceServers=e,this._pc.setConfiguration(t)}async restartIce(e){if(Lm.debug("restartIce()"),this._remoteSdp.updateIceParameters(e),this._transportReady)if("send"===this._direction){const e=await this._pc.createOffer({iceRestart:!0});Lm.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e);const t={type:"answer",sdp:this._remoteSdp.getSdp()};Lm.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setRemoteDescription(t)}else{const e={type:"offer",sdp:this._remoteSdp.getSdp()};Lm.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();Lm.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",t),await this._pc.setLocalDescription(t)}}async getTransportStats(){return this._pc.getStats()}async send({track:e,encodings:t,codecOptions:i,codec:n}){var s;this.assertSendDirection(),Lm.debug("send() [kind:%s, track.id:%s]",e.kind,e.id),n&&Lm.warn("send() | codec selection is not available in %s handler",this.name),this._sendStream.addTrack(e),this._pc.addStream(this._sendStream);let a,r=await this._pc.createOffer(),o=Cm.parse(r.sdp);const c=Pm.clone(this._sendingRtpParametersByKind[e.kind],{});c.codecs=Em.reduceCodecs(c.codecs);const p=Pm.clone(this._sendingRemoteRtpParametersByKind[e.kind],{});if(p.codecs=Em.reduceCodecs(p.codecs),this._transportReady||await this.setupTransport({localDtlsRole:null!==(s=this._forcedLocalDtlsRole)&&void 0!==s?s:"client",localSdpObject:o}),"video"===e.kind&&t&&t.length>1&&(Lm.debug("send() | enabling simulcast"),o=Cm.parse(r.sdp),a=o.media.find((e=>"video"===e.type)),Dm.addLegacySimulcast({offerMediaObject:a,track:e,numStreams:t.length}),r={type:"offer",sdp:Cm.write(o)}),Lm.debug("send() | calling pc.setLocalDescription() [offer:%o]",r),await this._pc.setLocalDescription(r),o=Cm.parse(this._pc.localDescription.sdp),a=o.media.find((t=>t.type===e.kind)),c.rtcp.cname=Om.getCname({offerMediaObject:a}),c.encodings=Dm.getRtpEncodings({offerMediaObject:a,track:e}),t)for(let e=0;e<c.encodings.length;++e)t[e]&&Object.assign(c.encodings[e],t[e]);if(c.encodings.length>1&&("video/vp8"===c.codecs[0].mimeType.toLowerCase()||"video/h264"===c.codecs[0].mimeType.toLowerCase()))for(const e of c.encodings)e.scalabilityMode="L1T3";this._remoteSdp.send({offerMediaObject:a,offerRtpParameters:c,answerRtpParameters:p,codecOptions:i});const d={type:"answer",sdp:this._remoteSdp.getSdp()};Lm.debug("send() | calling pc.setRemoteDescription() [answer:%o]",d),await this._pc.setRemoteDescription(d);const l=String(this._nextSendLocalId);return this._nextSendLocalId++,this._mapSendLocalIdTrack.set(l,e),{localId:l,rtpParameters:c}}async stopSending(e){this.assertSendDirection(),Lm.debug("stopSending() [localId:%s]",e);const t=this._mapSendLocalIdTrack.get(e);if(!t)throw new Error("track not found");this._mapSendLocalIdTrack.delete(e),this._sendStream.removeTrack(t),this._pc.addStream(this._sendStream);const i=await this._pc.createOffer();Lm.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",i);try{await this._pc.setLocalDescription(i)}catch(e){if(0===this._sendStream.getTracks().length)return void Lm.warn("stopSending() | ignoring expected error due no sending tracks: %s",e.toString());throw e}if("stable"===this._pc.signalingState)return;const n={type:"answer",sdp:this._remoteSdp.getSdp()};Lm.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",n),await this._pc.setRemoteDescription(n)}async pauseSending(e){}async resumeSending(e){}async replaceTrack(e,t){throw new Tm.UnsupportedError("not implemented")}async setMaxSpatialLayer(e,t){throw new Tm.UnsupportedError("not implemented")}async setRtpEncodingParameters(e,t){throw new Tm.UnsupportedError("not implemented")}async getSenderStats(e){throw new Tm.UnsupportedError("not implemented")}async sendDataChannel({ordered:e,maxPacketLifeTime:t,maxRetransmits:i,label:n,protocol:s}){var a;this.assertSendDirection();const r={negotiated:!0,id:this._nextSendSctpStreamId,ordered:e,maxPacketLifeTime:t,maxRetransmitTime:t,maxRetransmits:i,protocol:s};Lm.debug("sendDataChannel() [options:%o]",r);const o=this._pc.createDataChannel(n,r);if(this._nextSendSctpStreamId=++this._nextSendSctpStreamId%Mm.MIS,!this._hasDataChannelMediaSection){const e=await this._pc.createOffer(),t=Cm.parse(e.sdp),i=t.media.find((e=>"application"===e.type));this._transportReady||await this.setupTransport({localDtlsRole:null!==(a=this._forcedLocalDtlsRole)&&void 0!==a?a:"client",localSdpObject:t}),Lm.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",e),await this._pc.setLocalDescription(e),this._remoteSdp.sendSctpAssociation({offerMediaObject:i});const n={type:"answer",sdp:this._remoteSdp.getSdp()};Lm.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",n),await this._pc.setRemoteDescription(n),this._hasDataChannelMediaSection=!0}return{dataChannel:o,sctpStreamParameters:{streamId:r.id,ordered:r.ordered,maxPacketLifeTime:r.maxPacketLifeTime,maxRetransmits:r.maxRetransmits}}}async receive(e){var t;this.assertRecvDirection();const i=[],n=new Map;for(const t of e){const{trackId:e,kind:i,rtpParameters:s}=t;Lm.debug("receive() [trackId:%s, kind:%s]",e,i);const a=i;let r=t.streamId||s.rtcp.cname;Lm.debug("receive() | forcing a random remote streamId to avoid well known bug in react-native-webrtc"),r+=`-hack-${Pm.generateRandomNumber()}`,n.set(e,r),this._remoteSdp.receive({mid:a,kind:i,offerRtpParameters:s,streamId:r,trackId:e})}const s={type:"offer",sdp:this._remoteSdp.getSdp()};Lm.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",s),await this._pc.setRemoteDescription(s);let a=await this._pc.createAnswer();const r=Cm.parse(a.sdp);for(const t of e){const{kind:e,rtpParameters:i}=t,n=e,s=r.media.find((e=>String(e.mid)===n));Om.applyCodecParameters({offerRtpParameters:i,answerMediaObject:s})}a={type:"answer",sdp:Cm.write(r)},this._transportReady||await this.setupTransport({localDtlsRole:null!==(t=this._forcedLocalDtlsRole)&&void 0!==t?t:"client",localSdpObject:r}),Lm.debug("receive() | calling pc.setLocalDescription() [answer:%o]",a),await this._pc.setLocalDescription(a);for(const t of e){const{kind:e,trackId:s,rtpParameters:a}=t,r=s,o=e,c=n.get(s),p=this._pc.getRemoteStreams().find((e=>e.id===c)).getTrackById(r);if(!p)throw new Error("remote track not found");this._mapRecvLocalIdInfo.set(r,{mid:o,rtpParameters:a}),i.push({localId:r,track:p})}return i}async stopReceiving(e){this.assertRecvDirection();for(const t of e){Lm.debug("stopReceiving() [localId:%s]",t);const{mid:e,rtpParameters:i}=this._mapRecvLocalIdInfo.get(t)||{};this._mapRecvLocalIdInfo.delete(t),this._remoteSdp.planBStopReceiving({mid:e,offerRtpParameters:i})}const t={type:"offer",sdp:this._remoteSdp.getSdp()};Lm.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",t),await this._pc.setRemoteDescription(t);const i=await this._pc.createAnswer();Lm.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",i),await this._pc.setLocalDescription(i)}async pauseReceiving(e){}async resumeReceiving(e){}async getReceiverStats(e){throw new Tm.UnsupportedError("not implemented")}async receiveDataChannel({sctpStreamParameters:e,label:t,protocol:i}){var n;this.assertRecvDirection();const{streamId:s,ordered:a,maxPacketLifeTime:r,maxRetransmits:o}=e,c={negotiated:!0,id:s,ordered:a,maxPacketLifeTime:r,maxRetransmitTime:r,maxRetransmits:o,protocol:i};Lm.debug("receiveDataChannel() [options:%o]",c);const p=this._pc.createDataChannel(t,c);if(!this._hasDataChannelMediaSection){this._remoteSdp.receiveSctpAssociation({oldDataChannelSpec:!0});const e={type:"offer",sdp:this._remoteSdp.getSdp()};Lm.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",e),await this._pc.setRemoteDescription(e);const t=await this._pc.createAnswer();if(!this._transportReady){const e=Cm.parse(t.sdp);await this.setupTransport({localDtlsRole:null!==(n=this._forcedLocalDtlsRole)&&void 0!==n?n:"client",localSdpObject:e})}Lm.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",t),await this._pc.setLocalDescription(t),this._hasDataChannelMediaSection=!0}return{dataChannel:p}}async setupTransport({localDtlsRole:e,localSdpObject:t}){t||(t=Cm.parse(this._pc.localDescription.sdp));const i=Om.extractDtlsParameters({sdpObject:t});i.role=e,this._remoteSdp.updateDtlsRole("client"===e?"server":"client"),await new Promise(((e,t)=>{this.safeEmit("@connect",{dtlsParameters:i},e,t)})),this._transportReady=!0}assertSendDirection(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}assertRecvDirection(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}}xm.ReactNative=Am;var Nm=ei&&ei.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,s)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),Bm=ei&&ei.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Fm=ei&&ei.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&Nm(t,e,i);return Bm(t,e),t},Um=ei&&ei.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Go,"__esModule",{value:!0}),Go.Device=Go.detectDevice=void 0;const zm=Um(rc),qm=oc,$m=lc,Vm=fc,Wm=Fm(bc),Hm=Fm(_c),Gm=Fc,Km=jp,Jm=Md,Qm=Xd,Ym=hl,Xm=Ol,Zm=Hl,eh=pu,th=ku,ih=zu,nh=sm,sh=xm,ah=new qm.Logger("Device");function rh(){if("object"==typeof navigator&&"ReactNative"===navigator.product)return"undefined"==typeof RTCPeerConnection?void ah.warn("this._detectDevice() | unsupported react-native-webrtc without RTCPeerConnection, forgot to call registerGlobals()?"):"undefined"!=typeof RTCRtpTransceiver?(ah.debug("this._detectDevice() | ReactNative UnifiedPlan handler chosen"),"ReactNativeUnifiedPlan"):(ah.debug("this._detectDevice() | ReactNative PlanB handler chosen"),"ReactNative");if("object"!=typeof navigator||"string"!=typeof navigator.userAgent)ah.warn("this._detectDevice() | unknown device");else{const e=navigator.userAgent,t=zm.default.getParser(e),i=t.getEngine();if(t.satisfies({chrome:">=111",chromium:">=111","microsoft edge":">=111"}))return"Chrome111";if(t.satisfies({chrome:">=74",chromium:">=74","microsoft edge":">=88"}))return"Chrome74";if(t.satisfies({chrome:">=70",chromium:">=70"}))return"Chrome70";if(t.satisfies({chrome:">=67",chromium:">=67"}))return"Chrome67";if(t.satisfies({chrome:">=55",chromium:">=55"}))return"Chrome55";if(t.satisfies({firefox:">=60"}))return"Firefox60";if(t.satisfies({ios:{OS:">=14.3",firefox:">=30.0"}}))return"Safari12";if(t.satisfies({safari:">=12.0"})&&"undefined"!=typeof RTCRtpTransceiver&&RTCRtpTransceiver.prototype.hasOwnProperty("currentDirection"))return"Safari12";if(t.satisfies({safari:">=11"}))return"Safari11";if(t.satisfies({"microsoft edge":">=11"})&&t.satisfies({"microsoft edge":"<=18"}))return"Edge11";if(i.name&&"blink"===i.name.toLowerCase()){const t=e.match(/(?:(?:Chrome|Chromium))[ /](\w+)/i);if(t){const e=Number(t[1]);return e>=111?"Chrome111":e>=74?"Chrome74":e>=70?"Chrome70":e>=67?"Chrome67":"Chrome55"}return"Chrome111"}ah.warn("this._detectDevice() | browser not supported [name:%s, version:%s]",t.getBrowserName(),t.getBrowserVersion())}}Go.detectDevice=rh;Go.Device=class{constructor({handlerName:e,handlerFactory:t,Handler:i}={}){if(this._loaded=!1,this._observer=new $m.EnhancedEventEmitter,ah.debug("constructor()"),i){if(ah.warn("constructor() | Handler option is DEPRECATED, use handlerName or handlerFactory instead"),"string"!=typeof i)throw new TypeError("non string Handler option no longer supported, use handlerFactory instead");e=i}if(e&&t)throw new TypeError("just one of handlerName or handlerInterface can be given");if(t)this._handlerFactory=t;else{if(e)ah.debug("constructor() | handler given: %s",e);else{if(!(e=rh()))throw new Vm.UnsupportedError("device not supported");ah.debug("constructor() | detected handler: %s",e)}switch(e){case"Chrome111":this._handlerFactory=Km.Chrome111.createFactory();break;case"Chrome74":this._handlerFactory=Jm.Chrome74.createFactory();break;case"Chrome70":this._handlerFactory=Qm.Chrome70.createFactory();break;case"Chrome67":this._handlerFactory=Ym.Chrome67.createFactory();break;case"Chrome55":this._handlerFactory=Xm.Chrome55.createFactory();break;case"Firefox60":this._handlerFactory=Zm.Firefox60.createFactory();break;case"Safari12":this._handlerFactory=eh.Safari12.createFactory();break;case"Safari11":this._handlerFactory=th.Safari11.createFactory();break;case"Edge11":this._handlerFactory=ih.Edge11.createFactory();break;case"ReactNativeUnifiedPlan":this._handlerFactory=nh.ReactNativeUnifiedPlan.createFactory();break;case"ReactNative":this._handlerFactory=sh.ReactNative.createFactory();break;default:throw new TypeError(`unknown handlerName "${e}"`)}}const n=this._handlerFactory();this._handlerName=n.name,n.close(),this._extendedRtpCapabilities=void 0,this._recvRtpCapabilities=void 0,this._canProduceByKind={audio:!1,video:!1},this._sctpCapabilities=void 0}get handlerName(){return this._handlerName}get loaded(){return this._loaded}get rtpCapabilities(){if(!this._loaded)throw new Vm.InvalidStateError("not loaded");return this._recvRtpCapabilities}get sctpCapabilities(){if(!this._loaded)throw new Vm.InvalidStateError("not loaded");return this._sctpCapabilities}get observer(){return this._observer}async load({routerRtpCapabilities:e}){let t;ah.debug("load() [routerRtpCapabilities:%o]",e),e=Wm.clone(e,void 0);try{if(this._loaded)throw new Vm.InvalidStateError("already loaded");Hm.validateRtpCapabilities(e),t=this._handlerFactory();const i=await t.getNativeRtpCapabilities();ah.debug("load() | got native RTP capabilities:%o",i),Hm.validateRtpCapabilities(i),this._extendedRtpCapabilities=Hm.getExtendedRtpCapabilities(i,e),ah.debug("load() | got extended RTP capabilities:%o",this._extendedRtpCapabilities),this._canProduceByKind.audio=Hm.canSend("audio",this._extendedRtpCapabilities),this._canProduceByKind.video=Hm.canSend("video",this._extendedRtpCapabilities),this._recvRtpCapabilities=Hm.getRecvRtpCapabilities(this._extendedRtpCapabilities),Hm.validateRtpCapabilities(this._recvRtpCapabilities),ah.debug("load() | got receiving RTP capabilities:%o",this._recvRtpCapabilities),this._sctpCapabilities=await t.getNativeSctpCapabilities(),ah.debug("load() | got native SCTP capabilities:%o",this._sctpCapabilities),Hm.validateSctpCapabilities(this._sctpCapabilities),ah.debug("load() succeeded"),this._loaded=!0,t.close()}catch(e){throw t&&t.close(),e}}canProduce(e){if(!this._loaded)throw new Vm.InvalidStateError("not loaded");if("audio"!==e&&"video"!==e)throw new TypeError(`invalid kind "${e}"`);return this._canProduceByKind[e]}createSendTransport({id:e,iceParameters:t,iceCandidates:i,dtlsParameters:n,sctpParameters:s,iceServers:a,iceTransportPolicy:r,additionalSettings:o,proprietaryConstraints:c,appData:p}){return ah.debug("createSendTransport()"),this.createTransport({direction:"send",id:e,iceParameters:t,iceCandidates:i,dtlsParameters:n,sctpParameters:s,iceServers:a,iceTransportPolicy:r,additionalSettings:o,proprietaryConstraints:c,appData:p})}createRecvTransport({id:e,iceParameters:t,iceCandidates:i,dtlsParameters:n,sctpParameters:s,iceServers:a,iceTransportPolicy:r,additionalSettings:o,proprietaryConstraints:c,appData:p}){return ah.debug("createRecvTransport()"),this.createTransport({direction:"recv",id:e,iceParameters:t,iceCandidates:i,dtlsParameters:n,sctpParameters:s,iceServers:a,iceTransportPolicy:r,additionalSettings:o,proprietaryConstraints:c,appData:p})}createTransport({direction:e,id:t,iceParameters:i,iceCandidates:n,dtlsParameters:s,sctpParameters:a,iceServers:r,iceTransportPolicy:o,additionalSettings:c,proprietaryConstraints:p,appData:d}){if(!this._loaded)throw new Vm.InvalidStateError("not loaded");if("string"!=typeof t)throw new TypeError("missing id");if("object"!=typeof i)throw new TypeError("missing iceParameters");if(!Array.isArray(n))throw new TypeError("missing iceCandidates");if("object"!=typeof s)throw new TypeError("missing dtlsParameters");if(a&&"object"!=typeof a)throw new TypeError("wrong sctpParameters");if(d&&"object"!=typeof d)throw new TypeError("if given, appData must be an object");const l=new Gm.Transport({direction:e,id:t,iceParameters:i,iceCandidates:n,dtlsParameters:s,sctpParameters:a,iceServers:r,iceTransportPolicy:o,additionalSettings:c,proprietaryConstraints:p,appData:d,handlerFactory:this._handlerFactory,extendedRtpCapabilities:this._extendedRtpCapabilities,canProduceByKind:this._canProduceByKind});return this._observer.safeEmit("newtransport",l),l}};var oh={},ch={};Object.defineProperty(ch,"__esModule",{value:!0});var ph={};Object.defineProperty(ph,"__esModule",{value:!0}),function(e){var t=ei&&ei.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,s)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),i=ei&&ei.__exportStar||function(e,i){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(i,n)||t(i,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(Go,e),i(Fc,e),i(Qc,e),i(tp,e),i(rp,e),i(lp,e),i(ch,e),i(ph,e),i(Zp,e),i(fc,e)}(oh),function(e){var t=ei&&ei.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,s)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),i=ei&&ei.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=ei&&ei.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var s in e)"default"!==s&&Object.prototype.hasOwnProperty.call(e,s)&&t(n,e,s);return i(n,e),n},s=ei&&ei.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.debug=e.parseScalabilityMode=e.detectDevice=e.Device=e.version=e.types=void 0;const a=s(jo);e.debug=a.default;const r=Go;Object.defineProperty(e,"Device",{enumerable:!0,get:function(){return r.Device}}),Object.defineProperty(e,"detectDevice",{enumerable:!0,get:function(){return r.detectDevice}});const o=n(oh);e.types=o,e.version="3.6.83";var c=vd;Object.defineProperty(e,"parseScalabilityMode",{enumerable:!0,get:function(){return c.parse}})}(Io);class dh{static parse(e){let t;try{t=JSON.parse(e)}catch(e){return}if("object"==typeof t&&!Array.isArray(t))return t.request?dh._handleRequest(t):t.response?dh._handleResponse(t):t.message?dh._handleMessage(t):void 0}static _handleRequest(e){const t={request:!0};if("string"==typeof e.method&&"number"==typeof e.id)return t.id=e.id,t.method=e.method,t.data=e.data||{},t}static _handleResponse(e){const t={response:!0};if("number"==typeof e.id)return t.id=e.id,e.ok?(t.ok=!0,t.data=e.data||{}):(t.ok=!1,t.errorCode=e.errorCode,t.errorReason=e.errorReason),t}static _handleMessage(e){const t={message:!0};if("string"==typeof e.method)return t.method=e.method,t.data=e.data||{},t}static createRequest(e,t){return{request:!0,id:Math.round(1e7*Math.random()),method:e,data:t||{}}}static createSuccessResponse(e,t){return{response:!0,id:e.id,ok:!0,data:t||{}}}static createErrorResponse(e,t,i){return{response:!0,id:e.id,errorCode:t,errorReason:i}}static createMessage(e,t){return{message:!0,method:e,data:t||{}}}}class lh extends l{constructor(e,t,i="whereby-sfu#v4"){super(),this.wsUrl=e,this.protocol=i,this.logger=t,this.sents=new Map,this._setupSocket()}_setupSocket(){this.socket=new WebSocket(this.wsUrl,this.protocol),this.socket.onopen=this._onOpen.bind(this),this.socket.onmessage=this._onMessage.bind(this),this.socket.onclose=this._onClose.bind(this),this.socket.onerror=this._onError.bind(this)}_tearDown(){this.socket.onopen=null,this.socket.onmessage=null,this.socket.onclose=null,this.socket.onerror=null,this.socket=null,this.sents.forEach((e=>e.close())),this.emit("close")}close(){this.socket&&this.socket.close()}_onOpen(){this.logger.log("VegaConnectionManager: Connected"),this.emit("open")}_onMessage(e){const t=dh.parse(e.data);if(!t)return this.logger.log("VegaConnectionManager: Received invalid message",e.data);this.logger.log("VegaConnectionManager: Received message",t),t.response?this._handleResponse(t):t.message&&this.emit("message",t)}_onClose(){this.logger.log("VegaConnectionManager: Disconnected"),this._tearDown()}_onError(e){this.logger.log("VegaConnectionManager: Error",e)}_handleResponse(e){const t=this.sents.get(e.id);if(e.ok)t.resolve(e.data);else{const i=new Error(e.errorReason);t.reject(i)}}send(e){try{this.socket.send(JSON.stringify(e))}catch(e){}}message(e,t={}){const i=dh.createMessage(e,t);this.send(i)}request(e,t={},i=1500*(15+.1*this.sents.size)){const n=dh.createRequest(e,t);return this.send(n),new Promise(((e,t)=>{const s={id:n.id,method:n.method,resolve:t=>{this.sents.delete(n.id)&&(clearTimeout(s.timer),e(t))},reject:e=>{this.sents.delete(n.id)&&(clearTimeout(s.timer),t(e))},timer:setTimeout((()=>{this.sents.delete(n.id)&&t(new Error("request timeout"))}),i),close:()=>{clearTimeout(s.timer),t(new Error("transport closed"))}};this.sents.set(n.id,s)}))}}const uh={codecOptions:{opusDtx:!0,opusFec:!0},encodings:[{dtx:!0,networkPriority:"high"}]},mh={codecOptions:{videoGoogleStartBitrate:500},encodings:[{scaleResolutionDownBy:4,maxBitrate:15e4,networkPriority:"high"},{scaleResolutionDownBy:2,maxBitrate:5e5},{scaleResolutionDownBy:1,maxBitrate:1e6}]},hh={codecOptions:{videoGoogleStartBitrate:500},encodings:[{scaleResolutionDownBy:2,maxBitrate:15e4,networkPriority:"high"},{scaleResolutionDownBy:1,maxBitrate:5e5}]},fh={codecOptions:{videoGoogleStartBitrate:500},encodings:[{scalabilityMode:"L3T2_KEY",networkPriority:"high"}]},gh={encodings:[{networkPriority:"medium"}]},vh={encodings:[{scaleResolutionDownBy:2,dtx:!0,maxBitrate:5e5},{scaleResolutionDownBy:1,dtx:!0,maxBitrate:15e5}]},bh={encodings:[{scalabilityMode:"L1T1",dtx:!0,networkPriority:"high"}]},_h=(e,t,i)=>{const{lowDataModeEnabled:n,simulcastScreenshareOn:s,vp9On:a}=i;return"audio"===e?uh:t?a?bh:s?vh:gh:a?fh:n?hh:mh},yh=()=>{let e=Io.detectDevice()||(/applecoremedia|applewebkit|safari/i.test(navigator.userAgent)?"Safari12":void 0);return/iphone|ipad/i.test(navigator.userAgent)&&(e="Safari12"),e};let xh;const wh=new Uint8Array(16);function Sh(){if(!xh&&(xh="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!xh))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return xh(wh)}var Rh=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const Ch=[];for(let e=0;e<256;++e)Ch.push((e+256).toString(16).slice(1));function kh(e,t=0){return(Ch[e[t+0]]+Ch[e[t+1]]+Ch[e[t+2]]+Ch[e[t+3]]+"-"+Ch[e[t+4]]+Ch[e[t+5]]+"-"+Ch[e[t+6]]+Ch[e[t+7]]+"-"+Ch[e[t+8]]+Ch[e[t+9]]+"-"+Ch[e[t+10]]+Ch[e[t+11]]+Ch[e[t+12]]+Ch[e[t+13]]+Ch[e[t+14]]+Ch[e[t+15]]).toLowerCase()}function Th(e){if(!function(e){return"string"==typeof e&&Rh.test(e)}(e))throw TypeError("Invalid UUID");let t;const i=new Uint8Array(16);return i[0]=(t=parseInt(e.slice(0,8),16))>>>24,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i[4]=(t=parseInt(e.slice(9,13),16))>>>8,i[5]=255&t,i[6]=(t=parseInt(e.slice(14,18),16))>>>8,i[7]=255&t,i[8]=(t=parseInt(e.slice(19,23),16))>>>8,i[9]=255&t,i[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,i[11]=t/4294967296&255,i[12]=t>>>24&255,i[13]=t>>>16&255,i[14]=t>>>8&255,i[15]=255&t,i}function Ph(e,t,i){function n(e,n,s,a){var r;if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));const t=[];for(let i=0;i<e.length;++i)t.push(e.charCodeAt(i));return t}(e)),"string"==typeof n&&(n=Th(n)),16!==(null===(r=n)||void 0===r?void 0:r.length))throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let o=new Uint8Array(16+e.length);if(o.set(n),o.set(e,n.length),o=i(o),o[6]=15&o[6]|t,o[8]=63&o[8]|128,s){a=a||0;for(let e=0;e<16;++e)s[a+e]=o[e];return s}return kh(o)}try{n.name=e}catch(e){}return n.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",n.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",n}function Eh(e){return 14+(e+64>>>9<<4)+1}function Oh(e,t){const i=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(i>>16)<<16|65535&i}function Dh(e,t,i,n,s,a){return Oh((r=Oh(Oh(t,e),Oh(n,a)))<<(o=s)|r>>>32-o,i);var r,o}function Ih(e,t,i,n,s,a,r){return Dh(t&i|~t&n,e,t,s,a,r)}function jh(e,t,i,n,s,a,r){return Dh(t&n|i&~n,e,t,s,a,r)}function Lh(e,t,i,n,s,a,r){return Dh(t^i^n,e,t,s,a,r)}function Mh(e,t,i,n,s,a,r){return Dh(i^(t|~n),e,t,s,a,r)}Ph("v3",48,(function(e){if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(let i=0;i<t.length;++i)e[i]=t.charCodeAt(i)}return function(e){const t=[],i=32*e.length,n="0123456789abcdef";for(let s=0;s<i;s+=8){const i=e[s>>5]>>>s%32&255,a=parseInt(n.charAt(i>>>4&15)+n.charAt(15&i),16);t.push(a)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[Eh(t)-1]=t;let i=1732584193,n=-271733879,s=-1732584194,a=271733878;for(let t=0;t<e.length;t+=16){const r=i,o=n,c=s,p=a;i=Ih(i,n,s,a,e[t],7,-680876936),a=Ih(a,i,n,s,e[t+1],12,-389564586),s=Ih(s,a,i,n,e[t+2],17,606105819),n=Ih(n,s,a,i,e[t+3],22,-1044525330),i=Ih(i,n,s,a,e[t+4],7,-176418897),a=Ih(a,i,n,s,e[t+5],12,1200080426),s=Ih(s,a,i,n,e[t+6],17,-1473231341),n=Ih(n,s,a,i,e[t+7],22,-45705983),i=Ih(i,n,s,a,e[t+8],7,1770035416),a=Ih(a,i,n,s,e[t+9],12,-1958414417),s=Ih(s,a,i,n,e[t+10],17,-42063),n=Ih(n,s,a,i,e[t+11],22,-1990404162),i=Ih(i,n,s,a,e[t+12],7,1804603682),a=Ih(a,i,n,s,e[t+13],12,-40341101),s=Ih(s,a,i,n,e[t+14],17,-1502002290),n=Ih(n,s,a,i,e[t+15],22,1236535329),i=jh(i,n,s,a,e[t+1],5,-165796510),a=jh(a,i,n,s,e[t+6],9,-1069501632),s=jh(s,a,i,n,e[t+11],14,643717713),n=jh(n,s,a,i,e[t],20,-373897302),i=jh(i,n,s,a,e[t+5],5,-701558691),a=jh(a,i,n,s,e[t+10],9,38016083),s=jh(s,a,i,n,e[t+15],14,-660478335),n=jh(n,s,a,i,e[t+4],20,-405537848),i=jh(i,n,s,a,e[t+9],5,568446438),a=jh(a,i,n,s,e[t+14],9,-1019803690),s=jh(s,a,i,n,e[t+3],14,-187363961),n=jh(n,s,a,i,e[t+8],20,1163531501),i=jh(i,n,s,a,e[t+13],5,-1444681467),a=jh(a,i,n,s,e[t+2],9,-51403784),s=jh(s,a,i,n,e[t+7],14,1735328473),n=jh(n,s,a,i,e[t+12],20,-1926607734),i=Lh(i,n,s,a,e[t+5],4,-378558),a=Lh(a,i,n,s,e[t+8],11,-2022574463),s=Lh(s,a,i,n,e[t+11],16,1839030562),n=Lh(n,s,a,i,e[t+14],23,-35309556),i=Lh(i,n,s,a,e[t+1],4,-1530992060),a=Lh(a,i,n,s,e[t+4],11,1272893353),s=Lh(s,a,i,n,e[t+7],16,-155497632),n=Lh(n,s,a,i,e[t+10],23,-1094730640),i=Lh(i,n,s,a,e[t+13],4,681279174),a=Lh(a,i,n,s,e[t],11,-358537222),s=Lh(s,a,i,n,e[t+3],16,-722521979),n=Lh(n,s,a,i,e[t+6],23,76029189),i=Lh(i,n,s,a,e[t+9],4,-640364487),a=Lh(a,i,n,s,e[t+12],11,-421815835),s=Lh(s,a,i,n,e[t+15],16,530742520),n=Lh(n,s,a,i,e[t+2],23,-995338651),i=Mh(i,n,s,a,e[t],6,-198630844),a=Mh(a,i,n,s,e[t+7],10,1126891415),s=Mh(s,a,i,n,e[t+14],15,-1416354905),n=Mh(n,s,a,i,e[t+5],21,-57434055),i=Mh(i,n,s,a,e[t+12],6,1700485571),a=Mh(a,i,n,s,e[t+3],10,-1894986606),s=Mh(s,a,i,n,e[t+10],15,-1051523),n=Mh(n,s,a,i,e[t+1],21,-2054922799),i=Mh(i,n,s,a,e[t+8],6,1873313359),a=Mh(a,i,n,s,e[t+15],10,-30611744),s=Mh(s,a,i,n,e[t+6],15,-1560198380),n=Mh(n,s,a,i,e[t+13],21,1309151649),i=Mh(i,n,s,a,e[t+4],6,-145523070),a=Mh(a,i,n,s,e[t+11],10,-1120210379),s=Mh(s,a,i,n,e[t+2],15,718787259),n=Mh(n,s,a,i,e[t+9],21,-343485551),i=Oh(i,r),n=Oh(n,o),s=Oh(s,c),a=Oh(a,p)}return[i,n,s,a]}(function(e){if(0===e.length)return[];const t=8*e.length,i=new Uint32Array(Eh(t));for(let n=0;n<t;n+=8)i[n>>5]|=(255&e[n/8])<<n%32;return i}(e),8*e.length))}));var Ah={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Nh(e,t,i){if(Ah.randomUUID&&!t&&!e)return Ah.randomUUID();const n=(e=e||{}).random||(e.rng||Sh)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){i=i||0;for(let e=0;e<16;++e)t[i+e]=n[e];return t}return kh(n)}function Bh(e,t,i,n){switch(e){case 0:return t&i^~t&n;case 1:case 3:return t^i^n;case 2:return t&i^t&n^i&n}}function Fh(e,t){return e<<t|e>>>32-t}Ph("v5",80,(function(e){const t=[1518500249,1859775393,2400959708,3395469782],i=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=[];for(let i=0;i<t.length;++i)e.push(t.charCodeAt(i))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);const n=e.length/4+2,s=Math.ceil(n/16),a=new Array(s);for(let t=0;t<s;++t){const i=new Uint32Array(16);for(let n=0;n<16;++n)i[n]=e[64*t+4*n]<<24|e[64*t+4*n+1]<<16|e[64*t+4*n+2]<<8|e[64*t+4*n+3];a[t]=i}a[s-1][14]=8*(e.length-1)/Math.pow(2,32),a[s-1][14]=Math.floor(a[s-1][14]),a[s-1][15]=8*(e.length-1)&4294967295;for(let e=0;e<s;++e){const n=new Uint32Array(80);for(let t=0;t<16;++t)n[t]=a[e][t];for(let e=16;e<80;++e)n[e]=Fh(n[e-3]^n[e-8]^n[e-14]^n[e-16],1);let s=i[0],r=i[1],o=i[2],c=i[3],p=i[4];for(let e=0;e<80;++e){const i=Math.floor(e/20),a=Fh(s,5)+Bh(i,r,o,c)+p+t[i]+n[e]>>>0;p=c,c=o,o=Fh(r,30)>>>0,r=s,s=a}i[0]=i[0]+s>>>0,i[1]=i[1]+r>>>0,i[2]=i[2]+o>>>0,i[3]=i[3]+c>>>0,i[4]=i[4]+p>>>0}return[i[0]>>24&255,i[0]>>16&255,i[0]>>8&255,255&i[0],i[1]>>24&255,i[1]>>16&255,i[1]>>8&255,255&i[1],i[2]>>24&255,i[2]>>16&255,i[2]>>8&255,255&i[2],i[3]>>24&255,i[3]>>16&255,i[3]>>8&255,255&i[3],i[4]>>24&255,i[4]>>16&255,i[4]>>8&255,255&i[4]]}));const Uh=console,zh=Nh(),qh=Nh();class $h{constructor({selfId:e,room:t,emitter:i,serverSocket:n,webrtcProvider:s,features:a,eventClaim:r}){u.ok(e,"selfId is required"),u.ok(t,"room is required"),u.ok(i&&i.emit,"emitter is required"),u.ok(s,"webrtcProvider is required");const{session:o,iceServers:c,sfuServer:p,mediaserverConfigTtlSeconds:d}=t;this._selfId=e,this._room=t,this._roomSessionId=o?.id,this._emitter=i,this._serverSocket=n,this._webrtcProvider=s,this._features=a||{},this._eventClaim=r,this._vegaConnection=null,this._mediasoupDevice=new Io.Device({handlerName:yh()}),this._routerRtpCapabilities=null,this._sendTransport=null,this._receiveTransport=null,this._clientStates=new Map,this._streamIdToVideoConsumerId=new Map,this._consumers=new Map,this._micTrack=null,this._webcamTrack=null,this._screenVideoTrack=null,this._screenAudioTrack=null,this._micProducer=null,this._micProducerPromise=null,this._micPaused=!1,this._webcamProducer=null,this._webcamProducerPromise=null,this._webcamPaused=!1,this._screenVideoProducer=null,this._screenVideoProducerPromise=null,this._screenAudioProducer=null,this._screenAudioProducerPromise=null,this._sndTransportIceRestartPromise=null,this._rcvTransportIceRestartPromise=null,this._stopCameraTimeout=null,this._updateAndScheduleMediaServersRefresh({sfuServer:p,iceServers:c.iceServers||[],mediaserverConfigTtlSeconds:d}),this._socketListenerDeregisterFunctions=[]}_updateAndScheduleMediaServersRefresh({iceServers:e,sfuServer:t,mediaserverConfigTtlSeconds:i}){this._iceServers=e,this._sfuServer=t,this._mediaserverConfigTtlSeconds=i,this._sendTransport?.updateIceServers({iceServers:this._iceServers}),this._receiveTransport?.updateIceServers({iceServers:this._iceServers}),this._clearMediaServersRefresh(),i&&(this._fetchMediaServersTimer=setTimeout((()=>this._emitToSignal(Ei)),1e3*i))}_clearMediaServersRefresh(){this._fetchMediaServersTimer&&(clearTimeout(this._fetchMediaServersTimer),this._fetchMediaServersTimer=null)}setupSocketListeners(){this._socketListenerDeregisterFunctions.push((()=>this._clearMediaServersRefresh()),this._serverSocket.on(Ii,(e=>{e.error?Uh.warn("FETCH_MEDIASERVER_CONFIG failed:",e.error):this._updateAndScheduleMediaServersRefresh(e)})),this._serverSocket.on(ji,(()=>{this._screenVideoTrack&&this._emitScreenshareStarted()}))),this._connect()}_emitScreenshareStarted(){this._emitToSignal(Oi,{streamId:qh,hasAudioTrack:Boolean(this._screenAudioTrack)})}_connect(){const e=`wss://${this._features.sfuServerOverrideHost||[this._sfuServer.url]}?${new URLSearchParams({clientId:this._selfId,organizationId:this._room.organizationId,roomName:this._room.name,eventClaim:this._room.isClaimed?this._eventClaim:null,lowBw:!0}).toString()}`;this._vegaConnection=new lh(e,Uh),this._vegaConnection.on("open",(()=>this._join())),this._vegaConnection.on("close",(()=>this._onClose())),this._vegaConnection.on("message",(e=>this._onMessage(e)))}_onClose(){Uh.debug("_onClose()"),this._sendTransport?.close(),this._receiveTransport?.close(),this._sendTransport=null,this._receiveTransport=null,this._streamIdToVideoConsumerId.clear(),setTimeout((()=>this._connect()),1e3)}async _join(){Uh.debug("join()");try{const{routerRtpCapabilities:e}=await this._vegaConnection.request("getCapabilities");this._routerRtpCapabilities||(((e,t)=>{const{vp9On:i,h264On:n}=t;if(i){const{preferredPayloadType:t}=e.codecs.find((e=>"video/vp9"===e.mimeType.toLowerCase())),{preferredPayloadType:i}=e.codecs.find((e=>"video/rtx"===e.mimeType.toLowerCase()&&e.parameters.apt===t));e.codecs=e.codecs.filter((e=>"audio"===e.kind||e.preferredPayloadType===t||e.preferredPayloadType===i))}else if(n){const{preferredPayloadType:t}=e.codecs.find((e=>"video/h264"===e.mimeType.toLowerCase())),{preferredPayloadType:i}=e.codecs.find((e=>"video/rtx"===e.mimeType.toLowerCase()&&e.parameters.apt===t));e.codecs=e.codecs.filter((e=>"audio"===e.kind||e.preferredPayloadType===t||e.preferredPayloadType===i))}})(e,this._features),this._routerRtpCapabilities=e,await this._mediasoupDevice.load({routerRtpCapabilities:e})),this._vegaConnection.message("setCapabilities",{rtpCapabilities:this._mediasoupDevice.rtpCapabilities}),await Promise.all([this._createTransport(!0),this._createTransport(!1)]);const t=[];!this._micTrack||this._micProducer||this._micProducerPromise||t.push(this._internalSendMic()),!this._webcamTrack||this._webcamProducer||this._webcamProducerPromise||t.push(this._internalSendWebcam()),!this._screenVideoTrack||this._screenVideoProducer||this._screenVideoProducerPromise||t.push(this._internalSendScreenVideo()),!this._screenAudioTrack||this._screenAudioProducer||this._screenAudioProducerPromise||t.push(this._internalSendScreenAudio()),await Promise.all(t)}catch(e){Uh.error("_join() [error:%o]",e),this._onClose()}}async _createTransport(e){const t=e?"createSendTransport":"createRecvTransport",i=await this._vegaConnection.request("createTransport",{producing:e,consuming:!e,enableTcp:!0,enableUdp:!0,preferUdp:!0,sctpParameters:{enableSctp:!0,numSctpStreams:{OS:1024,MIS:1024},maxSctpMessageSize:262144,sctpSendBufferSize:262144}});i.iceServers=this._iceServers,((e,t)=>{if(!t.useOnlyTURN||["off","false","0"].includes(t.useOnlyTURN))return;e.iceTransportPolicy="relay";const i={onlyudp:/^turn:.*transport=udp$/,onlytcp:/^turn:.*transport=tcp$/,onlytls:/^turns:.*transport=tcp$/}[t.useOnlyTURN];i&&(e.iceServers=e.iceServers.filter((e=>e.url&&e.url.match(i))))})(i,this._features);const n=this._mediasoupDevice[t](i),s=async t=>{if(Uh.debug(`Transport ConnectionStateChanged ${t}`),"disconnected"===t||"failed"===t)if(e){if(this._sndTransportIceRestartPromise)return;this._sndTransportIceRestartPromise=this._restartIce(n).finally((()=>{this._sndTransportIceRestartPromise=null}))}else{if(this._rcvTransportIceRestartPromise)return;this._rcvTransportIceRestartPromise=this._restartIce(n).finally((()=>{this._rcvTransportIceRestartPromise=null}))}};n.on("connect",(({dtlsParameters:e},t)=>{this._vegaConnection?.message("connectTransport",{transportId:n.id,dtlsParameters:e}),t()})).on("connectionstatechange",s),n.observer.once("close",(()=>{n.removeListener(s)})),e?(n.on("produce",(async({kind:e,rtpParameters:t,appData:i},s,a)=>{try{const{paused:a}=i,{id:r}=await(this._vegaConnection?.request("produce",{transportId:n.id,kind:e,rtpParameters:t,paused:a,appData:i}));s({id:r})}catch(e){a(e)}})),n.on("producedata",(async({appData:e,sctpStreamParameters:t},i,s)=>{try{const{id:s}=await(this._vegaConnection?.request("produceData",{transportId:n.id,sctpStreamParameters:t,appData:e}));i({id:s})}catch(e){s(e)}})),this._sendTransport=n):this._receiveTransport=n}async _restartIce(e,t=0){if(!e||!("closed"in e)||!("connectionState"in e))return void Uh.debug("_restartIce: No transport or property closed or connectionState!");if(e.closed)return void Uh.debug("_restartIce: Transport is closed!");if("disconnected"!==e.connectionState&&"failed"!==e.connectionState)return void Uh.debug("_restartIce: Connection is healthy ICE restart no loneger needed!");const{iceRestartStarted:i}=e.appData,n=Date.now();if(Number.isFinite(i)&&n-i<3500)return;if(e.appData.iceRestartStarted=n,5<=t)return void Uh.debug("_restartIce: Reached restart ICE maximum retry count!");if(!this._vegaConnection)return void Uh.debug("_restartIce: Connection is undefined");const{iceParameters:s}=await this._vegaConnection.request("restartIce",{transportId:e.id});Uh.debug("_restartIce: ICE restart iceParameters received from SFU: ",s);const a=await e.restartIce({iceParameters:s}).then((()=>null)).catch((e=>e));if(a)switch(Uh.error(`_restartIce: ICE restart failed: ${a}`),a.message){case"missing transportId":case"no such transport":break;default:await new Promise((e=>{setTimeout((()=>{e()}),Math.min(3500*2**t,6e4))})),await this._restartIce(e,t+1)}else await new Promise((e=>{setTimeout((()=>{e()}),6e4*Math.min(8,t+1))})),"failed"!==e.connectionState&&"disconnected"!==e.connectionState||await this._restartIce(e,t+1)}async _internalSendMic(){Uh.debug("_internalSendMic()"),this._micProducerPromise=(async()=>{try{if(!this._micTrack||!this._sendTransport||this._micProducer)return void(this._micProducerPromise=null);const e=this._micPaused,t=await this._sendTransport.produce({track:this._micTrack,disableTrackOnPause:!1,stopTracks:!1,..._h("audio",!1,this._features),appData:{streamId:zh,sourceClientId:this._selfId,screenShare:!1,source:"mic",paused:e}});e?t.pause():t.resume(),this._micProducer=t,t.observer.once("close",(()=>{Uh.debug('micProducer "close" event'),t.appData.localClosed&&this._vegaConnection?.message("closeProducers",{producerIds:[t.id]}),this._micProducer=null,this._micProducerPromise=null})),this._micTrack!==this._micProducer.track&&await this._replaceMicTrack(),this._micPaused!==this._micProducer.paused&&this._pauseResumeMic()}catch(e){Uh.error("micProducer failed:%o",e)}finally{this._micProducerPromise=null,this._micTrack||(this._stopProducer(this._micProducer),this._micProducer=null)}})()}async _replaceMicTrack(){Uh.debug("_replaceMicTrack()"),this._micTrack&&this._micProducer&&!this._micProducer.closed&&this._micProducer.track!==this._micTrack&&(await this._micProducer.replaceTrack({track:this._micTrack}),await this._replaceMicTrack())}_pauseResumeMic(){Uh.debug("_pauseResumeMic()"),this._micProducer&&!this._micProducer.closed&&this._micPaused!==this._micProducer.paused&&(this._micPaused?(this._micProducer.pause(),this._vegaConnection?.message("pauseProducers",{producerIds:[this._micProducer.id]})):(this._micProducer.resume(),this._vegaConnection?.message("resumeProducers",{producerIds:[this._micProducer.id]})),this._pauseResumeMic())}async _sendMic(e){return Uh.debug("_sendMic() [track:%o]",e),this._micTrack=e,this._micProducer?await this._replaceMicTrack():this._micProducerPromise?void 0:this._sendTransport?await this._internalSendMic():void 0}async _internalSendWebcam(){Uh.debug("_internalSendWebcam()"),this._webcamProducerPromise=(async()=>{try{if(!this._webcamTrack||!this._sendTransport||this._webcamProducer)return void(this._webcamProducerPromise=null);const e=this._webcamPaused,t=await this._sendTransport.produce({track:this._webcamTrack,disableTrackOnPause:!1,stopTracks:!1,..._h("video",!1,this._features),appData:{streamId:zh,sourceClientId:this._selfId,screenShare:!1,source:"webcam",paused:e}});e?t.pause():t.resume(),this._webcamProducer=t,t.observer.once("close",(()=>{Uh.debug('webcamProducer "close" event'),t.appData.localClosed&&this._vegaConnection?.message("closeProducers",{producerIds:[t.id]}),this._webcamProducer=null,this._webcamProducerPromise=null})),this._webcamTrack!==this._webcamProducer.track&&await this._replaceWebcamTrack(),this._webcamPaused!==this._webcamProducer.paused&&this._pauseResumeWebcam()}catch(e){Uh.error("webcamProducer failed:%o",e)}finally{this._webcamProducerPromise=null,this._webcamTrack||(await this._stopProducer(this._webcamProducer),this._webcamProducer=null)}})()}async _replaceWebcamTrack(){Uh.debug("_replaceWebcamTrack()"),this._webcamTrack&&this._webcamProducer&&!this._webcamProducer.closed&&this._webcamProducer.track!==this._webcamTrack&&(await this._webcamProducer.replaceTrack({track:this._webcamTrack}),await this._replaceWebcamTrack())}_pauseResumeWebcam(){Uh.debug("_pauseResumeWebcam()"),this._webcamProducer&&!this._webcamProducer.closed&&this._webcamPaused!==this._webcamProducer.paused&&(this._webcamPaused?(this._webcamProducer.pause(),this._vegaConnection?.message("pauseProducers",{producerIds:[this._webcamProducer.id]})):(this._webcamProducer.resume(),this._vegaConnection?.message("resumeProducers",{producerIds:[this._webcamProducer.id]})),this._pauseResumeWebcam())}async _sendWebcam(e){return Uh.debug("_sendWebcam() [track:%o]",e),this._webcamTrack=e,this._webcamProducer?await this._replaceWebcamTrack():this._webcamProducerPromise?void 0:this._sendTransport?await this._internalSendWebcam():void 0}async _internalSendScreenVideo(){Uh.debug("_internalSendScreenVideo()"),this._screenVideoProducerPromise=(async()=>{try{if(!this._screenVideoTrack||!this._sendTransport||this._screenVideoProducer)return void(this._screenVideoProducerPromise=null);const e=await this._sendTransport.produce({track:this._screenVideoTrack,disableTrackOnPause:!1,stopTracks:!1,..._h("video",!0,this._features),appData:{streamId:qh,sourceClientId:this._selfId,screenShare:!0,source:"screenvideo",paused:!1}});this._screenVideoProducer=e,e.observer.once("close",(()=>{Uh.debug('screenVideoProducer "close" event'),e.appData.localClosed&&this._vegaConnection?.message("closeProducers",{producerIds:[e.id]}),this._screenVideoProducer=null,this._screenVideoProducerPromise=null})),this._screenVideoTrack!==this._screenVideoProducer.track&&await this._replaceScreenVideoTrack()}catch(e){Uh.error("screenVideoProducer failed:%o",e)}finally{this._screenVideoProducerPromise=null,this._screenVideoTrack||(await this._stopProducer(this._screenVideoProducer),this._screenVideoProducer=null)}})()}async _replaceScreenVideoTrack(){Uh.debug("_replaceScreenVideoTrack()"),this._screenVideoTrack&&this._screenVideoProducer&&!this._screenVideoProducer.closed&&this._screenVideoProducer.track!==this._screenVideoTrack&&(await this._screenVideoProducer.replaceTrack({track:this._screenVideoTrack}),await this._replaceScreenVideoTrack())}async _sendScreenVideo(e){return Uh.debug("_sendScreenVideo() [track:%o]",e),this._screenVideoTrack=e,this._screenVideoProducer?await this._replaceScreenVideoTrack():this._screenVideoProducerPromise?void 0:this._sendTransport?await this._internalSendScreenVideo():void 0}async _internalSendScreenAudio(){Uh.debug("_internalSendScreenAudio()"),this._screenAudioProducerPromise=(async()=>{try{if(!this._screenAudioTrack||!this._sendTransport||this._screenAudioProducer)return void(this._screenAudioProducerPromise=null);const e=await this._sendTransport.produce({track:this._screenAudioTrack,disableTrackOnPause:!1,stopTracks:!1,..._h("video",!0,this._features),appData:{streamId:qh,sourceClientId:this._selfId,screenShare:!0,source:"screenaudio",paused:!1}});this._screenAudioProducer=e,e.observer.once("close",(()=>{Uh.debug('screenAudioProducer "close" event'),e.appData.localClosed&&this._vegaConnection?.message("closeProducers",{producerIds:[e.id]}),this._screenAudioProducer=null,this._screenAudioProducerPromise=null})),this._screenAudioTrack!==this._screenAudioProducer.track&&await this._replaceScreenAudioTrack()}catch(e){Uh.error("screenAudioProducer failed:%o",e)}finally{this._screenAudioProducerPromise=null,this._screenAudioTrack||(await this._stopProducer(this._screenAudioProducer),this._screenAudioProducer=null)}})()}async _replaceScreenAudioTrack(){Uh.debug("_replaceScreenAudioTrack()"),this._screenAudioTrack&&this._screenAudioProducer&&!this._screenAudioProducer.closed&&this._screenAudioProducer.track!==this._screenAudioTrack&&(await this._screenAudioProducer.replaceTrack({track:this._screenAudioTrack}),await this._replaceScreenAudioTrack())}async _sendScreenAudio(e){return Uh.debug("_sendScreenAudio() [track:%o]",e),this._screenAudioTrack=e,this._screenAudioProducer?await this._replaceScreenAudioTrack():this._screenAudioProducerPromise?void 0:this._sendTransport?await this._internalSendScreenAudio():void 0}_stopProducer(e){Uh.debug("_stopProducer()"),e&&!e.closed&&(e.appData.localClosed=!0,e.close())}isInitializedWith({selfId:e,roomName:t,isSfu:i}){return this._selfId===e&&this._room.name===t&&Boolean(i)}setEventClaim(e){this._eventClaim=e,this._vegaConnection?.message("eventClaim",{eventClaim:e})}setRoomSessionId(e){this._roomSessionId=e}disconnect(e,t,i){if(Uh.debug("disconnect() [clientIdOrStreamId:%s, eventClaim:%s]",e,i),this._clientStates.has(e)){const t=this._clientStates.get(e);t.hasAcceptedWebcamStream=!1,t.hasAcceptedScreenStream=!1,this._syncIncomingStreamsWithPWA(e)}i&&(this._eventClaim=i,this._vegaConnection?.message("eventClaim",{eventClaim:i}))}replaceTrack(e,t){"audio"===t.kind&&(this._micTrack=t,this._replaceMicTrack()),"video"===t.kind&&(this._webcamTrack=t,this._replaceWebcamTrack())}removeStream(e,t,i){Uh.debug("removeStream() [streamId:%s, requestedByClientId:%s]",e,i),this._emitToSignal(Di,{streamId:qh,requestedByClientId:i}),this._stopProducer(this._screenVideoProducer),this._screenVideoProducer=null,this._screenVideoTrack=null,this._stopProducer(this._screenAudioProducer),this._screenAudioProducer=null,this._screenAudioTrack=null}addNewStream(e,t,i,n){if("0"===e){this._micPaused=i,this._webcamPaused=n;const e=t.getVideoTracks()[0],s=t.getAudioTracks()[0];e&&this._sendWebcam(e),s&&this._sendMic(s)}else{const e=t.getVideoTracks()[0],i=t.getAudioTracks()[0];e&&this._sendScreenVideo(e),i&&this._sendScreenAudio(i),this._emitScreenshareStarted()}}stopOrResumeAudio(e,t){Uh.debug("stopOrResumeAudio() [enabled:%s]",t),this._micPaused=!t,this._pauseResumeMic()}stopOrResumeVideo(e,t){if(Uh.debug("stopOrResumeVideo() [enable:%s]",t),this._webcamPaused=!t,this._pauseResumeWebcam(),"chrome"===browserName)if(t){if(0===e.getVideoTracks().length){const t=this._webrtcProvider.getMediaConstraints().video;navigator.mediaDevices.getUserMedia({video:t}).then((t=>{const i=t.getVideoTracks()[0];e.addTrack(i),this._emitToPWA(Si,{streamId:e.id,tracks:[i],screenShare:!1}),this._sendWebcam(i)}))}}else clearTimeout(this._stopCameraTimeout),this._stopCameraTimeout=setTimeout((()=>{e.getVideoTracks().forEach((t=>{!1===t.enabled&&(t.stop(),e.removeTrack(t),this._emitToPWA(Ri,{stream:e,track:t}),this._webcamProducer&&!this._webcamProducer.closed&&this._webcamProducer.track===t&&(this._stopProducer(this._webcamProducer),this._webcamProducer=null,this._webcamTrack=null))}))}),5e3)}supportsScreenShareAudio(){return!0}acceptNewStream({streamId:e,clientId:t}){Uh.debug("acceptNewStream()",{streamId:e,clientId:t});const i=this._getOrCreateClientState(t);e!==t?(i.hasAcceptedScreenStream=!0,i.hasEmittedScreenStream=!1):(i.hasAcceptedWebcamStream=!0,i.hasEmittedWebcamStream=!1),this._syncIncomingStreamsWithPWA(t)}updateStreamResolution(e,t,{width:i,height:n}){Uh.debug("updateStreamResolution()",{streamId:e,width:i,height:n});const s=this._streamIdToVideoConsumerId.get(e),a=this._consumers.get(s);if(!a)return;const r=Math.max(i,n),o=r>=480?r>=960?2:1:0;a.appData.spatialLayer!==o&&(a.appData.spatialLayer=o,this._vegaConnection?.message("setConsumersPreferredLayers",{consumerIds:[s],spatialLayer:o,temporalLayer:o}))}disconnectAll(){this._socketListenerDeregisterFunctions.forEach((e=>{e()})),this._socketListenerDeregisterFunctions=[],this._vegaConnection?.removeAllListeners(),this._vegaConnection?.close(),this._sendTransport?.close(),this._receiveTransport?.close(),this._micTrack=null,this._webcamTrack=null,this._screenVideoTrack=null,this._screenAudioTrack=null,this._streamIdToVideoConsumerId.clear(),this._mediasoupDevice=null}async _onMessage(e){const{method:t,data:i}=e;return Promise.resolve().then((()=>{switch(t){case"consumerReady":return this._onConsumerReady(i);case"consumerClosed":return this._onConsumerClosed(i);case"consumerPaused":return this._onConsumerPaused(i);case"consumerResumed":return this._onConsumerResumed(i);case"dominantSpeaker":return this._onDominantSpeaker(i);default:return void Uh.debug(`unknown message method "${t}"`)}})).catch((e=>{console.error('"message" failed [error:%o]',e)}))}async _onConsumerReady(e){Uh.debug("_onConsumerReady()",{id:e.id,producerId:e.producerId});const t=await this._receiveTransport.consume(e);t.pause(),t.appData.localPaused=!0,t.appData.spatialLayer=2,this._consumers.set(t.id,t),t.observer.once("close",(()=>{this._consumers.delete(t.id),this._consumerClosedCleanup(t)}));const{sourceClientId:i,screenShare:n,streamId:s}=t.appData,a=this._getOrCreateClientState(i);n?(a.hasEmittedScreenStream=!1,a.screenShareStreamId=s):(a.hasEmittedWebcamStream=!1,a.camStreamId=s);let r=n?a.screenStream:a.webcamStream;r&&r.inboundId===s||(r=new MediaStream,r.inboundId=s,n?a.screenStream=r:a.webcamStream=r),"video"===t.kind&&this._streamIdToVideoConsumerId.set(r.id,t.id),r.addTrack(t.track),this._syncIncomingStreamsWithPWA(i)}async _onConsumerClosed({consumerId:e,reason:t}){Uh.debug("_onConsumerClosed()",{consumerId:e,reason:t}),this._consumers.get(e)?.close()}_onConsumerPaused({consumerId:e}){Uh.debug("_onConsumerPaused()",{consumerId:e});const t=this._consumers.get(e);t&&(t.appData.remotePaused=!0,t.pause())}_onConsumerResumed({consumerId:e}){Uh.debug("_onConsumerResumed()",{consumerId:e});const t=this._consumers.get(e);t&&(t.appData.remotePaused=!1,t.appData.localPaused||t.resume())}_onDominantSpeaker({consumerId:e}){const t=this._consumers.get(e);if(!t)return;const{sourceClientId:i}=t.appData;this._emitToPWA(uo,{clientId:i})}_consumerClosedCleanup(e){const{sourceClientId:t,screenShare:i}=e.appData,n=this._getOrCreateClientState(t),s=i?n.screenStream:n.webcamStream;s&&(s.removeTrack(e.track),0===s.getTracks().length&&(this._streamIdToVideoConsumerId.delete(s.id),i?(n.screenStream=null,n.hasEmittedScreenStream=!1,n.screenShareStreamId=null):(n.hasEmittedWebcamStream=!1,n.camStreamId=null)))}_syncIncomingStreamsWithPWA(e){const t=this._getOrCreateClientState(e),{webcamStream:i,screenStream:n,hasEmittedWebcamStream:s,hasEmittedScreenStream:a,hasAcceptedWebcamStream:r,hasAcceptedScreenStream:o,screenShareStreamId:c,camStreamId:p}=t,d=[],l=[];this._consumers.forEach((t=>{if(t.appData.sourceClientId!==e)return;const i=t.appData.screenShare?o:r;!t.appData.localPaused!==i&&(i?(t.appData.remotePaused||t.resume(),t.appData.localPaused=!1,l.push(t.id)):(t.pause(),t.appData.localPaused=!0,d.push(t.id)))})),d.length>0&&this._vegaConnection?.message("pauseConsumers",{consumerIds:d}),l.length>0&&this._vegaConnection?.message("resumeConsumers",{consumerIds:l}),i&&!s&&r&&(this._emitToPWA(yi,{clientId:e,stream:i,streamId:p}),t.hasEmittedWebcamStream=!0),n&&!a&&o&&(this._emitToPWA(yi,{clientId:e,stream:n,streamId:c}),t.hasEmittedScreenStream=!0)}_getOrCreateClientState(e){let t=this._clientStates.get(e);return t||(t={hasAcceptedWebcamStream:!1,hasAcceptedScreenStream:!1,hasEmittedWebcamStream:!1,hasEmittedScreenStream:!1,webcamStream:null,screenStream:null,screenShareStreamId:null,camStreamId:null},this._clientStates.set(e,t)),t}_emitToPWA(e,t){this._emitter.emit(e,t)}_emitToSignal(e,t,i){this._serverSocket.emit(e,t,i)}shouldAcceptStreamsFromBothSides(){return!0}}class Vh{constructor({emitter:e,serverSocket:t,webrtcProvider:i,features:n}){this.emitter=e,this.currentManager=null,t.on(ji,(({room:s,selfId:a,error:r,eventClaim:o})=>{if(r)return;const c={selfId:a,room:s,emitter:e,serverSocket:t,webrtcProvider:i,features:n,eventClaim:o},p=!!s.sfuServer;if(this.currentManager){if(this.currentManager.isInitializedWith({selfId:a,roomName:s.name,isSfu:p}))return void(this.currentManager.setEventClaim&&o&&this.currentManager.setEventClaim(o));this.currentManager.disconnectAll(),e.emit(wi)}let d=null;d=p?new $h(c):new ko(c),d.setupSocketListeners(),e.emit(xi,{rtcManager:d}),this.currentManager=d}))}}const Wh=[{pattern:/^(?:([^.]+)[.])?(server:?\d*)/,separator:"."},{pattern:/^(?:([^.]+)[.])?(localhost:?\d*)/,separator:"."},{pattern:/^(?:([^.]+)[.])?((\d+[.]){3}:?\d*)$/,separator:"."},{pattern:/^(?:([^.]+)-)?(ip-[^.]*[.](?:hereby[.]dev|rfc1918[.]disappear[.]at)(?::\d+|))$/,separator:"-"},{pattern:/^(?:([^.]+)[.])?((:?[^.]+[.]){1,}[^.]+)$/,separator:"."}];function Hh({host:e="whereby.com",protocol:t="https:"}={}){let i="",n=e,s=".";for(const{separator:t,pattern:a}of Wh){const r=a.exec(e);if(r){i=r[1]||"",n=r[2],s=t;break}}const a=i?`${i}${s}${n}`:n;return{domain:n,domainWithSeparator:`${s}${n}`,organizationDomain:a,organization:`${t}//${a}`,service:`${t}//${n}`,subdomain:i}}Hh(window&&window.location);var Gh={};function Kh(e,t){return function(){return e.apply(t,arguments)}}({get exports(){return Gh},set exports(e){Gh=e}}).exports=function(e){return(e instanceof Buffer?e:Buffer.from(e.toString(),"binary")).toString("base64")};const{toString:Jh}=Object.prototype,{getPrototypeOf:Qh}=Object,Yh=(e=>t=>{const i=Jh.call(t);return e[i]||(e[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),Xh=e=>(e=e.toLowerCase(),t=>Yh(t)===e),Zh=e=>t=>typeof t===e,{isArray:ef}=Array,tf=Zh("undefined");const nf=Xh("ArrayBuffer");const sf=Zh("string"),af=Zh("function"),rf=Zh("number"),of=e=>null!==e&&"object"==typeof e,cf=e=>{if("object"!==Yh(e))return!1;const t=Qh(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},pf=Xh("Date"),df=Xh("File"),lf=Xh("Blob"),uf=Xh("FileList"),mf=Xh("URLSearchParams");function hf(e,t,{allOwnKeys:i=!1}={}){if(null==e)return;let n,s;if("object"!=typeof e&&(e=[e]),ef(e))for(n=0,s=e.length;n<s;n++)t.call(null,e[n],n,e);else{const s=i?Object.getOwnPropertyNames(e):Object.keys(e),a=s.length;let r;for(n=0;n<a;n++)r=s[n],t.call(null,e[r],r,e)}}function ff(e,t){t=t.toLowerCase();const i=Object.keys(e);let n,s=i.length;for(;s-- >0;)if(n=i[s],t===n.toLowerCase())return n;return null}const gf="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,vf=e=>!tf(e)&&e!==gf;const bf=(_f="undefined"!=typeof Uint8Array&&Qh(Uint8Array),e=>_f&&e instanceof _f);var _f;const yf=Xh("HTMLFormElement"),xf=(({hasOwnProperty:e})=>(t,i)=>e.call(t,i))(Object.prototype),wf=Xh("RegExp"),Sf=(e,t)=>{const i=Object.getOwnPropertyDescriptors(e),n={};hf(i,((i,s)=>{!1!==t(i,s,e)&&(n[s]=i)})),Object.defineProperties(e,n)};var Rf={isArray:ef,isArrayBuffer:nf,isBuffer:function(e){return null!==e&&!tf(e)&&null!==e.constructor&&!tf(e.constructor)&&af(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{const t="[object FormData]";return e&&("function"==typeof FormData&&e instanceof FormData||Jh.call(e)===t||af(e.toString)&&e.toString()===t)},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&nf(e.buffer),t},isString:sf,isNumber:rf,isBoolean:e=>!0===e||!1===e,isObject:of,isPlainObject:cf,isUndefined:tf,isDate:pf,isFile:df,isBlob:lf,isRegExp:wf,isFunction:af,isStream:e=>of(e)&&af(e.pipe),isURLSearchParams:mf,isTypedArray:bf,isFileList:uf,forEach:hf,merge:function e(){const{caseless:t}=vf(this)&&this||{},i={},n=(n,s)=>{const a=t&&ff(i,s)||s;cf(i[a])&&cf(n)?i[a]=e(i[a],n):cf(n)?i[a]=e({},n):ef(n)?i[a]=n.slice():i[a]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&hf(arguments[e],n);return i},extend:(e,t,i,{allOwnKeys:n}={})=>(hf(t,((t,n)=>{i&&af(t)?e[n]=Kh(t,i):e[n]=t}),{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,i,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),i&&Object.assign(e.prototype,i)},toFlatObject:(e,t,i,n)=>{let s,a,r;const o={};if(t=t||{},null==e)return t;do{for(s=Object.getOwnPropertyNames(e),a=s.length;a-- >0;)r=s[a],n&&!n(r,e,t)||o[r]||(t[r]=e[r],o[r]=!0);e=!1!==i&&Qh(e)}while(e&&(!i||i(e,t))&&e!==Object.prototype);return t},kindOf:Yh,kindOfTest:Xh,endsWith:(e,t,i)=>{e=String(e),(void 0===i||i>e.length)&&(i=e.length),i-=t.length;const n=e.indexOf(t,i);return-1!==n&&n===i},toArray:e=>{if(!e)return null;if(ef(e))return e;let t=e.length;if(!rf(t))return null;const i=new Array(t);for(;t-- >0;)i[t]=e[t];return i},forEachEntry:(e,t)=>{const i=(e&&e[Symbol.iterator]).call(e);let n;for(;(n=i.next())&&!n.done;){const i=n.value;t.call(e,i[0],i[1])}},matchAll:(e,t)=>{let i;const n=[];for(;null!==(i=e.exec(t));)n.push(i);return n},isHTMLForm:yf,hasOwnProperty:xf,hasOwnProp:xf,reduceDescriptors:Sf,freezeMethods:e=>{Sf(e,((t,i)=>{if(af(e)&&-1!==["arguments","caller","callee"].indexOf(i))return!1;const n=e[i];af(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")}))}))},toObjectSet:(e,t)=>{const i={},n=e=>{e.forEach((e=>{i[e]=!0}))};return ef(e)?n(e):n(String(e).split(t)),i},toCamelCase:e=>e.toLowerCase().replace(/[_-\s]([a-z\d])(\w*)/g,(function(e,t,i){return t.toUpperCase()+i})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:ff,global:gf,isContextDefined:vf,toJSONObject:e=>{const t=new Array(10),i=(e,n)=>{if(of(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const s=ef(e)?[]:{};return hf(e,((e,t)=>{const a=i(e,n+1);!tf(a)&&(s[t]=a)})),t[n]=void 0,s}}return e};return i(e,0)}};function Cf(e,t,i,n,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),i&&(this.config=i),n&&(this.request=n),s&&(this.response=s)}Rf.inherits(Cf,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Rf.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const kf=Cf.prototype,Tf={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{Tf[e]={value:e}})),Object.defineProperties(Cf,Tf),Object.defineProperty(kf,"isAxiosError",{value:!0}),Cf.from=(e,t,i,n,s,a)=>{const r=Object.create(kf);return Rf.toFlatObject(e,r,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),Cf.call(r,e.message,t,i,n,s),r.cause=e,r.name=e.name,a&&Object.assign(r,a),r};var Pf=a.Stream,Ef=Of;function Of(){this.source=null,this.dataSize=0,this.maxDataSize=1048576,this.pauseStream=!0,this._maxDataSizeExceeded=!1,this._released=!1,this._bufferedEvents=[]}h.inherits(Of,Pf),Of.create=function(e,t){var i=new this;for(var n in t=t||{})i[n]=t[n];i.source=e;var s=e.emit;return e.emit=function(){return i._handleEmit(arguments),s.apply(e,arguments)},e.on("error",(function(){})),i.pauseStream&&e.pause(),i},Object.defineProperty(Of.prototype,"readable",{configurable:!0,enumerable:!0,get:function(){return this.source.readable}}),Of.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)},Of.prototype.resume=function(){this._released||this.release(),this.source.resume()},Of.prototype.pause=function(){this.source.pause()},Of.prototype.release=function(){this._released=!0,this._bufferedEvents.forEach(function(e){this.emit.apply(this,e)}.bind(this)),this._bufferedEvents=[]},Of.prototype.pipe=function(){var e=Pf.prototype.pipe.apply(this,arguments);return this.resume(),e},Of.prototype._handleEmit=function(e){this._released?this.emit.apply(this,e):("data"===e[0]&&(this.dataSize+=e[1].length,this._checkIfMaxDataSizeExceeded()),this._bufferedEvents.push(e))},Of.prototype._checkIfMaxDataSizeExceeded=function(){if(!(this._maxDataSizeExceeded||this.dataSize<=this.maxDataSize)){this._maxDataSizeExceeded=!0;var e="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this.emit("error",new Error(e))}};var Df=h,If=a.Stream,jf=Ef,Lf=Mf;function Mf(){this.writable=!1,this.readable=!0,this.dataSize=0,this.maxDataSize=2097152,this.pauseStreams=!0,this._released=!1,this._streams=[],this._currentStream=null,this._insideLoop=!1,this._pendingNext=!1}Df.inherits(Mf,If),Mf.create=function(e){var t=new this;for(var i in e=e||{})t[i]=e[i];return t},Mf.isStreamLike=function(e){return"function"!=typeof e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e&&!Buffer.isBuffer(e)},Mf.prototype.append=function(e){if(Mf.isStreamLike(e)){if(!(e instanceof jf)){var t=jf.create(e,{maxDataSize:1/0,pauseStream:this.pauseStreams});e.on("data",this._checkDataSize.bind(this)),e=t}this._handleErrors(e),this.pauseStreams&&e.pause()}return this._streams.push(e),this},Mf.prototype.pipe=function(e,t){return If.prototype.pipe.call(this,e,t),this.resume(),e},Mf.prototype._getNext=function(){if(this._currentStream=null,this._insideLoop)this._pendingNext=!0;else{this._insideLoop=!0;try{do{this._pendingNext=!1,this._realGetNext()}while(this._pendingNext)}finally{this._insideLoop=!1}}},Mf.prototype._realGetNext=function(){var e=this._streams.shift();void 0!==e?"function"==typeof e?e(function(e){Mf.isStreamLike(e)&&(e.on("data",this._checkDataSize.bind(this)),this._handleErrors(e)),this._pipeNext(e)}.bind(this)):this._pipeNext(e):this.end()},Mf.prototype._pipeNext=function(e){if(this._currentStream=e,Mf.isStreamLike(e))return e.on("end",this._getNext.bind(this)),void e.pipe(this,{end:!1});var t=e;this.write(t),this._getNext()},Mf.prototype._handleErrors=function(e){var t=this;e.on("error",(function(e){t._emitError(e)}))},Mf.prototype.write=function(e){this.emit("data",e)},Mf.prototype.pause=function(){this.pauseStreams&&(this.pauseStreams&&this._currentStream&&"function"==typeof this._currentStream.pause&&this._currentStream.pause(),this.emit("pause"))},Mf.prototype.resume=function(){this._released||(this._released=!0,this.writable=!0,this._getNext()),this.pauseStreams&&this._currentStream&&"function"==typeof this._currentStream.resume&&this._currentStream.resume(),this.emit("resume")},Mf.prototype.end=function(){this._reset(),this.emit("end")},Mf.prototype.destroy=function(){this._reset(),this.emit("close")},Mf.prototype._reset=function(){this.writable=!1,this._streams=[],this._currentStream=null},Mf.prototype._checkDataSize=function(){if(this._updateDataSize(),!(this.dataSize<=this.maxDataSize)){var e="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this._emitError(new Error(e))}},Mf.prototype._updateDataSize=function(){this.dataSize=0;var e=this;this._streams.forEach((function(t){t.dataSize&&(e.dataSize+=t.dataSize)})),this._currentStream&&this._currentStream.dataSize&&(this.dataSize+=this._currentStream.dataSize)},Mf.prototype._emitError=function(e){this._reset(),this.emit("error",e)};var Af={},Nf={},Bf={"application/1d-interleaved-parityfec":{source:"iana"},"application/3gpdash-qoe-report+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/3gpp-ims+xml":{source:"iana",compressible:!0},"application/3gpphal+json":{source:"iana",compressible:!0},"application/3gpphalforms+json":{source:"iana",compressible:!0},"application/a2l":{source:"iana"},"application/ace+cbor":{source:"iana"},"application/activemessage":{source:"iana"},"application/activity+json":{source:"iana",compressible:!0},"application/alto-costmap+json":{source:"iana",compressible:!0},"application/alto-costmapfilter+json":{source:"iana",compressible:!0},"application/alto-directory+json":{source:"iana",compressible:!0},"application/alto-endpointcost+json":{source:"iana",compressible:!0},"application/alto-endpointcostparams+json":{source:"iana",compressible:!0},"application/alto-endpointprop+json":{source:"iana",compressible:!0},"application/alto-endpointpropparams+json":{source:"iana",compressible:!0},"application/alto-error+json":{source:"iana",compressible:!0},"application/alto-networkmap+json":{source:"iana",compressible:!0},"application/alto-networkmapfilter+json":{source:"iana",compressible:!0},"application/alto-updatestreamcontrol+json":{source:"iana",compressible:!0},"application/alto-updatestreamparams+json":{source:"iana",compressible:!0},"application/aml":{source:"iana"},"application/andrew-inset":{source:"iana",extensions:["ez"]},"application/applefile":{source:"iana"},"application/applixware":{source:"apache",extensions:["aw"]},"application/at+jwt":{source:"iana"},"application/atf":{source:"iana"},"application/atfx":{source:"iana"},"application/atom+xml":{source:"iana",compressible:!0,extensions:["atom"]},"application/atomcat+xml":{source:"iana",compressible:!0,extensions:["atomcat"]},"application/atomdeleted+xml":{source:"iana",compressible:!0,extensions:["atomdeleted"]},"application/atomicmail":{source:"iana"},"application/atomsvc+xml":{source:"iana",compressible:!0,extensions:["atomsvc"]},"application/atsc-dwd+xml":{source:"iana",compressible:!0,extensions:["dwd"]},"application/atsc-dynamic-event-message":{source:"iana"},"application/atsc-held+xml":{source:"iana",compressible:!0,extensions:["held"]},"application/atsc-rdt+json":{source:"iana",compressible:!0},"application/atsc-rsat+xml":{source:"iana",compressible:!0,extensions:["rsat"]},"application/atxml":{source:"iana"},"application/auth-policy+xml":{source:"iana",compressible:!0},"application/bacnet-xdd+zip":{source:"iana",compressible:!1},"application/batch-smtp":{source:"iana"},"application/bdoc":{compressible:!1,extensions:["bdoc"]},"application/beep+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/calendar+json":{source:"iana",compressible:!0},"application/calendar+xml":{source:"iana",compressible:!0,extensions:["xcs"]},"application/call-completion":{source:"iana"},"application/cals-1840":{source:"iana"},"application/captive+json":{source:"iana",compressible:!0},"application/cbor":{source:"iana"},"application/cbor-seq":{source:"iana"},"application/cccex":{source:"iana"},"application/ccmp+xml":{source:"iana",compressible:!0},"application/ccxml+xml":{source:"iana",compressible:!0,extensions:["ccxml"]},"application/cdfx+xml":{source:"iana",compressible:!0,extensions:["cdfx"]},"application/cdmi-capability":{source:"iana",extensions:["cdmia"]},"application/cdmi-container":{source:"iana",extensions:["cdmic"]},"application/cdmi-domain":{source:"iana",extensions:["cdmid"]},"application/cdmi-object":{source:"iana",extensions:["cdmio"]},"application/cdmi-queue":{source:"iana",extensions:["cdmiq"]},"application/cdni":{source:"iana"},"application/cea":{source:"iana"},"application/cea-2018+xml":{source:"iana",compressible:!0},"application/cellml+xml":{source:"iana",compressible:!0},"application/cfw":{source:"iana"},"application/city+json":{source:"iana",compressible:!0},"application/clr":{source:"iana"},"application/clue+xml":{source:"iana",compressible:!0},"application/clue_info+xml":{source:"iana",compressible:!0},"application/cms":{source:"iana"},"application/cnrp+xml":{source:"iana",compressible:!0},"application/coap-group+json":{source:"iana",compressible:!0},"application/coap-payload":{source:"iana"},"application/commonground":{source:"iana"},"application/conference-info+xml":{source:"iana",compressible:!0},"application/cose":{source:"iana"},"application/cose-key":{source:"iana"},"application/cose-key-set":{source:"iana"},"application/cpl+xml":{source:"iana",compressible:!0,extensions:["cpl"]},"application/csrattrs":{source:"iana"},"application/csta+xml":{source:"iana",compressible:!0},"application/cstadata+xml":{source:"iana",compressible:!0},"application/csvm+json":{source:"iana",compressible:!0},"application/cu-seeme":{source:"apache",extensions:["cu"]},"application/cwt":{source:"iana"},"application/cybercash":{source:"iana"},"application/dart":{compressible:!0},"application/dash+xml":{source:"iana",compressible:!0,extensions:["mpd"]},"application/dash-patch+xml":{source:"iana",compressible:!0,extensions:["mpp"]},"application/dashdelta":{source:"iana"},"application/davmount+xml":{source:"iana",compressible:!0,extensions:["davmount"]},"application/dca-rft":{source:"iana"},"application/dcd":{source:"iana"},"application/dec-dx":{source:"iana"},"application/dialog-info+xml":{source:"iana",compressible:!0},"application/dicom":{source:"iana"},"application/dicom+json":{source:"iana",compressible:!0},"application/dicom+xml":{source:"iana",compressible:!0},"application/dii":{source:"iana"},"application/dit":{source:"iana"},"application/dns":{source:"iana"},"application/dns+json":{source:"iana",compressible:!0},"application/dns-message":{source:"iana"},"application/docbook+xml":{source:"apache",compressible:!0,extensions:["dbk"]},"application/dots+cbor":{source:"iana"},"application/dskpp+xml":{source:"iana",compressible:!0},"application/dssc+der":{source:"iana",extensions:["dssc"]},"application/dssc+xml":{source:"iana",compressible:!0,extensions:["xdssc"]},"application/dvcs":{source:"iana"},"application/ecmascript":{source:"iana",compressible:!0,extensions:["es","ecma"]},"application/edi-consent":{source:"iana"},"application/edi-x12":{source:"iana",compressible:!1},"application/edifact":{source:"iana",compressible:!1},"application/efi":{source:"iana"},"application/elm+json":{source:"iana",charset:"UTF-8",compressible:!0},"application/elm+xml":{source:"iana",compressible:!0},"application/emergencycalldata.cap+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/emergencycalldata.comment+xml":{source:"iana",compressible:!0},"application/emergencycalldata.control+xml":{source:"iana",compressible:!0},"application/emergencycalldata.deviceinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.ecall.msd":{source:"iana"},"application/emergencycalldata.providerinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.serviceinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.subscriberinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.veds+xml":{source:"iana",compressible:!0},"application/emma+xml":{source:"iana",compressible:!0,extensions:["emma"]},"application/emotionml+xml":{source:"iana",compressible:!0,extensions:["emotionml"]},"application/encaprtp":{source:"iana"},"application/epp+xml":{source:"iana",compressible:!0},"application/epub+zip":{source:"iana",compressible:!1,extensions:["epub"]},"application/eshop":{source:"iana"},"application/exi":{source:"iana",extensions:["exi"]},"application/expect-ct-report+json":{source:"iana",compressible:!0},"application/express":{source:"iana",extensions:["exp"]},"application/fastinfoset":{source:"iana"},"application/fastsoap":{source:"iana"},"application/fdt+xml":{source:"iana",compressible:!0,extensions:["fdt"]},"application/fhir+json":{source:"iana",charset:"UTF-8",compressible:!0},"application/fhir+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/fido.trusted-apps+json":{compressible:!0},"application/fits":{source:"iana"},"application/flexfec":{source:"iana"},"application/font-sfnt":{source:"iana"},"application/font-tdpfr":{source:"iana",extensions:["pfr"]},"application/font-woff":{source:"iana",compressible:!1},"application/framework-attributes+xml":{source:"iana",compressible:!0},"application/geo+json":{source:"iana",compressible:!0,extensions:["geojson"]},"application/geo+json-seq":{source:"iana"},"application/geopackage+sqlite3":{source:"iana"},"application/geoxacml+xml":{source:"iana",compressible:!0},"application/gltf-buffer":{source:"iana"},"application/gml+xml":{source:"iana",compressible:!0,extensions:["gml"]},"application/gpx+xml":{source:"apache",compressible:!0,extensions:["gpx"]},"application/gxf":{source:"apache",extensions:["gxf"]},"application/gzip":{source:"iana",compressible:!1,extensions:["gz"]},"application/h224":{source:"iana"},"application/held+xml":{source:"iana",compressible:!0},"application/hjson":{extensions:["hjson"]},"application/http":{source:"iana"},"application/hyperstudio":{source:"iana",extensions:["stk"]},"application/ibe-key-request+xml":{source:"iana",compressible:!0},"application/ibe-pkg-reply+xml":{source:"iana",compressible:!0},"application/ibe-pp-data":{source:"iana"},"application/iges":{source:"iana"},"application/im-iscomposing+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/index":{source:"iana"},"application/index.cmd":{source:"iana"},"application/index.obj":{source:"iana"},"application/index.response":{source:"iana"},"application/index.vnd":{source:"iana"},"application/inkml+xml":{source:"iana",compressible:!0,extensions:["ink","inkml"]},"application/iotp":{source:"iana"},"application/ipfix":{source:"iana",extensions:["ipfix"]},"application/ipp":{source:"iana"},"application/isup":{source:"iana"},"application/its+xml":{source:"iana",compressible:!0,extensions:["its"]},"application/java-archive":{source:"apache",compressible:!1,extensions:["jar","war","ear"]},"application/java-serialized-object":{source:"apache",compressible:!1,extensions:["ser"]},"application/java-vm":{source:"apache",compressible:!1,extensions:["class"]},"application/javascript":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["js","mjs"]},"application/jf2feed+json":{source:"iana",compressible:!0},"application/jose":{source:"iana"},"application/jose+json":{source:"iana",compressible:!0},"application/jrd+json":{source:"iana",compressible:!0},"application/jscalendar+json":{source:"iana",compressible:!0},"application/json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["json","map"]},"application/json-patch+json":{source:"iana",compressible:!0},"application/json-seq":{source:"iana"},"application/json5":{extensions:["json5"]},"application/jsonml+json":{source:"apache",compressible:!0,extensions:["jsonml"]},"application/jwk+json":{source:"iana",compressible:!0},"application/jwk-set+json":{source:"iana",compressible:!0},"application/jwt":{source:"iana"},"application/kpml-request+xml":{source:"iana",compressible:!0},"application/kpml-response+xml":{source:"iana",compressible:!0},"application/ld+json":{source:"iana",compressible:!0,extensions:["jsonld"]},"application/lgr+xml":{source:"iana",compressible:!0,extensions:["lgr"]},"application/link-format":{source:"iana"},"application/load-control+xml":{source:"iana",compressible:!0},"application/lost+xml":{source:"iana",compressible:!0,extensions:["lostxml"]},"application/lostsync+xml":{source:"iana",compressible:!0},"application/lpf+zip":{source:"iana",compressible:!1},"application/lxf":{source:"iana"},"application/mac-binhex40":{source:"iana",extensions:["hqx"]},"application/mac-compactpro":{source:"apache",extensions:["cpt"]},"application/macwriteii":{source:"iana"},"application/mads+xml":{source:"iana",compressible:!0,extensions:["mads"]},"application/manifest+json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["webmanifest"]},"application/marc":{source:"iana",extensions:["mrc"]},"application/marcxml+xml":{source:"iana",compressible:!0,extensions:["mrcx"]},"application/mathematica":{source:"iana",extensions:["ma","nb","mb"]},"application/mathml+xml":{source:"iana",compressible:!0,extensions:["mathml"]},"application/mathml-content+xml":{source:"iana",compressible:!0},"application/mathml-presentation+xml":{source:"iana",compressible:!0},"application/mbms-associated-procedure-description+xml":{source:"iana",compressible:!0},"application/mbms-deregister+xml":{source:"iana",compressible:!0},"application/mbms-envelope+xml":{source:"iana",compressible:!0},"application/mbms-msk+xml":{source:"iana",compressible:!0},"application/mbms-msk-response+xml":{source:"iana",compressible:!0},"application/mbms-protection-description+xml":{source:"iana",compressible:!0},"application/mbms-reception-report+xml":{source:"iana",compressible:!0},"application/mbms-register+xml":{source:"iana",compressible:!0},"application/mbms-register-response+xml":{source:"iana",compressible:!0},"application/mbms-schedule+xml":{source:"iana",compressible:!0},"application/mbms-user-service-description+xml":{source:"iana",compressible:!0},"application/mbox":{source:"iana",extensions:["mbox"]},"application/media-policy-dataset+xml":{source:"iana",compressible:!0,extensions:["mpf"]},"application/media_control+xml":{source:"iana",compressible:!0},"application/mediaservercontrol+xml":{source:"iana",compressible:!0,extensions:["mscml"]},"application/merge-patch+json":{source:"iana",compressible:!0},"application/metalink+xml":{source:"apache",compressible:!0,extensions:["metalink"]},"application/metalink4+xml":{source:"iana",compressible:!0,extensions:["meta4"]},"application/mets+xml":{source:"iana",compressible:!0,extensions:["mets"]},"application/mf4":{source:"iana"},"application/mikey":{source:"iana"},"application/mipc":{source:"iana"},"application/missing-blocks+cbor-seq":{source:"iana"},"application/mmt-aei+xml":{source:"iana",compressible:!0,extensions:["maei"]},"application/mmt-usd+xml":{source:"iana",compressible:!0,extensions:["musd"]},"application/mods+xml":{source:"iana",compressible:!0,extensions:["mods"]},"application/moss-keys":{source:"iana"},"application/moss-signature":{source:"iana"},"application/mosskey-data":{source:"iana"},"application/mosskey-request":{source:"iana"},"application/mp21":{source:"iana",extensions:["m21","mp21"]},"application/mp4":{source:"iana",extensions:["mp4s","m4p"]},"application/mpeg4-generic":{source:"iana"},"application/mpeg4-iod":{source:"iana"},"application/mpeg4-iod-xmt":{source:"iana"},"application/mrb-consumer+xml":{source:"iana",compressible:!0},"application/mrb-publish+xml":{source:"iana",compressible:!0},"application/msc-ivr+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/msc-mixer+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/msword":{source:"iana",compressible:!1,extensions:["doc","dot"]},"application/mud+json":{source:"iana",compressible:!0},"application/multipart-core":{source:"iana"},"application/mxf":{source:"iana",extensions:["mxf"]},"application/n-quads":{source:"iana",extensions:["nq"]},"application/n-triples":{source:"iana",extensions:["nt"]},"application/nasdata":{source:"iana"},"application/news-checkgroups":{source:"iana",charset:"US-ASCII"},"application/news-groupinfo":{source:"iana",charset:"US-ASCII"},"application/news-transmission":{source:"iana"},"application/nlsml+xml":{source:"iana",compressible:!0},"application/node":{source:"iana",extensions:["cjs"]},"application/nss":{source:"iana"},"application/oauth-authz-req+jwt":{source:"iana"},"application/oblivious-dns-message":{source:"iana"},"application/ocsp-request":{source:"iana"},"application/ocsp-response":{source:"iana"},"application/octet-stream":{source:"iana",compressible:!1,extensions:["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"]},"application/oda":{source:"iana",extensions:["oda"]},"application/odm+xml":{source:"iana",compressible:!0},"application/odx":{source:"iana"},"application/oebps-package+xml":{source:"iana",compressible:!0,extensions:["opf"]},"application/ogg":{source:"iana",compressible:!1,extensions:["ogx"]},"application/omdoc+xml":{source:"apache",compressible:!0,extensions:["omdoc"]},"application/onenote":{source:"apache",extensions:["onetoc","onetoc2","onetmp","onepkg"]},"application/opc-nodeset+xml":{source:"iana",compressible:!0},"application/oscore":{source:"iana"},"application/oxps":{source:"iana",extensions:["oxps"]},"application/p21":{source:"iana"},"application/p21+zip":{source:"iana",compressible:!1},"application/p2p-overlay+xml":{source:"iana",compressible:!0,extensions:["relo"]},"application/parityfec":{source:"iana"},"application/passport":{source:"iana"},"application/patch-ops-error+xml":{source:"iana",compressible:!0,extensions:["xer"]},"application/pdf":{source:"iana",compressible:!1,extensions:["pdf"]},"application/pdx":{source:"iana"},"application/pem-certificate-chain":{source:"iana"},"application/pgp-encrypted":{source:"iana",compressible:!1,extensions:["pgp"]},"application/pgp-keys":{source:"iana",extensions:["asc"]},"application/pgp-signature":{source:"iana",extensions:["asc","sig"]},"application/pics-rules":{source:"apache",extensions:["prf"]},"application/pidf+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/pidf-diff+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/pkcs10":{source:"iana",extensions:["p10"]},"application/pkcs12":{source:"iana"},"application/pkcs7-mime":{source:"iana",extensions:["p7m","p7c"]},"application/pkcs7-signature":{source:"iana",extensions:["p7s"]},"application/pkcs8":{source:"iana",extensions:["p8"]},"application/pkcs8-encrypted":{source:"iana"},"application/pkix-attr-cert":{source:"iana",extensions:["ac"]},"application/pkix-cert":{source:"iana",extensions:["cer"]},"application/pkix-crl":{source:"iana",extensions:["crl"]},"application/pkix-pkipath":{source:"iana",extensions:["pkipath"]},"application/pkixcmp":{source:"iana",extensions:["pki"]},"application/pls+xml":{source:"iana",compressible:!0,extensions:["pls"]},"application/poc-settings+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/postscript":{source:"iana",compressible:!0,extensions:["ai","eps","ps"]},"application/ppsp-tracker+json":{source:"iana",compressible:!0},"application/problem+json":{source:"iana",compressible:!0},"application/problem+xml":{source:"iana",compressible:!0},"application/provenance+xml":{source:"iana",compressible:!0,extensions:["provx"]},"application/prs.alvestrand.titrax-sheet":{source:"iana"},"application/prs.cww":{source:"iana",extensions:["cww"]},"application/prs.cyn":{source:"iana",charset:"7-BIT"},"application/prs.hpub+zip":{source:"iana",compressible:!1},"application/prs.nprend":{source:"iana"},"application/prs.plucker":{source:"iana"},"application/prs.rdf-xml-crypt":{source:"iana"},"application/prs.xsf+xml":{source:"iana",compressible:!0},"application/pskc+xml":{source:"iana",compressible:!0,extensions:["pskcxml"]},"application/pvd+json":{source:"iana",compressible:!0},"application/qsig":{source:"iana"},"application/raml+yaml":{compressible:!0,extensions:["raml"]},"application/raptorfec":{source:"iana"},"application/rdap+json":{source:"iana",compressible:!0},"application/rdf+xml":{source:"iana",compressible:!0,extensions:["rdf","owl"]},"application/reginfo+xml":{source:"iana",compressible:!0,extensions:["rif"]},"application/relax-ng-compact-syntax":{source:"iana",extensions:["rnc"]},"application/remote-printing":{source:"iana"},"application/reputon+json":{source:"iana",compressible:!0},"application/resource-lists+xml":{source:"iana",compressible:!0,extensions:["rl"]},"application/resource-lists-diff+xml":{source:"iana",compressible:!0,extensions:["rld"]},"application/rfc+xml":{source:"iana",compressible:!0},"application/riscos":{source:"iana"},"application/rlmi+xml":{source:"iana",compressible:!0},"application/rls-services+xml":{source:"iana",compressible:!0,extensions:["rs"]},"application/route-apd+xml":{source:"iana",compressible:!0,extensions:["rapd"]},"application/route-s-tsid+xml":{source:"iana",compressible:!0,extensions:["sls"]},"application/route-usd+xml":{source:"iana",compressible:!0,extensions:["rusd"]},"application/rpki-ghostbusters":{source:"iana",extensions:["gbr"]},"application/rpki-manifest":{source:"iana",extensions:["mft"]},"application/rpki-publication":{source:"iana"},"application/rpki-roa":{source:"iana",extensions:["roa"]},"application/rpki-updown":{source:"iana"},"application/rsd+xml":{source:"apache",compressible:!0,extensions:["rsd"]},"application/rss+xml":{source:"apache",compressible:!0,extensions:["rss"]},"application/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"application/rtploopback":{source:"iana"},"application/rtx":{source:"iana"},"application/samlassertion+xml":{source:"iana",compressible:!0},"application/samlmetadata+xml":{source:"iana",compressible:!0},"application/sarif+json":{source:"iana",compressible:!0},"application/sarif-external-properties+json":{source:"iana",compressible:!0},"application/sbe":{source:"iana"},"application/sbml+xml":{source:"iana",compressible:!0,extensions:["sbml"]},"application/scaip+xml":{source:"iana",compressible:!0},"application/scim+json":{source:"iana",compressible:!0},"application/scvp-cv-request":{source:"iana",extensions:["scq"]},"application/scvp-cv-response":{source:"iana",extensions:["scs"]},"application/scvp-vp-request":{source:"iana",extensions:["spq"]},"application/scvp-vp-response":{source:"iana",extensions:["spp"]},"application/sdp":{source:"iana",extensions:["sdp"]},"application/secevent+jwt":{source:"iana"},"application/senml+cbor":{source:"iana"},"application/senml+json":{source:"iana",compressible:!0},"application/senml+xml":{source:"iana",compressible:!0,extensions:["senmlx"]},"application/senml-etch+cbor":{source:"iana"},"application/senml-etch+json":{source:"iana",compressible:!0},"application/senml-exi":{source:"iana"},"application/sensml+cbor":{source:"iana"},"application/sensml+json":{source:"iana",compressible:!0},"application/sensml+xml":{source:"iana",compressible:!0,extensions:["sensmlx"]},"application/sensml-exi":{source:"iana"},"application/sep+xml":{source:"iana",compressible:!0},"application/sep-exi":{source:"iana"},"application/session-info":{source:"iana"},"application/set-payment":{source:"iana"},"application/set-payment-initiation":{source:"iana",extensions:["setpay"]},"application/set-registration":{source:"iana"},"application/set-registration-initiation":{source:"iana",extensions:["setreg"]},"application/sgml":{source:"iana"},"application/sgml-open-catalog":{source:"iana"},"application/shf+xml":{source:"iana",compressible:!0,extensions:["shf"]},"application/sieve":{source:"iana",extensions:["siv","sieve"]},"application/simple-filter+xml":{source:"iana",compressible:!0},"application/simple-message-summary":{source:"iana"},"application/simplesymbolcontainer":{source:"iana"},"application/sipc":{source:"iana"},"application/slate":{source:"iana"},"application/smil":{source:"iana"},"application/smil+xml":{source:"iana",compressible:!0,extensions:["smi","smil"]},"application/smpte336m":{source:"iana"},"application/soap+fastinfoset":{source:"iana"},"application/soap+xml":{source:"iana",compressible:!0},"application/sparql-query":{source:"iana",extensions:["rq"]},"application/sparql-results+xml":{source:"iana",compressible:!0,extensions:["srx"]},"application/spdx+json":{source:"iana",compressible:!0},"application/spirits-event+xml":{source:"iana",compressible:!0},"application/sql":{source:"iana"},"application/srgs":{source:"iana",extensions:["gram"]},"application/srgs+xml":{source:"iana",compressible:!0,extensions:["grxml"]},"application/sru+xml":{source:"iana",compressible:!0,extensions:["sru"]},"application/ssdl+xml":{source:"apache",compressible:!0,extensions:["ssdl"]},"application/ssml+xml":{source:"iana",compressible:!0,extensions:["ssml"]},"application/stix+json":{source:"iana",compressible:!0},"application/swid+xml":{source:"iana",compressible:!0,extensions:["swidtag"]},"application/tamp-apex-update":{source:"iana"},"application/tamp-apex-update-confirm":{source:"iana"},"application/tamp-community-update":{source:"iana"},"application/tamp-community-update-confirm":{source:"iana"},"application/tamp-error":{source:"iana"},"application/tamp-sequence-adjust":{source:"iana"},"application/tamp-sequence-adjust-confirm":{source:"iana"},"application/tamp-status-query":{source:"iana"},"application/tamp-status-response":{source:"iana"},"application/tamp-update":{source:"iana"},"application/tamp-update-confirm":{source:"iana"},"application/tar":{compressible:!0},"application/taxii+json":{source:"iana",compressible:!0},"application/td+json":{source:"iana",compressible:!0},"application/tei+xml":{source:"iana",compressible:!0,extensions:["tei","teicorpus"]},"application/tetra_isi":{source:"iana"},"application/thraud+xml":{source:"iana",compressible:!0,extensions:["tfi"]},"application/timestamp-query":{source:"iana"},"application/timestamp-reply":{source:"iana"},"application/timestamped-data":{source:"iana",extensions:["tsd"]},"application/tlsrpt+gzip":{source:"iana"},"application/tlsrpt+json":{source:"iana",compressible:!0},"application/tnauthlist":{source:"iana"},"application/token-introspection+jwt":{source:"iana"},"application/toml":{compressible:!0,extensions:["toml"]},"application/trickle-ice-sdpfrag":{source:"iana"},"application/trig":{source:"iana",extensions:["trig"]},"application/ttml+xml":{source:"iana",compressible:!0,extensions:["ttml"]},"application/tve-trigger":{source:"iana"},"application/tzif":{source:"iana"},"application/tzif-leap":{source:"iana"},"application/ubjson":{compressible:!1,extensions:["ubj"]},"application/ulpfec":{source:"iana"},"application/urc-grpsheet+xml":{source:"iana",compressible:!0},"application/urc-ressheet+xml":{source:"iana",compressible:!0,extensions:["rsheet"]},"application/urc-targetdesc+xml":{source:"iana",compressible:!0,extensions:["td"]},"application/urc-uisocketdesc+xml":{source:"iana",compressible:!0},"application/vcard+json":{source:"iana",compressible:!0},"application/vcard+xml":{source:"iana",compressible:!0},"application/vemmi":{source:"iana"},"application/vividence.scriptfile":{source:"apache"},"application/vnd.1000minds.decision-model+xml":{source:"iana",compressible:!0,extensions:["1km"]},"application/vnd.3gpp-prose+xml":{source:"iana",compressible:!0},"application/vnd.3gpp-prose-pc3ch+xml":{source:"iana",compressible:!0},"application/vnd.3gpp-v2x-local-service-information":{source:"iana"},"application/vnd.3gpp.5gnas":{source:"iana"},"application/vnd.3gpp.access-transfer-events+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.bsf+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.gmop+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.gtpc":{source:"iana"},"application/vnd.3gpp.interworking-data":{source:"iana"},"application/vnd.3gpp.lpp":{source:"iana"},"application/vnd.3gpp.mc-signalling-ear":{source:"iana"},"application/vnd.3gpp.mcdata-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-payload":{source:"iana"},"application/vnd.3gpp.mcdata-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-signalling":{source:"iana"},"application/vnd.3gpp.mcdata-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-floor-request+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-location-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-mbms-usage-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-signed+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-ue-init-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-affiliation-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-location-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-mbms-usage-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-transmission-request+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mid-call+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.ngap":{source:"iana"},"application/vnd.3gpp.pfcp":{source:"iana"},"application/vnd.3gpp.pic-bw-large":{source:"iana",extensions:["plb"]},"application/vnd.3gpp.pic-bw-small":{source:"iana",extensions:["psb"]},"application/vnd.3gpp.pic-bw-var":{source:"iana",extensions:["pvb"]},"application/vnd.3gpp.s1ap":{source:"iana"},"application/vnd.3gpp.sms":{source:"iana"},"application/vnd.3gpp.sms+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.srvcc-ext+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.srvcc-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.state-and-event-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.ussd+xml":{source:"iana",compressible:!0},"application/vnd.3gpp2.bcmcsinfo+xml":{source:"iana",compressible:!0},"application/vnd.3gpp2.sms":{source:"iana"},"application/vnd.3gpp2.tcap":{source:"iana",extensions:["tcap"]},"application/vnd.3lightssoftware.imagescal":{source:"iana"},"application/vnd.3m.post-it-notes":{source:"iana",extensions:["pwn"]},"application/vnd.accpac.simply.aso":{source:"iana",extensions:["aso"]},"application/vnd.accpac.simply.imp":{source:"iana",extensions:["imp"]},"application/vnd.acucobol":{source:"iana",extensions:["acu"]},"application/vnd.acucorp":{source:"iana",extensions:["atc","acutc"]},"application/vnd.adobe.air-application-installer-package+zip":{source:"apache",compressible:!1,extensions:["air"]},"application/vnd.adobe.flash.movie":{source:"iana"},"application/vnd.adobe.formscentral.fcdt":{source:"iana",extensions:["fcdt"]},"application/vnd.adobe.fxp":{source:"iana",extensions:["fxp","fxpl"]},"application/vnd.adobe.partial-upload":{source:"iana"},"application/vnd.adobe.xdp+xml":{source:"iana",compressible:!0,extensions:["xdp"]},"application/vnd.adobe.xfdf":{source:"iana",extensions:["xfdf"]},"application/vnd.aether.imp":{source:"iana"},"application/vnd.afpc.afplinedata":{source:"iana"},"application/vnd.afpc.afplinedata-pagedef":{source:"iana"},"application/vnd.afpc.cmoca-cmresource":{source:"iana"},"application/vnd.afpc.foca-charset":{source:"iana"},"application/vnd.afpc.foca-codedfont":{source:"iana"},"application/vnd.afpc.foca-codepage":{source:"iana"},"application/vnd.afpc.modca":{source:"iana"},"application/vnd.afpc.modca-cmtable":{source:"iana"},"application/vnd.afpc.modca-formdef":{source:"iana"},"application/vnd.afpc.modca-mediummap":{source:"iana"},"application/vnd.afpc.modca-objectcontainer":{source:"iana"},"application/vnd.afpc.modca-overlay":{source:"iana"},"application/vnd.afpc.modca-pagesegment":{source:"iana"},"application/vnd.age":{source:"iana",extensions:["age"]},"application/vnd.ah-barcode":{source:"iana"},"application/vnd.ahead.space":{source:"iana",extensions:["ahead"]},"application/vnd.airzip.filesecure.azf":{source:"iana",extensions:["azf"]},"application/vnd.airzip.filesecure.azs":{source:"iana",extensions:["azs"]},"application/vnd.amadeus+json":{source:"iana",compressible:!0},"application/vnd.amazon.ebook":{source:"apache",extensions:["azw"]},"application/vnd.amazon.mobi8-ebook":{source:"iana"},"application/vnd.americandynamics.acc":{source:"iana",extensions:["acc"]},"application/vnd.amiga.ami":{source:"iana",extensions:["ami"]},"application/vnd.amundsen.maze+xml":{source:"iana",compressible:!0},"application/vnd.android.ota":{source:"iana"},"application/vnd.android.package-archive":{source:"apache",compressible:!1,extensions:["apk"]},"application/vnd.anki":{source:"iana"},"application/vnd.anser-web-certificate-issue-initiation":{source:"iana",extensions:["cii"]},"application/vnd.anser-web-funds-transfer-initiation":{source:"apache",extensions:["fti"]},"application/vnd.antix.game-component":{source:"iana",extensions:["atx"]},"application/vnd.apache.arrow.file":{source:"iana"},"application/vnd.apache.arrow.stream":{source:"iana"},"application/vnd.apache.thrift.binary":{source:"iana"},"application/vnd.apache.thrift.compact":{source:"iana"},"application/vnd.apache.thrift.json":{source:"iana"},"application/vnd.api+json":{source:"iana",compressible:!0},"application/vnd.aplextor.warrp+json":{source:"iana",compressible:!0},"application/vnd.apothekende.reservation+json":{source:"iana",compressible:!0},"application/vnd.apple.installer+xml":{source:"iana",compressible:!0,extensions:["mpkg"]},"application/vnd.apple.keynote":{source:"iana",extensions:["key"]},"application/vnd.apple.mpegurl":{source:"iana",extensions:["m3u8"]},"application/vnd.apple.numbers":{source:"iana",extensions:["numbers"]},"application/vnd.apple.pages":{source:"iana",extensions:["pages"]},"application/vnd.apple.pkpass":{compressible:!1,extensions:["pkpass"]},"application/vnd.arastra.swi":{source:"iana"},"application/vnd.aristanetworks.swi":{source:"iana",extensions:["swi"]},"application/vnd.artisan+json":{source:"iana",compressible:!0},"application/vnd.artsquare":{source:"iana"},"application/vnd.astraea-software.iota":{source:"iana",extensions:["iota"]},"application/vnd.audiograph":{source:"iana",extensions:["aep"]},"application/vnd.autopackage":{source:"iana"},"application/vnd.avalon+json":{source:"iana",compressible:!0},"application/vnd.avistar+xml":{source:"iana",compressible:!0},"application/vnd.balsamiq.bmml+xml":{source:"iana",compressible:!0,extensions:["bmml"]},"application/vnd.balsamiq.bmpr":{source:"iana"},"application/vnd.banana-accounting":{source:"iana"},"application/vnd.bbf.usp.error":{source:"iana"},"application/vnd.bbf.usp.msg":{source:"iana"},"application/vnd.bbf.usp.msg+json":{source:"iana",compressible:!0},"application/vnd.bekitzur-stech+json":{source:"iana",compressible:!0},"application/vnd.bint.med-content":{source:"iana"},"application/vnd.biopax.rdf+xml":{source:"iana",compressible:!0},"application/vnd.blink-idb-value-wrapper":{source:"iana"},"application/vnd.blueice.multipass":{source:"iana",extensions:["mpm"]},"application/vnd.bluetooth.ep.oob":{source:"iana"},"application/vnd.bluetooth.le.oob":{source:"iana"},"application/vnd.bmi":{source:"iana",extensions:["bmi"]},"application/vnd.bpf":{source:"iana"},"application/vnd.bpf3":{source:"iana"},"application/vnd.businessobjects":{source:"iana",extensions:["rep"]},"application/vnd.byu.uapi+json":{source:"iana",compressible:!0},"application/vnd.cab-jscript":{source:"iana"},"application/vnd.canon-cpdl":{source:"iana"},"application/vnd.canon-lips":{source:"iana"},"application/vnd.capasystems-pg+json":{source:"iana",compressible:!0},"application/vnd.cendio.thinlinc.clientconf":{source:"iana"},"application/vnd.century-systems.tcp_stream":{source:"iana"},"application/vnd.chemdraw+xml":{source:"iana",compressible:!0,extensions:["cdxml"]},"application/vnd.chess-pgn":{source:"iana"},"application/vnd.chipnuts.karaoke-mmd":{source:"iana",extensions:["mmd"]},"application/vnd.ciedi":{source:"iana"},"application/vnd.cinderella":{source:"iana",extensions:["cdy"]},"application/vnd.cirpack.isdn-ext":{source:"iana"},"application/vnd.citationstyles.style+xml":{source:"iana",compressible:!0,extensions:["csl"]},"application/vnd.claymore":{source:"iana",extensions:["cla"]},"application/vnd.cloanto.rp9":{source:"iana",extensions:["rp9"]},"application/vnd.clonk.c4group":{source:"iana",extensions:["c4g","c4d","c4f","c4p","c4u"]},"application/vnd.cluetrust.cartomobile-config":{source:"iana",extensions:["c11amc"]},"application/vnd.cluetrust.cartomobile-config-pkg":{source:"iana",extensions:["c11amz"]},"application/vnd.coffeescript":{source:"iana"},"application/vnd.collabio.xodocuments.document":{source:"iana"},"application/vnd.collabio.xodocuments.document-template":{source:"iana"},"application/vnd.collabio.xodocuments.presentation":{source:"iana"},"application/vnd.collabio.xodocuments.presentation-template":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet-template":{source:"iana"},"application/vnd.collection+json":{source:"iana",compressible:!0},"application/vnd.collection.doc+json":{source:"iana",compressible:!0},"application/vnd.collection.next+json":{source:"iana",compressible:!0},"application/vnd.comicbook+zip":{source:"iana",compressible:!1},"application/vnd.comicbook-rar":{source:"iana"},"application/vnd.commerce-battelle":{source:"iana"},"application/vnd.commonspace":{source:"iana",extensions:["csp"]},"application/vnd.contact.cmsg":{source:"iana",extensions:["cdbcmsg"]},"application/vnd.coreos.ignition+json":{source:"iana",compressible:!0},"application/vnd.cosmocaller":{source:"iana",extensions:["cmc"]},"application/vnd.crick.clicker":{source:"iana",extensions:["clkx"]},"application/vnd.crick.clicker.keyboard":{source:"iana",extensions:["clkk"]},"application/vnd.crick.clicker.palette":{source:"iana",extensions:["clkp"]},"application/vnd.crick.clicker.template":{source:"iana",extensions:["clkt"]},"application/vnd.crick.clicker.wordbank":{source:"iana",extensions:["clkw"]},"application/vnd.criticaltools.wbs+xml":{source:"iana",compressible:!0,extensions:["wbs"]},"application/vnd.cryptii.pipe+json":{source:"iana",compressible:!0},"application/vnd.crypto-shade-file":{source:"iana"},"application/vnd.cryptomator.encrypted":{source:"iana"},"application/vnd.cryptomator.vault":{source:"iana"},"application/vnd.ctc-posml":{source:"iana",extensions:["pml"]},"application/vnd.ctct.ws+xml":{source:"iana",compressible:!0},"application/vnd.cups-pdf":{source:"iana"},"application/vnd.cups-postscript":{source:"iana"},"application/vnd.cups-ppd":{source:"iana",extensions:["ppd"]},"application/vnd.cups-raster":{source:"iana"},"application/vnd.cups-raw":{source:"iana"},"application/vnd.curl":{source:"iana"},"application/vnd.curl.car":{source:"apache",extensions:["car"]},"application/vnd.curl.pcurl":{source:"apache",extensions:["pcurl"]},"application/vnd.cyan.dean.root+xml":{source:"iana",compressible:!0},"application/vnd.cybank":{source:"iana"},"application/vnd.cyclonedx+json":{source:"iana",compressible:!0},"application/vnd.cyclonedx+xml":{source:"iana",compressible:!0},"application/vnd.d2l.coursepackage1p0+zip":{source:"iana",compressible:!1},"application/vnd.d3m-dataset":{source:"iana"},"application/vnd.d3m-problem":{source:"iana"},"application/vnd.dart":{source:"iana",compressible:!0,extensions:["dart"]},"application/vnd.data-vision.rdz":{source:"iana",extensions:["rdz"]},"application/vnd.datapackage+json":{source:"iana",compressible:!0},"application/vnd.dataresource+json":{source:"iana",compressible:!0},"application/vnd.dbf":{source:"iana",extensions:["dbf"]},"application/vnd.debian.binary-package":{source:"iana"},"application/vnd.dece.data":{source:"iana",extensions:["uvf","uvvf","uvd","uvvd"]},"application/vnd.dece.ttml+xml":{source:"iana",compressible:!0,extensions:["uvt","uvvt"]},"application/vnd.dece.unspecified":{source:"iana",extensions:["uvx","uvvx"]},"application/vnd.dece.zip":{source:"iana",extensions:["uvz","uvvz"]},"application/vnd.denovo.fcselayout-link":{source:"iana",extensions:["fe_launch"]},"application/vnd.desmume.movie":{source:"iana"},"application/vnd.dir-bi.plate-dl-nosuffix":{source:"iana"},"application/vnd.dm.delegation+xml":{source:"iana",compressible:!0},"application/vnd.dna":{source:"iana",extensions:["dna"]},"application/vnd.document+json":{source:"iana",compressible:!0},"application/vnd.dolby.mlp":{source:"apache",extensions:["mlp"]},"application/vnd.dolby.mobile.1":{source:"iana"},"application/vnd.dolby.mobile.2":{source:"iana"},"application/vnd.doremir.scorecloud-binary-document":{source:"iana"},"application/vnd.dpgraph":{source:"iana",extensions:["dpg"]},"application/vnd.dreamfactory":{source:"iana",extensions:["dfac"]},"application/vnd.drive+json":{source:"iana",compressible:!0},"application/vnd.ds-keypoint":{source:"apache",extensions:["kpxx"]},"application/vnd.dtg.local":{source:"iana"},"application/vnd.dtg.local.flash":{source:"iana"},"application/vnd.dtg.local.html":{source:"iana"},"application/vnd.dvb.ait":{source:"iana",extensions:["ait"]},"application/vnd.dvb.dvbisl+xml":{source:"iana",compressible:!0},"application/vnd.dvb.dvbj":{source:"iana"},"application/vnd.dvb.esgcontainer":{source:"iana"},"application/vnd.dvb.ipdcdftnotifaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess2":{source:"iana"},"application/vnd.dvb.ipdcesgpdd":{source:"iana"},"application/vnd.dvb.ipdcroaming":{source:"iana"},"application/vnd.dvb.iptv.alfec-base":{source:"iana"},"application/vnd.dvb.iptv.alfec-enhancement":{source:"iana"},"application/vnd.dvb.notif-aggregate-root+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-container+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-generic+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-msglist+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-registration-request+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-registration-response+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-init+xml":{source:"iana",compressible:!0},"application/vnd.dvb.pfr":{source:"iana"},"application/vnd.dvb.service":{source:"iana",extensions:["svc"]},"application/vnd.dxr":{source:"iana"},"application/vnd.dynageo":{source:"iana",extensions:["geo"]},"application/vnd.dzr":{source:"iana"},"application/vnd.easykaraoke.cdgdownload":{source:"iana"},"application/vnd.ecdis-update":{source:"iana"},"application/vnd.ecip.rlp":{source:"iana"},"application/vnd.eclipse.ditto+json":{source:"iana",compressible:!0},"application/vnd.ecowin.chart":{source:"iana",extensions:["mag"]},"application/vnd.ecowin.filerequest":{source:"iana"},"application/vnd.ecowin.fileupdate":{source:"iana"},"application/vnd.ecowin.series":{source:"iana"},"application/vnd.ecowin.seriesrequest":{source:"iana"},"application/vnd.ecowin.seriesupdate":{source:"iana"},"application/vnd.efi.img":{source:"iana"},"application/vnd.efi.iso":{source:"iana"},"application/vnd.emclient.accessrequest+xml":{source:"iana",compressible:!0},"application/vnd.enliven":{source:"iana",extensions:["nml"]},"application/vnd.enphase.envoy":{source:"iana"},"application/vnd.eprints.data+xml":{source:"iana",compressible:!0},"application/vnd.epson.esf":{source:"iana",extensions:["esf"]},"application/vnd.epson.msf":{source:"iana",extensions:["msf"]},"application/vnd.epson.quickanime":{source:"iana",extensions:["qam"]},"application/vnd.epson.salt":{source:"iana",extensions:["slt"]},"application/vnd.epson.ssf":{source:"iana",extensions:["ssf"]},"application/vnd.ericsson.quickcall":{source:"iana"},"application/vnd.espass-espass+zip":{source:"iana",compressible:!1},"application/vnd.eszigno3+xml":{source:"iana",compressible:!0,extensions:["es3","et3"]},"application/vnd.etsi.aoc+xml":{source:"iana",compressible:!0},"application/vnd.etsi.asic-e+zip":{source:"iana",compressible:!1},"application/vnd.etsi.asic-s+zip":{source:"iana",compressible:!1},"application/vnd.etsi.cug+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvcommand+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvdiscovery+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvprofile+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-bc+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-cod+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-npvr+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvservice+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsync+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvueprofile+xml":{source:"iana",compressible:!0},"application/vnd.etsi.mcid+xml":{source:"iana",compressible:!0},"application/vnd.etsi.mheg5":{source:"iana"},"application/vnd.etsi.overload-control-policy-dataset+xml":{source:"iana",compressible:!0},"application/vnd.etsi.pstn+xml":{source:"iana",compressible:!0},"application/vnd.etsi.sci+xml":{source:"iana",compressible:!0},"application/vnd.etsi.simservs+xml":{source:"iana",compressible:!0},"application/vnd.etsi.timestamp-token":{source:"iana"},"application/vnd.etsi.tsl+xml":{source:"iana",compressible:!0},"application/vnd.etsi.tsl.der":{source:"iana"},"application/vnd.eu.kasparian.car+json":{source:"iana",compressible:!0},"application/vnd.eudora.data":{source:"iana"},"application/vnd.evolv.ecig.profile":{source:"iana"},"application/vnd.evolv.ecig.settings":{source:"iana"},"application/vnd.evolv.ecig.theme":{source:"iana"},"application/vnd.exstream-empower+zip":{source:"iana",compressible:!1},"application/vnd.exstream-package":{source:"iana"},"application/vnd.ezpix-album":{source:"iana",extensions:["ez2"]},"application/vnd.ezpix-package":{source:"iana",extensions:["ez3"]},"application/vnd.f-secure.mobile":{source:"iana"},"application/vnd.familysearch.gedcom+zip":{source:"iana",compressible:!1},"application/vnd.fastcopy-disk-image":{source:"iana"},"application/vnd.fdf":{source:"iana",extensions:["fdf"]},"application/vnd.fdsn.mseed":{source:"iana",extensions:["mseed"]},"application/vnd.fdsn.seed":{source:"iana",extensions:["seed","dataless"]},"application/vnd.ffsns":{source:"iana"},"application/vnd.ficlab.flb+zip":{source:"iana",compressible:!1},"application/vnd.filmit.zfc":{source:"iana"},"application/vnd.fints":{source:"iana"},"application/vnd.firemonkeys.cloudcell":{source:"iana"},"application/vnd.flographit":{source:"iana",extensions:["gph"]},"application/vnd.fluxtime.clip":{source:"iana",extensions:["ftc"]},"application/vnd.font-fontforge-sfd":{source:"iana"},"application/vnd.framemaker":{source:"iana",extensions:["fm","frame","maker","book"]},"application/vnd.frogans.fnc":{source:"iana",extensions:["fnc"]},"application/vnd.frogans.ltf":{source:"iana",extensions:["ltf"]},"application/vnd.fsc.weblaunch":{source:"iana",extensions:["fsc"]},"application/vnd.fujifilm.fb.docuworks":{source:"iana"},"application/vnd.fujifilm.fb.docuworks.binder":{source:"iana"},"application/vnd.fujifilm.fb.docuworks.container":{source:"iana"},"application/vnd.fujifilm.fb.jfi+xml":{source:"iana",compressible:!0},"application/vnd.fujitsu.oasys":{source:"iana",extensions:["oas"]},"application/vnd.fujitsu.oasys2":{source:"iana",extensions:["oa2"]},"application/vnd.fujitsu.oasys3":{source:"iana",extensions:["oa3"]},"application/vnd.fujitsu.oasysgp":{source:"iana",extensions:["fg5"]},"application/vnd.fujitsu.oasysprs":{source:"iana",extensions:["bh2"]},"application/vnd.fujixerox.art-ex":{source:"iana"},"application/vnd.fujixerox.art4":{source:"iana"},"application/vnd.fujixerox.ddd":{source:"iana",extensions:["ddd"]},"application/vnd.fujixerox.docuworks":{source:"iana",extensions:["xdw"]},"application/vnd.fujixerox.docuworks.binder":{source:"iana",extensions:["xbd"]},"application/vnd.fujixerox.docuworks.container":{source:"iana"},"application/vnd.fujixerox.hbpl":{source:"iana"},"application/vnd.fut-misnet":{source:"iana"},"application/vnd.futoin+cbor":{source:"iana"},"application/vnd.futoin+json":{source:"iana",compressible:!0},"application/vnd.fuzzysheet":{source:"iana",extensions:["fzs"]},"application/vnd.genomatix.tuxedo":{source:"iana",extensions:["txd"]},"application/vnd.gentics.grd+json":{source:"iana",compressible:!0},"application/vnd.geo+json":{source:"iana",compressible:!0},"application/vnd.geocube+xml":{source:"iana",compressible:!0},"application/vnd.geogebra.file":{source:"iana",extensions:["ggb"]},"application/vnd.geogebra.slides":{source:"iana"},"application/vnd.geogebra.tool":{source:"iana",extensions:["ggt"]},"application/vnd.geometry-explorer":{source:"iana",extensions:["gex","gre"]},"application/vnd.geonext":{source:"iana",extensions:["gxt"]},"application/vnd.geoplan":{source:"iana",extensions:["g2w"]},"application/vnd.geospace":{source:"iana",extensions:["g3w"]},"application/vnd.gerber":{source:"iana"},"application/vnd.globalplatform.card-content-mgt":{source:"iana"},"application/vnd.globalplatform.card-content-mgt-response":{source:"iana"},"application/vnd.gmx":{source:"iana",extensions:["gmx"]},"application/vnd.google-apps.document":{compressible:!1,extensions:["gdoc"]},"application/vnd.google-apps.presentation":{compressible:!1,extensions:["gslides"]},"application/vnd.google-apps.spreadsheet":{compressible:!1,extensions:["gsheet"]},"application/vnd.google-earth.kml+xml":{source:"iana",compressible:!0,extensions:["kml"]},"application/vnd.google-earth.kmz":{source:"iana",compressible:!1,extensions:["kmz"]},"application/vnd.gov.sk.e-form+xml":{source:"iana",compressible:!0},"application/vnd.gov.sk.e-form+zip":{source:"iana",compressible:!1},"application/vnd.gov.sk.xmldatacontainer+xml":{source:"iana",compressible:!0},"application/vnd.grafeq":{source:"iana",extensions:["gqf","gqs"]},"application/vnd.gridmp":{source:"iana"},"application/vnd.groove-account":{source:"iana",extensions:["gac"]},"application/vnd.groove-help":{source:"iana",extensions:["ghf"]},"application/vnd.groove-identity-message":{source:"iana",extensions:["gim"]},"application/vnd.groove-injector":{source:"iana",extensions:["grv"]},"application/vnd.groove-tool-message":{source:"iana",extensions:["gtm"]},"application/vnd.groove-tool-template":{source:"iana",extensions:["tpl"]},"application/vnd.groove-vcard":{source:"iana",extensions:["vcg"]},"application/vnd.hal+json":{source:"iana",compressible:!0},"application/vnd.hal+xml":{source:"iana",compressible:!0,extensions:["hal"]},"application/vnd.handheld-entertainment+xml":{source:"iana",compressible:!0,extensions:["zmm"]},"application/vnd.hbci":{source:"iana",extensions:["hbci"]},"application/vnd.hc+json":{source:"iana",compressible:!0},"application/vnd.hcl-bireports":{source:"iana"},"application/vnd.hdt":{source:"iana"},"application/vnd.heroku+json":{source:"iana",compressible:!0},"application/vnd.hhe.lesson-player":{source:"iana",extensions:["les"]},"application/vnd.hl7cda+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.hl7v2+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.hp-hpgl":{source:"iana",extensions:["hpgl"]},"application/vnd.hp-hpid":{source:"iana",extensions:["hpid"]},"application/vnd.hp-hps":{source:"iana",extensions:["hps"]},"application/vnd.hp-jlyt":{source:"iana",extensions:["jlt"]},"application/vnd.hp-pcl":{source:"iana",extensions:["pcl"]},"application/vnd.hp-pclxl":{source:"iana",extensions:["pclxl"]},"application/vnd.httphone":{source:"iana"},"application/vnd.hydrostatix.sof-data":{source:"iana",extensions:["sfd-hdstx"]},"application/vnd.hyper+json":{source:"iana",compressible:!0},"application/vnd.hyper-item+json":{source:"iana",compressible:!0},"application/vnd.hyperdrive+json":{source:"iana",compressible:!0},"application/vnd.hzn-3d-crossword":{source:"iana"},"application/vnd.ibm.afplinedata":{source:"iana"},"application/vnd.ibm.electronic-media":{source:"iana"},"application/vnd.ibm.minipay":{source:"iana",extensions:["mpy"]},"application/vnd.ibm.modcap":{source:"iana",extensions:["afp","listafp","list3820"]},"application/vnd.ibm.rights-management":{source:"iana",extensions:["irm"]},"application/vnd.ibm.secure-container":{source:"iana",extensions:["sc"]},"application/vnd.iccprofile":{source:"iana",extensions:["icc","icm"]},"application/vnd.ieee.1905":{source:"iana"},"application/vnd.igloader":{source:"iana",extensions:["igl"]},"application/vnd.imagemeter.folder+zip":{source:"iana",compressible:!1},"application/vnd.imagemeter.image+zip":{source:"iana",compressible:!1},"application/vnd.immervision-ivp":{source:"iana",extensions:["ivp"]},"application/vnd.immervision-ivu":{source:"iana",extensions:["ivu"]},"application/vnd.ims.imsccv1p1":{source:"iana"},"application/vnd.ims.imsccv1p2":{source:"iana"},"application/vnd.ims.imsccv1p3":{source:"iana"},"application/vnd.ims.lis.v2.result+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolconsumerprofile+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy.id+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings.simple+json":{source:"iana",compressible:!0},"application/vnd.informedcontrol.rms+xml":{source:"iana",compressible:!0},"application/vnd.informix-visionary":{source:"iana"},"application/vnd.infotech.project":{source:"iana"},"application/vnd.infotech.project+xml":{source:"iana",compressible:!0},"application/vnd.innopath.wamp.notification":{source:"iana"},"application/vnd.insors.igm":{source:"iana",extensions:["igm"]},"application/vnd.intercon.formnet":{source:"iana",extensions:["xpw","xpx"]},"application/vnd.intergeo":{source:"iana",extensions:["i2g"]},"application/vnd.intertrust.digibox":{source:"iana"},"application/vnd.intertrust.nncp":{source:"iana"},"application/vnd.intu.qbo":{source:"iana",extensions:["qbo"]},"application/vnd.intu.qfx":{source:"iana",extensions:["qfx"]},"application/vnd.iptc.g2.catalogitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.conceptitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.knowledgeitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.newsitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.newsmessage+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.packageitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.planningitem+xml":{source:"iana",compressible:!0},"application/vnd.ipunplugged.rcprofile":{source:"iana",extensions:["rcprofile"]},"application/vnd.irepository.package+xml":{source:"iana",compressible:!0,extensions:["irp"]},"application/vnd.is-xpr":{source:"iana",extensions:["xpr"]},"application/vnd.isac.fcs":{source:"iana",extensions:["fcs"]},"application/vnd.iso11783-10+zip":{source:"iana",compressible:!1},"application/vnd.jam":{source:"iana",extensions:["jam"]},"application/vnd.japannet-directory-service":{source:"iana"},"application/vnd.japannet-jpnstore-wakeup":{source:"iana"},"application/vnd.japannet-payment-wakeup":{source:"iana"},"application/vnd.japannet-registration":{source:"iana"},"application/vnd.japannet-registration-wakeup":{source:"iana"},"application/vnd.japannet-setstore-wakeup":{source:"iana"},"application/vnd.japannet-verification":{source:"iana"},"application/vnd.japannet-verification-wakeup":{source:"iana"},"application/vnd.jcp.javame.midlet-rms":{source:"iana",extensions:["rms"]},"application/vnd.jisp":{source:"iana",extensions:["jisp"]},"application/vnd.joost.joda-archive":{source:"iana",extensions:["joda"]},"application/vnd.jsk.isdn-ngn":{source:"iana"},"application/vnd.kahootz":{source:"iana",extensions:["ktz","ktr"]},"application/vnd.kde.karbon":{source:"iana",extensions:["karbon"]},"application/vnd.kde.kchart":{source:"iana",extensions:["chrt"]},"application/vnd.kde.kformula":{source:"iana",extensions:["kfo"]},"application/vnd.kde.kivio":{source:"iana",extensions:["flw"]},"application/vnd.kde.kontour":{source:"iana",extensions:["kon"]},"application/vnd.kde.kpresenter":{source:"iana",extensions:["kpr","kpt"]},"application/vnd.kde.kspread":{source:"iana",extensions:["ksp"]},"application/vnd.kde.kword":{source:"iana",extensions:["kwd","kwt"]},"application/vnd.kenameaapp":{source:"iana",extensions:["htke"]},"application/vnd.kidspiration":{source:"iana",extensions:["kia"]},"application/vnd.kinar":{source:"iana",extensions:["kne","knp"]},"application/vnd.koan":{source:"iana",extensions:["skp","skd","skt","skm"]},"application/vnd.kodak-descriptor":{source:"iana",extensions:["sse"]},"application/vnd.las":{source:"iana"},"application/vnd.las.las+json":{source:"iana",compressible:!0},"application/vnd.las.las+xml":{source:"iana",compressible:!0,extensions:["lasxml"]},"application/vnd.laszip":{source:"iana"},"application/vnd.leap+json":{source:"iana",compressible:!0},"application/vnd.liberty-request+xml":{source:"iana",compressible:!0},"application/vnd.llamagraphics.life-balance.desktop":{source:"iana",extensions:["lbd"]},"application/vnd.llamagraphics.life-balance.exchange+xml":{source:"iana",compressible:!0,extensions:["lbe"]},"application/vnd.logipipe.circuit+zip":{source:"iana",compressible:!1},"application/vnd.loom":{source:"iana"},"application/vnd.lotus-1-2-3":{source:"iana",extensions:["123"]},"application/vnd.lotus-approach":{source:"iana",extensions:["apr"]},"application/vnd.lotus-freelance":{source:"iana",extensions:["pre"]},"application/vnd.lotus-notes":{source:"iana",extensions:["nsf"]},"application/vnd.lotus-organizer":{source:"iana",extensions:["org"]},"application/vnd.lotus-screencam":{source:"iana",extensions:["scm"]},"application/vnd.lotus-wordpro":{source:"iana",extensions:["lwp"]},"application/vnd.macports.portpkg":{source:"iana",extensions:["portpkg"]},"application/vnd.mapbox-vector-tile":{source:"iana",extensions:["mvt"]},"application/vnd.marlin.drm.actiontoken+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.conftoken+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.license+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.mdcf":{source:"iana"},"application/vnd.mason+json":{source:"iana",compressible:!0},"application/vnd.maxar.archive.3tz+zip":{source:"iana",compressible:!1},"application/vnd.maxmind.maxmind-db":{source:"iana"},"application/vnd.mcd":{source:"iana",extensions:["mcd"]},"application/vnd.medcalcdata":{source:"iana",extensions:["mc1"]},"application/vnd.mediastation.cdkey":{source:"iana",extensions:["cdkey"]},"application/vnd.meridian-slingshot":{source:"iana"},"application/vnd.mfer":{source:"iana",extensions:["mwf"]},"application/vnd.mfmp":{source:"iana",extensions:["mfm"]},"application/vnd.micro+json":{source:"iana",compressible:!0},"application/vnd.micrografx.flo":{source:"iana",extensions:["flo"]},"application/vnd.micrografx.igx":{source:"iana",extensions:["igx"]},"application/vnd.microsoft.portable-executable":{source:"iana"},"application/vnd.microsoft.windows.thumbnail-cache":{source:"iana"},"application/vnd.miele+json":{source:"iana",compressible:!0},"application/vnd.mif":{source:"iana",extensions:["mif"]},"application/vnd.minisoft-hp3000-save":{source:"iana"},"application/vnd.mitsubishi.misty-guard.trustweb":{source:"iana"},"application/vnd.mobius.daf":{source:"iana",extensions:["daf"]},"application/vnd.mobius.dis":{source:"iana",extensions:["dis"]},"application/vnd.mobius.mbk":{source:"iana",extensions:["mbk"]},"application/vnd.mobius.mqy":{source:"iana",extensions:["mqy"]},"application/vnd.mobius.msl":{source:"iana",extensions:["msl"]},"application/vnd.mobius.plc":{source:"iana",extensions:["plc"]},"application/vnd.mobius.txf":{source:"iana",extensions:["txf"]},"application/vnd.mophun.application":{source:"iana",extensions:["mpn"]},"application/vnd.mophun.certificate":{source:"iana",extensions:["mpc"]},"application/vnd.motorola.flexsuite":{source:"iana"},"application/vnd.motorola.flexsuite.adsi":{source:"iana"},"application/vnd.motorola.flexsuite.fis":{source:"iana"},"application/vnd.motorola.flexsuite.gotap":{source:"iana"},"application/vnd.motorola.flexsuite.kmr":{source:"iana"},"application/vnd.motorola.flexsuite.ttc":{source:"iana"},"application/vnd.motorola.flexsuite.wem":{source:"iana"},"application/vnd.motorola.iprm":{source:"iana"},"application/vnd.mozilla.xul+xml":{source:"iana",compressible:!0,extensions:["xul"]},"application/vnd.ms-3mfdocument":{source:"iana"},"application/vnd.ms-artgalry":{source:"iana",extensions:["cil"]},"application/vnd.ms-asf":{source:"iana"},"application/vnd.ms-cab-compressed":{source:"iana",extensions:["cab"]},"application/vnd.ms-color.iccprofile":{source:"apache"},"application/vnd.ms-excel":{source:"iana",compressible:!1,extensions:["xls","xlm","xla","xlc","xlt","xlw"]},"application/vnd.ms-excel.addin.macroenabled.12":{source:"iana",extensions:["xlam"]},"application/vnd.ms-excel.sheet.binary.macroenabled.12":{source:"iana",extensions:["xlsb"]},"application/vnd.ms-excel.sheet.macroenabled.12":{source:"iana",extensions:["xlsm"]},"application/vnd.ms-excel.template.macroenabled.12":{source:"iana",extensions:["xltm"]},"application/vnd.ms-fontobject":{source:"iana",compressible:!0,extensions:["eot"]},"application/vnd.ms-htmlhelp":{source:"iana",extensions:["chm"]},"application/vnd.ms-ims":{source:"iana",extensions:["ims"]},"application/vnd.ms-lrm":{source:"iana",extensions:["lrm"]},"application/vnd.ms-office.activex+xml":{source:"iana",compressible:!0},"application/vnd.ms-officetheme":{source:"iana",extensions:["thmx"]},"application/vnd.ms-opentype":{source:"apache",compressible:!0},"application/vnd.ms-outlook":{compressible:!1,extensions:["msg"]},"application/vnd.ms-package.obfuscated-opentype":{source:"apache"},"application/vnd.ms-pki.seccat":{source:"apache",extensions:["cat"]},"application/vnd.ms-pki.stl":{source:"apache",extensions:["stl"]},"application/vnd.ms-playready.initiator+xml":{source:"iana",compressible:!0},"application/vnd.ms-powerpoint":{source:"iana",compressible:!1,extensions:["ppt","pps","pot"]},"application/vnd.ms-powerpoint.addin.macroenabled.12":{source:"iana",extensions:["ppam"]},"application/vnd.ms-powerpoint.presentation.macroenabled.12":{source:"iana",extensions:["pptm"]},"application/vnd.ms-powerpoint.slide.macroenabled.12":{source:"iana",extensions:["sldm"]},"application/vnd.ms-powerpoint.slideshow.macroenabled.12":{source:"iana",extensions:["ppsm"]},"application/vnd.ms-powerpoint.template.macroenabled.12":{source:"iana",extensions:["potm"]},"application/vnd.ms-printdevicecapabilities+xml":{source:"iana",compressible:!0},"application/vnd.ms-printing.printticket+xml":{source:"apache",compressible:!0},"application/vnd.ms-printschematicket+xml":{source:"iana",compressible:!0},"application/vnd.ms-project":{source:"iana",extensions:["mpp","mpt"]},"application/vnd.ms-tnef":{source:"iana"},"application/vnd.ms-windows.devicepairing":{source:"iana"},"application/vnd.ms-windows.nwprinting.oob":{source:"iana"},"application/vnd.ms-windows.printerpairing":{source:"iana"},"application/vnd.ms-windows.wsd.oob":{source:"iana"},"application/vnd.ms-wmdrm.lic-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.lic-resp":{source:"iana"},"application/vnd.ms-wmdrm.meter-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.meter-resp":{source:"iana"},"application/vnd.ms-word.document.macroenabled.12":{source:"iana",extensions:["docm"]},"application/vnd.ms-word.template.macroenabled.12":{source:"iana",extensions:["dotm"]},"application/vnd.ms-works":{source:"iana",extensions:["wps","wks","wcm","wdb"]},"application/vnd.ms-wpl":{source:"iana",extensions:["wpl"]},"application/vnd.ms-xpsdocument":{source:"iana",compressible:!1,extensions:["xps"]},"application/vnd.msa-disk-image":{source:"iana"},"application/vnd.mseq":{source:"iana",extensions:["mseq"]},"application/vnd.msign":{source:"iana"},"application/vnd.multiad.creator":{source:"iana"},"application/vnd.multiad.creator.cif":{source:"iana"},"application/vnd.music-niff":{source:"iana"},"application/vnd.musician":{source:"iana",extensions:["mus"]},"application/vnd.muvee.style":{source:"iana",extensions:["msty"]},"application/vnd.mynfc":{source:"iana",extensions:["taglet"]},"application/vnd.nacamar.ybrid+json":{source:"iana",compressible:!0},"application/vnd.ncd.control":{source:"iana"},"application/vnd.ncd.reference":{source:"iana"},"application/vnd.nearst.inv+json":{source:"iana",compressible:!0},"application/vnd.nebumind.line":{source:"iana"},"application/vnd.nervana":{source:"iana"},"application/vnd.netfpx":{source:"iana"},"application/vnd.neurolanguage.nlu":{source:"iana",extensions:["nlu"]},"application/vnd.nimn":{source:"iana"},"application/vnd.nintendo.nitro.rom":{source:"iana"},"application/vnd.nintendo.snes.rom":{source:"iana"},"application/vnd.nitf":{source:"iana",extensions:["ntf","nitf"]},"application/vnd.noblenet-directory":{source:"iana",extensions:["nnd"]},"application/vnd.noblenet-sealer":{source:"iana",extensions:["nns"]},"application/vnd.noblenet-web":{source:"iana",extensions:["nnw"]},"application/vnd.nokia.catalogs":{source:"iana"},"application/vnd.nokia.conml+wbxml":{source:"iana"},"application/vnd.nokia.conml+xml":{source:"iana",compressible:!0},"application/vnd.nokia.iptv.config+xml":{source:"iana",compressible:!0},"application/vnd.nokia.isds-radio-presets":{source:"iana"},"application/vnd.nokia.landmark+wbxml":{source:"iana"},"application/vnd.nokia.landmark+xml":{source:"iana",compressible:!0},"application/vnd.nokia.landmarkcollection+xml":{source:"iana",compressible:!0},"application/vnd.nokia.n-gage.ac+xml":{source:"iana",compressible:!0,extensions:["ac"]},"application/vnd.nokia.n-gage.data":{source:"iana",extensions:["ngdat"]},"application/vnd.nokia.n-gage.symbian.install":{source:"iana",extensions:["n-gage"]},"application/vnd.nokia.ncd":{source:"iana"},"application/vnd.nokia.pcd+wbxml":{source:"iana"},"application/vnd.nokia.pcd+xml":{source:"iana",compressible:!0},"application/vnd.nokia.radio-preset":{source:"iana",extensions:["rpst"]},"application/vnd.nokia.radio-presets":{source:"iana",extensions:["rpss"]},"application/vnd.novadigm.edm":{source:"iana",extensions:["edm"]},"application/vnd.novadigm.edx":{source:"iana",extensions:["edx"]},"application/vnd.novadigm.ext":{source:"iana",extensions:["ext"]},"application/vnd.ntt-local.content-share":{source:"iana"},"application/vnd.ntt-local.file-transfer":{source:"iana"},"application/vnd.ntt-local.ogw_remote-access":{source:"iana"},"application/vnd.ntt-local.sip-ta_remote":{source:"iana"},"application/vnd.ntt-local.sip-ta_tcp_stream":{source:"iana"},"application/vnd.oasis.opendocument.chart":{source:"iana",extensions:["odc"]},"application/vnd.oasis.opendocument.chart-template":{source:"iana",extensions:["otc"]},"application/vnd.oasis.opendocument.database":{source:"iana",extensions:["odb"]},"application/vnd.oasis.opendocument.formula":{source:"iana",extensions:["odf"]},"application/vnd.oasis.opendocument.formula-template":{source:"iana",extensions:["odft"]},"application/vnd.oasis.opendocument.graphics":{source:"iana",compressible:!1,extensions:["odg"]},"application/vnd.oasis.opendocument.graphics-template":{source:"iana",extensions:["otg"]},"application/vnd.oasis.opendocument.image":{source:"iana",extensions:["odi"]},"application/vnd.oasis.opendocument.image-template":{source:"iana",extensions:["oti"]},"application/vnd.oasis.opendocument.presentation":{source:"iana",compressible:!1,extensions:["odp"]},"application/vnd.oasis.opendocument.presentation-template":{source:"iana",extensions:["otp"]},"application/vnd.oasis.opendocument.spreadsheet":{source:"iana",compressible:!1,extensions:["ods"]},"application/vnd.oasis.opendocument.spreadsheet-template":{source:"iana",extensions:["ots"]},"application/vnd.oasis.opendocument.text":{source:"iana",compressible:!1,extensions:["odt"]},"application/vnd.oasis.opendocument.text-master":{source:"iana",extensions:["odm"]},"application/vnd.oasis.opendocument.text-template":{source:"iana",extensions:["ott"]},"application/vnd.oasis.opendocument.text-web":{source:"iana",extensions:["oth"]},"application/vnd.obn":{source:"iana"},"application/vnd.ocf+cbor":{source:"iana"},"application/vnd.oci.image.manifest.v1+json":{source:"iana",compressible:!0},"application/vnd.oftn.l10n+json":{source:"iana",compressible:!0},"application/vnd.oipf.contentaccessdownload+xml":{source:"iana",compressible:!0},"application/vnd.oipf.contentaccessstreaming+xml":{source:"iana",compressible:!0},"application/vnd.oipf.cspg-hexbinary":{source:"iana"},"application/vnd.oipf.dae.svg+xml":{source:"iana",compressible:!0},"application/vnd.oipf.dae.xhtml+xml":{source:"iana",compressible:!0},"application/vnd.oipf.mippvcontrolmessage+xml":{source:"iana",compressible:!0},"application/vnd.oipf.pae.gem":{source:"iana"},"application/vnd.oipf.spdiscovery+xml":{source:"iana",compressible:!0},"application/vnd.oipf.spdlist+xml":{source:"iana",compressible:!0},"application/vnd.oipf.ueprofile+xml":{source:"iana",compressible:!0},"application/vnd.oipf.userprofile+xml":{source:"iana",compressible:!0},"application/vnd.olpc-sugar":{source:"iana",extensions:["xo"]},"application/vnd.oma-scws-config":{source:"iana"},"application/vnd.oma-scws-http-request":{source:"iana"},"application/vnd.oma-scws-http-response":{source:"iana"},"application/vnd.oma.bcast.associated-procedure-parameter+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.drm-trigger+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.imd+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.ltkm":{source:"iana"},"application/vnd.oma.bcast.notification+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.provisioningtrigger":{source:"iana"},"application/vnd.oma.bcast.sgboot":{source:"iana"},"application/vnd.oma.bcast.sgdd+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.sgdu":{source:"iana"},"application/vnd.oma.bcast.simple-symbol-container":{source:"iana"},"application/vnd.oma.bcast.smartcard-trigger+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.sprov+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.stkm":{source:"iana"},"application/vnd.oma.cab-address-book+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-feature-handler+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-pcc+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-subs-invite+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-user-prefs+xml":{source:"iana",compressible:!0},"application/vnd.oma.dcd":{source:"iana"},"application/vnd.oma.dcdc":{source:"iana"},"application/vnd.oma.dd2+xml":{source:"iana",compressible:!0,extensions:["dd2"]},"application/vnd.oma.drm.risd+xml":{source:"iana",compressible:!0},"application/vnd.oma.group-usage-list+xml":{source:"iana",compressible:!0},"application/vnd.oma.lwm2m+cbor":{source:"iana"},"application/vnd.oma.lwm2m+json":{source:"iana",compressible:!0},"application/vnd.oma.lwm2m+tlv":{source:"iana"},"application/vnd.oma.pal+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.detailed-progress-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.final-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.groups+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.invocation-descriptor+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.optimized-progress-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.push":{source:"iana"},"application/vnd.oma.scidm.messages+xml":{source:"iana",compressible:!0},"application/vnd.oma.xcap-directory+xml":{source:"iana",compressible:!0},"application/vnd.omads-email+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omads-file+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omads-folder+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omaloc-supl-init":{source:"iana"},"application/vnd.onepager":{source:"iana"},"application/vnd.onepagertamp":{source:"iana"},"application/vnd.onepagertamx":{source:"iana"},"application/vnd.onepagertat":{source:"iana"},"application/vnd.onepagertatp":{source:"iana"},"application/vnd.onepagertatx":{source:"iana"},"application/vnd.openblox.game+xml":{source:"iana",compressible:!0,extensions:["obgx"]},"application/vnd.openblox.game-binary":{source:"iana"},"application/vnd.openeye.oeb":{source:"iana"},"application/vnd.openofficeorg.extension":{source:"apache",extensions:["oxt"]},"application/vnd.openstreetmap.data+xml":{source:"iana",compressible:!0,extensions:["osm"]},"application/vnd.opentimestamps.ots":{source:"iana"},"application/vnd.openxmlformats-officedocument.custom-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.customxmlproperties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawing+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.chart+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.extended-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{source:"iana",compressible:!1,extensions:["pptx"]},"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.presprops+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slide":{source:"iana",extensions:["sldx"]},"application/vnd.openxmlformats-officedocument.presentationml.slide+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slideshow":{source:"iana",extensions:["ppsx"]},"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.tags+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.template":{source:"iana",extensions:["potx"]},"application/vnd.openxmlformats-officedocument.presentationml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{source:"iana",compressible:!1,extensions:["xlsx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.template":{source:"iana",extensions:["xltx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.theme+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.themeoverride+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.vmldrawing":{source:"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{source:"iana",compressible:!1,extensions:["docx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.template":{source:"iana",extensions:["dotx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.core-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.relationships+xml":{source:"iana",compressible:!0},"application/vnd.oracle.resource+json":{source:"iana",compressible:!0},"application/vnd.orange.indata":{source:"iana"},"application/vnd.osa.netdeploy":{source:"iana"},"application/vnd.osgeo.mapguide.package":{source:"iana",extensions:["mgp"]},"application/vnd.osgi.bundle":{source:"iana"},"application/vnd.osgi.dp":{source:"iana",extensions:["dp"]},"application/vnd.osgi.subsystem":{source:"iana",extensions:["esa"]},"application/vnd.otps.ct-kip+xml":{source:"iana",compressible:!0},"application/vnd.oxli.countgraph":{source:"iana"},"application/vnd.pagerduty+json":{source:"iana",compressible:!0},"application/vnd.palm":{source:"iana",extensions:["pdb","pqa","oprc"]},"application/vnd.panoply":{source:"iana"},"application/vnd.paos.xml":{source:"iana"},"application/vnd.patentdive":{source:"iana"},"application/vnd.patientecommsdoc":{source:"iana"},"application/vnd.pawaafile":{source:"iana",extensions:["paw"]},"application/vnd.pcos":{source:"iana"},"application/vnd.pg.format":{source:"iana",extensions:["str"]},"application/vnd.pg.osasli":{source:"iana",extensions:["ei6"]},"application/vnd.piaccess.application-licence":{source:"iana"},"application/vnd.picsel":{source:"iana",extensions:["efif"]},"application/vnd.pmi.widget":{source:"iana",extensions:["wg"]},"application/vnd.poc.group-advertisement+xml":{source:"iana",compressible:!0},"application/vnd.pocketlearn":{source:"iana",extensions:["plf"]},"application/vnd.powerbuilder6":{source:"iana",extensions:["pbd"]},"application/vnd.powerbuilder6-s":{source:"iana"},"application/vnd.powerbuilder7":{source:"iana"},"application/vnd.powerbuilder7-s":{source:"iana"},"application/vnd.powerbuilder75":{source:"iana"},"application/vnd.powerbuilder75-s":{source:"iana"},"application/vnd.preminet":{source:"iana"},"application/vnd.previewsystems.box":{source:"iana",extensions:["box"]},"application/vnd.proteus.magazine":{source:"iana",extensions:["mgz"]},"application/vnd.psfs":{source:"iana"},"application/vnd.publishare-delta-tree":{source:"iana",extensions:["qps"]},"application/vnd.pvi.ptid1":{source:"iana",extensions:["ptid"]},"application/vnd.pwg-multiplexed":{source:"iana"},"application/vnd.pwg-xhtml-print+xml":{source:"iana",compressible:!0},"application/vnd.qualcomm.brew-app-res":{source:"iana"},"application/vnd.quarantainenet":{source:"iana"},"application/vnd.quark.quarkxpress":{source:"iana",extensions:["qxd","qxt","qwd","qwt","qxl","qxb"]},"application/vnd.quobject-quoxdocument":{source:"iana"},"application/vnd.radisys.moml+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-conf+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-conn+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-dialog+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-stream+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-conf+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-base+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-fax-detect+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-fax-sendrecv+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-group+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-speech+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-transform+xml":{source:"iana",compressible:!0},"application/vnd.rainstor.data":{source:"iana"},"application/vnd.rapid":{source:"iana"},"application/vnd.rar":{source:"iana",extensions:["rar"]},"application/vnd.realvnc.bed":{source:"iana",extensions:["bed"]},"application/vnd.recordare.musicxml":{source:"iana",extensions:["mxl"]},"application/vnd.recordare.musicxml+xml":{source:"iana",compressible:!0,extensions:["musicxml"]},"application/vnd.renlearn.rlprint":{source:"iana"},"application/vnd.resilient.logic":{source:"iana"},"application/vnd.restful+json":{source:"iana",compressible:!0},"application/vnd.rig.cryptonote":{source:"iana",extensions:["cryptonote"]},"application/vnd.rim.cod":{source:"apache",extensions:["cod"]},"application/vnd.rn-realmedia":{source:"apache",extensions:["rm"]},"application/vnd.rn-realmedia-vbr":{source:"apache",extensions:["rmvb"]},"application/vnd.route66.link66+xml":{source:"iana",compressible:!0,extensions:["link66"]},"application/vnd.rs-274x":{source:"iana"},"application/vnd.ruckus.download":{source:"iana"},"application/vnd.s3sms":{source:"iana"},"application/vnd.sailingtracker.track":{source:"iana",extensions:["st"]},"application/vnd.sar":{source:"iana"},"application/vnd.sbm.cid":{source:"iana"},"application/vnd.sbm.mid2":{source:"iana"},"application/vnd.scribus":{source:"iana"},"application/vnd.sealed.3df":{source:"iana"},"application/vnd.sealed.csf":{source:"iana"},"application/vnd.sealed.doc":{source:"iana"},"application/vnd.sealed.eml":{source:"iana"},"application/vnd.sealed.mht":{source:"iana"},"application/vnd.sealed.net":{source:"iana"},"application/vnd.sealed.ppt":{source:"iana"},"application/vnd.sealed.tiff":{source:"iana"},"application/vnd.sealed.xls":{source:"iana"},"application/vnd.sealedmedia.softseal.html":{source:"iana"},"application/vnd.sealedmedia.softseal.pdf":{source:"iana"},"application/vnd.seemail":{source:"iana",extensions:["see"]},"application/vnd.seis+json":{source:"iana",compressible:!0},"application/vnd.sema":{source:"iana",extensions:["sema"]},"application/vnd.semd":{source:"iana",extensions:["semd"]},"application/vnd.semf":{source:"iana",extensions:["semf"]},"application/vnd.shade-save-file":{source:"iana"},"application/vnd.shana.informed.formdata":{source:"iana",extensions:["ifm"]},"application/vnd.shana.informed.formtemplate":{source:"iana",extensions:["itp"]},"application/vnd.shana.informed.interchange":{source:"iana",extensions:["iif"]},"application/vnd.shana.informed.package":{source:"iana",extensions:["ipk"]},"application/vnd.shootproof+json":{source:"iana",compressible:!0},"application/vnd.shopkick+json":{source:"iana",compressible:!0},"application/vnd.shp":{source:"iana"},"application/vnd.shx":{source:"iana"},"application/vnd.sigrok.session":{source:"iana"},"application/vnd.simtech-mindmapper":{source:"iana",extensions:["twd","twds"]},"application/vnd.siren+json":{source:"iana",compressible:!0},"application/vnd.smaf":{source:"iana",extensions:["mmf"]},"application/vnd.smart.notebook":{source:"iana"},"application/vnd.smart.teacher":{source:"iana",extensions:["teacher"]},"application/vnd.snesdev-page-table":{source:"iana"},"application/vnd.software602.filler.form+xml":{source:"iana",compressible:!0,extensions:["fo"]},"application/vnd.software602.filler.form-xml-zip":{source:"iana"},"application/vnd.solent.sdkm+xml":{source:"iana",compressible:!0,extensions:["sdkm","sdkd"]},"application/vnd.spotfire.dxp":{source:"iana",extensions:["dxp"]},"application/vnd.spotfire.sfs":{source:"iana",extensions:["sfs"]},"application/vnd.sqlite3":{source:"iana"},"application/vnd.sss-cod":{source:"iana"},"application/vnd.sss-dtf":{source:"iana"},"application/vnd.sss-ntf":{source:"iana"},"application/vnd.stardivision.calc":{source:"apache",extensions:["sdc"]},"application/vnd.stardivision.draw":{source:"apache",extensions:["sda"]},"application/vnd.stardivision.impress":{source:"apache",extensions:["sdd"]},"application/vnd.stardivision.math":{source:"apache",extensions:["smf"]},"application/vnd.stardivision.writer":{source:"apache",extensions:["sdw","vor"]},"application/vnd.stardivision.writer-global":{source:"apache",extensions:["sgl"]},"application/vnd.stepmania.package":{source:"iana",extensions:["smzip"]},"application/vnd.stepmania.stepchart":{source:"iana",extensions:["sm"]},"application/vnd.street-stream":{source:"iana"},"application/vnd.sun.wadl+xml":{source:"iana",compressible:!0,extensions:["wadl"]},"application/vnd.sun.xml.calc":{source:"apache",extensions:["sxc"]},"application/vnd.sun.xml.calc.template":{source:"apache",extensions:["stc"]},"application/vnd.sun.xml.draw":{source:"apache",extensions:["sxd"]},"application/vnd.sun.xml.draw.template":{source:"apache",extensions:["std"]},"application/vnd.sun.xml.impress":{source:"apache",extensions:["sxi"]},"application/vnd.sun.xml.impress.template":{source:"apache",extensions:["sti"]},"application/vnd.sun.xml.math":{source:"apache",extensions:["sxm"]},"application/vnd.sun.xml.writer":{source:"apache",extensions:["sxw"]},"application/vnd.sun.xml.writer.global":{source:"apache",extensions:["sxg"]},"application/vnd.sun.xml.writer.template":{source:"apache",extensions:["stw"]},"application/vnd.sus-calendar":{source:"iana",extensions:["sus","susp"]},"application/vnd.svd":{source:"iana",extensions:["svd"]},"application/vnd.swiftview-ics":{source:"iana"},"application/vnd.sycle+xml":{source:"iana",compressible:!0},"application/vnd.syft+json":{source:"iana",compressible:!0},"application/vnd.symbian.install":{source:"apache",extensions:["sis","sisx"]},"application/vnd.syncml+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["xsm"]},"application/vnd.syncml.dm+wbxml":{source:"iana",charset:"UTF-8",extensions:["bdm"]},"application/vnd.syncml.dm+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["xdm"]},"application/vnd.syncml.dm.notification":{source:"iana"},"application/vnd.syncml.dmddf+wbxml":{source:"iana"},"application/vnd.syncml.dmddf+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["ddf"]},"application/vnd.syncml.dmtnds+wbxml":{source:"iana"},"application/vnd.syncml.dmtnds+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.syncml.ds.notification":{source:"iana"},"application/vnd.tableschema+json":{source:"iana",compressible:!0},"application/vnd.tao.intent-module-archive":{source:"iana",extensions:["tao"]},"application/vnd.tcpdump.pcap":{source:"iana",extensions:["pcap","cap","dmp"]},"application/vnd.think-cell.ppttc+json":{source:"iana",compressible:!0},"application/vnd.tmd.mediaflex.api+xml":{source:"iana",compressible:!0},"application/vnd.tml":{source:"iana"},"application/vnd.tmobile-livetv":{source:"iana",extensions:["tmo"]},"application/vnd.tri.onesource":{source:"iana"},"application/vnd.trid.tpt":{source:"iana",extensions:["tpt"]},"application/vnd.triscape.mxs":{source:"iana",extensions:["mxs"]},"application/vnd.trueapp":{source:"iana",extensions:["tra"]},"application/vnd.truedoc":{source:"iana"},"application/vnd.ubisoft.webplayer":{source:"iana"},"application/vnd.ufdl":{source:"iana",extensions:["ufd","ufdl"]},"application/vnd.uiq.theme":{source:"iana",extensions:["utz"]},"application/vnd.umajin":{source:"iana",extensions:["umj"]},"application/vnd.unity":{source:"iana",extensions:["unityweb"]},"application/vnd.uoml+xml":{source:"iana",compressible:!0,extensions:["uoml"]},"application/vnd.uplanet.alert":{source:"iana"},"application/vnd.uplanet.alert-wbxml":{source:"iana"},"application/vnd.uplanet.bearer-choice":{source:"iana"},"application/vnd.uplanet.bearer-choice-wbxml":{source:"iana"},"application/vnd.uplanet.cacheop":{source:"iana"},"application/vnd.uplanet.cacheop-wbxml":{source:"iana"},"application/vnd.uplanet.channel":{source:"iana"},"application/vnd.uplanet.channel-wbxml":{source:"iana"},"application/vnd.uplanet.list":{source:"iana"},"application/vnd.uplanet.list-wbxml":{source:"iana"},"application/vnd.uplanet.listcmd":{source:"iana"},"application/vnd.uplanet.listcmd-wbxml":{source:"iana"},"application/vnd.uplanet.signal":{source:"iana"},"application/vnd.uri-map":{source:"iana"},"application/vnd.valve.source.material":{source:"iana"},"application/vnd.vcx":{source:"iana",extensions:["vcx"]},"application/vnd.vd-study":{source:"iana"},"application/vnd.vectorworks":{source:"iana"},"application/vnd.vel+json":{source:"iana",compressible:!0},"application/vnd.verimatrix.vcas":{source:"iana"},"application/vnd.veritone.aion+json":{source:"iana",compressible:!0},"application/vnd.veryant.thin":{source:"iana"},"application/vnd.ves.encrypted":{source:"iana"},"application/vnd.vidsoft.vidconference":{source:"iana"},"application/vnd.visio":{source:"iana",extensions:["vsd","vst","vss","vsw"]},"application/vnd.visionary":{source:"iana",extensions:["vis"]},"application/vnd.vividence.scriptfile":{source:"iana"},"application/vnd.vsf":{source:"iana",extensions:["vsf"]},"application/vnd.wap.sic":{source:"iana"},"application/vnd.wap.slc":{source:"iana"},"application/vnd.wap.wbxml":{source:"iana",charset:"UTF-8",extensions:["wbxml"]},"application/vnd.wap.wmlc":{source:"iana",extensions:["wmlc"]},"application/vnd.wap.wmlscriptc":{source:"iana",extensions:["wmlsc"]},"application/vnd.webturbo":{source:"iana",extensions:["wtb"]},"application/vnd.wfa.dpp":{source:"iana"},"application/vnd.wfa.p2p":{source:"iana"},"application/vnd.wfa.wsc":{source:"iana"},"application/vnd.windows.devicepairing":{source:"iana"},"application/vnd.wmc":{source:"iana"},"application/vnd.wmf.bootstrap":{source:"iana"},"application/vnd.wolfram.mathematica":{source:"iana"},"application/vnd.wolfram.mathematica.package":{source:"iana"},"application/vnd.wolfram.player":{source:"iana",extensions:["nbp"]},"application/vnd.wordperfect":{source:"iana",extensions:["wpd"]},"application/vnd.wqd":{source:"iana",extensions:["wqd"]},"application/vnd.wrq-hp3000-labelled":{source:"iana"},"application/vnd.wt.stf":{source:"iana",extensions:["stf"]},"application/vnd.wv.csp+wbxml":{source:"iana"},"application/vnd.wv.csp+xml":{source:"iana",compressible:!0},"application/vnd.wv.ssp+xml":{source:"iana",compressible:!0},"application/vnd.xacml+json":{source:"iana",compressible:!0},"application/vnd.xara":{source:"iana",extensions:["xar"]},"application/vnd.xfdl":{source:"iana",extensions:["xfdl"]},"application/vnd.xfdl.webform":{source:"iana"},"application/vnd.xmi+xml":{source:"iana",compressible:!0},"application/vnd.xmpie.cpkg":{source:"iana"},"application/vnd.xmpie.dpkg":{source:"iana"},"application/vnd.xmpie.plan":{source:"iana"},"application/vnd.xmpie.ppkg":{source:"iana"},"application/vnd.xmpie.xlim":{source:"iana"},"application/vnd.yamaha.hv-dic":{source:"iana",extensions:["hvd"]},"application/vnd.yamaha.hv-script":{source:"iana",extensions:["hvs"]},"application/vnd.yamaha.hv-voice":{source:"iana",extensions:["hvp"]},"application/vnd.yamaha.openscoreformat":{source:"iana",extensions:["osf"]},"application/vnd.yamaha.openscoreformat.osfpvg+xml":{source:"iana",compressible:!0,extensions:["osfpvg"]},"application/vnd.yamaha.remote-setup":{source:"iana"},"application/vnd.yamaha.smaf-audio":{source:"iana",extensions:["saf"]},"application/vnd.yamaha.smaf-phrase":{source:"iana",extensions:["spf"]},"application/vnd.yamaha.through-ngn":{source:"iana"},"application/vnd.yamaha.tunnel-udpencap":{source:"iana"},"application/vnd.yaoweme":{source:"iana"},"application/vnd.yellowriver-custom-menu":{source:"iana",extensions:["cmp"]},"application/vnd.youtube.yt":{source:"iana"},"application/vnd.zul":{source:"iana",extensions:["zir","zirz"]},"application/vnd.zzazz.deck+xml":{source:"iana",compressible:!0,extensions:["zaz"]},"application/voicexml+xml":{source:"iana",compressible:!0,extensions:["vxml"]},"application/voucher-cms+json":{source:"iana",compressible:!0},"application/vq-rtcpxr":{source:"iana"},"application/wasm":{source:"iana",compressible:!0,extensions:["wasm"]},"application/watcherinfo+xml":{source:"iana",compressible:!0,extensions:["wif"]},"application/webpush-options+json":{source:"iana",compressible:!0},"application/whoispp-query":{source:"iana"},"application/whoispp-response":{source:"iana"},"application/widget":{source:"iana",extensions:["wgt"]},"application/winhlp":{source:"apache",extensions:["hlp"]},"application/wita":{source:"iana"},"application/wordperfect5.1":{source:"iana"},"application/wsdl+xml":{source:"iana",compressible:!0,extensions:["wsdl"]},"application/wspolicy+xml":{source:"iana",compressible:!0,extensions:["wspolicy"]},"application/x-7z-compressed":{source:"apache",compressible:!1,extensions:["7z"]},"application/x-abiword":{source:"apache",extensions:["abw"]},"application/x-ace-compressed":{source:"apache",extensions:["ace"]},"application/x-amf":{source:"apache"},"application/x-apple-diskimage":{source:"apache",extensions:["dmg"]},"application/x-arj":{compressible:!1,extensions:["arj"]},"application/x-authorware-bin":{source:"apache",extensions:["aab","x32","u32","vox"]},"application/x-authorware-map":{source:"apache",extensions:["aam"]},"application/x-authorware-seg":{source:"apache",extensions:["aas"]},"application/x-bcpio":{source:"apache",extensions:["bcpio"]},"application/x-bdoc":{compressible:!1,extensions:["bdoc"]},"application/x-bittorrent":{source:"apache",extensions:["torrent"]},"application/x-blorb":{source:"apache",extensions:["blb","blorb"]},"application/x-bzip":{source:"apache",compressible:!1,extensions:["bz"]},"application/x-bzip2":{source:"apache",compressible:!1,extensions:["bz2","boz"]},"application/x-cbr":{source:"apache",extensions:["cbr","cba","cbt","cbz","cb7"]},"application/x-cdlink":{source:"apache",extensions:["vcd"]},"application/x-cfs-compressed":{source:"apache",extensions:["cfs"]},"application/x-chat":{source:"apache",extensions:["chat"]},"application/x-chess-pgn":{source:"apache",extensions:["pgn"]},"application/x-chrome-extension":{extensions:["crx"]},"application/x-cocoa":{source:"nginx",extensions:["cco"]},"application/x-compress":{source:"apache"},"application/x-conference":{source:"apache",extensions:["nsc"]},"application/x-cpio":{source:"apache",extensions:["cpio"]},"application/x-csh":{source:"apache",extensions:["csh"]},"application/x-deb":{compressible:!1},"application/x-debian-package":{source:"apache",extensions:["deb","udeb"]},"application/x-dgc-compressed":{source:"apache",extensions:["dgc"]},"application/x-director":{source:"apache",extensions:["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"]},"application/x-doom":{source:"apache",extensions:["wad"]},"application/x-dtbncx+xml":{source:"apache",compressible:!0,extensions:["ncx"]},"application/x-dtbook+xml":{source:"apache",compressible:!0,extensions:["dtb"]},"application/x-dtbresource+xml":{source:"apache",compressible:!0,extensions:["res"]},"application/x-dvi":{source:"apache",compressible:!1,extensions:["dvi"]},"application/x-envoy":{source:"apache",extensions:["evy"]},"application/x-eva":{source:"apache",extensions:["eva"]},"application/x-font-bdf":{source:"apache",extensions:["bdf"]},"application/x-font-dos":{source:"apache"},"application/x-font-framemaker":{source:"apache"},"application/x-font-ghostscript":{source:"apache",extensions:["gsf"]},"application/x-font-libgrx":{source:"apache"},"application/x-font-linux-psf":{source:"apache",extensions:["psf"]},"application/x-font-pcf":{source:"apache",extensions:["pcf"]},"application/x-font-snf":{source:"apache",extensions:["snf"]},"application/x-font-speedo":{source:"apache"},"application/x-font-sunos-news":{source:"apache"},"application/x-font-type1":{source:"apache",extensions:["pfa","pfb","pfm","afm"]},"application/x-font-vfont":{source:"apache"},"application/x-freearc":{source:"apache",extensions:["arc"]},"application/x-futuresplash":{source:"apache",extensions:["spl"]},"application/x-gca-compressed":{source:"apache",extensions:["gca"]},"application/x-glulx":{source:"apache",extensions:["ulx"]},"application/x-gnumeric":{source:"apache",extensions:["gnumeric"]},"application/x-gramps-xml":{source:"apache",extensions:["gramps"]},"application/x-gtar":{source:"apache",extensions:["gtar"]},"application/x-gzip":{source:"apache"},"application/x-hdf":{source:"apache",extensions:["hdf"]},"application/x-httpd-php":{compressible:!0,extensions:["php"]},"application/x-install-instructions":{source:"apache",extensions:["install"]},"application/x-iso9660-image":{source:"apache",extensions:["iso"]},"application/x-iwork-keynote-sffkey":{extensions:["key"]},"application/x-iwork-numbers-sffnumbers":{extensions:["numbers"]},"application/x-iwork-pages-sffpages":{extensions:["pages"]},"application/x-java-archive-diff":{source:"nginx",extensions:["jardiff"]},"application/x-java-jnlp-file":{source:"apache",compressible:!1,extensions:["jnlp"]},"application/x-javascript":{compressible:!0},"application/x-keepass2":{extensions:["kdbx"]},"application/x-latex":{source:"apache",compressible:!1,extensions:["latex"]},"application/x-lua-bytecode":{extensions:["luac"]},"application/x-lzh-compressed":{source:"apache",extensions:["lzh","lha"]},"application/x-makeself":{source:"nginx",extensions:["run"]},"application/x-mie":{source:"apache",extensions:["mie"]},"application/x-mobipocket-ebook":{source:"apache",extensions:["prc","mobi"]},"application/x-mpegurl":{compressible:!1},"application/x-ms-application":{source:"apache",extensions:["application"]},"application/x-ms-shortcut":{source:"apache",extensions:["lnk"]},"application/x-ms-wmd":{source:"apache",extensions:["wmd"]},"application/x-ms-wmz":{source:"apache",extensions:["wmz"]},"application/x-ms-xbap":{source:"apache",extensions:["xbap"]},"application/x-msaccess":{source:"apache",extensions:["mdb"]},"application/x-msbinder":{source:"apache",extensions:["obd"]},"application/x-mscardfile":{source:"apache",extensions:["crd"]},"application/x-msclip":{source:"apache",extensions:["clp"]},"application/x-msdos-program":{extensions:["exe"]},"application/x-msdownload":{source:"apache",extensions:["exe","dll","com","bat","msi"]},"application/x-msmediaview":{source:"apache",extensions:["mvb","m13","m14"]},"application/x-msmetafile":{source:"apache",extensions:["wmf","wmz","emf","emz"]},"application/x-msmoney":{source:"apache",extensions:["mny"]},"application/x-mspublisher":{source:"apache",extensions:["pub"]},"application/x-msschedule":{source:"apache",extensions:["scd"]},"application/x-msterminal":{source:"apache",extensions:["trm"]},"application/x-mswrite":{source:"apache",extensions:["wri"]},"application/x-netcdf":{source:"apache",extensions:["nc","cdf"]},"application/x-ns-proxy-autoconfig":{compressible:!0,extensions:["pac"]},"application/x-nzb":{source:"apache",extensions:["nzb"]},"application/x-perl":{source:"nginx",extensions:["pl","pm"]},"application/x-pilot":{source:"nginx",extensions:["prc","pdb"]},"application/x-pkcs12":{source:"apache",compressible:!1,extensions:["p12","pfx"]},"application/x-pkcs7-certificates":{source:"apache",extensions:["p7b","spc"]},"application/x-pkcs7-certreqresp":{source:"apache",extensions:["p7r"]},"application/x-pki-message":{source:"iana"},"application/x-rar-compressed":{source:"apache",compressible:!1,extensions:["rar"]},"application/x-redhat-package-manager":{source:"nginx",extensions:["rpm"]},"application/x-research-info-systems":{source:"apache",extensions:["ris"]},"application/x-sea":{source:"nginx",extensions:["sea"]},"application/x-sh":{source:"apache",compressible:!0,extensions:["sh"]},"application/x-shar":{source:"apache",extensions:["shar"]},"application/x-shockwave-flash":{source:"apache",compressible:!1,extensions:["swf"]},"application/x-silverlight-app":{source:"apache",extensions:["xap"]},"application/x-sql":{source:"apache",extensions:["sql"]},"application/x-stuffit":{source:"apache",compressible:!1,extensions:["sit"]},"application/x-stuffitx":{source:"apache",extensions:["sitx"]},"application/x-subrip":{source:"apache",extensions:["srt"]},"application/x-sv4cpio":{source:"apache",extensions:["sv4cpio"]},"application/x-sv4crc":{source:"apache",extensions:["sv4crc"]},"application/x-t3vm-image":{source:"apache",extensions:["t3"]},"application/x-tads":{source:"apache",extensions:["gam"]},"application/x-tar":{source:"apache",compressible:!0,extensions:["tar"]},"application/x-tcl":{source:"apache",extensions:["tcl","tk"]},"application/x-tex":{source:"apache",extensions:["tex"]},"application/x-tex-tfm":{source:"apache",extensions:["tfm"]},"application/x-texinfo":{source:"apache",extensions:["texinfo","texi"]},"application/x-tgif":{source:"apache",extensions:["obj"]},"application/x-ustar":{source:"apache",extensions:["ustar"]},"application/x-virtualbox-hdd":{compressible:!0,extensions:["hdd"]},"application/x-virtualbox-ova":{compressible:!0,extensions:["ova"]},"application/x-virtualbox-ovf":{compressible:!0,extensions:["ovf"]},"application/x-virtualbox-vbox":{compressible:!0,extensions:["vbox"]},"application/x-virtualbox-vbox-extpack":{compressible:!1,extensions:["vbox-extpack"]},"application/x-virtualbox-vdi":{compressible:!0,extensions:["vdi"]},"application/x-virtualbox-vhd":{compressible:!0,extensions:["vhd"]},"application/x-virtualbox-vmdk":{compressible:!0,extensions:["vmdk"]},"application/x-wais-source":{source:"apache",extensions:["src"]},"application/x-web-app-manifest+json":{compressible:!0,extensions:["webapp"]},"application/x-www-form-urlencoded":{source:"iana",compressible:!0},"application/x-x509-ca-cert":{source:"iana",extensions:["der","crt","pem"]},"application/x-x509-ca-ra-cert":{source:"iana"},"application/x-x509-next-ca-cert":{source:"iana"},"application/x-xfig":{source:"apache",extensions:["fig"]},"application/x-xliff+xml":{source:"apache",compressible:!0,extensions:["xlf"]},"application/x-xpinstall":{source:"apache",compressible:!1,extensions:["xpi"]},"application/x-xz":{source:"apache",extensions:["xz"]},"application/x-zmachine":{source:"apache",extensions:["z1","z2","z3","z4","z5","z6","z7","z8"]},"application/x400-bp":{source:"iana"},"application/xacml+xml":{source:"iana",compressible:!0},"application/xaml+xml":{source:"apache",compressible:!0,extensions:["xaml"]},"application/xcap-att+xml":{source:"iana",compressible:!0,extensions:["xav"]},"application/xcap-caps+xml":{source:"iana",compressible:!0,extensions:["xca"]},"application/xcap-diff+xml":{source:"iana",compressible:!0,extensions:["xdf"]},"application/xcap-el+xml":{source:"iana",compressible:!0,extensions:["xel"]},"application/xcap-error+xml":{source:"iana",compressible:!0},"application/xcap-ns+xml":{source:"iana",compressible:!0,extensions:["xns"]},"application/xcon-conference-info+xml":{source:"iana",compressible:!0},"application/xcon-conference-info-diff+xml":{source:"iana",compressible:!0},"application/xenc+xml":{source:"iana",compressible:!0,extensions:["xenc"]},"application/xhtml+xml":{source:"iana",compressible:!0,extensions:["xhtml","xht"]},"application/xhtml-voice+xml":{source:"apache",compressible:!0},"application/xliff+xml":{source:"iana",compressible:!0,extensions:["xlf"]},"application/xml":{source:"iana",compressible:!0,extensions:["xml","xsl","xsd","rng"]},"application/xml-dtd":{source:"iana",compressible:!0,extensions:["dtd"]},"application/xml-external-parsed-entity":{source:"iana"},"application/xml-patch+xml":{source:"iana",compressible:!0},"application/xmpp+xml":{source:"iana",compressible:!0},"application/xop+xml":{source:"iana",compressible:!0,extensions:["xop"]},"application/xproc+xml":{source:"apache",compressible:!0,extensions:["xpl"]},"application/xslt+xml":{source:"iana",compressible:!0,extensions:["xsl","xslt"]},"application/xspf+xml":{source:"apache",compressible:!0,extensions:["xspf"]},"application/xv+xml":{source:"iana",compressible:!0,extensions:["mxml","xhvml","xvml","xvm"]},"application/yang":{source:"iana",extensions:["yang"]},"application/yang-data+json":{source:"iana",compressible:!0},"application/yang-data+xml":{source:"iana",compressible:!0},"application/yang-patch+json":{source:"iana",compressible:!0},"application/yang-patch+xml":{source:"iana",compressible:!0},"application/yin+xml":{source:"iana",compressible:!0,extensions:["yin"]},"application/zip":{source:"iana",compressible:!1,extensions:["zip"]},"application/zlib":{source:"iana"},"application/zstd":{source:"iana"},"audio/1d-interleaved-parityfec":{source:"iana"},"audio/32kadpcm":{source:"iana"},"audio/3gpp":{source:"iana",compressible:!1,extensions:["3gpp"]},"audio/3gpp2":{source:"iana"},"audio/aac":{source:"iana"},"audio/ac3":{source:"iana"},"audio/adpcm":{source:"apache",extensions:["adp"]},"audio/amr":{source:"iana",extensions:["amr"]},"audio/amr-wb":{source:"iana"},"audio/amr-wb+":{source:"iana"},"audio/aptx":{source:"iana"},"audio/asc":{source:"iana"},"audio/atrac-advanced-lossless":{source:"iana"},"audio/atrac-x":{source:"iana"},"audio/atrac3":{source:"iana"},"audio/basic":{source:"iana",compressible:!1,extensions:["au","snd"]},"audio/bv16":{source:"iana"},"audio/bv32":{source:"iana"},"audio/clearmode":{source:"iana"},"audio/cn":{source:"iana"},"audio/dat12":{source:"iana"},"audio/dls":{source:"iana"},"audio/dsr-es201108":{source:"iana"},"audio/dsr-es202050":{source:"iana"},"audio/dsr-es202211":{source:"iana"},"audio/dsr-es202212":{source:"iana"},"audio/dv":{source:"iana"},"audio/dvi4":{source:"iana"},"audio/eac3":{source:"iana"},"audio/encaprtp":{source:"iana"},"audio/evrc":{source:"iana"},"audio/evrc-qcp":{source:"iana"},"audio/evrc0":{source:"iana"},"audio/evrc1":{source:"iana"},"audio/evrcb":{source:"iana"},"audio/evrcb0":{source:"iana"},"audio/evrcb1":{source:"iana"},"audio/evrcnw":{source:"iana"},"audio/evrcnw0":{source:"iana"},"audio/evrcnw1":{source:"iana"},"audio/evrcwb":{source:"iana"},"audio/evrcwb0":{source:"iana"},"audio/evrcwb1":{source:"iana"},"audio/evs":{source:"iana"},"audio/flexfec":{source:"iana"},"audio/fwdred":{source:"iana"},"audio/g711-0":{source:"iana"},"audio/g719":{source:"iana"},"audio/g722":{source:"iana"},"audio/g7221":{source:"iana"},"audio/g723":{source:"iana"},"audio/g726-16":{source:"iana"},"audio/g726-24":{source:"iana"},"audio/g726-32":{source:"iana"},"audio/g726-40":{source:"iana"},"audio/g728":{source:"iana"},"audio/g729":{source:"iana"},"audio/g7291":{source:"iana"},"audio/g729d":{source:"iana"},"audio/g729e":{source:"iana"},"audio/gsm":{source:"iana"},"audio/gsm-efr":{source:"iana"},"audio/gsm-hr-08":{source:"iana"},"audio/ilbc":{source:"iana"},"audio/ip-mr_v2.5":{source:"iana"},"audio/isac":{source:"apache"},"audio/l16":{source:"iana"},"audio/l20":{source:"iana"},"audio/l24":{source:"iana",compressible:!1},"audio/l8":{source:"iana"},"audio/lpc":{source:"iana"},"audio/melp":{source:"iana"},"audio/melp1200":{source:"iana"},"audio/melp2400":{source:"iana"},"audio/melp600":{source:"iana"},"audio/mhas":{source:"iana"},"audio/midi":{source:"apache",extensions:["mid","midi","kar","rmi"]},"audio/mobile-xmf":{source:"iana",extensions:["mxmf"]},"audio/mp3":{compressible:!1,extensions:["mp3"]},"audio/mp4":{source:"iana",compressible:!1,extensions:["m4a","mp4a"]},"audio/mp4a-latm":{source:"iana"},"audio/mpa":{source:"iana"},"audio/mpa-robust":{source:"iana"},"audio/mpeg":{source:"iana",compressible:!1,extensions:["mpga","mp2","mp2a","mp3","m2a","m3a"]},"audio/mpeg4-generic":{source:"iana"},"audio/musepack":{source:"apache"},"audio/ogg":{source:"iana",compressible:!1,extensions:["oga","ogg","spx","opus"]},"audio/opus":{source:"iana"},"audio/parityfec":{source:"iana"},"audio/pcma":{source:"iana"},"audio/pcma-wb":{source:"iana"},"audio/pcmu":{source:"iana"},"audio/pcmu-wb":{source:"iana"},"audio/prs.sid":{source:"iana"},"audio/qcelp":{source:"iana"},"audio/raptorfec":{source:"iana"},"audio/red":{source:"iana"},"audio/rtp-enc-aescm128":{source:"iana"},"audio/rtp-midi":{source:"iana"},"audio/rtploopback":{source:"iana"},"audio/rtx":{source:"iana"},"audio/s3m":{source:"apache",extensions:["s3m"]},"audio/scip":{source:"iana"},"audio/silk":{source:"apache",extensions:["sil"]},"audio/smv":{source:"iana"},"audio/smv-qcp":{source:"iana"},"audio/smv0":{source:"iana"},"audio/sofa":{source:"iana"},"audio/sp-midi":{source:"iana"},"audio/speex":{source:"iana"},"audio/t140c":{source:"iana"},"audio/t38":{source:"iana"},"audio/telephone-event":{source:"iana"},"audio/tetra_acelp":{source:"iana"},"audio/tetra_acelp_bb":{source:"iana"},"audio/tone":{source:"iana"},"audio/tsvcis":{source:"iana"},"audio/uemclip":{source:"iana"},"audio/ulpfec":{source:"iana"},"audio/usac":{source:"iana"},"audio/vdvi":{source:"iana"},"audio/vmr-wb":{source:"iana"},"audio/vnd.3gpp.iufp":{source:"iana"},"audio/vnd.4sb":{source:"iana"},"audio/vnd.audiokoz":{source:"iana"},"audio/vnd.celp":{source:"iana"},"audio/vnd.cisco.nse":{source:"iana"},"audio/vnd.cmles.radio-events":{source:"iana"},"audio/vnd.cns.anp1":{source:"iana"},"audio/vnd.cns.inf1":{source:"iana"},"audio/vnd.dece.audio":{source:"iana",extensions:["uva","uvva"]},"audio/vnd.digital-winds":{source:"iana",extensions:["eol"]},"audio/vnd.dlna.adts":{source:"iana"},"audio/vnd.dolby.heaac.1":{source:"iana"},"audio/vnd.dolby.heaac.2":{source:"iana"},"audio/vnd.dolby.mlp":{source:"iana"},"audio/vnd.dolby.mps":{source:"iana"},"audio/vnd.dolby.pl2":{source:"iana"},"audio/vnd.dolby.pl2x":{source:"iana"},"audio/vnd.dolby.pl2z":{source:"iana"},"audio/vnd.dolby.pulse.1":{source:"iana"},"audio/vnd.dra":{source:"iana",extensions:["dra"]},"audio/vnd.dts":{source:"iana",extensions:["dts"]},"audio/vnd.dts.hd":{source:"iana",extensions:["dtshd"]},"audio/vnd.dts.uhd":{source:"iana"},"audio/vnd.dvb.file":{source:"iana"},"audio/vnd.everad.plj":{source:"iana"},"audio/vnd.hns.audio":{source:"iana"},"audio/vnd.lucent.voice":{source:"iana",extensions:["lvp"]},"audio/vnd.ms-playready.media.pya":{source:"iana",extensions:["pya"]},"audio/vnd.nokia.mobile-xmf":{source:"iana"},"audio/vnd.nortel.vbk":{source:"iana"},"audio/vnd.nuera.ecelp4800":{source:"iana",extensions:["ecelp4800"]},"audio/vnd.nuera.ecelp7470":{source:"iana",extensions:["ecelp7470"]},"audio/vnd.nuera.ecelp9600":{source:"iana",extensions:["ecelp9600"]},"audio/vnd.octel.sbc":{source:"iana"},"audio/vnd.presonus.multitrack":{source:"iana"},"audio/vnd.qcelp":{source:"iana"},"audio/vnd.rhetorex.32kadpcm":{source:"iana"},"audio/vnd.rip":{source:"iana",extensions:["rip"]},"audio/vnd.rn-realaudio":{compressible:!1},"audio/vnd.sealedmedia.softseal.mpeg":{source:"iana"},"audio/vnd.vmx.cvsd":{source:"iana"},"audio/vnd.wave":{compressible:!1},"audio/vorbis":{source:"iana",compressible:!1},"audio/vorbis-config":{source:"iana"},"audio/wav":{compressible:!1,extensions:["wav"]},"audio/wave":{compressible:!1,extensions:["wav"]},"audio/webm":{source:"apache",compressible:!1,extensions:["weba"]},"audio/x-aac":{source:"apache",compressible:!1,extensions:["aac"]},"audio/x-aiff":{source:"apache",extensions:["aif","aiff","aifc"]},"audio/x-caf":{source:"apache",compressible:!1,extensions:["caf"]},"audio/x-flac":{source:"apache",extensions:["flac"]},"audio/x-m4a":{source:"nginx",extensions:["m4a"]},"audio/x-matroska":{source:"apache",extensions:["mka"]},"audio/x-mpegurl":{source:"apache",extensions:["m3u"]},"audio/x-ms-wax":{source:"apache",extensions:["wax"]},"audio/x-ms-wma":{source:"apache",extensions:["wma"]},"audio/x-pn-realaudio":{source:"apache",extensions:["ram","ra"]},"audio/x-pn-realaudio-plugin":{source:"apache",extensions:["rmp"]},"audio/x-realaudio":{source:"nginx",extensions:["ra"]},"audio/x-tta":{source:"apache"},"audio/x-wav":{source:"apache",extensions:["wav"]},"audio/xm":{source:"apache",extensions:["xm"]},"chemical/x-cdx":{source:"apache",extensions:["cdx"]},"chemical/x-cif":{source:"apache",extensions:["cif"]},"chemical/x-cmdf":{source:"apache",extensions:["cmdf"]},"chemical/x-cml":{source:"apache",extensions:["cml"]},"chemical/x-csml":{source:"apache",extensions:["csml"]},"chemical/x-pdb":{source:"apache"},"chemical/x-xyz":{source:"apache",extensions:["xyz"]},"font/collection":{source:"iana",extensions:["ttc"]},"font/otf":{source:"iana",compressible:!0,extensions:["otf"]},"font/sfnt":{source:"iana"},"font/ttf":{source:"iana",compressible:!0,extensions:["ttf"]},"font/woff":{source:"iana",extensions:["woff"]},"font/woff2":{source:"iana",extensions:["woff2"]},"image/aces":{source:"iana",extensions:["exr"]},"image/apng":{compressible:!1,extensions:["apng"]},"image/avci":{source:"iana",extensions:["avci"]},"image/avcs":{source:"iana",extensions:["avcs"]},"image/avif":{source:"iana",compressible:!1,extensions:["avif"]},"image/bmp":{source:"iana",compressible:!0,extensions:["bmp"]},"image/cgm":{source:"iana",extensions:["cgm"]},"image/dicom-rle":{source:"iana",extensions:["drle"]},"image/emf":{source:"iana",extensions:["emf"]},"image/fits":{source:"iana",extensions:["fits"]},"image/g3fax":{source:"iana",extensions:["g3"]},"image/gif":{source:"iana",compressible:!1,extensions:["gif"]},"image/heic":{source:"iana",extensions:["heic"]},"image/heic-sequence":{source:"iana",extensions:["heics"]},"image/heif":{source:"iana",extensions:["heif"]},"image/heif-sequence":{source:"iana",extensions:["heifs"]},"image/hej2k":{source:"iana",extensions:["hej2"]},"image/hsj2":{source:"iana",extensions:["hsj2"]},"image/ief":{source:"iana",extensions:["ief"]},"image/jls":{source:"iana",extensions:["jls"]},"image/jp2":{source:"iana",compressible:!1,extensions:["jp2","jpg2"]},"image/jpeg":{source:"iana",compressible:!1,extensions:["jpeg","jpg","jpe"]},"image/jph":{source:"iana",extensions:["jph"]},"image/jphc":{source:"iana",extensions:["jhc"]},"image/jpm":{source:"iana",compressible:!1,extensions:["jpm"]},"image/jpx":{source:"iana",compressible:!1,extensions:["jpx","jpf"]},"image/jxr":{source:"iana",extensions:["jxr"]},"image/jxra":{source:"iana",extensions:["jxra"]},"image/jxrs":{source:"iana",extensions:["jxrs"]},"image/jxs":{source:"iana",extensions:["jxs"]},"image/jxsc":{source:"iana",extensions:["jxsc"]},"image/jxsi":{source:"iana",extensions:["jxsi"]},"image/jxss":{source:"iana",extensions:["jxss"]},"image/ktx":{source:"iana",extensions:["ktx"]},"image/ktx2":{source:"iana",extensions:["ktx2"]},"image/naplps":{source:"iana"},"image/pjpeg":{compressible:!1},"image/png":{source:"iana",compressible:!1,extensions:["png"]},"image/prs.btif":{source:"iana",extensions:["btif"]},"image/prs.pti":{source:"iana",extensions:["pti"]},"image/pwg-raster":{source:"iana"},"image/sgi":{source:"apache",extensions:["sgi"]},"image/svg+xml":{source:"iana",compressible:!0,extensions:["svg","svgz"]},"image/t38":{source:"iana",extensions:["t38"]},"image/tiff":{source:"iana",compressible:!1,extensions:["tif","tiff"]},"image/tiff-fx":{source:"iana",extensions:["tfx"]},"image/vnd.adobe.photoshop":{source:"iana",compressible:!0,extensions:["psd"]},"image/vnd.airzip.accelerator.azv":{source:"iana",extensions:["azv"]},"image/vnd.cns.inf2":{source:"iana"},"image/vnd.dece.graphic":{source:"iana",extensions:["uvi","uvvi","uvg","uvvg"]},"image/vnd.djvu":{source:"iana",extensions:["djvu","djv"]},"image/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"image/vnd.dwg":{source:"iana",extensions:["dwg"]},"image/vnd.dxf":{source:"iana",extensions:["dxf"]},"image/vnd.fastbidsheet":{source:"iana",extensions:["fbs"]},"image/vnd.fpx":{source:"iana",extensions:["fpx"]},"image/vnd.fst":{source:"iana",extensions:["fst"]},"image/vnd.fujixerox.edmics-mmr":{source:"iana",extensions:["mmr"]},"image/vnd.fujixerox.edmics-rlc":{source:"iana",extensions:["rlc"]},"image/vnd.globalgraphics.pgb":{source:"iana"},"image/vnd.microsoft.icon":{source:"iana",compressible:!0,extensions:["ico"]},"image/vnd.mix":{source:"iana"},"image/vnd.mozilla.apng":{source:"iana"},"image/vnd.ms-dds":{compressible:!0,extensions:["dds"]},"image/vnd.ms-modi":{source:"iana",extensions:["mdi"]},"image/vnd.ms-photo":{source:"apache",extensions:["wdp"]},"image/vnd.net-fpx":{source:"iana",extensions:["npx"]},"image/vnd.pco.b16":{source:"iana",extensions:["b16"]},"image/vnd.radiance":{source:"iana"},"image/vnd.sealed.png":{source:"iana"},"image/vnd.sealedmedia.softseal.gif":{source:"iana"},"image/vnd.sealedmedia.softseal.jpg":{source:"iana"},"image/vnd.svf":{source:"iana"},"image/vnd.tencent.tap":{source:"iana",extensions:["tap"]},"image/vnd.valve.source.texture":{source:"iana",extensions:["vtf"]},"image/vnd.wap.wbmp":{source:"iana",extensions:["wbmp"]},"image/vnd.xiff":{source:"iana",extensions:["xif"]},"image/vnd.zbrush.pcx":{source:"iana",extensions:["pcx"]},"image/webp":{source:"apache",extensions:["webp"]},"image/wmf":{source:"iana",extensions:["wmf"]},"image/x-3ds":{source:"apache",extensions:["3ds"]},"image/x-cmu-raster":{source:"apache",extensions:["ras"]},"image/x-cmx":{source:"apache",extensions:["cmx"]},"image/x-freehand":{source:"apache",extensions:["fh","fhc","fh4","fh5","fh7"]},"image/x-icon":{source:"apache",compressible:!0,extensions:["ico"]},"image/x-jng":{source:"nginx",extensions:["jng"]},"image/x-mrsid-image":{source:"apache",extensions:["sid"]},"image/x-ms-bmp":{source:"nginx",compressible:!0,extensions:["bmp"]},"image/x-pcx":{source:"apache",extensions:["pcx"]},"image/x-pict":{source:"apache",extensions:["pic","pct"]},"image/x-portable-anymap":{source:"apache",extensions:["pnm"]},"image/x-portable-bitmap":{source:"apache",extensions:["pbm"]},"image/x-portable-graymap":{source:"apache",extensions:["pgm"]},"image/x-portable-pixmap":{source:"apache",extensions:["ppm"]},"image/x-rgb":{source:"apache",extensions:["rgb"]},"image/x-tga":{source:"apache",extensions:["tga"]},"image/x-xbitmap":{source:"apache",extensions:["xbm"]},"image/x-xcf":{compressible:!1},"image/x-xpixmap":{source:"apache",extensions:["xpm"]},"image/x-xwindowdump":{source:"apache",extensions:["xwd"]},"message/cpim":{source:"iana"},"message/delivery-status":{source:"iana"},"message/disposition-notification":{source:"iana",extensions:["disposition-notification"]},"message/external-body":{source:"iana"},"message/feedback-report":{source:"iana"},"message/global":{source:"iana",extensions:["u8msg"]},"message/global-delivery-status":{source:"iana",extensions:["u8dsn"]},"message/global-disposition-notification":{source:"iana",extensions:["u8mdn"]},"message/global-headers":{source:"iana",extensions:["u8hdr"]},"message/http":{source:"iana",compressible:!1},"message/imdn+xml":{source:"iana",compressible:!0},"message/news":{source:"iana"},"message/partial":{source:"iana",compressible:!1},"message/rfc822":{source:"iana",compressible:!0,extensions:["eml","mime"]},"message/s-http":{source:"iana"},"message/sip":{source:"iana"},"message/sipfrag":{source:"iana"},"message/tracking-status":{source:"iana"},"message/vnd.si.simp":{source:"iana"},"message/vnd.wfa.wsc":{source:"iana",extensions:["wsc"]},"model/3mf":{source:"iana",extensions:["3mf"]},"model/e57":{source:"iana"},"model/gltf+json":{source:"iana",compressible:!0,extensions:["gltf"]},"model/gltf-binary":{source:"iana",compressible:!0,extensions:["glb"]},"model/iges":{source:"iana",compressible:!1,extensions:["igs","iges"]},"model/mesh":{source:"iana",compressible:!1,extensions:["msh","mesh","silo"]},"model/mtl":{source:"iana",extensions:["mtl"]},"model/obj":{source:"iana",extensions:["obj"]},"model/step":{source:"iana"},"model/step+xml":{source:"iana",compressible:!0,extensions:["stpx"]},"model/step+zip":{source:"iana",compressible:!1,extensions:["stpz"]},"model/step-xml+zip":{source:"iana",compressible:!1,extensions:["stpxz"]},"model/stl":{source:"iana",extensions:["stl"]},"model/vnd.collada+xml":{source:"iana",compressible:!0,extensions:["dae"]},"model/vnd.dwf":{source:"iana",extensions:["dwf"]},"model/vnd.flatland.3dml":{source:"iana"},"model/vnd.gdl":{source:"iana",extensions:["gdl"]},"model/vnd.gs-gdl":{source:"apache"},"model/vnd.gs.gdl":{source:"iana"},"model/vnd.gtw":{source:"iana",extensions:["gtw"]},"model/vnd.moml+xml":{source:"iana",compressible:!0},"model/vnd.mts":{source:"iana",extensions:["mts"]},"model/vnd.opengex":{source:"iana",extensions:["ogex"]},"model/vnd.parasolid.transmit.binary":{source:"iana",extensions:["x_b"]},"model/vnd.parasolid.transmit.text":{source:"iana",extensions:["x_t"]},"model/vnd.pytha.pyox":{source:"iana"},"model/vnd.rosette.annotated-data-model":{source:"iana"},"model/vnd.sap.vds":{source:"iana",extensions:["vds"]},"model/vnd.usdz+zip":{source:"iana",compressible:!1,extensions:["usdz"]},"model/vnd.valve.source.compiled-map":{source:"iana",extensions:["bsp"]},"model/vnd.vtu":{source:"iana",extensions:["vtu"]},"model/vrml":{source:"iana",compressible:!1,extensions:["wrl","vrml"]},"model/x3d+binary":{source:"apache",compressible:!1,extensions:["x3db","x3dbz"]},"model/x3d+fastinfoset":{source:"iana",extensions:["x3db"]},"model/x3d+vrml":{source:"apache",compressible:!1,extensions:["x3dv","x3dvz"]},"model/x3d+xml":{source:"iana",compressible:!0,extensions:["x3d","x3dz"]},"model/x3d-vrml":{source:"iana",extensions:["x3dv"]},"multipart/alternative":{source:"iana",compressible:!1},"multipart/appledouble":{source:"iana"},"multipart/byteranges":{source:"iana"},"multipart/digest":{source:"iana"},"multipart/encrypted":{source:"iana",compressible:!1},"multipart/form-data":{source:"iana",compressible:!1},"multipart/header-set":{source:"iana"},"multipart/mixed":{source:"iana"},"multipart/multilingual":{source:"iana"},"multipart/parallel":{source:"iana"},"multipart/related":{source:"iana",compressible:!1},"multipart/report":{source:"iana"},"multipart/signed":{source:"iana",compressible:!1},"multipart/vnd.bint.med-plus":{source:"iana"},"multipart/voice-message":{source:"iana"},"multipart/x-mixed-replace":{source:"iana"},"text/1d-interleaved-parityfec":{source:"iana"},"text/cache-manifest":{source:"iana",compressible:!0,extensions:["appcache","manifest"]},"text/calendar":{source:"iana",extensions:["ics","ifb"]},"text/calender":{compressible:!0},"text/cmd":{compressible:!0},"text/coffeescript":{extensions:["coffee","litcoffee"]},"text/cql":{source:"iana"},"text/cql-expression":{source:"iana"},"text/cql-identifier":{source:"iana"},"text/css":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["css"]},"text/csv":{source:"iana",compressible:!0,extensions:["csv"]},"text/csv-schema":{source:"iana"},"text/directory":{source:"iana"},"text/dns":{source:"iana"},"text/ecmascript":{source:"iana"},"text/encaprtp":{source:"iana"},"text/enriched":{source:"iana"},"text/fhirpath":{source:"iana"},"text/flexfec":{source:"iana"},"text/fwdred":{source:"iana"},"text/gff3":{source:"iana"},"text/grammar-ref-list":{source:"iana"},"text/html":{source:"iana",compressible:!0,extensions:["html","htm","shtml"]},"text/jade":{extensions:["jade"]},"text/javascript":{source:"iana",compressible:!0},"text/jcr-cnd":{source:"iana"},"text/jsx":{compressible:!0,extensions:["jsx"]},"text/less":{compressible:!0,extensions:["less"]},"text/markdown":{source:"iana",compressible:!0,extensions:["markdown","md"]},"text/mathml":{source:"nginx",extensions:["mml"]},"text/mdx":{compressible:!0,extensions:["mdx"]},"text/mizar":{source:"iana"},"text/n3":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["n3"]},"text/parameters":{source:"iana",charset:"UTF-8"},"text/parityfec":{source:"iana"},"text/plain":{source:"iana",compressible:!0,extensions:["txt","text","conf","def","list","log","in","ini"]},"text/provenance-notation":{source:"iana",charset:"UTF-8"},"text/prs.fallenstein.rst":{source:"iana"},"text/prs.lines.tag":{source:"iana",extensions:["dsc"]},"text/prs.prop.logic":{source:"iana"},"text/raptorfec":{source:"iana"},"text/red":{source:"iana"},"text/rfc822-headers":{source:"iana"},"text/richtext":{source:"iana",compressible:!0,extensions:["rtx"]},"text/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"text/rtp-enc-aescm128":{source:"iana"},"text/rtploopback":{source:"iana"},"text/rtx":{source:"iana"},"text/sgml":{source:"iana",extensions:["sgml","sgm"]},"text/shaclc":{source:"iana"},"text/shex":{source:"iana",extensions:["shex"]},"text/slim":{extensions:["slim","slm"]},"text/spdx":{source:"iana",extensions:["spdx"]},"text/strings":{source:"iana"},"text/stylus":{extensions:["stylus","styl"]},"text/t140":{source:"iana"},"text/tab-separated-values":{source:"iana",compressible:!0,extensions:["tsv"]},"text/troff":{source:"iana",extensions:["t","tr","roff","man","me","ms"]},"text/turtle":{source:"iana",charset:"UTF-8",extensions:["ttl"]},"text/ulpfec":{source:"iana"},"text/uri-list":{source:"iana",compressible:!0,extensions:["uri","uris","urls"]},"text/vcard":{source:"iana",compressible:!0,extensions:["vcard"]},"text/vnd.a":{source:"iana"},"text/vnd.abc":{source:"iana"},"text/vnd.ascii-art":{source:"iana"},"text/vnd.curl":{source:"iana",extensions:["curl"]},"text/vnd.curl.dcurl":{source:"apache",extensions:["dcurl"]},"text/vnd.curl.mcurl":{source:"apache",extensions:["mcurl"]},"text/vnd.curl.scurl":{source:"apache",extensions:["scurl"]},"text/vnd.debian.copyright":{source:"iana",charset:"UTF-8"},"text/vnd.dmclientscript":{source:"iana"},"text/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"text/vnd.esmertec.theme-descriptor":{source:"iana",charset:"UTF-8"},"text/vnd.familysearch.gedcom":{source:"iana",extensions:["ged"]},"text/vnd.ficlab.flt":{source:"iana"},"text/vnd.fly":{source:"iana",extensions:["fly"]},"text/vnd.fmi.flexstor":{source:"iana",extensions:["flx"]},"text/vnd.gml":{source:"iana"},"text/vnd.graphviz":{source:"iana",extensions:["gv"]},"text/vnd.hans":{source:"iana"},"text/vnd.hgl":{source:"iana"},"text/vnd.in3d.3dml":{source:"iana",extensions:["3dml"]},"text/vnd.in3d.spot":{source:"iana",extensions:["spot"]},"text/vnd.iptc.newsml":{source:"iana"},"text/vnd.iptc.nitf":{source:"iana"},"text/vnd.latex-z":{source:"iana"},"text/vnd.motorola.reflex":{source:"iana"},"text/vnd.ms-mediapackage":{source:"iana"},"text/vnd.net2phone.commcenter.command":{source:"iana"},"text/vnd.radisys.msml-basic-layout":{source:"iana"},"text/vnd.senx.warpscript":{source:"iana"},"text/vnd.si.uricatalogue":{source:"iana"},"text/vnd.sosi":{source:"iana"},"text/vnd.sun.j2me.app-descriptor":{source:"iana",charset:"UTF-8",extensions:["jad"]},"text/vnd.trolltech.linguist":{source:"iana",charset:"UTF-8"},"text/vnd.wap.si":{source:"iana"},"text/vnd.wap.sl":{source:"iana"},"text/vnd.wap.wml":{source:"iana",extensions:["wml"]},"text/vnd.wap.wmlscript":{source:"iana",extensions:["wmls"]},"text/vtt":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["vtt"]},"text/x-asm":{source:"apache",extensions:["s","asm"]},"text/x-c":{source:"apache",extensions:["c","cc","cxx","cpp","h","hh","dic"]},"text/x-component":{source:"nginx",extensions:["htc"]},"text/x-fortran":{source:"apache",extensions:["f","for","f77","f90"]},"text/x-gwt-rpc":{compressible:!0},"text/x-handlebars-template":{extensions:["hbs"]},"text/x-java-source":{source:"apache",extensions:["java"]},"text/x-jquery-tmpl":{compressible:!0},"text/x-lua":{extensions:["lua"]},"text/x-markdown":{compressible:!0,extensions:["mkd"]},"text/x-nfo":{source:"apache",extensions:["nfo"]},"text/x-opml":{source:"apache",extensions:["opml"]},"text/x-org":{compressible:!0,extensions:["org"]},"text/x-pascal":{source:"apache",extensions:["p","pas"]},"text/x-processing":{compressible:!0,extensions:["pde"]},"text/x-sass":{extensions:["sass"]},"text/x-scss":{extensions:["scss"]},"text/x-setext":{source:"apache",extensions:["etx"]},"text/x-sfv":{source:"apache",extensions:["sfv"]},"text/x-suse-ymp":{compressible:!0,extensions:["ymp"]},"text/x-uuencode":{source:"apache",extensions:["uu"]},"text/x-vcalendar":{source:"apache",extensions:["vcs"]},"text/x-vcard":{source:"apache",extensions:["vcf"]},"text/xml":{source:"iana",compressible:!0,extensions:["xml"]},"text/xml-external-parsed-entity":{source:"iana"},"text/yaml":{compressible:!0,extensions:["yaml","yml"]},"video/1d-interleaved-parityfec":{source:"iana"},"video/3gpp":{source:"iana",extensions:["3gp","3gpp"]},"video/3gpp-tt":{source:"iana"},"video/3gpp2":{source:"iana",extensions:["3g2"]},"video/av1":{source:"iana"},"video/bmpeg":{source:"iana"},"video/bt656":{source:"iana"},"video/celb":{source:"iana"},"video/dv":{source:"iana"},"video/encaprtp":{source:"iana"},"video/ffv1":{source:"iana"},"video/flexfec":{source:"iana"},"video/h261":{source:"iana",extensions:["h261"]},"video/h263":{source:"iana",extensions:["h263"]},"video/h263-1998":{source:"iana"},"video/h263-2000":{source:"iana"},"video/h264":{source:"iana",extensions:["h264"]},"video/h264-rcdo":{source:"iana"},"video/h264-svc":{source:"iana"},"video/h265":{source:"iana"},"video/iso.segment":{source:"iana",extensions:["m4s"]},"video/jpeg":{source:"iana",extensions:["jpgv"]},"video/jpeg2000":{source:"iana"},"video/jpm":{source:"apache",extensions:["jpm","jpgm"]},"video/jxsv":{source:"iana"},"video/mj2":{source:"iana",extensions:["mj2","mjp2"]},"video/mp1s":{source:"iana"},"video/mp2p":{source:"iana"},"video/mp2t":{source:"iana",extensions:["ts"]},"video/mp4":{source:"iana",compressible:!1,extensions:["mp4","mp4v","mpg4"]},"video/mp4v-es":{source:"iana"},"video/mpeg":{source:"iana",compressible:!1,extensions:["mpeg","mpg","mpe","m1v","m2v"]},"video/mpeg4-generic":{source:"iana"},"video/mpv":{source:"iana"},"video/nv":{source:"iana"},"video/ogg":{source:"iana",compressible:!1,extensions:["ogv"]},"video/parityfec":{source:"iana"},"video/pointer":{source:"iana"},"video/quicktime":{source:"iana",compressible:!1,extensions:["qt","mov"]},"video/raptorfec":{source:"iana"},"video/raw":{source:"iana"},"video/rtp-enc-aescm128":{source:"iana"},"video/rtploopback":{source:"iana"},"video/rtx":{source:"iana"},"video/scip":{source:"iana"},"video/smpte291":{source:"iana"},"video/smpte292m":{source:"iana"},"video/ulpfec":{source:"iana"},"video/vc1":{source:"iana"},"video/vc2":{source:"iana"},"video/vnd.cctv":{source:"iana"},"video/vnd.dece.hd":{source:"iana",extensions:["uvh","uvvh"]},"video/vnd.dece.mobile":{source:"iana",extensions:["uvm","uvvm"]},"video/vnd.dece.mp4":{source:"iana"},"video/vnd.dece.pd":{source:"iana",extensions:["uvp","uvvp"]},"video/vnd.dece.sd":{source:"iana",extensions:["uvs","uvvs"]},"video/vnd.dece.video":{source:"iana",extensions:["uvv","uvvv"]},"video/vnd.directv.mpeg":{source:"iana"},"video/vnd.directv.mpeg-tts":{source:"iana"},"video/vnd.dlna.mpeg-tts":{source:"iana"},"video/vnd.dvb.file":{source:"iana",extensions:["dvb"]},"video/vnd.fvt":{source:"iana",extensions:["fvt"]},"video/vnd.hns.video":{source:"iana"},"video/vnd.iptvforum.1dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.1dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.2dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.2dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.ttsavc":{source:"iana"},"video/vnd.iptvforum.ttsmpeg2":{source:"iana"},"video/vnd.motorola.video":{source:"iana"},"video/vnd.motorola.videop":{source:"iana"},"video/vnd.mpegurl":{source:"iana",extensions:["mxu","m4u"]},"video/vnd.ms-playready.media.pyv":{source:"iana",extensions:["pyv"]},"video/vnd.nokia.interleaved-multimedia":{source:"iana"},"video/vnd.nokia.mp4vr":{source:"iana"},"video/vnd.nokia.videovoip":{source:"iana"},"video/vnd.objectvideo":{source:"iana"},"video/vnd.radgamettools.bink":{source:"iana"},"video/vnd.radgamettools.smacker":{source:"iana"},"video/vnd.sealed.mpeg1":{source:"iana"},"video/vnd.sealed.mpeg4":{source:"iana"},"video/vnd.sealed.swf":{source:"iana"},"video/vnd.sealedmedia.softseal.mov":{source:"iana"},"video/vnd.uvvu.mp4":{source:"iana",extensions:["uvu","uvvu"]},"video/vnd.vivo":{source:"iana",extensions:["viv"]},"video/vnd.youtube.yt":{source:"iana"},"video/vp8":{source:"iana"},"video/vp9":{source:"iana"},"video/webm":{source:"apache",compressible:!1,extensions:["webm"]},"video/x-f4v":{source:"apache",extensions:["f4v"]},"video/x-fli":{source:"apache",extensions:["fli"]},"video/x-flv":{source:"apache",compressible:!1,extensions:["flv"]},"video/x-m4v":{source:"apache",extensions:["m4v"]},"video/x-matroska":{source:"apache",compressible:!1,extensions:["mkv","mk3d","mks"]},"video/x-mng":{source:"apache",extensions:["mng"]},"video/x-ms-asf":{source:"apache",extensions:["asf","asx"]},"video/x-ms-vob":{source:"apache",extensions:["vob"]},"video/x-ms-wm":{source:"apache",extensions:["wm"]},"video/x-ms-wmv":{source:"apache",compressible:!1,extensions:["wmv"]},"video/x-ms-wmx":{source:"apache",extensions:["wmx"]},"video/x-ms-wvx":{source:"apache",extensions:["wvx"]},"video/x-msvideo":{source:"apache",extensions:["avi"]},"video/x-sgi-movie":{source:"apache",extensions:["movie"]},"video/x-smv":{source:"apache",extensions:["smv"]},"x-conference/x-cooltalk":{source:"apache",extensions:["ice"]},"x-shader/x-fragment":{compressible:!0},"x-shader/x-vertex":{compressible:!0}};({get exports(){return Nf},set exports(e){Nf=e}}).exports=Bf,
37
- /*!
38
- * mime-types
39
- * Copyright(c) 2014 Jonathan Ong
40
- * Copyright(c) 2015 Douglas Christopher Wilson
41
- * MIT Licensed
42
- */
43
- function(e){var t=Nf,i=g.extname,n=/^\s*([^;\s]*)(?:;|\s|$)/,s=/^text\//i;function a(e){if(!e||"string"!=typeof e)return!1;var i=n.exec(e),a=i&&t[i[1].toLowerCase()];return a&&a.charset?a.charset:!(!i||!s.test(i[1]))&&"UTF-8"}e.charset=a,e.charsets={lookup:a},e.contentType=function(t){if(!t||"string"!=typeof t)return!1;var i=-1===t.indexOf("/")?e.lookup(t):t;if(!i)return!1;if(-1===i.indexOf("charset")){var n=e.charset(i);n&&(i+="; charset="+n.toLowerCase())}return i},e.extension=function(t){if(!t||"string"!=typeof t)return!1;var i=n.exec(t),s=i&&e.extensions[i[1].toLowerCase()];if(!s||!s.length)return!1;return s[0]},e.extensions=Object.create(null),e.lookup=function(t){if(!t||"string"!=typeof t)return!1;var n=i("x."+t).toLowerCase().substr(1);if(!n)return!1;return e.types[n]||!1},e.types=Object.create(null),function(e,i){var n=["nginx","apache",void 0,"iana"];Object.keys(t).forEach((function(s){var a=t[s],r=a.extensions;if(r&&r.length){e[s]=r;for(var o=0;o<r.length;o++){var c=r[o];if(i[c]){var p=n.indexOf(t[i[c]].source),d=n.indexOf(a.source);if("application/octet-stream"!==i[c]&&(p>d||p===d&&"application/"===i[c].substr(0,12)))continue}i[c]=s}}}))}(e.extensions,e.types)}(Af);var Ff=function(e){var t="function"==typeof setImmediate?setImmediate:"object"==typeof process&&"function"==typeof process.nextTick?process.nextTick:null;t?t(e):setTimeout(e,0)};var Uf=Ff,zf=function(e){var t=!1;return Uf((function(){t=!0})),function(i,n){t?e(i,n):Uf((function(){e(i,n)}))}};var qf=function(e){Object.keys(e.jobs).forEach($f.bind(e)),e.jobs={}};function $f(e){"function"==typeof this.jobs[e]&&this.jobs[e]()}var Vf=zf,Wf=qf,Hf=function(e,t,i,n){var s=i.keyedList?i.keyedList[i.index]:i.index;i.jobs[s]=function(e,t,i,n){var s;s=2==e.length?e(i,Vf(n)):e(i,t,Vf(n));return s}(t,s,e[s],(function(e,t){s in i.jobs&&(delete i.jobs[s],e?Wf(i):i.results[s]=t,n(e,i.results))}))};var Gf=function(e,t){var i=!Array.isArray(e),n={index:0,keyedList:i||t?Object.keys(e):null,jobs:{},results:i?{}:[],size:i?Object.keys(e).length:e.length};t&&n.keyedList.sort(i?t:function(i,n){return t(e[i],e[n])});return n};var Kf=qf,Jf=zf,Qf=function(e){if(!Object.keys(this.jobs).length)return;this.index=this.size,Kf(this),Jf(e)(null,this.results)};var Yf=Hf,Xf=Gf,Zf=Qf,eg=function(e,t,i){var n=Xf(e);for(;n.index<(n.keyedList||e).length;)Yf(e,t,n,(function(e,t){e?i(e,t):0!==Object.keys(n.jobs).length||i(null,n.results)})),n.index++;return Zf.bind(n,i)};var tg={},ig=Hf,ng=Gf,sg=Qf;function ag(e,t){return e<t?-1:e>t?1:0}({get exports(){return tg},set exports(e){tg=e}}).exports=function(e,t,i,n){var s=ng(e,i);return ig(e,t,s,(function i(a,r){a?n(a,r):(s.index++,s.index<(s.keyedList||e).length?ig(e,t,s,i):n(null,s.results))})),sg.bind(s,n)},tg.ascending=ag,tg.descending=function(e,t){return-1*ag(e,t)};var rg=tg;var og={parallel:eg,serial:function(e,t,i){return rg(e,t,null,i)},serialOrdered:tg},cg=Lf,pg=h,dg=g,lg=n,ug=s,mg=t.parse,hg=e,fg=a.Stream,gg=Af,vg=og,bg=function(e,t){return Object.keys(t).forEach((function(i){e[i]=e[i]||t[i]})),e},_g=yg;function yg(e){if(!(this instanceof yg))return new yg(e);for(var t in this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],cg.call(this),e=e||{})this[t]=e[t]}function xg(e){return Rf.isPlainObject(e)||Rf.isArray(e)}function wg(e){return Rf.endsWith(e,"[]")?e.slice(0,-2):e}function Sg(e,t,i){return e?e.concat(t).map((function(e,t){return e=wg(e),!i&&t?"["+e+"]":e})).join(i?".":""):t}pg.inherits(yg,cg),yg.LINE_BREAK="\r\n",yg.DEFAULT_CONTENT_TYPE="application/octet-stream",yg.prototype.append=function(e,t,i){"string"==typeof(i=i||{})&&(i={filename:i});var n=cg.prototype.append.bind(this);if("number"==typeof t&&(t=""+t),pg.isArray(t))this._error(new Error("Arrays are not supported."));else{var s=this._multiPartHeader(e,t,i),a=this._multiPartFooter();n(s),n(t),n(a),this._trackLength(s,t,i)}},yg.prototype._trackLength=function(e,t,i){var n=0;null!=i.knownLength?n+=+i.knownLength:Buffer.isBuffer(t)?n=t.length:"string"==typeof t&&(n=Buffer.byteLength(t)),this._valueLength+=n,this._overheadLength+=Buffer.byteLength(e)+yg.LINE_BREAK.length,t&&(t.path||t.readable&&t.hasOwnProperty("httpVersion")||t instanceof fg)&&(i.knownLength||this._valuesToMeasure.push(t))},yg.prototype._lengthRetriever=function(e,t){e.hasOwnProperty("fd")?null!=e.end&&e.end!=1/0&&null!=e.start?t(null,e.end+1-(e.start?e.start:0)):hg.stat(e.path,(function(i,n){var s;i?t(i):(s=n.size-(e.start?e.start:0),t(null,s))})):e.hasOwnProperty("httpVersion")?t(null,+e.headers["content-length"]):e.hasOwnProperty("httpModule")?(e.on("response",(function(i){e.pause(),t(null,+i.headers["content-length"])})),e.resume()):t("Unknown stream")},yg.prototype._multiPartHeader=function(e,t,i){if("string"==typeof i.header)return i.header;var n,s=this._getContentDisposition(t,i),a=this._getContentType(t,i),r="",o={"Content-Disposition":["form-data",'name="'+e+'"'].concat(s||[]),"Content-Type":[].concat(a||[])};for(var c in"object"==typeof i.header&&bg(o,i.header),o)o.hasOwnProperty(c)&&null!=(n=o[c])&&(Array.isArray(n)||(n=[n]),n.length&&(r+=c+": "+n.join("; ")+yg.LINE_BREAK));return"--"+this.getBoundary()+yg.LINE_BREAK+r+yg.LINE_BREAK},yg.prototype._getContentDisposition=function(e,t){var i,n;return"string"==typeof t.filepath?i=dg.normalize(t.filepath).replace(/\\/g,"/"):t.filename||e.name||e.path?i=dg.basename(t.filename||e.name||e.path):e.readable&&e.hasOwnProperty("httpVersion")&&(i=dg.basename(e.client._httpMessage.path||"")),i&&(n='filename="'+i+'"'),n},yg.prototype._getContentType=function(e,t){var i=t.contentType;return!i&&e.name&&(i=gg.lookup(e.name)),!i&&e.path&&(i=gg.lookup(e.path)),!i&&e.readable&&e.hasOwnProperty("httpVersion")&&(i=e.headers["content-type"]),i||!t.filepath&&!t.filename||(i=gg.lookup(t.filepath||t.filename)),i||"object"!=typeof e||(i=yg.DEFAULT_CONTENT_TYPE),i},yg.prototype._multiPartFooter=function(){return function(e){var t=yg.LINE_BREAK;0===this._streams.length&&(t+=this._lastBoundary()),e(t)}.bind(this)},yg.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+yg.LINE_BREAK},yg.prototype.getHeaders=function(e){var t,i={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(t in e)e.hasOwnProperty(t)&&(i[t.toLowerCase()]=e[t]);return i},yg.prototype.setBoundary=function(e){this._boundary=e},yg.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary},yg.prototype.getBuffer=function(){for(var e=new Buffer.alloc(0),t=this.getBoundary(),i=0,n=this._streams.length;i<n;i++)"function"!=typeof this._streams[i]&&(e=Buffer.isBuffer(this._streams[i])?Buffer.concat([e,this._streams[i]]):Buffer.concat([e,Buffer.from(this._streams[i])]),"string"==typeof this._streams[i]&&this._streams[i].substring(2,t.length+2)===t||(e=Buffer.concat([e,Buffer.from(yg.LINE_BREAK)])));return Buffer.concat([e,Buffer.from(this._lastBoundary())])},yg.prototype._generateBoundary=function(){for(var e="--------------------------",t=0;t<24;t++)e+=Math.floor(10*Math.random()).toString(16);this._boundary=e},yg.prototype.getLengthSync=function(){var e=this._overheadLength+this._valueLength;return this._streams.length&&(e+=this._lastBoundary().length),this.hasKnownLength()||this._error(new Error("Cannot calculate proper length in synchronous way.")),e},yg.prototype.hasKnownLength=function(){var e=!0;return this._valuesToMeasure.length&&(e=!1),e},yg.prototype.getLength=function(e){var t=this._overheadLength+this._valueLength;this._streams.length&&(t+=this._lastBoundary().length),this._valuesToMeasure.length?vg.parallel(this._valuesToMeasure,this._lengthRetriever,(function(i,n){i?e(i):(n.forEach((function(e){t+=e})),e(null,t))})):process.nextTick(e.bind(this,null,t))},yg.prototype.submit=function(e,t){var i,n,s={method:"post"};return"string"==typeof e?(e=mg(e),n=bg({port:e.port,path:e.pathname,host:e.hostname,protocol:e.protocol},s)):(n=bg(e,s)).port||(n.port="https:"==n.protocol?443:80),n.headers=this.getHeaders(e.headers),i="https:"==n.protocol?ug.request(n):lg.request(n),this.getLength(function(e,n){if(e&&"Unknown stream"!==e)this._error(e);else if(n&&i.setHeader("Content-Length",n),this.pipe(i),t){var s,a=function(e,n){return i.removeListener("error",a),i.removeListener("response",s),t.call(this,e,n)};s=a.bind(this,null),i.on("error",a),i.on("response",s)}}.bind(this)),i},yg.prototype._error=function(e){this.error||(this.error=e,this.pause(),this.emit("error",e))},yg.prototype.toString=function(){return"[object FormData]"};const Rg=Rf.toFlatObject(Rf,{},null,(function(e){return/^is[A-Z]/.test(e)}));function Cg(e,t,i){if(!Rf.isObject(e))throw new TypeError("target must be an object");t=t||new(_g||FormData);const n=(i=Rf.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!Rf.isUndefined(t[e])}))).metaTokens,s=i.visitor||d,a=i.dots,r=i.indexes,o=(i.Blob||"undefined"!=typeof Blob&&Blob)&&((c=t)&&Rf.isFunction(c.append)&&"FormData"===c[Symbol.toStringTag]&&c[Symbol.iterator]);var c;if(!Rf.isFunction(s))throw new TypeError("visitor must be a function");function p(e){if(null===e)return"";if(Rf.isDate(e))return e.toISOString();if(!o&&Rf.isBlob(e))throw new Cf("Blob is not supported. Use a Buffer instead.");return Rf.isArrayBuffer(e)||Rf.isTypedArray(e)?o&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function d(e,i,s){let o=e;if(e&&!s&&"object"==typeof e)if(Rf.endsWith(i,"{}"))i=n?i:i.slice(0,-2),e=JSON.stringify(e);else if(Rf.isArray(e)&&function(e){return Rf.isArray(e)&&!e.some(xg)}(e)||Rf.isFileList(e)||Rf.endsWith(i,"[]")&&(o=Rf.toArray(e)))return i=wg(i),o.forEach((function(e,n){!Rf.isUndefined(e)&&null!==e&&t.append(!0===r?Sg([i],n,a):null===r?i:i+"[]",p(e))})),!1;return!!xg(e)||(t.append(Sg(s,i,a),p(e)),!1)}const l=[],u=Object.assign(Rg,{defaultVisitor:d,convertValue:p,isVisitable:xg});if(!Rf.isObject(e))throw new TypeError("data must be an object");return function e(i,n){if(!Rf.isUndefined(i)){if(-1!==l.indexOf(i))throw Error("Circular reference detected in "+n.join("."));l.push(i),Rf.forEach(i,(function(i,a){!0===(!(Rf.isUndefined(i)||null===i)&&s.call(t,i,Rf.isString(a)?a.trim():a,n,u))&&e(i,n?n.concat(a):[a])})),l.pop()}}(e),t}function kg(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function Tg(e,t){this._pairs=[],e&&Cg(e,this,t)}const Pg=Tg.prototype;function Eg(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Og(e,t,i){if(!t)return e;const n=i&&i.encode||Eg,s=i&&i.serialize;let a;if(a=s?s(t,i):Rf.isURLSearchParams(t)?t.toString():new Tg(t,i).toString(n),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}Pg.append=function(e,t){this._pairs.push([e,t])},Pg.toString=function(e){const t=e?function(t){return e.call(this,t,kg)}:kg;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};class Dg{constructor(){this.handlers=[]}use(e,t,i){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!i&&i.synchronous,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Rf.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}var Ig={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},jg={isNode:!0,classes:{URLSearchParams:t.URLSearchParams,FormData:_g,Blob:"undefined"!=typeof Blob&&Blob||null},protocols:["http","https","file","data"]};function Lg(e){function t(e,i,n,s){let a=e[s++];const r=Number.isFinite(+a),o=s>=e.length;if(a=!a&&Rf.isArray(n)?n.length:a,o)return Rf.hasOwnProp(n,a)?n[a]=[n[a],i]:n[a]=i,!r;n[a]&&Rf.isObject(n[a])||(n[a]=[]);return t(e,i,n[a],s)&&Rf.isArray(n[a])&&(n[a]=function(e){const t={},i=Object.keys(e);let n;const s=i.length;let a;for(n=0;n<s;n++)a=i[n],t[a]=e[a];return t}(n[a])),!r}if(Rf.isFormData(e)&&Rf.isFunction(e.entries)){const i={};return Rf.forEachEntry(e,((e,n)=>{t(function(e){return Rf.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,i,0)})),i}return null}const Mg={"Content-Type":void 0};const Ag={transitional:Ig,adapter:["xhr","http"],transformRequest:[function(e,t){const i=t.getContentType()||"",n=i.indexOf("application/json")>-1,s=Rf.isObject(e);s&&Rf.isHTMLForm(e)&&(e=new FormData(e));if(Rf.isFormData(e))return n&&n?JSON.stringify(Lg(e)):e;if(Rf.isArrayBuffer(e)||Rf.isBuffer(e)||Rf.isStream(e)||Rf.isFile(e)||Rf.isBlob(e))return e;if(Rf.isArrayBufferView(e))return e.buffer;if(Rf.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(i.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Cg(e,new jg.classes.URLSearchParams,Object.assign({visitor:function(e,t,i,n){return Rf.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=Rf.isFileList(e))||i.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Cg(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||n?(t.setContentType("application/json",!1),function(e,t,i){if(Rf.isString(e))try{return(t||JSON.parse)(e),Rf.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(i||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Ag.transitional,i=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&Rf.isString(e)&&(i&&!this.responseType||n)){const i=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(i){if("SyntaxError"===e.name)throw Cf.from(e,Cf.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:jg.classes.FormData,Blob:jg.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Rf.forEach(["delete","get","head"],(function(e){Ag.headers[e]={}})),Rf.forEach(["post","put","patch"],(function(e){Ag.headers[e]=Rf.merge(Mg)}));const Ng=Rf.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const Bg=Symbol("internals");function Fg(e){return e&&String(e).trim().toLowerCase()}function Ug(e){return!1===e||null==e?e:Rf.isArray(e)?e.map(Ug):String(e)}function zg(e,t,i,n){return Rf.isFunction(n)?n.call(this,t,i):Rf.isString(t)?Rf.isString(n)?-1!==t.indexOf(n):Rf.isRegExp(n)?n.test(t):void 0:void 0}class qg{constructor(e){e&&this.set(e)}set(e,t,i){const n=this;function s(e,t,i){const s=Fg(t);if(!s)throw new Error("header name must be a non-empty string");const a=Rf.findKey(n,s);(!a||void 0===n[a]||!0===i||void 0===i&&!1!==n[a])&&(n[a||t]=Ug(e))}const a=(e,t)=>Rf.forEach(e,((e,i)=>s(e,i,t)));return Rf.isPlainObject(e)||e instanceof this.constructor?a(e,t):Rf.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z]+$/.test(e.trim())?a((e=>{const t={};let i,n,s;return e&&e.split("\n").forEach((function(e){s=e.indexOf(":"),i=e.substring(0,s).trim().toLowerCase(),n=e.substring(s+1).trim(),!i||t[i]&&Ng[i]||("set-cookie"===i?t[i]?t[i].push(n):t[i]=[n]:t[i]=t[i]?t[i]+", "+n:n)})),t})(e),t):null!=e&&s(t,e,i),this}get(e,t){if(e=Fg(e)){const i=Rf.findKey(this,e);if(i){const e=this[i];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=i.exec(e);)t[n[1]]=n[2];return t}(e);if(Rf.isFunction(t))return t.call(this,e,i);if(Rf.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Fg(e)){const i=Rf.findKey(this,e);return!(!i||t&&!zg(0,this[i],i,t))}return!1}delete(e,t){const i=this;let n=!1;function s(e){if(e=Fg(e)){const s=Rf.findKey(i,e);!s||t&&!zg(0,i[s],s,t)||(delete i[s],n=!0)}}return Rf.isArray(e)?e.forEach(s):s(e),n}clear(){return Object.keys(this).forEach(this.delete.bind(this))}normalize(e){const t=this,i={};return Rf.forEach(this,((n,s)=>{const a=Rf.findKey(i,s);if(a)return t[a]=Ug(n),void delete t[s];const r=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,i)=>t.toUpperCase()+i))}(s):String(s).trim();r!==s&&delete t[s],t[r]=Ug(n),i[r]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Rf.forEach(this,((i,n)=>{null!=i&&!1!==i&&(t[n]=e&&Rf.isArray(i)?i.join(", "):i)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const i=new this(e);return t.forEach((e=>i.set(e))),i}static accessor(e){const t=(this[Bg]=this[Bg]={accessors:{}}).accessors,i=this.prototype;function n(e){const n=Fg(e);t[n]||(!function(e,t){const i=Rf.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+i,{value:function(e,i,s){return this[n].call(this,t,e,i,s)},configurable:!0})}))}(i,e),t[n]=!0)}return Rf.isArray(e)?e.forEach(n):n(e),this}}function $g(e,t){const i=this||Ag,n=t||i,s=qg.from(n.headers);let a=n.data;return Rf.forEach(e,(function(e){a=e.call(i,a,s.normalize(),t?t.status:void 0)})),s.normalize(),a}function Vg(e){return!(!e||!e.__CANCEL__)}function Wg(e,t,i){Cf.call(this,null==e?"canceled":e,Cf.ERR_CANCELED,t,i),this.name="CanceledError"}function Hg(e,t,i){const n=i.config.validateStatus;i.status&&n&&!n(i.status)?t(new Cf("Request failed with status code "+i.status,[Cf.ERR_BAD_REQUEST,Cf.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i)):e(i)}function Gg(e,t){return e&&!function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}qg.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent"]),Rf.freezeMethods(qg.prototype),Rf.freezeMethods(qg),Rf.inherits(Wg,Cf,{__CANCEL__:!0});var Kg=t.parse,Jg={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443},Qg=String.prototype.endsWith||function(e){return e.length<=this.length&&-1!==this.indexOf(e,this.length-e.length)};function Yg(e){return process.env[e.toLowerCase()]||process.env[e.toUpperCase()]||""}var Xg,Zg=function(e){var t="string"==typeof e?Kg(e):e||{},i=t.protocol,n=t.host,s=t.port;if("string"!=typeof n||!n||"string"!=typeof i)return"";if(i=i.split(":",1)[0],!function(e,t){var i=(Yg("npm_config_no_proxy")||Yg("no_proxy")).toLowerCase();if(!i)return!0;if("*"===i)return!1;return i.split(/[,\s]/).every((function(i){if(!i)return!0;var n=i.match(/^(.+):(\d+)$/),s=n?n[1]:i,a=n?parseInt(n[2]):0;return!(!a||a===t)||(/^[.*]/.test(s)?("*"===s.charAt(0)&&(s=s.slice(1)),!Qg.call(e,s)):e!==s)}))}(n=n.replace(/:\d*$/,""),s=parseInt(s)||Jg[i]||0))return"";var a=Yg("npm_config_"+i+"_proxy")||Yg(i+"_proxy")||Yg("npm_config_proxy")||Yg("all_proxy");return a&&-1===a.indexOf("://")&&(a=i+"://"+a),a},ev={},tv={get exports(){return ev},set exports(e){ev=e}},iv=t,nv=iv.URL,sv=n,av=s,rv=a.Writable,ov=u,cv=function(){if(!Xg){try{Xg=jo("follow-redirects")}catch(e){}"function"!=typeof Xg&&(Xg=function(){})}Xg.apply(null,arguments)},pv=["abort","aborted","connect","error","socket","timeout"],dv=Object.create(null);pv.forEach((function(e){dv[e]=function(t,i,n){this._redirectable.emit(e,t,i,n)}}));var lv=xv("ERR_INVALID_URL","Invalid URL",TypeError),uv=xv("ERR_FR_REDIRECTION_FAILURE","Redirected request failed"),mv=xv("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded"),hv=xv("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),fv=xv("ERR_STREAM_WRITE_AFTER_END","write after end");function gv(e,t){rv.call(this),this._sanitizeOptions(e),this._options=e,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],t&&this.on("response",t);var i=this;this._onNativeResponse=function(e){i._processResponse(e)},this._performRequest()}function vv(e){var t={maxRedirects:21,maxBodyLength:10485760},i={};return Object.keys(e).forEach((function(n){var s=n+":",a=i[s]=e[n],r=t[n]=Object.create(a);Object.defineProperties(r,{request:{value:function(e,n,a){if(Sv(e)){var r;try{r=_v(new nv(e))}catch(t){r=iv.parse(e)}if(!Sv(r.protocol))throw new lv({input:e});e=r}else nv&&e instanceof nv?e=_v(e):(a=n,n=e,e={protocol:s});return Rv(n)&&(a=n,n=null),(n=Object.assign({maxRedirects:t.maxRedirects,maxBodyLength:t.maxBodyLength},e,n)).nativeProtocols=i,Sv(n.host)||Sv(n.hostname)||(n.hostname="::1"),ov.equal(n.protocol,s,"protocol mismatch"),cv("options",n),new gv(n,a)},configurable:!0,enumerable:!0,writable:!0},get:{value:function(e,t,i){var n=r.request(e,t,i);return n.end(),n},configurable:!0,enumerable:!0,writable:!0}})})),t}function bv(){}function _v(e){var t={protocol:e.protocol,hostname:e.hostname.startsWith("[")?e.hostname.slice(1,-1):e.hostname,hash:e.hash,search:e.search,pathname:e.pathname,path:e.pathname+e.search,href:e.href};return""!==e.port&&(t.port=Number(e.port)),t}function yv(e,t){var i;for(var n in t)e.test(n)&&(i=t[n],delete t[n]);return null==i?void 0:String(i).trim()}function xv(e,t,i){function n(i){Error.captureStackTrace(this,this.constructor),Object.assign(this,i||{}),this.code=e,this.message=this.cause?t+": "+this.cause.message:t}return n.prototype=new(i||Error),n.prototype.constructor=n,n.prototype.name="Error ["+e+"]",n}function wv(e){for(var t of pv)e.removeListener(t,dv[t]);e.on("error",bv),e.abort()}function Sv(e){return"string"==typeof e||e instanceof String}function Rv(e){return"function"==typeof e}gv.prototype=Object.create(rv.prototype),gv.prototype.abort=function(){wv(this._currentRequest),this.emit("abort")},gv.prototype.write=function(e,t,i){if(this._ending)throw new fv;if(!Sv(e)&&("object"!=typeof(n=e)||!("length"in n)))throw new TypeError("data should be a string, Buffer or Uint8Array");var n;Rv(t)&&(i=t,t=null),0!==e.length?this._requestBodyLength+e.length<=this._options.maxBodyLength?(this._requestBodyLength+=e.length,this._requestBodyBuffers.push({data:e,encoding:t}),this._currentRequest.write(e,t,i)):(this.emit("error",new hv),this.abort()):i&&i()},gv.prototype.end=function(e,t,i){if(Rv(e)?(i=e,e=t=null):Rv(t)&&(i=t,t=null),e){var n=this,s=this._currentRequest;this.write(e,t,(function(){n._ended=!0,s.end(null,null,i)})),this._ending=!0}else this._ended=this._ending=!0,this._currentRequest.end(null,null,i)},gv.prototype.setHeader=function(e,t){this._options.headers[e]=t,this._currentRequest.setHeader(e,t)},gv.prototype.removeHeader=function(e){delete this._options.headers[e],this._currentRequest.removeHeader(e)},gv.prototype.setTimeout=function(e,t){var i=this;function n(t){t.setTimeout(e),t.removeListener("timeout",t.destroy),t.addListener("timeout",t.destroy)}function s(t){i._timeout&&clearTimeout(i._timeout),i._timeout=setTimeout((function(){i.emit("timeout"),a()}),e),n(t)}function a(){i._timeout&&(clearTimeout(i._timeout),i._timeout=null),i.removeListener("abort",a),i.removeListener("error",a),i.removeListener("response",a),t&&i.removeListener("timeout",t),i.socket||i._currentRequest.removeListener("socket",s)}return t&&this.on("timeout",t),this.socket?s(this.socket):this._currentRequest.once("socket",s),this.on("socket",n),this.on("abort",a),this.on("error",a),this.on("response",a),this},["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach((function(e){gv.prototype[e]=function(t,i){return this._currentRequest[e](t,i)}})),["aborted","connection","socket"].forEach((function(e){Object.defineProperty(gv.prototype,e,{get:function(){return this._currentRequest[e]}})})),gv.prototype._sanitizeOptions=function(e){if(e.headers||(e.headers={}),e.host&&(e.hostname||(e.hostname=e.host),delete e.host),!e.pathname&&e.path){var t=e.path.indexOf("?");t<0?e.pathname=e.path:(e.pathname=e.path.substring(0,t),e.search=e.path.substring(t))}},gv.prototype._performRequest=function(){var e=this._options.protocol,t=this._options.nativeProtocols[e];if(t){if(this._options.agents){var i=e.slice(0,-1);this._options.agent=this._options.agents[i]}var n=this._currentRequest=t.request(this._options,this._onNativeResponse);for(var s of(n._redirectable=this,pv))n.on(s,dv[s]);if(this._currentUrl=/^\//.test(this._options.path)?iv.format(this._options):this._options.path,this._isRedirect){var a=0,r=this,o=this._requestBodyBuffers;!function e(t){if(n===r._currentRequest)if(t)r.emit("error",t);else if(a<o.length){var i=o[a++];n.finished||n.write(i.data,i.encoding,e)}else r._ended&&n.end()}()}}else this.emit("error",new TypeError("Unsupported protocol "+e))},gv.prototype._processResponse=function(e){var t=e.statusCode;this._options.trackRedirects&&this._redirects.push({url:this._currentUrl,headers:e.headers,statusCode:t});var i=e.headers.location;if(!i||!1===this._options.followRedirects||t<300||t>=400)return e.responseUrl=this._currentUrl,e.redirects=this._redirects,this.emit("response",e),void(this._requestBodyBuffers=[]);if(wv(this._currentRequest),e.destroy(),++this._redirectCount>this._options.maxRedirects)this.emit("error",new mv);else{var n,s=this._options.beforeRedirect;s&&(n=Object.assign({Host:e.req.getHeader("host")},this._options.headers));var a=this._options.method;((301===t||302===t)&&"POST"===this._options.method||303===t&&!/^(?:GET|HEAD)$/.test(this._options.method))&&(this._options.method="GET",this._requestBodyBuffers=[],yv(/^content-/i,this._options.headers));var r,o=yv(/^host$/i,this._options.headers),c=iv.parse(this._currentUrl),p=o||c.host,d=/^\w+:/.test(i)?this._currentUrl:iv.format(Object.assign(c,{host:p}));try{r=iv.resolve(d,i)}catch(e){return void this.emit("error",new uv({cause:e}))}cv("redirecting to",r),this._isRedirect=!0;var l=iv.parse(r);if(Object.assign(this._options,l),(l.protocol!==c.protocol&&"https:"!==l.protocol||l.host!==p&&!function(e,t){ov(Sv(e)&&Sv(t));var i=e.length-t.length-1;return i>0&&"."===e[i]&&e.endsWith(t)}(l.host,p))&&yv(/^(?:authorization|cookie)$/i,this._options.headers),Rv(s)){var u={headers:e.headers,statusCode:t},m={url:d,method:a,headers:n};try{s(this._options,u,m)}catch(e){return void this.emit("error",e)}this._sanitizeOptions(this._options)}try{this._performRequest()}catch(e){this.emit("error",new uv({cause:e}))}}},tv.exports=vv({http:sv,https:av}),ev.wrap=vv;function Cv(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}const kv=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function Tv(e,t){e=e||10;const i=new Array(e),n=new Array(e);let s,a=0,r=0;return t=void 0!==t?t:1e3,function(o){const c=Date.now(),p=n[r];s||(s=c),i[a]=o,n[a]=c;let d=r,l=0;for(;d!==a;)l+=i[d++],d%=e;if(a=(a+1)%e,a===r&&(r=(r+1)%e),c-s<t)return;const u=p&&c-p;return u?Math.round(1e3*l/u):void 0}}const Pv=Symbol("internals");class Ev extends a.Transform{constructor(e){super({readableHighWaterMark:(e=Rf.toFlatObject(e,{maxRate:0,chunkSize:65536,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,((e,t)=>!Rf.isUndefined(t[e])))).chunkSize});const t=this,i=this[Pv]={length:e.length,timeWindow:e.timeWindow,ticksRate:e.ticksRate,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null},n=Tv(i.ticksRate*e.samplesCount,i.timeWindow);this.on("newListener",(e=>{"progress"===e&&(i.isCaptured||(i.isCaptured=!0))}));let s=0;i.updateProgress=function(e,t){let i=0;const n=1e3/t;let s=null;return function(t,a){const r=Date.now();if(t||r-i>n)return s&&(clearTimeout(s),s=null),i=r,e.apply(null,a);s||(s=setTimeout((()=>(s=null,i=Date.now(),e.apply(null,a))),n-(r-i)))}}((function(){const e=i.length,a=i.bytesSeen,r=a-s;if(!r||t.destroyed)return;const o=n(r);s=a,process.nextTick((()=>{t.emit("progress",{loaded:a,total:e,progress:e?a/e:void 0,bytes:r,rate:o||void 0,estimated:o&&e&&a<=e?(e-a)/o:void 0})}))}),i.ticksRate);const a=()=>{i.updateProgress(!0)};this.once("end",a),this.once("error",a)}_read(e){const t=this[Pv];return t.onReadCallback&&t.onReadCallback(),super._read(e)}_transform(e,t,i){const n=this,s=this[Pv],a=s.maxRate,r=this.readableHighWaterMark,o=s.timeWindow,c=a/(1e3/o),p=!1!==s.minChunkSize?Math.max(s.minChunkSize,.01*c):0;const d=(e,t)=>{const i=Buffer.byteLength(e);let d,l=null,u=r,m=0;if(a){const e=Date.now();(!s.ts||(m=e-s.ts)>=o)&&(s.ts=e,d=c-s.bytes,s.bytes=d<0?-d:0,m=0),d=c-s.bytes}if(a){if(d<=0)return setTimeout((()=>{t(null,e)}),o-m);d<u&&(u=d)}u&&i>u&&i-u>p&&(l=e.subarray(u),e=e.subarray(0,u)),function(e,t){const i=Buffer.byteLength(e);s.bytesSeen+=i,s.bytes+=i,s.isCaptured&&s.updateProgress(),n.push(e)?process.nextTick(t):s.onReadCallback=()=>{s.onReadCallback=null,process.nextTick(t)}}(e,l?()=>{process.nextTick(t,null,l)}:t)};d(e,(function e(t,n){if(t)return i(t);n?d(n,e):i(null)}))}setLength(e){return this[Pv].length=+e,this}}const Ov={flush:r.constants.Z_SYNC_FLUSH,finishFlush:r.constants.Z_SYNC_FLUSH},Dv={flush:r.constants.BROTLI_OPERATION_FLUSH,finishFlush:r.constants.BROTLI_OPERATION_FLUSH},Iv=Rf.isFunction(r.createBrotliDecompress),{http:jv,https:Lv}=ev,Mv=/https:?/,Av=jg.protocols.map((e=>e+":"));function Nv(e){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e)}function Bv(e,t,i){let n=t;if(!n&&!1!==n){const e=Zg(i);e&&(n=new URL(e))}if(n){if(n.username&&(n.auth=(n.username||"")+":"+(n.password||"")),n.auth){(n.auth.username||n.auth.password)&&(n.auth=(n.auth.username||"")+":"+(n.auth.password||""));const t=Buffer.from(n.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+t}e.headers.host=e.hostname+(e.port?":"+e.port:"");const t=n.hostname||n.host;e.hostname=t,e.host=t,e.port=n.port,e.path=i,n.protocol&&(e.protocol=n.protocol.includes(":")?n.protocol:`${n.protocol}:`)}e.beforeRedirects.proxy=function(e){Bv(e,t,e.href)}}var Fv="undefined"!=typeof process&&"process"===Rf.kindOf(process)&&function(e){return new Promise((function(t,i){let o=e.data;const c=e.responseType,p=e.responseEncoding,l=e.method.toUpperCase();let u,m,h,f=!1;const g=new d;function v(){u||(u=!0,e.cancelToken&&e.cancelToken.unsubscribe(x),e.signal&&e.signal.removeEventListener("abort",x),g.removeAllListeners())}function b(e,n){m||(m=!0,n&&(f=!0,v()),n?i(e):t(e))}const _=function(e){b(e)},y=function(e){b(e,!0)};function x(t){g.emit("abort",!t||t.type?new Wg(null,e,h):t)}g.once("abort",y),(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(x),e.signal&&(e.signal.aborted?x():e.signal.addEventListener("abort",x)));const w=Gg(e.baseURL,e.url),S=new URL(w),R=S.protocol||Av[0];if("data:"===R){let t;if("GET"!==l)return Hg(_,y,{status:405,statusText:"method not allowed",headers:{},config:e});try{t=function(e,t,i){const n=i&&i.Blob||jg.classes.Blob,s=Cv(e);if(void 0===t&&n&&(t=!0),"data"===s){e=s.length?e.slice(s.length+1):e;const i=kv.exec(e);if(!i)throw new Cf("Invalid URL",Cf.ERR_INVALID_URL);const a=i[1],r=i[2],o=i[3],c=Buffer.from(decodeURIComponent(o),r?"base64":"utf8");if(t){if(!n)throw new Cf("Blob is not supported",Cf.ERR_NOT_SUPPORT);return new n([c],{type:a})}return c}throw new Cf("Unsupported protocol "+s,Cf.ERR_NOT_SUPPORT)}(e.url,"blob"===c,{Blob:e.env&&e.env.Blob})}catch(t){throw Cf.from(t,Cf.ERR_BAD_REQUEST,e)}return"text"===c?(t=t.toString(p),p&&"utf8"!==p||(o=Rf.stripBOM(t))):"stream"===c&&(t=a.Readable.from(t)),Hg(_,y,{data:t,status:200,statusText:"OK",headers:new qg,config:e})}if(-1===Av.indexOf(R))return y(new Cf("Unsupported protocol "+R,Cf.ERR_BAD_REQUEST,e));const C=qg.from(e.headers).normalize();C.set("User-Agent","axios/1.2.3",!1);const k=e.onDownloadProgress,T=e.onUploadProgress,P=e.maxRate;let E,O;if(Rf.isFormData(o)&&Rf.isFunction(o.getHeaders))C.set(o.getHeaders());else if(o&&!Rf.isStream(o)){if(Buffer.isBuffer(o));else if(Rf.isArrayBuffer(o))o=Buffer.from(new Uint8Array(o));else{if(!Rf.isString(o))return y(new Cf("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",Cf.ERR_BAD_REQUEST,e));o=Buffer.from(o,"utf-8")}if(C.set("Content-Length",o.length,!1),e.maxBodyLength>-1&&o.length>e.maxBodyLength)return y(new Cf("Request body larger than maxBodyLength limit",Cf.ERR_BAD_REQUEST,e))}const D=Rf.toFiniteNumber(C.getContentLength());let I,j;if(Rf.isArray(P)?(E=P[0],O=P[1]):E=O=P,o&&(T||E)&&(Rf.isStream(o)||(o=a.Readable.from(o,{objectMode:!1})),o=a.pipeline([o,new Ev({length:D,maxRate:Rf.toFiniteNumber(E)})],Rf.noop),T&&o.on("progress",(e=>{T(Object.assign(e,{upload:!0}))}))),e.auth){I=(e.auth.username||"")+":"+(e.auth.password||"")}if(!I&&S.username){I=S.username+":"+S.password}I&&C.delete("authorization");try{j=Og(S.pathname+S.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(t){const i=new Error(t.message);return i.config=e,i.url=e.url,i.exists=!0,y(i)}C.set("Accept-Encoding","gzip, compress, deflate"+(Iv?", br":""),!1);const L={path:j,method:l,headers:C.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:I,protocol:R,beforeRedirect:Nv,beforeRedirects:{}};let M;e.socketPath?L.socketPath=e.socketPath:(L.hostname=S.hostname,L.port=S.port,Bv(L,e.proxy,R+"//"+S.hostname+(S.port?":"+S.port:"")+L.path));const A=Mv.test(L.protocol);if(L.agent=A?e.httpsAgent:e.httpAgent,e.transport?M=e.transport:0===e.maxRedirects?M=A?s:n:(e.maxRedirects&&(L.maxRedirects=e.maxRedirects),e.beforeRedirect&&(L.beforeRedirects.config=e.beforeRedirect),M=A?Lv:jv),e.maxBodyLength>-1?L.maxBodyLength=e.maxBodyLength:L.maxBodyLength=1/0,e.insecureHTTPParser&&(L.insecureHTTPParser=e.insecureHTTPParser),h=M.request(L,(function(t){if(h.destroyed)return;const i=[t],n=+t.headers["content-length"];if(k){const e=new Ev({length:Rf.toFiniteNumber(n),maxRate:Rf.toFiniteNumber(O)});k&&e.on("progress",(e=>{k(Object.assign(e,{download:!0}))})),i.push(e)}let s=t;const o=t.req||h;if(!1!==e.decompress&&t.headers["content-encoding"])switch("HEAD"!==l&&204!==t.statusCode||delete t.headers["content-encoding"],t.headers["content-encoding"]){case"gzip":case"x-gzip":case"compress":case"x-compress":case"deflate":i.push(r.createUnzip(Ov)),delete t.headers["content-encoding"];break;case"br":Iv&&(i.push(r.createBrotliDecompress(Dv)),delete t.headers["content-encoding"])}s=i.length>1?a.pipeline(i,Rf.noop):i[0];const d=a.finished(s,(()=>{d(),v()})),u={status:t.statusCode,statusText:t.statusMessage,headers:new qg(t.headers),config:e,request:o};if("stream"===c)u.data=s,Hg(_,y,u);else{const t=[];let i=0;s.on("data",(function(n){t.push(n),i+=n.length,e.maxContentLength>-1&&i>e.maxContentLength&&(f=!0,s.destroy(),y(new Cf("maxContentLength size of "+e.maxContentLength+" exceeded",Cf.ERR_BAD_RESPONSE,e,o)))})),s.on("aborted",(function(){if(f)return;const t=new Cf("maxContentLength size of "+e.maxContentLength+" exceeded",Cf.ERR_BAD_RESPONSE,e,o);s.destroy(t),y(t)})),s.on("error",(function(t){h.destroyed||y(Cf.from(t,null,e,o))})),s.on("end",(function(){try{let e=1===t.length?t[0]:Buffer.concat(t);"arraybuffer"!==c&&(e=e.toString(p),p&&"utf8"!==p||(e=Rf.stripBOM(e))),u.data=e}catch(t){y(Cf.from(t,null,e,u.request,u))}Hg(_,y,u)}))}g.once("abort",(e=>{s.destroyed||(s.emit("error",e),s.destroy())}))})),g.once("abort",(e=>{y(e),h.destroy(e)})),h.on("error",(function(t){y(Cf.from(t,null,e,h))})),h.on("socket",(function(e){e.setKeepAlive(!0,6e4)})),e.timeout){const t=parseInt(e.timeout,10);if(isNaN(t))return void y(new Cf("error trying to parse `config.timeout` to int",Cf.ERR_BAD_OPTION_VALUE,e,h));h.setTimeout(t,(function(){if(m)return;let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const i=e.transitional||Ig;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),y(new Cf(t,i.clarifyTimeoutError?Cf.ETIMEDOUT:Cf.ECONNABORTED,e,h)),x()}))}if(Rf.isStream(o)){let t=!1,i=!1;o.on("end",(()=>{t=!0})),o.once("error",(e=>{i=!0,h.destroy(e)})),o.on("close",(()=>{t||i||x(new Wg("Request stream has been aborted",e,h))})),o.pipe(h)}else h.end(o)}))},Uv=jg.isStandardBrowserEnv?{write:function(e,t,i,n,s,a){const r=[];r.push(e+"="+encodeURIComponent(t)),Rf.isNumber(i)&&r.push("expires="+new Date(i).toGMTString()),Rf.isString(n)&&r.push("path="+n),Rf.isString(s)&&r.push("domain="+s),!0===a&&r.push("secure"),document.cookie=r.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},zv=jg.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let i;function n(i){let n=i;return e&&(t.setAttribute("href",n),n=t.href),t.setAttribute("href",n),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return i=n(window.location.href),function(e){const t=Rf.isString(e)?n(e):e;return t.protocol===i.protocol&&t.host===i.host}}():function(){return!0};function qv(e,t){let i=0;const n=Tv(50,250);return s=>{const a=s.loaded,r=s.lengthComputable?s.total:void 0,o=a-i,c=n(o);i=a;const p={loaded:a,total:r,progress:r?a/r:void 0,bytes:o,rate:c||void 0,estimated:c&&r&&a<=r?(r-a)/c:void 0,event:s};p[t?"download":"upload"]=!0,e(p)}}var $v="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,i){let n=e.data;const s=qg.from(e.headers).normalize(),a=e.responseType;let r;function o(){e.cancelToken&&e.cancelToken.unsubscribe(r),e.signal&&e.signal.removeEventListener("abort",r)}Rf.isFormData(n)&&(jg.isStandardBrowserEnv||jg.isStandardBrowserWebWorkerEnv)&&s.setContentType(!1);let c=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",i=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";s.set("Authorization","Basic "+btoa(t+":"+i))}const p=Gg(e.baseURL,e.url);function d(){if(!c)return;const n=qg.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());Hg((function(e){t(e),o()}),(function(e){i(e),o()}),{data:a&&"text"!==a&&"json"!==a?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:n,config:e,request:c}),c=null}if(c.open(e.method.toUpperCase(),Og(p,e.params,e.paramsSerializer),!0),c.timeout=e.timeout,"onloadend"in c?c.onloadend=d:c.onreadystatechange=function(){c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(d)},c.onabort=function(){c&&(i(new Cf("Request aborted",Cf.ECONNABORTED,e,c)),c=null)},c.onerror=function(){i(new Cf("Network Error",Cf.ERR_NETWORK,e,c)),c=null},c.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||Ig;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),i(new Cf(t,n.clarifyTimeoutError?Cf.ETIMEDOUT:Cf.ECONNABORTED,e,c)),c=null},jg.isStandardBrowserEnv){const t=(e.withCredentials||zv(p))&&e.xsrfCookieName&&Uv.read(e.xsrfCookieName);t&&s.set(e.xsrfHeaderName,t)}void 0===n&&s.setContentType(null),"setRequestHeader"in c&&Rf.forEach(s.toJSON(),(function(e,t){c.setRequestHeader(t,e)})),Rf.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),a&&"json"!==a&&(c.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&c.addEventListener("progress",qv(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",qv(e.onUploadProgress)),(e.cancelToken||e.signal)&&(r=t=>{c&&(i(!t||t.type?new Wg(null,e,c):t),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(r),e.signal&&(e.signal.aborted?r():e.signal.addEventListener("abort",r)));const l=Cv(p);l&&-1===jg.protocols.indexOf(l)?i(new Cf("Unsupported protocol "+l+":",Cf.ERR_BAD_REQUEST,e)):c.send(n||null)}))};const Vv={http:Fv,xhr:$v};Rf.forEach(Vv,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var Wv=e=>{e=Rf.isArray(e)?e:[e];const{length:t}=e;let i,n;for(let s=0;s<t&&(i=e[s],!(n=Rf.isString(i)?Vv[i.toLowerCase()]:i));s++);if(!n){if(!1===n)throw new Cf(`Adapter ${i} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(Rf.hasOwnProp(Vv,i)?`Adapter '${i}' is not available in the build`:`Unknown adapter '${i}'`)}if(!Rf.isFunction(n))throw new TypeError("adapter is not a function");return n};function Hv(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Wg(null,e)}function Gv(e){Hv(e),e.headers=qg.from(e.headers),e.data=$g.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Wv(e.adapter||Ag.adapter)(e).then((function(t){return Hv(e),t.data=$g.call(e,e.transformResponse,t),t.headers=qg.from(t.headers),t}),(function(t){return Vg(t)||(Hv(e),t&&t.response&&(t.response.data=$g.call(e,e.transformResponse,t.response),t.response.headers=qg.from(t.response.headers))),Promise.reject(t)}))}const Kv=e=>e instanceof qg?e.toJSON():e;function Jv(e,t){t=t||{};const i={};function n(e,t,i){return Rf.isPlainObject(e)&&Rf.isPlainObject(t)?Rf.merge.call({caseless:i},e,t):Rf.isPlainObject(t)?Rf.merge({},t):Rf.isArray(t)?t.slice():t}function s(e,t,i){return Rf.isUndefined(t)?Rf.isUndefined(e)?void 0:n(void 0,e,i):n(e,t,i)}function a(e,t){if(!Rf.isUndefined(t))return n(void 0,t)}function r(e,t){return Rf.isUndefined(t)?Rf.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function o(i,s,a){return a in t?n(i,s):a in e?n(void 0,i):void 0}const c={url:a,method:a,data:a,baseURL:r,transformRequest:r,transformResponse:r,paramsSerializer:r,timeout:r,timeoutMessage:r,withCredentials:r,adapter:r,responseType:r,xsrfCookieName:r,xsrfHeaderName:r,onUploadProgress:r,onDownloadProgress:r,decompress:r,maxContentLength:r,maxBodyLength:r,beforeRedirect:r,transport:r,httpAgent:r,httpsAgent:r,cancelToken:r,socketPath:r,responseEncoding:r,validateStatus:o,headers:(e,t)=>s(Kv(e),Kv(t),!0)};return Rf.forEach(Object.keys(e).concat(Object.keys(t)),(function(n){const a=c[n]||s,r=a(e[n],t[n],n);Rf.isUndefined(r)&&a!==o||(i[n]=r)})),i}const Qv={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Qv[e]=function(i){return typeof i===e||"a"+(t<1?"n ":" ")+e}}));const Yv={};Qv.transitional=function(e,t,i){function n(e,t){return"[Axios v1.2.3] Transitional option '"+e+"'"+t+(i?". "+i:"")}return(i,s,a)=>{if(!1===e)throw new Cf(n(s," has been removed"+(t?" in "+t:"")),Cf.ERR_DEPRECATED);return t&&!Yv[s]&&(Yv[s]=!0,console.warn(n(s," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(i,s,a)}};var Xv={assertOptions:function(e,t,i){if("object"!=typeof e)throw new Cf("options must be an object",Cf.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let s=n.length;for(;s-- >0;){const a=n[s],r=t[a];if(r){const t=e[a],i=void 0===t||r(t,a,e);if(!0!==i)throw new Cf("option "+a+" must be "+i,Cf.ERR_BAD_OPTION_VALUE)}else if(!0!==i)throw new Cf("Unknown option "+a,Cf.ERR_BAD_OPTION)}},validators:Qv};const Zv=Xv.validators;class eb{constructor(e){this.defaults=e,this.interceptors={request:new Dg,response:new Dg}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Jv(this.defaults,t);const{transitional:i,paramsSerializer:n,headers:s}=t;let a;void 0!==i&&Xv.assertOptions(i,{silentJSONParsing:Zv.transitional(Zv.boolean),forcedJSONParsing:Zv.transitional(Zv.boolean),clarifyTimeoutError:Zv.transitional(Zv.boolean)},!1),void 0!==n&&Xv.assertOptions(n,{encode:Zv.function,serialize:Zv.function},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase(),a=s&&Rf.merge(s.common,s[t.method]),a&&Rf.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete s[e]})),t.headers=qg.concat(a,s);const r=[];let o=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(o=o&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));const c=[];let p;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let d,l=0;if(!o){const e=[Gv.bind(this),void 0];for(e.unshift.apply(e,r),e.push.apply(e,c),d=e.length,p=Promise.resolve(t);l<d;)p=p.then(e[l++],e[l++]);return p}d=r.length;let u=t;for(l=0;l<d;){const e=r[l++],t=r[l++];try{u=e(u)}catch(e){t.call(this,e);break}}try{p=Gv.call(this,u)}catch(e){return Promise.reject(e)}for(l=0,d=c.length;l<d;)p=p.then(c[l++],c[l++]);return p}getUri(e){return Og(Gg((e=Jv(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}Rf.forEach(["delete","get","head","options"],(function(e){eb.prototype[e]=function(t,i){return this.request(Jv(i||{},{method:e,url:t,data:(i||{}).data}))}})),Rf.forEach(["post","put","patch"],(function(e){function t(t){return function(i,n,s){return this.request(Jv(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:i,data:n}))}}eb.prototype[e]=t(),eb.prototype[e+"Form"]=t(!0)}));class tb{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const i=this;this.promise.then((e=>{if(!i._listeners)return;let t=i._listeners.length;for(;t-- >0;)i._listeners[t](e);i._listeners=null})),this.promise.then=e=>{let t;const n=new Promise((e=>{i.subscribe(e),t=e})).then(e);return n.cancel=function(){i.unsubscribe(t)},n},e((function(e,n,s){i.reason||(i.reason=new Wg(e,n,s),t(i.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new tb((function(t){e=t})),cancel:e}}}const ib={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ib).forEach((([e,t])=>{ib[t]=e}));const nb=function e(t){const i=new eb(t),n=Kh(eb.prototype.request,i);return Rf.extend(n,eb.prototype,i,{allOwnKeys:!0}),Rf.extend(n,i,null,{allOwnKeys:!0}),n.create=function(i){return e(Jv(t,i))},n}(Ag);nb.Axios=eb,nb.CanceledError=Wg,nb.CancelToken=tb,nb.isCancel=Vg,nb.VERSION="1.2.3",nb.toFormData=Cg,nb.AxiosError=Cf,nb.Cancel=nb.CanceledError,nb.all=function(e){return Promise.all(e)},nb.spread=function(e){return function(t){return e.apply(null,t)}},nb.isAxiosError=function(e){return Rf.isObject(e)&&!0===e.isAxiosError},nb.mergeConfig=Jv,nb.AxiosHeaders=qg,nb.formToJSON=e=>Lg(Rf.isHTMLForm(e)?new FormData(e):e),nb.HttpStatusCode=ib,nb.default=nb;class sb{constructor(e={}){this.data=void 0===e.data?{}:e.data,this.headers=e.headers||{},this.status=e.status||200,this.statusText=e.statusText||"OK",this.url=e.url||null}}function ab(e,t){return u.ok(e,`${t} is required`),e}function rb(e,t){return u.ok("boolean"==typeof e,`${t}<boolean> is required`),e}function ob(e,t){return u.ok("number"==typeof e,`${t}<number> is required`),e}function cb(e,t){return u.ok("string"==typeof e,`${t}<string> is required`),e}function pb(e,t,i){const n=i||t.name[0].toLowerCase()+t.name.substring(1);return u.ok(e instanceof t,`${n}<${t.name}> is required`),e}function db(e,t="roomName"){return cb(e,t),u.equal("string"==typeof e&&e[0],"/",`${t} must begin with a '/'`),e}function lb(e,t){return u.ok(Array.isArray(e),`${t}<array> is required`),e}function ub(e,t){if(null==e||"object"!=typeof e||Array.isArray(e))throw new Error(`${t} must be a record. ${JSON.stringify(e)}`);return e}function mb(e,t,i){cb(t,"name"),function(e,t,i,n){cb(i,"name");const s=n||`${i} must be null or of type ${t}`;u.ok(null===e||typeof e===t,s)}(e,"string",t,i)}function hb({baseUrl:e,url:t}){return u.ok("string"==typeof t,"url<String> is required"),e?e+t:t}class fb{constructor({baseUrl:e}){cb(e,"baseUrl"),this._baseUrl=e}_requestAxios(e,t){const i=Object.assign({},t,{url:e,baseURL:this._baseUrl});return nb.request(i)}request(e,t){return cb(e,"url"),u.equal(e[0],"/",'url<String> only accepts relative URLs beginning with "/".'),u.ok(t,"options are required"),this._requestAxios(e,t).then((e=>{const{data:t,headers:i,status:n,statusText:s,config:a}=e,r=a&&a.url?hb({baseUrl:a.baseURL,url:a.url}):null;return new sb({data:t,headers:i,status:n,statusText:s,url:r})})).catch((e=>{const t=e.response;if(!t)throw new Error("Could not make the request.");const{data:i,headers:n,status:s,statusText:a,config:r}=t,o=r&&r.url?hb({baseUrl:r.baseURL,url:r.url}):null;return Promise.reject(new sb({data:i,headers:n,status:s,statusText:a,url:o}))}))}}class gb{constructor({httpClient:e}){u.ok(e,"httpClient is required"),this._httpClient=e}static dataToFormData(e){u.ok(e,"data is required");const t=new FormData;return Object.keys(e).forEach((i=>{const n=e[i];t.append(i,n)})),t}request(e,t={}){const i=Object.assign(t.headers||{},{"Content-Type":void 0});return this._httpClient.request(e,Object.assign(t,{headers:i,transformRequest:gb.dataToFormData}))}}let vb;vb="object"==typeof window?window.btoa||Gh:"object"==typeof global&&global.btoa||Gh;const bb=()=>Promise.resolve(null);class _b{constructor({httpClient:e,fetchDeviceCredentials:t}){this._httpClient=e,this._fetchDeviceCredentials=t}request(e,t){return this._fetchDeviceCredentials().then((i=>{const n=Object.assign({},t.headers,function(e){if(e&&e.credentials){const t=`${e.credentials.uuid}:${e.hmac}`;return{Authorization:`Basic ${vb(t)}`}}return{}}(i),{"X-Appearin-Device-Platform":"web"}),s=Object.assign({},t,{headers:n});return this._httpClient.request(e,s)}))}}class yb{constructor({baseUrl:e="https://api.appearin.net",fetchDeviceCredentials:t=bb}={}){cb(e,"baseUrl"),u.ok("function"==typeof t,"fetchDeviceCredentials<Function> is required"),this.authenticatedHttpClient=new _b({httpClient:new fb({baseUrl:e}),fetchDeviceCredentials:t}),this.authenticatedFormDataHttpClient=new gb({httpClient:this.authenticatedHttpClient})}request(e,t){return cb(e,"url"),u.equal(e[0],"/",'url<String> only accepts relative URLs beginning with "/".'),u.ok(t,"options are required"),this.authenticatedHttpClient.request(e,t)}requestMultipart(e,t){return cb(e,"url"),u.equal(e[0],"/",'url<String> only accepts relative URLs beginning with "/".'),u.ok(t,"options are required"),this.authenticatedFormDataHttpClient.request(e,t)}}function xb(e,t){return cb(ub(e,"data")[t],t)}const wb=(Sb=xb,(e,t)=>{const i=ub(e,"data")[t];return null==i?null:Sb(e,t)});var Sb;function Rb(e,t){const i=xb(e,t),n=new Date(i);if(isNaN(n.getTime()))throw new Error(`Invalid date for ${i}`);return n}function Cb(e,t,i){return function(e,t){return lb(ub(e,"data")[t],t)}(e,t).map((e=>i(e)))}class kb{constructor(e,t,i){this.credentials={uuid:e},this.hmac=t,this.userId=i}toJson(){return Object.assign({credentials:this.credentials,hmac:this.hmac},this.userId&&{userId:this.userId})}static fromJson(e){return new kb(xb(function(e,t){const i=ub(e,"data")[t];return void 0===i?null:i}(e,"credentials"),"uuid"),xb(e,"hmac"),wb(e,"userId")||void 0)}}class Tb{constructor({apiClient:e}){this._apiClient=pb(e,yb)}getCredentials(){return this._apiClient.request("/devices",{method:"post"}).then((({data:e})=>kb.fromJson(e))).catch((e=>{if(e.response&&404===e.response.status)return null;throw e}))}}class Pb{constructor(e,t){this._key=e,this._chromeStorage=t}loadOrDefault(e){return new Promise((t=>{this._chromeStorage.get(this._key,(i=>{t(i[this._key]||e)}))}))}save(e){return new Promise((t=>{this._chromeStorage.set({[this._key]:e},(()=>{t()}))}))}}class Eb{constructor(e,t){ab(t,"localStorage"),this._key=cb(e,"key"),this._localStorage=t}loadOrDefault(e){try{const t=this._localStorage.getItem(this._key);if(t)try{return Promise.resolve(JSON.parse(t))}catch(e){}return Promise.resolve(e)}catch(t){return console.warn("Error getting access to storage. Are cookies blocked?",t),Promise.resolve(e)}}save(e){try{return this._localStorage.setItem(this._key,JSON.stringify(e)),Promise.resolve()}catch(e){return console.warn("Error getting access to storage. Are cookies blocked?",e),Promise.reject(e)}}}let Ob;try{Ob=self.localStorage}catch(e){Ob={getItem:()=>{},key:()=>{},setItem:()=>{},removeItem:()=>{},hasOwnProperty:()=>{},length:0}}var Db=Ob;const Ib="credentials_saved";class jb extends d{constructor({deviceService:e,credentialsStore:t}){super(),this._deviceService=pb(e,Tb),this._credentialsStore=t}static create({baseUrl:e,storeName:t="CredentialsStorage",storeType:i="localStorage"}){const n=new Tb({apiClient:new yb({baseUrl:e})});let s=null;if("localStorage"===i)s=new Eb(t,Db);else{if("chromeStorage"!==i)throw new Error(`Unknown store type: ${i}`);s=new Pb(t,window.chrome.storage.local)}return new jb({deviceService:n,credentialsStore:s})}_fetchNewCredentialsFromApi(){const e=this._credentialsStore;return new Promise((t=>{const i=()=>{this._deviceService.getCredentials().then((i=>e.save(i?i.toJson():null).then((()=>t(i))))).catch((()=>{setTimeout(i,2e3)}))};i()}))}getCurrentCredentials(){return this._credentialsStore.loadOrDefault(null).then((e=>e?kb.fromJson(e):null))}getCredentials(){return this.credentialsPromise||(this.credentialsPromise=this.getCurrentCredentials().then((e=>e||this._fetchNewCredentialsFromApi()))),this.credentialsPromise}saveCredentials(e){return this.credentialsPromise=void 0,this._credentialsStore.save(e.toJson()).then((()=>(this.emit(Ib,e),e)))}setUserId(e){return this.getCurrentCredentials().then((t=>{t||console.error("Illegal state: no credentials to set user id for.");if(null===t||t.userId!==e)return this._credentialsStore.save(Object.assign({},null==t?void 0:t.toJson(),{userId:e}))})).then((()=>{}))}}const Lb=()=>Promise.resolve(void 0);class Mb{constructor({apiClient:e,fetchOrganization:t=Lb}){this._apiClient=pb(e,yb),u.ok("function"==typeof t,"fetchOrganization<Function> is required"),this._fetchOrganization=t,this._apiClient=e}_callRequestMethod(e,t,i){return cb(t,"url"),u.equal(t[0],"/",'url<String> only accepts relative URLs beginning with "/".'),u.ok(i,"options are required"),this._fetchOrganization().then((n=>{if(!n)return this._apiClient[e](t,i);const{organizationId:s}=n;return this._apiClient[e](`/organizations/${encodeURIComponent(s)}${t}`,i)}))}request(e,t){return this._callRequestMethod("request",e,t)}requestMultipart(e,t){return this._callRequestMethod("requestMultipart",e,t)}}class Ab{constructor({isExhausted:e,renewsAt:t,totalMinutesLimit:i,totalMinutesUsed:n}){this.isExhausted=e,this.renewsAt=t,this.totalMinutesLimit=i,this.totalMinutesUsed=n}static fromJson(e){return new Ab({isExhausted:rb(e.isExhausted,"isExhausted"),renewsAt:new Date(cb(e.renewsAt,"renewsAt")),totalMinutesLimit:ob(e.totalMinutesLimit,"totalMinutesLimit"),totalMinutesUsed:ob(e.totalMinutesUsed,"totalMinutesUsed")})}}class Nb{constructor({basePlanId:e,embeddedFreeTierStatus:t,isDeactivated:i,isOnTrial:n,onTrialUntil:s,trialStatus:a}){this.basePlanId=e,this.isDeactivated=i,this.isOnTrial=n,this.onTrialUntil=s||null,this.trialStatus=a||null,this.embeddedFreeTierStatus=t||null}static fromJson(e){return new Nb({basePlanId:"string"==typeof e.basePlanId?e.basePlanId:null,isDeactivated:rb(e.isDeactivated,"isDeactivated"),isOnTrial:rb(e.isOnTrial,"isOnTrial"),onTrialUntil:"string"==typeof e.onTrialUntil?new Date(e.onTrialUntil):null,trialStatus:"string"==typeof e.trialStatus?e.trialStatus:null,embeddedFreeTierStatus:e.embeddedFreeTierStatus?Ab.fromJson(e.embeddedFreeTierStatus):null})}}function Bb(e){return null!=e}function Fb(e={}){return{maxNumberOfInvitationsAndUsers:Bb(null==e?void 0:e.maxNumberOfInvitationsAndUsers)?Number(null==e?void 0:e.maxNumberOfInvitationsAndUsers):null,maxNumberOfClaimedRooms:Bb(null==e?void 0:e.maxNumberOfClaimedRooms)?Number(null==e?void 0:e.maxNumberOfClaimedRooms):null,maxRoomLimitPerOrganization:Bb(null==e?void 0:e.maxRoomLimitPerOrganization)?Number(null==e?void 0:e.maxRoomLimitPerOrganization):null,trialMinutesLimit:Bb(null==e?void 0:e.trialMinutesLimit)?Number(null==e?void 0:e.trialMinutesLimit):null,includedUnits:Bb(null==e?void 0:e.includedUnits)?Number(null==e?void 0:e.includedUnits):null}}class Ub{constructor(e){this.logoImageUrl=null,this.roomBackgroundImageUrl=null,this.roomBackgroundThumbnailUrl=null,this.roomKnockPageBackgroundImageUrl=null,this.roomKnockPageBackgroundThumbnailUrl=null,this.preferences=null,this.onboardingSurvey=null,this.type=null,pb(e,Object,"properties"),cb(e.organizationId,"organizationId"),cb(e.organizationName,"organizationName"),cb(e.subdomain,"subdomain"),pb(e.permissions,Object,"permissions"),pb(e.limits,Object,"limits"),this.organizationId=e.organizationId,this.organizationName=e.organizationName,this.subdomain=e.subdomain,this.permissions=e.permissions,this.limits=e.limits,this.account=e.account?new Nb(e.account):null,this.logoImageUrl=e.logoImageUrl,this.roomBackgroundImageUrl=e.roomBackgroundImageUrl,this.roomBackgroundThumbnailUrl=e.roomBackgroundThumbnailUrl,this.roomKnockPageBackgroundImageUrl=e.roomKnockPageBackgroundImageUrl,this.roomKnockPageBackgroundThumbnailUrl=e.roomKnockPageBackgroundThumbnailUrl,this.preferences=e.preferences,this.onboardingSurvey=e.onboardingSurvey,this.type=e.type}static fromJson(e){const t=pb(e,Object,"data"),i=(null==t?void 0:t.preferences)||{},n=(null==t?void 0:t.onboardingSurvey)||null,s=pb(t.permissions,Object,"permissions");return new Ub({organizationId:cb(t.organizationId,"organizationId"),organizationName:cb(t.organizationName,"organizationName"),subdomain:cb(t.subdomain,"subdomain"),permissions:s,limits:Fb(pb(t.limits,Object,"limits")),account:t.account?Nb.fromJson(t.account):null,logoImageUrl:"string"==typeof t.logoImageUrl?t.logoImageUrl:null,roomBackgroundImageUrl:"string"==typeof t.roomBackgroundImageUrl?t.roomBackgroundImageUrl:null,roomBackgroundThumbnailUrl:"string"==typeof t.roomBackgroundThumbnailUrl?t.roomBackgroundThumbnailUrl:null,roomKnockPageBackgroundImageUrl:"string"==typeof t.roomKnockPageBackgroundImageUrl?t.roomKnockPageBackgroundImageUrl:null,roomKnockPageBackgroundThumbnailUrl:"string"==typeof t.roomKnockPageBackgroundThumbnailUrl?t.roomKnockPageBackgroundThumbnailUrl:null,preferences:i,onboardingSurvey:n,type:"string"==typeof t.type?t.type:null})}}Ub.GLOBAL_ORGANIZATION_ID="1";class zb{constructor({apiClient:e}){this._apiClient=pb(e,yb)}createOrganization({organizationName:e,subdomain:t,owner:i}){const{displayName:n,consents:s}=i||{},a="email"in i?{value:i.email,verificationCode:cb(i.verificationCode,"owner.verificationCode")}:null,r="idToken"in i?i.idToken:null;if(cb(t,"subdomain"),cb(e,"organizationName"),cb(n,"owner.displayName"),u.ok(a||r,"owner.email or owner.idToken is required"),s){lb(s,"consents");for(const{consentRevisionId:e,action:t}of s)cb(e,"consentRevisionId"),mb(t,"action")}return this._apiClient.request("/organizations",{method:"POST",data:{organizationName:e,type:"private",subdomain:t,owner:Object.assign(Object.assign(Object.assign(Object.assign({},a&&{email:a}),r&&{idToken:r}),s&&{consents:s}),{displayName:n})}}).then((({data:e})=>xb(e,"organizationId")))}getOrganizationBySubdomain(e){return cb(e,"subdomain"),this._apiClient.request(`/organization-subdomains/${encodeURIComponent(e)}/?fields=permissions,account,onboardingSurvey`,{method:"GET"}).then((({data:e})=>Ub.fromJson(e))).catch((e=>{if(e instanceof sb){if(404===e.status)return null;throw new Error(e.statusText)}throw e}))}getOrganizationByOrganizationId(e){return cb(e,"organizationId"),this._apiClient.request(`/organizations/${encodeURIComponent(e)}?fields=permissions,account`,{method:"GET"}).then((({data:e})=>Ub.fromJson(e))).catch((e=>{if(e instanceof sb){if(404===e.status)return null;throw new Error(e.statusText)}throw e}))}getOrganizationsByContactPoint(e){const{code:t}=e,i="email"in e?e.email:null,n="phoneNumber"in e?e.phoneNumber:null;u.ok((i||n)&&!(i&&n),"either email or phoneNumber is required"),cb(t,"code");const s=i?{type:"email",value:i}:{type:"phoneNumber",value:n};return this._apiClient.request("/organization-queries",{method:"POST",data:{contactPoint:s,code:t}}).then((({data:e})=>Cb(e,"organizations",(e=>Ub.fromJson(e)))))}getOrganizationsByIdToken({idToken:e}){return cb(e,"idToken"),this._apiClient.request("/organization-queries",{method:"POST",data:{idToken:e}}).then((({data:e})=>Cb(e,"organizations",(e=>Ub.fromJson(Object.assign({permissions:{},limits:{}},ub(e,"organization")))))))}getOrganizationsByLoggedInUser(){return this._apiClient.request("/user/organizations",{method:"GET"}).then((({data:e})=>Cb(e,"organizations",(e=>Ub.fromJson(Object.assign({permissions:{},limits:{}},ub(e,"organization")))))))}getSubdomainAvailability(e){return cb(e,"subdomain"),this._apiClient.request(`/organization-subdomains/${encodeURIComponent(e)}/availability`,{method:"GET"}).then((({data:e})=>(pb(e,Object,"data"),{status:xb(e,"status")})))}updatePreferences({organizationId:e,preferences:t}){return ab(e,"organizationId"),ab(t,"preferences"),this._apiClient.request(`/organizations/${encodeURIComponent(e)}/preferences`,{method:"PATCH",data:t}).then((()=>{}))}deleteOrganization({organizationId:e}){return ab(e,"organizationId"),this._apiClient.request(`/organizations/${encodeURIComponent(e)}`,{method:"DELETE"}).then((()=>{}))}}class qb{constructor({organizationService:e,subdomain:t}){pb(e,zb),cb(t,"subdomain"),this._organizationService=e,this._subdomain=t,this._organizationPromise=null}initOrganization(){return this.fetchOrganization().then((()=>{}))}fetchOrganization(){return this._organizationPromise||(this._organizationPromise=this._organizationService.getOrganizationBySubdomain(this._subdomain)),this._organizationPromise}}class $b{constructor(e={}){u.ok(e instanceof Object,"properties<object> must be empty or an object"),this.isClaimed=!1,this.isBanned=!1,this.isLocked=!1,this.knockPage={backgroundImageUrl:null,backgroundThumbnailUrl:null},this.logoUrl=null,this.backgroundImageUrl=null,this.backgroundThumbnailUrl=null,this.type=null,this.legacyRoomType=null,this.mode=null,this.product=null,this.roomName=null,this.theme=null,this.preferences={},this.protectedPreferences={},this.publicProfile=null;const t={};Object.getOwnPropertyNames(e).forEach((i=>{-1!==Object.getOwnPropertyNames(this).indexOf(i)&&(t[i]=e[i])})),void 0!==e.ownerId&&(this.ownerId=e.ownerId),void 0!==e.meeting&&(this.meeting=e.meeting),Object.assign(this,t)}}class Vb{constructor({meetingId:e,roomName:t,roomUrl:i,startDate:n,endDate:s,hostRoomUrl:a,viewerRoomUrl:r}){cb(e,"meetingId"),cb(t,"roomName"),cb(i,"roomUrl"),pb(n,Date,"startDate"),pb(s,Date,"endDate"),this.meetingId=e,this.roomName=t,this.roomUrl=i,this.startDate=n,this.endDate=s,this.hostRoomUrl=a,this.viewerRoomUrl=r}static fromJson(e){return new Vb({meetingId:xb(e,"meetingId"),roomName:xb(e,"roomName"),roomUrl:xb(e,"roomUrl"),startDate:Rb(e,"startDate"),endDate:Rb(e,"endDate"),hostRoomUrl:wb(e,"hostRoomUrl"),viewerRoomUrl:wb(e,"viewerRoomUrl")})}}function Wb(e,t=""){return`/room/${encodeURIComponent(e.substring(1))}${t}`}class Hb{constructor({organizationApiClient:e}){this._organizationApiClient=pb(e,Mb)}getRooms({types:e,fields:t=[]}={}){return lb(e,"types"),lb(t,"fields"),this._organizationApiClient.request("/room",{method:"GET",params:{types:e.join(","),fields:t.join(","),includeOnlyLegacyRoomType:"false"}}).then((({data:e})=>e.rooms.map((e=>new $b(e)))))}getRoom({roomName:e,fields:t}){db(e);const i=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/rooms/${i}`,{method:"GET",params:Object.assign({includeOnlyLegacyRoomType:"false"},t&&{fields:t.join(",")})}).then((({data:t})=>new $b(Object.assign({},t,Object.assign({roomName:e},t.meeting&&{meeting:Vb.fromJson(t.meeting)}))))).catch((t=>{if(404===t.status)return new $b({roomName:e,isClaimed:!1,mode:"normal",product:{categoryName:"personal_free"},type:"personal",legacyRoomType:"free"});if(400===t.status&&"Banned room"===t.data.error)return new $b({roomName:e,isBanned:!0});throw new Error(t.data?t.data.error:"Could not fetch room information")}))}claimRoom({roomName:e,type:t,mode:i,isLocked:n}){return db(e),cb(t,"type"),this._organizationApiClient.request("/room/claim",{method:"POST",data:Object.assign(Object.assign({roomName:e,type:t},"string"==typeof i&&{mode:i}),"boolean"==typeof n&&{isLocked:n})}).then((()=>{})).catch((e=>{throw new Error(e.data.error||"Failed to claim room")}))}unclaimRoom(e){db(e);const t=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${t}`,{method:"DELETE"}).then((()=>{}))}renameRoom({roomName:e,newRoomName:t}){db(e),cb(t,"newRoomName");const i=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${i}/roomName`,{method:"PUT",data:{newRoomName:t}}).then((()=>{}))}changeMode({roomName:e,mode:t}){db(e),cb(t,"mode");const i=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${i}/mode`,{method:"PUT",data:{mode:t}}).then((()=>{}))}updatePreferences({roomName:e,preferences:t}){db(e),pb(t,Object,"preferences");const i=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${i}/preferences`,{method:"PATCH",data:t}).then((()=>{}))}updateProtectedPreferences({roomName:e,preferences:t}){db(e),pb(t,Object,"preferences");const i=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${i}/protected-preferences`,{method:"PATCH",data:t}).then((()=>{}))}getRoomPermissions(e,{roomKey:t}={}){return db(e),this._organizationApiClient.request(Wb(e,"/permissions"),Object.assign({method:"GET"},t&&{headers:{"X-Whereby-Room-Key":t}})).then((e=>{const{permissions:t,limits:i}=e.data;return{permissions:t,limits:i}}))}getRoomMetrics({roomName:e,metrics:t,from:i,to:n}){return db(e),cb(t,"metrics"),this._organizationApiClient.request(Wb(e,"/metrics"),{method:"GET",params:{metrics:t,from:i,to:n}}).then((e=>e.data))}changeType({roomName:e,type:t}){db(e),function(e,t,i){if(ab(e,"value"),lb(t,"allowedValues"),!t.includes(e))throw new Error(`${i}<string> must be one of the following: ${t.join(", ")}`)}(t,["personal","personal_xl"],"type");const i=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${i}/type`,{method:"PUT",data:{type:t}}).then((()=>{}))}getForestSocialImage({roomName:e,count:t}){return db(e),ob(t,"count"),this._organizationApiClient.request(Wb(e,`/forest-social-image/${t}`),{method:"GET"}).then((e=>e.data.imageUrl))}}class Gb{constructor({displayName:e,id:t,stream:i,isAudioEnabled:n,isVideoEnabled:s}){this.isLocalParticipant=!1,this.displayName=e,this.id=t,this.stream=i,this.isAudioEnabled=n,this.isVideoEnabled=s}}class Kb extends Gb{constructor({displayName:e,id:t,newJoiner:i,streams:n,isAudioEnabled:s,isVideoEnabled:a}){super({displayName:e,id:t,isAudioEnabled:s,isVideoEnabled:a}),this.newJoiner=i,this.streams=n.map((e=>({id:e,state:i?"new_accept":"to_accept"})))}updateStreamState(e,t){const i=this.streams.find((t=>t.id===e));i&&(i.state=t)}}class Jb extends Gb{constructor({displayName:e,id:t,stream:i,isAudioEnabled:n,isVideoEnabled:s}){super({displayName:e,id:t,stream:i,isAudioEnabled:n,isVideoEnabled:s}),this.isLocalParticipant=!0}}const Qb=["recorder","streamer"];const Yb=()=>{},Xb=EventTarget;class Zb extends Xb{constructor(e,{displayName:t,localMedia:i,localMediaConstraints:n,logger:s,roomKey:a}){super(),this.localParticipant=null,this.remoteParticipants=[],this._ownsLocalMedia=!1,this.organizationId="",this.roomConnectionStatus="",this.roomUrl=new URL(e);const r=new URLSearchParams(this.roomUrl.search);this._roomKey=a||r.get("roomKey"),this.roomName=this.roomUrl.pathname,this.logger=s||{debug:Yb,error:Yb,log:Yb,warn:Yb},this.displayName=t,this.localMediaConstraints=n;const o=Hh({host:this.roomUrl.host});if(i)this.localMedia=i;else{if(!n)throw new Error("Missing constraints");this.localMedia=new fi(n),this._ownsLocalMedia=!0}this.credentialsService=jb.create({baseUrl:"https://api.whereby.dev"}),this.apiClient=new yb({fetchDeviceCredentials:this.credentialsService.getCredentials.bind(this.credentialsService),baseUrl:"https://api.whereby.dev"}),this.organizationService=new zb({apiClient:this.apiClient}),this.organizationServiceCache=new qb({organizationService:this.organizationService,subdomain:o.subdomain}),this.organizationApiClient=new Mb({apiClient:this.apiClient,fetchOrganization:()=>Zt(this,void 0,void 0,(function*(){return(yield this.organizationServiceCache.fetchOrganization())||void 0}))}),this.roomService=new Hb({organizationApiClient:this.organizationApiClient}),this.signalSocket=function(){const e=new URL("wss://signal.appearin.net"),t=`${e.pathname.replace(/^\/$/,"")}/protocol/socket.io/v4`,i=e.origin;return new po(i,{host:i,path:t,reconnectionDelay:5e3,reconnectionDelayMax:3e4,timeout:1e4,withCredentials:!0})}(),this.signalSocket.on("new_client",this._handleNewClient.bind(this)),this.signalSocket.on("chat_message",this._handleNewChatMessage.bind(this)),this.signalSocket.on("client_left",this._handleClientLeft.bind(this)),this.signalSocket.on("audio_enabled",this._handleClientAudioEnabled.bind(this)),this.signalSocket.on("video_enabled",this._handleClientVideoEnabled.bind(this)),this.signalSocket.on("client_metadata_received",this._handleClientMetadataReceived.bind(this)),this.signalSocket.on("knock_handled",this._handleKnockHandled.bind(this)),this.signalSocket.on("knocker_left",this._handleKnockerLeft.bind(this)),this.signalSocket.on("room_joined",this._handleRoomJoined.bind(this)),this.signalSocket.on("room_knocked",this._handleRoomKnocked.bind(this)),this.localMedia.addEventListener("camera_enabled",(e=>{const{enabled:t}=e.detail;this.signalSocket.emit("enable_video",{enabled:t})})),this.localMedia.addEventListener("microphone_enabled",(e=>{const{enabled:t}=e.detail;this.signalSocket.emit("enable_audio",{enabled:t})}))}get roomKey(){return this._roomKey}_handleNewChatMessage(e){this.dispatchEvent(new CustomEvent("chat_message",{detail:e}))}_handleNewClient({client:e}){if(Qb.includes(e.role.roleName))return;const t=new Kb(Object.assign(Object.assign({},e),{newJoiner:!0}));this.remoteParticipants=[...this.remoteParticipants,t],this._handleAcceptStreams([t]),this.dispatchEvent(new CustomEvent("participant_joined",{detail:{remoteParticipant:t}}))}_handleClientLeft({clientId:e}){const t=this.remoteParticipants.find((t=>t.id===e));this.remoteParticipants=this.remoteParticipants.filter((t=>t.id!==e)),t&&this.dispatchEvent(new CustomEvent("participant_left",{detail:{participantId:t.id}}))}_handleClientAudioEnabled({clientId:e,isAudioEnabled:t}){const i=this.remoteParticipants.find((t=>t.id===e));i&&this.dispatchEvent(new CustomEvent("participant_audio_enabled",{detail:{participantId:i.id,isAudioEnabled:t}}))}_handleClientVideoEnabled({clientId:e,isVideoEnabled:t}){const i=this.remoteParticipants.find((t=>t.id===e));i&&this.dispatchEvent(new CustomEvent("participant_video_enabled",{detail:{participantId:i.id,isVideoEnabled:t}}))}_handleClientMetadataReceived({payload:{clientId:e,displayName:t}}){const i=this.remoteParticipants.find((t=>t.id===e));i&&this.dispatchEvent(new CustomEvent("participant_metadata_changed",{detail:{participantId:i.id,displayName:t}}))}_handleKnockHandled(e){const{resolution:t}=e;"accepted"===t?(this.roomConnectionStatus="accepted",this._roomKey=e.metadata.roomKey,this._joinRoom()):"rejected"===t&&(this.roomConnectionStatus="rejected",this.dispatchEvent(new CustomEvent("room_connection_status_changed",{detail:{roomConnectionStatus:this.roomConnectionStatus}})))}_handleKnockerLeft(e){const{clientId:t}=e;this.dispatchEvent(new CustomEvent("waiting_participant_left",{detail:{participantId:t}}))}_handleRoomJoined(e){const{error:t,isLocked:i,room:n,selfId:s}=e;if("room_locked"===t&&i)return this.roomConnectionStatus="room_locked",void this.dispatchEvent(new CustomEvent("room_connection_status_changed",{detail:{roomConnectionStatus:this.roomConnectionStatus}}));if(n){const{clients:e,knockers:t}=n,i=e.find((e=>e.id===s));if(!i)throw new Error("Missing local client");this.localParticipant=new Jb(Object.assign(Object.assign({},i),{stream:this.localMedia.stream||void 0})),this.remoteParticipants=e.filter((e=>e.id!==s)).map((e=>new Kb(Object.assign(Object.assign({},e),{newJoiner:!1})))),this.roomConnectionStatus="connected",this.dispatchEvent(new CustomEvent("room_joined",{detail:{localParticipant:this.localParticipant,remoteParticipants:this.remoteParticipants,waitingParticipants:t.map((e=>({id:e.clientId,displayName:e.displayName})))}}))}}_handleRoomKnocked(e){const{clientId:t,displayName:i}=e;this.dispatchEvent(new CustomEvent("waiting_participant_joined",{detail:{participantId:t,displayName:i}}))}_handleRtcEvent(e,t){return"rtc_manager_created"===e?this._handleRtcManagerCreated(t):"stream_added"===e?this._handleStreamAdded(t):void this.logger.log(`Unhandled RTC event ${e}`)}_handleRtcManagerCreated({rtcManager:e}){var t;this.rtcManager=e,this.localMedia.addRtcManager(e),this.localMedia.stream&&(null===(t=this.rtcManager)||void 0===t||t.addNewStream("0",this.localMedia.stream,!this.localMedia.isMicrophoneEnabled(),!this.localMedia.isCameraEnabled())),this.remoteParticipants.length&&this._handleAcceptStreams(this.remoteParticipants)}_handleAcceptStreams(e){var t,i;if(!this.rtcManager)return void this.logger.log("Unable to accept streams, no rtc manager");const n=null===(i=(t=this.rtcManager).shouldAcceptStreamsFromBothSides)||void 0===i?void 0:i.call(t);e.forEach((e=>{const{id:t,streams:i,newJoiner:s}=e;i.forEach((i=>{var a,r;const{id:o,state:c}=i;let p;if("done_accept"!==c&&(p=(s&&"0"===o?"new":"to")+"_accept"),p){if("to_accept"===p||"new_accept"===p&&n||"old_accept"===p&&!n)this.logger.log(`Accepting stream ${o} from ${t}`),null===(a=this.rtcManager)||void 0===a||a.acceptNewStream({streamId:"0"===o?t:o,clientId:t,shouldAddLocalVideo:"0"===o,activeBreakout:false});else if("new_accept"===p||"old_accept"===p);else if("to_unaccept"===p)this.logger.log(`Disconnecting stream ${o} from ${t}`),null===(r=this.rtcManager)||void 0===r||r.disconnect("0"===o?t:o,false);else if("done_accept"!==p)return void this.logger.warn(`Stream state not handled: ${p} for ${t}-${o}`);e.updateStreamState(o,c.replace(/to_|new_|old_/,"done_"))}}))}))}_handleStreamAdded({clientId:e,stream:t,streamId:i}){this.remoteParticipants.find((t=>t.id===e))?this.dispatchEvent(new CustomEvent("participant_stream_added",{detail:{participantId:e,stream:t,streamId:i}})):this.logger.log("WARN: Could not find participant for incoming stream")}_joinRoom(){this.signalSocket.emit("join_room",{avatarUrl:null,config:{isAudioEnabled:this.localMedia.isMicrophoneEnabled(),isVideoEnabled:this.localMedia.isCameraEnabled()},deviceCapabilities:{canScreenshare:!0},displayName:this.displayName,isCoLocated:!1,isDevicePermissionDenied:!1,kickFromOtherRooms:!1,organizationId:this.organizationId,roomKey:this.roomKey,roomName:this.roomName,selfId:"",userAgent:`browser-sdk:${s_}`})}join(){return Zt(this,void 0,void 0,(function*(){if(["connected","connecting"].includes(this.roomConnectionStatus))return void console.warn(`Trying to join when room state is already ${this.roomConnectionStatus}`);this.logger.log("Joining room"),this.roomConnectionStatus="connecting",this.dispatchEvent(new CustomEvent("room_connection_status_changed",{detail:{roomConnectionStatus:this.roomConnectionStatus}}));const e=yield this.organizationServiceCache.fetchOrganization();if(!e)throw new Error("Invalid room url");this.organizationId=e.organizationId,this._ownsLocalMedia&&(yield this.localMedia.start());const t={getMediaConstraints:()=>({audio:this.localMedia.isMicrophoneEnabled(),video:this.localMedia.isCameraEnabled()}),deferrable:e=>!e};this.rtcManagerDispatcher=new Vh({emitter:{emit:this._handleRtcEvent.bind(this)},serverSocket:this.signalSocket,webrtcProvider:t,features:{lowDataModeEnabled:!1,sfuServerOverrideHost:void 0,turnServerOverrideHost:void 0,useOnlyTURN:void 0,vp9On:!1,h264On:!1,simulcastScreenshareOn:!1}});const i=yield this.credentialsService.getCredentials();this.logger.log("Connected to signal socket"),this.signalSocket.emit("identify_device",{deviceCredentials:i}),this.signalSocket.once("device_identified",(()=>{this._joinRoom()}))}))}knock(){this.roomConnectionStatus="knocking",this.dispatchEvent(new CustomEvent("room_connection_status_changed",{detail:{roomConnectionStatus:this.roomConnectionStatus}})),this.signalSocket.emit("knock_room",{displayName:this.displayName,imageUrl:null,kickFromOtherRooms:!0,liveVideo:!1,organizationId:this.organizationId,roomKey:this._roomKey,roomName:this.roomName})}leave(){return new Promise((e=>{if(this._ownsLocalMedia&&this.localMedia.stop(),this.rtcManager&&(this.localMedia.removeRtcManager(this.rtcManager),this.rtcManager.disconnectAll(),this.rtcManager=void 0),!this.signalSocket)return e();this.signalSocket.emit("leave_room");const t=setTimeout((()=>{e()}),200);this.signalSocket.once("room_left",(()=>{clearTimeout(t),this.signalSocket.disconnect(),e()}))}))}sendChatMessage(e){this.signalSocket.emit("chat_message",{text:e})}setDisplayName(e){this.signalSocket.emit("send_client_metadata",{type:"UserData",payload:{displayName:e}})}acceptWaitingParticipant(e){this.signalSocket.emit("handle_knock",{action:"accept",clientId:e,response:{}})}rejectWaitingParticipant(e){this.signalSocket.emit("handle_knock",{action:"reject",clientId:e,response:{}})}}const e_={chatMessages:[],roomConnectionStatus:"",isJoining:!1,joinError:null,mostRecentChatMessage:null,remoteParticipants:[],waitingParticipants:[]};function t_(e,t,i){const n=e.find((e=>e.id===t));if(!n)return e;const s=e.indexOf(n);return[...e.slice(0,s),Object.assign(Object.assign({},n),i),...e.slice(s+1)]}function i_(e,t){switch(t.type){case"CHAT_MESSAGE":return Object.assign(Object.assign({},e),{chatMessages:[...e.chatMessages,t.payload],mostRecentChatMessage:t.payload});case"ROOM_JOINED":return Object.assign(Object.assign({},e),{localParticipant:t.payload.localParticipant,remoteParticipants:t.payload.remoteParticipants,waitingParticipants:t.payload.waitingParticipants,roomConnectionStatus:"connected"});case"ROOM_CONNECTION_STATUS_CHANGED":return Object.assign(Object.assign({},e),{roomConnectionStatus:t.payload.roomConnectionStatus});case"PARTICIPANT_AUDIO_ENABLED":return Object.assign(Object.assign({},e),{remoteParticipants:t_(e.remoteParticipants,t.payload.participantId,{isAudioEnabled:t.payload.isAudioEnabled})});case"PARTICIPANT_JOINED":return Object.assign(Object.assign({},e),{remoteParticipants:[...e.remoteParticipants,t.payload.paritipant]});case"PARTICIPANT_LEFT":return Object.assign(Object.assign({},e),{remoteParticipants:[...e.remoteParticipants.filter((e=>e.id!==t.payload.participantId))]});case"PARTICIPANT_STREAM_ADDED":return Object.assign(Object.assign({},e),{remoteParticipants:t_(e.remoteParticipants,t.payload.participantId,{stream:t.payload.stream})});case"PARTICIPANT_VIDEO_ENABLED":return Object.assign(Object.assign({},e),{remoteParticipants:t_(e.remoteParticipants,t.payload.participantId,{isVideoEnabled:t.payload.isVideoEnabled})});case"PARTICIPANT_METADATA_CHANGED":return Object.assign(Object.assign({},e),{remoteParticipants:[...e.remoteParticipants.map((e=>e.id===t.payload.participantId?Object.assign(Object.assign({},e),{displayName:t.payload.displayName}):e))]});case"LOCAL_CLIENT_DISPLAY_NAME_CHANGED":return e.localParticipant?Object.assign(Object.assign({},e),{localParticipant:Object.assign(Object.assign({},e.localParticipant),{displayName:t.payload.displayName})}):e;case"WAITING_PARTICIPANT_JOINED":return Object.assign(Object.assign({},e),{waitingParticipants:[...e.waitingParticipants,{id:t.payload.participantId,displayName:t.payload.displayName}]});case"WAITING_PARTICIPANT_LEFT":return Object.assign(Object.assign({},e),{waitingParticipants:e.waitingParticipants.filter((e=>e.id!==t.payload.participantId))});default:throw e}}function n_(e,t){const[i]=si.useState((()=>{var i;return new Zb(e,Object.assign(Object.assign({},t),{localMedia:(null===(i=null==t?void 0:t.localMedia)||void 0===i?void 0:i._ref)||void 0}))})),[n,s]=si.useReducer(i_,e_);return si.useEffect((()=>(i.addEventListener("chat_message",(e=>{const t=e.detail;s({type:"CHAT_MESSAGE",payload:t})})),i.addEventListener("participant_audio_enabled",(e=>{const{participantId:t,isAudioEnabled:i}=e.detail;s({type:"PARTICIPANT_AUDIO_ENABLED",payload:{participantId:t,isAudioEnabled:i}})})),i.addEventListener("participant_joined",(e=>{const{remoteParticipant:t}=e.detail;s({type:"PARTICIPANT_JOINED",payload:{paritipant:t}})})),i.addEventListener("participant_left",(e=>{const{participantId:t}=e.detail;s({type:"PARTICIPANT_LEFT",payload:{participantId:t}})})),i.addEventListener("participant_stream_added",(e=>{const{participantId:t,stream:i}=e.detail;s({type:"PARTICIPANT_STREAM_ADDED",payload:{participantId:t,stream:i}})})),i.addEventListener("room_connection_status_changed",(e=>{const{roomConnectionStatus:t}=e.detail;s({type:"ROOM_CONNECTION_STATUS_CHANGED",payload:{roomConnectionStatus:t}})})),i.addEventListener("room_joined",(e=>{const{localParticipant:t,remoteParticipants:i,waitingParticipants:n}=e.detail;s({type:"ROOM_JOINED",payload:{localParticipant:t,remoteParticipants:i,waitingParticipants:n}})})),i.addEventListener("participant_video_enabled",(e=>{const{participantId:t,isVideoEnabled:i}=e.detail;s({type:"PARTICIPANT_VIDEO_ENABLED",payload:{participantId:t,isVideoEnabled:i}})})),i.addEventListener("participant_metadata_changed",(e=>{const{participantId:t,displayName:i}=e.detail;s({type:"PARTICIPANT_METADATA_CHANGED",payload:{participantId:t,displayName:i}})})),i.addEventListener("waiting_participant_joined",(e=>{const{participantId:t,displayName:i}=e.detail;s({type:"WAITING_PARTICIPANT_JOINED",payload:{participantId:t,displayName:i}})})),i.addEventListener("waiting_participant_left",(e=>{const{participantId:t}=e.detail;s({type:"WAITING_PARTICIPANT_LEFT",payload:{participantId:t}})})),i.join(),()=>{i.leave()})),[]),{state:n,actions:{knock:()=>{i.knock()},sendChatMessage:e=>{i.sendChatMessage(e)},setDisplayName:e=>{i.setDisplayName(e),s({type:"LOCAL_CLIENT_DISPLAY_NAME_CHANGED",payload:{displayName:e}})},toggleCamera:e=>{i.localMedia.toggleCameraEnabled(e)},toggleMicrophone:e=>{i.localMedia.toggleMichrophoneEnabled(e)},acceptWaitingParticipant:e=>{i.acceptWaitingParticipant(e)},rejectWaitingParticipant:e=>{i.rejectWaitingParticipant(e)}},components:{VideoView:mi},_ref:i}}const s_="2.0.0-alpha9";export{mi as VideoView,s_ as sdkVersion,bi as useLocalMedia,n_ as useRoomConnection};