@whereby.com/browser-sdk 2.0.0-alpha14 → 2.0.0-alpha16
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.
- package/README.md +20 -0
- package/dist/lib.cjs +197 -7
- package/dist/lib.esm.js +197 -7
- package/dist/types.d.ts +48 -2
- package/dist/{v2-alpha14.js → v2-alpha16.js} +3 -3
- package/package.json +2 -2
|
@@ -7,7 +7,7 @@ function D(e){return e.join(P).replace(B,q).replace(N,U)}var I=" \\f\\n\\r\\t",j
|
|
|
7
7
|
/*! (c) Andrea Giammarchi - ISC */
|
|
8
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=G(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
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)],H,e));break;case"function":a(r(e));break;case"object":case"undefined":if(null==r){s=!1,t=Q(e.parentNode,t,[],H,e);break}default:if(s=!1,n=r,$(r))if(0===r.length)t.length&&(t=Q(e.parentNode,t,[],H,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,H,e)}else"ELEMENT_NODE"in r?t=Q(e.parentNode,t,11===r.nodeType?W.call(r.childNodes):[r],H,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),H,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=G(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=G(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=G(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=G(Ve),Ge=()=>{},He=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():Ge,o={clean:null,update:n,values:i,stop:Ge};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=He(!0),Qe=He(!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 Gt=new _;new _;const Ht=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?Gt.get(t)||((e,t)=>{const{statics:i,prototype:n}=Ht(e),s=et(Vt[t]||(Vt[t]=document.createElement(t).constructor),!1);return Ft(s.prototype,n),Ft(s,i),Gt.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=[]){this.iframe.current&&this.iframe.current.contentWindow.postMessage({command:e,args:t},this.url.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!==this.url.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|-ip-\d+-\d+-\d+-\d+.hereby.dev:4443)\/.+/.exec(a),p=c&&c[1]||this.subdomain;if(!p)return this.html`Whereby: Missing subdomain attr.`;if(!c)return this.html`could not parse URL.`;const d=c[2]||".whereby.com";this.url=new URL(a,`https://${p}${d}`);const l=new URL(a);return l.searchParams.get("roomKey")&&this.url.searchParams.append("roomKey",l.searchParams.get("roomKey")),Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({jsApi:!0,we:"2.0.0-alpha14",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])=>{this.url.searchParams.has(e)||"string"!=typeof t||this.url.searchParams.set(e,t)})),this.html`
|
|
10
|
+
/*! (c) Andrea Giammarchi - ISC */let Ae=null;const Ne=G(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=G(Ve),Ge=()=>{},He=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():Ge,o={clean:null,update:n,values:i,stop:Ge};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=He(!0),Qe=He(!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 Gt=new _;new _;const Ht=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?Gt.get(t)||((e,t)=>{const{statics:i,prototype:n}=Ht(e),s=et(Vt[t]||(Vt[t]=document.createElement(t).constructor),!1);return Ft(s.prototype,n),Ft(s,i),Gt.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=[]){this.iframe.current&&this.iframe.current.contentWindow.postMessage({command:e,args:t},this.url.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!==this.url.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|-ip-\d+-\d+-\d+-\d+.hereby.dev:4443)\/.+/.exec(a),p=c&&c[1]||this.subdomain;if(!p)return this.html`Whereby: Missing subdomain attr.`;if(!c)return this.html`could not parse URL.`;const d=c[2]||".whereby.com";this.url=new URL(a,`https://${p}${d}`);const l=new URL(a);return l.searchParams.get("roomKey")&&this.url.searchParams.append("roomKey",l.searchParams.get("roomKey")),Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({jsApi:!0,we:"2.0.0-alpha16",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])=>{this.url.searchParams.has(e)||"string"!=typeof t||this.url.searchParams.set(e,t)})),this.html`
|
|
11
11
|
<iframe
|
|
12
12
|
ref=${this.iframe}
|
|
13
13
|
src=${this.url}
|
|
@@ -33,11 +33,11 @@ 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={
|
|
|
33
33
|
* MIT License | (c) Denis Demchenko 2015-2019
|
|
34
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 Gc extends Error{constructor(e){super(null!=e?e:"AwaitQueue stopped"),this.name="AwaitQueueStoppedError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,Gc)}}Uc.AwaitQueueStoppedError=Gc;class Hc extends Error{constructor(e){super(null!=e?e:"AwaitQueue task removed"),this.name="AwaitQueueRemovedTaskError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,Hc)}}Uc.AwaitQueueRemovedTaskError=Hc;
|
|
35
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 Gc);this.stopping=!1}remove(e){Wc.debug(`remove() [taskIdx:${e}]`);const t=Array.from(this.pendingTasks.values())[e];t?t.reject(new Hc):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 Gp={},Hp=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)&&Hp(t,e,i);return Kp(t,e),t};Object.defineProperty(Gp,"__esModule",{value:!0}),Gp.applyCodecParameters=Gp.getCname=Gp.extractDtlsParameters=Gp.extractRtpCapabilities=void 0;const Qp=Jp(Lp);Gp.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}},Gp.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}]}},Gp.getCname=function({offerMediaObject:e}){const t=(e.ssrcs||[]).find((e=>"cname"===e.attribute));return t?t.value:""},Gp.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(Gp),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(Gp),Vd=Bd(Yp),Wd=Bd(Xp),Gd=Zp,Hd=id,Kd=vd,Jd=new Ud.Logger("Chrome74"),Qd={OS:1024,MIS:1024};class Yd extends Gd.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 Hd.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(Gp),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(Gp),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(Gp),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 Gl={},Hl=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)&&Hl(t,e,i);return Kl(t,e),t};Object.defineProperty(Gl,"__esModule",{value:!0}),Gl.Firefox60=void 0;const Ql=Jl(Lp),Yl=oc,Xl=fc,Zl=Jl(bc),eu=Jl(_c),tu=Jl(Gp),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')}}Gl.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(Gp),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(Gp),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 Gu=Wu(bc);qu.getCapabilities=function(){const e=RTCRtpReceiver.getCapabilities(),t=Gu.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=Gu.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 Hu=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)&&Hu(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(Gp),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(Gp),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(Ho,"__esModule",{value:!0}),Ho.Device=Ho.detectDevice=void 0;const zm=Um(rc),qm=oc,$m=lc,Vm=fc,Wm=Fm(bc),Gm=Fm(_c),Hm=Fc,Km=jp,Jm=Md,Qm=Xd,Ym=hl,Xm=Ol,Zm=Gl,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())}}Ho.detectDevice=rh;Ho.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");Gm.validateRtpCapabilities(e),t=this._handlerFactory();const i=await t.getNativeRtpCapabilities();ah.debug("load() | got native RTP capabilities:%o",i),Gm.validateRtpCapabilities(i),this._extendedRtpCapabilities=Gm.getExtendedRtpCapabilities(i,e),ah.debug("load() | got extended RTP capabilities:%o",this._extendedRtpCapabilities),this._canProduceByKind.audio=Gm.canSend("audio",this._extendedRtpCapabilities),this._canProduceByKind.video=Gm.canSend("video",this._extendedRtpCapabilities),this._recvRtpCapabilities=Gm.getRecvRtpCapabilities(this._extendedRtpCapabilities),Gm.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),Gm.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 Hm.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(Ho,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=Ho;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 Gh({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}}Gh(window&&window.location);var Hh={};function Kh(e,t){return function(){return e.apply(t,arguments)}}({get exports(){return Hh},set exports(e){Hh=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,
|
|
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 Gc);this.stopping=!1}remove(e){Wc.debug(`remove() [taskIdx:${e}]`);const t=Array.from(this.pendingTasks.values())[e];t?t.reject(new Hc):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 Gp={},Hp=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)&&Hp(t,e,i);return Kp(t,e),t};Object.defineProperty(Gp,"__esModule",{value:!0}),Gp.applyCodecParameters=Gp.getCname=Gp.extractDtlsParameters=Gp.extractRtpCapabilities=void 0;const Qp=Jp(Lp);Gp.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}},Gp.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}]}},Gp.getCname=function({offerMediaObject:e}){const t=(e.ssrcs||[]).find((e=>"cname"===e.attribute));return t?t.value:""},Gp.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(Gp),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(Gp),Vd=Bd(Yp),Wd=Bd(Xp),Gd=Zp,Hd=id,Kd=vd,Jd=new Ud.Logger("Chrome74"),Qd={OS:1024,MIS:1024};class Yd extends Gd.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 Hd.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(Gp),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(Gp),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(Gp),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 Gl={},Hl=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)&&Hl(t,e,i);return Kl(t,e),t};Object.defineProperty(Gl,"__esModule",{value:!0}),Gl.Firefox60=void 0;const Ql=Jl(Lp),Yl=oc,Xl=fc,Zl=Jl(bc),eu=Jl(_c),tu=Jl(Gp),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')}}Gl.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(Gp),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(Gp),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 Gu=Wu(bc);qu.getCapabilities=function(){const e=RTCRtpReceiver.getCapabilities(),t=Gu.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=Gu.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 Hu=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)&&Hu(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(Gp),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(Gp),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(Ho,"__esModule",{value:!0}),Ho.Device=Ho.detectDevice=void 0;const zm=Um(rc),qm=oc,$m=lc,Vm=fc,Wm=Fm(bc),Gm=Fm(_c),Hm=Fc,Km=jp,Jm=Md,Qm=Xd,Ym=hl,Xm=Ol,Zm=Gl,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())}}Ho.detectDevice=rh;Ho.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");Gm.validateRtpCapabilities(e),t=this._handlerFactory();const i=await t.getNativeRtpCapabilities();ah.debug("load() | got native RTP capabilities:%o",i),Gm.validateRtpCapabilities(i),this._extendedRtpCapabilities=Gm.getExtendedRtpCapabilities(i,e),ah.debug("load() | got extended RTP capabilities:%o",this._extendedRtpCapabilities),this._canProduceByKind.audio=Gm.canSend("audio",this._extendedRtpCapabilities),this._canProduceByKind.video=Gm.canSend("video",this._extendedRtpCapabilities),this._recvRtpCapabilities=Gm.getRecvRtpCapabilities(this._extendedRtpCapabilities),Gm.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),Gm.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 Hm.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(Ho,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=Ho;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,streamType:"webcam"}),t.hasEmittedWebcamStream=!0),n&&!a&&o&&(this._emitToPWA(yi,{clientId:e,stream:n,streamId:c,streamType:"screenshare"}),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 Gh({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}}Gh(window&&window.location);var Hh={};function Kh(e,t){return function(){return e.apply(t,arguments)}}({get exports(){return Hh},set exports(e){Hh=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
37
|
/*!
|
|
38
38
|
* mime-types
|
|
39
39
|
* Copyright(c) 2014 Jonathan Ong
|
|
40
40
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
41
41
|
* MIT Licensed
|
|
42
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,Gf=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 Hf=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=Gf,Xf=Hf,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=Gf,ng=Hf,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 Gg(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 Hg(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=Hg(e.baseURL,e.url),S=new URL(w),R=S.protocol||Av[0];if("data:"===R){let t;if("GET"!==l)return Gg(_,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)),Gg(_,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,Gg(_,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))}Gg(_,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=Hg(e.baseURL,e.url);function d(){if(!c)return;const n=qg.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());Gg((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 Gv(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Wg(null,e)}function Hv(e){Gv(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 Gv(e),t.data=$g.call(e,e.transformResponse,t),t.headers=qg.from(t.headers),t}),(function(t){return Vg(t)||(Gv(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=[Hv.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=Hv.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(Hg((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||Hh:"object"==typeof global&&global.btoa||Hh;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 Gb{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 Hb{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 Hb{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 Hb{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=process.env.REACT_APP_API_BASE_URL||"https://api.whereby.dev",Yb=process.env.REACT_APP_SIGNAL_BASE_URL||"wss://signal.appearin.net",Xb=["recorder","streamer"];const Zb=()=>{},e_=EventTarget;class t_ extends e_{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.selfId=null,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:Zb,error:Zb,log:Zb,warn:Zb},this.displayName=t,this.localMediaConstraints=n;const o=Gh({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:Qb}),this.apiClient=new yb({fetchDeviceCredentials:this.credentialsService.getCredentials.bind(this.credentialsService),baseUrl:Qb}),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 Gb({organizationApiClient:this.organizationApiClient}),this.signalSocket=function(){const e=new URL(Yb),t=`${e.pathname.replace(/^\/$/,"")}/protocol/socket.io/v4`,i=e.origin;return new po(i,{autoConnect:!1,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})}));const c={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:c,features:{lowDataModeEnabled:!1,sfuServerOverrideHost:void 0,turnServerOverrideHost:void 0,useOnlyTURN:void 0,vp9On:!1,h264On:!1,simulcastScreenshareOn:!1}})}get roomKey(){return this._roomKey}_handleNewChatMessage(e){this.dispatchEvent(new CustomEvent("chat_message",{detail:e}))}_handleNewClient({client:e}){if(Xb.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{clientId:t,resolution:i}=e;t===this.selfId&&("accepted"===i?(this.roomConnectionStatus="accepted",this._roomKey=e.metadata.roomKey,this._joinRoom()):"rejected"===i&&(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(this.selfId=s,"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:${r_}`})}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.signalSocket.connect(),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=yield this.credentialsService.getCredentials();this.logger.log("Connected to signal socket"),this.signalSocket.emit("identify_device",{deviceCredentials:t}),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(){this.roomConnectionStatus="disconnecting",this._ownsLocalMedia&&this.localMedia.stop(),this.rtcManager&&(this.localMedia.removeRtcManager(this.rtcManager),this.rtcManager.disconnectAll(),this.rtcManager=void 0),this.signalSocket&&(this.signalSocket.emit("leave_room"),this.signalSocket.disconnect(),this.roomConnectionStatus="disconnected")}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 i_={chatMessages:[],roomConnectionStatus:"",isJoining:!1,joinError:null,mostRecentChatMessage:null,remoteParticipants:[],waitingParticipants:[]};function n_(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 s_(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:n_(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:n_(e.remoteParticipants,t.payload.participantId,{stream:t.payload.stream})});case"PARTICIPANT_VIDEO_ENABLED":return Object.assign(Object.assign({},e),{remoteParticipants:n_(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 a_(e,t){const[i]=si.useState((()=>{var i;return new t_(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(s_,i_);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 r_="2.0.0-alpha14";export{mi as VideoView,r_ as sdkVersion,bi as useLocalMedia,a_ as useRoomConnection};
|
|
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,Gf=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 Hf=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=Gf,Xf=Hf,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=Gf,ng=Hf,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 Gg(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 Hg(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=Hg(e.baseURL,e.url),S=new URL(w),R=S.protocol||Av[0];if("data:"===R){let t;if("GET"!==l)return Gg(_,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)),Gg(_,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,Gg(_,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))}Gg(_,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=Hg(e.baseURL,e.url);function d(){if(!c)return;const n=qg.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());Gg((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 Gv(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Wg(null,e)}function Hv(e){Gv(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 Gv(e),t.data=$g.call(e,e.transformResponse,t),t.headers=qg.from(t.headers),t}),(function(t){return Vg(t)||(Gv(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=[Hv.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=Hv.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(Hg((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||Hh:"object"==typeof global&&global.btoa||Hh;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 Gb{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 Hb{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 Hb{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"})))}addStream(e,t){this.streams.push({id:e,state:t})}removeStream(e){const t=this.streams.findIndex((t=>t.id===e));-1!==t&&this.streams.splice(t,1)}updateStreamState(e,t){const i=this.streams.find((t=>t.id===e));i&&(i.state=t)}}class Jb extends Hb{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=process.env.REACT_APP_API_BASE_URL||"https://api.whereby.dev",Yb=process.env.REACT_APP_SIGNAL_BASE_URL||"wss://signal.appearin.net",Xb=["recorder","streamer"];const Zb=()=>{},e_=EventTarget;class t_ extends e_{constructor(e,{displayName:t,localMedia:i,localMediaConstraints:n,logger:s,roomKey:a}){super(),this.localParticipant=null,this.remoteParticipants=[],this.screenshares=[],this._deviceCredentials=null,this._ownsLocalMedia=!1,this.organizationId="",this.roomConnectionStatus="",this.selfId=null,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:Zb,error:Zb,log:Zb,warn:Zb},this.displayName=t,this.localMediaConstraints=n;const o=Gh({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:Qb}),this.apiClient=new yb({fetchDeviceCredentials:this.credentialsService.getCredentials.bind(this.credentialsService),baseUrl:Qb}),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 Gb({organizationApiClient:this.organizationApiClient}),this.signalSocket=function(){const e=new URL(Yb),t=`${e.pathname.replace(/^\/$/,"")}/protocol/socket.io/v4`,i=e.origin;return new po(i,{autoConnect:!1,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.signalSocket.on("cloud_recording_stopped",this._handleCloudRecordingStopped.bind(this)),this.signalSocket.on("screenshare_started",this._handleScreenshareStarted.bind(this)),this.signalSocket.on("screenshare_stopped",this._handleScreenshareStopped.bind(this)),this.signalSocket.on("streaming_stopped",this._handleStreamingStopped.bind(this)),this.signalSocket.on("disconnect",this._handleDisconnect.bind(this)),this.signalSocket.on("connect_error",this._handleDisconnect.bind(this)),this.signalSocketManager=this.signalSocket.getManager(),this.signalSocketManager.on("reconnect",this._handleReconnect.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})}));const c={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:c,features:{lowDataModeEnabled:!1,sfuServerOverrideHost:void 0,turnServerOverrideHost:void 0,useOnlyTURN:void 0,vp9On:!1,h264On:!1,simulcastScreenshareOn:!1}})}get roomKey(){return this._roomKey}_handleNewChatMessage(e){this.dispatchEvent(new CustomEvent("chat_message",{detail:e}))}_handleCloudRecordingStarted({client:e}){this.dispatchEvent(new CustomEvent("cloud_recording_started",{detail:{status:"recording",startedAt:e.startedCloudRecordingAt?new Date(e.startedCloudRecordingAt).getTime():(new Date).getTime()}}))}_handleStreamingStarted(){this.dispatchEvent(new CustomEvent("streaming_started",{detail:{status:"streaming",startedAt:(new Date).getTime()}}))}_handleNewClient({client:e}){if("recorder"===e.role.roleName&&this._handleCloudRecordingStarted({client:e}),"streamer"===e.role.roleName&&this._handleStreamingStarted(),Xb.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{clientId:t,resolution:i}=e;t===this.selfId&&("accepted"===i?(this.roomConnectionStatus="accepted",this._roomKey=e.metadata.roomKey,this._joinRoom()):"rejected"===i&&(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(this.selfId=s,"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}));const a=e.find((e=>"recorder"===e.role.roleName));a&&this._handleCloudRecordingStarted({client:a});e.find((e=>"streamer"===e.role.roleName))&&this._handleStreamingStarted(),this.remoteParticipants=e.filter((e=>e.id!==s)).filter((e=>!Xb.includes(e.role.roleName))).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}}))}_handleReconnect(){this.logger.log("Reconnected to signal socket"),this.signalSocket.emit("identify_device",{deviceCredentials:this._deviceCredentials}),this.signalSocket.once("device_identified",(()=>{this._joinRoom()}))}_handleDisconnect(){this.roomConnectionStatus="disconnected",this.dispatchEvent(new CustomEvent("room_connection_status_changed",{detail:{roomConnectionStatus:this.roomConnectionStatus}}))}_handleCloudRecordingStopped(){this.dispatchEvent(new CustomEvent("cloud_recording_stopped"))}_handleStreamingStopped(){this.dispatchEvent(new CustomEvent("streaming_stopped"))}_handleScreenshareStarted(e){const{clientId:t,streamId:i,hasAudioTrack:n}=e,s=this.remoteParticipants.find((e=>e.id===t));if(!s)return void this.logger.log("WARN: Could not find participant for screenshare");this.screenshares.find((e=>e.id===i))?this.logger.log("WARN: Screenshare already exists"):(s.addStream(i,"to_accept"),this._handleAcceptStreams([s]),this.screenshares=[...this.screenshares,{participantId:t,id:i,hasAudioTrack:n,stream:void 0}])}_handleScreenshareStopped(e){const{clientId:t,streamId:i}=e,n=this.remoteParticipants.find((e=>e.id===t));n?(n.removeStream(i),this.screenshares=this.screenshares.filter((e=>!(e.participantId===t&&e.id===i))),this.dispatchEvent(new CustomEvent("screenshare_stopped",{detail:{participantId:t,id:i}}))):this.logger.log("WARN: Could not find participant for screenshare")}_handleRtcEvent(e,t){return"rtc_manager_created"===e?this._handleRtcManagerCreated(t):"stream_added"===e?this._handleStreamAdded(t):"rtc_manager_destroyed"===e?this._handleRtcManagerDestroyed():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)}_handleRtcManagerDestroyed(){this.rtcManager=void 0}_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,streamType:n}){const s=this.remoteParticipants.find((t=>t.id===e));if(!s)return void this.logger.log("WARN: Could not find participant for incoming stream");const a=s.streams.find((e=>e.id===i));s.stream&&s.stream.id===i||!s.stream&&"webcam"===n||!s.stream&&!n&&a&&s.streams.indexOf(a)<1?this.dispatchEvent(new CustomEvent("participant_stream_added",{detail:{participantId:e,stream:t,streamId:i}})):this.dispatchEvent(new CustomEvent("screenshare_started",{detail:{participantId:e,stream:t,id:i}}))}_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:${r_}`})}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.signalSocket.connect(),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()),this._deviceCredentials=yield this.credentialsService.getCredentials(),this.logger.log("Connected to signal socket"),this.signalSocket.emit("identify_device",{deviceCredentials:this._deviceCredentials}),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(){this.roomConnectionStatus="disconnecting",this._ownsLocalMedia&&this.localMedia.stop(),this.rtcManager&&(this.localMedia.removeRtcManager(this.rtcManager),this.rtcManager.disconnectAll(),this.rtcManager=void 0),this.signalSocket&&(this.signalSocket.emit("leave_room"),this.signalSocket.disconnect(),this.roomConnectionStatus="disconnected")}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 i_={chatMessages:[],cloudRecording:{status:"",startedAt:null},isJoining:!1,joinError:null,mostRecentChatMessage:null,remoteParticipants:[],roomConnectionStatus:"",screenshares:[],streaming:{status:"",startedAt:null},waitingParticipants:[]};function n_(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 s_(e,t){switch(t.type){case"CHAT_MESSAGE":return Object.assign(Object.assign({},e),{chatMessages:[...e.chatMessages,t.payload],mostRecentChatMessage:t.payload});case"CLOUD_RECORDING_STARTED":return Object.assign(Object.assign({},e),{cloudRecording:{status:t.payload.status,startedAt:t.payload.startedAt}});case"CLOUD_RECORDING_STOPPED":return Object.assign(Object.assign({},e),{cloudRecording:{status:"",startedAt:null}});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:n_(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:n_(e.remoteParticipants,t.payload.participantId,{stream:t.payload.stream})});case"PARTICIPANT_VIDEO_ENABLED":return Object.assign(Object.assign({},e),{remoteParticipants:n_(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"SCREENSHARE_STARTED":return Object.assign(Object.assign({},e),{screenshares:(i=e.screenshares,n={participantId:t.payload.participantId,id:t.payload.id,hasAudioTrack:t.payload.hasAudioTrack,stream:t.payload.stream},i.find((e=>e.id===n.id))?i:[...i,n])});case"SCREENSHARE_STOPPED":return Object.assign(Object.assign({},e),{screenshares:e.screenshares.filter((e=>e.participantId!==t.payload.participantId||e.id!==t.payload.id))});case"STREAMING_STARTED":return Object.assign(Object.assign({},e),{streaming:{status:t.payload.status,startedAt:t.payload.startedAt}});case"STREAMING_STOPPED":return Object.assign(Object.assign({},e),{streaming:{status:"",startedAt:null}});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}var i,n}function a_(e,t){const[i]=si.useState((()=>{var i;return new t_(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(s_,i_);return si.useEffect((()=>(i.addEventListener("chat_message",(e=>{const t=e.detail;s({type:"CHAT_MESSAGE",payload:t})})),i.addEventListener("cloud_recording_started",(e=>{const{status:t,startedAt:i}=e.detail;s({type:"CLOUD_RECORDING_STARTED",payload:{status:t,startedAt:i}})})),i.addEventListener("cloud_recording_stopped",(()=>{s({type:"CLOUD_RECORDING_STOPPED"})})),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("screenshare_started",(e=>{const{participantId:t,id:i,hasAudioTrack:n,stream:a}=e.detail;s({type:"SCREENSHARE_STARTED",payload:{participantId:t,id:i,hasAudioTrack:n,stream:a}})})),i.addEventListener("screenshare_stopped",(e=>{const{participantId:t,id:i}=e.detail;s({type:"SCREENSHARE_STOPPED",payload:{participantId:t,id:i}})})),i.addEventListener("streaming_started",(e=>{const{status:t,startedAt:i}=e.detail;s({type:"STREAMING_STARTED",payload:{status:t,startedAt:i}})})),i.addEventListener("streaming_stopped",(()=>{s({type:"STREAMING_STOPPED"})})),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 r_="2.0.0-alpha16";export{mi as VideoView,r_ as sdkVersion,bi as useLocalMedia,a_ as useRoomConnection};
|