media-av 0.0.26 → 0.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,15 @@
1
- (function(k,q){typeof exports=="object"&&typeof module<"u"?q(exports):typeof define=="function"&&define.amd?define(["exports"],q):(k=typeof globalThis<"u"?globalThis:k||self,q(k.mediaAV={}))})(this,function(k){"use strict";var md=Object.defineProperty;var yd=(k,q,Ie)=>q in k?md(k,q,{enumerable:!0,configurable:!0,writable:!0,value:Ie}):k[q]=Ie;var g=(k,q,Ie)=>yd(k,typeof q!="symbol"?q+"":q,Ie);var q=typeof document<"u"?document.currentScript:null;function Ie(t,e){for(var r=0;r<e.length;r++){const n=e[r];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in t)){const o=Object.getOwnPropertyDescriptor(n,i);o&&Object.defineProperty(t,i,o.get?o:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}function fn(t,e){return function(){return t.apply(e,arguments)}}const{toString:Es}=Object.prototype,{getPrototypeOf:me}=Object,{iterator:Qe,toStringTag:dn}=Symbol,Xe=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),pn=t=>typeof t=="string"&&(t==="__proto__"||t==="constructor"||t==="prototype"),hn=(t,e,r)=>t===Object.prototype||!r&&e===null,Ts=t=>{if(!Object.isExtensible(t))return!1;const e=Object.getOwnPropertyNames(t);return Object.getOwnPropertySymbols&&e.push(...Object.getOwnPropertySymbols(t)),e.every(r=>{if(pn(r))return!1;const n=Object.getOwnPropertyDescriptor(t,r);return!!n&&n.configurable&&n.writable===!0})},Ye=(t,e)=>{let r=t;const n=[];for(;r!=null;){if(n.indexOf(r)!==-1)return!1;n.push(r);const i=me(r);if(hn(r,i,r===t))return!1;if(Xe(r,e))return!0;r=i}return!1},Ps=(t,e)=>t!=null&&Ye(t,e)?t[e]:void 0,Os=t=>{if(t==null||typeof t!="object"&&typeof t!="function")return t;const e=me(t);if(e===null&&Ts(t))return t;const r=Object.create(null),n=Object.create(null),i=[];let o=t;for(;o!=null&&i.indexOf(o)===-1;){i.push(o);const s=o===t?e:me(o);if(hn(o,s,o===t))break;const a=Object.getOwnPropertyNames(o);Object.getOwnPropertySymbols&&a.push(...Object.getOwnPropertySymbols(o));for(const c of a)pn(c)||Xe(n,c)||(r[c]=t[c],n[c]=!0);o=s}return r},Zt=(t=>e=>{const r=Es.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),te=t=>(t=t.toLowerCase(),e=>Zt(e)===t),St=t=>e=>typeof e===t,{isArray:Ce}=Array,Re=St("undefined");function ke(t){return t!==null&&!Re(t)&&t.constructor!==null&&!Re(t.constructor)&&W(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const mn=te("ArrayBuffer");function ws(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&mn(t.buffer),e}const As=St("string"),W=St("function"),yn=St("number"),Fe=t=>t!==null&&typeof t=="object",_s=t=>t===!0||t===!1,vt=t=>{if(!Fe(t))return!1;const e=me(t);return(e===null||e===Object.prototype||me(e)===null)&&!Ye(t,dn)&&!Ye(t,Qe)},Ds=t=>{if(!Fe(t)||ke(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},Ls=te("Date"),xs=te("File"),Is=t=>!!(t&&typeof t.uri<"u"),ks=t=>t&&typeof t.getParts<"u",Fs=te("Blob"),Us=te("FileList"),Ms=te("Set"),Ns=t=>Fe(t)&&W(t.pipe);function Bs(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const gn=Bs(),Sn=typeof gn.FormData<"u"?gn.FormData:void 0,$s=t=>{if(!t)return!1;if(Sn&&t instanceof Sn)return!0;const e=me(t);if(!e||e===Object.prototype||!W(t.append))return!1;const r=Zt(t);return r==="formdata"||r==="object"&&W(t.toString)&&t.toString()==="[object FormData]"},js=te("URLSearchParams"),[Hs,Vs,qs,zs]=["ReadableStream","Request","Response","Headers"].map(te),Gs=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ze(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),Ce(t))for(n=0,i=t.length;n<i;n++)e.call(null,t[n],n,t);else{if(ke(t))return;const o=r?Object.getOwnPropertyNames(t):Object.keys(t),s=o.length;let a;for(n=0;n<s;n++)a=o[n],e.call(null,t[a],a,t)}}function vn(t,e){if(ke(t))return null;e=e.toLowerCase();const r=Object.keys(t);let n=r.length,i;for(;n-- >0;)if(i=r[n],e===i.toLowerCase())return i;return null}const Ee=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,bn=t=>!Re(t)&&t!==Ee;function er(...t){const{caseless:e,skipUndefined:r}=bn(this)&&this||{},n={},i=(o,s)=>{if(s==="__proto__"||s==="constructor"||s==="prototype")return;const a=e&&typeof s=="string"&&vn(n,s)||s,c=Xe(n,a)?n[a]:void 0;vt(c)&&vt(o)?n[a]=er(c,o):vt(o)?n[a]=er({},o):Ce(o)?n[a]=o.slice():(!r||!Re(o))&&(n[a]=o)};for(let o=0,s=t.length;o<s;o++){const a=t[o];if(!a||ke(a)||(Ze(a,i),typeof a!="object"||Ce(a)))continue;const c=Object.getOwnPropertySymbols(a);for(let l=0;l<c.length;l++){const u=c[l];ia.call(a,u)&&i(a[u],u)}}return n}const Ws=(t,e,r,{allOwnKeys:n}={})=>(Ze(e,(i,o)=>{r&&W(i)?Object.defineProperty(t,o,{__proto__:null,value:fn(i,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,o,{__proto__:null,value:i,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),t),Ks=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Js=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),Object.defineProperty(t.prototype,"constructor",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{__proto__:null,value:e.prototype}),r&&Object.assign(t.prototype,r)},Qs=(t,e,r,n)=>{let i,o,s;const a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),o=i.length;o-- >0;)s=i[o],(!n||n(s,t,e))&&!a[s]&&(e[s]=t[s],a[s]=!0);t=r!==!1&&me(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},Xs=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},Ys=t=>{if(!t)return null;if(Ce(t))return t;let e=t.length;if(!yn(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},Zs=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&me(Uint8Array)),ea=(t,e)=>{const n=(t&&t[Qe]).call(t);let i;for(;(i=n.next())&&!i.done;){const o=i.value;e.call(t,o[0],o[1])}},ta=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},ra=te("HTMLFormElement"),na=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),{propertyIsEnumerable:ia}=Object.prototype,oa=te("RegExp"),Cn=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};Ze(r,(i,o)=>{let s;(s=e(i,o,t))!==!1&&(n[o]=s||i)}),Object.defineProperties(t,n)},sa=t=>{Cn(t,(e,r)=>{if(W(t)&&["arguments","caller","callee"].includes(r))return!1;const n=t[r];if(W(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},aa=(t,e)=>{const r={},n=i=>{i.forEach(o=>{r[o]=!0})};return Ce(t)?n(t):n(String(t).split(e)),r},ca=()=>{},la=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function ua(t){return!!(t&&W(t.append)&&t[dn]==="FormData"&&t[Qe])}const fa=t=>{const e=new WeakSet,r=n=>{if(Fe(n)){if(e.has(n))return;if(ke(n))return n;if(!("toJSON"in n)){e.add(n);let i;if(Ms(n)){i=[];for(const o of n){const s=r(o);!Re(s)&&i.push(s)}}else i=Ce(n)?[]:{},Ze(n,(o,s)=>{const a=r(o);!Re(a)&&(i[s]=a)});return e.delete(n),i}}return n};return r(t)},da=te("AsyncFunction"),pa=t=>t&&(Fe(t)||W(t))&&W(t.then)&&W(t.catch),Rn=((t,e)=>t?setImmediate:e?((r,n)=>(Ee.addEventListener("message",({source:i,data:o})=>{i===Ee&&o===r&&n.length&&n.shift()()},!1),i=>{n.push(i),Ee.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",W(Ee.postMessage)),ha=typeof queueMicrotask<"u"?queueMicrotask.bind(Ee):typeof process<"u"&&process.nextTick||Rn,En=t=>t!=null&&W(t[Qe]),p={isArray:Ce,isArrayBuffer:mn,isBuffer:ke,isFormData:$s,isArrayBufferView:ws,isString:As,isNumber:yn,isBoolean:_s,isObject:Fe,isPlainObject:vt,isEmptyObject:Ds,isReadableStream:Hs,isRequest:Vs,isResponse:qs,isHeaders:zs,isUndefined:Re,isDate:Ls,isFile:xs,isReactNativeBlob:Is,isReactNative:ks,isBlob:Fs,isRegExp:oa,isFunction:W,isStream:Ns,isURLSearchParams:js,isTypedArray:Zs,isFileList:Us,forEach:Ze,merge:er,extend:Ws,trim:Gs,stripBOM:Ks,inherits:Js,toFlatObject:Qs,kindOf:Zt,kindOfTest:te,endsWith:Xs,toArray:Ys,forEachEntry:ea,matchAll:ta,isHTMLForm:ra,hasOwnProperty:Xe,hasOwnProp:Xe,hasOwnInPrototypeChain:Ye,getSafeProp:Ps,toSafeFlatObject:Os,reduceDescriptors:Cn,freezeMethods:sa,toObjectSet:aa,toCamelCase:na,noop:ca,toFiniteNumber:la,findKey:vn,global:Ee,isContextDefined:bn,isSpecCompliantForm:ua,toJSONObject:fa,isAsyncFn:da,isThenable:pa,setImmediate:Rn,asap:ha,isIterable:En,isSafeIterable:t=>t!=null&&Ye(t,Qe)&&En(t)},ma=p.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"]),ya=t=>{const e={};let r,n,i;return t&&t.split(`
2
- `).forEach(function(s){i=s.indexOf(":"),r=s.substring(0,i).trim().toLowerCase(),n=s.substring(i+1).trim();const a=p.hasOwnProp(e,r);!r||a&&p.hasOwnProp(ma,r)||(r==="set-cookie"?a?e[r].push(n):e[r]=[n]:e[r]=a?e[r]+", "+n:n)}),e};function ga(t){let e=0,r=t.length;for(;e<r;){const n=t.charCodeAt(e);if(n!==9&&n!==32)break;e+=1}for(;r>e;){const n=t.charCodeAt(r-1);if(n!==9&&n!==32)break;r-=1}return e===0&&r===t.length?t:t.slice(e,r)}const Sa=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),va=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function tr(t,e){return p.isArray(t)?t.map(r=>tr(r,e)):ga(String(t).replace(e,""))}const ba=t=>tr(t,Sa),Ca=t=>tr(t,va);function Tn(t){const e=Object.create(null);return p.forEach(t.toJSON(),(r,n)=>{e[n]=Ca(r)}),e}const Pn=Symbol("internals");function et(t){return t&&String(t).trim().toLowerCase()}function bt(t){return t===!1||t==null?t:p.isArray(t)?t.map(bt):ba(String(t))}function Ra(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const Ea=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function rr(t){let e=0,r=t.length;for(;e<r;){const n=t.charCodeAt(e);if(n!==9&&n!==32)break;e+=1}for(;r>e;){const n=t.charCodeAt(r-1);if(n!==9&&n!==32)break;r-=1}return e===0&&r===t.length?t:t.slice(e,r)}function Ta(t){const e=t.length-1;if(e<1||t.charCodeAt(0)!==34||t.charCodeAt(e)!==34)return t;let r="";for(let n=1;n<e;n++){const i=t.charCodeAt(n);if(i===34||i===92&&(n+=1,n>=e))return t;r+=t[n]}return r}function Pa(t){const e=Object.create(null),r=String(t);let n=0,i=!1,o=!1;function s(a){const c=rr(r.slice(n,a)),l=c.indexOf("=");if(l<1)return;const u=rr(c.slice(0,l));if(!Ea.test(u))return;const f=u.toLowerCase();if(f==="__proto__"||f==="constructor"||f==="prototype")return;const d=rr(c.slice(l+1));e[f]=Ta(d)}for(let a=0;a<r.length;a++){const c=r.charCodeAt(a);i?o?o=!1:c===92?o=!0:c===34&&(i=!1):c===34?i=!0:(c===44||c===59)&&(s(a),n=a+1)}return s(r.length),e}const Oa=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function nr(t,e,r,n,i){if(p.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!p.isString(e)){if(p.isString(n))return e.indexOf(n)!==-1;if(p.isRegExp(n))return n.test(e)}}function wa(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function Aa(t,e){const r=p.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{__proto__:null,value:function(i,o,s){return this[n].call(this,e,i,o,s)},configurable:!0})})}let $=class{constructor(e){e&&this.set(e)}set(e,r,n){const i=this;function o(a,c,l){const u=et(c);if(!u)return;const f=p.findKey(i,u);(!f||i[f]===void 0||l===!0||l===void 0&&i[f]!==!1)&&(i[f||c]=bt(a))}const s=(a,c)=>p.forEach(a,(l,u)=>o(l,u,c));if(p.isPlainObject(e)||e instanceof this.constructor)s(e,r);else if(p.isString(e)&&(e=e.trim())&&!Oa(e))s(ya(e),r);else if(p.isObject(e)&&p.isSafeIterable(e)){let a=Object.create(null),c,l;for(const u of e){if(!p.isArray(u))throw new TypeError("Object iterator must return a key-value pair");l=u[0],p.hasOwnProp(a,l)?(c=a[l],a[l]=p.isArray(c)?[...c,u[1]]:[c,u[1]]):a[l]=u[1]}s(a,r)}else e!=null&&o(r,e,n);return this}get(e,r){if(e=et(e),e){const n=p.findKey(this,e);if(n){const i=this[n];if(!r)return i;if(r===!0)return Ra(i);if(p.isFunction(r))return r.call(this,i,n);if(p.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=et(e),e){const n=p.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||nr(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let i=!1;function o(s){if(s=et(s),s){const a=p.findKey(n,s);a&&(!r||nr(n,n[a],a,r))&&(delete n[a],i=!0)}}return p.isArray(e)?e.forEach(o):o(e),i}clear(e){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const o=r[n];(!e||nr(this,this[o],o,e,!0))&&(delete this[o],i=!0)}return i}normalize(e){const r=this,n={};return p.forEach(this,(i,o)=>{const s=p.findKey(n,o);if(s){r[s]=bt(i),delete r[o];return}const a=e?wa(o):String(o).trim();a!==o&&delete r[o],r[a]=bt(i),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return p.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&p.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(`
3
- `)}getSetCookie(){const e=this.get("set-cookie");return p.isArray(e)?e:e==null||e===!1?[]:[e]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static parseParameters(e){return Pa(e)}static concat(e,...r){const n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){const n=(this[Pn]=this[Pn]={accessors:{}}).accessors,i=this.prototype;function o(s){const a=et(s);n[a]||(Aa(i,s),n[a]=!0)}return p.isArray(e)?e.forEach(o):o(e),this}};$.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),p.reduceDescriptors($.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),p.freezeMethods($);const Ct="[REDACTED ****]";function _a(t){if(p.hasOwnProp(t,"toJSON"))return!0;let e=Object.getPrototypeOf(t);for(;e&&e!==Object.prototype;){if(p.hasOwnProp(e,"toJSON"))return!0;e=Object.getPrototypeOf(e)}return!1}function Da(t,e){const r=new Set(e.map(o=>String(o).toLowerCase())),n=[],i=o=>{if(o===null||typeof o!="object"||p.isBuffer(o))return o;if(n.indexOf(o)!==-1)return;o instanceof $&&(o=o.toJSON()),n.push(o);let s;if(p.isArray(o))s=[],o.forEach((a,c)=>{const l=i(a);p.isUndefined(l)||(s[c]=l)});else{if(!p.isPlainObject(o)&&_a(o))return n.pop(),o;s=Object.create(null);for(const[a,c]of Object.entries(o)){const l=r.has(a.toLowerCase())?Ct:i(c);p.isUndefined(l)||(s[a]=l)}}return n.pop(),s};return i(t)}function On(t){try{return String(t)}catch{return""}}function La(t){return t.errors.map(r=>{try{return r&&r.message?On(r.message):On(r)}catch{return""}}).filter(Boolean).join("; ")||t.name||"AggregateError"}let v=class Cs extends Error{static from(e,r,n,i,o,s){let a=e.message;!a&&p.isArray(e.errors)&&e.errors.length&&(a=La(e));const c=new Cs(a,r||e.code,n,i,o);return Object.defineProperty(c,"cause",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),c.name=e.name,e.status!=null&&c.status==null&&(c.status=e.status),s&&Object.assign(c,s),c}constructor(e,r,n,i,o){super(e),Object.defineProperty(this,"message",{__proto__:null,value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),n&&(this.config=n),i&&(this.request=i),o&&(this.response=o,this.status=o.status)}toJSON(){const e=this.config,r=e&&p.hasOwnProp(e,"redact")?e.redact:void 0,n=p.isArray(r)&&r.length>0?Da(e,r):p.toJSONObject(e);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:n,code:this.code,status:this.status}}};v.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",v.ERR_BAD_OPTION="ERR_BAD_OPTION",v.ECONNABORTED="ECONNABORTED",v.ETIMEDOUT="ETIMEDOUT",v.ECONNREFUSED="ECONNREFUSED",v.ERR_NETWORK="ERR_NETWORK",v.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",v.ERR_DEPRECATED="ERR_DEPRECATED",v.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",v.ERR_BAD_REQUEST="ERR_BAD_REQUEST",v.ERR_CANCELED="ERR_CANCELED",v.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",v.ERR_INVALID_URL="ERR_INVALID_URL",v.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const xa=null,wn=100;function ir(t){return p.isPlainObject(t)||p.isArray(t)}function An(t){return p.endsWith(t,"[]")?t.slice(0,-2):t}function or(t,e,r){return t?t.concat(e).map(function(i,o){return i=An(i),!r&&o?"["+i+"]":i}).join(r?".":""):e}function Ia(t){return p.isArray(t)&&!t.some(ir)}const ka=p.toFlatObject(p,{},null,function(e){return/^is[A-Z]/.test(e)});function Rt(t,e,r){if(!p.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const n=(b,R)=>{const E=p.getSafeProp(r,b);return p.isUndefined(E)?R:E},i=n("metaTokens",!0),o=n("visitor")||S,s=n("dots",!1),a=n("indexes",!1),c=n("Blob")||typeof Blob<"u"&&Blob,l=n("maxDepth",wn),u=c&&p.isSpecCompliantForm(e),f=[];if(!p.isFunction(o))throw new TypeError("visitor must be a function");function d(b){if(b===null)return"";if(p.isDate(b))return b.toISOString();if(p.isBoolean(b))return b.toString();if(!u&&p.isBlob(b))throw new v("Blob is not supported. Use a Buffer instead.");if(p.isArrayBuffer(b)||p.isTypedArray(b)){if(u&&typeof c=="function")return new c([b]);throw new v("Blob is not supported. Use a Buffer instead.",v.ERR_NOT_SUPPORT)}return b}function h(b){if(b>l)throw new v("Object is too deeply nested ("+b+" levels). Max depth: "+l,v.ERR_FORM_DATA_DEPTH_EXCEEDED)}function y(b,R){if(l===1/0)return JSON.stringify(b);const E=[];return JSON.stringify(b,function(x,A){if(!p.isObject(A))return A;for(;E.length&&E[E.length-1]!==this;)E.pop();return E.push(A),h(R+E.length-1),A})}function S(b,R,E){let C=b;if(p.isReactNative(e)&&p.isReactNativeBlob(b))return e.append(or(E,R,s),d(b)),!1;if(b&&!E&&typeof b=="object"){if(p.endsWith(R,"{}"))R=i?R:R.slice(0,-2),b=y(b,1);else if(p.isArray(b)&&Ia(b)||(p.isFileList(b)||p.endsWith(R,"[]"))&&(C=p.toArray(b)))return R=An(R),C.forEach(function(A,H){!(p.isUndefined(A)||A===null)&&e.append(a===!0?or([R],H,s):a===null?R:R+"[]",d(A))}),!1}return ir(b)?!0:(e.append(or(E,R,s),d(b)),!1)}const P=Object.assign(ka,{defaultVisitor:S,convertValue:d,isVisitable:ir});function m(b,R,E=0){if(!p.isUndefined(b)){if(h(E),f.indexOf(b)!==-1)throw new Error("Circular reference detected in "+R.join("."));f.push(b),p.forEach(b,function(x,A){(!(p.isUndefined(x)||x===null)&&o.call(e,x,p.isString(A)?A.trim():A,R,P))===!0&&m(x,R?R.concat(A):[A],E+1)}),f.pop()}}if(!p.isObject(t))throw new TypeError("data must be an object");return m(t),e}function _n(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(t).replace(/[!'()~]|%20/g,function(n){return e[n]})}function sr(t,e){this._pairs=[],t&&Rt(t,this,e)}const Dn=sr.prototype;Dn.append=function(e,r){this._pairs.push([e,r])},Dn.toString=function(e){const r=e?n=>e.call(this,n,_n):_n;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function Fa(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ln(t,e,r){if(!e)return t;t=t||"";const n=p.isFunction(r)?{serialize:r}:r,i=p.getSafeProp(n,"encode")||Fa,o=p.getSafeProp(n,"serialize");let s;if(o?s=o(e,n):s=p.isURLSearchParams(e)?e.toString():new sr(e,n).toString(i),s){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}const tt=Symbol("internals");function xn(t){return t?t.length:0}function In(t){if(t)for(;t.length&&t[t.length-1]===null;)t.pop()}function rt(t,e){const r=t.handlers,n=xn(r);r!==e.handlersRef?(e.handlersRef=r,e.handlerEntries.clear()):n!==e.handlersLength&&(n?e.handlerEntries.forEach(function(o,s){r[o.index]!==o.handler&&e.handlerEntries.delete(s)}):e.handlerEntries.clear()),e.handlersLength=n}class kn{constructor(){this.handlers=[],this[tt]={handlersRef:this.handlers,handlersLength:this.handlers.length,handlerEntries:new Map,iterationDepth:0,nextId:0}}use(e,r,n){const i={fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null},o=this[tt];this.handlers==null&&(this.handlers=[]),rt(this,o);const s=o.nextId++;return this.handlers.push(i),o.handlerEntries.set(s,{handler:i,index:this.handlers.length-1}),o.handlersLength=this.handlers.length,s}eject(e){const r=this[tt];rt(this,r);const n=r.handlerEntries.get(e);if(n){if(r.handlerEntries.delete(e),this.handlers[n.index]!==n.handler)return;this.handlers[n.index]=null,r.iterationDepth||(In(this.handlers),r.handlersLength=this.handlers.length)}}clear(){this.handlers&&(this.handlers=[],rt(this,this[tt]))}forEach(e){const r=this[tt];rt(this,r),r.iterationDepth++;try{p.forEach(this.handlers,function(i){i!==null&&e(i)})}finally{--r.iterationDepth||(rt(this,r),In(this.handlers),r.handlersLength=xn(this.handlers))}}}const ar={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Ua={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:sr,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},cr=typeof window<"u"&&typeof document<"u",lr=typeof navigator=="object"&&navigator||void 0,Ma=cr&&(!lr||["ReactNative","NativeScript","NS"].indexOf(lr.product)<0),Na=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Ba=cr&&window.location.href||"http://localhost",M={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:cr,hasStandardBrowserEnv:Ma,hasStandardBrowserWebWorkerEnv:Na,navigator:lr,origin:Ba},Symbol.toStringTag,{value:"Module"})),...Ua};function $a(t,e){return Rt(t,new M.classes.URLSearchParams,{visitor:function(r,n,i,o){return M.isNode&&p.isBuffer(r)?(this.append(n,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...e})}const Fn=wn;function Un(t){if(t>Fn)throw new v("FormData field is too deeply nested ("+t+" levels). Max depth: "+Fn,v.ERR_FORM_DATA_DEPTH_EXCEEDED)}function ja(t){const e=[],r=/[^.[\]]+|\[([^.[\]]*)]/g;let n;for(;(n=r.exec(t))!==null;)Un(e.length),e.push(n[0]==="[]"?"":n[1]||n[0]);return e}function Ha(t){const e={},r=Object.keys(t);let n;const i=r.length;let o;for(n=0;n<i;n++)o=r[n],e[o]=t[o];return e}function Mn(t){function e(r,n,i,o){Un(o);let s=r[o++];if(s==="__proto__")return!0;const a=Number.isFinite(+s),c=o>=r.length;return s=!s&&p.isArray(i)?i.length:s,c?(p.hasOwnProp(i,s)?i[s]=p.isArray(i[s])?i[s].concat(n):[i[s],n]:i[s]=n,!a):((!p.hasOwnProp(i,s)||!p.isObject(i[s]))&&(i[s]=[]),e(r,n,i[s],o)&&p.isArray(i[s])&&(i[s]=Ha(i[s])),!a)}if(p.isFormData(t)&&p.isFunction(t.entries)){const r={};return p.forEachEntry(t,(n,i)=>{e(ja(n),i,r,0)}),r}return null}const Nn=Object.freeze(["get","delete","head","options","post","put","patch","purge","link","unlink","query"]),Ue=(t,e)=>t!=null&&p.hasOwnProp(t,e)?t[e]:void 0;function Va(t,e,r){if(p.isString(t))try{return(e||JSON.parse)(t),p.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const nt={transitional:ar,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,o=p.isObject(e);if(o&&p.isHTMLForm(e)&&(e=new FormData(e)),p.isFormData(e))return i?JSON.stringify(Mn(e)):e;if(p.isArrayBuffer(e)||p.isBuffer(e)||p.isStream(e)||p.isFile(e)||p.isBlob(e)||p.isReadableStream(e))return e;if(p.isArrayBufferView(e))return e.buffer;if(p.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(o){const c=Ue(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return $a(e,c).toString();if((a=p.isFileList(e))||n.indexOf("multipart/form-data")>-1){const l=Ue(this,"env"),u=l&&l.FormData;return Rt(a?{"files[]":e}:e,u&&new u,c)}}return o||i?(r.setContentType("application/json",!1),Va(e)):e}],transformResponse:[function(e){const r=Ue(this,"transitional")||nt.transitional,n=r&&r.forcedJSONParsing,i=Ue(this,"responseType"),o=i==="json";if(p.isResponse(e)||p.isReadableStream(e))return e;if(e&&p.isString(e)&&(n&&!i||o)){const a=!(r&&r.silentJSONParsing)&&o;try{return JSON.parse(e,Ue(this,"parseReviver"))}catch(c){if(a)throw c.name==="SyntaxError"?v.from(c,v.ERR_BAD_RESPONSE,this,null,Ue(this,"response")):c}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:M.classes.FormData,Blob:M.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};p.forEach(Nn,t=>{nt.headers[t]={}});function ur(t,e){const r=this||nt,n=e||r,i=$.from(n.headers);let o=n.data;return p.forEach(t,function(a){o=a.call(r,o,i.normalize(),e?e.status:void 0)}),i.normalize(),o}function Bn(t){return!!(t&&t.__CANCEL__)}let it=class extends v{constructor(e,r,n){super(e??"canceled",v.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function $n(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new v("Request failed with status code "+r.status,r.status>=400&&r.status<500?v.ERR_BAD_REQUEST:v.ERR_BAD_RESPONSE,r.config,r.request,r))}const qa=/[\t\n\r]/g;function jn(t){if(typeof t!="string")return t;let e=0;for(;e<t.length&&t.charCodeAt(e)<=32;)e++;return t.slice(e).replace(qa,"")}function fr(t){const e=/^([-+\w]{1,25}):(?:\/\/)?/.exec(t);return e&&e[1]||""}function za(t,e){t=t||10;const r=new Array(t),n=new Array(t);let i=0,o=0,s;return e=e!==void 0?e:1e3,function(c){const l=Date.now(),u=n[o];s||(s=l),r[i]=c,n[i]=l;let f=o,d=0;for(;f!==i;)d+=r[f++],f=f%t;if(i=(i+1)%t,i===o&&(o=(o+1)%t),l-s<e)return;const h=u&&l-u;return h?Math.round(d*1e3/h):void 0}}function Ga(t,e){let r=0,n=1e3/e,i,o;const s=(u,f=Date.now())=>{r=f,i=null,o&&(clearTimeout(o),o=null),t(...u)};return[(...u)=>{const f=Date.now(),d=f-r;d>=n?s(u,f):(i=u,o||(o=setTimeout(()=>{o=null,s(i)},n-d)))},()=>i&&s(i),(...u)=>s(u)]}const Et=(t,e,r=3)=>{let n=0;const i=za(50,250);return Ga(o=>{if(!o||!p.isNumber(o.loaded))return;const s=o.loaded,a=o.lengthComputable?o.total:void 0,c=Math.max(0,a!=null?Math.min(s,a):s),l=Math.max(0,c-n),u=i(l);n=Math.max(n,c);const f={loaded:c,total:a,progress:a?c/a:void 0,bytes:l,rate:u||void 0,estimated:u&&a?(a-c)/u:void 0,event:o,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(f)},r)},Hn=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},Vn=(t,e=p.asap)=>(...r)=>e(()=>t(...r)),Wa=M.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,M.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(M.origin),M.navigator&&/(msie|trident)/i.test(M.navigator.userAgent)):()=>!0,Ka=M.hasStandardBrowserEnv?{write(t,e,r,n,i,o,s){if(typeof document>"u")return;const a=[`${t}=${encodeURIComponent(e)}`];p.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),p.isString(n)&&a.push(`path=${n}`),p.isString(i)&&a.push(`domain=${i}`),o===!0&&a.push("secure"),p.isString(s)&&a.push(`SameSite=${s}`),document.cookie=a.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.split(";");for(let r=0;r<e.length;r++){const n=e[r].replace(/^\s+/,""),i=n.indexOf("=");if(i!==-1&&n.slice(0,i)===t)try{return decodeURIComponent(n.slice(i+1))}catch{return n.slice(i+1)}}return null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Ja(t){return typeof t!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Qa(t,e){if(!e)return t;let r=t.length;for(;r>0&&t.charCodeAt(r-1)===47;)r--;return t.slice(0,r)+"/"+e.replace(/^\/+/,"")}const Xa=/^https?:(?!\/\/)/i;function Ya(t){return t&&t.replace(/(^|&)([^=&]*=)?[^&]+/g,(e,r,n="")=>`${r}${n}${Ct}`)}function Za(t){const e=t.replace(/^(https?:\/{0,2})[^/?#]*@/i,`$1${Ct}@`),r=e.indexOf("#"),i=(r===-1?e:e.slice(0,r)).replace(/([?&][^=&#]*=)[^&#]*/g,`$1${Ct}`);return r===-1?i:`${i}#${Ya(e.slice(r+1))}`}function qn(t,e){if(typeof t=="string"){const r=jn(t);if(Xa.test(r))throw new v(`Invalid URL ${JSON.stringify(Za(r))}: missing "//" after protocol`,v.ERR_INVALID_URL,e)}}function zn(t,e,r,n){qn(e,n);let i=!Ja(e);return t&&(i||r===!1)?(qn(t,n),Qa(t,e)):e}const Gn=t=>t instanceof $?{...t}:t,ec=t=>Object.getOwnPropertySymbols&&Object.getOwnPropertyDescriptor?Object.keys(t).concat(Object.getOwnPropertySymbols(t).filter(e=>Object.getOwnPropertyDescriptor(t,e).enumerable)):Object.keys(t);function Te(t,e){t=t||{},e=e||{};const r=Object.create(null);Object.defineProperty(r,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function n(u,f,d,h){return p.isPlainObject(u)&&p.isPlainObject(f)?p.merge.call({caseless:h},u,f):p.isPlainObject(f)?p.merge({},f):p.isArray(f)?f.slice():f}function i(u,f,d,h){if(p.isUndefined(f)){if(!p.isUndefined(u))return n(void 0,u,d,h)}else return n(u,f,d,h)}function o(u,f){if(!p.isUndefined(f))return n(void 0,f)}function s(u,f){if(p.isUndefined(f)){if(!p.isUndefined(u))return n(void 0,u)}else return n(void 0,f)}function a(u){const f=p.hasOwnProp(e,"transitional")?e.transitional:void 0;if(!p.isUndefined(f))if(p.isPlainObject(f)){if(p.hasOwnProp(f,u))return f[u]}else return;const d=p.hasOwnProp(t,"transitional")?t.transitional:void 0;if(p.isPlainObject(d)&&p.hasOwnProp(d,u))return d[u]}function c(u,f,d){if(p.hasOwnProp(e,d))return n(u,f);if(p.hasOwnProp(t,d))return n(void 0,u)}const l={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutErrorMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,allowedSocketPaths:s,responseEncoding:s,validateStatus:c,headers:(u,f,d)=>i(Gn(u),Gn(f),d,!0)};return p.forEach(ec({...t,...e}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;const d=p.hasOwnProp(l,f)?l[f]:i,h=p.hasOwnProp(t,f)?t[f]:void 0,y=p.hasOwnProp(e,f)?e[f]:void 0,S=d(h,y,f);p.isUndefined(S)&&d!==c||(r[f]=S)}),p.hasOwnProp(e,"validateStatus")&&p.isUndefined(e.validateStatus)&&a("validateStatusUndefinedResolves")===!1&&(p.hasOwnProp(t,"validateStatus")?r.validateStatus=n(void 0,t.validateStatus):delete r.validateStatus),r}const tc=["content-type","content-length"];function rc(t,e,r){if(r!=="content-only"){t.set(e);return}Object.entries(e||{}).forEach(([n,i])=>{tc.includes(n.toLowerCase())&&t.set(n,i)})}const nc=t=>encodeURIComponent(t).replace(/%([0-9A-F]{2})/gi,(e,r)=>String.fromCharCode(parseInt(r,16)));function Wn(t){const e=Te({},t),r=d=>p.hasOwnProp(e,d)?e[d]:void 0,n=r("data");let i=r("withXSRFToken");const o=r("xsrfHeaderName"),s=r("xsrfCookieName");let a=r("headers");const c=r("auth"),l=r("baseURL"),u=r("allowAbsoluteUrls"),f=r("url");if(e.headers=a=$.from(a),e.url=Ln(zn(l,f,u,e),r("params"),r("paramsSerializer")),c){const d=p.getSafeProp(c,"username")||"",h=p.getSafeProp(c,"password")||"";try{a.set("Authorization","Basic "+btoa(d+":"+(h?nc(h):"")))}catch(y){throw v.from(y,v.ERR_BAD_OPTION_VALUE,t)}}if(p.isFormData(n)){const d=p.getSafeProp(n,"getHeaders");M.hasStandardBrowserEnv||M.hasStandardBrowserWebWorkerEnv||p.isReactNative(n)?a.setContentType(void 0):p.isFunction(d)&&rc(a,d.call(n),r("formDataHeaderPolicy"))}if(M.hasStandardBrowserEnv&&(p.isFunction(i)&&(i=i(e)),i===!0||i==null&&Wa(e.url))){const h=o&&s&&Ka.read(s);h&&a.set(o,h)}return e}const ic=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const i=Wn(t);let o=i.data;const s=$.from(i.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:l}=i,u,f,d,h,y,S;function P(){h&&h(),y&&y(),i.cancelToken&&i.cancelToken.unsubscribe(u),i.signal&&i.signal.removeEventListener("abort",u)}let m=new XMLHttpRequest;m.open(i.method.toUpperCase(),i.url,!0),m.timeout=i.timeout;function b(E){if(!m)return;if(m.status===0&&(fr(jn(i.url))||fr(M.origin))!=="file"&&!(m.responseURL&&m.responseURL.startsWith("file:"))){n(new v("Request aborted",v.ECONNABORTED,t,m)),P(),m=null;return}try{E?S&&S(E):y&&y()}catch(H){setTimeout(()=>{throw H})}if(!m)return;const C=$.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),A={data:!a||a==="text"||a==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:C,config:t,request:m};$n(function(K){r(K),P()},function(K){n(K),P()},A),m=null}"onloadend"in m?m.onloadend=b:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.startsWith("file:"))||setTimeout(b)},m.onabort=function(){m&&(n(new v("Request aborted",v.ECONNABORTED,t,m)),P(),m=null)},m.onerror=function(C){const x=C&&C.message?C.message:"Network Error",A=new v(x,v.ERR_NETWORK,t,m);A.event=C||null,n(A),P(),m=null},m.ontimeout=function(){let C=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const x=i.transitional||ar;i.timeoutErrorMessage&&(C=i.timeoutErrorMessage),n(new v(C,x.clarifyTimeoutError?v.ETIMEDOUT:v.ECONNABORTED,t,m)),P(),m=null},o===void 0&&s.setContentType(null),"setRequestHeader"in m&&p.forEach(Tn(s),function(C,x){m.setRequestHeader(x,C)}),p.isUndefined(i.withCredentials)||(m.withCredentials=!!i.withCredentials),a&&a!=="json"&&(m.responseType=i.responseType),l&&([d,y,S]=Et(l,!0),m.addEventListener("progress",d)),c&&m.upload&&([f,h]=Et(c),m.upload.addEventListener("progress",f),m.upload.addEventListener("loadend",h)),(i.cancelToken||i.signal)&&(u=E=>{m&&(n(!E||E.type?new it(null,t,m):E),m.abort(),P(),m=null)},i.cancelToken&&i.cancelToken.subscribe(u),i.signal&&(i.signal.aborted?u():i.signal.addEventListener("abort",u)));const R=fr(i.url);if(R&&!M.protocols.includes(R)){n(new v("Unsupported protocol "+R+":",v.ERR_BAD_REQUEST,t)),P();return}m.send(o||null)})},oc=(t,e)=>{if(t=t?t.filter(Boolean):[],!e&&!t.length)return;const r=new AbortController;let n=!1;const i=function(c){if(!n){n=!0,s();const l=c instanceof Error?c:this.reason;r.abort(l instanceof v?l:new it(l instanceof Error?l.message:l))}};let o=e&&setTimeout(()=>{o=null,i(new v(`timeout of ${e}ms exceeded`,v.ETIMEDOUT))},e);const s=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(c=>{c.unsubscribe?c.unsubscribe(i):c.removeEventListener("abort",i)}),t=null)};t.forEach(c=>{if(!n){if(c.aborted){i.call(c);return}c.addEventListener("abort",i,{once:!0})}});const{signal:a}=r;return a.unsubscribe=()=>p.asap(s),a},sc=function*(t,e){let r=t.byteLength;if(r<e){yield t;return}let n=0,i;for(;n<r;)i=n+e,yield t.slice(n,i),n=i},ac=async function*(t,e){for await(const r of cc(t))yield*sc(r,e)},cc=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:r,value:n}=await e.read();if(r)break;yield n}}finally{await e.cancel()}},Kn=(t,e,r,n)=>{const i=ac(t,e);let o=0,s,a=c=>{s||(s=!0,n&&n(c))};return new ReadableStream({async pull(c){try{const{done:l,value:u}=await i.next();if(l){a(),c.close();return}let f=u.byteLength;if(r){let d=o+=f;r(d)}c.enqueue(new Uint8Array(u))}catch(l){throw a(l),l}},cancel(c){return a(c),i.return()}},{highWaterMark:2})},Jn=t=>t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102,Qn=(t,e,r)=>e+2<r&&Jn(t.charCodeAt(e+1))&&Jn(t.charCodeAt(e+2)),Xn=t=>t<=57?t-48:(t&223)-55,lc=t=>t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||t===43||t===47||t===45||t===95,uc=t=>t===9||t===10||t===12||t===13||t===32,fc=t=>{const e=Math.floor(t/4),r=t%4;return e*3+(r===2?1:r===3?2:0)},dc=t=>{const e=t.length;let r=0;return e>0&&t.charCodeAt(e-1)===61&&(r++,e>1&&t.charCodeAt(e-2)===61&&r++),Math.floor((e-r)*3/4)},pc=t=>{const e=t.length;let r=0,n=0,i=!1;for(let o=0;o<e;o++){let s=t.charCodeAt(o);if(s===37&&Qn(t,o,e)&&(s=Xn(t.charCodeAt(o+1))*16+Xn(t.charCodeAt(o+2)),o+=2),!uc(s)){if(s===61){n++;continue}if(!lc(s)||n>0){i=!0;continue}r++}}return i||n>2||n>0&&(r+n)%4!==0||r%4===1?dc(t):fc(r)},hc=(t,e)=>{if(!t||typeof t!="string"||!t.startsWith("data:"))return 0;const r=t.indexOf(",");if(r<0)return 0;const n=t.slice(5,r),i=t.slice(r+1);if(/;base64/i.test(n))return e(i);let s=0;for(let a=0,c=i.length;a<c;a++){const l=i.charCodeAt(a);if(l===37&&Qn(i,a,c))s+=1,a+=2;else if(l<128)s+=1;else if(l<2048)s+=2;else if(l>=55296&&l<=56319&&a+1<c){const u=i.charCodeAt(a+1);u>=56320&&u<=57343?(s+=4,a++):s+=3}else s+=3}return s};function mc(t){const e=typeof t=="string"?t.indexOf("#"):-1;return hc(e===-1?t:t.slice(0,e),pc)}const dr="1.20.0",Yn=64*1024,yc={cache:"default",redirect:"follow",referrer:"about:client",referrerPolicy:"",mode:"cors",integrity:"",keepalive:!1,priority:"auto",window:null},{isFunction:Tt}=p,gc=t=>encodeURIComponent(t).replace(/%([0-9A-F]{2})/gi,(e,r)=>String.fromCharCode(parseInt(r,16))),Zn=t=>{if(!p.isString(t))return t;try{return decodeURIComponent(t)}catch{return t}},ei=(t,...e)=>{try{return!!t(...e)}catch{return!1}},Sc=t=>{const e=t.indexOf("://");let r=t;return e!==-1&&(r=r.slice(e+3)),r.includes("@")||r.includes(":")},vc=t=>{const e=p.global!==void 0&&p.global!==null?p.global:globalThis,{ReadableStream:r,TextEncoder:n}=e;t=p.merge.call({skipUndefined:!0},{Request:e.Request,Response:e.Response},t);const{fetch:i,Request:o,Response:s}=t,a=i?Tt(i):typeof fetch=="function",c=Tt(o),l=Tt(s);if(!a)return!1;const u=a&&Tt(r),f=a&&(typeof n=="function"?(m=>b=>m.encode(b))(new n):async m=>new Uint8Array(await new o(m).arrayBuffer())),d=c&&u&&ei(()=>{let m=!1;const b=new o(M.origin,{body:new r,method:"POST",get duplex(){return m=!0,"half"}}),R=b.headers.has("Content-Type");return b.body!=null&&b.body.cancel(),m&&!R}),h=l&&u&&ei(()=>p.isReadableStream(new s("").body)),y={stream:h&&(m=>m.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!y[m]&&(y[m]=(b,R)=>{let E=b&&b[m];if(E)return E.call(b);throw new v(`Response type '${m}' is not supported`,v.ERR_NOT_SUPPORT,R)})});const S=async m=>{if(m==null)return 0;if(p.isBlob(m))return m.size;if(p.isSpecCompliantForm(m))return(await new o(M.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if(p.isArrayBufferView(m)||p.isArrayBuffer(m))return m.byteLength;if(p.isURLSearchParams(m)&&(m=m+""),p.isString(m))return(await f(m)).byteLength},P=async(m,b)=>{const R=p.toFiniteNumber(m.getContentLength());return R??S(b)};return async m=>{let{url:b,method:R,data:E,signal:C,cancelToken:x,timeout:A,onDownloadProgress:H,onUploadProgress:K,responseType:Y,headers:J,withCredentials:Q="same-origin",fetchOptions:Z,maxContentLength:B,maxBodyLength:ne,maxRedirects:ve}=Wn(m);const ee=p.isNumber(B)&&B>-1,Ke=p.isNumber(ne)&&ne>-1,mt=_=>p.hasOwnProp(m,_)?m[_]:void 0;let Xt=i||fetch;Y=Y?(Y+"").toLowerCase():"text";let ie=oc([C,x&&x.toAbortSignal()],A),L=null;const Le=ie&&ie.unsubscribe&&(()=>{ie.unsubscribe()});let Je,yt=null;const gs=()=>new v("Request body larger than maxBodyLength limit",v.ERR_BAD_REQUEST,m,L);try{let _;const re=mt("auth");if(re){const O=p.getSafeProp(re,"username")||"",V=p.getSafeProp(re,"password")||"";_={username:O,password:V}}if(Sc(b)){const O=new URL(b,M.origin);if(!_&&(O.username||O.password)){const V=Zn(O.username),be=Zn(O.password);_={username:V,password:be}}(O.username||O.password)&&(O.username="",O.password="",b=O.href)}if(_&&(J.delete("authorization"),J.set("Authorization","Basic "+btoa(gc((_.username||"")+":"+(_.password||""))))),ee&&typeof b=="string"&&b.startsWith("data:")&&mc(b)>B)throw new v("maxContentLength size of "+B+" exceeded",v.ERR_BAD_RESPONSE,m,L);if(Ke&&R!=="get"&&R!=="head"){const O=await S(E);if(typeof O=="number"&&isFinite(O)&&(Je=O,O>ne))throw gs()}const Yt=Ke&&(p.isReadableStream(E)||p.isStream(E)),Ss=(O,V,be)=>Kn(O,Yn,xe=>{if(Ke&&xe>ne)throw yt=gs();V&&V(xe)},be);if(d&&R!=="get"&&R!=="head"&&(K||Yt)){if(Je=Je??await P(J,E),Je!==0||Yt){let O=new o(b,{method:"POST",body:E,duplex:"half"}),V;if(p.isFormData(E)&&(V=O.headers.get("content-type"))&&J.setContentType(V),O.body){const[be,xe]=K&&Hn(Je,Et(Vn(K)))||[];E=Ss(O.body,be,xe)}}}else if(Yt&&!c&&u&&R!=="get"&&R!=="head")E=Ss(E);else if(Yt&&c&&!d&&R!=="get"&&R!=="head")throw new v("Stream request bodies are not supported by the current fetch implementation",v.ERR_NOT_SUPPORT,m,L);p.isString(Q)||(Q=Q?"include":"omit");const pd=c&&"credentials"in o.prototype;if(p.isFormData(E)){const O=J.getContentType();O&&/^multipart\/form-data/i.test(O)&&!/boundary=/i.test(O)&&J.delete("content-type")}J.set("User-Agent","axios/"+dr,!1);const oe=Z==null?Z:Object.assign(Object.create(null),Z);oe&&(delete oe.body,delete oe.headers,delete oe.method,delete oe.signal,delete oe.duplex,delete oe.credentials);const de=Object.assign(Object.create(null),oe,{signal:ie,method:R.toUpperCase(),headers:Tn(J.normalize()),body:E,duplex:"half",credentials:pd?Q:void 0});c&&(p.forEach(yc,(O,V)=>{de[V]===void 0&&(de[V]=O)}),de.signal===void 0&&(de.signal=null),de.body===void 0&&(de.body=null)),ve===0&&(de.redirect="manual",oe&&(oe.redirect="manual")),L=c&&new o(b,de);let pe=await(c?Xt(L,oe):Xt(b,de));const vs=$.from(pe.headers);if(ee){const O=p.toFiniteNumber(vs.getContentLength());if(O!=null&&O>B)throw new v("maxContentLength size of "+B+" exceeded",v.ERR_BAD_RESPONSE,m,L)}const un=h&&(Y==="stream"||Y==="response");if(h&&pe.body&&(H||ee||un&&Le)){const O={};["status","statusText","headers"].forEach(gt=>{O[gt]=pe[gt]});const V=p.toFiniteNumber(vs.getContentLength()),[be,xe]=H&&Hn(V,Et(Vn(H),!0))||[];let bs=0;const hd=gt=>{if(ee&&(bs=gt,bs>B))throw new v("maxContentLength size of "+B+" exceeded",v.ERR_BAD_RESPONSE,m,L);be&&be(gt)};pe=new s(Kn(pe.body,Yn,hd,()=>{xe&&xe(),Le&&Le()}),O)}Y=Y||"text";let he=await y[p.findKey(y,Y)||"text"](pe,m);if(ee&&!h&&!un){let O;if(he!=null&&(typeof he.byteLength=="number"?O=he.byteLength:typeof he.size=="number"?O=he.size:typeof he=="string"&&(O=typeof n=="function"?new n().encode(he).byteLength:he.length)),typeof O=="number"&&O>B)throw new v("maxContentLength size of "+B+" exceeded",v.ERR_BAD_RESPONSE,m,L)}return!un&&Le&&Le(),await new Promise((O,V)=>{$n(O,V,{data:he,headers:$.from(pe.headers),status:pe.status,statusText:pe.statusText,config:m,request:L})})}catch(_){if(Le&&Le(),ie&&ie.aborted&&ie.reason instanceof v){const re=ie.reason;throw re.config=m,L&&(re.request=L),_!==re&&Object.defineProperty(re,"cause",{__proto__:null,value:_,writable:!0,enumerable:!1,configurable:!0}),re}if(yt)throw L&&!yt.request&&(yt.request=L),yt;if(_ instanceof v)throw L&&!_.request&&(_.request=L),_;if(_&&_.name==="TypeError"&&/Load failed|fetch/i.test(_.message)){const re=new v("Network Error",v.ERR_NETWORK,m,L,_&&_.response);throw Object.defineProperty(re,"cause",{__proto__:null,value:_.cause||_,writable:!0,enumerable:!1,configurable:!0}),re}throw v.from(_,_&&_.code,m,L,_&&_.response)}}},bc=new Map,ti=t=>{let e=t&&t.env||{};const{fetch:r,Request:n,Response:i}=e,o=[n,i,r];let s=o.length,a=s,c,l,u=bc;for(;a--;)c=o[a],l=u.get(c),l===void 0&&u.set(c,l=a?new Map:vc(e)),u=l;return l};ti();const pr={http:xa,xhr:ic,fetch:{get:ti}};p.forEach(pr,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{__proto__:null,value:e})}catch{}Object.defineProperty(t,"adapterName",{__proto__:null,value:e})}});const ri=t=>`- ${t}`,Cc=t=>p.isFunction(t)||t===null||t===!1;function Rc(t,e){t=p.isArray(t)?t:[t];const{length:r}=t;let n,i;const o={};for(let s=0;s<r;s++){n=t[s];let a;if(i=n,!Cc(n)&&(i=pr[(a=String(n)).toLowerCase()],i===void 0))throw new v(`Unknown adapter '${a}'`);if(i&&(p.isFunction(i)||(i=i.get(e))))break;o[a||"#"+s]=i}if(!i){const s=Object.entries(o).map(([c,l])=>`adapter ${c} `+(l===!1?"is not supported by the environment":"is not available in the build"));let a=r?s.length>1?`since :
4
- `+s.map(ri).join(`
5
- `):" "+ri(s[0]):"as no adapter specified";throw new v("There is no suitable adapter to dispatch the request "+a,v.ERR_NOT_SUPPORT)}return i}const ni={getAdapter:Rc,adapters:pr};function hr(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new it(null,t)}function mr(t){const e=p.toSafeFlatObject(t);return hr(e),e.headers=$.from(p.getSafeProp(e,"headers")),e.data=ur.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),ni.getAdapter(e.adapter||nt.adapter,e)(e).then(function(i){hr(e),e.response=i;try{i.data=ur.call(e,e.transformResponse,i)}finally{delete e.response}return i.headers=$.from(i.headers),i},function(i){if(!Bn(i)&&(hr(e),i&&i.response)){e.response=i.response;try{i.response.data=ur.call(e,e.transformResponse,i.response)}finally{delete e.response}i.response.headers=$.from(i.response.headers)}return Promise.reject(i)})}const Pt={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Pt[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const ii={};Pt.transitional=function(e,r,n){function i(o,s){return"[Axios v"+dr+"] Transitional option '"+o+"'"+s+(n?". "+n:"")}return(o,s,a)=>{if(e===!1)throw new v(i(s," has been removed"+(r?" in "+r:"")),v.ERR_DEPRECATED);return r&&!ii[s]&&(ii[s]=!0,console.warn(i(s," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(o,s,a):!0}},Pt.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function Ec(t,e,r){if(typeof t!="object"||t===null)throw new v("options must be an object",v.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let i=n.length;for(;i-- >0;){const o=n[i],s=Object.prototype.hasOwnProperty.call(e,o)?e[o]:void 0;if(s){const a=t[o],c=a===void 0||s(a,o,t);if(c!==!0)throw new v("option "+o+" must be "+c,v.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new v("Unknown option "+o,v.ERR_BAD_OPTION)}}const Ot={assertOptions:Ec,validators:Pt},j=Ot.validators;let Pe=class{constructor(e){this.defaults=e||{},this.interceptors={request:new kn,response:new kn}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error)try{let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const o=i.stack;let s="";if(typeof o=="string"){const a=o.indexOf(`
1
+ (function(k,q){typeof exports=="object"&&typeof module<"u"?q(exports):typeof define=="function"&&define.amd?define(["exports"],q):(k=typeof globalThis<"u"?globalThis:k||self,q(k.mediaAV={}))})(this,function(k){"use strict";var gd=Object.defineProperty;var Sd=(k,q,Ie)=>q in k?gd(k,q,{enumerable:!0,configurable:!0,writable:!0,value:Ie}):k[q]=Ie;var y=(k,q,Ie)=>Sd(k,typeof q!="symbol"?q+"":q,Ie);var q=typeof document<"u"?document.currentScript:null;function Ie(t,e){for(var r=0;r<e.length;r++){const n=e[r];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in t)){const o=Object.getOwnPropertyDescriptor(n,i);o&&Object.defineProperty(t,i,o.get?o:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}function cn(t,e){return function(){return t.apply(e,arguments)}}const{toString:Ss}=Object.prototype,{getPrototypeOf:me}=Object,{iterator:Qe,toStringTag:ln}=Symbol,Xe=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),un=t=>typeof t=="string"&&(t==="__proto__"||t==="constructor"||t==="prototype"),fn=(t,e,r)=>t===Object.prototype||!r&&e===null,vs=t=>{if(!Object.isExtensible(t))return!1;const e=Object.getOwnPropertyNames(t);return Object.getOwnPropertySymbols&&e.push(...Object.getOwnPropertySymbols(t)),e.every(r=>{if(un(r))return!1;const n=Object.getOwnPropertyDescriptor(t,r);return!!n&&n.configurable&&n.writable===!0})},Ye=(t,e)=>{let r=t;const n=[];for(;r!=null;){if(n.indexOf(r)!==-1)return!1;n.push(r);const i=me(r);if(fn(r,i,r===t))return!1;if(Xe(r,e))return!0;r=i}return!1},bs=(t,e)=>t!=null&&Ye(t,e)?t[e]:void 0,Cs=t=>{if(t==null||typeof t!="object"&&typeof t!="function")return t;const e=me(t);if(e===null&&vs(t))return t;const r=Object.create(null),n=Object.create(null),i=[];let o=t;for(;o!=null&&i.indexOf(o)===-1;){i.push(o);const s=o===t?e:me(o);if(fn(o,s,o===t))break;const a=Object.getOwnPropertyNames(o);Object.getOwnPropertySymbols&&a.push(...Object.getOwnPropertySymbols(o));for(const c of a)un(c)||Xe(n,c)||(r[c]=t[c],n[c]=!0);o=s}return r},Zt=(t=>e=>{const r=Ss.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),te=t=>(t=t.toLowerCase(),e=>Zt(e)===t),St=t=>e=>typeof e===t,{isArray:Ce}=Array,Re=St("undefined");function ke(t){return t!==null&&!Re(t)&&t.constructor!==null&&!Re(t.constructor)&&W(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const dn=te("ArrayBuffer");function Rs(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&dn(t.buffer),e}const Es=St("string"),W=St("function"),pn=St("number"),Fe=t=>t!==null&&typeof t=="object",Ts=t=>t===!0||t===!1,vt=t=>{if(!Fe(t))return!1;const e=me(t);return(e===null||e===Object.prototype||me(e)===null)&&!Ye(t,ln)&&!Ye(t,Qe)},Ps=t=>{if(!Fe(t)||ke(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},Os=te("Date"),ws=te("File"),As=t=>!!(t&&typeof t.uri<"u"),_s=t=>t&&typeof t.getParts<"u",Ds=te("Blob"),Ls=te("FileList"),xs=te("Set"),Is=t=>Fe(t)&&W(t.pipe);function ks(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const hn=ks(),mn=typeof hn.FormData<"u"?hn.FormData:void 0,Fs=t=>{if(!t)return!1;if(mn&&t instanceof mn)return!0;const e=me(t);if(!e||e===Object.prototype||!W(t.append))return!1;const r=Zt(t);return r==="formdata"||r==="object"&&W(t.toString)&&t.toString()==="[object FormData]"},Us=te("URLSearchParams"),[Ms,Ns,Bs,$s]=["ReadableStream","Request","Response","Headers"].map(te),js=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ze(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),Ce(t))for(n=0,i=t.length;n<i;n++)e.call(null,t[n],n,t);else{if(ke(t))return;const o=r?Object.getOwnPropertyNames(t):Object.keys(t),s=o.length;let a;for(n=0;n<s;n++)a=o[n],e.call(null,t[a],a,t)}}function yn(t,e){if(ke(t))return null;e=e.toLowerCase();const r=Object.keys(t);let n=r.length,i;for(;n-- >0;)if(i=r[n],e===i.toLowerCase())return i;return null}const Ee=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,gn=t=>!Re(t)&&t!==Ee;function er(...t){const{caseless:e,skipUndefined:r}=gn(this)&&this||{},n={},i=(o,s)=>{if(s==="__proto__"||s==="constructor"||s==="prototype")return;const a=e&&typeof s=="string"&&yn(n,s)||s,c=Xe(n,a)?n[a]:void 0;vt(c)&&vt(o)?n[a]=er(c,o):vt(o)?n[a]=er({},o):Ce(o)?n[a]=o.slice():(!r||!Re(o))&&(n[a]=o)};for(let o=0,s=t.length;o<s;o++){const a=t[o];if(!a||ke(a)||(Ze(a,i),typeof a!="object"||Ce(a)))continue;const c=Object.getOwnPropertySymbols(a);for(let l=0;l<c.length;l++){const u=c[l];Zs.call(a,u)&&i(a[u],u)}}return n}const Hs=(t,e,r,{allOwnKeys:n}={})=>(Ze(e,(i,o)=>{r&&W(i)?Object.defineProperty(t,o,{__proto__:null,value:cn(i,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,o,{__proto__:null,value:i,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),t),Vs=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),qs=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),Object.defineProperty(t.prototype,"constructor",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{__proto__:null,value:e.prototype}),r&&Object.assign(t.prototype,r)},zs=(t,e,r,n)=>{let i,o,s;const a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),o=i.length;o-- >0;)s=i[o],(!n||n(s,t,e))&&!a[s]&&(e[s]=t[s],a[s]=!0);t=r!==!1&&me(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},Gs=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},Ws=t=>{if(!t)return null;if(Ce(t))return t;let e=t.length;if(!pn(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},Ks=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&me(Uint8Array)),Js=(t,e)=>{const n=(t&&t[Qe]).call(t);let i;for(;(i=n.next())&&!i.done;){const o=i.value;e.call(t,o[0],o[1])}},Qs=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},Xs=te("HTMLFormElement"),Ys=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),{propertyIsEnumerable:Zs}=Object.prototype,ea=te("RegExp"),Sn=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};Ze(r,(i,o)=>{let s;(s=e(i,o,t))!==!1&&(n[o]=s||i)}),Object.defineProperties(t,n)},ta=t=>{Sn(t,(e,r)=>{if(W(t)&&["arguments","caller","callee"].includes(r))return!1;const n=t[r];if(W(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},ra=(t,e)=>{const r={},n=i=>{i.forEach(o=>{r[o]=!0})};return Ce(t)?n(t):n(String(t).split(e)),r},na=()=>{},ia=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function oa(t){return!!(t&&W(t.append)&&t[ln]==="FormData"&&t[Qe])}const sa=t=>{const e=new WeakSet,r=n=>{if(Fe(n)){if(e.has(n))return;if(ke(n))return n;if(!("toJSON"in n)){e.add(n);let i;if(xs(n)){i=[];for(const o of n){const s=r(o);!Re(s)&&i.push(s)}}else i=Ce(n)?[]:{},Ze(n,(o,s)=>{const a=r(o);!Re(a)&&(i[s]=a)});return e.delete(n),i}}return n};return r(t)},aa=te("AsyncFunction"),ca=t=>t&&(Fe(t)||W(t))&&W(t.then)&&W(t.catch),vn=((t,e)=>t?setImmediate:e?((r,n)=>(Ee.addEventListener("message",({source:i,data:o})=>{i===Ee&&o===r&&n.length&&n.shift()()},!1),i=>{n.push(i),Ee.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",W(Ee.postMessage)),la=typeof queueMicrotask<"u"?queueMicrotask.bind(Ee):typeof process<"u"&&process.nextTick||vn,bn=t=>t!=null&&W(t[Qe]),d={isArray:Ce,isArrayBuffer:dn,isBuffer:ke,isFormData:Fs,isArrayBufferView:Rs,isString:Es,isNumber:pn,isBoolean:Ts,isObject:Fe,isPlainObject:vt,isEmptyObject:Ps,isReadableStream:Ms,isRequest:Ns,isResponse:Bs,isHeaders:$s,isUndefined:Re,isDate:Os,isFile:ws,isReactNativeBlob:As,isReactNative:_s,isBlob:Ds,isRegExp:ea,isFunction:W,isStream:Is,isURLSearchParams:Us,isTypedArray:Ks,isFileList:Ls,forEach:Ze,merge:er,extend:Hs,trim:js,stripBOM:Vs,inherits:qs,toFlatObject:zs,kindOf:Zt,kindOfTest:te,endsWith:Gs,toArray:Ws,forEachEntry:Js,matchAll:Qs,isHTMLForm:Xs,hasOwnProperty:Xe,hasOwnProp:Xe,hasOwnInPrototypeChain:Ye,getSafeProp:bs,toSafeFlatObject:Cs,reduceDescriptors:Sn,freezeMethods:ta,toObjectSet:ra,toCamelCase:Ys,noop:na,toFiniteNumber:ia,findKey:yn,global:Ee,isContextDefined:gn,isSpecCompliantForm:oa,toJSONObject:sa,isAsyncFn:aa,isThenable:ca,setImmediate:vn,asap:la,isIterable:bn,isSafeIterable:t=>t!=null&&Ye(t,Qe)&&bn(t)},ua=d.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"]),fa=t=>{const e={};let r,n,i;return t&&t.split(`
2
+ `).forEach(function(s){i=s.indexOf(":"),r=s.substring(0,i).trim().toLowerCase(),n=s.substring(i+1).trim();const a=d.hasOwnProp(e,r);!r||a&&d.hasOwnProp(ua,r)||(r==="set-cookie"?a?e[r].push(n):e[r]=[n]:e[r]=a?e[r]+", "+n:n)}),e};function da(t){let e=0,r=t.length;for(;e<r;){const n=t.charCodeAt(e);if(n!==9&&n!==32)break;e+=1}for(;r>e;){const n=t.charCodeAt(r-1);if(n!==9&&n!==32)break;r-=1}return e===0&&r===t.length?t:t.slice(e,r)}const pa=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),ha=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function tr(t,e){return d.isArray(t)?t.map(r=>tr(r,e)):da(String(t).replace(e,""))}const ma=t=>tr(t,pa),ya=t=>tr(t,ha);function Cn(t){const e=Object.create(null);return d.forEach(t.toJSON(),(r,n)=>{e[n]=ya(r)}),e}const Rn=Symbol("internals");function et(t){return t&&String(t).trim().toLowerCase()}function bt(t){return t===!1||t==null?t:d.isArray(t)?t.map(bt):ma(String(t))}function ga(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const Sa=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function rr(t){let e=0,r=t.length;for(;e<r;){const n=t.charCodeAt(e);if(n!==9&&n!==32)break;e+=1}for(;r>e;){const n=t.charCodeAt(r-1);if(n!==9&&n!==32)break;r-=1}return e===0&&r===t.length?t:t.slice(e,r)}function va(t){const e=t.length-1;if(e<1||t.charCodeAt(0)!==34||t.charCodeAt(e)!==34)return t;let r="";for(let n=1;n<e;n++){const i=t.charCodeAt(n);if(i===34||i===92&&(n+=1,n>=e))return t;r+=t[n]}return r}function ba(t){const e=Object.create(null),r=String(t);let n=0,i=!1,o=!1;function s(a){const c=rr(r.slice(n,a)),l=c.indexOf("=");if(l<1)return;const u=rr(c.slice(0,l));if(!Sa.test(u))return;const f=u.toLowerCase();if(f==="__proto__"||f==="constructor"||f==="prototype")return;const p=rr(c.slice(l+1));e[f]=va(p)}for(let a=0;a<r.length;a++){const c=r.charCodeAt(a);i?o?o=!1:c===92?o=!0:c===34&&(i=!1):c===34?i=!0:(c===44||c===59)&&(s(a),n=a+1)}return s(r.length),e}const Ca=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function nr(t,e,r,n,i){if(d.isFunction(n))return n.call(this,e,r);if(i&&(e=r),!!d.isString(e)){if(d.isString(n))return e.indexOf(n)!==-1;if(d.isRegExp(n))return n.test(e)}}function Ra(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function Ea(t,e){const r=d.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{__proto__:null,value:function(i,o,s){return this[n].call(this,e,i,o,s)},configurable:!0})})}let $=class{constructor(e){e&&this.set(e)}set(e,r,n){const i=this;function o(a,c,l){const u=et(c);if(!u)return;const f=d.findKey(i,u);(!f||i[f]===void 0||l===!0||l===void 0&&i[f]!==!1)&&(i[f||c]=bt(a))}const s=(a,c)=>d.forEach(a,(l,u)=>o(l,u,c));if(d.isPlainObject(e)||e instanceof this.constructor)s(e,r);else if(d.isString(e)&&(e=e.trim())&&!Ca(e))s(fa(e),r);else if(d.isObject(e)&&d.isSafeIterable(e)){let a=Object.create(null),c,l;for(const u of e){if(!d.isArray(u))throw new TypeError("Object iterator must return a key-value pair");l=u[0],d.hasOwnProp(a,l)?(c=a[l],a[l]=d.isArray(c)?[...c,u[1]]:[c,u[1]]):a[l]=u[1]}s(a,r)}else e!=null&&o(r,e,n);return this}get(e,r){if(e=et(e),e){const n=d.findKey(this,e);if(n){const i=this[n];if(!r)return i;if(r===!0)return ga(i);if(d.isFunction(r))return r.call(this,i,n);if(d.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=et(e),e){const n=d.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||nr(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let i=!1;function o(s){if(s=et(s),s){const a=d.findKey(n,s);a&&(!r||nr(n,n[a],a,r))&&(delete n[a],i=!0)}}return d.isArray(e)?e.forEach(o):o(e),i}clear(e){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const o=r[n];(!e||nr(this,this[o],o,e,!0))&&(delete this[o],i=!0)}return i}normalize(e){const r=this,n={};return d.forEach(this,(i,o)=>{const s=d.findKey(n,o);if(s){r[s]=bt(i),delete r[o];return}const a=e?Ra(o):String(o).trim();a!==o&&delete r[o],r[a]=bt(i),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return d.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=e&&d.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(`
3
+ `)}getSetCookie(){const e=this.get("set-cookie");return d.isArray(e)?e:e==null||e===!1?[]:[e]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static parseParameters(e){return ba(e)}static concat(e,...r){const n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){const n=(this[Rn]=this[Rn]={accessors:{}}).accessors,i=this.prototype;function o(s){const a=et(s);n[a]||(Ea(i,s),n[a]=!0)}return d.isArray(e)?e.forEach(o):o(e),this}};$.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),d.reduceDescriptors($.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),d.freezeMethods($);const Ct="[REDACTED ****]";function Ta(t){if(d.hasOwnProp(t,"toJSON"))return!0;let e=Object.getPrototypeOf(t);for(;e&&e!==Object.prototype;){if(d.hasOwnProp(e,"toJSON"))return!0;e=Object.getPrototypeOf(e)}return!1}function Pa(t,e){const r=new Set(e.map(o=>String(o).toLowerCase())),n=[],i=o=>{if(o===null||typeof o!="object"||d.isBuffer(o))return o;if(n.indexOf(o)!==-1)return;o instanceof $&&(o=o.toJSON()),n.push(o);let s;if(d.isArray(o))s=[],o.forEach((a,c)=>{const l=i(a);d.isUndefined(l)||(s[c]=l)});else{if(!d.isPlainObject(o)&&Ta(o))return n.pop(),o;s=Object.create(null);for(const[a,c]of Object.entries(o)){const l=r.has(a.toLowerCase())?Ct:i(c);d.isUndefined(l)||(s[a]=l)}}return n.pop(),s};return i(t)}function En(t){try{return String(t)}catch{return""}}function Oa(t){return t.errors.map(r=>{try{return r&&r.message?En(r.message):En(r)}catch{return""}}).filter(Boolean).join("; ")||t.name||"AggregateError"}let S=class ys extends Error{static from(e,r,n,i,o,s){let a=e.message;!a&&d.isArray(e.errors)&&e.errors.length&&(a=Oa(e));const c=new ys(a,r||e.code,n,i,o);return Object.defineProperty(c,"cause",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),c.name=e.name,e.status!=null&&c.status==null&&(c.status=e.status),s&&Object.assign(c,s),c}constructor(e,r,n,i,o){super(e),Object.defineProperty(this,"message",{__proto__:null,value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),n&&(this.config=n),i&&(this.request=i),o&&(this.response=o,this.status=o.status)}toJSON(){const e=this.config,r=e&&d.hasOwnProp(e,"redact")?e.redact:void 0,n=d.isArray(r)&&r.length>0?Pa(e,r):d.toJSONObject(e);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:n,code:this.code,status:this.status}}};S.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",S.ERR_BAD_OPTION="ERR_BAD_OPTION",S.ECONNABORTED="ECONNABORTED",S.ETIMEDOUT="ETIMEDOUT",S.ECONNREFUSED="ECONNREFUSED",S.ERR_NETWORK="ERR_NETWORK",S.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",S.ERR_DEPRECATED="ERR_DEPRECATED",S.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",S.ERR_BAD_REQUEST="ERR_BAD_REQUEST",S.ERR_CANCELED="ERR_CANCELED",S.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",S.ERR_INVALID_URL="ERR_INVALID_URL",S.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const wa=null,Tn=100;function ir(t){return d.isPlainObject(t)||d.isArray(t)}function Pn(t){return d.endsWith(t,"[]")?t.slice(0,-2):t}function or(t,e,r){return t?t.concat(e).map(function(i,o){return i=Pn(i),!r&&o?"["+i+"]":i}).join(r?".":""):e}function Aa(t){return d.isArray(t)&&!t.some(ir)}const _a=d.toFlatObject(d,{},null,function(e){return/^is[A-Z]/.test(e)});function Rt(t,e,r){if(!d.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const n=(b,R)=>{const E=d.getSafeProp(r,b);return d.isUndefined(E)?R:E},i=n("metaTokens",!0),o=n("visitor")||v,s=n("dots",!1),a=n("indexes",!1),c=n("Blob")||typeof Blob<"u"&&Blob,l=n("maxDepth",Tn),u=c&&d.isSpecCompliantForm(e),f=[];if(!d.isFunction(o))throw new TypeError("visitor must be a function");function p(b){if(b===null)return"";if(d.isDate(b))return b.toISOString();if(d.isBoolean(b))return b.toString();if(!u&&d.isBlob(b))throw new S("Blob is not supported. Use a Buffer instead.");if(d.isArrayBuffer(b)||d.isTypedArray(b)){if(u&&typeof c=="function")return new c([b]);throw new S("Blob is not supported. Use a Buffer instead.",S.ERR_NOT_SUPPORT)}return b}function h(b){if(b>l)throw new S("Object is too deeply nested ("+b+" levels). Max depth: "+l,S.ERR_FORM_DATA_DEPTH_EXCEEDED)}function g(b,R){if(l===1/0)return JSON.stringify(b);const E=[];return JSON.stringify(b,function(x,A){if(!d.isObject(A))return A;for(;E.length&&E[E.length-1]!==this;)E.pop();return E.push(A),h(R+E.length-1),A})}function v(b,R,E){let C=b;if(d.isReactNative(e)&&d.isReactNativeBlob(b))return e.append(or(E,R,s),p(b)),!1;if(b&&!E&&typeof b=="object"){if(d.endsWith(R,"{}"))R=i?R:R.slice(0,-2),b=g(b,1);else if(d.isArray(b)&&Aa(b)||(d.isFileList(b)||d.endsWith(R,"[]"))&&(C=d.toArray(b)))return R=Pn(R),C.forEach(function(A,H){!(d.isUndefined(A)||A===null)&&e.append(a===!0?or([R],H,s):a===null?R:R+"[]",p(A))}),!1}return ir(b)?!0:(e.append(or(E,R,s),p(b)),!1)}const O=Object.assign(_a,{defaultVisitor:v,convertValue:p,isVisitable:ir});function m(b,R,E=0){if(!d.isUndefined(b)){if(h(E),f.indexOf(b)!==-1)throw new Error("Circular reference detected in "+R.join("."));f.push(b),d.forEach(b,function(x,A){(!(d.isUndefined(x)||x===null)&&o.call(e,x,d.isString(A)?A.trim():A,R,O))===!0&&m(x,R?R.concat(A):[A],E+1)}),f.pop()}}if(!d.isObject(t))throw new TypeError("data must be an object");return m(t),e}function On(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(t).replace(/[!'()~]|%20/g,function(n){return e[n]})}function sr(t,e){this._pairs=[],t&&Rt(t,this,e)}const wn=sr.prototype;wn.append=function(e,r){this._pairs.push([e,r])},wn.toString=function(e){const r=e?n=>e.call(this,n,On):On;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function Da(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function An(t,e,r){if(!e)return t;t=t||"";const n=d.isFunction(r)?{serialize:r}:r,i=d.getSafeProp(n,"encode")||Da,o=d.getSafeProp(n,"serialize");let s;if(o?s=o(e,n):s=d.isURLSearchParams(e)?e.toString():new sr(e,n).toString(i),s){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}const tt=Symbol("internals");function _n(t){return t?t.length:0}function Dn(t){if(t)for(;t.length&&t[t.length-1]===null;)t.pop()}function rt(t,e){const r=t.handlers,n=_n(r);r!==e.handlersRef?(e.handlersRef=r,e.handlerEntries.clear()):n!==e.handlersLength&&(n?e.handlerEntries.forEach(function(o,s){r[o.index]!==o.handler&&e.handlerEntries.delete(s)}):e.handlerEntries.clear()),e.handlersLength=n}class Ln{constructor(){this.handlers=[],this[tt]={handlersRef:this.handlers,handlersLength:this.handlers.length,handlerEntries:new Map,iterationDepth:0,nextId:0}}use(e,r,n){const i={fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null},o=this[tt];this.handlers==null&&(this.handlers=[]),rt(this,o);const s=o.nextId++;return this.handlers.push(i),o.handlerEntries.set(s,{handler:i,index:this.handlers.length-1}),o.handlersLength=this.handlers.length,s}eject(e){const r=this[tt];rt(this,r);const n=r.handlerEntries.get(e);if(n){if(r.handlerEntries.delete(e),this.handlers[n.index]!==n.handler)return;this.handlers[n.index]=null,r.iterationDepth||(Dn(this.handlers),r.handlersLength=this.handlers.length)}}clear(){this.handlers&&(this.handlers=[],rt(this,this[tt]))}forEach(e){const r=this[tt];rt(this,r),r.iterationDepth++;try{d.forEach(this.handlers,function(i){i!==null&&e(i)})}finally{--r.iterationDepth||(rt(this,r),Dn(this.handlers),r.handlersLength=_n(this.handlers))}}}const ar={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},La={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:sr,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},cr=typeof window<"u"&&typeof document<"u",lr=typeof navigator=="object"&&navigator||void 0,xa=cr&&(!lr||["ReactNative","NativeScript","NS"].indexOf(lr.product)<0),Ia=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",ka=cr&&window.location.href||"http://localhost",M={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:cr,hasStandardBrowserEnv:xa,hasStandardBrowserWebWorkerEnv:Ia,navigator:lr,origin:ka},Symbol.toStringTag,{value:"Module"})),...La};function Fa(t,e){return Rt(t,new M.classes.URLSearchParams,{visitor:function(r,n,i,o){return M.isNode&&d.isBuffer(r)?(this.append(n,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...e})}const xn=Tn;function In(t){if(t>xn)throw new S("FormData field is too deeply nested ("+t+" levels). Max depth: "+xn,S.ERR_FORM_DATA_DEPTH_EXCEEDED)}function Ua(t){const e=[],r=/[^.[\]]+|\[([^.[\]]*)]/g;let n;for(;(n=r.exec(t))!==null;)In(e.length),e.push(n[0]==="[]"?"":n[1]||n[0]);return e}function Ma(t){const e={},r=Object.keys(t);let n;const i=r.length;let o;for(n=0;n<i;n++)o=r[n],e[o]=t[o];return e}function kn(t){function e(r,n,i,o){In(o);let s=r[o++];if(s==="__proto__")return!0;const a=Number.isFinite(+s),c=o>=r.length;return s=!s&&d.isArray(i)?i.length:s,c?(d.hasOwnProp(i,s)?i[s]=d.isArray(i[s])?i[s].concat(n):[i[s],n]:i[s]=n,!a):((!d.hasOwnProp(i,s)||!d.isObject(i[s]))&&(i[s]=[]),e(r,n,i[s],o)&&d.isArray(i[s])&&(i[s]=Ma(i[s])),!a)}if(d.isFormData(t)&&d.isFunction(t.entries)){const r={};return d.forEachEntry(t,(n,i)=>{e(Ua(n),i,r,0)}),r}return null}const Fn=Object.freeze(["get","delete","head","options","post","put","patch","purge","link","unlink","query"]),Ue=(t,e)=>t!=null&&d.hasOwnProp(t,e)?t[e]:void 0;function Na(t,e,r){if(d.isString(t))try{return(e||JSON.parse)(t),d.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const nt={transitional:ar,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,o=d.isObject(e);if(o&&d.isHTMLForm(e)&&(e=new FormData(e)),d.isFormData(e))return i?JSON.stringify(kn(e)):e;if(d.isArrayBuffer(e)||d.isBuffer(e)||d.isStream(e)||d.isFile(e)||d.isBlob(e)||d.isReadableStream(e))return e;if(d.isArrayBufferView(e))return e.buffer;if(d.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(o){const c=Ue(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return Fa(e,c).toString();if((a=d.isFileList(e))||n.indexOf("multipart/form-data")>-1){const l=Ue(this,"env"),u=l&&l.FormData;return Rt(a?{"files[]":e}:e,u&&new u,c)}}return o||i?(r.setContentType("application/json",!1),Na(e)):e}],transformResponse:[function(e){const r=Ue(this,"transitional")||nt.transitional,n=r&&r.forcedJSONParsing,i=Ue(this,"responseType"),o=i==="json";if(d.isResponse(e)||d.isReadableStream(e))return e;if(e&&d.isString(e)&&(n&&!i||o)){const a=!(r&&r.silentJSONParsing)&&o;try{return JSON.parse(e,Ue(this,"parseReviver"))}catch(c){if(a)throw c.name==="SyntaxError"?S.from(c,S.ERR_BAD_RESPONSE,this,null,Ue(this,"response")):c}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:M.classes.FormData,Blob:M.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};d.forEach(Fn,t=>{nt.headers[t]={}});function ur(t,e){const r=this||nt,n=e||r,i=$.from(n.headers);let o=n.data;return d.forEach(t,function(a){o=a.call(r,o,i.normalize(),e?e.status:void 0)}),i.normalize(),o}function Un(t){return!!(t&&t.__CANCEL__)}let it=class extends S{constructor(e,r,n){super(e??"canceled",S.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function Mn(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new S("Request failed with status code "+r.status,r.status>=400&&r.status<500?S.ERR_BAD_REQUEST:S.ERR_BAD_RESPONSE,r.config,r.request,r))}const Ba=/[\t\n\r]/g;function Nn(t){if(typeof t!="string")return t;let e=0;for(;e<t.length&&t.charCodeAt(e)<=32;)e++;return t.slice(e).replace(Ba,"")}function fr(t){const e=/^([-+\w]{1,25}):(?:\/\/)?/.exec(t);return e&&e[1]||""}function $a(t,e){t=t||10;const r=new Array(t),n=new Array(t);let i=0,o=0,s;return e=e!==void 0?e:1e3,function(c){const l=Date.now(),u=n[o];s||(s=l),r[i]=c,n[i]=l;let f=o,p=0;for(;f!==i;)p+=r[f++],f=f%t;if(i=(i+1)%t,i===o&&(o=(o+1)%t),l-s<e)return;const h=u&&l-u;return h?Math.round(p*1e3/h):void 0}}function ja(t,e){let r=0,n=1e3/e,i,o;const s=(u,f=Date.now())=>{r=f,i=null,o&&(clearTimeout(o),o=null),t(...u)};return[(...u)=>{const f=Date.now(),p=f-r;p>=n?s(u,f):(i=u,o||(o=setTimeout(()=>{o=null,s(i)},n-p)))},()=>i&&s(i),(...u)=>s(u)]}const Et=(t,e,r=3)=>{let n=0;const i=$a(50,250);return ja(o=>{if(!o||!d.isNumber(o.loaded))return;const s=o.loaded,a=o.lengthComputable?o.total:void 0,c=Math.max(0,a!=null?Math.min(s,a):s),l=Math.max(0,c-n),u=i(l);n=Math.max(n,c);const f={loaded:c,total:a,progress:a?c/a:void 0,bytes:l,rate:u||void 0,estimated:u&&a?(a-c)/u:void 0,event:o,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(f)},r)},Bn=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},$n=(t,e=d.asap)=>(...r)=>e(()=>t(...r)),Ha=M.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,M.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(M.origin),M.navigator&&/(msie|trident)/i.test(M.navigator.userAgent)):()=>!0,Va=M.hasStandardBrowserEnv?{write(t,e,r,n,i,o,s){if(typeof document>"u")return;const a=[`${t}=${encodeURIComponent(e)}`];d.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),d.isString(n)&&a.push(`path=${n}`),d.isString(i)&&a.push(`domain=${i}`),o===!0&&a.push("secure"),d.isString(s)&&a.push(`SameSite=${s}`),document.cookie=a.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.split(";");for(let r=0;r<e.length;r++){const n=e[r].replace(/^\s+/,""),i=n.indexOf("=");if(i!==-1&&n.slice(0,i)===t)try{return decodeURIComponent(n.slice(i+1))}catch{return n.slice(i+1)}}return null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function qa(t){return typeof t!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function za(t,e){if(!e)return t;let r=t.length;for(;r>0&&t.charCodeAt(r-1)===47;)r--;return t.slice(0,r)+"/"+e.replace(/^\/+/,"")}const Ga=/^https?:(?!\/\/)/i;function Wa(t){return t&&t.replace(/(^|&)([^=&]*=)?[^&]+/g,(e,r,n="")=>`${r}${n}${Ct}`)}function Ka(t){const e=t.replace(/^(https?:\/{0,2})[^/?#]*@/i,`$1${Ct}@`),r=e.indexOf("#"),i=(r===-1?e:e.slice(0,r)).replace(/([?&][^=&#]*=)[^&#]*/g,`$1${Ct}`);return r===-1?i:`${i}#${Wa(e.slice(r+1))}`}function jn(t,e){if(typeof t=="string"){const r=Nn(t);if(Ga.test(r))throw new S(`Invalid URL ${JSON.stringify(Ka(r))}: missing "//" after protocol`,S.ERR_INVALID_URL,e)}}function Hn(t,e,r,n){jn(e,n);let i=!qa(e);return t&&(i||r===!1)?(jn(t,n),za(t,e)):e}const Vn=t=>t instanceof $?{...t}:t,Ja=t=>Object.getOwnPropertySymbols&&Object.getOwnPropertyDescriptor?Object.keys(t).concat(Object.getOwnPropertySymbols(t).filter(e=>Object.getOwnPropertyDescriptor(t,e).enumerable)):Object.keys(t);function Te(t,e){t=t||{},e=e||{};const r=Object.create(null);Object.defineProperty(r,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function n(u,f,p,h){return d.isPlainObject(u)&&d.isPlainObject(f)?d.merge.call({caseless:h},u,f):d.isPlainObject(f)?d.merge({},f):d.isArray(f)?f.slice():f}function i(u,f,p,h){if(d.isUndefined(f)){if(!d.isUndefined(u))return n(void 0,u,p,h)}else return n(u,f,p,h)}function o(u,f){if(!d.isUndefined(f))return n(void 0,f)}function s(u,f){if(d.isUndefined(f)){if(!d.isUndefined(u))return n(void 0,u)}else return n(void 0,f)}function a(u){const f=d.hasOwnProp(e,"transitional")?e.transitional:void 0;if(!d.isUndefined(f))if(d.isPlainObject(f)){if(d.hasOwnProp(f,u))return f[u]}else return;const p=d.hasOwnProp(t,"transitional")?t.transitional:void 0;if(d.isPlainObject(p)&&d.hasOwnProp(p,u))return p[u]}function c(u,f,p){if(d.hasOwnProp(e,p))return n(u,f);if(d.hasOwnProp(t,p))return n(void 0,u)}const l={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutErrorMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,allowedSocketPaths:s,responseEncoding:s,validateStatus:c,headers:(u,f,p)=>i(Vn(u),Vn(f),p,!0)};return d.forEach(Ja({...t,...e}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;const p=d.hasOwnProp(l,f)?l[f]:i,h=d.hasOwnProp(t,f)?t[f]:void 0,g=d.hasOwnProp(e,f)?e[f]:void 0,v=p(h,g,f);d.isUndefined(v)&&p!==c||(r[f]=v)}),d.hasOwnProp(e,"validateStatus")&&d.isUndefined(e.validateStatus)&&a("validateStatusUndefinedResolves")===!1&&(d.hasOwnProp(t,"validateStatus")?r.validateStatus=n(void 0,t.validateStatus):delete r.validateStatus),r}const Qa=["content-type","content-length"];function Xa(t,e,r){if(r!=="content-only"){t.set(e);return}Object.entries(e||{}).forEach(([n,i])=>{Qa.includes(n.toLowerCase())&&t.set(n,i)})}const Ya=t=>encodeURIComponent(t).replace(/%([0-9A-F]{2})/gi,(e,r)=>String.fromCharCode(parseInt(r,16)));function qn(t){const e=Te({},t),r=p=>d.hasOwnProp(e,p)?e[p]:void 0,n=r("data");let i=r("withXSRFToken");const o=r("xsrfHeaderName"),s=r("xsrfCookieName");let a=r("headers");const c=r("auth"),l=r("baseURL"),u=r("allowAbsoluteUrls"),f=r("url");if(e.headers=a=$.from(a),e.url=An(Hn(l,f,u,e),r("params"),r("paramsSerializer")),c){const p=d.getSafeProp(c,"username")||"",h=d.getSafeProp(c,"password")||"";try{a.set("Authorization","Basic "+btoa(p+":"+(h?Ya(h):"")))}catch(g){throw S.from(g,S.ERR_BAD_OPTION_VALUE,t)}}if(d.isFormData(n)){const p=d.getSafeProp(n,"getHeaders");M.hasStandardBrowserEnv||M.hasStandardBrowserWebWorkerEnv||d.isReactNative(n)?a.setContentType(void 0):d.isFunction(p)&&Xa(a,p.call(n),r("formDataHeaderPolicy"))}if(M.hasStandardBrowserEnv&&(d.isFunction(i)&&(i=i(e)),i===!0||i==null&&Ha(e.url))){const h=o&&s&&Va.read(s);h&&a.set(o,h)}return e}const Za=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const i=qn(t);let o=i.data;const s=$.from(i.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:l}=i,u,f,p,h,g,v;function O(){h&&h(),g&&g(),i.cancelToken&&i.cancelToken.unsubscribe(u),i.signal&&i.signal.removeEventListener("abort",u)}let m=new XMLHttpRequest;m.open(i.method.toUpperCase(),i.url,!0),m.timeout=i.timeout;function b(E){if(!m)return;if(m.status===0&&(fr(Nn(i.url))||fr(M.origin))!=="file"&&!(m.responseURL&&m.responseURL.startsWith("file:"))){n(new S("Request aborted",S.ECONNABORTED,t,m)),O(),m=null;return}try{E?v&&v(E):g&&g()}catch(H){setTimeout(()=>{throw H})}if(!m)return;const C=$.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),A={data:!a||a==="text"||a==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:C,config:t,request:m};Mn(function(K){r(K),O()},function(K){n(K),O()},A),m=null}"onloadend"in m?m.onloadend=b:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.startsWith("file:"))||setTimeout(b)},m.onabort=function(){m&&(n(new S("Request aborted",S.ECONNABORTED,t,m)),O(),m=null)},m.onerror=function(C){const x=C&&C.message?C.message:"Network Error",A=new S(x,S.ERR_NETWORK,t,m);A.event=C||null,n(A),O(),m=null},m.ontimeout=function(){let C=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const x=i.transitional||ar;i.timeoutErrorMessage&&(C=i.timeoutErrorMessage),n(new S(C,x.clarifyTimeoutError?S.ETIMEDOUT:S.ECONNABORTED,t,m)),O(),m=null},o===void 0&&s.setContentType(null),"setRequestHeader"in m&&d.forEach(Cn(s),function(C,x){m.setRequestHeader(x,C)}),d.isUndefined(i.withCredentials)||(m.withCredentials=!!i.withCredentials),a&&a!=="json"&&(m.responseType=i.responseType),l&&([p,g,v]=Et(l,!0),m.addEventListener("progress",p)),c&&m.upload&&([f,h]=Et(c),m.upload.addEventListener("progress",f),m.upload.addEventListener("loadend",h)),(i.cancelToken||i.signal)&&(u=E=>{m&&(n(!E||E.type?new it(null,t,m):E),m.abort(),O(),m=null)},i.cancelToken&&i.cancelToken.subscribe(u),i.signal&&(i.signal.aborted?u():i.signal.addEventListener("abort",u)));const R=fr(i.url);if(R&&!M.protocols.includes(R)){n(new S("Unsupported protocol "+R+":",S.ERR_BAD_REQUEST,t)),O();return}m.send(o||null)})},ec=(t,e)=>{if(t=t?t.filter(Boolean):[],!e&&!t.length)return;const r=new AbortController;let n=!1;const i=function(c){if(!n){n=!0,s();const l=c instanceof Error?c:this.reason;r.abort(l instanceof S?l:new it(l instanceof Error?l.message:l))}};let o=e&&setTimeout(()=>{o=null,i(new S(`timeout of ${e}ms exceeded`,S.ETIMEDOUT))},e);const s=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(c=>{c.unsubscribe?c.unsubscribe(i):c.removeEventListener("abort",i)}),t=null)};t.forEach(c=>{if(!n){if(c.aborted){i.call(c);return}c.addEventListener("abort",i,{once:!0})}});const{signal:a}=r;return a.unsubscribe=()=>d.asap(s),a},tc=function*(t,e){let r=t.byteLength;if(r<e){yield t;return}let n=0,i;for(;n<r;)i=n+e,yield t.slice(n,i),n=i},rc=async function*(t,e){for await(const r of nc(t))yield*tc(r,e)},nc=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:r,value:n}=await e.read();if(r)break;yield n}}finally{await e.cancel()}},zn=(t,e,r,n)=>{const i=rc(t,e);let o=0,s,a=c=>{s||(s=!0,n&&n(c))};return new ReadableStream({async pull(c){try{const{done:l,value:u}=await i.next();if(l){a(),c.close();return}let f=u.byteLength;if(r){let p=o+=f;r(p)}c.enqueue(new Uint8Array(u))}catch(l){throw a(l),l}},cancel(c){return a(c),i.return()}},{highWaterMark:2})},Gn=t=>t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102,Wn=(t,e,r)=>e+2<r&&Gn(t.charCodeAt(e+1))&&Gn(t.charCodeAt(e+2)),Kn=t=>t<=57?t-48:(t&223)-55,ic=t=>t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||t===43||t===47||t===45||t===95,oc=t=>t===9||t===10||t===12||t===13||t===32,sc=t=>{const e=Math.floor(t/4),r=t%4;return e*3+(r===2?1:r===3?2:0)},ac=t=>{const e=t.length;let r=0;return e>0&&t.charCodeAt(e-1)===61&&(r++,e>1&&t.charCodeAt(e-2)===61&&r++),Math.floor((e-r)*3/4)},cc=t=>{const e=t.length;let r=0,n=0,i=!1;for(let o=0;o<e;o++){let s=t.charCodeAt(o);if(s===37&&Wn(t,o,e)&&(s=Kn(t.charCodeAt(o+1))*16+Kn(t.charCodeAt(o+2)),o+=2),!oc(s)){if(s===61){n++;continue}if(!ic(s)||n>0){i=!0;continue}r++}}return i||n>2||n>0&&(r+n)%4!==0||r%4===1?ac(t):sc(r)},lc=(t,e)=>{if(!t||typeof t!="string"||!t.startsWith("data:"))return 0;const r=t.indexOf(",");if(r<0)return 0;const n=t.slice(5,r),i=t.slice(r+1);if(/;base64/i.test(n))return e(i);let s=0;for(let a=0,c=i.length;a<c;a++){const l=i.charCodeAt(a);if(l===37&&Wn(i,a,c))s+=1,a+=2;else if(l<128)s+=1;else if(l<2048)s+=2;else if(l>=55296&&l<=56319&&a+1<c){const u=i.charCodeAt(a+1);u>=56320&&u<=57343?(s+=4,a++):s+=3}else s+=3}return s};function uc(t){const e=typeof t=="string"?t.indexOf("#"):-1;return lc(e===-1?t:t.slice(0,e),cc)}const dr="1.20.0",Jn=64*1024,fc={cache:"default",redirect:"follow",referrer:"about:client",referrerPolicy:"",mode:"cors",integrity:"",keepalive:!1,priority:"auto",window:null},{isFunction:Tt}=d,dc=t=>encodeURIComponent(t).replace(/%([0-9A-F]{2})/gi,(e,r)=>String.fromCharCode(parseInt(r,16))),Qn=t=>{if(!d.isString(t))return t;try{return decodeURIComponent(t)}catch{return t}},Xn=(t,...e)=>{try{return!!t(...e)}catch{return!1}},pc=t=>{const e=t.indexOf("://");let r=t;return e!==-1&&(r=r.slice(e+3)),r.includes("@")||r.includes(":")},hc=t=>{const e=d.global!==void 0&&d.global!==null?d.global:globalThis,{ReadableStream:r,TextEncoder:n}=e;t=d.merge.call({skipUndefined:!0},{Request:e.Request,Response:e.Response},t);const{fetch:i,Request:o,Response:s}=t,a=i?Tt(i):typeof fetch=="function",c=Tt(o),l=Tt(s);if(!a)return!1;const u=a&&Tt(r),f=a&&(typeof n=="function"?(m=>b=>m.encode(b))(new n):async m=>new Uint8Array(await new o(m).arrayBuffer())),p=c&&u&&Xn(()=>{let m=!1;const b=new o(M.origin,{body:new r,method:"POST",get duplex(){return m=!0,"half"}}),R=b.headers.has("Content-Type");return b.body!=null&&b.body.cancel(),m&&!R}),h=l&&u&&Xn(()=>d.isReadableStream(new s("").body)),g={stream:h&&(m=>m.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!g[m]&&(g[m]=(b,R)=>{let E=b&&b[m];if(E)return E.call(b);throw new S(`Response type '${m}' is not supported`,S.ERR_NOT_SUPPORT,R)})});const v=async m=>{if(m==null)return 0;if(d.isBlob(m))return m.size;if(d.isSpecCompliantForm(m))return(await new o(M.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if(d.isArrayBufferView(m)||d.isArrayBuffer(m))return m.byteLength;if(d.isURLSearchParams(m)&&(m=m+""),d.isString(m))return(await f(m)).byteLength},O=async(m,b)=>{const R=d.toFiniteNumber(m.getContentLength());return R??v(b)};return async m=>{let{url:b,method:R,data:E,signal:C,cancelToken:x,timeout:A,onDownloadProgress:H,onUploadProgress:K,responseType:Y,headers:J,withCredentials:Q="same-origin",fetchOptions:Z,maxContentLength:B,maxBodyLength:ne,maxRedirects:ve}=qn(m);const ee=d.isNumber(B)&&B>-1,Ke=d.isNumber(ne)&&ne>-1,mt=_=>d.hasOwnProp(m,_)?m[_]:void 0;let Xt=i||fetch;Y=Y?(Y+"").toLowerCase():"text";let ie=ec([C,x&&x.toAbortSignal()],A),L=null;const Le=ie&&ie.unsubscribe&&(()=>{ie.unsubscribe()});let Je,yt=null;const ds=()=>new S("Request body larger than maxBodyLength limit",S.ERR_BAD_REQUEST,m,L);try{let _;const re=mt("auth");if(re){const P=d.getSafeProp(re,"username")||"",V=d.getSafeProp(re,"password")||"";_={username:P,password:V}}if(pc(b)){const P=new URL(b,M.origin);if(!_&&(P.username||P.password)){const V=Qn(P.username),be=Qn(P.password);_={username:V,password:be}}(P.username||P.password)&&(P.username="",P.password="",b=P.href)}if(_&&(J.delete("authorization"),J.set("Authorization","Basic "+btoa(dc((_.username||"")+":"+(_.password||""))))),ee&&typeof b=="string"&&b.startsWith("data:")&&uc(b)>B)throw new S("maxContentLength size of "+B+" exceeded",S.ERR_BAD_RESPONSE,m,L);if(Ke&&R!=="get"&&R!=="head"){const P=await v(E);if(typeof P=="number"&&isFinite(P)&&(Je=P,P>ne))throw ds()}const Yt=Ke&&(d.isReadableStream(E)||d.isStream(E)),ps=(P,V,be)=>zn(P,Jn,xe=>{if(Ke&&xe>ne)throw yt=ds();V&&V(xe)},be);if(p&&R!=="get"&&R!=="head"&&(K||Yt)){if(Je=Je??await O(J,E),Je!==0||Yt){let P=new o(b,{method:"POST",body:E,duplex:"half"}),V;if(d.isFormData(E)&&(V=P.headers.get("content-type"))&&J.setContentType(V),P.body){const[be,xe]=K&&Bn(Je,Et($n(K)))||[];E=ps(P.body,be,xe)}}}else if(Yt&&!c&&u&&R!=="get"&&R!=="head")E=ps(E);else if(Yt&&c&&!p&&R!=="get"&&R!=="head")throw new S("Stream request bodies are not supported by the current fetch implementation",S.ERR_NOT_SUPPORT,m,L);d.isString(Q)||(Q=Q?"include":"omit");const md=c&&"credentials"in o.prototype;if(d.isFormData(E)){const P=J.getContentType();P&&/^multipart\/form-data/i.test(P)&&!/boundary=/i.test(P)&&J.delete("content-type")}J.set("User-Agent","axios/"+dr,!1);const oe=Z==null?Z:Object.assign(Object.create(null),Z);oe&&(delete oe.body,delete oe.headers,delete oe.method,delete oe.signal,delete oe.duplex,delete oe.credentials);const de=Object.assign(Object.create(null),oe,{signal:ie,method:R.toUpperCase(),headers:Cn(J.normalize()),body:E,duplex:"half",credentials:md?Q:void 0});c&&(d.forEach(fc,(P,V)=>{de[V]===void 0&&(de[V]=P)}),de.signal===void 0&&(de.signal=null),de.body===void 0&&(de.body=null)),ve===0&&(de.redirect="manual",oe&&(oe.redirect="manual")),L=c&&new o(b,de);let pe=await(c?Xt(L,oe):Xt(b,de));const hs=$.from(pe.headers);if(ee){const P=d.toFiniteNumber(hs.getContentLength());if(P!=null&&P>B)throw new S("maxContentLength size of "+B+" exceeded",S.ERR_BAD_RESPONSE,m,L)}const an=h&&(Y==="stream"||Y==="response");if(h&&pe.body&&(H||ee||an&&Le)){const P={};["status","statusText","headers"].forEach(gt=>{P[gt]=pe[gt]});const V=d.toFiniteNumber(hs.getContentLength()),[be,xe]=H&&Bn(V,Et($n(H),!0))||[];let ms=0;const yd=gt=>{if(ee&&(ms=gt,ms>B))throw new S("maxContentLength size of "+B+" exceeded",S.ERR_BAD_RESPONSE,m,L);be&&be(gt)};pe=new s(zn(pe.body,Jn,yd,()=>{xe&&xe(),Le&&Le()}),P)}Y=Y||"text";let he=await g[d.findKey(g,Y)||"text"](pe,m);if(ee&&!h&&!an){let P;if(he!=null&&(typeof he.byteLength=="number"?P=he.byteLength:typeof he.size=="number"?P=he.size:typeof he=="string"&&(P=typeof n=="function"?new n().encode(he).byteLength:he.length)),typeof P=="number"&&P>B)throw new S("maxContentLength size of "+B+" exceeded",S.ERR_BAD_RESPONSE,m,L)}return!an&&Le&&Le(),await new Promise((P,V)=>{Mn(P,V,{data:he,headers:$.from(pe.headers),status:pe.status,statusText:pe.statusText,config:m,request:L})})}catch(_){if(Le&&Le(),ie&&ie.aborted&&ie.reason instanceof S){const re=ie.reason;throw re.config=m,L&&(re.request=L),_!==re&&Object.defineProperty(re,"cause",{__proto__:null,value:_,writable:!0,enumerable:!1,configurable:!0}),re}if(yt)throw L&&!yt.request&&(yt.request=L),yt;if(_ instanceof S)throw L&&!_.request&&(_.request=L),_;if(_&&_.name==="TypeError"&&/Load failed|fetch/i.test(_.message)){const re=new S("Network Error",S.ERR_NETWORK,m,L,_&&_.response);throw Object.defineProperty(re,"cause",{__proto__:null,value:_.cause||_,writable:!0,enumerable:!1,configurable:!0}),re}throw S.from(_,_&&_.code,m,L,_&&_.response)}}},mc=new Map,Yn=t=>{let e=t&&t.env||{};const{fetch:r,Request:n,Response:i}=e,o=[n,i,r];let s=o.length,a=s,c,l,u=mc;for(;a--;)c=o[a],l=u.get(c),l===void 0&&u.set(c,l=a?new Map:hc(e)),u=l;return l};Yn();const pr={http:wa,xhr:Za,fetch:{get:Yn}};d.forEach(pr,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{__proto__:null,value:e})}catch{}Object.defineProperty(t,"adapterName",{__proto__:null,value:e})}});const Zn=t=>`- ${t}`,yc=t=>d.isFunction(t)||t===null||t===!1;function gc(t,e){t=d.isArray(t)?t:[t];const{length:r}=t;let n,i;const o={};for(let s=0;s<r;s++){n=t[s];let a;if(i=n,!yc(n)&&(i=pr[(a=String(n)).toLowerCase()],i===void 0))throw new S(`Unknown adapter '${a}'`);if(i&&(d.isFunction(i)||(i=i.get(e))))break;o[a||"#"+s]=i}if(!i){const s=Object.entries(o).map(([c,l])=>`adapter ${c} `+(l===!1?"is not supported by the environment":"is not available in the build"));let a=r?s.length>1?`since :
4
+ `+s.map(Zn).join(`
5
+ `):" "+Zn(s[0]):"as no adapter specified";throw new S("There is no suitable adapter to dispatch the request "+a,S.ERR_NOT_SUPPORT)}return i}const ei={getAdapter:gc,adapters:pr};function hr(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new it(null,t)}function mr(t){const e=d.toSafeFlatObject(t);return hr(e),e.headers=$.from(d.getSafeProp(e,"headers")),e.data=ur.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),ei.getAdapter(e.adapter||nt.adapter,e)(e).then(function(i){hr(e),e.response=i;try{i.data=ur.call(e,e.transformResponse,i)}finally{delete e.response}return i.headers=$.from(i.headers),i},function(i){if(!Un(i)&&(hr(e),i&&i.response)){e.response=i.response;try{i.response.data=ur.call(e,e.transformResponse,i.response)}finally{delete e.response}i.response.headers=$.from(i.response.headers)}return Promise.reject(i)})}const Pt={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Pt[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const ti={};Pt.transitional=function(e,r,n){function i(o,s){return"[Axios v"+dr+"] Transitional option '"+o+"'"+s+(n?". "+n:"")}return(o,s,a)=>{if(e===!1)throw new S(i(s," has been removed"+(r?" in "+r:"")),S.ERR_DEPRECATED);return r&&!ti[s]&&(ti[s]=!0,console.warn(i(s," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(o,s,a):!0}},Pt.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function Sc(t,e,r){if(typeof t!="object"||t===null)throw new S("options must be an object",S.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let i=n.length;for(;i-- >0;){const o=n[i],s=Object.prototype.hasOwnProperty.call(e,o)?e[o]:void 0;if(s){const a=t[o],c=a===void 0||s(a,o,t);if(c!==!0)throw new S("option "+o+" must be "+c,S.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new S("Unknown option "+o,S.ERR_BAD_OPTION)}}const Ot={assertOptions:Sc,validators:Pt},j=Ot.validators;let Pe=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Ln,response:new Ln}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error)try{let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const o=i.stack;let s="";if(typeof o=="string"){const a=o.indexOf(`
6
6
  `);s=a===-1?"":o.slice(a+1)}if(!n.stack)n.stack=s;else if(s){const a=s.indexOf(`
7
7
  `),c=a===-1?-1:s.indexOf(`
8
8
  `,a+1),l=c===-1?"":s.slice(c+1);String(n.stack).endsWith(l)||(n.stack+=`
9
- `+s)}}catch{}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=Te(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:o}=r;n!==void 0&&Ot.assertOptions(n,{silentJSONParsing:j.transitional(j.boolean),forcedJSONParsing:j.transitional(j.boolean),clarifyTimeoutError:j.transitional(j.boolean),legacyInterceptorReqResOrdering:j.transitional(j.boolean),advertiseZstdAcceptEncoding:j.transitional(j.boolean),validateStatusUndefinedResolves:j.transitional(j.boolean)},!1),i!=null&&(p.isFunction(i)?r.paramsSerializer={serialize:i}:Ot.assertOptions(i,{encode:j.function,serialize:j.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Ot.assertOptions(r,{baseUrl:j.spelling("baseURL"),withXsrfToken:j.spelling("withXSRFToken")},!0),r.method=(p.getSafeProp(r,"method")||p.getSafeProp(this.defaults,"method")||"get").toLowerCase();let s=o&&p.merge(o.common,o[r.method]);o&&p.forEach(Nn.concat("common"),y=>{delete o[y]}),r.headers=$.concat(s,o);const a=[];let c=!0;this.interceptors.request.forEach(function(S){if(typeof S.runWhen=="function"&&S.runWhen(r)===!1)return;c=c&&S.synchronous;const P=r.transitional||ar;P&&P.legacyInterceptorReqResOrdering?a.unshift(S.fulfilled,S.rejected):a.push(S.fulfilled,S.rejected)});const l=[];this.interceptors.response.forEach(function(S){l.push(S.fulfilled,S.rejected)});let u,f=0,d;if(!c){const y=[mr.bind(this),void 0];for(y.unshift(...a),y.push(...l),d=y.length,u=Promise.resolve(r);f<d;)u=u.then(y[f++],y[f++]);return u}d=a.length;let h=r;for(;f<d;){const y=a[f++],S=a[f++];try{h=y?y(h):h}catch(P){if(!S){u=Promise.reject(P);break}try{const m=S.call(this,P);p.isThenable(m)&&(u=Promise.resolve(m).then(()=>mr.call(this,h)))}catch(m){u=Promise.reject(m)}break}}if(!u)try{u=mr.call(this,h)}catch(y){u=Promise.reject(y)}for(f=0,d=l.length;f<d;)u=u.then(l[f++],l[f++]);return u}getUri(e){e=Te(this.defaults,e);const r=zn(e.baseURL,e.url,e.allowAbsoluteUrls,e);return Ln(r,e.params,e.paramsSerializer)}};p.forEach(["delete","get","head","options"],function(e){Pe.prototype[e]=function(r,n){return this.request(Te(n||{},{method:e,url:r,data:n&&p.hasOwnProp(n,"data")?n.data:void 0}))}}),p.forEach(["post","put","patch","query"],function(e){function r(n){return function(o,s,a){return this.request(Te(a||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:o,data:s}))}}Pe.prototype[e]=r(),e!=="query"&&(Pe.prototype[e+"Form"]=r(!0))});let Tc=class Rs{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(o){r=o});const n=this;this.promise.then(i=>{if(!n._listeners)return;let o=n._listeners.length;for(;o-- >0;)n._listeners[o](i);n._listeners=null}),this.promise.then=i=>{let o;const s=new Promise(a=>{n.subscribe(a),o=a}).then(i);return s.cancel=function(){n.unsubscribe(o)},s},e(function(o,s,a){n.reason||(n.reason=new it(o,s,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new Rs(function(i){e=i}),cancel:e}}};function Pc(t){return function(r){return t.apply(null,r)}}function Oc(t){return p.isObject(t)&&t.isAxiosError===!0}const wt={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,ContentTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,UnprocessableContent: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,WebServerReturnsAnUnknownError:520,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(wt).forEach(([t,e])=>{wt[e]===void 0&&(wt[e]=t)});function oi(t){const e=new Pe(t),r=fn(Pe.prototype.request,e);return p.extend(r,Pe.prototype,e,{allOwnKeys:!0}),p.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return oi(Te(t,i))},r}const F=oi(nt);F.Axios=Pe,F.CanceledError=it,F.CancelToken=Tc,F.isCancel=Bn,F.VERSION=dr,F.toFormData=Rt,F.AxiosError=v,F.Cancel=F.CanceledError,F.all=function(e){return Promise.all(e)},F.spread=Pc,F.isAxiosError=Oc,F.mergeConfig=Te,F.AxiosHeaders=$,F.formToJSON=t=>Mn(p.isHTMLForm(t)?new FormData(t):t),F.getAdapter=ni.getAdapter,F.HttpStatusCode=wt,F.default=F;const{Axios:Ed,AxiosError:Td,CanceledError:Pd,isCancel:Od,CancelToken:wd,VERSION:Ad,all:_d,Cancel:Dd,isAxiosError:Ld,spread:xd,toFormData:Id,AxiosHeaders:kd,HttpStatusCode:Fd,formToJSON:Ud,getAdapter:Md,mergeConfig:Nd,create:Bd}=F;var si=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ai(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function wc(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var Me=TypeError;const Ac=wc(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var yr=typeof Map=="function"&&Map.prototype,gr=Object.getOwnPropertyDescriptor&&yr?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,At=yr&&gr&&typeof gr.get=="function"?gr.get:null,ci=yr&&Map.prototype.forEach,Sr=typeof Set=="function"&&Set.prototype,vr=Object.getOwnPropertyDescriptor&&Sr?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,_t=Sr&&vr&&typeof vr.get=="function"?vr.get:null,li=Sr&&Set.prototype.forEach,_c=typeof WeakMap=="function"&&WeakMap.prototype,ot=_c?WeakMap.prototype.has:null,Dc=typeof WeakSet=="function"&&WeakSet.prototype,st=Dc?WeakSet.prototype.has:null,Lc=typeof WeakRef=="function"&&WeakRef.prototype,ui=Lc?WeakRef.prototype.deref:null,xc=Boolean.prototype.valueOf,Ic=Object.prototype.toString,kc=Function.prototype.toString,Fc=String.prototype.match,br=String.prototype.slice,ye=String.prototype.replace,Uc=String.prototype.toUpperCase,fi=String.prototype.toLowerCase,di=RegExp.prototype.test,pi=Array.prototype.concat,se=Array.prototype.join,Mc=Array.prototype.slice,hi=Math.floor,Cr=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Rr=Object.getOwnPropertySymbols,Er=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Ne=typeof Symbol=="function"&&typeof Symbol.iterator=="object",at=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Ne||!0)?Symbol.toStringTag:null,mi=Object.prototype.propertyIsEnumerable,yi=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function gi(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||di.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-hi(-t):hi(t);if(n!==t){var i=String(n),o=br.call(e,i.length+1);return ye.call(i,r,"$&_")+"."+ye.call(ye.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return ye.call(e,r,"$&_")}var Tr=Ac,Si=Tr.custom,vi=Ei(Si)?Si:null,bi={__proto__:null,double:'"',single:"'"},Nc={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},Dt=function t(e,r,n,i){var o=r||{};if(fe(o,"quoteStyle")&&!fe(bi,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(fe(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var s=fe(o,"customInspect")?o.customInspect:!0;if(typeof s!="boolean"&&s!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(fe(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(fe(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=o.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return Pi(e,o);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var c=String(e);return a?gi(e,c):c}if(typeof e=="bigint"){var l=String(e)+"n";return a?gi(e,l):l}var u=typeof o.depth>"u"?5:o.depth;if(typeof n>"u"&&(n=0),n>=u&&u>0&&typeof e=="object")return Pr(e)?"[Array]":"[Object]";var f=rl(o,n);if(typeof i>"u")i=[];else if(Ti(i,e)>=0)return"[Circular]";function d(Z,B,ne){if(B&&(i=Mc.call(i),i.push(B)),ne){var ve={depth:o.depth};return fe(o,"quoteStyle")&&(ve.quoteStyle=o.quoteStyle),t(Z,ve,n+1,i)}return t(Z,o,n+1,i)}if(typeof e=="function"&&!Ri(e)){var h=Wc(e),y=Lt(e,d);return"[Function"+(h?": "+h:" (anonymous)")+"]"+(y.length>0?" { "+se.call(y,", ")+" }":"")}if(Ei(e)){var S=Ne?ye.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Er.call(e);return typeof e=="object"&&!Ne?ct(S):S}if(Zc(e)){for(var P="<"+fi.call(String(e.nodeName)),m=e.attributes||[],b=0;b<m.length;b++)P+=" "+m[b].name+"="+Ci(Bc(m[b].value),"double",o);return P+=">",e.childNodes&&e.childNodes.length&&(P+="..."),P+="</"+fi.call(String(e.nodeName))+">",P}if(Pr(e)){if(e.length===0)return"[]";var R=Lt(e,d);return f&&!tl(R)?"["+wr(R,f)+"]":"[ "+se.call(R,", ")+" ]"}if(jc(e)){var E=Lt(e,d);return!("cause"in Error.prototype)&&"cause"in e&&!mi.call(e,"cause")?"{ ["+String(e)+"] "+se.call(pi.call("[cause]: "+d(e.cause),E),", ")+" }":E.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+se.call(E,", ")+" }"}if(typeof e=="object"&&s){if(vi&&typeof e[vi]=="function"&&Tr)return Tr(e,{depth:u-n});if(s!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(Kc(e)){var C=[];return ci&&ci.call(e,function(Z,B){C.push(d(B,e,!0)+" => "+d(Z,e))}),Oi("Map",At.call(e),C,f)}if(Xc(e)){var x=[];return li&&li.call(e,function(Z){x.push(d(Z,e))}),Oi("Set",_t.call(e),x,f)}if(Jc(e))return Or("WeakMap");if(Yc(e))return Or("WeakSet");if(Qc(e))return Or("WeakRef");if(Vc(e))return ct(d(Number(e)));if(zc(e))return ct(d(Cr.call(e)));if(qc(e))return ct(xc.call(e));if(Hc(e))return ct(d(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof si<"u"&&e===si)return"{ [object globalThis] }";if(!$c(e)&&!Ri(e)){var A=Lt(e,d),H=yi?yi(e)===Object.prototype:e instanceof Object||e.constructor===Object,K=e instanceof Object?"":"null prototype",Y=!H&&at&&Object(e)===e&&at in e?br.call(ge(e),8,-1):K?"Object":"",J=H||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",Q=J+(Y||K?"["+se.call(pi.call([],Y||[],K||[]),": ")+"] ":"");return A.length===0?Q+"{}":f?Q+"{"+wr(A,f)+"}":Q+"{ "+se.call(A,", ")+" }"}return String(e)};function Ci(t,e,r){var n=r.quoteStyle||e,i=bi[n];return i+t+i}function Bc(t){return ye.call(String(t),/"/g,"&quot;")}function Oe(t){return!at||!(typeof t=="object"&&(at in t||typeof t[at]<"u"))}function Pr(t){return ge(t)==="[object Array]"&&Oe(t)}function $c(t){return ge(t)==="[object Date]"&&Oe(t)}function Ri(t){return ge(t)==="[object RegExp]"&&Oe(t)}function jc(t){return ge(t)==="[object Error]"&&Oe(t)}function Hc(t){return ge(t)==="[object String]"&&Oe(t)}function Vc(t){return ge(t)==="[object Number]"&&Oe(t)}function qc(t){return ge(t)==="[object Boolean]"&&Oe(t)}function Ei(t){if(Ne)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!Er)return!1;try{return Er.call(t),!0}catch{}return!1}function zc(t){if(!t||typeof t!="object"||!Cr)return!1;try{return Cr.call(t),!0}catch{}return!1}var Gc=Object.prototype.hasOwnProperty||function(t){return t in this};function fe(t,e){return Gc.call(t,e)}function ge(t){return Ic.call(t)}function Wc(t){if(t.name)return t.name;var e=Fc.call(kc.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function Ti(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}function Kc(t){if(!At||!t||typeof t!="object")return!1;try{At.call(t);try{_t.call(t)}catch{return!0}return t instanceof Map}catch{}return!1}function Jc(t){if(!ot||!t||typeof t!="object")return!1;try{ot.call(t,ot);try{st.call(t,st)}catch{return!0}return t instanceof WeakMap}catch{}return!1}function Qc(t){if(!ui||!t||typeof t!="object")return!1;try{return ui.call(t),!0}catch{}return!1}function Xc(t){if(!_t||!t||typeof t!="object")return!1;try{_t.call(t);try{At.call(t)}catch{return!0}return t instanceof Set}catch{}return!1}function Yc(t){if(!st||!t||typeof t!="object")return!1;try{st.call(t,st);try{ot.call(t,ot)}catch{return!0}return t instanceof WeakSet}catch{}return!1}function Zc(t){return!t||typeof t!="object"?!1:typeof HTMLElement<"u"&&t instanceof HTMLElement?!0:typeof t.nodeName=="string"&&typeof t.getAttribute=="function"}function Pi(t,e){if(t.length>e.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return Pi(br.call(t,0,e.maxStringLength),e)+n}var i=Nc[e.quoteStyle||"single"];i.lastIndex=0;var o=ye.call(ye.call(t,i,"\\$1"),/[\x00-\x1f]/g,el);return Ci(o,"single",e)}function el(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+Uc.call(e.toString(16))}function ct(t){return"Object("+t+")"}function Or(t){return t+" { ? }"}function Oi(t,e,r,n){var i=n?wr(r,n):se.call(r,", ");return t+" ("+e+") {"+i+"}"}function tl(t){for(var e=0;e<t.length;e++)if(Ti(t[e],`
10
- `)>=0)return!1;return!0}function rl(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=se.call(Array(t.indent+1)," ");else return null;return{base:r,prev:se.call(Array(e+1),r)}}function wr(t,e){if(t.length===0)return"";var r=`
9
+ `+s)}}catch{}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=Te(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:o}=r;n!==void 0&&Ot.assertOptions(n,{silentJSONParsing:j.transitional(j.boolean),forcedJSONParsing:j.transitional(j.boolean),clarifyTimeoutError:j.transitional(j.boolean),legacyInterceptorReqResOrdering:j.transitional(j.boolean),advertiseZstdAcceptEncoding:j.transitional(j.boolean),validateStatusUndefinedResolves:j.transitional(j.boolean)},!1),i!=null&&(d.isFunction(i)?r.paramsSerializer={serialize:i}:Ot.assertOptions(i,{encode:j.function,serialize:j.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Ot.assertOptions(r,{baseUrl:j.spelling("baseURL"),withXsrfToken:j.spelling("withXSRFToken")},!0),r.method=(d.getSafeProp(r,"method")||d.getSafeProp(this.defaults,"method")||"get").toLowerCase();let s=o&&d.merge(o.common,o[r.method]);o&&d.forEach(Fn.concat("common"),g=>{delete o[g]}),r.headers=$.concat(s,o);const a=[];let c=!0;this.interceptors.request.forEach(function(v){if(typeof v.runWhen=="function"&&v.runWhen(r)===!1)return;c=c&&v.synchronous;const O=r.transitional||ar;O&&O.legacyInterceptorReqResOrdering?a.unshift(v.fulfilled,v.rejected):a.push(v.fulfilled,v.rejected)});const l=[];this.interceptors.response.forEach(function(v){l.push(v.fulfilled,v.rejected)});let u,f=0,p;if(!c){const g=[mr.bind(this),void 0];for(g.unshift(...a),g.push(...l),p=g.length,u=Promise.resolve(r);f<p;)u=u.then(g[f++],g[f++]);return u}p=a.length;let h=r;for(;f<p;){const g=a[f++],v=a[f++];try{h=g?g(h):h}catch(O){if(!v){u=Promise.reject(O);break}try{const m=v.call(this,O);d.isThenable(m)&&(u=Promise.resolve(m).then(()=>mr.call(this,h)))}catch(m){u=Promise.reject(m)}break}}if(!u)try{u=mr.call(this,h)}catch(g){u=Promise.reject(g)}for(f=0,p=l.length;f<p;)u=u.then(l[f++],l[f++]);return u}getUri(e){e=Te(this.defaults,e);const r=Hn(e.baseURL,e.url,e.allowAbsoluteUrls,e);return An(r,e.params,e.paramsSerializer)}};d.forEach(["delete","get","head","options"],function(e){Pe.prototype[e]=function(r,n){return this.request(Te(n||{},{method:e,url:r,data:n&&d.hasOwnProp(n,"data")?n.data:void 0}))}}),d.forEach(["post","put","patch","query"],function(e){function r(n){return function(o,s,a){return this.request(Te(a||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:o,data:s}))}}Pe.prototype[e]=r(),e!=="query"&&(Pe.prototype[e+"Form"]=r(!0))});let vc=class gs{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(o){r=o});const n=this;this.promise.then(i=>{if(!n._listeners)return;let o=n._listeners.length;for(;o-- >0;)n._listeners[o](i);n._listeners=null}),this.promise.then=i=>{let o;const s=new Promise(a=>{n.subscribe(a),o=a}).then(i);return s.cancel=function(){n.unsubscribe(o)},s},e(function(o,s,a){n.reason||(n.reason=new it(o,s,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new gs(function(i){e=i}),cancel:e}}};function bc(t){return function(r){return t.apply(null,r)}}function Cc(t){return d.isObject(t)&&t.isAxiosError===!0}const wt={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,ContentTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,UnprocessableContent: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,WebServerReturnsAnUnknownError:520,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(wt).forEach(([t,e])=>{wt[e]===void 0&&(wt[e]=t)});function ri(t){const e=new Pe(t),r=cn(Pe.prototype.request,e);return d.extend(r,Pe.prototype,e,{allOwnKeys:!0}),d.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return ri(Te(t,i))},r}const F=ri(nt);F.Axios=Pe,F.CanceledError=it,F.CancelToken=vc,F.isCancel=Un,F.VERSION=dr,F.toFormData=Rt,F.AxiosError=S,F.Cancel=F.CanceledError,F.all=function(e){return Promise.all(e)},F.spread=bc,F.isAxiosError=Cc,F.mergeConfig=Te,F.AxiosHeaders=$,F.formToJSON=t=>kn(d.isHTMLForm(t)?new FormData(t):t),F.getAdapter=ei.getAdapter,F.HttpStatusCode=wt,F.default=F;const{Axios:Pd,AxiosError:Od,CanceledError:wd,isCancel:Ad,CancelToken:_d,VERSION:Dd,all:Ld,Cancel:xd,isAxiosError:Id,spread:kd,toFormData:Fd,AxiosHeaders:Ud,HttpStatusCode:Md,formToJSON:Nd,getAdapter:Bd,mergeConfig:$d,create:jd}=F;var ni=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ii(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Rc(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var Me=TypeError;const Ec=Rc(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var yr=typeof Map=="function"&&Map.prototype,gr=Object.getOwnPropertyDescriptor&&yr?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,At=yr&&gr&&typeof gr.get=="function"?gr.get:null,oi=yr&&Map.prototype.forEach,Sr=typeof Set=="function"&&Set.prototype,vr=Object.getOwnPropertyDescriptor&&Sr?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,_t=Sr&&vr&&typeof vr.get=="function"?vr.get:null,si=Sr&&Set.prototype.forEach,Tc=typeof WeakMap=="function"&&WeakMap.prototype,ot=Tc?WeakMap.prototype.has:null,Pc=typeof WeakSet=="function"&&WeakSet.prototype,st=Pc?WeakSet.prototype.has:null,Oc=typeof WeakRef=="function"&&WeakRef.prototype,ai=Oc?WeakRef.prototype.deref:null,wc=Boolean.prototype.valueOf,Ac=Object.prototype.toString,_c=Function.prototype.toString,Dc=String.prototype.match,br=String.prototype.slice,ye=String.prototype.replace,Lc=String.prototype.toUpperCase,ci=String.prototype.toLowerCase,li=RegExp.prototype.test,ui=Array.prototype.concat,se=Array.prototype.join,xc=Array.prototype.slice,fi=Math.floor,Cr=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Rr=Object.getOwnPropertySymbols,Er=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Ne=typeof Symbol=="function"&&typeof Symbol.iterator=="object",at=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Ne||!0)?Symbol.toStringTag:null,di=Object.prototype.propertyIsEnumerable,pi=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function hi(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||li.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-fi(-t):fi(t);if(n!==t){var i=String(n),o=br.call(e,i.length+1);return ye.call(i,r,"$&_")+"."+ye.call(ye.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return ye.call(e,r,"$&_")}var Tr=Ec,mi=Tr.custom,yi=bi(mi)?mi:null,gi={__proto__:null,double:'"',single:"'"},Ic={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},Dt=function t(e,r,n,i){var o=r||{};if(fe(o,"quoteStyle")&&!fe(gi,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(fe(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var s=fe(o,"customInspect")?o.customInspect:!0;if(typeof s!="boolean"&&s!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(fe(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(fe(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=o.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return Ri(e,o);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var c=String(e);return a?hi(e,c):c}if(typeof e=="bigint"){var l=String(e)+"n";return a?hi(e,l):l}var u=typeof o.depth>"u"?5:o.depth;if(typeof n>"u"&&(n=0),n>=u&&u>0&&typeof e=="object")return Pr(e)?"[Array]":"[Object]";var f=Xc(o,n);if(typeof i>"u")i=[];else if(Ci(i,e)>=0)return"[Circular]";function p(Z,B,ne){if(B&&(i=xc.call(i),i.push(B)),ne){var ve={depth:o.depth};return fe(o,"quoteStyle")&&(ve.quoteStyle=o.quoteStyle),t(Z,ve,n+1,i)}return t(Z,o,n+1,i)}if(typeof e=="function"&&!vi(e)){var h=Hc(e),g=Lt(e,p);return"[Function"+(h?": "+h:" (anonymous)")+"]"+(g.length>0?" { "+se.call(g,", ")+" }":"")}if(bi(e)){var v=Ne?ye.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Er.call(e);return typeof e=="object"&&!Ne?ct(v):v}if(Kc(e)){for(var O="<"+ci.call(String(e.nodeName)),m=e.attributes||[],b=0;b<m.length;b++)O+=" "+m[b].name+"="+Si(kc(m[b].value),"double",o);return O+=">",e.childNodes&&e.childNodes.length&&(O+="..."),O+="</"+ci.call(String(e.nodeName))+">",O}if(Pr(e)){if(e.length===0)return"[]";var R=Lt(e,p);return f&&!Qc(R)?"["+wr(R,f)+"]":"[ "+se.call(R,", ")+" ]"}if(Uc(e)){var E=Lt(e,p);return!("cause"in Error.prototype)&&"cause"in e&&!di.call(e,"cause")?"{ ["+String(e)+"] "+se.call(ui.call("[cause]: "+p(e.cause),E),", ")+" }":E.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+se.call(E,", ")+" }"}if(typeof e=="object"&&s){if(yi&&typeof e[yi]=="function"&&Tr)return Tr(e,{depth:u-n});if(s!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(Vc(e)){var C=[];return oi&&oi.call(e,function(Z,B){C.push(p(B,e,!0)+" => "+p(Z,e))}),Ei("Map",At.call(e),C,f)}if(Gc(e)){var x=[];return si&&si.call(e,function(Z){x.push(p(Z,e))}),Ei("Set",_t.call(e),x,f)}if(qc(e))return Or("WeakMap");if(Wc(e))return Or("WeakSet");if(zc(e))return Or("WeakRef");if(Nc(e))return ct(p(Number(e)));if($c(e))return ct(p(Cr.call(e)));if(Bc(e))return ct(wc.call(e));if(Mc(e))return ct(p(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof ni<"u"&&e===ni)return"{ [object globalThis] }";if(!Fc(e)&&!vi(e)){var A=Lt(e,p),H=pi?pi(e)===Object.prototype:e instanceof Object||e.constructor===Object,K=e instanceof Object?"":"null prototype",Y=!H&&at&&Object(e)===e&&at in e?br.call(ge(e),8,-1):K?"Object":"",J=H||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",Q=J+(Y||K?"["+se.call(ui.call([],Y||[],K||[]),": ")+"] ":"");return A.length===0?Q+"{}":f?Q+"{"+wr(A,f)+"}":Q+"{ "+se.call(A,", ")+" }"}return String(e)};function Si(t,e,r){var n=r.quoteStyle||e,i=gi[n];return i+t+i}function kc(t){return ye.call(String(t),/"/g,"&quot;")}function Oe(t){return!at||!(typeof t=="object"&&(at in t||typeof t[at]<"u"))}function Pr(t){return ge(t)==="[object Array]"&&Oe(t)}function Fc(t){return ge(t)==="[object Date]"&&Oe(t)}function vi(t){return ge(t)==="[object RegExp]"&&Oe(t)}function Uc(t){return ge(t)==="[object Error]"&&Oe(t)}function Mc(t){return ge(t)==="[object String]"&&Oe(t)}function Nc(t){return ge(t)==="[object Number]"&&Oe(t)}function Bc(t){return ge(t)==="[object Boolean]"&&Oe(t)}function bi(t){if(Ne)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!Er)return!1;try{return Er.call(t),!0}catch{}return!1}function $c(t){if(!t||typeof t!="object"||!Cr)return!1;try{return Cr.call(t),!0}catch{}return!1}var jc=Object.prototype.hasOwnProperty||function(t){return t in this};function fe(t,e){return jc.call(t,e)}function ge(t){return Ac.call(t)}function Hc(t){if(t.name)return t.name;var e=Dc.call(_c.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function Ci(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}function Vc(t){if(!At||!t||typeof t!="object")return!1;try{At.call(t);try{_t.call(t)}catch{return!0}return t instanceof Map}catch{}return!1}function qc(t){if(!ot||!t||typeof t!="object")return!1;try{ot.call(t,ot);try{st.call(t,st)}catch{return!0}return t instanceof WeakMap}catch{}return!1}function zc(t){if(!ai||!t||typeof t!="object")return!1;try{return ai.call(t),!0}catch{}return!1}function Gc(t){if(!_t||!t||typeof t!="object")return!1;try{_t.call(t);try{At.call(t)}catch{return!0}return t instanceof Set}catch{}return!1}function Wc(t){if(!st||!t||typeof t!="object")return!1;try{st.call(t,st);try{ot.call(t,ot)}catch{return!0}return t instanceof WeakSet}catch{}return!1}function Kc(t){return!t||typeof t!="object"?!1:typeof HTMLElement<"u"&&t instanceof HTMLElement?!0:typeof t.nodeName=="string"&&typeof t.getAttribute=="function"}function Ri(t,e){if(t.length>e.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return Ri(br.call(t,0,e.maxStringLength),e)+n}var i=Ic[e.quoteStyle||"single"];i.lastIndex=0;var o=ye.call(ye.call(t,i,"\\$1"),/[\x00-\x1f]/g,Jc);return Si(o,"single",e)}function Jc(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+Lc.call(e.toString(16))}function ct(t){return"Object("+t+")"}function Or(t){return t+" { ? }"}function Ei(t,e,r,n){var i=n?wr(r,n):se.call(r,", ");return t+" ("+e+") {"+i+"}"}function Qc(t){for(var e=0;e<t.length;e++)if(Ci(t[e],`
10
+ `)>=0)return!1;return!0}function Xc(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=se.call(Array(t.indent+1)," ");else return null;return{base:r,prev:se.call(Array(e+1),r)}}function wr(t,e){if(t.length===0)return"";var r=`
11
11
  `+e.prev+e.base;return r+se.call(t,","+r)+`
12
- `+e.prev}function Lt(t,e){var r=Pr(t),n=[];if(r){n.length=t.length;for(var i=0;i<t.length;i++)n[i]=fe(t,i)?e(t[i],t):""}var o=typeof Rr=="function"?Rr(t):[],s;if(Ne){s={};for(var a=0;a<o.length;a++)s["$"+o[a]]=o[a]}for(var c in t)fe(t,c)&&(r&&String(Number(c))===c&&c<t.length||Ne&&s["$"+c]instanceof Symbol||(di.call(/[^\w$]/,c)?n.push(e(c,t)+": "+e(t[c],t)):n.push(c+": "+e(t[c],t))));if(typeof Rr=="function")for(var l=0;l<o.length;l++)mi.call(t,o[l])&&n.push("["+e(o[l])+"]: "+e(t[o[l]],t));return n}var nl=Dt,il=Me,xt=function(t,e,r){for(var n=t,i;(i=n.next)!=null;n=i)if(i.key===e)return n.next=i.next,r||(i.next=t.next,t.next=i),i},ol=function(t,e){if(t){var r=xt(t,e);return r&&r.value}},sl=function(t,e,r){var n=xt(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},al=function(t,e){return t?!!xt(t,e):!1},cl=function(t,e){if(t)return xt(t,e,!0)},ll=function(){var e,r={assert:function(n){if(!r.has(n))throw new il("Side channel does not contain "+nl(n))},delete:function(n){var i=cl(e,n);return i&&e&&!e.next&&(e=void 0),!!i},get:function(n){return ol(e,n)},has:function(n){return al(e,n)},set:function(n,i){e||(e={next:void 0}),sl(e,n,i)}};return r},wi=Object,ul=Error,fl=EvalError,dl=RangeError,pl=ReferenceError,hl=SyntaxError,ml=URIError,yl=Math.abs,gl=Math.floor,Sl=Math.max,vl=Math.min,bl=Math.pow,Cl=Math.round,Rl=Number.isNaN||function(e){return e!==e},El=Rl,Tl=function(e){return El(e)||e===0?e:e<0?-1:1},Pl=Object.getOwnPropertyDescriptor,It=Pl;if(It)try{It([],"length")}catch{It=null}var Ai=It,kt=Object.defineProperty||!1;if(kt)try{kt({},"a",{value:1})}catch{kt=!1}var _i=kt,Ar,Di;function Ol(){return Di||(Di=1,Ar=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[r]=i;for(var o in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(e,r);if(a.value!==i||a.enumerable!==!0)return!1}return!0}),Ar}var _r,Li;function wl(){if(Li)return _r;Li=1;var t=typeof Symbol<"u"&&Symbol,e=Ol();return _r=function(){return typeof t!="function"||typeof Symbol!="function"||typeof t("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},_r}var Dr,xi;function Ii(){return xi||(xi=1,Dr=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Dr}var Lr,ki;function Fi(){if(ki)return Lr;ki=1;var t=wi;return Lr=t.getPrototypeOf||null,Lr}var xr,Ui;function Al(){if(Ui)return xr;Ui=1;var t="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,r=Math.max,n="[object Function]",i=function(c,l){for(var u=[],f=0;f<c.length;f+=1)u[f]=c[f];for(var d=0;d<l.length;d+=1)u[d+c.length]=l[d];return u},o=function(c,l){for(var u=[],f=l,d=0;f<c.length;f+=1,d+=1)u[d]=c[f];return u},s=function(a,c){for(var l="",u=0;u<a.length;u+=1)l+=a[u],u+1<a.length&&(l+=c);return l};return xr=function(c){var l=this;if(typeof l!="function"||e.apply(l)!==n)throw new TypeError(t+l);for(var u=o(arguments,1),f,d=function(){if(this instanceof f){var m=l.apply(this,i(u,arguments));return Object(m)===m?m:this}return l.apply(c,i(u,arguments))},h=r(0,l.length-u.length),y=[],S=0;S<h;S++)y[S]="$"+S;if(f=Function("binder","return function ("+s(y,",")+"){ return binder.apply(this,arguments); }")(d),l.prototype){var P=function(){};P.prototype=l.prototype,f.prototype=new P,P.prototype=null}return f},xr}var Ir,Mi;function Ft(){if(Mi)return Ir;Mi=1;var t=Al();return Ir=Function.prototype.bind||t,Ir}var kr,Ni;function Fr(){return Ni||(Ni=1,kr=Function.prototype.call),kr}var Ur,Bi;function $i(){return Bi||(Bi=1,Ur=Function.prototype.apply),Ur}var _l=typeof Reflect<"u"&&Reflect&&Reflect.apply,Dl=Ft(),Ll=$i(),xl=Fr(),Il=_l,kl=Il||Dl.call(xl,Ll),Fl=Ft(),Ul=Me,Ml=Fr(),Nl=kl,ji=function(e){if(e.length<1||typeof e[0]!="function")throw new Ul("a function is required");return Nl(Fl,Ml,e)},Mr,Hi;function Bl(){if(Hi)return Mr;Hi=1;var t=ji,e=Ai,r;try{r=[].__proto__===Array.prototype}catch(s){if(!s||typeof s!="object"||!("code"in s)||s.code!=="ERR_PROTO_ACCESS")throw s}var n=!!r&&e&&e(Object.prototype,"__proto__"),i=Object,o=i.getPrototypeOf;return Mr=n&&typeof n.get=="function"?t([n.get]):typeof o=="function"?function(a){return o(a==null?a:i(a))}:!1,Mr}var Nr,Vi;function $l(){if(Vi)return Nr;Vi=1;var t=Ii(),e=Fi(),r=Bl();return Nr=t?function(i){return t(i)}:e?function(i){if(!i||typeof i!="object"&&typeof i!="function")throw new TypeError("getProto: not an object");return e(i)}:r?function(i){return r(i)}:null,Nr}var Br,qi;function jl(){if(qi)return Br;qi=1;var t=Function.prototype.call,e=Object.prototype.hasOwnProperty,r=Ft();return Br=r.call(t,e),Br}var w,Hl=wi,Vl=ul,ql=fl,zl=dl,Gl=pl,Be=hl,$e=Me,Wl=ml,Kl=yl,Jl=gl,Ql=Sl,Xl=vl,Yl=bl,Zl=Cl,eu=Tl,zi=Function,$r=function(t){try{return zi('"use strict"; return ('+t+").constructor;")()}catch{}},lt=Ai,tu=_i,jr=function(){throw new $e},ru=lt?function(){try{return arguments.callee,jr}catch{try{return lt(arguments,"callee").get}catch{return jr}}}():jr,je=wl()(),N=$l(),nu=Fi(),iu=Ii(),Gi=$i(),ut=Fr(),He={},ou=typeof Uint8Array>"u"||!N?w:N(Uint8Array),we={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?w:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?w:ArrayBuffer,"%ArrayIteratorPrototype%":je&&N?N([][Symbol.iterator]()):w,"%AsyncFromSyncIteratorPrototype%":w,"%AsyncFunction%":He,"%AsyncGenerator%":He,"%AsyncGeneratorFunction%":He,"%AsyncIteratorPrototype%":He,"%Atomics%":typeof Atomics>"u"?w:Atomics,"%BigInt%":typeof BigInt>"u"?w:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?w:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?w:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?w:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Vl,"%eval%":eval,"%EvalError%":ql,"%Float16Array%":typeof Float16Array>"u"?w:Float16Array,"%Float32Array%":typeof Float32Array>"u"?w:Float32Array,"%Float64Array%":typeof Float64Array>"u"?w:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?w:FinalizationRegistry,"%Function%":zi,"%GeneratorFunction%":He,"%Int8Array%":typeof Int8Array>"u"?w:Int8Array,"%Int16Array%":typeof Int16Array>"u"?w:Int16Array,"%Int32Array%":typeof Int32Array>"u"?w:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":je&&N?N(N([][Symbol.iterator]())):w,"%JSON%":typeof JSON=="object"?JSON:w,"%Map%":typeof Map>"u"?w:Map,"%MapIteratorPrototype%":typeof Map>"u"||!je||!N?w:N(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Hl,"%Object.getOwnPropertyDescriptor%":lt,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?w:Promise,"%Proxy%":typeof Proxy>"u"?w:Proxy,"%RangeError%":zl,"%ReferenceError%":Gl,"%Reflect%":typeof Reflect>"u"?w:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?w:Set,"%SetIteratorPrototype%":typeof Set>"u"||!je||!N?w:N(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?w:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":je&&N?N(""[Symbol.iterator]()):w,"%Symbol%":je?Symbol:w,"%SyntaxError%":Be,"%ThrowTypeError%":ru,"%TypedArray%":ou,"%TypeError%":$e,"%Uint8Array%":typeof Uint8Array>"u"?w:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?w:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?w:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?w:Uint32Array,"%URIError%":Wl,"%WeakMap%":typeof WeakMap>"u"?w:WeakMap,"%WeakRef%":typeof WeakRef>"u"?w:WeakRef,"%WeakSet%":typeof WeakSet>"u"?w:WeakSet,"%Function.prototype.call%":ut,"%Function.prototype.apply%":Gi,"%Object.defineProperty%":tu,"%Object.getPrototypeOf%":nu,"%Math.abs%":Kl,"%Math.floor%":Jl,"%Math.max%":Ql,"%Math.min%":Xl,"%Math.pow%":Yl,"%Math.round%":Zl,"%Math.sign%":eu,"%Reflect.getPrototypeOf%":iu};if(N)try{null.error}catch(t){var su=N(N(t));we["%Error.prototype%"]=su}var au=function t(e){var r;if(e==="%AsyncFunction%")r=$r("async function () {}");else if(e==="%GeneratorFunction%")r=$r("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=$r("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&N&&(r=N(i.prototype))}return we[e]=r,r},Wi={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},ft=Ft(),Ut=jl(),cu=ft.call(ut,Array.prototype.concat),lu=ft.call(Gi,Array.prototype.splice),Ki=ft.call(ut,String.prototype.replace),Mt=ft.call(ut,String.prototype.slice),uu=ft.call(ut,RegExp.prototype.exec),fu=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,du=/\\(\\)?/g,pu=function(e){var r=Mt(e,0,1),n=Mt(e,-1);if(r==="%"&&n!=="%")throw new Be("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Be("invalid intrinsic syntax, expected opening `%`");var i=[];return Ki(e,fu,function(o,s,a,c){i[i.length]=a?Ki(c,du,"$1"):s||o}),i},hu=function(e,r){var n=e,i;if(Ut(Wi,n)&&(i=Wi[n],n="%"+i[0]+"%"),Ut(we,n)){var o=we[n];if(o===He&&(o=au(n)),typeof o>"u"&&!r)throw new $e("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:o}}throw new Be("intrinsic "+e+" does not exist!")},Hr=function(e,r){if(typeof e!="string"||e.length===0)throw new $e("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new $e('"allowMissing" argument must be a boolean');if(uu(/^%?[^%]*%?$/,e)===null)throw new Be("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=pu(e),i=n.length>0?n[0]:"",o=hu("%"+i+"%",r),s=o.name,a=o.value,c=!1,l=o.alias;l&&(i=l[0],lu(n,cu([0,1],l)));for(var u=1,f=!0;u<n.length;u+=1){var d=n[u],h=Mt(d,0,1),y=Mt(d,-1);if((h==='"'||h==="'"||h==="`"||y==='"'||y==="'"||y==="`")&&h!==y)throw new Be("property names with quotes must have matching quotes");if((d==="constructor"||!f)&&(c=!0),i+="."+d,s="%"+i+"%",Ut(we,s))a=we[s];else if(a!=null){if(!(d in a)){if(!r)throw new $e("base intrinsic for "+e+" exists, but the property is not available.");return}if(lt&&u+1>=n.length){var S=lt(a,d);f=!!S,f&&"get"in S&&!("originalValue"in S.get)?a=S.get:a=a[d]}else f=Ut(a,d),a=a[d];f&&!c&&(we[s]=a)}}return a},Ji=Hr,Qi=ji,mu=Qi([Ji("%String.prototype.indexOf%")]),Xi=function(e,r){var n=Ji(e,!!r);return typeof n=="function"&&mu(e,".prototype.")>-1?Qi([n]):n},yu=Hr,dt=Xi,gu=Dt,Su=Me,Yi=yu("%Map%",!0),vu=dt("Map.prototype.get",!0),bu=dt("Map.prototype.set",!0),Cu=dt("Map.prototype.has",!0),Ru=dt("Map.prototype.delete",!0),Eu=dt("Map.prototype.size",!0),Zi=!!Yi&&function(){var e,r={assert:function(n){if(!r.has(n))throw new Su("Side channel does not contain "+gu(n))},delete:function(n){if(e){var i=Ru(e,n);return Eu(e)===0&&(e=void 0),i}return!1},get:function(n){if(e)return vu(e,n)},has:function(n){return e?Cu(e,n):!1},set:function(n,i){e||(e=new Yi),bu(e,n,i)}};return r},Tu=Hr,Nt=Xi,Pu=Dt,Bt=Zi,Ou=Me,Ve=Tu("%WeakMap%",!0),wu=Nt("WeakMap.prototype.get",!0),Au=Nt("WeakMap.prototype.set",!0),_u=Nt("WeakMap.prototype.has",!0),Du=Nt("WeakMap.prototype.delete",!0),Lu=Ve?function(){var e,r,n={assert:function(i){if(!n.has(i))throw new Ou("Side channel does not contain "+Pu(i))},delete:function(i){if(Ve&&i&&(typeof i=="object"||typeof i=="function")){if(e)return Du(e,i)}else if(Bt&&r)return r.delete(i);return!1},get:function(i){return Ve&&i&&(typeof i=="object"||typeof i=="function")&&e?wu(e,i):r&&r.get(i)},has:function(i){return Ve&&i&&(typeof i=="object"||typeof i=="function")&&e?_u(e,i):!!r&&r.has(i)},set:function(i,o){Ve&&i&&(typeof i=="object"||typeof i=="function")?(e||(e=new Ve),Au(e,i,o)):Bt&&(r||(r=Bt()),r.set(i,o))}};return n}:Bt,xu=Me,Iu=Dt,ku=ll,Fu=Zi,Uu=Lu,Mu=Uu||Fu||ku,eo=function(){var e,r={assert:function(n){if(!r.has(n)){var i=n&&Object(n)===n?"the given object key":Iu(n);throw new xu("Side channel does not contain "+i)}},delete:function(n){return!!e&&e.delete(n)},get:function(n){return e&&e.get(n)},has:function(n){return!!e&&e.has(n)},set:function(n,i){e||(e=Mu()),e.set(n,i)}};return r},Nu=String.prototype.replace,Bu=/%20/g,Vr={RFC1738:"RFC1738",RFC3986:"RFC3986"},qr={default:Vr.RFC3986,formatters:{RFC1738:function(t){return Nu.call(t,Bu,"+")},RFC3986:function(t){return String(t)}},RFC1738:Vr.RFC1738,RFC3986:Vr.RFC3986},$u=qr,to=eo,ro=_i,zr=Object.prototype.hasOwnProperty,Se=Array.isArray,$t=to(),Ae=function(e,r){return $t.set(e,r),e},_e=function(e){return $t.has(e)},pt=function(e){return $t.get(e)},Gr=function(e,r){$t.set(e,r)},ae=function(){for(var t=[],e=0;e<256;++e)t[t.length]="%"+((e<16?"0":"")+e.toString(16)).toUpperCase();return t}(),ju=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(Se(n)){for(var i=[],o=0;o<n.length;++o)typeof n[o]<"u"&&(i[i.length]=n[o]);r.obj[r.prop]=i}}},qe=function(e,r){for(var n=r&&r.plainObjects?{__proto__:null}:{},i=0;i<e.length;++i)typeof e[i]<"u"&&(n[i]=e[i]);return n},Wr=function(e,r,n){r==="__proto__"&&ro?ro(e,r,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[r]=n},Hu=function t(e,r,n){if(!r)return e;if(typeof r!="object"&&typeof r!="function"){if(Se(e)){var i=e.length;if(n&&typeof n.arrayLimit=="number"&&i>=n.arrayLimit){if(n.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+n.arrayLimit+" element"+(n.arrayLimit===1?"":"s")+" allowed in an array.");return Ae(qe(e.concat(r),n),i)}e[i]=r}else if(e&&typeof e=="object")if(_e(e)){var o=pt(e)+1;e[o]=r,Gr(e,o)}else{if(n&&n.strictMerge)return[e,r];(n&&(n.plainObjects||n.allowPrototypes)||!zr.call(Object.prototype,r))&&(e[r]=!0)}else return[e,r];return e}if(!e||typeof e!="object"){if(_e(r)){for(var s=Object.keys(r),a=n&&n.plainObjects?{__proto__:null,0:e}:{0:e},c=0;c<s.length;c++){var l=parseInt(s[c],10);a[l+1]=r[s[c]]}return Ae(a,pt(r)+1)}var u=[e].concat(r);if(n&&typeof n.arrayLimit=="number"&&u.length>n.arrayLimit){if(n.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+n.arrayLimit+" element"+(n.arrayLimit===1?"":"s")+" allowed in an array.");return Ae(qe(u,n),u.length-1)}return u}var f=e;if(Se(e)&&!Se(r)&&(f=qe(e,n)),Se(e)&&Se(r)){if(r.forEach(function(d,h){if(zr.call(e,h)){var y=e[h];y&&typeof y=="object"&&d&&typeof d=="object"?e[h]=t(y,d,n):e[e.length]=d}else e[h]=d}),n&&typeof n.arrayLimit=="number"&&e.length>n.arrayLimit){if(n.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+n.arrayLimit+" element"+(n.arrayLimit===1?"":"s")+" allowed in an array.");return Ae(qe(e,n),e.length-1)}return e}return Object.keys(r).reduce(function(d,h){var y=r[h];if(zr.call(d,h)?Wr(d,h,t(d[h],y,n)):Wr(d,h,y),_e(r)&&!_e(d)&&Ae(d,pt(r)),_e(d)){var S=parseInt(h,10);String(S)===h&&S>=0&&S>pt(d)&&Gr(d,S)}return d},f)},Vu=function(e,r){return Object.keys(r).reduce(function(n,i){return Wr(n,i,r[i]),n},e)},qu=function(t,e,r){var n=t.replace(/\+/g," ");if(r==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch{return n}},jt=1024,zu=function(e,r,n,i,o){if(e.length===0)return e;var s=e;if(typeof e=="symbol"?s=Symbol.prototype.toString.call(e):typeof e!="string"&&(s=String(e)),n==="iso-8859-1")return escape(s).replace(/%u[0-9a-f]{4}/gi,function(y){return"%26%23"+parseInt(y.slice(2),16)+"%3B"});for(var a="",c=0;c<s.length;c+=jt){var l=s.length>=jt?s.slice(c,c+jt):s;if(c+jt<s.length){var u=l.charCodeAt(l.length-1);u>=55296&&u<=56319&&(l=l.slice(0,-1),c-=1)}for(var f=[],d=0;d<l.length;++d){var h=l.charCodeAt(d);if(h===45||h===46||h===95||h===126||h>=48&&h<=57||h>=65&&h<=90||h>=97&&h<=122||o===$u.RFC1738&&(h===40||h===41)){f[f.length]=l.charAt(d);continue}if(h<128){f[f.length]=ae[h];continue}if(h<2048){f[f.length]=ae[192|h>>6]+ae[128|h&63];continue}if(h<55296||h>=57344){f[f.length]=ae[224|h>>12]+ae[128|h>>6&63]+ae[128|h&63];continue}d+=1,h=65536+((h&1023)<<10|l.charCodeAt(d)&1023),f[f.length]=ae[240|h>>18]+ae[128|h>>12&63]+ae[128|h>>6&63]+ae[128|h&63]}a+=f.join("")}return a},Gu=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=to(),i=0;i<r.length;++i)for(var o=r[i],s=o.obj[o.prop],a=Object.keys(s),c=0;c<a.length;++c){var l=a[c],u=s[l];typeof u=="object"&&u!==null&&!n.has(u)&&(r[r.length]={obj:s,prop:l},n.set(u,!0))}return ju(r),e},Wu=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},Ku=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e))},Ju=function(e,r,n,i,o){if(_e(e)){if(o)throw new RangeError("Array limit exceeded. Only "+n+" element"+(n===1?"":"s")+" allowed in an array.");for(var s=Se(r)?r:[r],a=pt(e),c=0;c<s.length;++c)a+=1,e[a]=s[c];return Gr(e,a),e}var l=[].concat(e,r);if(l.length>n){if(o)throw new RangeError("Array limit exceeded. Only "+n+" element"+(n===1?"":"s")+" allowed in an array.");return Ae(qe(l,{plainObjects:i}),l.length-1)}return l},Qu=function(e,r){if(Se(e)){for(var n=[],i=0;i<e.length;i+=1)n[n.length]=r(e[i]);return n}return r(e)},no={arrayToObject:qe,assign:Vu,combine:Ju,compact:Gu,decode:qu,encode:zu,isBuffer:Ku,isOverflow:_e,isRegExp:Wu,markOverflow:Ae,maybeMap:Qu,merge:Hu},io=eo,Ht=no,ht=qr,Xu=Object.prototype.hasOwnProperty,oo={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},ce=Array.isArray,Yu=Array.prototype.push,so=function(t,e){Yu.apply(t,ce(e)?e:[e])},Zu=Date.prototype.toISOString,ao=ht.default,U={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",depth:1/0,encode:!0,encodeDotInKeys:!1,encoder:Ht.encode,encodeValuesOnly:!1,filter:void 0,format:ao,formatter:ht.formatters[ao],indices:!1,serializeDate:function(e){return Zu.call(e)},skipNulls:!1,strictNullHandling:!1},ef=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},Kr={},tf=function t(e,r,n,i,o,s,a,c,l,u,f,d,h,y,S,P,m,b,R,E){var C=e;if(E>R)throw new RangeError("Input depth exceeded depth option of "+R);for(var x=b,A=0,H=!1;(x=x.get(Kr))!==void 0&&!H;){var K=x.get(e);if(A+=1,typeof K<"u"){if(K===A)throw new RangeError("Cyclic object value");H=!0}typeof x.get(Kr)>"u"&&(A=0)}if(C=typeof u=="function"?u(r,C):C,C instanceof Date?C=h(C):n==="comma"&&ce(C)&&(C=Ht.maybeMap(C,function(L){return L instanceof Date?h(L):L})),C===null){if(s)return S(l&&!P?l(r,U.encoder,m,"key",y):r);C=""}if(ef(C)||Ht.isBuffer(C)){if(l){var Y=P?r:l(r,U.encoder,m,"key",y);return[S(Y)+"="+S(l(C,U.encoder,m,"value",y))]}return[S(r)+"="+S(String(C))]}var J=[];if(typeof C>"u")return J;var Q;if(n==="comma"&&ce(C))P&&l&&(C=Ht.maybeMap(C,function(L){return L==null?L:l(L)})),Q=[{value:C.length>0?C.join(",")||null:void 0}];else if(ce(u))Q=u;else{var Z=Object.keys(C);Q=f?Z.sort(f):Z}var B=c?String(r).replace(/\./g,"%2E"):String(r),ne=i&&ce(C)&&C.length===1?B+"[]":B;if(o&&ce(C)&&C.length===0&&Object.keys(C).length===0)return ne+"[]";for(var ve=0;ve<Q.length;++ve){var ee=Q[ve],Ke=typeof ee=="object"&&ee&&typeof ee.value<"u"?ee.value:C[ee];if(!(a&&Ke===null)){var mt=d&&c?String(ee).replace(/\./g,"%2E"):String(ee),Xt=ce(C)?typeof n=="function"?n(ne,mt):ne:ne+(d?"."+mt:"["+mt+"]");b.set(e,A);var ie=io();ie.set(Kr,b),so(J,t(Ke,Xt,n,i,o,s,a,c,n==="comma"&&P&&ce(C)?null:l,u,f,d,h,y,S,P,m,ie,R,E+1))}}return J},rf=function(e){if(!e)return U;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys<"u"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var r=e.charset||U.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=ht.default;if(typeof e.format<"u"){if(!Xu.call(ht.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var i=ht.formatters[n],o=U.filter;(typeof e.filter=="function"||ce(e.filter))&&(o=e.filter);var s;if(e.arrayFormat in oo?s=e.arrayFormat:"indices"in e?s=e.indices?"indices":"repeat":s=U.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var a=typeof e.allowDots>"u"?e.encodeDotInKeys===!0?!0:U.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:U.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:U.allowEmptyArrays,arrayFormat:s,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:U.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?U.delimiter:e.delimiter,depth:typeof e.depth=="number"?e.depth:U.depth,encode:typeof e.encode=="boolean"?e.encode:U.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:U.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:U.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:U.encodeValuesOnly,filter:o,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:U.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:U.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:U.strictNullHandling}},nf=function(t,e){var r=t,n=rf(e),i,o;typeof n.filter=="function"?(o=n.filter,r=o("",r)):ce(n.filter)&&(o=n.filter,i=o);var s=[];if(typeof r!="object"||r===null)return"";var a=oo[n.arrayFormat],c=a==="comma"&&n.commaRoundTrip;i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var l=io(),u=0;u<i.length;++u){var f=i[u];if(!(typeof f>"u"||f===null)){var d=r[f];if(!(n.skipNulls&&d===null)){var h=n.encodeDotInKeys?String(f).replace(/\./g,"%2E"):String(f);so(s,tf(d,h,a,c,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,l,n.depth,0))}}}var y=s.join(n.delimiter),S=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?S+="utf8=%26%2310003%3B"+n.delimiter:S+="utf8=%E2%9C%93"+n.delimiter),y.length>0?S+y:""},le=no,Vt=Object.prototype.hasOwnProperty,Jr=Array.isArray,I={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:le.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictMerge:!0,strictNullHandling:!1,throwOnLimitExceeded:!1},of=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},co=function(t,e,r){if(t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1){if(e.throwOnLimitExceeded)for(var n=0,i=t.indexOf(",");i>-1;){if(n+=1,n>=e.arrayLimit)throw new RangeError("Array limit exceeded. Only "+e.arrayLimit+" element"+(e.arrayLimit===1?"":"s")+" allowed in an array.");i=t.indexOf(",",i+1)}return t.split(",")}if(e.throwOnLimitExceeded&&r>=e.arrayLimit)throw new RangeError("Array limit exceeded. Only "+e.arrayLimit+" element"+(e.arrayLimit===1?"":"s")+" allowed in an array.");return t},sf="utf8=%26%2310003%3B",af="utf8=%E2%9C%93",cf=function(e,r){var n={__proto__:null},i=r.ignoreQueryPrefix?e.replace(/^\?/,""):e;i=i.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var o=r.parameterLimit===1/0?void 0:r.parameterLimit,s=i.split(r.delimiter,r.throwOnLimitExceeded&&typeof o<"u"?o+1:o);if(r.throwOnLimitExceeded&&typeof o<"u"&&s.length>o)throw new RangeError("Parameter limit exceeded. Only "+o+" parameter"+(o===1?"":"s")+" allowed.");var a=-1,c,l=r.charset;if(r.charsetSentinel)for(c=0;c<s.length;++c)s[c].indexOf("utf8=")===0&&(s[c]===af?l="utf-8":s[c]===sf&&(l="iso-8859-1"),a=c,c=s.length);for(c=0;c<s.length;++c)if(c!==a){var u=s[c],f=u.indexOf("]="),d=f===-1?u.indexOf("="):f+1,h,y;if(d===-1?(h=r.decoder(u,I.decoder,l,"key"),y=r.strictNullHandling?null:""):(h=r.decoder(u.slice(0,d),I.decoder,l,"key"),h!==null&&(y=le.maybeMap(co(u.slice(d+1),r,Jr(n[h])?n[h].length:0),function(P){return r.decoder(P,I.decoder,l,"value")}))),y&&r.interpretNumericEntities&&l==="iso-8859-1"&&(y=of(String(y))),u.indexOf("[]=")>-1&&(y=Jr(y)?[y]:y),r.comma&&Jr(y)&&y.length>r.arrayLimit&&(y=le.combine([],y,r.arrayLimit,r.plainObjects,r.throwOnLimitExceeded)),h!==null){var S=Vt.call(n,h);S&&(r.duplicates==="combine"||u.indexOf("[]=")>-1)?n[h]=le.combine(n[h],y,r.arrayLimit,r.plainObjects,r.throwOnLimitExceeded):(!S||r.duplicates==="last")&&(n[h]=y)}}return n},lf=function(t,e,r,n){var i=0;if(t.length>0&&t[t.length-1]==="[]"){var o=t.slice(0,-1).join("");i=Array.isArray(e)&&e[o]?e[o].length:0}for(var s=n?e:co(e,r,i),a=t.length-1;a>=0;--a){var c,l=t[a];if(l==="[]"&&r.parseArrays)le.isOverflow(s)?c=s:c=r.allowEmptyArrays&&(s===""||r.strictNullHandling&&s===null)?[]:le.combine([],s,r.arrayLimit,r.plainObjects,r.throwOnLimitExceeded);else{c=r.plainObjects?{__proto__:null}:{};var u=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,f=r.decodeDotInKeys?u.replace(/%2E/g,"."):u,d=parseInt(f,10),h=!isNaN(d)&&l!==f&&String(d)===f&&d>=0&&r.parseArrays;if(!r.parseArrays&&f==="")c={0:s};else if(h&&d<r.arrayLimit)c=[],c[d]=s;else{if(h&&r.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+r.arrayLimit+" element"+(r.arrayLimit===1?"":"s")+" allowed in an array.");h?(c[d]=s,le.markOverflow(c,d)):f!=="__proto__"&&(c[f]=s)}}s=c}return s},uf=function(e,r){var n=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e;if(r.depth<=0)return!r.plainObjects&&Vt.call(Object.prototype,n)&&!r.allowPrototypes?void 0:[n];var i=[],o=n.indexOf("["),s=o>=0?n.slice(0,o):n;if(s){if(!r.plainObjects&&Vt.call(Object.prototype,s)&&!r.allowPrototypes)return;i[i.length]=s}for(var a=n.length,c=o,l=0;c>=0&&l<r.depth;){for(var u=1,f=c+1,d=-1;f<a&&d<0;){var h=n.charCodeAt(f);h===91?u+=1:h===93&&(u-=1,u===0&&(d=f)),f+=1}if(d<0)return i[i.length]="["+n.slice(c)+"]",i;var y=n.slice(c,d+1),S=y.slice(1,-1);if(!r.plainObjects&&Vt.call(Object.prototype,S)&&!r.allowPrototypes)return;i[i.length]=y,l+=1,c=n.indexOf("[",d+1)}if(c>=0){if(r.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+r.depth+" and strictDepth is true");i[i.length]="["+n.slice(c)+"]"}return i},ff=function(e,r,n,i){if(e){var o=uf(e,n);if(o)return lf(o,r,n,i)}},df=function(e){if(!e)return I;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.decodeDotInKeys<"u"&&typeof e.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(e.decoder!==null&&typeof e.decoder<"u"&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof e.throwOnLimitExceeded<"u"&&typeof e.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var r=typeof e.charset>"u"?I.charset:e.charset,n=typeof e.duplicates>"u"?I.duplicates:e.duplicates;if(n!=="combine"&&n!=="first"&&n!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var i=typeof e.allowDots>"u"?e.decodeDotInKeys===!0?!0:I.allowDots:!!e.allowDots;return{allowDots:i,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:I.allowEmptyArrays,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:I.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:I.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:I.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:I.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:I.comma,decodeDotInKeys:typeof e.decodeDotInKeys=="boolean"?e.decodeDotInKeys:I.decodeDotInKeys,decoder:typeof e.decoder=="function"?e.decoder:I.decoder,delimiter:typeof e.delimiter=="string"||le.isRegExp(e.delimiter)?e.delimiter:I.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:I.depth,duplicates:n,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:I.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:I.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:I.plainObjects,strictDepth:typeof e.strictDepth=="boolean"?!!e.strictDepth:I.strictDepth,strictMerge:typeof e.strictMerge=="boolean"?!!e.strictMerge:I.strictMerge,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:I.strictNullHandling,throwOnLimitExceeded:typeof e.throwOnLimitExceeded=="boolean"?e.throwOnLimitExceeded:!1}},pf=function(t,e){var r=df(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?{__proto__:null}:{};for(var n=typeof t=="string"?cf(t,r):t,i=r.plainObjects?{__proto__:null}:{},o=Object.keys(n),s=0;s<o.length;++s){var a=o[s],c=ff(a,n[a],r,typeof t=="string");i=le.merge(i,c,r)}return r.allowSparse===!0?i:le.compact(i)},hf=nf,mf=pf,yf=qr,gf={formats:yf,parse:mf,stringify:hf};const Sf=ai(gf);class lo{constructor(e){g(this,"axiosInstance");this.axiosInstance=F.create({baseURL:e,timeout:12e4})}Request(e){return new Promise((r,n)=>{this.axiosInstance.request(e).then(i=>r(i)).catch(i=>n(i))})}Get(e,r,n){return new Promise((i,o)=>{r&&(n?n.params=r:n={params:r}),n&&(n.paramsSerializer={serialize:(s,a)=>Sf.stringify(s,{indices:!1})}),this.axiosInstance.get(e,n??{}).then(({data:s})=>i(s)).catch(s=>o(s))})}Post(e,r,n){return new Promise((i,o)=>{this.axiosInstance.post(e,r,n??{}).then(({data:s})=>i(s)).catch(s=>o(s))})}Put(e,r,n){return new Promise((i,o)=>{this.axiosInstance.put(e,r,n??{}).then(({data:s})=>i(s)).catch(s=>o(s))})}Delete(e,r,n){return new Promise((i,o)=>{r&&(n?n.data=r:n={data:r}),this.axiosInstance.delete(e,n??{}).then(({data:s})=>i(s)).catch(s=>o(s))})}}class vf{onAddLocalStream(e){console.debug("onAddLocalStream:",e)}onAddRemoteStream(e){console.debug("onAddRemoteStream:",e)}onError(e){console.debug("onError:",e)}onStartSuccess(e){console.debug("onStartSuccess:",e)}onDataChannelMessage(e){console.debug("onDataChannelMessage:",e)}onStopDesktopShare(){console.debug("onStopDesktopShare")}}var T=(t=>(t[t.UNKNOWN=0]="UNKNOWN",t[t.AUDIO=1]="AUDIO",t[t.VIDEO=2]="VIDEO",t[t.RTSP_PULL=3]="RTSP_PULL",t[t.AUDIO_PUSH=4]="AUDIO_PUSH",t[t.VIDEO_PUSH=5]="VIDEO_PUSH",t[t.AUDIO_HALF=6]="AUDIO_HALF",t[t.VIDEO_HALF=7]="VIDEO_HALF",t))(T||{}),z=(t=>(t.FRONT_FACING="user",t.BACK_FACING="environment",t))(z||{});let uo=!0,fo=!0;function qt(t,e,r){const n=t.match(e);return n&&n.length>=r&&parseInt(n[r],10)}function De(t,e,r){if(!t.RTCPeerConnection)return;const n=t.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(s,a){if(s!==e)return i.apply(this,arguments);const c=l=>{const u=r(l);u&&(a.handleEvent?a.handleEvent(u):a(u))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(a,c),i.apply(this,[s,c])};const o=n.removeEventListener;n.removeEventListener=function(s,a){if(s!==e||!this._eventMap||!this._eventMap[e])return o.apply(this,arguments);if(!this._eventMap[e].has(a))return o.apply(this,arguments);const c=this._eventMap[e].get(a);return this._eventMap[e].delete(a),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,o.apply(this,[s,c])},Object.defineProperty(n,"on"+e,{get(){return this["_on"+e]},set(s){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),s&&this.addEventListener(e,this["_on"+e]=s)},enumerable:!0,configurable:!0})}function bf(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(uo=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function Cf(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(fo=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function po(){if(typeof window=="object"){if(uo)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function Qr(t,e){fo&&console.warn(t+" is deprecated, please use "+e+" instead.")}function Rf(t){const e={browser:null,version:null};if(typeof t>"u"||!t.navigator||!t.navigator.userAgent)return e.browser="Not a browser.",e;const{navigator:r}=t;if(r.mozGetUserMedia)e.browser="firefox",e.version=qt(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||t.isSecureContext===!1&&t.webkitRTCPeerConnection)e.browser="chrome",e.version=qt(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(t.RTCPeerConnection&&r.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=qt(r.userAgent,/AppleWebKit\/(\d+)\./,1),e.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype;else return e.browser="Not a supported browser.",e;return e}function ho(t){return Object.prototype.toString.call(t)==="[object Object]"}function mo(t){return ho(t)?Object.keys(t).reduce(function(e,r){const n=ho(t[r]),i=n?mo(t[r]):t[r],o=n&&!Object.keys(i).length;return i===void 0||o?e:Object.assign(e,{[r]:i})},{}):t}function Xr(t,e,r){!e||r.has(e.id)||(r.set(e.id,e),Object.keys(e).forEach(n=>{n.endsWith("Id")?Xr(t,t.get(e[n]),r):n.endsWith("Ids")&&e[n].forEach(i=>{Xr(t,t.get(i),r)})}))}function yo(t,e,r){const n=r?"outbound-rtp":"inbound-rtp",i=new Map;if(e===null)return i;const o=[];return t.forEach(s=>{s.type==="track"&&s.trackIdentifier===e.id&&o.push(s)}),o.forEach(s=>{t.forEach(a=>{a.type===n&&a.trackId===s.id&&Xr(t,a,i)})}),i}const go=po;function So(t,e){const r=t&&t.navigator;if(!r.mediaDevices)return;const n=function(a){if(typeof a!="object"||a.mandatory||a.optional)return a;const c={};return Object.keys(a).forEach(l=>{if(l==="require"||l==="advanced"||l==="mediaSource")return;const u=typeof a[l]=="object"?a[l]:{ideal:a[l]};u.exact!==void 0&&typeof u.exact=="number"&&(u.min=u.max=u.exact);const f=function(d,h){return d?d+h.charAt(0).toUpperCase()+h.slice(1):h==="deviceId"?"sourceId":h};if(u.ideal!==void 0){c.optional=c.optional||[];let d={};typeof u.ideal=="number"?(d[f("min",l)]=u.ideal,c.optional.push(d),d={},d[f("max",l)]=u.ideal,c.optional.push(d)):(d[f("",l)]=u.ideal,c.optional.push(d))}u.exact!==void 0&&typeof u.exact!="number"?(c.mandatory=c.mandatory||{},c.mandatory[f("",l)]=u.exact):["min","max"].forEach(d=>{u[d]!==void 0&&(c.mandatory=c.mandatory||{},c.mandatory[f(d,l)]=u[d])})}),a.advanced&&(c.optional=(c.optional||[]).concat(a.advanced)),c},i=function(a,c){if(e.version>=61)return c(a);if(a=JSON.parse(JSON.stringify(a)),a&&typeof a.audio=="object"){const l=function(u,f,d){f in u&&!(d in u)&&(u[d]=u[f],delete u[f])};a=JSON.parse(JSON.stringify(a)),l(a.audio,"autoGainControl","googAutoGainControl"),l(a.audio,"noiseSuppression","googNoiseSuppression"),a.audio=n(a.audio)}if(a&&typeof a.video=="object"){let l=a.video.facingMode;l=l&&(typeof l=="object"?l:{ideal:l});const u=e.version<66;if(l&&(l.exact==="user"||l.exact==="environment"||l.ideal==="user"||l.ideal==="environment")&&!(r.mediaDevices.getSupportedConstraints&&r.mediaDevices.getSupportedConstraints().facingMode&&!u)){delete a.video.facingMode;let f;if(l.exact==="environment"||l.ideal==="environment"?f=["back","rear"]:(l.exact==="user"||l.ideal==="user")&&(f=["front"]),f)return r.mediaDevices.enumerateDevices().then(d=>{d=d.filter(y=>y.kind==="videoinput");let h=d.find(y=>f.some(S=>y.label.toLowerCase().includes(S)));return!h&&d.length&&f.includes("back")&&(h=d[d.length-1]),h&&(a.video.deviceId=l.exact?{exact:h.deviceId}:{ideal:h.deviceId}),a.video=n(a.video),go("chrome: "+JSON.stringify(a)),c(a)})}a.video=n(a.video)}return go("chrome: "+JSON.stringify(a)),c(a)},o=function(a){return e.version>=64?a:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[a.name]||a.name,message:a.message,constraint:a.constraint||a.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},s=function(a,c,l){i(a,u=>{r.webkitGetUserMedia(u,c,f=>{l&&l(o(f))})})};if(r.getUserMedia=s.bind(r),r.mediaDevices.getUserMedia){const a=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(c){return i(c,l=>a(l).then(u=>{if(l.audio&&!u.getAudioTracks().length||l.video&&!u.getVideoTracks().length)throw u.getTracks().forEach(f=>{f.stop()}),new DOMException("","NotFoundError");return u},u=>Promise.reject(o(u))))}}}function Ef(t,e){if(!(t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices)&&t.navigator.mediaDevices){if(typeof e!="function"){console.error("shimGetDisplayMedia: getSourceId argument is not a function");return}t.navigator.mediaDevices.getDisplayMedia=function(n){return e(n).then(i=>{const o=n.video&&n.video.width,s=n.video&&n.video.height,a=n.video&&n.video.frameRate;return n.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:i,maxFrameRate:a||3}},o&&(n.video.mandatory.maxWidth=o),s&&(n.video.mandatory.maxHeight=s),t.navigator.mediaDevices.getUserMedia(n)})}}}function vo(t){t.MediaStream=t.MediaStream||t.webkitMediaStream}function bo(t){if(typeof t=="object"&&t.RTCPeerConnection&&!("ontrack"in t.RTCPeerConnection.prototype)){Object.defineProperty(t.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(r){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=r)},enumerable:!0,configurable:!0});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=n=>{n.stream.addEventListener("addtrack",i=>{let o;t.RTCPeerConnection.prototype.getReceivers?o=this.getReceivers().find(a=>a.track&&a.track.id===i.track.id):o={track:i.track};const s=new Event("track");s.track=i.track,s.receiver=o,s.transceiver={receiver:o},s.streams=[n.stream],this.dispatchEvent(s)}),n.stream.getTracks().forEach(i=>{let o;t.RTCPeerConnection.prototype.getReceivers?o=this.getReceivers().find(a=>a.track&&a.track.id===i.id):o={track:i};const s=new Event("track");s.track=i,s.receiver=o,s.transceiver={receiver:o},s.streams=[n.stream],this.dispatchEvent(s)})},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else De(t,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function Co(t){if(typeof t=="object"&&t.RTCPeerConnection&&!("getSenders"in t.RTCPeerConnection.prototype)&&"createDTMFSender"in t.RTCPeerConnection.prototype){const e=function(i,o){return{track:o,get dtmf(){return this._dtmf===void 0&&(o.kind==="audio"?this._dtmf=i.createDTMFSender(o):this._dtmf=null),this._dtmf},_pc:i}};if(!t.RTCPeerConnection.prototype.getSenders){t.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const i=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(a,c){let l=i.apply(this,arguments);return l||(l=e(this,a),this._senders.push(l)),l};const o=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(a){o.apply(this,arguments);const c=this._senders.indexOf(a);c!==-1&&this._senders.splice(c,1)}}const r=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(o){this._senders=this._senders||[],r.apply(this,[o]),o.getTracks().forEach(s=>{this._senders.push(e(this,s))})};const n=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(o){this._senders=this._senders||[],n.apply(this,[o]),o.getTracks().forEach(s=>{const a=this._senders.find(c=>c.track===s);a&&this._senders.splice(this._senders.indexOf(a),1)})}}else if(typeof t=="object"&&t.RTCPeerConnection&&"getSenders"in t.RTCPeerConnection.prototype&&"createDTMFSender"in t.RTCPeerConnection.prototype&&t.RTCRtpSender&&!("dtmf"in t.RTCRtpSender.prototype)){const e=t.RTCPeerConnection.prototype.getSenders;t.RTCPeerConnection.prototype.getSenders=function(){const n=e.apply(this,[]);return n.forEach(i=>i._pc=this),n},Object.defineProperty(t.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function Ro(t){if(!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){const[n,i,o]=arguments;if(arguments.length>0&&typeof n=="function")return e.apply(this,arguments);if(e.length===0&&(arguments.length===0||typeof n!="function"))return e.apply(this,[]);const s=function(c){const l={};return c.result().forEach(f=>{const d={id:f.id,timestamp:f.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[f.type]||f.type};f.names().forEach(h=>{d[h]=f.stat(h)}),l[d.id]=d}),l},a=function(c){return new Map(Object.keys(c).map(l=>[l,c[l]]))};if(arguments.length>=2){const c=function(l){i(a(s(l)))};return e.apply(this,[c,n])}return new Promise((c,l)=>{e.apply(this,[function(u){c(a(s(u)))},l])}).then(i,o)}}function Eo(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender&&t.RTCRtpReceiver))return;if(!("getStats"in t.RTCRtpSender.prototype)){const r=t.RTCPeerConnection.prototype.getSenders;r&&(t.RTCPeerConnection.prototype.getSenders=function(){const o=r.apply(this,[]);return o.forEach(s=>s._pc=this),o});const n=t.RTCPeerConnection.prototype.addTrack;n&&(t.RTCPeerConnection.prototype.addTrack=function(){const o=n.apply(this,arguments);return o._pc=this,o}),t.RTCRtpSender.prototype.getStats=function(){const o=this;return this._pc.getStats().then(s=>yo(s,o.track,!0))}}if(!("getStats"in t.RTCRtpReceiver.prototype)){const r=t.RTCPeerConnection.prototype.getReceivers;r&&(t.RTCPeerConnection.prototype.getReceivers=function(){const i=r.apply(this,[]);return i.forEach(o=>o._pc=this),i}),De(t,"track",n=>(n.receiver._pc=n.srcElement,n)),t.RTCRtpReceiver.prototype.getStats=function(){const i=this;return this._pc.getStats().then(o=>yo(o,i.track,!1))}}if(!("getStats"in t.RTCRtpSender.prototype&&"getStats"in t.RTCRtpReceiver.prototype))return;const e=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof t.MediaStreamTrack){const n=arguments[0];let i,o,s;return this.getSenders().forEach(a=>{a.track===n&&(i?s=!0:i=a)}),this.getReceivers().forEach(a=>(a.track===n&&(o?s=!0:o=a),a.track===n)),s||i&&o?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):i?i.getStats():o?o.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}function To(t){t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(s=>this._shimmedLocalStreams[s][0])};const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(s,a){if(!a)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const c=e.apply(this,arguments);return this._shimmedLocalStreams[a.id]?this._shimmedLocalStreams[a.id].indexOf(c)===-1&&this._shimmedLocalStreams[a.id].push(c):this._shimmedLocalStreams[a.id]=[a,c],c};const r=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(s){this._shimmedLocalStreams=this._shimmedLocalStreams||{},s.getTracks().forEach(l=>{if(this.getSenders().find(f=>f.track===l))throw new DOMException("Track already exists.","InvalidAccessError")});const a=this.getSenders();r.apply(this,arguments);const c=this.getSenders().filter(l=>a.indexOf(l)===-1);this._shimmedLocalStreams[s.id]=[s].concat(c)};const n=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(s){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[s.id],n.apply(this,arguments)};const i=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(s){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},s&&Object.keys(this._shimmedLocalStreams).forEach(a=>{const c=this._shimmedLocalStreams[a].indexOf(s);c!==-1&&this._shimmedLocalStreams[a].splice(c,1),this._shimmedLocalStreams[a].length===1&&delete this._shimmedLocalStreams[a]}),i.apply(this,arguments)}}function Po(t,e){if(!t.RTCPeerConnection)return;if(t.RTCPeerConnection.prototype.addTrack&&e.version>=65)return To(t);const r=t.RTCPeerConnection.prototype.getLocalStreams;t.RTCPeerConnection.prototype.getLocalStreams=function(){const u=r.apply(this);return this._reverseStreams=this._reverseStreams||{},u.map(f=>this._reverseStreams[f.id])};const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(u){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},u.getTracks().forEach(f=>{if(this.getSenders().find(h=>h.track===f))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[u.id]){const f=new t.MediaStream(u.getTracks());this._streams[u.id]=f,this._reverseStreams[f.id]=u,u=f}n.apply(this,[u])};const i=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(u){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[u.id]||u]),delete this._reverseStreams[this._streams[u.id]?this._streams[u.id].id:u.id],delete this._streams[u.id]},t.RTCPeerConnection.prototype.addTrack=function(u,f){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const d=[].slice.call(arguments,1);if(d.length!==1||!d[0].getTracks().find(S=>S===u))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(S=>S.track===u))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const y=this._streams[f.id];if(y)y.addTrack(u),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const S=new t.MediaStream([u]);this._streams[f.id]=S,this._reverseStreams[S.id]=f,this.addStream(S)}return this.getSenders().find(S=>S.track===u)};function o(l,u){let f=u.sdp;return Object.keys(l._reverseStreams||[]).forEach(d=>{const h=l._reverseStreams[d],y=l._streams[h.id];f=f.replace(new RegExp(y.id,"g"),h.id)}),new RTCSessionDescription({type:u.type,sdp:f})}function s(l,u){let f=u.sdp;return Object.keys(l._reverseStreams||[]).forEach(d=>{const h=l._reverseStreams[d],y=l._streams[h.id];f=f.replace(new RegExp(h.id,"g"),y.id)}),new RTCSessionDescription({type:u.type,sdp:f})}["createOffer","createAnswer"].forEach(function(l){const u=t.RTCPeerConnection.prototype[l],f={[l](){const d=arguments;return arguments.length&&typeof arguments[0]=="function"?u.apply(this,[y=>{const S=o(this,y);d[0].apply(null,[S])},y=>{d[1]&&d[1].apply(null,y)},arguments[2]]):u.apply(this,arguments).then(y=>o(this,y))}};t.RTCPeerConnection.prototype[l]=f[l]});const a=t.RTCPeerConnection.prototype.setLocalDescription;t.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?a.apply(this,arguments):(arguments[0]=s(this,arguments[0]),a.apply(this,arguments))};const c=Object.getOwnPropertyDescriptor(t.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(t.RTCPeerConnection.prototype,"localDescription",{get(){const l=c.get.apply(this);return l.type===""?l:o(this,l)}}),t.RTCPeerConnection.prototype.removeTrack=function(u){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!u._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(u._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let d;Object.keys(this._streams).forEach(h=>{this._streams[h].getTracks().find(S=>u.track===S)&&(d=this._streams[h])}),d&&(d.getTracks().length===1?this.removeStream(this._reverseStreams[d.id]):d.removeTrack(u.track),this.dispatchEvent(new Event("negotiationneeded")))}}function Yr(t,e){!t.RTCPeerConnection&&t.webkitRTCPeerConnection&&(t.RTCPeerConnection=t.webkitRTCPeerConnection),t.RTCPeerConnection&&e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(r){const n=t.RTCPeerConnection.prototype[r],i={[r](){return arguments[0]=new(r==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};t.RTCPeerConnection.prototype[r]=i[r]})}function Oo(t,e){De(t,"negotiationneeded",r=>{const n=r.target;if(!((e.version<72||n.getConfiguration&&n.getConfiguration().sdpSemantics==="plan-b")&&n.signalingState!=="stable"))return r})}const wo=Object.freeze(Object.defineProperty({__proto__:null,fixNegotiationNeeded:Oo,shimAddTrackRemoveTrack:Po,shimAddTrackRemoveTrackWithNative:To,shimGetDisplayMedia:Ef,shimGetSendersWithDtmf:Co,shimGetStats:Ro,shimGetUserMedia:So,shimMediaStream:vo,shimOnTrack:bo,shimPeerConnection:Yr,shimSenderReceiverGetStats:Eo},Symbol.toStringTag,{value:"Module"}));function Ao(t,e){const r=t&&t.navigator,n=t&&t.MediaStreamTrack;if(r.getUserMedia=function(i,o,s){Qr("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(i).then(o,s)},!(e.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){const i=function(s,a,c){a in s&&!(c in s)&&(s[c]=s[a],delete s[a])},o=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(s){return typeof s=="object"&&typeof s.audio=="object"&&(s=JSON.parse(JSON.stringify(s)),i(s.audio,"autoGainControl","mozAutoGainControl"),i(s.audio,"noiseSuppression","mozNoiseSuppression")),o(s)},n&&n.prototype.getSettings){const s=n.prototype.getSettings;n.prototype.getSettings=function(){const a=s.apply(this,arguments);return i(a,"mozAutoGainControl","autoGainControl"),i(a,"mozNoiseSuppression","noiseSuppression"),a}}if(n&&n.prototype.applyConstraints){const s=n.prototype.applyConstraints;n.prototype.applyConstraints=function(a){return this.kind==="audio"&&typeof a=="object"&&(a=JSON.parse(JSON.stringify(a)),i(a,"autoGainControl","mozAutoGainControl"),i(a,"noiseSuppression","mozNoiseSuppression")),s.apply(this,[a])}}}}function Tf(t,e){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&(t.navigator.mediaDevices.getDisplayMedia=function(n){if(!(n&&n.video)){const i=new DOMException("getDisplayMedia without video constraints is undefined");return i.name="NotFoundError",i.code=8,Promise.reject(i)}return n.video===!0?n.video={mediaSource:e}:n.video.mediaSource=e,t.navigator.mediaDevices.getUserMedia(n)})}function _o(t){typeof t=="object"&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Zr(t,e){if(typeof t!="object"||!(t.RTCPeerConnection||t.mozRTCPeerConnection))return;!t.RTCPeerConnection&&t.mozRTCPeerConnection&&(t.RTCPeerConnection=t.mozRTCPeerConnection),e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(i){const o=t.RTCPeerConnection.prototype[i],s={[i](){return arguments[0]=new(i==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),o.apply(this,arguments)}};t.RTCPeerConnection.prototype[i]=s[i]});const r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){const[o,s,a]=arguments;return n.apply(this,[o||null]).then(c=>{if(e.version<53&&!s)try{c.forEach(l=>{l.type=r[l.type]||l.type})}catch(l){if(l.name!=="TypeError")throw l;c.forEach((u,f)=>{c.set(f,Object.assign({},u,{type:r[u.type]||u.type}))})}return c}).then(s,a)}}function Do(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender)||t.RTCRtpSender&&"getStats"in t.RTCRtpSender.prototype)return;const e=t.RTCPeerConnection.prototype.getSenders;e&&(t.RTCPeerConnection.prototype.getSenders=function(){const i=e.apply(this,[]);return i.forEach(o=>o._pc=this),i});const r=t.RTCPeerConnection.prototype.addTrack;r&&(t.RTCPeerConnection.prototype.addTrack=function(){const i=r.apply(this,arguments);return i._pc=this,i}),t.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function Lo(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender)||t.RTCRtpSender&&"getStats"in t.RTCRtpReceiver.prototype)return;const e=t.RTCPeerConnection.prototype.getReceivers;e&&(t.RTCPeerConnection.prototype.getReceivers=function(){const n=e.apply(this,[]);return n.forEach(i=>i._pc=this),n}),De(t,"track",r=>(r.receiver._pc=r.srcElement,r)),t.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function xo(t){!t.RTCPeerConnection||"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(r){Qr("removeStream","removeTrack"),this.getSenders().forEach(n=>{n.track&&r.getTracks().includes(n.track)&&this.removeTrack(n)})})}function Io(t){t.DataChannel&&!t.RTCDataChannel&&(t.RTCDataChannel=t.DataChannel)}function ko(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.addTransceiver;e&&(t.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let n=arguments[1]&&arguments[1].sendEncodings;n===void 0&&(n=[]),n=[...n];const i=n.length>0;i&&n.forEach(s=>{if("rid"in s&&!/^[a-z0-9]{0,16}$/i.test(s.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in s&&!(parseFloat(s.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in s&&!(parseFloat(s.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const o=e.apply(this,arguments);if(i){const{sender:s}=o,a=s.getParameters();(!("encodings"in a)||a.encodings.length===1&&Object.keys(a.encodings[0]).length===0)&&(a.encodings=n,s.sendEncodings=n,this.setParametersPromises.push(s.setParameters(a).then(()=>{delete s.sendEncodings}).catch(()=>{delete s.sendEncodings})))}return o})}function Fo(t){if(!(typeof t=="object"&&t.RTCRtpSender))return;const e=t.RTCRtpSender.prototype.getParameters;e&&(t.RTCRtpSender.prototype.getParameters=function(){const n=e.apply(this,arguments);return"encodings"in n||(n.encodings=[].concat(this.sendEncodings||[{}])),n})}function Uo(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}function Mo(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.createAnswer;t.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}const No=Object.freeze(Object.defineProperty({__proto__:null,shimAddTransceiver:ko,shimCreateAnswer:Mo,shimCreateOffer:Uo,shimGetDisplayMedia:Tf,shimGetParameters:Fo,shimGetUserMedia:Ao,shimOnTrack:_o,shimPeerConnection:Zr,shimRTCDataChannel:Io,shimReceiverGetStats:Lo,shimRemoveStream:xo,shimSenderGetStats:Do},Symbol.toStringTag,{value:"Module"}));function Bo(t){if(!(typeof t!="object"||!t.RTCPeerConnection)){if("getLocalStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in t.RTCPeerConnection.prototype)){const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addStream=function(n){this._localStreams||(this._localStreams=[]),this._localStreams.includes(n)||this._localStreams.push(n),n.getAudioTracks().forEach(i=>e.call(this,i,n)),n.getVideoTracks().forEach(i=>e.call(this,i,n))},t.RTCPeerConnection.prototype.addTrack=function(n,...i){return i&&i.forEach(o=>{this._localStreams?this._localStreams.includes(o)||this._localStreams.push(o):this._localStreams=[o]}),e.apply(this,arguments)}}"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(r){this._localStreams||(this._localStreams=[]);const n=this._localStreams.indexOf(r);if(n===-1)return;this._localStreams.splice(n,1);const i=r.getTracks();this.getSenders().forEach(o=>{i.includes(o.track)&&this.removeTrack(o)})})}}function $o(t){if(!(typeof t!="object"||!t.RTCPeerConnection)&&("getRemoteStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in t.RTCPeerConnection.prototype))){Object.defineProperty(t.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(r){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=r),this.addEventListener("track",this._onaddstreampoly=n=>{n.streams.forEach(i=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(i))return;this._remoteStreams.push(i);const o=new Event("addstream");o.stream=i,this.dispatchEvent(o)})})}});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){const n=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(i){i.streams.forEach(o=>{if(n._remoteStreams||(n._remoteStreams=[]),n._remoteStreams.indexOf(o)>=0)return;n._remoteStreams.push(o);const s=new Event("addstream");s.stream=o,n.dispatchEvent(s)})}),e.apply(n,arguments)}}}function jo(t){if(typeof t!="object"||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype,r=e.createOffer,n=e.createAnswer,i=e.setLocalDescription,o=e.setRemoteDescription,s=e.addIceCandidate;e.createOffer=function(l,u){const f=arguments.length>=2?arguments[2]:arguments[0],d=r.apply(this,[f]);return u?(d.then(l,u),Promise.resolve()):d},e.createAnswer=function(l,u){const f=arguments.length>=2?arguments[2]:arguments[0],d=n.apply(this,[f]);return u?(d.then(l,u),Promise.resolve()):d};let a=function(c,l,u){const f=i.apply(this,[c]);return u?(f.then(l,u),Promise.resolve()):f};e.setLocalDescription=a,a=function(c,l,u){const f=o.apply(this,[c]);return u?(f.then(l,u),Promise.resolve()):f},e.setRemoteDescription=a,a=function(c,l,u){const f=s.apply(this,[c]);return u?(f.then(l,u),Promise.resolve()):f},e.addIceCandidate=a}function Ho(t){const e=t&&t.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){const r=e.mediaDevices,n=r.getUserMedia.bind(r);e.mediaDevices.getUserMedia=i=>n(Vo(i))}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=(function(n,i,o){e.mediaDevices.getUserMedia(n).then(i,o)}).bind(e))}function Vo(t){return t&&t.video!==void 0?Object.assign({},t,{video:mo(t.video)}):t}function qo(t){if(!t.RTCPeerConnection)return;const e=t.RTCPeerConnection;t.RTCPeerConnection=function(n,i){if(n&&n.iceServers){const o=[];for(let s=0;s<n.iceServers.length;s++){let a=n.iceServers[s];a.urls===void 0&&a.url?(Qr("RTCIceServer.url","RTCIceServer.urls"),a=JSON.parse(JSON.stringify(a)),a.urls=a.url,delete a.url,o.push(a)):o.push(n.iceServers[s])}n.iceServers=o}return new e(n,i)},t.RTCPeerConnection.prototype=e.prototype,"generateCertificate"in e&&Object.defineProperty(t.RTCPeerConnection,"generateCertificate",{get(){return e.generateCertificate}})}function zo(t){typeof t=="object"&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Go(t){const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(n){if(n){typeof n.offerToReceiveAudio<"u"&&(n.offerToReceiveAudio=!!n.offerToReceiveAudio);const i=this.getTransceivers().find(s=>s.receiver.track.kind==="audio");n.offerToReceiveAudio===!1&&i?i.direction==="sendrecv"?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":i.direction==="recvonly"&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):n.offerToReceiveAudio===!0&&!i&&this.addTransceiver("audio",{direction:"recvonly"}),typeof n.offerToReceiveVideo<"u"&&(n.offerToReceiveVideo=!!n.offerToReceiveVideo);const o=this.getTransceivers().find(s=>s.receiver.track.kind==="video");n.offerToReceiveVideo===!1&&o?o.direction==="sendrecv"?o.setDirection?o.setDirection("sendonly"):o.direction="sendonly":o.direction==="recvonly"&&(o.setDirection?o.setDirection("inactive"):o.direction="inactive"):n.offerToReceiveVideo===!0&&!o&&this.addTransceiver("video",{direction:"recvonly"})}return e.apply(this,arguments)}}function Wo(t){typeof t!="object"||t.AudioContext||(t.AudioContext=t.webkitAudioContext)}const Ko=Object.freeze(Object.defineProperty({__proto__:null,shimAudioContext:Wo,shimCallbacksAPI:jo,shimConstraints:Vo,shimCreateOfferLegacy:Go,shimGetUserMedia:Ho,shimLocalStreamsAPI:Bo,shimRTCIceServerUrls:qo,shimRemoteStreamsAPI:$o,shimTrackEventTransceiver:zo},Symbol.toStringTag,{value:"Module"}));var Jo={exports:{}};(function(t){const e={};e.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},e.localCName=e.generateIdentifier(),e.splitLines=function(r){return r.trim().split(`
12
+ `+e.prev}function Lt(t,e){var r=Pr(t),n=[];if(r){n.length=t.length;for(var i=0;i<t.length;i++)n[i]=fe(t,i)?e(t[i],t):""}var o=typeof Rr=="function"?Rr(t):[],s;if(Ne){s={};for(var a=0;a<o.length;a++)s["$"+o[a]]=o[a]}for(var c in t)fe(t,c)&&(r&&String(Number(c))===c&&c<t.length||Ne&&s["$"+c]instanceof Symbol||(li.call(/[^\w$]/,c)?n.push(e(c,t)+": "+e(t[c],t)):n.push(c+": "+e(t[c],t))));if(typeof Rr=="function")for(var l=0;l<o.length;l++)di.call(t,o[l])&&n.push("["+e(o[l])+"]: "+e(t[o[l]],t));return n}var Yc=Dt,Zc=Me,xt=function(t,e,r){for(var n=t,i;(i=n.next)!=null;n=i)if(i.key===e)return n.next=i.next,r||(i.next=t.next,t.next=i),i},el=function(t,e){if(t){var r=xt(t,e);return r&&r.value}},tl=function(t,e,r){var n=xt(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},rl=function(t,e){return t?!!xt(t,e):!1},nl=function(t,e){if(t)return xt(t,e,!0)},il=function(){var e,r={assert:function(n){if(!r.has(n))throw new Zc("Side channel does not contain "+Yc(n))},delete:function(n){var i=nl(e,n);return i&&e&&!e.next&&(e=void 0),!!i},get:function(n){return el(e,n)},has:function(n){return rl(e,n)},set:function(n,i){e||(e={next:void 0}),tl(e,n,i)}};return r},Ti=Object,ol=Error,sl=EvalError,al=RangeError,cl=ReferenceError,ll=SyntaxError,ul=URIError,fl=Math.abs,dl=Math.floor,pl=Math.max,hl=Math.min,ml=Math.pow,yl=Math.round,gl=Number.isNaN||function(e){return e!==e},Sl=gl,vl=function(e){return Sl(e)||e===0?e:e<0?-1:1},bl=Object.getOwnPropertyDescriptor,It=bl;if(It)try{It([],"length")}catch{It=null}var Pi=It,kt=Object.defineProperty||!1;if(kt)try{kt({},"a",{value:1})}catch{kt=!1}var Oi=kt,Ar,wi;function Cl(){return wi||(wi=1,Ar=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[r]=i;for(var o in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(e,r);if(a.value!==i||a.enumerable!==!0)return!1}return!0}),Ar}var _r,Ai;function Rl(){if(Ai)return _r;Ai=1;var t=typeof Symbol<"u"&&Symbol,e=Cl();return _r=function(){return typeof t!="function"||typeof Symbol!="function"||typeof t("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},_r}var Dr,_i;function Di(){return _i||(_i=1,Dr=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Dr}var Lr,Li;function xi(){if(Li)return Lr;Li=1;var t=Ti;return Lr=t.getPrototypeOf||null,Lr}var El="Function.prototype.bind called on incompatible ",Tl=Object.prototype.toString,Pl=Math.max,Ol="[object Function]",Ii=function(e,r){for(var n=[],i=0;i<e.length;i+=1)n[i]=e[i];for(var o=0;o<r.length;o+=1)n[o+e.length]=r[o];return n},wl=function(e,r){for(var n=[],i=r,o=0;i<e.length;i+=1,o+=1)n[o]=e[i];return n},Al=function(t,e){for(var r="",n=0;n<t.length;n+=1)r+=t[n],n+1<t.length&&(r+=e);return r},_l=function(e){var r=this;if(typeof r!="function"||Tl.apply(r)!==Ol)throw new TypeError(El+r);for(var n=wl(arguments,1),i,o=function(){if(this instanceof i){var u=r.apply(this,Ii(n,arguments));return Object(u)===u?u:this}return r.apply(e,Ii(n,arguments))},s=Pl(0,r.length-n.length),a=[],c=0;c<s;c++)a[c]="$"+c;if(i=Function("binder","return function ("+Al(a,",")+"){ return binder.apply(this,arguments); }")(o),r.prototype){var l=function(){};l.prototype=r.prototype,i.prototype=new l,l.prototype=null}return i},Dl=_l,Ft=Function.prototype.bind||Dl,xr=Function.prototype.call,Ir,ki;function Fi(){return ki||(ki=1,Ir=Function.prototype.apply),Ir}var Ll=typeof Reflect<"u"&&Reflect&&Reflect.apply,xl=Ft,Il=Fi(),kl=xr,Fl=Ll,Ul=Fl||xl.call(kl,Il),Ml=Ft,Nl=Me,Bl=xr,$l=Ul,Ui=function(e){if(e.length<1||typeof e[0]!="function")throw new Nl("a function is required");return $l(Ml,Bl,e)},kr,Mi;function jl(){if(Mi)return kr;Mi=1;var t=Ui,e=Pi,r;try{r=[].__proto__===Array.prototype}catch(s){if(!s||typeof s!="object"||!("code"in s)||s.code!=="ERR_PROTO_ACCESS")throw s}var n=!!r&&e&&e(Object.prototype,"__proto__"),i=Object,o=i.getPrototypeOf;return kr=n&&typeof n.get=="function"?t([n.get]):typeof o=="function"?function(a){return o(a==null?a:i(a))}:!1,kr}var Fr,Ni;function Hl(){if(Ni)return Fr;Ni=1;var t=Di(),e=xi(),r=jl();return Fr=t?function(i){return t(i)}:e?function(i){if(!i||typeof i!="object"&&typeof i!="function")throw new TypeError("getProto: not an object");return e(i)}:r?function(i){return r(i)}:null,Fr}var Ur,Bi;function Vl(){if(Bi)return Ur;Bi=1;var t=Function.prototype.call,e=Object.prototype.hasOwnProperty,r=Ft;return Ur=r.call(t,e),Ur}var w,ql=Ti,zl=ol,Gl=sl,Wl=al,Kl=cl,Be=ll,$e=Me,Jl=ul,Ql=fl,Xl=dl,Yl=pl,Zl=hl,eu=ml,tu=yl,ru=vl,$i=Function,Mr=function(t){try{return $i('"use strict"; return ('+t+").constructor;")()}catch{}},lt=Pi,nu=Oi,Nr=function(){throw new $e},iu=lt?function(){try{return arguments.callee,Nr}catch{try{return lt(arguments,"callee").get}catch{return Nr}}}():Nr,je=Rl()(),N=Hl(),ou=xi(),su=Di(),ji=Fi(),ut=xr,He={},au=typeof Uint8Array>"u"||!N?w:N(Uint8Array),we={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?w:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?w:ArrayBuffer,"%ArrayIteratorPrototype%":je&&N?N([][Symbol.iterator]()):w,"%AsyncFromSyncIteratorPrototype%":w,"%AsyncFunction%":He,"%AsyncGenerator%":He,"%AsyncGeneratorFunction%":He,"%AsyncIteratorPrototype%":He,"%Atomics%":typeof Atomics>"u"?w:Atomics,"%BigInt%":typeof BigInt>"u"?w:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?w:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?w:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?w:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":zl,"%eval%":eval,"%EvalError%":Gl,"%Float16Array%":typeof Float16Array>"u"?w:Float16Array,"%Float32Array%":typeof Float32Array>"u"?w:Float32Array,"%Float64Array%":typeof Float64Array>"u"?w:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?w:FinalizationRegistry,"%Function%":$i,"%GeneratorFunction%":He,"%Int8Array%":typeof Int8Array>"u"?w:Int8Array,"%Int16Array%":typeof Int16Array>"u"?w:Int16Array,"%Int32Array%":typeof Int32Array>"u"?w:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":je&&N?N(N([][Symbol.iterator]())):w,"%JSON%":typeof JSON=="object"?JSON:w,"%Map%":typeof Map>"u"?w:Map,"%MapIteratorPrototype%":typeof Map>"u"||!je||!N?w:N(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":ql,"%Object.getOwnPropertyDescriptor%":lt,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?w:Promise,"%Proxy%":typeof Proxy>"u"?w:Proxy,"%RangeError%":Wl,"%ReferenceError%":Kl,"%Reflect%":typeof Reflect>"u"?w:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?w:Set,"%SetIteratorPrototype%":typeof Set>"u"||!je||!N?w:N(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?w:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":je&&N?N(""[Symbol.iterator]()):w,"%Symbol%":je?Symbol:w,"%SyntaxError%":Be,"%ThrowTypeError%":iu,"%TypedArray%":au,"%TypeError%":$e,"%Uint8Array%":typeof Uint8Array>"u"?w:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?w:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?w:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?w:Uint32Array,"%URIError%":Jl,"%WeakMap%":typeof WeakMap>"u"?w:WeakMap,"%WeakRef%":typeof WeakRef>"u"?w:WeakRef,"%WeakSet%":typeof WeakSet>"u"?w:WeakSet,"%Function.prototype.call%":ut,"%Function.prototype.apply%":ji,"%Object.defineProperty%":nu,"%Object.getPrototypeOf%":ou,"%Math.abs%":Ql,"%Math.floor%":Xl,"%Math.max%":Yl,"%Math.min%":Zl,"%Math.pow%":eu,"%Math.round%":tu,"%Math.sign%":ru,"%Reflect.getPrototypeOf%":su};if(N)try{null.error}catch(t){var cu=N(N(t));we["%Error.prototype%"]=cu}var lu=function t(e){var r;if(e==="%AsyncFunction%")r=Mr("async function () {}");else if(e==="%GeneratorFunction%")r=Mr("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=Mr("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&N&&(r=N(i.prototype))}return we[e]=r,r},Hi={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},ft=Ft,Ut=Vl(),uu=ft.call(ut,Array.prototype.concat),fu=ft.call(ji,Array.prototype.splice),Vi=ft.call(ut,String.prototype.replace),Mt=ft.call(ut,String.prototype.slice),du=ft.call(ut,RegExp.prototype.exec),pu=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,hu=/\\(\\)?/g,mu=function(e){var r=Mt(e,0,1),n=Mt(e,-1);if(r==="%"&&n!=="%")throw new Be("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Be("invalid intrinsic syntax, expected opening `%`");var i=[];return Vi(e,pu,function(o,s,a,c){i[i.length]=a?Vi(c,hu,"$1"):s||o}),i},yu=function(e,r){var n=e,i;if(Ut(Hi,n)&&(i=Hi[n],n="%"+i[0]+"%"),Ut(we,n)){var o=we[n];if(o===He&&(o=lu(n)),typeof o>"u"&&!r)throw new $e("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:o}}throw new Be("intrinsic "+e+" does not exist!")},Br=function(e,r){if(typeof e!="string"||e.length===0)throw new $e("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new $e('"allowMissing" argument must be a boolean');if(du(/^%?[^%]*%?$/,e)===null)throw new Be("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=mu(e),i=n.length>0?n[0]:"",o=yu("%"+i+"%",r),s=o.name,a=o.value,c=!1,l=o.alias;l&&(i=l[0],fu(n,uu([0,1],l)));for(var u=1,f=!0;u<n.length;u+=1){var p=n[u],h=Mt(p,0,1),g=Mt(p,-1);if((h==='"'||h==="'"||h==="`"||g==='"'||g==="'"||g==="`")&&h!==g)throw new Be("property names with quotes must have matching quotes");if((p==="constructor"||!f)&&(c=!0),i+="."+p,s="%"+i+"%",Ut(we,s))a=we[s];else if(a!=null){if(!(p in a)){if(!r)throw new $e("base intrinsic for "+e+" exists, but the property is not available.");return}if(lt&&u+1>=n.length){var v=lt(a,p);f=!!v,f&&"get"in v&&!("originalValue"in v.get)?a=v.get:a=a[p]}else f=Ut(a,p),a=a[p];f&&!c&&(we[s]=a)}}return a},qi=Br,zi=Ui,gu=zi([qi("%String.prototype.indexOf%")]),Gi=function(e,r){var n=qi(e,!!r);return typeof n=="function"&&gu(e,".prototype.")>-1?zi([n]):n},Su=Br,dt=Gi,vu=Dt,bu=Me,Wi=Su("%Map%",!0),Cu=dt("Map.prototype.get",!0),Ru=dt("Map.prototype.set",!0),Eu=dt("Map.prototype.has",!0),Tu=dt("Map.prototype.delete",!0),Pu=dt("Map.prototype.size",!0),Ki=!!Wi&&function(){var e,r={assert:function(n){if(!r.has(n))throw new bu("Side channel does not contain "+vu(n))},delete:function(n){if(e){var i=Tu(e,n);return Pu(e)===0&&(e=void 0),i}return!1},get:function(n){if(e)return Cu(e,n)},has:function(n){return e?Eu(e,n):!1},set:function(n,i){e||(e=new Wi),Ru(e,n,i)}};return r},Ou=Br,Nt=Gi,wu=Dt,Bt=Ki,Au=Me,Ve=Ou("%WeakMap%",!0),_u=Nt("WeakMap.prototype.get",!0),Du=Nt("WeakMap.prototype.set",!0),Lu=Nt("WeakMap.prototype.has",!0),xu=Nt("WeakMap.prototype.delete",!0),Iu=Ve?function(){var e,r,n={assert:function(i){if(!n.has(i))throw new Au("Side channel does not contain "+wu(i))},delete:function(i){if(Ve&&i&&(typeof i=="object"||typeof i=="function")){if(e)return xu(e,i)}else if(Bt&&r)return r.delete(i);return!1},get:function(i){return Ve&&i&&(typeof i=="object"||typeof i=="function")&&e?_u(e,i):r&&r.get(i)},has:function(i){return Ve&&i&&(typeof i=="object"||typeof i=="function")&&e?Lu(e,i):!!r&&r.has(i)},set:function(i,o){Ve&&i&&(typeof i=="object"||typeof i=="function")?(e||(e=new Ve),Du(e,i,o)):Bt&&(r||(r=Bt()),r.set(i,o))}};return n}:Bt,ku=Me,Fu=Dt,Uu=il,Mu=Ki,Nu=Iu,Bu=Nu||Mu||Uu,Ji=function(){var e,r={assert:function(n){if(!r.has(n)){var i=n&&Object(n)===n?"the given object key":Fu(n);throw new ku("Side channel does not contain "+i)}},delete:function(n){return!!e&&e.delete(n)},get:function(n){return e&&e.get(n)},has:function(n){return!!e&&e.has(n)},set:function(n,i){e||(e=Bu()),e.set(n,i)}};return r},$u=String.prototype.replace,ju=/%20/g,$r={RFC1738:"RFC1738",RFC3986:"RFC3986"},jr={default:$r.RFC3986,formatters:{RFC1738:function(t){return $u.call(t,ju,"+")},RFC3986:function(t){return String(t)}},RFC1738:$r.RFC1738,RFC3986:$r.RFC3986},Hu=jr,Qi=Ji,Xi=Oi,Hr=Object.prototype.hasOwnProperty,Se=Array.isArray,$t=Qi(),Ae=function(e,r){return $t.set(e,r),e},_e=function(e){return $t.has(e)},pt=function(e){return $t.get(e)},Vr=function(e,r){$t.set(e,r)},ae=function(){for(var t=[],e=0;e<256;++e)t[t.length]="%"+((e<16?"0":"")+e.toString(16)).toUpperCase();return t}(),Vu=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(Se(n)){for(var i=[],o=0;o<n.length;++o)typeof n[o]<"u"&&(i[i.length]=n[o]);r.obj[r.prop]=i}}},qe=function(e,r){for(var n=r&&r.plainObjects?{__proto__:null}:{},i=0;i<e.length;++i)typeof e[i]<"u"&&(n[i]=e[i]);return n},qr=function(e,r,n){r==="__proto__"&&Xi?Xi(e,r,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[r]=n},qu=function t(e,r,n){if(!r)return e;if(typeof r!="object"&&typeof r!="function"){if(Se(e)){var i=e.length;if(n&&typeof n.arrayLimit=="number"&&i>=n.arrayLimit){if(n.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+n.arrayLimit+" element"+(n.arrayLimit===1?"":"s")+" allowed in an array.");return Ae(qe(e.concat(r),n),i)}e[i]=r}else if(e&&typeof e=="object")if(_e(e)){var o=pt(e)+1;e[o]=r,Vr(e,o)}else{if(n&&n.strictMerge)return[e,r];(n&&(n.plainObjects||n.allowPrototypes)||!Hr.call(Object.prototype,r))&&(e[r]=!0)}else return[e,r];return e}if(!e||typeof e!="object"){if(_e(r)){for(var s=Object.keys(r),a=n&&n.plainObjects?{__proto__:null,0:e}:{0:e},c=0;c<s.length;c++){var l=parseInt(s[c],10);a[l+1]=r[s[c]]}return Ae(a,pt(r)+1)}var u=[e].concat(r);if(n&&typeof n.arrayLimit=="number"&&u.length>n.arrayLimit){if(n.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+n.arrayLimit+" element"+(n.arrayLimit===1?"":"s")+" allowed in an array.");return Ae(qe(u,n),u.length-1)}return u}var f=e;if(Se(e)&&!Se(r)&&(f=qe(e,n)),Se(e)&&Se(r)){if(r.forEach(function(p,h){if(Hr.call(e,h)){var g=e[h];g&&typeof g=="object"&&p&&typeof p=="object"?e[h]=t(g,p,n):e[e.length]=p}else e[h]=p}),n&&typeof n.arrayLimit=="number"&&e.length>n.arrayLimit){if(n.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+n.arrayLimit+" element"+(n.arrayLimit===1?"":"s")+" allowed in an array.");return Ae(qe(e,n),e.length-1)}return e}return Object.keys(r).reduce(function(p,h){var g=r[h];if(Hr.call(p,h)?qr(p,h,t(p[h],g,n)):qr(p,h,g),_e(r)&&!_e(p)&&Ae(p,pt(r)),_e(p)){var v=parseInt(h,10);String(v)===h&&v>=0&&v>pt(p)&&Vr(p,v)}return p},f)},zu=function(e,r){return Object.keys(r).reduce(function(n,i){return qr(n,i,r[i]),n},e)},Gu=function(t,e,r){var n=t.replace(/\+/g," ");if(r==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch{return n}},jt=1024,Wu=function(e,r,n,i,o){if(e.length===0)return e;var s=e;if(typeof e=="symbol"?s=Symbol.prototype.toString.call(e):typeof e!="string"&&(s=String(e)),n==="iso-8859-1")return escape(s).replace(/%u[0-9a-f]{4}/gi,function(g){return"%26%23"+parseInt(g.slice(2),16)+"%3B"});for(var a="",c=0;c<s.length;c+=jt){var l=s.length>=jt?s.slice(c,c+jt):s;if(c+jt<s.length){var u=l.charCodeAt(l.length-1);u>=55296&&u<=56319&&(l=l.slice(0,-1),c-=1)}for(var f=[],p=0;p<l.length;++p){var h=l.charCodeAt(p);if(h===45||h===46||h===95||h===126||h>=48&&h<=57||h>=65&&h<=90||h>=97&&h<=122||o===Hu.RFC1738&&(h===40||h===41)){f[f.length]=l.charAt(p);continue}if(h<128){f[f.length]=ae[h];continue}if(h<2048){f[f.length]=ae[192|h>>6]+ae[128|h&63];continue}if(h<55296||h>=57344){f[f.length]=ae[224|h>>12]+ae[128|h>>6&63]+ae[128|h&63];continue}p+=1,h=65536+((h&1023)<<10|l.charCodeAt(p)&1023),f[f.length]=ae[240|h>>18]+ae[128|h>>12&63]+ae[128|h>>6&63]+ae[128|h&63]}a+=f.join("")}return a},Ku=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=Qi(),i=0;i<r.length;++i)for(var o=r[i],s=o.obj[o.prop],a=Object.keys(s),c=0;c<a.length;++c){var l=a[c],u=s[l];typeof u=="object"&&u!==null&&!n.has(u)&&(r[r.length]={obj:s,prop:l},n.set(u,!0))}return Vu(r),e},Ju=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},Qu=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e))},Xu=function(e,r,n,i,o){if(_e(e)){if(o)throw new RangeError("Array limit exceeded. Only "+n+" element"+(n===1?"":"s")+" allowed in an array.");for(var s=Se(r)?r:[r],a=pt(e),c=0;c<s.length;++c)a+=1,e[a]=s[c];return Vr(e,a),e}var l=[].concat(e,r);if(l.length>n){if(o)throw new RangeError("Array limit exceeded. Only "+n+" element"+(n===1?"":"s")+" allowed in an array.");return Ae(qe(l,{plainObjects:i}),l.length-1)}return l},Yu=function(e,r){if(Se(e)){for(var n=[],i=0;i<e.length;i+=1)n[n.length]=r(e[i]);return n}return r(e)},Yi={arrayToObject:qe,assign:zu,combine:Xu,compact:Ku,decode:Gu,encode:Wu,isBuffer:Qu,isOverflow:_e,isRegExp:Ju,markOverflow:Ae,maybeMap:Yu,merge:qu},Zi=Ji,Ht=Yi,ht=jr,Zu=Object.prototype.hasOwnProperty,eo={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},ce=Array.isArray,ef=Array.prototype.push,to=function(t,e){ef.apply(t,ce(e)?e:[e])},tf=Date.prototype.toISOString,ro=ht.default,U={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",depth:1/0,encode:!0,encodeDotInKeys:!1,encoder:Ht.encode,encodeValuesOnly:!1,filter:void 0,format:ro,formatter:ht.formatters[ro],indices:!1,serializeDate:function(e){return tf.call(e)},skipNulls:!1,strictNullHandling:!1},rf=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},zr={},nf=function t(e,r,n,i,o,s,a,c,l,u,f,p,h,g,v,O,m,b,R,E){var C=e;if(E>R)throw new RangeError("Input depth exceeded depth option of "+R);for(var x=b,A=0,H=!1;(x=x.get(zr))!==void 0&&!H;){var K=x.get(e);if(A+=1,typeof K<"u"){if(K===A)throw new RangeError("Cyclic object value");H=!0}typeof x.get(zr)>"u"&&(A=0)}if(C=typeof u=="function"?u(r,C):C,C instanceof Date?C=h(C):n==="comma"&&ce(C)&&(C=Ht.maybeMap(C,function(L){return L instanceof Date?h(L):L})),C===null){if(s)return v(l&&!O?l(r,U.encoder,m,"key",g):r);C=""}if(rf(C)||Ht.isBuffer(C)){if(l){var Y=O?r:l(r,U.encoder,m,"key",g);return[v(Y)+"="+v(l(C,U.encoder,m,"value",g))]}return[v(r)+"="+v(String(C))]}var J=[];if(typeof C>"u")return J;var Q;if(n==="comma"&&ce(C))O&&l&&(C=Ht.maybeMap(C,function(L){return L==null?L:l(L)})),Q=[{value:C.length>0?C.join(",")||null:void 0}];else if(ce(u))Q=u;else{var Z=Object.keys(C);Q=f?Z.sort(f):Z}var B=c?String(r).replace(/\./g,"%2E"):String(r),ne=i&&ce(C)&&C.length===1?B+"[]":B;if(o&&ce(C)&&C.length===0&&Object.keys(C).length===0)return ne+"[]";for(var ve=0;ve<Q.length;++ve){var ee=Q[ve],Ke=typeof ee=="object"&&ee&&typeof ee.value<"u"?ee.value:C[ee];if(!(a&&Ke===null)){var mt=p&&c?String(ee).replace(/\./g,"%2E"):String(ee),Xt=ce(C)?typeof n=="function"?n(ne,mt):ne:ne+(p?"."+mt:"["+mt+"]");b.set(e,A);var ie=Zi();ie.set(zr,b),to(J,t(Ke,Xt,n,i,o,s,a,c,n==="comma"&&O&&ce(C)?null:l,u,f,p,h,g,v,O,m,ie,R,E+1))}}return J},of=function(e){if(!e)return U;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys<"u"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var r=e.charset||U.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=ht.default;if(typeof e.format<"u"){if(!Zu.call(ht.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var i=ht.formatters[n],o=U.filter;(typeof e.filter=="function"||ce(e.filter))&&(o=e.filter);var s;if(e.arrayFormat in eo?s=e.arrayFormat:"indices"in e?s=e.indices?"indices":"repeat":s=U.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var a=typeof e.allowDots>"u"?e.encodeDotInKeys===!0?!0:U.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:U.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:U.allowEmptyArrays,arrayFormat:s,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:U.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?U.delimiter:e.delimiter,depth:typeof e.depth=="number"?e.depth:U.depth,encode:typeof e.encode=="boolean"?e.encode:U.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:U.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:U.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:U.encodeValuesOnly,filter:o,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:U.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:U.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:U.strictNullHandling}},sf=function(t,e){var r=t,n=of(e),i,o;typeof n.filter=="function"?(o=n.filter,r=o("",r)):ce(n.filter)&&(o=n.filter,i=o);var s=[];if(typeof r!="object"||r===null)return"";var a=eo[n.arrayFormat],c=a==="comma"&&n.commaRoundTrip;i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var l=Zi(),u=0;u<i.length;++u){var f=i[u];if(!(typeof f>"u"||f===null)){var p=r[f];if(!(n.skipNulls&&p===null)){var h=n.encodeDotInKeys?String(f).replace(/\./g,"%2E"):String(f);to(s,nf(p,h,a,c,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,l,n.depth,0))}}}var g=s.join(n.delimiter),v=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?v+="utf8=%26%2310003%3B"+n.delimiter:v+="utf8=%E2%9C%93"+n.delimiter),g.length>0?v+g:""},le=Yi,Vt=Object.prototype.hasOwnProperty,Gr=Array.isArray,I={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:le.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictMerge:!0,strictNullHandling:!1,throwOnLimitExceeded:!1},af=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},no=function(t,e,r){if(t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1){if(e.throwOnLimitExceeded)for(var n=0,i=t.indexOf(",");i>-1;){if(n+=1,n>=e.arrayLimit)throw new RangeError("Array limit exceeded. Only "+e.arrayLimit+" element"+(e.arrayLimit===1?"":"s")+" allowed in an array.");i=t.indexOf(",",i+1)}return t.split(",")}if(e.throwOnLimitExceeded&&r>=e.arrayLimit)throw new RangeError("Array limit exceeded. Only "+e.arrayLimit+" element"+(e.arrayLimit===1?"":"s")+" allowed in an array.");return t},cf="utf8=%26%2310003%3B",lf="utf8=%E2%9C%93",uf=function(e,r){var n={__proto__:null},i=r.ignoreQueryPrefix?e.replace(/^\?/,""):e;i=i.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var o=r.parameterLimit===1/0?void 0:r.parameterLimit,s=i.split(r.delimiter,r.throwOnLimitExceeded&&typeof o<"u"?o+1:o);if(r.throwOnLimitExceeded&&typeof o<"u"&&s.length>o)throw new RangeError("Parameter limit exceeded. Only "+o+" parameter"+(o===1?"":"s")+" allowed.");var a=-1,c,l=r.charset;if(r.charsetSentinel)for(c=0;c<s.length;++c)s[c].indexOf("utf8=")===0&&(s[c]===lf?l="utf-8":s[c]===cf&&(l="iso-8859-1"),a=c,c=s.length);for(c=0;c<s.length;++c)if(c!==a){var u=s[c],f=u.indexOf("]="),p=f===-1?u.indexOf("="):f+1,h,g;if(p===-1?(h=r.decoder(u,I.decoder,l,"key"),g=r.strictNullHandling?null:""):(h=r.decoder(u.slice(0,p),I.decoder,l,"key"),h!==null&&(g=le.maybeMap(no(u.slice(p+1),r,Gr(n[h])?n[h].length:0),function(O){return r.decoder(O,I.decoder,l,"value")}))),g&&r.interpretNumericEntities&&l==="iso-8859-1"&&(g=af(String(g))),u.indexOf("[]=")>-1&&(g=Gr(g)?[g]:g),r.comma&&Gr(g)&&g.length>r.arrayLimit&&(g=le.combine([],g,r.arrayLimit,r.plainObjects,r.throwOnLimitExceeded)),h!==null){var v=Vt.call(n,h);v&&(r.duplicates==="combine"||u.indexOf("[]=")>-1)?n[h]=le.combine(n[h],g,r.arrayLimit,r.plainObjects,r.throwOnLimitExceeded):(!v||r.duplicates==="last")&&(n[h]=g)}}return n},ff=function(t,e,r,n){var i=0;if(t.length>0&&t[t.length-1]==="[]"){var o=t.slice(0,-1).join("");i=Array.isArray(e)&&e[o]?e[o].length:0}for(var s=n?e:no(e,r,i),a=t.length-1;a>=0;--a){var c,l=t[a];if(l==="[]"&&r.parseArrays)le.isOverflow(s)?c=s:c=r.allowEmptyArrays&&(s===""||r.strictNullHandling&&s===null)?[]:le.combine([],s,r.arrayLimit,r.plainObjects,r.throwOnLimitExceeded);else{c=r.plainObjects?{__proto__:null}:{};var u=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,f=r.decodeDotInKeys?u.replace(/%2E/g,"."):u,p=parseInt(f,10),h=!isNaN(p)&&l!==f&&String(p)===f&&p>=0&&r.parseArrays;if(!r.parseArrays&&f==="")c={0:s};else if(h&&p<r.arrayLimit)c=[],c[p]=s;else{if(h&&r.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+r.arrayLimit+" element"+(r.arrayLimit===1?"":"s")+" allowed in an array.");h?(c[p]=s,le.markOverflow(c,p)):f!=="__proto__"&&(c[f]=s)}}s=c}return s},df=function(e,r){var n=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e;if(r.depth<=0)return!r.plainObjects&&Vt.call(Object.prototype,n)&&!r.allowPrototypes?void 0:[n];var i=[],o=n.indexOf("["),s=o>=0?n.slice(0,o):n;if(s){if(!r.plainObjects&&Vt.call(Object.prototype,s)&&!r.allowPrototypes)return;i[i.length]=s}for(var a=n.length,c=o,l=0;c>=0&&l<r.depth;){for(var u=1,f=c+1,p=-1;f<a&&p<0;){var h=n.charCodeAt(f);h===91?u+=1:h===93&&(u-=1,u===0&&(p=f)),f+=1}if(p<0)return i[i.length]="["+n.slice(c)+"]",i;var g=n.slice(c,p+1),v=g.slice(1,-1);if(!r.plainObjects&&Vt.call(Object.prototype,v)&&!r.allowPrototypes)return;i[i.length]=g,l+=1,c=n.indexOf("[",p+1)}if(c>=0){if(r.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+r.depth+" and strictDepth is true");i[i.length]="["+n.slice(c)+"]"}return i},pf=function(e,r,n,i){if(e){var o=df(e,n);if(o)return ff(o,r,n,i)}},hf=function(e){if(!e)return I;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.decodeDotInKeys<"u"&&typeof e.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(e.decoder!==null&&typeof e.decoder<"u"&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof e.throwOnLimitExceeded<"u"&&typeof e.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var r=typeof e.charset>"u"?I.charset:e.charset,n=typeof e.duplicates>"u"?I.duplicates:e.duplicates;if(n!=="combine"&&n!=="first"&&n!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var i=typeof e.allowDots>"u"?e.decodeDotInKeys===!0?!0:I.allowDots:!!e.allowDots;return{allowDots:i,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:I.allowEmptyArrays,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:I.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:I.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:I.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:I.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:I.comma,decodeDotInKeys:typeof e.decodeDotInKeys=="boolean"?e.decodeDotInKeys:I.decodeDotInKeys,decoder:typeof e.decoder=="function"?e.decoder:I.decoder,delimiter:typeof e.delimiter=="string"||le.isRegExp(e.delimiter)?e.delimiter:I.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:I.depth,duplicates:n,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:I.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:I.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:I.plainObjects,strictDepth:typeof e.strictDepth=="boolean"?!!e.strictDepth:I.strictDepth,strictMerge:typeof e.strictMerge=="boolean"?!!e.strictMerge:I.strictMerge,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:I.strictNullHandling,throwOnLimitExceeded:typeof e.throwOnLimitExceeded=="boolean"?e.throwOnLimitExceeded:!1}},mf=function(t,e){var r=hf(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?{__proto__:null}:{};for(var n=typeof t=="string"?uf(t,r):t,i=r.plainObjects?{__proto__:null}:{},o=Object.keys(n),s=0;s<o.length;++s){var a=o[s],c=pf(a,n[a],r,typeof t=="string");i=le.merge(i,c,r)}return r.allowSparse===!0?i:le.compact(i)},yf=sf,gf=mf,Sf=jr,vf={formats:Sf,parse:gf,stringify:yf};const bf=ii(vf);class io{constructor(e){y(this,"axiosInstance");this.axiosInstance=F.create({baseURL:e,timeout:12e4})}Request(e){return new Promise((r,n)=>{this.axiosInstance.request(e).then(i=>r(i)).catch(i=>n(i))})}Get(e,r,n){return new Promise((i,o)=>{r&&(n?n.params=r:n={params:r}),n&&(n.paramsSerializer={serialize:(s,a)=>bf.stringify(s,{indices:!1})}),this.axiosInstance.get(e,n??{}).then(({data:s})=>i(s)).catch(s=>o(s))})}Post(e,r,n){return new Promise((i,o)=>{this.axiosInstance.post(e,r,n??{}).then(({data:s})=>i(s)).catch(s=>o(s))})}Put(e,r,n){return new Promise((i,o)=>{this.axiosInstance.put(e,r,n??{}).then(({data:s})=>i(s)).catch(s=>o(s))})}Delete(e,r,n){return new Promise((i,o)=>{r&&(n?n.data=r:n={data:r}),this.axiosInstance.delete(e,n??{}).then(({data:s})=>i(s)).catch(s=>o(s))})}}class Cf{onAddLocalStream(e){console.debug("onAddLocalStream:",e)}onAddRemoteStream(e){console.debug("onAddRemoteStream:",e)}onError(e){console.debug("onError:",e)}onStartSuccess(e){console.debug("onStartSuccess:",e)}onDataChannelMessage(e){console.debug("onDataChannelMessage:",e)}onStopDesktopShare(){console.debug("onStopDesktopShare")}}var T=(t=>(t[t.UNKNOWN=0]="UNKNOWN",t[t.AUDIO=1]="AUDIO",t[t.VIDEO=2]="VIDEO",t[t.RTSP_PULL=3]="RTSP_PULL",t[t.AUDIO_PUSH=4]="AUDIO_PUSH",t[t.VIDEO_PUSH=5]="VIDEO_PUSH",t[t.AUDIO_HALF=6]="AUDIO_HALF",t[t.VIDEO_HALF=7]="VIDEO_HALF",t))(T||{}),z=(t=>(t.FRONT_FACING="user",t.BACK_FACING="environment",t))(z||{});let oo=!0,so=!0;function qt(t,e,r){const n=t.match(e);return n&&n.length>=r&&parseInt(n[r],10)}function De(t,e,r){if(!t.RTCPeerConnection)return;const n=t.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(s,a){if(s!==e)return i.apply(this,arguments);const c=l=>{const u=r(l);u&&(a.handleEvent?a.handleEvent(u):a(u))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(a,c),i.apply(this,[s,c])};const o=n.removeEventListener;n.removeEventListener=function(s,a){if(s!==e||!this._eventMap||!this._eventMap[e])return o.apply(this,arguments);if(!this._eventMap[e].has(a))return o.apply(this,arguments);const c=this._eventMap[e].get(a);return this._eventMap[e].delete(a),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,o.apply(this,[s,c])},Object.defineProperty(n,"on"+e,{get(){return this["_on"+e]},set(s){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),s&&this.addEventListener(e,this["_on"+e]=s)},enumerable:!0,configurable:!0})}function Rf(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(oo=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function Ef(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(so=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function ao(){if(typeof window=="object"){if(oo)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function Wr(t,e){so&&console.warn(t+" is deprecated, please use "+e+" instead.")}function Tf(t){const e={browser:null,version:null};if(typeof t>"u"||!t.navigator||!t.navigator.userAgent)return e.browser="Not a browser.",e;const{navigator:r}=t;if(r.mozGetUserMedia)e.browser="firefox",e.version=qt(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||t.isSecureContext===!1&&t.webkitRTCPeerConnection)e.browser="chrome",e.version=qt(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(t.RTCPeerConnection&&r.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=qt(r.userAgent,/AppleWebKit\/(\d+)\./,1),e.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype;else return e.browser="Not a supported browser.",e;return e}function co(t){return Object.prototype.toString.call(t)==="[object Object]"}function lo(t){return co(t)?Object.keys(t).reduce(function(e,r){const n=co(t[r]),i=n?lo(t[r]):t[r],o=n&&!Object.keys(i).length;return i===void 0||o?e:Object.assign(e,{[r]:i})},{}):t}function Kr(t,e,r){!e||r.has(e.id)||(r.set(e.id,e),Object.keys(e).forEach(n=>{n.endsWith("Id")?Kr(t,t.get(e[n]),r):n.endsWith("Ids")&&e[n].forEach(i=>{Kr(t,t.get(i),r)})}))}function uo(t,e,r){const n=r?"outbound-rtp":"inbound-rtp",i=new Map;if(e===null)return i;const o=[];return t.forEach(s=>{s.type==="track"&&s.trackIdentifier===e.id&&o.push(s)}),o.forEach(s=>{t.forEach(a=>{a.type===n&&a.trackId===s.id&&Kr(t,a,i)})}),i}const fo=ao;function po(t,e){const r=t&&t.navigator;if(!r.mediaDevices)return;const n=function(a){if(typeof a!="object"||a.mandatory||a.optional)return a;const c={};return Object.keys(a).forEach(l=>{if(l==="require"||l==="advanced"||l==="mediaSource")return;const u=typeof a[l]=="object"?a[l]:{ideal:a[l]};u.exact!==void 0&&typeof u.exact=="number"&&(u.min=u.max=u.exact);const f=function(p,h){return p?p+h.charAt(0).toUpperCase()+h.slice(1):h==="deviceId"?"sourceId":h};if(u.ideal!==void 0){c.optional=c.optional||[];let p={};typeof u.ideal=="number"?(p[f("min",l)]=u.ideal,c.optional.push(p),p={},p[f("max",l)]=u.ideal,c.optional.push(p)):(p[f("",l)]=u.ideal,c.optional.push(p))}u.exact!==void 0&&typeof u.exact!="number"?(c.mandatory=c.mandatory||{},c.mandatory[f("",l)]=u.exact):["min","max"].forEach(p=>{u[p]!==void 0&&(c.mandatory=c.mandatory||{},c.mandatory[f(p,l)]=u[p])})}),a.advanced&&(c.optional=(c.optional||[]).concat(a.advanced)),c},i=function(a,c){if(e.version>=61)return c(a);if(a=JSON.parse(JSON.stringify(a)),a&&typeof a.audio=="object"){const l=function(u,f,p){f in u&&!(p in u)&&(u[p]=u[f],delete u[f])};a=JSON.parse(JSON.stringify(a)),l(a.audio,"autoGainControl","googAutoGainControl"),l(a.audio,"noiseSuppression","googNoiseSuppression"),a.audio=n(a.audio)}if(a&&typeof a.video=="object"){let l=a.video.facingMode;l=l&&(typeof l=="object"?l:{ideal:l});const u=e.version<66;if(l&&(l.exact==="user"||l.exact==="environment"||l.ideal==="user"||l.ideal==="environment")&&!(r.mediaDevices.getSupportedConstraints&&r.mediaDevices.getSupportedConstraints().facingMode&&!u)){delete a.video.facingMode;let f;if(l.exact==="environment"||l.ideal==="environment"?f=["back","rear"]:(l.exact==="user"||l.ideal==="user")&&(f=["front"]),f)return r.mediaDevices.enumerateDevices().then(p=>{p=p.filter(g=>g.kind==="videoinput");let h=p.find(g=>f.some(v=>g.label.toLowerCase().includes(v)));return!h&&p.length&&f.includes("back")&&(h=p[p.length-1]),h&&(a.video.deviceId=l.exact?{exact:h.deviceId}:{ideal:h.deviceId}),a.video=n(a.video),fo("chrome: "+JSON.stringify(a)),c(a)})}a.video=n(a.video)}return fo("chrome: "+JSON.stringify(a)),c(a)},o=function(a){return e.version>=64?a:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[a.name]||a.name,message:a.message,constraint:a.constraint||a.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},s=function(a,c,l){i(a,u=>{r.webkitGetUserMedia(u,c,f=>{l&&l(o(f))})})};if(r.getUserMedia=s.bind(r),r.mediaDevices.getUserMedia){const a=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(c){return i(c,l=>a(l).then(u=>{if(l.audio&&!u.getAudioTracks().length||l.video&&!u.getVideoTracks().length)throw u.getTracks().forEach(f=>{f.stop()}),new DOMException("","NotFoundError");return u},u=>Promise.reject(o(u))))}}}function Pf(t,e){if(!(t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices)&&t.navigator.mediaDevices){if(typeof e!="function"){console.error("shimGetDisplayMedia: getSourceId argument is not a function");return}t.navigator.mediaDevices.getDisplayMedia=function(n){return e(n).then(i=>{const o=n.video&&n.video.width,s=n.video&&n.video.height,a=n.video&&n.video.frameRate;return n.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:i,maxFrameRate:a||3}},o&&(n.video.mandatory.maxWidth=o),s&&(n.video.mandatory.maxHeight=s),t.navigator.mediaDevices.getUserMedia(n)})}}}function ho(t){t.MediaStream=t.MediaStream||t.webkitMediaStream}function mo(t){if(typeof t=="object"&&t.RTCPeerConnection&&!("ontrack"in t.RTCPeerConnection.prototype)){Object.defineProperty(t.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(r){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=r)},enumerable:!0,configurable:!0});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=n=>{n.stream.addEventListener("addtrack",i=>{let o;t.RTCPeerConnection.prototype.getReceivers?o=this.getReceivers().find(a=>a.track&&a.track.id===i.track.id):o={track:i.track};const s=new Event("track");s.track=i.track,s.receiver=o,s.transceiver={receiver:o},s.streams=[n.stream],this.dispatchEvent(s)}),n.stream.getTracks().forEach(i=>{let o;t.RTCPeerConnection.prototype.getReceivers?o=this.getReceivers().find(a=>a.track&&a.track.id===i.id):o={track:i};const s=new Event("track");s.track=i,s.receiver=o,s.transceiver={receiver:o},s.streams=[n.stream],this.dispatchEvent(s)})},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else De(t,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function yo(t){if(typeof t=="object"&&t.RTCPeerConnection&&!("getSenders"in t.RTCPeerConnection.prototype)&&"createDTMFSender"in t.RTCPeerConnection.prototype){const e=function(i,o){return{track:o,get dtmf(){return this._dtmf===void 0&&(o.kind==="audio"?this._dtmf=i.createDTMFSender(o):this._dtmf=null),this._dtmf},_pc:i}};if(!t.RTCPeerConnection.prototype.getSenders){t.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const i=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(a,c){let l=i.apply(this,arguments);return l||(l=e(this,a),this._senders.push(l)),l};const o=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(a){o.apply(this,arguments);const c=this._senders.indexOf(a);c!==-1&&this._senders.splice(c,1)}}const r=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(o){this._senders=this._senders||[],r.apply(this,[o]),o.getTracks().forEach(s=>{this._senders.push(e(this,s))})};const n=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(o){this._senders=this._senders||[],n.apply(this,[o]),o.getTracks().forEach(s=>{const a=this._senders.find(c=>c.track===s);a&&this._senders.splice(this._senders.indexOf(a),1)})}}else if(typeof t=="object"&&t.RTCPeerConnection&&"getSenders"in t.RTCPeerConnection.prototype&&"createDTMFSender"in t.RTCPeerConnection.prototype&&t.RTCRtpSender&&!("dtmf"in t.RTCRtpSender.prototype)){const e=t.RTCPeerConnection.prototype.getSenders;t.RTCPeerConnection.prototype.getSenders=function(){const n=e.apply(this,[]);return n.forEach(i=>i._pc=this),n},Object.defineProperty(t.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function go(t){if(!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){const[n,i,o]=arguments;if(arguments.length>0&&typeof n=="function")return e.apply(this,arguments);if(e.length===0&&(arguments.length===0||typeof n!="function"))return e.apply(this,[]);const s=function(c){const l={};return c.result().forEach(f=>{const p={id:f.id,timestamp:f.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[f.type]||f.type};f.names().forEach(h=>{p[h]=f.stat(h)}),l[p.id]=p}),l},a=function(c){return new Map(Object.keys(c).map(l=>[l,c[l]]))};if(arguments.length>=2){const c=function(l){i(a(s(l)))};return e.apply(this,[c,n])}return new Promise((c,l)=>{e.apply(this,[function(u){c(a(s(u)))},l])}).then(i,o)}}function So(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender&&t.RTCRtpReceiver))return;if(!("getStats"in t.RTCRtpSender.prototype)){const r=t.RTCPeerConnection.prototype.getSenders;r&&(t.RTCPeerConnection.prototype.getSenders=function(){const o=r.apply(this,[]);return o.forEach(s=>s._pc=this),o});const n=t.RTCPeerConnection.prototype.addTrack;n&&(t.RTCPeerConnection.prototype.addTrack=function(){const o=n.apply(this,arguments);return o._pc=this,o}),t.RTCRtpSender.prototype.getStats=function(){const o=this;return this._pc.getStats().then(s=>uo(s,o.track,!0))}}if(!("getStats"in t.RTCRtpReceiver.prototype)){const r=t.RTCPeerConnection.prototype.getReceivers;r&&(t.RTCPeerConnection.prototype.getReceivers=function(){const i=r.apply(this,[]);return i.forEach(o=>o._pc=this),i}),De(t,"track",n=>(n.receiver._pc=n.srcElement,n)),t.RTCRtpReceiver.prototype.getStats=function(){const i=this;return this._pc.getStats().then(o=>uo(o,i.track,!1))}}if(!("getStats"in t.RTCRtpSender.prototype&&"getStats"in t.RTCRtpReceiver.prototype))return;const e=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof t.MediaStreamTrack){const n=arguments[0];let i,o,s;return this.getSenders().forEach(a=>{a.track===n&&(i?s=!0:i=a)}),this.getReceivers().forEach(a=>(a.track===n&&(o?s=!0:o=a),a.track===n)),s||i&&o?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):i?i.getStats():o?o.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}function vo(t){t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(s=>this._shimmedLocalStreams[s][0])};const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(s,a){if(!a)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const c=e.apply(this,arguments);return this._shimmedLocalStreams[a.id]?this._shimmedLocalStreams[a.id].indexOf(c)===-1&&this._shimmedLocalStreams[a.id].push(c):this._shimmedLocalStreams[a.id]=[a,c],c};const r=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(s){this._shimmedLocalStreams=this._shimmedLocalStreams||{},s.getTracks().forEach(l=>{if(this.getSenders().find(f=>f.track===l))throw new DOMException("Track already exists.","InvalidAccessError")});const a=this.getSenders();r.apply(this,arguments);const c=this.getSenders().filter(l=>a.indexOf(l)===-1);this._shimmedLocalStreams[s.id]=[s].concat(c)};const n=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(s){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[s.id],n.apply(this,arguments)};const i=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(s){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},s&&Object.keys(this._shimmedLocalStreams).forEach(a=>{const c=this._shimmedLocalStreams[a].indexOf(s);c!==-1&&this._shimmedLocalStreams[a].splice(c,1),this._shimmedLocalStreams[a].length===1&&delete this._shimmedLocalStreams[a]}),i.apply(this,arguments)}}function bo(t,e){if(!t.RTCPeerConnection)return;if(t.RTCPeerConnection.prototype.addTrack&&e.version>=65)return vo(t);const r=t.RTCPeerConnection.prototype.getLocalStreams;t.RTCPeerConnection.prototype.getLocalStreams=function(){const u=r.apply(this);return this._reverseStreams=this._reverseStreams||{},u.map(f=>this._reverseStreams[f.id])};const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(u){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},u.getTracks().forEach(f=>{if(this.getSenders().find(h=>h.track===f))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[u.id]){const f=new t.MediaStream(u.getTracks());this._streams[u.id]=f,this._reverseStreams[f.id]=u,u=f}n.apply(this,[u])};const i=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(u){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[u.id]||u]),delete this._reverseStreams[this._streams[u.id]?this._streams[u.id].id:u.id],delete this._streams[u.id]},t.RTCPeerConnection.prototype.addTrack=function(u,f){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const p=[].slice.call(arguments,1);if(p.length!==1||!p[0].getTracks().find(v=>v===u))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(v=>v.track===u))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const g=this._streams[f.id];if(g)g.addTrack(u),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const v=new t.MediaStream([u]);this._streams[f.id]=v,this._reverseStreams[v.id]=f,this.addStream(v)}return this.getSenders().find(v=>v.track===u)};function o(l,u){let f=u.sdp;return Object.keys(l._reverseStreams||[]).forEach(p=>{const h=l._reverseStreams[p],g=l._streams[h.id];f=f.replace(new RegExp(g.id,"g"),h.id)}),new RTCSessionDescription({type:u.type,sdp:f})}function s(l,u){let f=u.sdp;return Object.keys(l._reverseStreams||[]).forEach(p=>{const h=l._reverseStreams[p],g=l._streams[h.id];f=f.replace(new RegExp(h.id,"g"),g.id)}),new RTCSessionDescription({type:u.type,sdp:f})}["createOffer","createAnswer"].forEach(function(l){const u=t.RTCPeerConnection.prototype[l],f={[l](){const p=arguments;return arguments.length&&typeof arguments[0]=="function"?u.apply(this,[g=>{const v=o(this,g);p[0].apply(null,[v])},g=>{p[1]&&p[1].apply(null,g)},arguments[2]]):u.apply(this,arguments).then(g=>o(this,g))}};t.RTCPeerConnection.prototype[l]=f[l]});const a=t.RTCPeerConnection.prototype.setLocalDescription;t.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?a.apply(this,arguments):(arguments[0]=s(this,arguments[0]),a.apply(this,arguments))};const c=Object.getOwnPropertyDescriptor(t.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(t.RTCPeerConnection.prototype,"localDescription",{get(){const l=c.get.apply(this);return l.type===""?l:o(this,l)}}),t.RTCPeerConnection.prototype.removeTrack=function(u){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!u._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(u._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let p;Object.keys(this._streams).forEach(h=>{this._streams[h].getTracks().find(v=>u.track===v)&&(p=this._streams[h])}),p&&(p.getTracks().length===1?this.removeStream(this._reverseStreams[p.id]):p.removeTrack(u.track),this.dispatchEvent(new Event("negotiationneeded")))}}function Jr(t,e){!t.RTCPeerConnection&&t.webkitRTCPeerConnection&&(t.RTCPeerConnection=t.webkitRTCPeerConnection),t.RTCPeerConnection&&e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(r){const n=t.RTCPeerConnection.prototype[r],i={[r](){return arguments[0]=new(r==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};t.RTCPeerConnection.prototype[r]=i[r]})}function Co(t,e){De(t,"negotiationneeded",r=>{const n=r.target;if(!((e.version<72||n.getConfiguration&&n.getConfiguration().sdpSemantics==="plan-b")&&n.signalingState!=="stable"))return r})}const Ro=Object.freeze(Object.defineProperty({__proto__:null,fixNegotiationNeeded:Co,shimAddTrackRemoveTrack:bo,shimAddTrackRemoveTrackWithNative:vo,shimGetDisplayMedia:Pf,shimGetSendersWithDtmf:yo,shimGetStats:go,shimGetUserMedia:po,shimMediaStream:ho,shimOnTrack:mo,shimPeerConnection:Jr,shimSenderReceiverGetStats:So},Symbol.toStringTag,{value:"Module"}));function Eo(t,e){const r=t&&t.navigator,n=t&&t.MediaStreamTrack;if(r.getUserMedia=function(i,o,s){Wr("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(i).then(o,s)},!(e.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){const i=function(s,a,c){a in s&&!(c in s)&&(s[c]=s[a],delete s[a])},o=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(s){return typeof s=="object"&&typeof s.audio=="object"&&(s=JSON.parse(JSON.stringify(s)),i(s.audio,"autoGainControl","mozAutoGainControl"),i(s.audio,"noiseSuppression","mozNoiseSuppression")),o(s)},n&&n.prototype.getSettings){const s=n.prototype.getSettings;n.prototype.getSettings=function(){const a=s.apply(this,arguments);return i(a,"mozAutoGainControl","autoGainControl"),i(a,"mozNoiseSuppression","noiseSuppression"),a}}if(n&&n.prototype.applyConstraints){const s=n.prototype.applyConstraints;n.prototype.applyConstraints=function(a){return this.kind==="audio"&&typeof a=="object"&&(a=JSON.parse(JSON.stringify(a)),i(a,"autoGainControl","mozAutoGainControl"),i(a,"noiseSuppression","mozNoiseSuppression")),s.apply(this,[a])}}}}function Of(t,e){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&(t.navigator.mediaDevices.getDisplayMedia=function(n){if(!(n&&n.video)){const i=new DOMException("getDisplayMedia without video constraints is undefined");return i.name="NotFoundError",i.code=8,Promise.reject(i)}return n.video===!0?n.video={mediaSource:e}:n.video.mediaSource=e,t.navigator.mediaDevices.getUserMedia(n)})}function To(t){typeof t=="object"&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Qr(t,e){if(typeof t!="object"||!(t.RTCPeerConnection||t.mozRTCPeerConnection))return;!t.RTCPeerConnection&&t.mozRTCPeerConnection&&(t.RTCPeerConnection=t.mozRTCPeerConnection),e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(i){const o=t.RTCPeerConnection.prototype[i],s={[i](){return arguments[0]=new(i==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),o.apply(this,arguments)}};t.RTCPeerConnection.prototype[i]=s[i]});const r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){const[o,s,a]=arguments;return n.apply(this,[o||null]).then(c=>{if(e.version<53&&!s)try{c.forEach(l=>{l.type=r[l.type]||l.type})}catch(l){if(l.name!=="TypeError")throw l;c.forEach((u,f)=>{c.set(f,Object.assign({},u,{type:r[u.type]||u.type}))})}return c}).then(s,a)}}function Po(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender)||t.RTCRtpSender&&"getStats"in t.RTCRtpSender.prototype)return;const e=t.RTCPeerConnection.prototype.getSenders;e&&(t.RTCPeerConnection.prototype.getSenders=function(){const i=e.apply(this,[]);return i.forEach(o=>o._pc=this),i});const r=t.RTCPeerConnection.prototype.addTrack;r&&(t.RTCPeerConnection.prototype.addTrack=function(){const i=r.apply(this,arguments);return i._pc=this,i}),t.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function Oo(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender)||t.RTCRtpSender&&"getStats"in t.RTCRtpReceiver.prototype)return;const e=t.RTCPeerConnection.prototype.getReceivers;e&&(t.RTCPeerConnection.prototype.getReceivers=function(){const n=e.apply(this,[]);return n.forEach(i=>i._pc=this),n}),De(t,"track",r=>(r.receiver._pc=r.srcElement,r)),t.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function wo(t){!t.RTCPeerConnection||"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(r){Wr("removeStream","removeTrack"),this.getSenders().forEach(n=>{n.track&&r.getTracks().includes(n.track)&&this.removeTrack(n)})})}function Ao(t){t.DataChannel&&!t.RTCDataChannel&&(t.RTCDataChannel=t.DataChannel)}function _o(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.addTransceiver;e&&(t.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let n=arguments[1]&&arguments[1].sendEncodings;n===void 0&&(n=[]),n=[...n];const i=n.length>0;i&&n.forEach(s=>{if("rid"in s&&!/^[a-z0-9]{0,16}$/i.test(s.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in s&&!(parseFloat(s.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in s&&!(parseFloat(s.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const o=e.apply(this,arguments);if(i){const{sender:s}=o,a=s.getParameters();(!("encodings"in a)||a.encodings.length===1&&Object.keys(a.encodings[0]).length===0)&&(a.encodings=n,s.sendEncodings=n,this.setParametersPromises.push(s.setParameters(a).then(()=>{delete s.sendEncodings}).catch(()=>{delete s.sendEncodings})))}return o})}function Do(t){if(!(typeof t=="object"&&t.RTCRtpSender))return;const e=t.RTCRtpSender.prototype.getParameters;e&&(t.RTCRtpSender.prototype.getParameters=function(){const n=e.apply(this,arguments);return"encodings"in n||(n.encodings=[].concat(this.sendEncodings||[{}])),n})}function Lo(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}function xo(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.createAnswer;t.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}const Io=Object.freeze(Object.defineProperty({__proto__:null,shimAddTransceiver:_o,shimCreateAnswer:xo,shimCreateOffer:Lo,shimGetDisplayMedia:Of,shimGetParameters:Do,shimGetUserMedia:Eo,shimOnTrack:To,shimPeerConnection:Qr,shimRTCDataChannel:Ao,shimReceiverGetStats:Oo,shimRemoveStream:wo,shimSenderGetStats:Po},Symbol.toStringTag,{value:"Module"}));function ko(t){if(!(typeof t!="object"||!t.RTCPeerConnection)){if("getLocalStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in t.RTCPeerConnection.prototype)){const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addStream=function(n){this._localStreams||(this._localStreams=[]),this._localStreams.includes(n)||this._localStreams.push(n),n.getAudioTracks().forEach(i=>e.call(this,i,n)),n.getVideoTracks().forEach(i=>e.call(this,i,n))},t.RTCPeerConnection.prototype.addTrack=function(n,...i){return i&&i.forEach(o=>{this._localStreams?this._localStreams.includes(o)||this._localStreams.push(o):this._localStreams=[o]}),e.apply(this,arguments)}}"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(r){this._localStreams||(this._localStreams=[]);const n=this._localStreams.indexOf(r);if(n===-1)return;this._localStreams.splice(n,1);const i=r.getTracks();this.getSenders().forEach(o=>{i.includes(o.track)&&this.removeTrack(o)})})}}function Fo(t){if(!(typeof t!="object"||!t.RTCPeerConnection)&&("getRemoteStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in t.RTCPeerConnection.prototype))){Object.defineProperty(t.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(r){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=r),this.addEventListener("track",this._onaddstreampoly=n=>{n.streams.forEach(i=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(i))return;this._remoteStreams.push(i);const o=new Event("addstream");o.stream=i,this.dispatchEvent(o)})})}});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){const n=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(i){i.streams.forEach(o=>{if(n._remoteStreams||(n._remoteStreams=[]),n._remoteStreams.indexOf(o)>=0)return;n._remoteStreams.push(o);const s=new Event("addstream");s.stream=o,n.dispatchEvent(s)})}),e.apply(n,arguments)}}}function Uo(t){if(typeof t!="object"||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype,r=e.createOffer,n=e.createAnswer,i=e.setLocalDescription,o=e.setRemoteDescription,s=e.addIceCandidate;e.createOffer=function(l,u){const f=arguments.length>=2?arguments[2]:arguments[0],p=r.apply(this,[f]);return u?(p.then(l,u),Promise.resolve()):p},e.createAnswer=function(l,u){const f=arguments.length>=2?arguments[2]:arguments[0],p=n.apply(this,[f]);return u?(p.then(l,u),Promise.resolve()):p};let a=function(c,l,u){const f=i.apply(this,[c]);return u?(f.then(l,u),Promise.resolve()):f};e.setLocalDescription=a,a=function(c,l,u){const f=o.apply(this,[c]);return u?(f.then(l,u),Promise.resolve()):f},e.setRemoteDescription=a,a=function(c,l,u){const f=s.apply(this,[c]);return u?(f.then(l,u),Promise.resolve()):f},e.addIceCandidate=a}function Mo(t){const e=t&&t.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){const r=e.mediaDevices,n=r.getUserMedia.bind(r);e.mediaDevices.getUserMedia=i=>n(No(i))}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=(function(n,i,o){e.mediaDevices.getUserMedia(n).then(i,o)}).bind(e))}function No(t){return t&&t.video!==void 0?Object.assign({},t,{video:lo(t.video)}):t}function Bo(t){if(!t.RTCPeerConnection)return;const e=t.RTCPeerConnection;t.RTCPeerConnection=function(n,i){if(n&&n.iceServers){const o=[];for(let s=0;s<n.iceServers.length;s++){let a=n.iceServers[s];a.urls===void 0&&a.url?(Wr("RTCIceServer.url","RTCIceServer.urls"),a=JSON.parse(JSON.stringify(a)),a.urls=a.url,delete a.url,o.push(a)):o.push(n.iceServers[s])}n.iceServers=o}return new e(n,i)},t.RTCPeerConnection.prototype=e.prototype,"generateCertificate"in e&&Object.defineProperty(t.RTCPeerConnection,"generateCertificate",{get(){return e.generateCertificate}})}function $o(t){typeof t=="object"&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function jo(t){const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(n){if(n){typeof n.offerToReceiveAudio<"u"&&(n.offerToReceiveAudio=!!n.offerToReceiveAudio);const i=this.getTransceivers().find(s=>s.receiver.track.kind==="audio");n.offerToReceiveAudio===!1&&i?i.direction==="sendrecv"?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":i.direction==="recvonly"&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):n.offerToReceiveAudio===!0&&!i&&this.addTransceiver("audio",{direction:"recvonly"}),typeof n.offerToReceiveVideo<"u"&&(n.offerToReceiveVideo=!!n.offerToReceiveVideo);const o=this.getTransceivers().find(s=>s.receiver.track.kind==="video");n.offerToReceiveVideo===!1&&o?o.direction==="sendrecv"?o.setDirection?o.setDirection("sendonly"):o.direction="sendonly":o.direction==="recvonly"&&(o.setDirection?o.setDirection("inactive"):o.direction="inactive"):n.offerToReceiveVideo===!0&&!o&&this.addTransceiver("video",{direction:"recvonly"})}return e.apply(this,arguments)}}function Ho(t){typeof t!="object"||t.AudioContext||(t.AudioContext=t.webkitAudioContext)}const Vo=Object.freeze(Object.defineProperty({__proto__:null,shimAudioContext:Ho,shimCallbacksAPI:Uo,shimConstraints:No,shimCreateOfferLegacy:jo,shimGetUserMedia:Mo,shimLocalStreamsAPI:ko,shimRTCIceServerUrls:Bo,shimRemoteStreamsAPI:Fo,shimTrackEventTransceiver:$o},Symbol.toStringTag,{value:"Module"}));var qo={exports:{}};(function(t){const e={};e.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},e.localCName=e.generateIdentifier(),e.splitLines=function(r){return r.trim().split(`
13
13
  `).map(n=>n.trim())},e.splitSections=function(r){return r.split(`
14
14
  m=`).map((i,o)=>(o>0?"m="+i:i).trim()+`\r
15
15
  `)},e.getDescription=function(r){const n=e.splitSections(r);return n&&n[0]},e.getMediaSections=function(r){const n=e.splitSections(r);return n.shift(),n},e.matchPrefix=function(r,n){return e.splitLines(r).filter(i=>i.indexOf(n)===0)},e.parseCandidate=function(r){let n;r.indexOf("a=candidate:")===0?n=r.substring(12).split(" "):n=r.substring(10).split(" ");const i={foundation:n[0],component:{1:"rtp",2:"rtcp"}[n[1]]||n[1],protocol:n[2].toLowerCase(),priority:parseInt(n[3],10),ip:n[4],address:n[4],port:parseInt(n[5],10),type:n[7]};for(let o=8;o<n.length;o+=2)switch(n[o]){case"raddr":i.relatedAddress=n[o+1];break;case"rport":i.relatedPort=parseInt(n[o+1],10);break;case"tcptype":i.tcpType=n[o+1];break;case"ufrag":i.ufrag=n[o+1],i.usernameFragment=n[o+1];break;default:i[n[o]]===void 0&&(i[n[o]]=n[o+1]);break}return i},e.writeCandidate=function(r){const n=[];n.push(r.foundation);const i=r.component;i==="rtp"?n.push(1):i==="rtcp"?n.push(2):n.push(i),n.push(r.protocol.toUpperCase()),n.push(r.priority),n.push(r.address||r.ip),n.push(r.port);const o=r.type;return n.push("typ"),n.push(o),o!=="host"&&r.relatedAddress&&r.relatedPort&&(n.push("raddr"),n.push(r.relatedAddress),n.push("rport"),n.push(r.relatedPort)),r.tcpType&&r.protocol.toLowerCase()==="tcp"&&(n.push("tcptype"),n.push(r.tcpType)),(r.usernameFragment||r.ufrag)&&(n.push("ufrag"),n.push(r.usernameFragment||r.ufrag)),"candidate:"+n.join(" ")},e.parseIceOptions=function(r){return r.substring(14).split(" ")},e.parseRtpMap=function(r){let n=r.substring(9).split(" ");const i={payloadType:parseInt(n.shift(),10)};return n=n[0].split("/"),i.name=n[0],i.clockRate=parseInt(n[1],10),i.channels=n.length===3?parseInt(n[2],10):1,i.numChannels=i.channels,i},e.writeRtpMap=function(r){let n=r.payloadType;r.preferredPayloadType!==void 0&&(n=r.preferredPayloadType);const i=r.channels||r.numChannels||1;return"a=rtpmap:"+n+" "+r.name+"/"+r.clockRate+(i!==1?"/"+i:"")+`\r
@@ -26,7 +26,7 @@ a=ice-pwd:`+r.password+`\r
26
26
  `,i+=`c=IN IP4 0.0.0.0\r
27
27
  `,i+=`a=rtcp:9 IN IP4 0.0.0.0\r
28
28
  `,n.codecs.forEach(s=>{i+=e.writeRtpMap(s),i+=e.writeFmtp(s),i+=e.writeRtcpFb(s)});let o=0;return n.codecs.forEach(s=>{s.maxptime>o&&(o=s.maxptime)}),o>0&&(i+="a=maxptime:"+o+`\r
29
- `),n.headerExtensions&&n.headerExtensions.forEach(s=>{i+=e.writeExtmap(s)}),i},e.parseRtpEncodingParameters=function(r){const n=[],i=e.parseRtpParameters(r),o=i.fecMechanisms.indexOf("RED")!==-1,s=i.fecMechanisms.indexOf("ULPFEC")!==-1,a=e.matchPrefix(r,"a=ssrc:").map(d=>e.parseSsrcMedia(d)).filter(d=>d.attribute==="cname"),c=a.length>0&&a[0].ssrc;let l;const u=e.matchPrefix(r,"a=ssrc-group:FID").map(d=>d.substring(17).split(" ").map(y=>parseInt(y,10)));u.length>0&&u[0].length>1&&u[0][0]===c&&(l=u[0][1]),i.codecs.forEach(d=>{if(d.name.toUpperCase()==="RTX"&&d.parameters.apt){let h={ssrc:c,codecPayloadType:parseInt(d.parameters.apt,10)};c&&l&&(h.rtx={ssrc:l}),n.push(h),o&&(h=JSON.parse(JSON.stringify(h)),h.fec={ssrc:c,mechanism:s?"red+ulpfec":"red"},n.push(h))}}),n.length===0&&c&&n.push({ssrc:c});let f=e.matchPrefix(r,"b=");return f.length&&(f[0].indexOf("b=TIAS:")===0?f=parseInt(f[0].substring(7),10):f[0].indexOf("b=AS:")===0?f=parseInt(f[0].substring(5),10)*1e3*.95-50*40*8:f=void 0,n.forEach(d=>{d.maxBitrate=f})),n},e.parseRtcpParameters=function(r){const n={},i=e.matchPrefix(r,"a=ssrc:").map(a=>e.parseSsrcMedia(a)).filter(a=>a.attribute==="cname")[0];i&&(n.cname=i.value,n.ssrc=i.ssrc);const o=e.matchPrefix(r,"a=rtcp-rsize");n.reducedSize=o.length>0,n.compound=o.length===0;const s=e.matchPrefix(r,"a=rtcp-mux");return n.mux=s.length>0,n},e.writeRtcpParameters=function(r){let n="";return r.reducedSize&&(n+=`a=rtcp-rsize\r
29
+ `),n.headerExtensions&&n.headerExtensions.forEach(s=>{i+=e.writeExtmap(s)}),i},e.parseRtpEncodingParameters=function(r){const n=[],i=e.parseRtpParameters(r),o=i.fecMechanisms.indexOf("RED")!==-1,s=i.fecMechanisms.indexOf("ULPFEC")!==-1,a=e.matchPrefix(r,"a=ssrc:").map(p=>e.parseSsrcMedia(p)).filter(p=>p.attribute==="cname"),c=a.length>0&&a[0].ssrc;let l;const u=e.matchPrefix(r,"a=ssrc-group:FID").map(p=>p.substring(17).split(" ").map(g=>parseInt(g,10)));u.length>0&&u[0].length>1&&u[0][0]===c&&(l=u[0][1]),i.codecs.forEach(p=>{if(p.name.toUpperCase()==="RTX"&&p.parameters.apt){let h={ssrc:c,codecPayloadType:parseInt(p.parameters.apt,10)};c&&l&&(h.rtx={ssrc:l}),n.push(h),o&&(h=JSON.parse(JSON.stringify(h)),h.fec={ssrc:c,mechanism:s?"red+ulpfec":"red"},n.push(h))}}),n.length===0&&c&&n.push({ssrc:c});let f=e.matchPrefix(r,"b=");return f.length&&(f[0].indexOf("b=TIAS:")===0?f=parseInt(f[0].substring(7),10):f[0].indexOf("b=AS:")===0?f=parseInt(f[0].substring(5),10)*1e3*.95-50*40*8:f=void 0,n.forEach(p=>{p.maxBitrate=f})),n},e.parseRtcpParameters=function(r){const n={},i=e.matchPrefix(r,"a=ssrc:").map(a=>e.parseSsrcMedia(a)).filter(a=>a.attribute==="cname")[0];i&&(n.cname=i.value,n.ssrc=i.ssrc);const o=e.matchPrefix(r,"a=rtcp-rsize");n.reducedSize=o.length>0,n.compound=o.length===0;const s=e.matchPrefix(r,"a=rtcp-mux");return n.mux=s.length>0,n},e.writeRtcpParameters=function(r){let n="";return r.reducedSize&&(n+=`a=rtcp-rsize\r
30
30
  `),r.mux&&(n+=`a=rtcp-mux\r
31
31
  `),r.ssrc!==void 0&&r.cname&&(n+="a=ssrc:"+r.ssrc+" cname:"+r.cname+`\r
32
32
  `),n},e.parseMsid=function(r){let n;const i=e.matchPrefix(r,"a=msid:");if(i.length===1)return n=i[0].substring(7).split(" "),{stream:n[0],track:n[1]};const o=e.matchPrefix(r,"a=ssrc:").map(s=>e.parseSsrcMedia(s)).filter(s=>s.attribute==="msid");if(o.length>0)return n=o[0].value.split(" "),{stream:n[0],track:n[1]}},e.parseSctpDescription=function(r){const n=e.parseMLine(r),i=e.matchPrefix(r,"a=max-message-size:");let o;i.length>0&&(o=parseInt(i[0].substring(19),10)),isNaN(o)&&(o=65536);const s=e.matchPrefix(r,"a=sctp-port:");if(s.length>0)return{port:parseInt(s[0].substring(12),10),protocol:n.fmt,maxMessageSize:o};const a=e.matchPrefix(r,"a=sctpmap:");if(a.length>0){const c=a[0].substring(10).split(" ");return{port:parseInt(c[0],10),protocol:c[1],maxMessageSize:o}}},e.writeSctpDescription=function(r,n){let i=[];return r.protocol!=="DTLS/SCTP"?i=["m="+r.kind+" 9 "+r.protocol+" "+n.protocol+`\r
@@ -40,7 +40,7 @@ a=ice-pwd:`+r.password+`\r
40
40
  o=`+(i||"thisisadapterortc")+" "+o+" "+s+` IN IP4 127.0.0.1\r
41
41
  s=-\r
42
42
  t=0 0\r
43
- `},e.getDirection=function(r,n){const i=e.splitLines(r);for(let o=0;o<i.length;o++)switch(i[o]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[o].substring(2)}return n?e.getDirection(n):"sendrecv"},e.getKind=function(r){return e.splitLines(r)[0].split(" ")[0].substring(2)},e.isRejected=function(r){return r.split(" ",2)[1]==="0"},e.parseMLine=function(r){const i=e.splitLines(r)[0].substring(2).split(" ");return{kind:i[0],port:parseInt(i[1],10),protocol:i[2],fmt:i.slice(3).join(" ")}},e.parseOLine=function(r){const i=e.matchPrefix(r,"o=")[0].substring(2).split(" ");return{username:i[0],sessionId:i[1],sessionVersion:parseInt(i[2],10),netType:i[3],addressType:i[4],address:i[5]}},e.isValidSDP=function(r){if(typeof r!="string"||r.length===0)return!1;const n=e.splitLines(r);for(let i=0;i<n.length;i++)if(n[i].length<2||n[i].charAt(1)!=="=")return!1;return!0},t.exports=e})(Jo);var Qo=Jo.exports;const ze=ai(Qo),Pf=Ie({__proto__:null,default:ze},[Qo]);function zt(t){if(!t.RTCIceCandidate||t.RTCIceCandidate&&"foundation"in t.RTCIceCandidate.prototype)return;const e=t.RTCIceCandidate;t.RTCIceCandidate=function(n){if(typeof n=="object"&&n.candidate&&n.candidate.indexOf("a=")===0&&(n=JSON.parse(JSON.stringify(n)),n.candidate=n.candidate.substring(2)),n.candidate&&n.candidate.length){const i=new e(n),o=ze.parseCandidate(n.candidate);for(const s in o)s in i||Object.defineProperty(i,s,{value:o[s]});return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new e(n)},t.RTCIceCandidate.prototype=e.prototype,De(t,"icecandidate",r=>(r.candidate&&Object.defineProperty(r,"candidate",{value:new t.RTCIceCandidate(r.candidate),writable:"false"}),r))}function en(t){!t.RTCIceCandidate||t.RTCIceCandidate&&"relayProtocol"in t.RTCIceCandidate.prototype||De(t,"icecandidate",e=>{if(e.candidate){const r=ze.parseCandidate(e.candidate.candidate);r.type==="relay"&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[r.priority>>24])}return e})}function Gt(t,e){if(!t.RTCPeerConnection)return;"sctp"in t.RTCPeerConnection.prototype||Object.defineProperty(t.RTCPeerConnection.prototype,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp}});const r=function(a){if(!a||!a.sdp)return!1;const c=ze.splitSections(a.sdp);return c.shift(),c.some(l=>{const u=ze.parseMLine(l);return u&&u.kind==="application"&&u.protocol.indexOf("SCTP")!==-1})},n=function(a){const c=a.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(c===null||c.length<2)return-1;const l=parseInt(c[1],10);return l!==l?-1:l},i=function(a){let c=65536;return e.browser==="firefox"&&(e.version<57?a===-1?c=16384:c=2147483637:e.version<60?c=e.version===57?65535:65536:c=2147483637),c},o=function(a,c){let l=65536;e.browser==="firefox"&&e.version===57&&(l=65535);const u=ze.matchPrefix(a.sdp,"a=max-message-size:");return u.length>0?l=parseInt(u[0].substring(19),10):e.browser==="firefox"&&c!==-1&&(l=2147483637),l},s=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,e.browser==="chrome"&&e.version>=76){const{sdpSemantics:c}=this.getConfiguration();c==="plan-b"&&Object.defineProperty(this,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){const c=n(arguments[0]),l=i(c),u=o(arguments[0],c);let f;l===0&&u===0?f=Number.POSITIVE_INFINITY:l===0||u===0?f=Math.max(l,u):f=Math.min(l,u);const d={};Object.defineProperty(d,"maxMessageSize",{get(){return f}}),this._sctp=d}return s.apply(this,arguments)}}function Wt(t){if(!(t.RTCPeerConnection&&"createDataChannel"in t.RTCPeerConnection.prototype))return;function e(n,i){const o=n.send;n.send=function(){const a=arguments[0],c=a.length||a.size||a.byteLength;if(n.readyState==="open"&&i.sctp&&c>i.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+i.sctp.maxMessageSize+" bytes)");return o.apply(n,arguments)}}const r=t.RTCPeerConnection.prototype.createDataChannel;t.RTCPeerConnection.prototype.createDataChannel=function(){const i=r.apply(this,arguments);return e(i,this),i},De(t,"datachannel",n=>(e(n.channel,n.target),n))}function tn(t){if(!t.RTCPeerConnection||"connectionState"in t.RTCPeerConnection.prototype)return;const e=t.RTCPeerConnection.prototype;Object.defineProperty(e,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(e,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(r){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),r&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=r)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(r=>{const n=e[r];e[r]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=i=>{const o=i.target;if(o._lastConnectionState!==o.connectionState){o._lastConnectionState=o.connectionState;const s=new Event("connectionstatechange",i);o.dispatchEvent(s)}return i},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}})}function rn(t,e){if(!t.RTCPeerConnection||e.browser==="chrome"&&e.version>=71||e.browser==="safari"&&e.version>=605)return;const r=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(i){if(i&&i.sdp&&i.sdp.indexOf(`
43
+ `},e.getDirection=function(r,n){const i=e.splitLines(r);for(let o=0;o<i.length;o++)switch(i[o]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[o].substring(2)}return n?e.getDirection(n):"sendrecv"},e.getKind=function(r){return e.splitLines(r)[0].split(" ")[0].substring(2)},e.isRejected=function(r){return r.split(" ",2)[1]==="0"},e.parseMLine=function(r){const i=e.splitLines(r)[0].substring(2).split(" ");return{kind:i[0],port:parseInt(i[1],10),protocol:i[2],fmt:i.slice(3).join(" ")}},e.parseOLine=function(r){const i=e.matchPrefix(r,"o=")[0].substring(2).split(" ");return{username:i[0],sessionId:i[1],sessionVersion:parseInt(i[2],10),netType:i[3],addressType:i[4],address:i[5]}},e.isValidSDP=function(r){if(typeof r!="string"||r.length===0)return!1;const n=e.splitLines(r);for(let i=0;i<n.length;i++)if(n[i].length<2||n[i].charAt(1)!=="=")return!1;return!0},t.exports=e})(qo);var zo=qo.exports;const ze=ii(zo),wf=Ie({__proto__:null,default:ze},[zo]);function zt(t){if(!t.RTCIceCandidate||t.RTCIceCandidate&&"foundation"in t.RTCIceCandidate.prototype)return;const e=t.RTCIceCandidate;t.RTCIceCandidate=function(n){if(typeof n=="object"&&n.candidate&&n.candidate.indexOf("a=")===0&&(n=JSON.parse(JSON.stringify(n)),n.candidate=n.candidate.substring(2)),n.candidate&&n.candidate.length){const i=new e(n),o=ze.parseCandidate(n.candidate);for(const s in o)s in i||Object.defineProperty(i,s,{value:o[s]});return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new e(n)},t.RTCIceCandidate.prototype=e.prototype,De(t,"icecandidate",r=>(r.candidate&&Object.defineProperty(r,"candidate",{value:new t.RTCIceCandidate(r.candidate),writable:"false"}),r))}function Xr(t){!t.RTCIceCandidate||t.RTCIceCandidate&&"relayProtocol"in t.RTCIceCandidate.prototype||De(t,"icecandidate",e=>{if(e.candidate){const r=ze.parseCandidate(e.candidate.candidate);r.type==="relay"&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[r.priority>>24])}return e})}function Gt(t,e){if(!t.RTCPeerConnection)return;"sctp"in t.RTCPeerConnection.prototype||Object.defineProperty(t.RTCPeerConnection.prototype,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp}});const r=function(a){if(!a||!a.sdp)return!1;const c=ze.splitSections(a.sdp);return c.shift(),c.some(l=>{const u=ze.parseMLine(l);return u&&u.kind==="application"&&u.protocol.indexOf("SCTP")!==-1})},n=function(a){const c=a.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(c===null||c.length<2)return-1;const l=parseInt(c[1],10);return l!==l?-1:l},i=function(a){let c=65536;return e.browser==="firefox"&&(e.version<57?a===-1?c=16384:c=2147483637:e.version<60?c=e.version===57?65535:65536:c=2147483637),c},o=function(a,c){let l=65536;e.browser==="firefox"&&e.version===57&&(l=65535);const u=ze.matchPrefix(a.sdp,"a=max-message-size:");return u.length>0?l=parseInt(u[0].substring(19),10):e.browser==="firefox"&&c!==-1&&(l=2147483637),l},s=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,e.browser==="chrome"&&e.version>=76){const{sdpSemantics:c}=this.getConfiguration();c==="plan-b"&&Object.defineProperty(this,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){const c=n(arguments[0]),l=i(c),u=o(arguments[0],c);let f;l===0&&u===0?f=Number.POSITIVE_INFINITY:l===0||u===0?f=Math.max(l,u):f=Math.min(l,u);const p={};Object.defineProperty(p,"maxMessageSize",{get(){return f}}),this._sctp=p}return s.apply(this,arguments)}}function Wt(t){if(!(t.RTCPeerConnection&&"createDataChannel"in t.RTCPeerConnection.prototype))return;function e(n,i){const o=n.send;n.send=function(){const a=arguments[0],c=a.length||a.size||a.byteLength;if(n.readyState==="open"&&i.sctp&&c>i.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+i.sctp.maxMessageSize+" bytes)");return o.apply(n,arguments)}}const r=t.RTCPeerConnection.prototype.createDataChannel;t.RTCPeerConnection.prototype.createDataChannel=function(){const i=r.apply(this,arguments);return e(i,this),i},De(t,"datachannel",n=>(e(n.channel,n.target),n))}function Yr(t){if(!t.RTCPeerConnection||"connectionState"in t.RTCPeerConnection.prototype)return;const e=t.RTCPeerConnection.prototype;Object.defineProperty(e,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(e,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(r){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),r&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=r)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(r=>{const n=e[r];e[r]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=i=>{const o=i.target;if(o._lastConnectionState!==o.connectionState){o._lastConnectionState=o.connectionState;const s=new Event("connectionstatechange",i);o.dispatchEvent(s)}return i},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}})}function Zr(t,e){if(!t.RTCPeerConnection||e.browser==="chrome"&&e.version>=71||e.browser==="safari"&&e.version>=605)return;const r=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(i){if(i&&i.sdp&&i.sdp.indexOf(`
44
44
  a=extmap-allow-mixed`)!==-1){const o=i.sdp.split(`
45
45
  `).filter(s=>s.trim()!=="a=extmap-allow-mixed").join(`
46
- `);t.RTCSessionDescription&&i instanceof t.RTCSessionDescription?arguments[0]=new t.RTCSessionDescription({type:i.type,sdp:o}):i.sdp=o}return r.apply(this,arguments)}}function Kt(t,e){if(!(t.RTCPeerConnection&&t.RTCPeerConnection.prototype))return;const r=t.RTCPeerConnection.prototype.addIceCandidate;!r||r.length===0||(t.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(e.browser==="chrome"&&e.version<78||e.browser==="firefox"&&e.version<68||e.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function Jt(t,e){if(!(t.RTCPeerConnection&&t.RTCPeerConnection.prototype))return;const r=t.RTCPeerConnection.prototype.setLocalDescription;!r||r.length===0||(t.RTCPeerConnection.prototype.setLocalDescription=function(){let i=arguments[0]||{};if(typeof i!="object"||i.type&&i.sdp)return r.apply(this,arguments);if(i={type:i.type,sdp:i.sdp},!i.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":i.type="offer";break;default:i.type="answer";break}return i.sdp||i.type!=="offer"&&i.type!=="answer"?r.apply(this,[i]):(i.type==="offer"?this.createOffer:this.createAnswer).apply(this).then(s=>r.apply(this,[s]))})}const Of=Object.freeze(Object.defineProperty({__proto__:null,removeExtmapAllowMixed:rn,shimAddIceCandidateNullOrEmpty:Kt,shimConnectionState:tn,shimMaxMessageSize:Gt,shimParameterlessSetLocalDescription:Jt,shimRTCIceCandidate:zt,shimRTCIceCandidateRelayProtocol:en,shimSendThrowTypeError:Wt},Symbol.toStringTag,{value:"Module"}));function wf({window:t}={},e={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const r=po,n=Rf(t),i={browserDetails:n,commonShim:Of,extractVersion:qt,disableLog:bf,disableWarnings:Cf,sdp:Pf};switch(n.browser){case"chrome":if(!wo||!Yr||!e.shimChrome)return r("Chrome shim is not included in this adapter release."),i;if(n.version===null)return r("Chrome shim can not determine version, not shimming."),i;r("adapter.js shimming chrome."),i.browserShim=wo,Kt(t,n),Jt(t),So(t,n),vo(t),Yr(t,n),bo(t),Po(t,n),Co(t),Ro(t),Eo(t),Oo(t,n),zt(t),en(t),tn(t),Gt(t,n),Wt(t),rn(t,n);break;case"firefox":if(!No||!Zr||!e.shimFirefox)return r("Firefox shim is not included in this adapter release."),i;r("adapter.js shimming firefox."),i.browserShim=No,Kt(t,n),Jt(t),Ao(t,n),Zr(t,n),_o(t),xo(t),Do(t),Lo(t),Io(t),ko(t),Fo(t),Uo(t),Mo(t),zt(t),tn(t),Gt(t,n),Wt(t);break;case"safari":if(!Ko||!e.shimSafari)return r("Safari shim is not included in this adapter release."),i;r("adapter.js shimming safari."),i.browserShim=Ko,Kt(t,n),Jt(t),qo(t),Go(t),jo(t),Bo(t),$o(t),zo(t),Ho(t),Wo(t),zt(t),en(t),Gt(t,n),Wt(t),rn(t,n);break;default:r("Unsupported browser!");break}return i}const Xo=wf({window:typeof window>"u"?void 0:window});class nn{constructor(e){g(this,"peerConnection");g(this,"sessionListener",new vf);g(this,"isCallOut",!1);g(this,"sessionType",T.UNKNOWN);g(this,"localStream");g(this,"remoteStream");g(this,"dataChannel");g(this,"hasSetRemoteSdp",!1);g(this,"facingMode",z.FRONT_FACING);g(this,"facingChanging",!1);g(this,"muted",!1);g(this,"openCamera",!1);g(this,"desktopSharing",!1);this.sessionType=e,console.debug(Xo.browserDetails.browser+" "+Xo.browserDetails.version)}setListener(e){this.sessionListener=e}start(e,r){if(!e&&!r){this.error(new Error("start failed, remoteSdp is null."));return}switch(this.isCallOut=e,this.hasSetRemoteSdp=!1,this.facingMode=z.FRONT_FACING,this.facingChanging=!1,this.muted=!1,this.desktopSharing=!1,this.peerConnection=new RTCPeerConnection({iceServers:[]}),this.peerConnection.onnegotiationneeded=()=>{switch(this.sessionType){case T.AUDIO_PUSH:case T.VIDEO_PUSH:case T.AUDIO_HALF:case T.VIDEO_HALF:this.createDataChannel()}e?(console.debug("webrtc call out"),this.peerConnection.createOffer().then(n=>{console.debug("webrtc createOffer success"),this.peerConnection.setLocalDescription(n).then(()=>{console.debug("webrtc setLocalDescription success")}).catch(i=>{this.error(i)})}).catch(n=>{this.error(n)})):(console.debug("webrtc call in: ",r),this.peerConnection.setRemoteDescription(new RTCSessionDescription({type:"offer",sdp:r})).then(()=>{console.debug("webrtc setRemoteDescription success"),this.peerConnection.createAnswer().then(n=>{console.debug("webrtc createAnswer success"),this.peerConnection.setLocalDescription(n).then(()=>{console.debug("webrtc setLocalDescription success")}).catch(i=>{this.error(i)})}).catch(n=>{this.error(n)})}).catch(n=>{this.error(n)}))},this.peerConnection.onicegatheringstatechange=()=>{var n;console.debug("webrtc onicegatheringstatechange",(n=this.peerConnection)==null?void 0:n.iceGatheringState),this.peerConnection&&this.peerConnection.iceGatheringState=="complete"&&this.peerConnection.localDescription&&this.sessionListener.onStartSuccess(this.peerConnection.localDescription)},this.peerConnection.ontrack=n=>{console.debug("webrtc ontrack");for(let i=0;i<n.streams.length;i++)this.remoteStream?n.streams[i].getTracks().forEach(o=>{var s;(s=this.remoteStream)==null||s.addTrack(o)}):this.remoteStream=new MediaStream(n.streams[i]);this.sessionListener.onAddRemoteStream(this.remoteStream)},this.peerConnection.oniceconnectionstatechange=n=>{var i,o,s,a,c;console.debug("oniceconnectionstatechange",(i=this.peerConnection)==null?void 0:i.iceConnectionState),(((o=this.peerConnection)==null?void 0:o.iceConnectionState)=="completed"||((s=this.peerConnection)==null?void 0:s.iceConnectionState)=="disconnected"||((a=this.peerConnection)==null?void 0:a.iceConnectionState)=="failed"||((c=this.peerConnection)==null?void 0:c.iceConnectionState)=="closed")&&(this.dataChannel=void 0,this.stop(),this.sessionListener.onError(new Error("session closed.")))},this.sessionType){case T.RTSP_PULL:this.addTransceivers(),this.createDataChannel();break;case T.AUDIO_PUSH:case T.VIDEO_PUSH:case T.AUDIO_HALF:case T.VIDEO_HALF:case T.VIDEO:case T.AUDIO:this.gotLocalMedia();break;default:this.error(new Error("session type unknown: "+this.sessionType));break}}setRemoteSdp(e){e&&e!==""&&this.peerConnection&&this.isCallOut&&!this.hasSetRemoteSdp&&(this.hasSetRemoteSdp=!0,this.peerConnection.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e})).then(()=>{console.debug("webrtc setRemoteDescription success")}).catch(r=>{this.error(r),this.hasSetRemoteSdp=!1}))}addRemoteCandidate(e){this.peerConnection&&e.forEach(r=>{this.peerConnection.addIceCandidate(r).then(()=>{console.debug("webrtc addIceCandidate success")}).catch(n=>console.log(n))})}sendStringData(e){try{this.dataChannel&&this.dataChannel.send(e)}catch(r){console.debug("sendStringData failed",r)}}stop(){var e;if(console.debug("webrtc stop"),(this.sessionType==T.VIDEO_PUSH||this.sessionType==T.AUDIO_PUSH||this.sessionType==T.RTSP_PULL)&&this.sendStringData("close"),(e=this.peerConnection)==null||e.close(),this.localStream)for(let r of this.localStream.getTracks())this.localStream.removeTrack(r),r.stop();this.desktopSharing&&(this.desktopSharing=!1,this.sessionListener.onStopDesktopShare()),this.peerConnection=void 0,this.dataChannel=void 0,this.localStream=void 0,this.remoteStream=void 0,this.isCallOut=!1,this.sessionType=T.UNKNOWN,this.hasSetRemoteSdp=!1,this.facingMode=z.FRONT_FACING,this.facingChanging=!1,this.muted=!1,this.openCamera=!1,this.desktopSharing=!1}changeFacing(){return new Promise((e,r)=>{if(this.sessionType!==T.VIDEO&&this.sessionType!==T.VIDEO_PUSH){r(new Error("not video call"));return}if(!this.localStream||this.localStream.getVideoTracks().length<=0){r(new Error("not in calling or not video call"));return}if(this.facingChanging){r(new Error("camera switching in progress"));return}this.changeCameraLocalMedia().then(()=>e(this.facingMode)).catch(n=>r(n))})}changeMuted(){return new Promise((e,r)=>{!this.localStream||this.localStream.getAudioTracks().length<=0?r(new Error("not in calling")):(this.localStream.getAudioTracks().forEach(n=>{n.enabled=!n.enabled,this.muted=!n.enabled}),e(this.muted))})}changeCameraOpened(){return new Promise((e,r)=>{!this.localStream||this.localStream.getVideoTracks().length<=0?r(new Error("not in video calling")):(this.localStream.getVideoTracks().forEach(n=>{n.enabled=!n.enabled,this.openCamera=!n.enabled}),e(this.openCamera))})}startDesktopShare(){return new Promise((e,r)=>{if(this.desktopSharing){r(new Error("desktop sharing has opened"));return}if(this.sessionType!=T.VIDEO&&this.sessionType!=T.VIDEO_PUSH){r(new Error("desktop sharing not in video calling"));return}if(!this.localStream){r(new Error("localStream undefined"));return}navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia?(this.desktopSharing=!0,navigator.mediaDevices.getDisplayMedia({audio:!1,video:!0}).then(n=>{let i=this.changeVideoTrack(n,()=>{this.stopDesktopShare(),this.sessionListener.onStopDesktopShare()});i?(this.desktopSharing=!1,r(i)):e()}).catch(n=>{this.desktopSharing=!1,r(n)})):r(new Error("error: browsers unsupported DesktopShare"))})}stopDesktopShare(){if(!(!this.peerConnection||!this.localStream)&&this.desktopSharing){for(let e of this.localStream.getVideoTracks())this.localStream.removeTrack(e),e.stop();navigator.mediaDevices.getUserMedia({audio:!1,video:{height:{exact:720},width:{exact:1280}}}).then(e=>{this.changeVideoTrack(e),this.desktopSharing=!1}).catch(e=>{this.desktopSharing=!1,console.debug("stopDesktopShare getUserMedia failed: ",e)})}}changeVideoTrack(e,r){if(!this.localStream||!this.peerConnection){for(let n of e.getTracks())e.removeTrack(n),n.stop();return new Error("localStream undefined or peerConnection undefined")}for(let n of this.localStream.getVideoTracks())this.localStream.removeTrack(n),n.stop();for(let n of e.getTracks())e.removeTrack(n),n.kind=="video"?(this.localStream.addTrack(n),r&&(n.onended=i=>{r()})):n.stop();for(let n of this.peerConnection.getSenders())n.track&&n.track.kind==="video"&&n.replaceTrack(this.localStream.getVideoTracks()[0]).then(()=>{}).catch(i=>{console.error(i)})}error(e){console.debug("webrtc error: ",e),this.stop(),this.sessionListener.onError(e)}addTransceivers(){this.peerConnection.addTransceiver("audio",{direction:"recvonly"}),this.peerConnection.addTransceiver("video",{direction:"recvonly"})}gotLocalMedia(){let e={audio:{echoCancellation:!0,noiseSuppression:!0}};switch(this.sessionType){case T.VIDEO:case T.VIDEO_PUSH:case T.VIDEO_HALF:e.video={height:{exact:720},width:{exact:1280},facingMode:z.FRONT_FACING};break}navigator.mediaDevices&&navigator.mediaDevices.getUserMedia?navigator.mediaDevices.getUserMedia(e).then(r=>{this.getMediaSuccess(r)}).catch(r=>{this.getMediaFailed(r)}):this.error(new Error("Browser does not support WebRTC"))}getMediaSuccess(e){console.debug("webrtc getMediaSuccess"),this.localStream=e,(this.sessionType===T.VIDEO||this.sessionType===T.VIDEO_PUSH||this.sessionType===T.VIDEO_HALF)&&this.sessionListener.onAddLocalStream(e),e.getTracks().forEach(r=>{switch(this.sessionType){case T.AUDIO_PUSH:case T.VIDEO_PUSH:this.peerConnection.addTransceiver(r,{direction:"sendonly",streams:[e]});break;default:this.peerConnection.addTrack(r,e)}}),this.muted=!1}getMediaFailed(e){if(console.debug("webrtc getMediaFailed failed"),this.sessionType===T.VIDEO){console.error("get video media failed. maybe not found camera.",e),this.sessionType=T.AUDIO,this.gotLocalMedia();return}else if(this.sessionType===T.VIDEO_PUSH){console.error("get video media failed. maybe not found camera.",e),this.sessionType=T.AUDIO_PUSH,this.gotLocalMedia();return}else if(this.sessionType===T.VIDEO_HALF){console.error("get video media failed. maybe not found camera.",e),this.sessionType=T.AUDIO_HALF,this.gotLocalMedia();return}this.error(e)}createDataChannel(){this.peerConnection&&(this.isCallOut?(this.dataChannel=this.peerConnection.createDataChannel("command_channel"),this.dataChannel.onmessage=e=>{this.onDataChannelReceive(e.data)}):this.peerConnection.ondatachannel=e=>{this.dataChannel=e.channel,this.dataChannel.onmessage=r=>{this.onDataChannelReceive(r.data)}})}onDataChannelReceive(e){if(e==="close"){console.debug("data channel receive from server: close"),this.dataChannel=void 0,this.stop();return}(this.sessionType==T.VIDEO_HALF||this.sessionType==T.AUDIO_HALF)&&this.sessionListener.onDataChannelMessage(e)}changeCameraLocalMedia(){return new Promise((e,r)=>{if(!this.localStream){r(new Error("local stream not found"));return}if(this.localStream.getVideoTracks().length==0){r(new Error("local stream not video track"));return}this.facingChanging=!0,this.localStream.getVideoTracks().forEach(o=>{this.localStream.removeTrack(o),o.stop()});let n,i=this.facingMode;if(this.facingMode===z.FRONT_FACING?(i=z.BACK_FACING,n={audio:{echoCancellation:!0,noiseSuppression:!0},video:{height:{exact:1280},width:{exact:720},facingMode:z.BACK_FACING}}):(i=z.FRONT_FACING,n={audio:{echoCancellation:!0,noiseSuppression:!0},video:{height:{exact:720},width:{exact:1280},facingMode:z.FRONT_FACING}}),navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)navigator.mediaDevices.getUserMedia(n).then(o=>{this.changeCameraSuccess(o,i),e()}).catch(o=>{console.error("change camera failed, use last camera: "+o,o),i=this.facingMode,this.facingMode===z.FRONT_FACING?(i=z.FRONT_FACING,n={audio:{echoCancellation:!0,noiseSuppression:!0},video:{height:{exact:720},width:{exact:1280},facingMode:z.FRONT_FACING}}):(i=z.BACK_FACING,n={audio:{echoCancellation:!0,noiseSuppression:!0},video:{height:{exact:1280},width:{exact:720},facingMode:z.BACK_FACING}}),navigator.mediaDevices.getUserMedia(n).then(s=>{this.changeCameraSuccess(s,i),e()}).catch(s=>{this.changeCameraFailed(s),r(s)})});else{let o=new Error("Browser does not support WebRTC");this.changeCameraFailed(o),r(new Error("Browser does not support WebRTC"))}})}changeCameraSuccess(e,r){if(!this.localStream){e.getTracks().forEach(n=>{n.stop()}),this.facingChanging=!1;return}e.getVideoTracks().forEach(n=>{this.localStream.addTrack(n)}),this.peerConnection.getSenders().forEach(n=>{n.track&&n.track.kind==="video"&&n.replaceTrack(e.getVideoTracks()[0]).then(()=>{}).catch(i=>{console.log(i)})}),this.facingMode=r,this.facingChanging=!1}changeCameraFailed(e){console.log(e),this.facingChanging=!1}}class Af{onAddRemoteStream(e){console.debug("onAddRemoteStream:",e)}onError(e){console.debug("onError:",e)}}class Yo{constructor(e,r){g(this,"url");g(this,"offerSdp");this.url=e,this.offerSdp=r}}const _f="/media-server/video-play/webrtc";class Df{constructor(e,r){g(this,"rtspUrl");g(this,"webrtcSession",new nn(T.RTSP_PULL));g(this,"sessionListener",new Af);g(this,"httpClient");this.rtspUrl=e,this.httpClient=r,this.webrtcSession.setListener(this)}setRtspPullSessionListener(e){this.sessionListener=e}start(){this.webrtcSession.start(!0)}stop(){this.webrtcSession.stop()}onAddLocalStream(e){}onAddRemoteStream(e){this.sessionListener.onAddRemoteStream(e)}onError(e){this.sessionListener.onError(e)}onStartSuccess(e){console.debug("rtsp offer:",e.sdp),this.httpClient.Post(_f,new Yo(this.rtspUrl,e.sdp??"")).then(r=>{var n,i,o,s;if(r.code!=200){this.stop(),this.sessionListener.onError(new Error(r.message));return}console.debug("rtsp answer",(n=r.data)==null?void 0:n.sdp),console.debug("rtsp answer",(i=r.data)==null?void 0:i.candidateList),this.webrtcSession.setRemoteSdp(((o=r.data)==null?void 0:o.sdp)??""),this.webrtcSession.addRemoteCandidate(((s=r.data)==null?void 0:s.candidateList)??[])}).catch(r=>{this.stop(),this.sessionListener.onError(r)})}onDataChannelMessage(e){}onStopDesktopShare(){}}var D=(t=>(t[t.OFFLINE=-1]="OFFLINE",t[t.IDLE=0]="IDLE",t[t.TRY=1]="TRY",t[t.RING=2]="RING",t[t.TALK=3]="TALK",t))(D||{}),G=(t=>(t.VIDEO="video",t.AUDIO="audio",t))(G||{}),ue=(t=>(t.FULL="full-duplex",t.HALF="half-duplex",t))(ue||{}),Ge=(t=>(t.IN="in",t.OUT="out",t))(Ge||{}),X=(t=>(t.LOGIN="login",t.LOGOUT="logout",t.Invite="invite",t.RING="ring",t.ANSWER="answer",t.HANGUP="hangup",t.DTMF="dtmf",t))(X||{});let Zo,es=!1,on="/decoder-assets/";function Lf(){return on}function xf(t){t.endsWith("/")?on=t+"/":on=t}function If(t){es=t}function kf(){return es}function Ff(){Zo="true"}function Uf(){return Zo}function Mf(){let t=!1;try{const e=RTCRtpSender.getCapabilities("video");e&&e.codecs.some(r=>r.mimeType.toLowerCase()==="video/h264")&&(t=!0)}catch(e){console.error("Error checking H.264 support:",e)}return t}function ts(){try{return!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)}catch{return!1}}function Nf(){return"browser-"+Bf()+$f(6)}function Bf(){let t=new Date;return`${t.getFullYear()}${t.getMonth()}${t.getDate()}${t.getHours()}${t.getMinutes()}${t.getSeconds()}`}function $f(t){let e="",r=["0","1","2","3","4","5","6","7","8","9","0","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];for(let n=0;n<t;n++)e+=r[Math.floor(Math.random()*(r.length-1))];return e}class jf{constructor(e,r,n){g(this,"tel");g(this,"mediaType");g(this,"callMode");this.tel=e,this.callMode=n,this.mediaType=r}}class rs{onAddLocalStream(e){console.debug("onAddLocalStream:",e)}onAddRemoteStream(e){console.debug("onAddRemoteStream:",e)}onAnswer(){console.debug("onAnswer")}onClose(e){console.debug("onClose:",e)}onError(e){console.debug("onError:",e)}onHangup(e){console.debug("onHangup:",e)}onNewCall(e){console.debug("onNewCall:",e)}onRing(){console.debug("onRing")}onInitResult(e){console.debug("onInitResult: ",e)}onStopDesktopShare(){console.debug("onStopDesktopShare")}}class ns{constructor(e,r,n){g(this,"tel","");g(this,"status",D.OFFLINE);g(this,"mediaType",G.AUDIO);g(this,"callMode",ue.FULL);g(this,"callDirect",Ge.OUT);g(this,"called","");g(this,"callId");g(this,"remoteSdp");g(this,"candidate");g(this,"ringBackTone",new Audio("sound/ringbacktone.wav"));g(this,"ringtone",new Audio("sound/ringtone.wav"));g(this,"dtmfAudio",new Audio("sound/dtmf.wav"));g(this,"ws");g(this,"wsConnected",!1);g(this,"closeBySelf",!1);g(this,"webrtcSession");g(this,"sessionListener",new rs);g(this,"wsUrl");g(this,"accountId");this.tel=r??"",this.wsUrl=e,this.accountId=n,this.ringBackTone.loop=!0,this.ringtone.loop=!0}setCallSessionListener(e){this.sessionListener=e}init(){this.websocketInit(this.wsUrl)}audioCall(e){this.makeCall(e)}videoCall(e){this.makeCall(e,G.VIDEO)}answer(){var r;if(this.status!=D.RING){console.debug("session is not ring state");return}if(this.callDirect!=Ge.IN){console.debug("session is call out, not allow answer");return}let e;this.callMode==ue.HALF?e=G.VIDEO==this.mediaType?T.VIDEO_HALF:T.AUDIO_HALF:e=G.VIDEO==this.mediaType?T.VIDEO:T.AUDIO,this.webrtcCreate(e),(r=this.webrtcSession)==null||r.start(!1,this.remoteSdp)}hangup(){this.status<=D.IDLE||(this.status==D.TALK?this.sendHangup(this.callId??""):this.callDirect==Ge.IN?this.sendHangup(this.callId??"",488):this.sendHangup(this.callId??"",801),this.close())}dtmf(e){return this.status!==D.TALK?!1:(this.sendDtmf(e),!0)}changeCamera(){return new Promise((e,r)=>{var n;this.webrtcSession||r(new Error("webrtc session not start")),(n=this.webrtcSession)==null||n.changeFacing().then(i=>e(i)).catch(i=>r(i))})}changeMuted(){return new Promise((e,r)=>{this.webrtcSession||r(new Error("webrtc session not start")),this.webrtcSession.changeMuted().then(n=>e(n)).catch(n=>r(n))})}changeCameraOpened(){return new Promise((e,r)=>{this.webrtcSession||r(new Error("webrtc session not start")),this.webrtcSession.changeCameraOpened().then(n=>e(n)).catch(n=>r(n))})}startDesktopShare(){return new Promise((e,r)=>{this.webrtcSession||r(new Error("webrtc session not start")),this.status!=D.TALK&&r(new Error(`session status[${this.status}] not talk`)),this.webrtcSession.startDesktopShare().then(()=>e()).catch(n=>r(n))})}stopDesktopShare(){this.webrtcSession&&this.status==D.TALK&&this.webrtcSession.stopDesktopShare()}destroy(){var e;this.closeBySelf=!0,this.hangup(),this.close(),(e=this.ws)==null||e.close()}makeCall(e,r=G.AUDIO,n=ue.FULL){var i;try{if(!ts()){console.debug("Browser does not support WEBRTC"),this.sessionListener.onError(new Error("Browser does not support WEBRTC"));return}if(this.status==D.OFFLINE){console.debug("The initialization has not been completed yet. Please try again later"),this.sessionListener.onError(new Error("The initialization has not been completed yet. Please try again later"));return}this.status>D.IDLE&&(console.debug("Another call is currently in progress, hangup it"),this.hangup()),this.mediaType=r,this.callMode=n,this.called=e,this.callDirect=Ge.OUT,this.callId=Nf();let o;this.callMode==ue.HALF?o=G.VIDEO==r?T.VIDEO_HALF:T.AUDIO_HALF:o=G.VIDEO==r?T.VIDEO:T.AUDIO,this.webrtcCreate(o),(i=this.webrtcSession)==null||i.start(!0),this.status=D.TRY}catch(o){this.status=D.IDLE,this.sessionListener.onError(new Error(""+o))}}close(){this.webrtcClose();try{this.ringtone.pause(),this.ringBackTone.pause()}catch(e){console.debug("FullSession.close: ",e)}this.status=D.IDLE}websocketInit(e){this.ws=new WebSocket(e),this.closeBySelf=!1,this.ws.onopen=()=>{console.debug("ws connect success"),this.wsConnected=!0,this.sendLogin()},this.ws.onclose=r=>{console.error("ws on close: ",r),this.wsConnected=!1,this.close(),this.status=D.OFFLINE,this.closeBySelf||this.sessionListener.onClose(new Error(r.reason)),this.ws=void 0},this.ws.onmessage=r=>{try{let n=JSON.parse(r.data);switch(console.debug("receive msg from server <<<<<<<<<<<<<<<",n),n.type){case X.Invite:this.inviteHandler(n);break;case X.ANSWER:this.answerHandler(n);break;case X.RING:this.ringHandler(n);break;case X.HANGUP:this.hangupHandler(n);break;case X.LOGIN:this.loginHandler(n);break}}catch(n){console.error("receive msg from server, but process error: ",n,r)}},this.ws.onerror=r=>{console.error("ws on error: ",r)}}sendTo(e){var r;try{this.wsConnected?(console.debug("send msg to server >>>>>>>>>>>>>>>>>> ",e),(r=this.ws)==null||r.send(JSON.stringify(e))):console.error("ws not connected.")}catch(n){console.debug("FullSession sendTo error: ",n)}}sendLogin(){this.sendTo({type:X.LOGIN,username:this.tel,allowEmpty:this.tel===""?Uf():void 0,userAgent:this.getUserAgent(),accountId:this.accountId})}sendLogout(){this.sendTo({type:X.LOGOUT,username:this.tel}),this.status=D.OFFLINE}sendInvite(e){this.sendTo({callId:this.callId,type:X.Invite,from:this.tel,to:this.called,callMode:this.callMode,mediaType:this.mediaType,sdp:e}),this.status=D.TRY}sendRing(){this.sendTo({type:X.RING,callId:this.callId,code:180}),this.status=D.RING}sendAnswer(e){this.sendTo({type:X.ANSWER,callId:this.callId,mediaType:this.mediaType,sdp:e}),this.status=D.TALK,this.ringtone.pause(),this.ringBackTone.pause()}sendDtmf(e){this.sendTo({type:X.DTMF,callId:this.callId,callInfo:"dtmf="+e}),this.dtmfAudio.play().then(()=>{}).catch(r=>console.debug(r))}sendHangup(e,r=800){this.sendTo({type:X.HANGUP,callId:e,code:r}),e==this.callId&&(this.status=D.IDLE,this.callId=void 0)}loginHandler(e){var r;if(e.code!=200){(r=this.ws)==null||r.close(),this.wsConnected=!1,this.ws=void 0,this.status=D.OFFLINE,this.sessionListener.onInitResult(!1);return}this.tel=e.username??"",this.status=D.IDLE,this.sessionListener.onInitResult(!0)}inviteHandler(e){if(!e.callId){console.debug("receive invite, but callId is null.");return}if(!ts()){console.debug("receive invite, but unsupported webrtc."),this.sendHangup(e.callId,803);return}if(this.status>D.IDLE){e.callId!=this.callId?(console.debug("receive invite, but busy."),this.sendHangup(e.callId,486)):console.debug("receive re invite. not process");return}this.callId=e.callId,this.mediaType=e.mediaType??G.AUDIO,this.callMode=e.callMode??ue.FULL,this.called=e.from??"",this.callDirect=Ge.IN,this.remoteSdp=e.sdp,this.candidate=e.candidate,this.sendRing(),this.ringtone.currentTime=0,this.ringtone.play().then(()=>{}).catch(()=>{}),this.sessionListener.onNewCall(new jf(this.called,this.mediaType,this.callMode))}ringHandler(e){var r,n;!e.callId||e.callId!=this.callId||(e.code==183?(this.ringBackTone.pause(),(r=this.webrtcSession)==null||r.setRemoteSdp(e.sdp??""),(n=this.webrtcSession)==null||n.addRemoteCandidate(e.candidate??[])):(this.ringBackTone.currentTime=0,this.ringBackTone.play().then(()=>{}).catch(()=>{})),this.sessionListener.onRing(),this.status=D.RING)}answerHandler(e){var r,n;!e.callId||e.callId!=this.callId||(this.ringBackTone.pause(),(r=this.webrtcSession)==null||r.setRemoteSdp(e.sdp??""),(n=this.webrtcSession)==null||n.addRemoteCandidate(e.candidate??[]),this.sessionListener.onAnswer(),this.status=D.TALK)}hangupHandler(e){!e.callId||e.callId!=this.callId||(this.close(),this.sessionListener.onHangup(e.code))}getUserAgent(){return Mf()?"windows":"phone"}webrtcCreate(e){this.webrtcClose(),this.webrtcSession=new nn(e),this.webrtcSession.setListener(this)}webrtcClose(){var e;(e=this.webrtcSession)==null||e.stop(),this.webrtcSession=void 0}onAddLocalStream(e){this.sessionListener.onAddLocalStream(e)}onAddRemoteStream(e){this.sessionListener.onAddRemoteStream(e)}onError(e){this.status>D.IDLE&&this.hangup(),this.close(),this.sessionListener.onError(e)}onStartSuccess(e){var r;e.type=="answer"?(this.sendAnswer(e.sdp??""),(r=this.webrtcSession)==null||r.addRemoteCandidate(this.candidate??[])):e.type=="offer"&&this.sendInvite(e.sdp??"")}onDataChannelMessage(e){}onStopDesktopShare(){this.sessionListener.onStopDesktopShare()}}class Hf{onError(e){console.debug("onError:",e)}onAddLocalStream(e){console.debug("onAddLocalStream:",e)}onStopDesktopShare(){console.debug("onStopDesktopShare")}}const Vf="/media-server/broadcast/webrtc";class qf{constructor(e,r,n){g(this,"tel");g(this,"mediaType");g(this,"webrtcSession");g(this,"sessionListener",new Hf);g(this,"httpClient");this.tel=e,this.httpClient=r,this.mediaType=n===G.VIDEO?G.VIDEO:G.AUDIO,this.webrtcSession=new nn(n==G.VIDEO?T.VIDEO_PUSH:T.AUDIO_PUSH),this.webrtcSession.setListener(this)}setBroadcastSessionListener(e){this.sessionListener=e}start(){this.webrtcSession.start(!0)}stop(){this.webrtcSession.stop()}startDesktopShare(){return new Promise((e,r)=>{this.webrtcSession||r(new Error("webrtc session not start")),this.webrtcSession.startDesktopShare().then(()=>e()).catch(n=>r(n))})}stopDesktopShare(){this.webrtcSession&&this.webrtcSession.stopDesktopShare()}onAddLocalStream(e){this.sessionListener.onAddLocalStream(e)}onAddRemoteStream(e){}onError(e){this.sessionListener.onError(e)}onStartSuccess(e){console.debug("offer:",e.sdp),this.httpClient.Post(Vf,new Yo(this.tel,e.sdp??"")).then(r=>{var n,i,o;if(r.code!=200){this.stop(),this.sessionListener.onError(new Error(r.message));return}console.debug("answer",(n=r.data)==null?void 0:n.sdp),this.webrtcSession.setRemoteSdp(((i=r.data)==null?void 0:i.sdp)??""),this.webrtcSession.addRemoteCandidate(((o=r.data)==null?void 0:o.candidateList)??[])}).catch(r=>{this.stop(),this.sessionListener.onError(r)})}onDataChannelMessage(e){}onStopDesktopShare(){this.sessionListener.onStopDesktopShare()}}var sn=(t=>(t.TB_REQUEST="tb_request",t.TB_GRANTED="tb_granted",t.TB_TAKEN="tb_taken",t.TB_DENY="tb_deny",t.TB_RELEASE="tb_release",t.TB_IDLE="tb_idle",t.TB_REVOKE="tb_revoke",t))(sn||{});class zf extends rs{onTbcpMessage(e){console.debug("onTbcpMessage:",e)}}class Gf extends ns{constructor(r,n,i){super(r,n,i);g(this,"sessionListener",new zf)}setCallSessionListener(r){this.sessionListener=r}audioHalfCall(r){this.makeCall(r,G.AUDIO,ue.HALF)}videoHalfCall(r){this.makeCall(r,G.VIDEO,ue.HALF)}tbcpRequest(){var r;this.callMode==ue.HALF&&this.status==D.TALK&&((r=this.webrtcSession)==null||r.sendStringData(JSON.stringify({type:sn.TB_REQUEST})))}tbcpRelease(){var r;this.callMode==ue.HALF&&this.status==D.TALK&&((r=this.webrtcSession)==null||r.sendStringData(JSON.stringify({type:sn.TB_RELEASE})))}onDataChannelMessage(r){try{this.sessionListener.onTbcpMessage(JSON.parse(r))}catch(n){console.debug("onDataChannelMessage err: ",n,r)}}}function Wf(t){const e=t^85;let r=(e&15)<<4;const n=(e&112)>>4;return n===0?r+=8:n===1?r+=264:r=r+264<<n-1,e&128?r:-r}function Kf(t){const e=new Int16Array(t.length);for(let r=0;r<t.length;r++)e[r]=Wf(t[r]);return e}function Jf(t){const e=t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength);if(e.byteLength<12)throw new Error("RTP packet is shorter than its fixed header");if(e[0]>>>6!==2)throw new Error("Unsupported RTP version");const r=e[0]&15,n=(e[0]&16)!==0,i=(e[0]&32)!==0;let o=12+r*4;if(o>e.length)throw new Error("Truncated RTP CSRC list");if(n){if(o+4>e.length)throw new Error("Truncated RTP extension header");const a=e[o+2]<<8|e[o+3];if(o+=4+a*4,o>e.length)throw new Error("Truncated RTP extension data")}let s=e.length;if(i){const a=e[s-1];if(a===0||a>s-o)throw new Error("Invalid RTP padding");s-=a}if(o>=s)throw new Error("RTP packet has an empty payload");return{payloadType:e[1]&127,marker:(e[1]&128)!==0,sequenceNumber:e[2]<<8|e[3],timestamp:new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(4),ssrc:new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(8),payload:e.subarray(o,s)}}const Qf=new Uint8Array([0,0,0,1]),is=24,os=28;function ss(t){const e=new Uint8Array(t.reduce((n,i)=>n+i.length,0));let r=0;for(const n of t)e.set(n,r),r+=n.length;return e}class Xf{constructor(){g(this,"timestamp");g(this,"nals",[]);g(this,"fu");g(this,"fuType",0)}push(e){this.timestamp!==void 0&&e.timestamp!==this.timestamp&&this.reset(),this.timestamp=e.timestamp;try{this.consume(e.payload)}catch(o){throw this.reset(),o}if(!e.marker)return;if(this.fu||this.nals.length===0){this.reset();return}const r=this.nals,n=this.timestamp;this.nals=[],this.timestamp=void 0;const i=r.map(o=>o[0]&31);return{timestamp:n,data:ss(r.flatMap(o=>[Qf,o])),keyFrame:i.includes(5),nalTypes:i}}reset(){this.timestamp=void 0,this.nals=[],this.fu=void 0,this.fuType=0}consume(e){if(e.length<1)throw new Error("Empty H.264 RTP payload");const r=e[0]&31;if(r===is){this.consumeStapA(e);return}if(r===os){this.consumeFuA(e);return}if(r<1||r>23)throw new Error(`Unsupported H.264 RTP packet type ${r}`);if(this.fu)throw new Error("H.264 FU-A interrupted by a non-FU packet");this.nals.push(e.slice())}consumeStapA(e){if(this.fu)throw new Error("H.264 STAP-A interrupted an FU-A");let r=1;for(;r+2<=e.length;){const n=e[r]<<8|e[r+1];if(r+=2,n<1||r+n>e.length)throw new Error("Invalid H.264 STAP-A NAL length");const i=e.slice(r,r+n),o=i[0]&31;if(o===is||o===os||o===0)throw new Error("Invalid NAL in H.264 STAP-A");this.nals.push(i),r+=n}if(r!==e.length)throw new Error("Trailing bytes in H.264 STAP-A")}consumeFuA(e){if(e.length<3)throw new Error("Truncated H.264 FU-A");const r=e[1],n=(r&128)!==0,i=(r&64)!==0,o=r&31;if(n){if(this.fu)throw new Error("Nested H.264 FU-A start");this.fuType=o,this.fu=[new Uint8Array([e[0]&224|o]),e.slice(2)]}else{if(!this.fu||this.fuType!==o)throw new Error("H.264 FU-A continuation without matching start");this.fu.push(e.slice(2))}i&&this.fu&&(this.nals.push(ss(this.fu)),this.fu=void 0)}}const Yf=new Uint8Array([0,0,0,1]),as=48,cs=49;function Qt(t){if(t.length<2)throw new Error("Truncated HEVC NAL unit");return t[0]>>>1&63}function ls(t){const e=t.reduce((i,o)=>i+o.byteLength,0),r=new Uint8Array(e);let n=0;for(const i of t)r.set(i,n),n+=i.byteLength;return r}class Zf{constructor(){g(this,"timestamp");g(this,"nals",[]);g(this,"fu");g(this,"fuHeader",0)}push(e){this.timestamp!==void 0&&e.timestamp!==this.timestamp&&this.reset(),this.timestamp=e.timestamp;try{this.consumePayload(e.payload)}catch(o){throw this.reset(),o}if(!e.marker)return;if(this.fu){this.reset();return}if(this.nals.length===0){this.reset();return}const r=this.nals,n=this.timestamp;this.nals=[],this.timestamp=void 0;const i=r.map(Qt);return{timestamp:n,data:ls(r.flatMap(o=>[Yf,o])),keyFrame:i.some(o=>o>=16&&o<=21),nalTypes:i}}reset(){this.timestamp=void 0,this.nals=[],this.fu=void 0,this.fuHeader=0}consumePayload(e){if(e.length<2)throw new Error("Truncated HEVC RTP payload");const r=Qt(e);if(r===as){this.consumeAggregationPacket(e);return}if(r===cs){this.consumeFragmentationUnit(e);return}if(this.fu)throw new Error("HEVC FU interrupted by a non-FU packet");this.nals.push(e.slice())}consumeAggregationPacket(e){if(this.fu)throw new Error("HEVC AP interrupted an FU");let r=2;for(;r+2<=e.length;){const n=e[r]<<8|e[r+1];if(r+=2,n<2||r+n>e.length)throw new Error("Invalid HEVC AP NAL length");const i=e.slice(r,r+n);if(Qt(i)===as||Qt(i)===cs)throw new Error("Nested HEVC packetization unit");this.nals.push(i),r+=n}if(r!==e.length)throw new Error("Trailing bytes in HEVC AP")}consumeFragmentationUnit(e){if(e.length<4)throw new Error("Truncated HEVC FU");const r=e[2],n=(r&128)!==0,i=(r&64)!==0,o=r&63;if(n){if(this.fu)throw new Error("Nested HEVC FU start");const s=new Uint8Array([e[0]&129|o<<1,e[1]]);this.fuHeader=o,this.fu=[s,e.slice(3)]}else{if(!this.fu||this.fuHeader!==o)throw new Error("HEVC FU continuation without matching start");this.fu.push(e.slice(3))}i&&this.fu&&(this.nals.push(ls(this.fu)),this.fu=void 0)}}function ed(t,e="hev1"){if(t.length<4||(t[0]>>>1&63)!==33)return;const r=[];let n=0;for(const o of t.subarray(2)){if(n>=2&&o===3){n=0;continue}r.push(o),n=o===0?n+1:0}const i=new td(Uint8Array.from(r));try{i.skip(4);const o=i.read(3);i.skip(1);const s=i.read(2),a=i.read(1)?"H":"L",c=i.read(5),l=rd(i.read32()),u=Array.from({length:6},()=>i.read(8)),f=i.read(8),d=[],h=[];for(let P=0;P<o;P++)d.push(i.read(1)!==0),h.push(i.read(1)!==0);o>0&&i.skip((8-o)*2);for(let P=0;P<o;P++)d[P]&&i.skip(88),h[P]&&i.skip(8);const y=u.map(P=>P.toString(16).padStart(2,"0")).join("").replace(/(00)+$/i,"").toUpperCase(),S=[`${s?String.fromCharCode(64+s):""}${c}`,l.toString(10),`${a}${f}`,y];return`${e}.${S.join(".")}`}catch{return}}class td{constructor(e){g(this,"offset",0);this.data=e}read(e){if(e<0||e>32||this.offset+e>this.data.length*8)throw new Error("Truncated HEVC SPS");let r=0;for(let n=0;n<e;n++)r=r*2+(this.data[this.offset>>>3]>>>7-(this.offset&7)&1),this.offset++;return r}read32(){return this.read(32)>>>0}skip(e){if(e<0||this.offset+e>this.data.length*8)throw new Error("Truncated HEVC SPS");this.offset+=e}}function rd(t){let e=0;for(let r=0;r<32;r++)e=e*2+(t>>>r&1)>>>0;return e}const nd="hev1.1.6.L120.B0",id="avc1.42E01E";class od{constructor(e){g(this,"options");g(this,"videoCodec");g(this,"videoPayloadType");g(this,"audioPayloadType");g(this,"audioClockRate");g(this,"audioChannels");g(this,"depacketizer");g(this,"parameterSets",new Map);g(this,"pendingUnits",[]);g(this,"audioNodes",new Set);g(this,"codecString");g(this,"codecStringPinned");g(this,"hardwareDecoder");g(this,"softwareWorker");g(this,"videoFrameWriter");g(this,"outputTrack");g(this,"audioContext");g(this,"audioDestination");g(this,"audioUnlockHandler");g(this,"outputStream");g(this,"outputError");g(this,"streamWaiters",[]);g(this,"mode");g(this,"closed",!1);g(this,"waitingForKeyFrame",!0);g(this,"initializationStarted",!1);g(this,"lastVideoSequence");g(this,"videoSsrc");g(this,"lastAudioSequence");g(this,"audioSsrc");g(this,"audioRtpBase");g(this,"audioTimeBase");g(this,"audioScheduledUntil",0);g(this,"videoTimestampBase");if(e.videoPayloadType<0||e.videoPayloadType>127)throw new Error("Invalid video RTP payload type");if(e.audioPayloadType!==void 0&&(e.audioPayloadType<0||e.audioPayloadType>127))throw new Error("Invalid audio RTP payload type");if(e.audioPayloadType===e.videoPayloadType)throw new Error("Audio and video payload types must be different");if(this.options=e,this.videoCodec=e.videoCodec,this.videoPayloadType=e.videoPayloadType,this.audioPayloadType=e.audioPayloadType,this.audioClockRate=e.audioClockRate??8e3,this.audioChannels=e.audioChannels??1,this.codecStringPinned=e.videoCodecString!==void 0,this.codecString=e.videoCodecString??(e.videoCodec==="h265"?nd:id),this.depacketizer=e.videoCodec==="h265"?new Zf:new Xf,this.audioChannels<1||this.audioChannels>2)throw new Error("G.711 A-law supports one or two configured channels");try{const r=globalThis;let n,i;if(typeof r.VideoTrackGenerator=="function"){const o=new r.VideoTrackGenerator;n=o.track,i=o.writable}else if(typeof r.MediaStreamTrackGenerator=="function"){const o=new r.MediaStreamTrackGenerator({kind:"video"});n=o,i=o.writable}else throw new Error("当前浏览器不支持 VideoTrackGenerator,无法在不使用 canvas 的情况下播放解码帧");this.outputTrack=n,this.outputStream=new MediaStream([n]),this.videoFrameWriter=i.getWriter()}catch(r){this.outputError=r instanceof Error?r:new Error(String(r)),this.report(this.outputError)}}get decoderMode(){return this.mode}pushRtpPacket(e){if(this.closed)throw new Error("Player is closed");let r;try{r=Jf(e)}catch(n){this.report(n);return}r.payloadType===this.videoPayloadType?this.pushVideoPacket(r):r.payloadType===this.audioPayloadType&&this.pushAudioPacket(r)}getMediaStream(){return this.closed?Promise.reject(new Error("Player is closed")):this.outputStream?Promise.resolve(this.outputStream):this.outputError?Promise.reject(this.outputError):new Promise((e,r)=>this.streamWaiters.push({resolve:e,reject:r}))}notifyPacketLoss(){var e,r;this.depacketizer.reset(),this.waitingForKeyFrame=!0,this.lastVideoSequence=void 0,(r=(e=this.options).onKeyFrameNeeded)==null||r.call(e)}close(){var e,r,n,i,o,s,a;if(!this.closed){this.closed=!0,(e=this.videoFrameWriter)==null||e.close().catch(()=>{}),this.videoFrameWriter=void 0,(r=this.outputTrack)==null||r.stop(),this.outputTrack=void 0,this.outputStream=void 0;for(const c of this.streamWaiters.splice(0))c.reject(new Error("Player is closed"));this.depacketizer.reset(),(n=this.hardwareDecoder)==null||n.close(),this.hardwareDecoder=void 0,(i=this.softwareWorker)==null||i.postMessage({type:"close"}),(o=this.softwareWorker)==null||o.terminate(),this.softwareWorker=void 0;for(const c of this.audioNodes)try{c.stop()}catch{}this.audioNodes.clear(),(s=this.audioContext)==null||s.close(),this.audioContext=void 0,(a=this.audioDestination)==null||a.stream.getTracks().forEach(c=>c.stop()),this.audioDestination=void 0,this.removeAudioUnlockListeners(),this.parameterSets.clear(),this.pendingUnits.length=0}}pushVideoPacket(e){var r,n,i,o,s,a;if(this.videoSsrc!==void 0&&e.ssrc!==this.videoSsrc?(this.notifyPacketLoss(),this.videoSsrc=e.ssrc):this.videoSsrc===void 0&&(this.videoSsrc=e.ssrc),this.lastVideoSequence!==void 0&&e.sequenceNumber!==(this.lastVideoSequence+1&65535)){const c=this.lastVideoSequence+1&65535,l=e.sequenceNumber-this.lastVideoSequence&65535,u=l>1&&l<32768?l-1:0;(n=(r=this.options).onVideoSequenceGap)==null||n.call(r,u,c,e.sequenceNumber),this.depacketizer.reset(),this.waitingForKeyFrame=!0,(o=(i=this.options).onKeyFrameNeeded)==null||o.call(i)}this.lastVideoSequence=e.sequenceNumber;try{const c=this.depacketizer.push(e);if(!c)return;if(this.rememberParameterSets(c),this.waitingForKeyFrame){if(!c.keyFrame||!this.hasParameterSets())return;this.waitingForKeyFrame=!1}this.initializationStarted||(this.initializationStarted=!0,this.initialize()),this.decode(c)}catch(c){this.waitingForKeyFrame=!0,(a=(s=this.options).onKeyFrameNeeded)==null||a.call(s),this.report(c)}}pushAudioPacket(e){if(e.payload.length){this.audioSsrc!==void 0&&e.ssrc!==this.audioSsrc&&this.resetAudioPlayout(),this.audioSsrc=e.ssrc,this.lastAudioSequence!==void 0&&e.sequenceNumber!==(this.lastAudioSequence+1&65535)&&this.resetAudioPlayout(),this.lastAudioSequence=e.sequenceNumber;try{this.ensureAudioOutput();const r=this.audioContext,n=this.audioDestination;if(r.state!=="running"){this.audioRtpBase=void 0,this.audioTimeBase=void 0,this.audioScheduledUntil=r.currentTime;return}const i=Kf(e.payload),o=Math.floor(i.length/this.audioChannels);if(o===0)return;const s=r.createBuffer(this.audioChannels,o,this.audioClockRate);for(let f=0;f<this.audioChannels;f++){const d=s.getChannelData(f);for(let h=0;h<o;h++)d[h]=i[h*this.audioChannels+f]/32768}const a=r.currentTime;(this.audioRtpBase===void 0||this.audioTimeBase===void 0)&&(this.audioRtpBase=e.timestamp,this.audioTimeBase=a+.06);let c=e.timestamp-this.audioRtpBase>>>0;c>2147483647&&(c-=4294967296);let l=this.audioTimeBase+c/this.audioClockRate;(l<a-.12||l>a+1)&&(this.audioRtpBase=e.timestamp,this.audioTimeBase=a+.06,l=this.audioTimeBase),l=Math.max(l,a+.01,this.audioScheduledUntil);const u=r.createBufferSource();u.buffer=s,u.connect(n),u.onended=()=>{u.disconnect(),this.audioNodes.delete(u)},u.start(l),this.audioNodes.add(u),this.audioScheduledUntil=l+s.duration}catch(r){this.report(r)}}}resetAudioPlayout(){this.audioRtpBase=void 0,this.audioTimeBase=void 0,this.audioScheduledUntil=0;for(const e of this.audioNodes)try{e.stop()}catch{}this.audioNodes.clear()}ensureAudioOutput(){if(this.audioContext??(this.audioContext=new AudioContext),!this.audioDestination){this.audioDestination=this.audioContext.createMediaStreamDestination();const e=this.audioDestination.stream.getAudioTracks()[0];e&&this.outputStream&&this.outputStream.addTrack(e)}this.installAudioUnlockListeners()}installAudioUnlockListeners(){this.audioUnlockHandler||!this.audioContext||this.audioContext.state==="running"||typeof window>"u"||(this.audioUnlockHandler=()=>{const e=this.audioContext;e&&e.resume().then(()=>{e.state==="running"&&(this.audioRtpBase=void 0,this.audioTimeBase=void 0,this.audioScheduledUntil=e.currentTime,this.removeAudioUnlockListeners())}).catch(r=>this.report(r))},window.addEventListener("pointerdown",this.audioUnlockHandler,!0),window.addEventListener("keydown",this.audioUnlockHandler,!0))}removeAudioUnlockListeners(){!this.audioUnlockHandler||typeof window>"u"||(window.removeEventListener("pointerdown",this.audioUnlockHandler,!0),window.removeEventListener("keydown",this.audioUnlockHandler,!0),this.audioUnlockHandler=void 0)}rememberParameterSets(e){const r=this.videoCodec==="h265"?[32,33,34]:[7,8],n=e.data;let i=0;for(;i+5<n.length;){let o=-1;for(let c=i;c+3<n.length;c++)if(n[c]===0&&n[c+1]===0&&n[c+2]===0&&n[c+3]===1){o=c;break}if(o<0)break;const s=o+4;let a=n.length;for(let c=s+2;c+3<n.length;c++)if(n[c]===0&&n[c+1]===0&&n[c+2]===0&&n[c+3]===1){a=c;break}if(s<a){const c=this.videoCodec==="h265"?n[s]>>>1&63:n[s]&31;if(r.includes(c)){const l=n.slice(s,a);this.parameterSets.set(c,l),this.videoCodec==="h265"&&c===33&&!this.codecStringPinned&&(this.codecString=ed(l)??this.codecString),this.videoCodec==="h264"&&c===7&&!this.codecStringPinned&&l.length>=4&&(this.codecString=`avc1.${[l[1],l[2],l[3]].map(u=>u.toString(16).padStart(2,"0")).join("").toUpperCase()}`)}}if(i=a,a===n.length)break}}hasParameterSets(){return(this.videoCodec==="h265"?[32,33,34]:[7,8]).every(r=>this.parameterSets.has(r))}async initialize(){try{if(typeof VideoDecoder<"u"){const e={codec:this.codecString,hardwareAcceleration:"prefer-hardware",optimizeForLatency:!0},r=await VideoDecoder.isConfigSupported(e);if(!this.closed&&r.supported){this.useWebCodecs(e);return}}if(this.videoCodec==="h265")await this.useSoftware();else throw new Error("This browser does not support H.264 WebCodecs decoding")}catch(e){if(this.videoCodec==="h265"){this.report(e);try{await this.useSoftware()}catch(r){this.report(r)}}else this.report(e)}}useWebCodecs(e){var n,i;const r=new VideoDecoder({output:o=>{this.renderWebCodecsFrame(o)},error:o=>{this.videoCodec==="h265"?this.fallbackToSoftware(o):this.report(o)}});r.configure(e),this.hardwareDecoder=r,this.mode="hardware",(i=(n=this.options).onDecoderChange)==null||i.call(n,"hardware"),this.flushPendingUnits()}async useSoftware(){if(this.closed||this.softwareWorker||this.videoCodec!=="h265")return;const e=this.options.decoderAssetsBaseUrl??new URL("./decoder-assets/",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:q&&q.tagName.toUpperCase()==="SCRIPT"&&q.src||new URL("mediaAV.umd.cjs",document.baseURI).href).href,r=new Worker(`${e}software-worker.js`,{type:"module"});this.softwareWorker=r,r.onmessage=n=>{var i,o,s,a;if(n.data.type==="ready")this.mode="software",(o=(i=this.options).onDecoderChange)==null||o.call(i,"software"),this.flushPendingUnits();else if(n.data.type==="frame"&&n.data.frame){const c=n.data.frame;if(this.closed){c.close();return}this.sendVideoFrame(c)}else n.data.type==="error"&&(this.waitingForKeyFrame=!0,(a=(s=this.options).onKeyFrameNeeded)==null||a.call(s),this.report(new Error(n.data.message??"Software decoder failed")))},r.onerror=n=>this.report(new Error(n.message||"Software decoder worker failed")),r.postMessage({type:"init",decoderJsUrl:`${e}libde265.mjs`,wasmUrl:`${e}libde265.wasm`})}async fallbackToSoftware(e){var r,n,i;if(!(this.closed||this.mode==="software"||this.videoCodec!=="h265")){(r=this.hardwareDecoder)==null||r.close(),this.hardwareDecoder=void 0,this.mode=void 0,this.waitingForKeyFrame=!0,this.pendingUnits.length=0,(i=(n=this.options).onKeyFrameNeeded)==null||i.call(n),this.report(new Error(`视频硬解码失败,切换软件解码:${e.message}`));try{await this.useSoftware()}catch(o){this.report(o)}}}decode(e){var n,i,o,s,a;const r=this.videoTimestampUs(e.timestamp);if(!this.mode){if(this.pendingUnits.length>=16){this.pendingUnits.length=0,this.waitingForKeyFrame=!0,(i=(n=this.options).onKeyFrameNeeded)==null||i.call(n);return}this.pendingUnits.push(e);return}if(this.mode==="hardware"&&((o=this.hardwareDecoder)==null?void 0:o.state)==="configured"){if(this.hardwareDecoder.decodeQueueSize>30){this.videoCodec==="h265"?this.fallbackToSoftware(new Error("硬解码队列积压")):(this.waitingForKeyFrame=!0,(a=(s=this.options).onKeyFrameNeeded)==null||a.call(s));return}try{this.hardwareDecoder.decode(new EncodedVideoChunk({type:e.keyFrame?"key":"delta",timestamp:r,data:e.data}));return}catch(c){this.videoCodec==="h265"?this.fallbackToSoftware(c instanceof Error?c:new Error(String(c))):this.report(c)}}if(!this.waitingForKeyFrame&&this.videoCodec==="h265"&&(this.mode==="software"||this.mode===void 0)&&this.softwareWorker){const c=e.data.slice();this.softwareWorker.postMessage({type:"decode",data:c.buffer,timestampUs:r},[c.buffer])}}async renderWebCodecsFrame(e){let r=!1;try{if(this.closed||this.mode!=="hardware"||this.closed)return;this.sendVideoFrame(e),r=!0}catch(n){this.report(n)}finally{r||e.close()}}sendVideoFrame(e){if(this.closed){e.close();return}const r=this.videoFrameWriter;if(!r){e.close();return}r.ready.then(()=>r.write(e)).then(()=>{var n,i;(i=(n=this.options).onFrameRendered)==null||i.call(n)}).catch(n=>{e.close(),this.report(n)})}flushPendingUnits(){const e=this.pendingUnits.splice(0);for(const r of e)this.decode(r)}videoTimestampUs(e){this.videoTimestampBase===void 0&&(this.videoTimestampBase=e);let r=e-this.videoTimestampBase>>>0;return r>2147483647&&(r-=4294967296),Math.max(0,Math.round(r*1e6/9e4))}report(e){var r,n;(n=(r=this.options).onError)==null||n.call(r,e instanceof Error?e:new Error(String(e)))}}function sd(t){let e;try{e=JSON.parse(t)}catch{throw new Error("Invalid stream description: expected a JSON object")}if(!fs(e))throw new Error("Invalid stream description: expected a JSON object");const r=us(e.video,"video"),n=r.media.trim().toLowerCase();if(n!=="h264"&&n!=="h265")throw new Error(`Unsupported video media "${r.media}"; expected h264 or h265`);const i={videoCodec:n,videoPayloadType:r.payloadType,videoChannel:r.channel};if(e.audio!==void 0&&e.audio!==null){const o=us(e.audio,"audio");if(o.media.trim().toLowerCase()!=="pcma")throw new Error(`Unsupported audio media "${o.media}"; expected pcma`);i.audioPayloadType=o.payloadType,i.audioChannel=o.channel}if(i.audioPayloadType===i.videoPayloadType)throw new Error("Audio and video payload types must be different");return i}function us(t,e){if(!fs(t))throw new Error(`Stream description is missing ${e} media`);if(typeof t.media!="string"||t.media.trim()==="")throw new Error(`Invalid ${e}.media`);if(!Number.isInteger(t.channel)||t.channel<0)throw new Error(`Invalid ${e}.channel`);if(!Number.isInteger(t.payloadType)||t.payloadType<0||t.payloadType>127)throw new Error(`Invalid ${e}.payloadType; expected an integer from 0 to 127`);return{media:t.media,channel:t.channel,payloadType:t.payloadType}}function fs(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}class ad{constructor(e){g(this,"listener");g(this,"socket");g(this,"player");g(this,"remoteStream");g(this,"messageQueue",Promise.resolve());g(this,"generation",0);this.options=e}setRtspPullSessionListener(e){this.listener=e,this.remoteStream&&e.onAddRemoteStream(this.remoteStream)}start(){var n,i;if(this.socket&&this.socket.readyState<WebSocket.CLOSING)return;const e=++this.generation;let r;try{const o=new URL(this.options.url);if(o.protocol!=="ws:"&&o.protocol!=="wss:")throw new Error("WebSocket URL must use ws:// or wss://");o.searchParams.set("stream",btoa(this.options.rtspUrl)),r=new WebSocket(o),r.binaryType="arraybuffer"}catch(o){this.report(o);return}this.socket=r,this.messageQueue=Promise.resolve(),(i=(n=this.options).onConnectionStateChange)==null||i.call(n,"connecting"),r.onopen=()=>{var o,s;this.isCurrent(r,e)&&((s=(o=this.options).onConnectionStateChange)==null||s.call(o,"connected"))},r.onmessage=({data:o})=>{this.messageQueue=this.messageQueue.then(async()=>{if(this.isCurrent(r,e))if(typeof o=="string")this.handleDescription(o,r,e);else if(o instanceof ArrayBuffer)this.handleRtpPacket(o);else if(o instanceof Blob)this.handleRtpPacket(await o.arrayBuffer());else throw new Error("Unsupported WebSocket message type")}).catch(s=>this.report(s))},r.onerror=()=>{this.isCurrent(r,e)&&this.report(new Error("WebSocket connection error"))},r.onclose=o=>{var s,a;this.isCurrent(r,e)&&(this.socket=void 0,this.disposePlayer(),(a=(s=this.options).onConnectionStateChange)==null||a.call(s,"disconnected"),o.wasClean||this.report(new Error(`WebSocket disconnected (${o.code})`)))}}stop(){var r,n;++this.generation;const e=this.socket;this.socket=void 0,e&&(e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null,e.readyState<WebSocket.CLOSING&&e.close(1e3,"client stopped")),this.disposePlayer(),(n=(r=this.options).onConnectionStateChange)==null||n.call(r,"disconnected")}handleDescription(e,r,n){var s,a;const i=sd(e);(a=(s=this.options).onStreamConfig)==null||a.call(s,i),this.disposePlayer();const o=new od({videoPayloadType:i.videoPayloadType,videoCodec:i.videoCodec,audioPayloadType:i.audioPayloadType,audioClockRate:8e3,audioChannels:1,decoderAssetsBaseUrl:this.options.decoderAssetsBaseUrl,onDecoderChange:this.options.onDecoderChange,onKeyFrameNeeded:this.options.onKeyFrameNeeded,onVideoSequenceGap:this.options.onVideoSequenceGap,onFrameRendered:this.options.onFrameRendered,onError:c=>this.report(c)});this.player=o,o.getMediaStream().then(c=>{var l;if(!this.isCurrent(r,n)||this.player!==o){c.getTracks().forEach(u=>u.stop());return}this.remoteStream=c,(l=this.listener)==null||l.onAddRemoteStream(c)}).catch(c=>this.report(c))}handleRtpPacket(e){var r,n;if(!this.player){this.report(new Error("Received RTP before the private JSON stream description"));return}this.player.pushRtpPacket(e),(n=(r=this.options).onRtpPacket)==null||n.call(r,e.byteLength)}disposePlayer(){var e;(e=this.player)==null||e.close(),this.player=void 0,this.remoteStream=void 0}isCurrent(e,r){return this.socket===e&&this.generation===r}report(e){var r;(r=this.listener)==null||r.onError(e instanceof Error?e:new Error(String(e)))}}let an=new lo("/"),ds="/media-server/ws/voip",ps="/media-server/ws/b-trun-c",hs="/media-server/ws/video-play",cn=new URL((window.location.protocol=="https:"?"wss://":"ws://")+window.location.host+ds),ln=new URL((window.location.protocol=="https:"?"wss://":"ws://")+window.location.host+ps),We=new URL((window.location.protocol=="https:"?"wss://":"ws://")+window.location.host+hs);function cd(t){let e=new URL(t);const r=e.protocol;if(r!="http:"&&r!="https:"&&r!="wss:"&&r!="ws:"){console.debug("moduleInit protocol error, init failed",r);return}e.protocol=="https:"?e.protocol="wss:":e.protocol=="http:"&&(e.protocol="ws:"),ys(e.toString()),e.protocol=="wss:"?e.protocol="https:":e.protocol=="ws:"&&(e.protocol="http:"),ms(e.toString())}function ms(t){const e=new URL(t).protocol;if(e!="http:"&&e!="https:"){console.debug("videoModuleInit protocol error, init failed",e);return}an=new lo(t),We=new URL(t),We.protocol=="https:"?We.protocol="wss:":We.protocol="ws:",We.pathname=hs}function ld(t){return kf()?new Df(t,an):new ad({url:We.toString(),rtspUrl:t,decoderAssetsBaseUrl:Lf()})}function ud(t,e){return new qf(t,an,e)}function ys(t){const e=new URL(t).protocol;if(e!="ws:"&&e!="wss:"){console.debug("voipModuleInit protocol error, init failed",e);return}cn=new URL(t),cn.pathname=ds,ln=new URL(t),ln.pathname=ps}function fd(t){return new ns(cn.toString(),t)}function dd(t,e){return new Gf(ln.toString(),t,e)}k.createAppCallSession=dd,k.createBroadcastSession=ud,k.createCallSession=fd,k.createRtspPullSession=ld,k.moduleInit=cd,k.setAllowEmpty=Ff,k.setDecoderAssets=xf,k.setTranscode=If,k.videoModuleInit=ms,k.voipModuleInit=ys,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})});
46
+ `);t.RTCSessionDescription&&i instanceof t.RTCSessionDescription?arguments[0]=new t.RTCSessionDescription({type:i.type,sdp:o}):i.sdp=o}return r.apply(this,arguments)}}function Kt(t,e){if(!(t.RTCPeerConnection&&t.RTCPeerConnection.prototype))return;const r=t.RTCPeerConnection.prototype.addIceCandidate;!r||r.length===0||(t.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(e.browser==="chrome"&&e.version<78||e.browser==="firefox"&&e.version<68||e.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function Jt(t,e){if(!(t.RTCPeerConnection&&t.RTCPeerConnection.prototype))return;const r=t.RTCPeerConnection.prototype.setLocalDescription;!r||r.length===0||(t.RTCPeerConnection.prototype.setLocalDescription=function(){let i=arguments[0]||{};if(typeof i!="object"||i.type&&i.sdp)return r.apply(this,arguments);if(i={type:i.type,sdp:i.sdp},!i.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":i.type="offer";break;default:i.type="answer";break}return i.sdp||i.type!=="offer"&&i.type!=="answer"?r.apply(this,[i]):(i.type==="offer"?this.createOffer:this.createAnswer).apply(this).then(s=>r.apply(this,[s]))})}const Af=Object.freeze(Object.defineProperty({__proto__:null,removeExtmapAllowMixed:Zr,shimAddIceCandidateNullOrEmpty:Kt,shimConnectionState:Yr,shimMaxMessageSize:Gt,shimParameterlessSetLocalDescription:Jt,shimRTCIceCandidate:zt,shimRTCIceCandidateRelayProtocol:Xr,shimSendThrowTypeError:Wt},Symbol.toStringTag,{value:"Module"}));function _f({window:t}={},e={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const r=ao,n=Tf(t),i={browserDetails:n,commonShim:Af,extractVersion:qt,disableLog:Rf,disableWarnings:Ef,sdp:wf};switch(n.browser){case"chrome":if(!Ro||!Jr||!e.shimChrome)return r("Chrome shim is not included in this adapter release."),i;if(n.version===null)return r("Chrome shim can not determine version, not shimming."),i;r("adapter.js shimming chrome."),i.browserShim=Ro,Kt(t,n),Jt(t),po(t,n),ho(t),Jr(t,n),mo(t),bo(t,n),yo(t),go(t),So(t),Co(t,n),zt(t),Xr(t),Yr(t),Gt(t,n),Wt(t),Zr(t,n);break;case"firefox":if(!Io||!Qr||!e.shimFirefox)return r("Firefox shim is not included in this adapter release."),i;r("adapter.js shimming firefox."),i.browserShim=Io,Kt(t,n),Jt(t),Eo(t,n),Qr(t,n),To(t),wo(t),Po(t),Oo(t),Ao(t),_o(t),Do(t),Lo(t),xo(t),zt(t),Yr(t),Gt(t,n),Wt(t);break;case"safari":if(!Vo||!e.shimSafari)return r("Safari shim is not included in this adapter release."),i;r("adapter.js shimming safari."),i.browserShim=Vo,Kt(t,n),Jt(t),Bo(t),jo(t),Uo(t),ko(t),Fo(t),$o(t),Mo(t),Ho(t),zt(t),Xr(t),Gt(t,n),Wt(t),Zr(t,n);break;default:r("Unsupported browser!");break}return i}const Go=_f({window:typeof window>"u"?void 0:window});class en{constructor(e){y(this,"peerConnection");y(this,"sessionListener",new Cf);y(this,"isCallOut",!1);y(this,"sessionType",T.UNKNOWN);y(this,"localStream");y(this,"remoteStream");y(this,"dataChannel");y(this,"hasSetRemoteSdp",!1);y(this,"facingMode",z.FRONT_FACING);y(this,"facingChanging",!1);y(this,"muted",!1);y(this,"openCamera",!1);y(this,"desktopSharing",!1);this.sessionType=e,console.debug(Go.browserDetails.browser+" "+Go.browserDetails.version)}setListener(e){this.sessionListener=e}start(e,r){if(!e&&!r){this.error(new Error("start failed, remoteSdp is null."));return}switch(this.isCallOut=e,this.hasSetRemoteSdp=!1,this.facingMode=z.FRONT_FACING,this.facingChanging=!1,this.muted=!1,this.desktopSharing=!1,this.peerConnection=new RTCPeerConnection({iceServers:[]}),this.peerConnection.onnegotiationneeded=()=>{switch(this.sessionType){case T.AUDIO_PUSH:case T.VIDEO_PUSH:case T.AUDIO_HALF:case T.VIDEO_HALF:this.createDataChannel()}e?(console.debug("webrtc call out"),this.peerConnection.createOffer().then(n=>{console.debug("webrtc createOffer success"),this.peerConnection.setLocalDescription(n).then(()=>{console.debug("webrtc setLocalDescription success")}).catch(i=>{this.error(i)})}).catch(n=>{this.error(n)})):(console.debug("webrtc call in: ",r),this.peerConnection.setRemoteDescription(new RTCSessionDescription({type:"offer",sdp:r})).then(()=>{console.debug("webrtc setRemoteDescription success"),this.peerConnection.createAnswer().then(n=>{console.debug("webrtc createAnswer success"),this.peerConnection.setLocalDescription(n).then(()=>{console.debug("webrtc setLocalDescription success")}).catch(i=>{this.error(i)})}).catch(n=>{this.error(n)})}).catch(n=>{this.error(n)}))},this.peerConnection.onicegatheringstatechange=()=>{var n;console.debug("webrtc onicegatheringstatechange",(n=this.peerConnection)==null?void 0:n.iceGatheringState),this.peerConnection&&this.peerConnection.iceGatheringState=="complete"&&this.peerConnection.localDescription&&this.sessionListener.onStartSuccess(this.peerConnection.localDescription)},this.peerConnection.ontrack=n=>{console.debug("webrtc ontrack");for(let i=0;i<n.streams.length;i++)this.remoteStream?n.streams[i].getTracks().forEach(o=>{var s;(s=this.remoteStream)==null||s.addTrack(o)}):this.remoteStream=new MediaStream(n.streams[i]);this.sessionListener.onAddRemoteStream(this.remoteStream)},this.peerConnection.oniceconnectionstatechange=n=>{var i,o,s,a,c;console.debug("oniceconnectionstatechange",(i=this.peerConnection)==null?void 0:i.iceConnectionState),(((o=this.peerConnection)==null?void 0:o.iceConnectionState)=="completed"||((s=this.peerConnection)==null?void 0:s.iceConnectionState)=="disconnected"||((a=this.peerConnection)==null?void 0:a.iceConnectionState)=="failed"||((c=this.peerConnection)==null?void 0:c.iceConnectionState)=="closed")&&(this.dataChannel=void 0,this.stop(),this.sessionListener.onError(new Error("session closed.")))},this.sessionType){case T.RTSP_PULL:this.addTransceivers(),this.createDataChannel();break;case T.AUDIO_PUSH:case T.VIDEO_PUSH:case T.AUDIO_HALF:case T.VIDEO_HALF:case T.VIDEO:case T.AUDIO:this.gotLocalMedia();break;default:this.error(new Error("session type unknown: "+this.sessionType));break}}setRemoteSdp(e){e&&e!==""&&this.peerConnection&&this.isCallOut&&!this.hasSetRemoteSdp&&(this.hasSetRemoteSdp=!0,this.peerConnection.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e})).then(()=>{console.debug("webrtc setRemoteDescription success")}).catch(r=>{this.error(r),this.hasSetRemoteSdp=!1}))}addRemoteCandidate(e){this.peerConnection&&e.forEach(r=>{this.peerConnection.addIceCandidate(r).then(()=>{console.debug("webrtc addIceCandidate success")}).catch(n=>console.log(n))})}sendStringData(e){try{this.dataChannel&&this.dataChannel.send(e)}catch(r){console.debug("sendStringData failed",r)}}stop(){var e;if(console.debug("webrtc stop"),(this.sessionType==T.VIDEO_PUSH||this.sessionType==T.AUDIO_PUSH||this.sessionType==T.RTSP_PULL)&&this.sendStringData("close"),(e=this.peerConnection)==null||e.close(),this.localStream)for(let r of this.localStream.getTracks())this.localStream.removeTrack(r),r.stop();this.desktopSharing&&(this.desktopSharing=!1,this.sessionListener.onStopDesktopShare()),this.peerConnection=void 0,this.dataChannel=void 0,this.localStream=void 0,this.remoteStream=void 0,this.isCallOut=!1,this.sessionType=T.UNKNOWN,this.hasSetRemoteSdp=!1,this.facingMode=z.FRONT_FACING,this.facingChanging=!1,this.muted=!1,this.openCamera=!1,this.desktopSharing=!1}changeFacing(){return new Promise((e,r)=>{if(this.sessionType!==T.VIDEO&&this.sessionType!==T.VIDEO_PUSH){r(new Error("not video call"));return}if(!this.localStream||this.localStream.getVideoTracks().length<=0){r(new Error("not in calling or not video call"));return}if(this.facingChanging){r(new Error("camera switching in progress"));return}this.changeCameraLocalMedia().then(()=>e(this.facingMode)).catch(n=>r(n))})}changeMuted(){return new Promise((e,r)=>{!this.localStream||this.localStream.getAudioTracks().length<=0?r(new Error("not in calling")):(this.localStream.getAudioTracks().forEach(n=>{n.enabled=!n.enabled,this.muted=!n.enabled}),e(this.muted))})}changeCameraOpened(){return new Promise((e,r)=>{!this.localStream||this.localStream.getVideoTracks().length<=0?r(new Error("not in video calling")):(this.localStream.getVideoTracks().forEach(n=>{n.enabled=!n.enabled,this.openCamera=!n.enabled}),e(this.openCamera))})}startDesktopShare(){return new Promise((e,r)=>{if(this.desktopSharing){r(new Error("desktop sharing has opened"));return}if(this.sessionType!=T.VIDEO&&this.sessionType!=T.VIDEO_PUSH){r(new Error("desktop sharing not in video calling"));return}if(!this.localStream){r(new Error("localStream undefined"));return}navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia?(this.desktopSharing=!0,navigator.mediaDevices.getDisplayMedia({audio:!1,video:!0}).then(n=>{let i=this.changeVideoTrack(n,()=>{this.stopDesktopShare(),this.sessionListener.onStopDesktopShare()});i?(this.desktopSharing=!1,r(i)):e()}).catch(n=>{this.desktopSharing=!1,r(n)})):r(new Error("error: browsers unsupported DesktopShare"))})}stopDesktopShare(){if(!(!this.peerConnection||!this.localStream)&&this.desktopSharing){for(let e of this.localStream.getVideoTracks())this.localStream.removeTrack(e),e.stop();navigator.mediaDevices.getUserMedia({audio:!1,video:{height:{exact:720},width:{exact:1280}}}).then(e=>{this.changeVideoTrack(e),this.desktopSharing=!1}).catch(e=>{this.desktopSharing=!1,console.debug("stopDesktopShare getUserMedia failed: ",e)})}}changeVideoTrack(e,r){if(!this.localStream||!this.peerConnection){for(let n of e.getTracks())e.removeTrack(n),n.stop();return new Error("localStream undefined or peerConnection undefined")}for(let n of this.localStream.getVideoTracks())this.localStream.removeTrack(n),n.stop();for(let n of e.getTracks())e.removeTrack(n),n.kind=="video"?(this.localStream.addTrack(n),r&&(n.onended=i=>{r()})):n.stop();for(let n of this.peerConnection.getSenders())n.track&&n.track.kind==="video"&&n.replaceTrack(this.localStream.getVideoTracks()[0]).then(()=>{}).catch(i=>{console.error(i)})}error(e){console.debug("webrtc error: ",e),this.stop(),this.sessionListener.onError(e)}addTransceivers(){this.peerConnection.addTransceiver("audio",{direction:"recvonly"}),this.peerConnection.addTransceiver("video",{direction:"recvonly"})}gotLocalMedia(){let e={audio:{echoCancellation:!0,noiseSuppression:!0}};switch(this.sessionType){case T.VIDEO:case T.VIDEO_PUSH:case T.VIDEO_HALF:e.video={height:{exact:720},width:{exact:1280},facingMode:z.FRONT_FACING};break}navigator.mediaDevices&&navigator.mediaDevices.getUserMedia?navigator.mediaDevices.getUserMedia(e).then(r=>{this.getMediaSuccess(r)}).catch(r=>{this.getMediaFailed(r)}):this.error(new Error("Browser does not support WebRTC"))}getMediaSuccess(e){console.debug("webrtc getMediaSuccess"),this.localStream=e,(this.sessionType===T.VIDEO||this.sessionType===T.VIDEO_PUSH||this.sessionType===T.VIDEO_HALF)&&this.sessionListener.onAddLocalStream(e),e.getTracks().forEach(r=>{switch(this.sessionType){case T.AUDIO_PUSH:case T.VIDEO_PUSH:this.peerConnection.addTransceiver(r,{direction:"sendonly",streams:[e]});break;default:this.peerConnection.addTrack(r,e)}}),this.muted=!1}getMediaFailed(e){if(console.debug("webrtc getMediaFailed failed"),this.sessionType===T.VIDEO){console.error("get video media failed. maybe not found camera.",e),this.sessionType=T.AUDIO,this.gotLocalMedia();return}else if(this.sessionType===T.VIDEO_PUSH){console.error("get video media failed. maybe not found camera.",e),this.sessionType=T.AUDIO_PUSH,this.gotLocalMedia();return}else if(this.sessionType===T.VIDEO_HALF){console.error("get video media failed. maybe not found camera.",e),this.sessionType=T.AUDIO_HALF,this.gotLocalMedia();return}this.error(e)}createDataChannel(){this.peerConnection&&(this.isCallOut?(this.dataChannel=this.peerConnection.createDataChannel("command_channel"),this.dataChannel.onmessage=e=>{this.onDataChannelReceive(e.data)}):this.peerConnection.ondatachannel=e=>{this.dataChannel=e.channel,this.dataChannel.onmessage=r=>{this.onDataChannelReceive(r.data)}})}onDataChannelReceive(e){if(e==="close"){console.debug("data channel receive from server: close"),this.dataChannel=void 0,this.stop();return}(this.sessionType==T.VIDEO_HALF||this.sessionType==T.AUDIO_HALF)&&this.sessionListener.onDataChannelMessage(e)}changeCameraLocalMedia(){return new Promise((e,r)=>{if(!this.localStream){r(new Error("local stream not found"));return}if(this.localStream.getVideoTracks().length==0){r(new Error("local stream not video track"));return}this.facingChanging=!0,this.localStream.getVideoTracks().forEach(o=>{this.localStream.removeTrack(o),o.stop()});let n,i=this.facingMode;if(this.facingMode===z.FRONT_FACING?(i=z.BACK_FACING,n={audio:{echoCancellation:!0,noiseSuppression:!0},video:{height:{exact:1280},width:{exact:720},facingMode:z.BACK_FACING}}):(i=z.FRONT_FACING,n={audio:{echoCancellation:!0,noiseSuppression:!0},video:{height:{exact:720},width:{exact:1280},facingMode:z.FRONT_FACING}}),navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)navigator.mediaDevices.getUserMedia(n).then(o=>{this.changeCameraSuccess(o,i),e()}).catch(o=>{console.error("change camera failed, use last camera: "+o,o),i=this.facingMode,this.facingMode===z.FRONT_FACING?(i=z.FRONT_FACING,n={audio:{echoCancellation:!0,noiseSuppression:!0},video:{height:{exact:720},width:{exact:1280},facingMode:z.FRONT_FACING}}):(i=z.BACK_FACING,n={audio:{echoCancellation:!0,noiseSuppression:!0},video:{height:{exact:1280},width:{exact:720},facingMode:z.BACK_FACING}}),navigator.mediaDevices.getUserMedia(n).then(s=>{this.changeCameraSuccess(s,i),e()}).catch(s=>{this.changeCameraFailed(s),r(s)})});else{let o=new Error("Browser does not support WebRTC");this.changeCameraFailed(o),r(new Error("Browser does not support WebRTC"))}})}changeCameraSuccess(e,r){if(!this.localStream){e.getTracks().forEach(n=>{n.stop()}),this.facingChanging=!1;return}e.getVideoTracks().forEach(n=>{this.localStream.addTrack(n)}),this.peerConnection.getSenders().forEach(n=>{n.track&&n.track.kind==="video"&&n.replaceTrack(e.getVideoTracks()[0]).then(()=>{}).catch(i=>{console.log(i)})}),this.facingMode=r,this.facingChanging=!1}changeCameraFailed(e){console.log(e),this.facingChanging=!1}}class Df{onAddRemoteStream(e){console.debug("onAddRemoteStream:",e)}onError(e){console.debug("onError:",e)}}class Wo{constructor(e,r){y(this,"url");y(this,"offerSdp");this.url=e,this.offerSdp=r}}const Lf="/media-server/video-play/webrtc";class xf{constructor(e,r){y(this,"rtspUrl");y(this,"webrtcSession",new en(T.RTSP_PULL));y(this,"sessionListener",new Df);y(this,"httpClient");this.rtspUrl=e,this.httpClient=r,this.webrtcSession.setListener(this)}setRtspPullSessionListener(e){this.sessionListener=e}start(){this.webrtcSession.start(!0)}stop(){this.webrtcSession.stop()}onAddLocalStream(e){}onAddRemoteStream(e){this.sessionListener.onAddRemoteStream(e)}onError(e){this.sessionListener.onError(e)}onStartSuccess(e){console.debug("rtsp offer:",e.sdp),this.httpClient.Post(Lf,new Wo(this.rtspUrl,e.sdp??"")).then(r=>{var n,i,o,s;if(r.code!=200){this.stop(),this.sessionListener.onError(new Error(r.message));return}console.debug("rtsp answer",(n=r.data)==null?void 0:n.sdp),console.debug("rtsp answer",(i=r.data)==null?void 0:i.candidateList),this.webrtcSession.setRemoteSdp(((o=r.data)==null?void 0:o.sdp)??""),this.webrtcSession.addRemoteCandidate(((s=r.data)==null?void 0:s.candidateList)??[])}).catch(r=>{this.stop(),this.sessionListener.onError(r)})}onDataChannelMessage(e){}onStopDesktopShare(){}}var D=(t=>(t[t.OFFLINE=-1]="OFFLINE",t[t.IDLE=0]="IDLE",t[t.TRY=1]="TRY",t[t.RING=2]="RING",t[t.TALK=3]="TALK",t))(D||{}),G=(t=>(t.VIDEO="video",t.AUDIO="audio",t))(G||{}),ue=(t=>(t.FULL="full-duplex",t.HALF="half-duplex",t))(ue||{}),Ge=(t=>(t.IN="in",t.OUT="out",t))(Ge||{}),X=(t=>(t.LOGIN="login",t.LOGOUT="logout",t.Invite="invite",t.RING="ring",t.ANSWER="answer",t.HANGUP="hangup",t.DTMF="dtmf",t))(X||{});let Ko,Jo=!0,tn="/decoder-assets/";function If(){return tn}function kf(t){t.endsWith("/")?tn=t+"/":tn=t}function Ff(t){Jo=t}function Uf(){return Jo}function Mf(){Ko="true"}function Nf(){return Ko}function Bf(){let t=!1;try{const e=RTCRtpSender.getCapabilities("video");e&&e.codecs.some(r=>r.mimeType.toLowerCase()==="video/h264")&&(t=!0)}catch(e){console.error("Error checking H.264 support:",e)}return t}function Qo(){try{return!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)}catch{return!1}}function $f(){return"browser-"+jf()+Hf(6)}function jf(){let t=new Date;return`${t.getFullYear()}${t.getMonth()}${t.getDate()}${t.getHours()}${t.getMinutes()}${t.getSeconds()}`}function Hf(t){let e="",r=["0","1","2","3","4","5","6","7","8","9","0","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];for(let n=0;n<t;n++)e+=r[Math.floor(Math.random()*(r.length-1))];return e}class Vf{constructor(e,r,n){y(this,"tel");y(this,"mediaType");y(this,"callMode");this.tel=e,this.callMode=n,this.mediaType=r}}class Xo{onAddLocalStream(e){console.debug("onAddLocalStream:",e)}onAddRemoteStream(e){console.debug("onAddRemoteStream:",e)}onAnswer(){console.debug("onAnswer")}onClose(e){console.debug("onClose:",e)}onError(e){console.debug("onError:",e)}onHangup(e){console.debug("onHangup:",e)}onNewCall(e){console.debug("onNewCall:",e)}onRing(){console.debug("onRing")}onInitResult(e){console.debug("onInitResult: ",e)}onStopDesktopShare(){console.debug("onStopDesktopShare")}}class Yo{constructor(e,r,n){y(this,"tel","");y(this,"status",D.OFFLINE);y(this,"mediaType",G.AUDIO);y(this,"callMode",ue.FULL);y(this,"callDirect",Ge.OUT);y(this,"called","");y(this,"callId");y(this,"remoteSdp");y(this,"candidate");y(this,"ringBackTone",new Audio("sound/ringbacktone.wav"));y(this,"ringtone",new Audio("sound/ringtone.wav"));y(this,"dtmfAudio",new Audio("sound/dtmf.wav"));y(this,"ws");y(this,"wsConnected",!1);y(this,"closeBySelf",!1);y(this,"webrtcSession");y(this,"sessionListener",new Xo);y(this,"wsUrl");y(this,"accountId");this.tel=r??"",this.wsUrl=e,this.accountId=n,this.ringBackTone.loop=!0,this.ringtone.loop=!0}setCallSessionListener(e){this.sessionListener=e}init(){this.websocketInit(this.wsUrl)}audioCall(e){this.makeCall(e)}videoCall(e){this.makeCall(e,G.VIDEO)}answer(){var r;if(this.status!=D.RING){console.debug("session is not ring state");return}if(this.callDirect!=Ge.IN){console.debug("session is call out, not allow answer");return}let e;this.callMode==ue.HALF?e=G.VIDEO==this.mediaType?T.VIDEO_HALF:T.AUDIO_HALF:e=G.VIDEO==this.mediaType?T.VIDEO:T.AUDIO,this.webrtcCreate(e),(r=this.webrtcSession)==null||r.start(!1,this.remoteSdp)}hangup(){this.status<=D.IDLE||(this.status==D.TALK?this.sendHangup(this.callId??""):this.callDirect==Ge.IN?this.sendHangup(this.callId??"",488):this.sendHangup(this.callId??"",801),this.close())}dtmf(e){return this.status!==D.TALK?!1:(this.sendDtmf(e),!0)}changeCamera(){return new Promise((e,r)=>{var n;this.webrtcSession||r(new Error("webrtc session not start")),(n=this.webrtcSession)==null||n.changeFacing().then(i=>e(i)).catch(i=>r(i))})}changeMuted(){return new Promise((e,r)=>{this.webrtcSession||r(new Error("webrtc session not start")),this.webrtcSession.changeMuted().then(n=>e(n)).catch(n=>r(n))})}changeCameraOpened(){return new Promise((e,r)=>{this.webrtcSession||r(new Error("webrtc session not start")),this.webrtcSession.changeCameraOpened().then(n=>e(n)).catch(n=>r(n))})}startDesktopShare(){return new Promise((e,r)=>{this.webrtcSession||r(new Error("webrtc session not start")),this.status!=D.TALK&&r(new Error(`session status[${this.status}] not talk`)),this.webrtcSession.startDesktopShare().then(()=>e()).catch(n=>r(n))})}stopDesktopShare(){this.webrtcSession&&this.status==D.TALK&&this.webrtcSession.stopDesktopShare()}destroy(){var e;this.closeBySelf=!0,this.hangup(),this.close(),(e=this.ws)==null||e.close()}makeCall(e,r=G.AUDIO,n=ue.FULL){var i;try{if(!Qo()){console.debug("Browser does not support WEBRTC"),this.sessionListener.onError(new Error("Browser does not support WEBRTC"));return}if(this.status==D.OFFLINE){console.debug("The initialization has not been completed yet. Please try again later"),this.sessionListener.onError(new Error("The initialization has not been completed yet. Please try again later"));return}this.status>D.IDLE&&(console.debug("Another call is currently in progress, hangup it"),this.hangup()),this.mediaType=r,this.callMode=n,this.called=e,this.callDirect=Ge.OUT,this.callId=$f();let o;this.callMode==ue.HALF?o=G.VIDEO==r?T.VIDEO_HALF:T.AUDIO_HALF:o=G.VIDEO==r?T.VIDEO:T.AUDIO,this.webrtcCreate(o),(i=this.webrtcSession)==null||i.start(!0),this.status=D.TRY}catch(o){this.status=D.IDLE,this.sessionListener.onError(new Error(""+o))}}close(){this.webrtcClose();try{this.ringtone.pause(),this.ringBackTone.pause()}catch(e){console.debug("FullSession.close: ",e)}this.status=D.IDLE}websocketInit(e){this.ws=new WebSocket(e),this.closeBySelf=!1,this.ws.onopen=()=>{console.debug("ws connect success"),this.wsConnected=!0,this.sendLogin()},this.ws.onclose=r=>{console.error("ws on close: ",r),this.wsConnected=!1,this.close(),this.status=D.OFFLINE,this.closeBySelf||this.sessionListener.onClose(new Error(r.reason)),this.ws=void 0},this.ws.onmessage=r=>{try{let n=JSON.parse(r.data);switch(console.debug("receive msg from server <<<<<<<<<<<<<<<",n),n.type){case X.Invite:this.inviteHandler(n);break;case X.ANSWER:this.answerHandler(n);break;case X.RING:this.ringHandler(n);break;case X.HANGUP:this.hangupHandler(n);break;case X.LOGIN:this.loginHandler(n);break}}catch(n){console.error("receive msg from server, but process error: ",n,r)}},this.ws.onerror=r=>{console.error("ws on error: ",r)}}sendTo(e){var r;try{this.wsConnected?(console.debug("send msg to server >>>>>>>>>>>>>>>>>> ",e),(r=this.ws)==null||r.send(JSON.stringify(e))):console.error("ws not connected.")}catch(n){console.debug("FullSession sendTo error: ",n)}}sendLogin(){this.sendTo({type:X.LOGIN,username:this.tel,allowEmpty:this.tel===""?Nf():void 0,userAgent:this.getUserAgent(),accountId:this.accountId})}sendLogout(){this.sendTo({type:X.LOGOUT,username:this.tel}),this.status=D.OFFLINE}sendInvite(e){this.sendTo({callId:this.callId,type:X.Invite,from:this.tel,to:this.called,callMode:this.callMode,mediaType:this.mediaType,sdp:e}),this.status=D.TRY}sendRing(){this.sendTo({type:X.RING,callId:this.callId,code:180}),this.status=D.RING}sendAnswer(e){this.sendTo({type:X.ANSWER,callId:this.callId,mediaType:this.mediaType,sdp:e}),this.status=D.TALK,this.ringtone.pause(),this.ringBackTone.pause()}sendDtmf(e){this.sendTo({type:X.DTMF,callId:this.callId,callInfo:"dtmf="+e}),this.dtmfAudio.play().then(()=>{}).catch(r=>console.debug(r))}sendHangup(e,r=800){this.sendTo({type:X.HANGUP,callId:e,code:r}),e==this.callId&&(this.status=D.IDLE,this.callId=void 0)}loginHandler(e){var r;if(e.code!=200){(r=this.ws)==null||r.close(),this.wsConnected=!1,this.ws=void 0,this.status=D.OFFLINE,this.sessionListener.onInitResult(!1);return}this.tel=e.username??"",this.status=D.IDLE,this.sessionListener.onInitResult(!0)}inviteHandler(e){if(!e.callId){console.debug("receive invite, but callId is null.");return}if(!Qo()){console.debug("receive invite, but unsupported webrtc."),this.sendHangup(e.callId,803);return}if(this.status>D.IDLE){e.callId!=this.callId?(console.debug("receive invite, but busy."),this.sendHangup(e.callId,486)):console.debug("receive re invite. not process");return}this.callId=e.callId,this.mediaType=e.mediaType??G.AUDIO,this.callMode=e.callMode??ue.FULL,this.called=e.from??"",this.callDirect=Ge.IN,this.remoteSdp=e.sdp,this.candidate=e.candidate,this.sendRing(),this.ringtone.currentTime=0,this.ringtone.play().then(()=>{}).catch(()=>{}),this.sessionListener.onNewCall(new Vf(this.called,this.mediaType,this.callMode))}ringHandler(e){var r,n;!e.callId||e.callId!=this.callId||(e.code==183?(this.ringBackTone.pause(),(r=this.webrtcSession)==null||r.setRemoteSdp(e.sdp??""),(n=this.webrtcSession)==null||n.addRemoteCandidate(e.candidate??[])):(this.ringBackTone.currentTime=0,this.ringBackTone.play().then(()=>{}).catch(()=>{})),this.sessionListener.onRing(),this.status=D.RING)}answerHandler(e){var r,n;!e.callId||e.callId!=this.callId||(this.ringBackTone.pause(),(r=this.webrtcSession)==null||r.setRemoteSdp(e.sdp??""),(n=this.webrtcSession)==null||n.addRemoteCandidate(e.candidate??[]),this.sessionListener.onAnswer(),this.status=D.TALK)}hangupHandler(e){!e.callId||e.callId!=this.callId||(this.close(),this.sessionListener.onHangup(e.code))}getUserAgent(){return Bf()?"windows":"phone"}webrtcCreate(e){this.webrtcClose(),this.webrtcSession=new en(e),this.webrtcSession.setListener(this)}webrtcClose(){var e;(e=this.webrtcSession)==null||e.stop(),this.webrtcSession=void 0}onAddLocalStream(e){this.sessionListener.onAddLocalStream(e)}onAddRemoteStream(e){this.sessionListener.onAddRemoteStream(e)}onError(e){this.status>D.IDLE&&this.hangup(),this.close(),this.sessionListener.onError(e)}onStartSuccess(e){var r;e.type=="answer"?(this.sendAnswer(e.sdp??""),(r=this.webrtcSession)==null||r.addRemoteCandidate(this.candidate??[])):e.type=="offer"&&this.sendInvite(e.sdp??"")}onDataChannelMessage(e){}onStopDesktopShare(){this.sessionListener.onStopDesktopShare()}}class qf{onError(e){console.debug("onError:",e)}onAddLocalStream(e){console.debug("onAddLocalStream:",e)}onStopDesktopShare(){console.debug("onStopDesktopShare")}}const zf="/media-server/broadcast/webrtc";class Gf{constructor(e,r,n){y(this,"tel");y(this,"mediaType");y(this,"webrtcSession");y(this,"sessionListener",new qf);y(this,"httpClient");this.tel=e,this.httpClient=r,this.mediaType=n===G.VIDEO?G.VIDEO:G.AUDIO,this.webrtcSession=new en(n==G.VIDEO?T.VIDEO_PUSH:T.AUDIO_PUSH),this.webrtcSession.setListener(this)}setBroadcastSessionListener(e){this.sessionListener=e}start(){this.webrtcSession.start(!0)}stop(){this.webrtcSession.stop()}startDesktopShare(){return new Promise((e,r)=>{this.webrtcSession||r(new Error("webrtc session not start")),this.webrtcSession.startDesktopShare().then(()=>e()).catch(n=>r(n))})}stopDesktopShare(){this.webrtcSession&&this.webrtcSession.stopDesktopShare()}onAddLocalStream(e){this.sessionListener.onAddLocalStream(e)}onAddRemoteStream(e){}onError(e){this.sessionListener.onError(e)}onStartSuccess(e){console.debug("offer:",e.sdp),this.httpClient.Post(zf,new Wo(this.tel,e.sdp??"")).then(r=>{var n,i,o;if(r.code!=200){this.stop(),this.sessionListener.onError(new Error(r.message));return}console.debug("answer",(n=r.data)==null?void 0:n.sdp),this.webrtcSession.setRemoteSdp(((i=r.data)==null?void 0:i.sdp)??""),this.webrtcSession.addRemoteCandidate(((o=r.data)==null?void 0:o.candidateList)??[])}).catch(r=>{this.stop(),this.sessionListener.onError(r)})}onDataChannelMessage(e){}onStopDesktopShare(){this.sessionListener.onStopDesktopShare()}}var rn=(t=>(t.TB_REQUEST="tb_request",t.TB_GRANTED="tb_granted",t.TB_TAKEN="tb_taken",t.TB_DENY="tb_deny",t.TB_RELEASE="tb_release",t.TB_IDLE="tb_idle",t.TB_REVOKE="tb_revoke",t))(rn||{});class Wf extends Xo{onTbcpMessage(e){console.debug("onTbcpMessage:",e)}}class Kf extends Yo{constructor(r,n,i){super(r,n,i);y(this,"sessionListener",new Wf)}setCallSessionListener(r){this.sessionListener=r}audioHalfCall(r){this.makeCall(r,G.AUDIO,ue.HALF)}videoHalfCall(r){this.makeCall(r,G.VIDEO,ue.HALF)}tbcpRequest(){var r;this.callMode==ue.HALF&&this.status==D.TALK&&((r=this.webrtcSession)==null||r.sendStringData(JSON.stringify({type:rn.TB_REQUEST})))}tbcpRelease(){var r;this.callMode==ue.HALF&&this.status==D.TALK&&((r=this.webrtcSession)==null||r.sendStringData(JSON.stringify({type:rn.TB_RELEASE})))}onDataChannelMessage(r){try{this.sessionListener.onTbcpMessage(JSON.parse(r))}catch(n){console.debug("onDataChannelMessage err: ",n,r)}}}function Jf(t){const e=t^85;let r=(e&15)<<4;const n=(e&112)>>4;return n===0?r+=8:n===1?r+=264:r=r+264<<n-1,e&128?r:-r}function Qf(t){const e=new Int16Array(t.length);for(let r=0;r<t.length;r++)e[r]=Jf(t[r]);return e}function Xf(t){const e=t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength);if(e.byteLength<12)throw new Error("RTP packet is shorter than its fixed header");if(e[0]>>>6!==2)throw new Error("Unsupported RTP version");const r=e[0]&15,n=(e[0]&16)!==0,i=(e[0]&32)!==0;let o=12+r*4;if(o>e.length)throw new Error("Truncated RTP CSRC list");if(n){if(o+4>e.length)throw new Error("Truncated RTP extension header");const a=e[o+2]<<8|e[o+3];if(o+=4+a*4,o>e.length)throw new Error("Truncated RTP extension data")}let s=e.length;if(i){const a=e[s-1];if(a===0||a>s-o)throw new Error("Invalid RTP padding");s-=a}if(o>=s)throw new Error("RTP packet has an empty payload");return{payloadType:e[1]&127,marker:(e[1]&128)!==0,sequenceNumber:e[2]<<8|e[3],timestamp:new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(4),ssrc:new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(8),payload:e.subarray(o,s)}}const Yf=new Uint8Array([0,0,0,1]),Zo=24,es=28;function ts(t){const e=new Uint8Array(t.reduce((n,i)=>n+i.length,0));let r=0;for(const n of t)e.set(n,r),r+=n.length;return e}class Zf{constructor(){y(this,"timestamp");y(this,"nals",[]);y(this,"fu");y(this,"fuType",0)}push(e){this.timestamp!==void 0&&e.timestamp!==this.timestamp&&this.reset(),this.timestamp=e.timestamp;try{this.consume(e.payload)}catch(o){throw this.reset(),o}if(!e.marker)return;if(this.fu||this.nals.length===0){this.reset();return}const r=this.nals,n=this.timestamp;this.nals=[],this.timestamp=void 0;const i=r.map(o=>o[0]&31);return{timestamp:n,data:ts(r.flatMap(o=>[Yf,o])),keyFrame:i.includes(5),nalTypes:i}}reset(){this.timestamp=void 0,this.nals=[],this.fu=void 0,this.fuType=0}consume(e){if(e.length<1)throw new Error("Empty H.264 RTP payload");const r=e[0]&31;if(r===Zo){this.consumeStapA(e);return}if(r===es){this.consumeFuA(e);return}if(r<1||r>23)throw new Error(`Unsupported H.264 RTP packet type ${r}`);if(this.fu)throw new Error("H.264 FU-A interrupted by a non-FU packet");this.nals.push(e.slice())}consumeStapA(e){if(this.fu)throw new Error("H.264 STAP-A interrupted an FU-A");let r=1;for(;r+2<=e.length;){const n=e[r]<<8|e[r+1];if(r+=2,n<1||r+n>e.length)throw new Error("Invalid H.264 STAP-A NAL length");const i=e.slice(r,r+n),o=i[0]&31;if(o===Zo||o===es||o===0)throw new Error("Invalid NAL in H.264 STAP-A");this.nals.push(i),r+=n}if(r!==e.length)throw new Error("Trailing bytes in H.264 STAP-A")}consumeFuA(e){if(e.length<3)throw new Error("Truncated H.264 FU-A");const r=e[1],n=(r&128)!==0,i=(r&64)!==0,o=r&31;if(n){if(this.fu)throw new Error("Nested H.264 FU-A start");this.fuType=o,this.fu=[new Uint8Array([e[0]&224|o]),e.slice(2)]}else{if(!this.fu||this.fuType!==o)throw new Error("H.264 FU-A continuation without matching start");this.fu.push(e.slice(2))}i&&this.fu&&(this.nals.push(ts(this.fu)),this.fu=void 0)}}const ed=new Uint8Array([0,0,0,1]),rs=48,ns=49;function Qt(t){if(t.length<2)throw new Error("Truncated HEVC NAL unit");return t[0]>>>1&63}function is(t){const e=t.reduce((i,o)=>i+o.byteLength,0),r=new Uint8Array(e);let n=0;for(const i of t)r.set(i,n),n+=i.byteLength;return r}class td{constructor(){y(this,"timestamp");y(this,"nals",[]);y(this,"fu");y(this,"fuHeader",0)}push(e){this.timestamp!==void 0&&e.timestamp!==this.timestamp&&this.reset(),this.timestamp=e.timestamp;try{this.consumePayload(e.payload)}catch(o){throw this.reset(),o}if(!e.marker)return;if(this.fu){this.reset();return}if(this.nals.length===0){this.reset();return}const r=this.nals,n=this.timestamp;this.nals=[],this.timestamp=void 0;const i=r.map(Qt);return{timestamp:n,data:is(r.flatMap(o=>[ed,o])),keyFrame:i.some(o=>o>=16&&o<=21),nalTypes:i}}reset(){this.timestamp=void 0,this.nals=[],this.fu=void 0,this.fuHeader=0}consumePayload(e){if(e.length<2)throw new Error("Truncated HEVC RTP payload");const r=Qt(e);if(r===rs){this.consumeAggregationPacket(e);return}if(r===ns){this.consumeFragmentationUnit(e);return}if(this.fu)throw new Error("HEVC FU interrupted by a non-FU packet");this.nals.push(e.slice())}consumeAggregationPacket(e){if(this.fu)throw new Error("HEVC AP interrupted an FU");let r=2;for(;r+2<=e.length;){const n=e[r]<<8|e[r+1];if(r+=2,n<2||r+n>e.length)throw new Error("Invalid HEVC AP NAL length");const i=e.slice(r,r+n);if(Qt(i)===rs||Qt(i)===ns)throw new Error("Nested HEVC packetization unit");this.nals.push(i),r+=n}if(r!==e.length)throw new Error("Trailing bytes in HEVC AP")}consumeFragmentationUnit(e){if(e.length<4)throw new Error("Truncated HEVC FU");const r=e[2],n=(r&128)!==0,i=(r&64)!==0,o=r&63;if(n){if(this.fu)throw new Error("Nested HEVC FU start");const s=new Uint8Array([e[0]&129|o<<1,e[1]]);this.fuHeader=o,this.fu=[s,e.slice(3)]}else{if(!this.fu||this.fuHeader!==o)throw new Error("HEVC FU continuation without matching start");this.fu.push(e.slice(3))}i&&this.fu&&(this.nals.push(is(this.fu)),this.fu=void 0)}}function rd(t,e="hev1"){if(t.length<4||(t[0]>>>1&63)!==33)return;const r=[];let n=0;for(const o of t.subarray(2)){if(n>=2&&o===3){n=0;continue}r.push(o),n=o===0?n+1:0}const i=new nd(Uint8Array.from(r));try{i.skip(4);const o=i.read(3);i.skip(1);const s=i.read(2),a=i.read(1)?"H":"L",c=i.read(5),l=id(i.read32()),u=Array.from({length:6},()=>i.read(8)),f=i.read(8),p=[],h=[];for(let O=0;O<o;O++)p.push(i.read(1)!==0),h.push(i.read(1)!==0);o>0&&i.skip((8-o)*2);for(let O=0;O<o;O++)p[O]&&i.skip(88),h[O]&&i.skip(8);const g=u.map(O=>O.toString(16).padStart(2,"0")).join("").replace(/(00)+$/i,"").toUpperCase(),v=[`${s?String.fromCharCode(64+s):""}${c}`,l.toString(10),`${a}${f}`,g];return`${e}.${v.join(".")}`}catch{return}}class nd{constructor(e){y(this,"offset",0);this.data=e}read(e){if(e<0||e>32||this.offset+e>this.data.length*8)throw new Error("Truncated HEVC SPS");let r=0;for(let n=0;n<e;n++)r=r*2+(this.data[this.offset>>>3]>>>7-(this.offset&7)&1),this.offset++;return r}read32(){return this.read(32)>>>0}skip(e){if(e<0||this.offset+e>this.data.length*8)throw new Error("Truncated HEVC SPS");this.offset+=e}}function id(t){let e=0;for(let r=0;r<32;r++)e=e*2+(t>>>r&1)>>>0;return e}const od="hev1.1.6.L120.B0",sd="avc1.42E01E";class ad{constructor(e){y(this,"options");y(this,"videoCodec");y(this,"videoPayloadType");y(this,"audioPayloadType");y(this,"audioClockRate");y(this,"audioChannels");y(this,"depacketizer");y(this,"parameterSets",new Map);y(this,"pendingUnits",[]);y(this,"audioNodes",new Set);y(this,"codecString");y(this,"codecStringPinned");y(this,"hardwareDecoder");y(this,"softwareWorker");y(this,"videoFrameWriter");y(this,"outputTrack");y(this,"audioContext");y(this,"audioDestination");y(this,"audioUnlockHandler");y(this,"outputStream");y(this,"outputError");y(this,"streamWaiters",[]);y(this,"mode");y(this,"closed",!1);y(this,"waitingForKeyFrame",!0);y(this,"initializationStarted",!1);y(this,"lastVideoSequence");y(this,"videoSsrc");y(this,"lastAudioSequence");y(this,"audioSsrc");y(this,"audioRtpBase");y(this,"audioTimeBase");y(this,"audioScheduledUntil",0);y(this,"videoTimestampBase");if(e.videoPayloadType<0||e.videoPayloadType>127)throw new Error("Invalid video RTP payload type");if(e.audioPayloadType!==void 0&&(e.audioPayloadType<0||e.audioPayloadType>127))throw new Error("Invalid audio RTP payload type");if(e.audioPayloadType===e.videoPayloadType)throw new Error("Audio and video payload types must be different");if(this.options=e,this.videoCodec=e.videoCodec,this.videoPayloadType=e.videoPayloadType,this.audioPayloadType=e.audioPayloadType,this.audioClockRate=e.audioClockRate??8e3,this.audioChannels=e.audioChannels??1,this.codecStringPinned=e.videoCodecString!==void 0,this.codecString=e.videoCodecString??(e.videoCodec==="h265"?od:sd),this.depacketizer=e.videoCodec==="h265"?new td:new Zf,this.audioChannels<1||this.audioChannels>2)throw new Error("G.711 A-law supports one or two configured channels");try{const r=globalThis;let n,i;if(typeof r.VideoTrackGenerator=="function"){const o=new r.VideoTrackGenerator;n=o.track,i=o.writable}else if(typeof r.MediaStreamTrackGenerator=="function"){const o=new r.MediaStreamTrackGenerator({kind:"video"});n=o,i=o.writable}else throw new Error("当前浏览器不支持 VideoTrackGenerator,无法在不使用 canvas 的情况下播放解码帧");this.outputTrack=n,this.outputStream=new MediaStream([n]),this.videoFrameWriter=i.getWriter()}catch(r){this.outputError=r instanceof Error?r:new Error(String(r)),this.report(this.outputError)}}get decoderMode(){return this.mode}pushRtpPacket(e){if(this.closed)throw new Error("Player is closed");let r;try{r=Xf(e)}catch(n){this.report(n);return}r.payloadType===this.videoPayloadType?this.pushVideoPacket(r):r.payloadType===this.audioPayloadType&&this.pushAudioPacket(r)}getMediaStream(){return this.closed?Promise.reject(new Error("Player is closed")):this.outputStream?Promise.resolve(this.outputStream):this.outputError?Promise.reject(this.outputError):new Promise((e,r)=>this.streamWaiters.push({resolve:e,reject:r}))}notifyPacketLoss(){var e,r;this.depacketizer.reset(),this.waitingForKeyFrame=!0,this.lastVideoSequence=void 0,(r=(e=this.options).onKeyFrameNeeded)==null||r.call(e)}close(){var e,r,n,i,o,s,a;if(!this.closed){this.closed=!0,(e=this.videoFrameWriter)==null||e.close().catch(()=>{}),this.videoFrameWriter=void 0,(r=this.outputTrack)==null||r.stop(),this.outputTrack=void 0,this.outputStream=void 0;for(const c of this.streamWaiters.splice(0))c.reject(new Error("Player is closed"));this.depacketizer.reset(),(n=this.hardwareDecoder)==null||n.close(),this.hardwareDecoder=void 0,(i=this.softwareWorker)==null||i.postMessage({type:"close"}),(o=this.softwareWorker)==null||o.terminate(),this.softwareWorker=void 0;for(const c of this.audioNodes)try{c.stop()}catch{}this.audioNodes.clear(),(s=this.audioContext)==null||s.close(),this.audioContext=void 0,(a=this.audioDestination)==null||a.stream.getTracks().forEach(c=>c.stop()),this.audioDestination=void 0,this.removeAudioUnlockListeners(),this.parameterSets.clear(),this.pendingUnits.length=0}}pushVideoPacket(e){var r,n,i,o,s,a;if(this.videoSsrc!==void 0&&e.ssrc!==this.videoSsrc?(this.notifyPacketLoss(),this.videoSsrc=e.ssrc):this.videoSsrc===void 0&&(this.videoSsrc=e.ssrc),this.lastVideoSequence!==void 0&&e.sequenceNumber!==(this.lastVideoSequence+1&65535)){const c=this.lastVideoSequence+1&65535,l=e.sequenceNumber-this.lastVideoSequence&65535,u=l>1&&l<32768?l-1:0;(n=(r=this.options).onVideoSequenceGap)==null||n.call(r,u,c,e.sequenceNumber),this.depacketizer.reset(),this.waitingForKeyFrame=!0,(o=(i=this.options).onKeyFrameNeeded)==null||o.call(i)}this.lastVideoSequence=e.sequenceNumber;try{const c=this.depacketizer.push(e);if(!c)return;if(this.rememberParameterSets(c),this.waitingForKeyFrame){if(!c.keyFrame||!this.hasParameterSets())return;this.waitingForKeyFrame=!1}this.initializationStarted||(this.initializationStarted=!0,this.initialize()),this.decode(c)}catch(c){this.waitingForKeyFrame=!0,(a=(s=this.options).onKeyFrameNeeded)==null||a.call(s),this.report(c)}}pushAudioPacket(e){if(e.payload.length){this.audioSsrc!==void 0&&e.ssrc!==this.audioSsrc&&this.resetAudioPlayout(),this.audioSsrc=e.ssrc,this.lastAudioSequence!==void 0&&e.sequenceNumber!==(this.lastAudioSequence+1&65535)&&this.resetAudioPlayout(),this.lastAudioSequence=e.sequenceNumber;try{this.ensureAudioOutput();const r=this.audioContext,n=this.audioDestination;if(r.state!=="running"){this.audioRtpBase=void 0,this.audioTimeBase=void 0,this.audioScheduledUntil=r.currentTime;return}const i=Qf(e.payload),o=Math.floor(i.length/this.audioChannels);if(o===0)return;const s=r.createBuffer(this.audioChannels,o,this.audioClockRate);for(let f=0;f<this.audioChannels;f++){const p=s.getChannelData(f);for(let h=0;h<o;h++)p[h]=i[h*this.audioChannels+f]/32768}const a=r.currentTime;(this.audioRtpBase===void 0||this.audioTimeBase===void 0)&&(this.audioRtpBase=e.timestamp,this.audioTimeBase=a+.06);let c=e.timestamp-this.audioRtpBase>>>0;c>2147483647&&(c-=4294967296);let l=this.audioTimeBase+c/this.audioClockRate;(l<a-.12||l>a+1)&&(this.audioRtpBase=e.timestamp,this.audioTimeBase=a+.06,l=this.audioTimeBase),l=Math.max(l,a+.01,this.audioScheduledUntil);const u=r.createBufferSource();u.buffer=s,u.connect(n),u.onended=()=>{u.disconnect(),this.audioNodes.delete(u)},u.start(l),this.audioNodes.add(u),this.audioScheduledUntil=l+s.duration}catch(r){this.report(r)}}}resetAudioPlayout(){this.audioRtpBase=void 0,this.audioTimeBase=void 0,this.audioScheduledUntil=0;for(const e of this.audioNodes)try{e.stop()}catch{}this.audioNodes.clear()}ensureAudioOutput(){if(this.audioContext??(this.audioContext=new AudioContext),!this.audioDestination){this.audioDestination=this.audioContext.createMediaStreamDestination();const e=this.audioDestination.stream.getAudioTracks()[0];e&&this.outputStream&&this.outputStream.addTrack(e)}this.installAudioUnlockListeners()}installAudioUnlockListeners(){this.audioUnlockHandler||!this.audioContext||this.audioContext.state==="running"||typeof window>"u"||(this.audioUnlockHandler=()=>{const e=this.audioContext;e&&e.resume().then(()=>{e.state==="running"&&(this.audioRtpBase=void 0,this.audioTimeBase=void 0,this.audioScheduledUntil=e.currentTime,this.removeAudioUnlockListeners())}).catch(r=>this.report(r))},window.addEventListener("pointerdown",this.audioUnlockHandler,!0),window.addEventListener("keydown",this.audioUnlockHandler,!0))}removeAudioUnlockListeners(){!this.audioUnlockHandler||typeof window>"u"||(window.removeEventListener("pointerdown",this.audioUnlockHandler,!0),window.removeEventListener("keydown",this.audioUnlockHandler,!0),this.audioUnlockHandler=void 0)}rememberParameterSets(e){const r=this.videoCodec==="h265"?[32,33,34]:[7,8],n=e.data;let i=0;for(;i+5<n.length;){let o=-1;for(let c=i;c+3<n.length;c++)if(n[c]===0&&n[c+1]===0&&n[c+2]===0&&n[c+3]===1){o=c;break}if(o<0)break;const s=o+4;let a=n.length;for(let c=s+2;c+3<n.length;c++)if(n[c]===0&&n[c+1]===0&&n[c+2]===0&&n[c+3]===1){a=c;break}if(s<a){const c=this.videoCodec==="h265"?n[s]>>>1&63:n[s]&31;if(r.includes(c)){const l=n.slice(s,a);this.parameterSets.set(c,l),this.videoCodec==="h265"&&c===33&&!this.codecStringPinned&&(this.codecString=rd(l)??this.codecString),this.videoCodec==="h264"&&c===7&&!this.codecStringPinned&&l.length>=4&&(this.codecString=`avc1.${[l[1],l[2],l[3]].map(u=>u.toString(16).padStart(2,"0")).join("").toUpperCase()}`)}}if(i=a,a===n.length)break}}hasParameterSets(){return(this.videoCodec==="h265"?[32,33,34]:[7,8]).every(r=>this.parameterSets.has(r))}async initialize(){try{if(typeof VideoDecoder<"u"){const e={codec:this.codecString,hardwareAcceleration:"prefer-hardware",optimizeForLatency:!0},r=await VideoDecoder.isConfigSupported(e);if(!this.closed&&r.supported){this.useWebCodecs(e);return}}if(this.videoCodec==="h265")await this.useSoftware();else throw new Error("This browser does not support H.264 WebCodecs decoding")}catch(e){if(this.videoCodec==="h265"){this.report(e);try{await this.useSoftware()}catch(r){this.report(r)}}else this.report(e)}}useWebCodecs(e){var n,i;const r=new VideoDecoder({output:o=>{this.renderWebCodecsFrame(o)},error:o=>{this.videoCodec==="h265"?this.fallbackToSoftware(o):this.report(o)}});r.configure(e),this.hardwareDecoder=r,this.mode="hardware",(i=(n=this.options).onDecoderChange)==null||i.call(n,"hardware"),this.flushPendingUnits()}async useSoftware(){if(this.closed||this.softwareWorker||this.videoCodec!=="h265")return;const e=this.options.decoderAssetsBaseUrl??new URL("./decoder-assets/",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:q&&q.tagName.toUpperCase()==="SCRIPT"&&q.src||new URL("mediaAV.umd.cjs",document.baseURI).href).href,r=new Worker(`${e}software-worker.js`,{type:"module"});this.softwareWorker=r,r.onmessage=n=>{var i,o,s,a;if(n.data.type==="ready")this.mode="software",(o=(i=this.options).onDecoderChange)==null||o.call(i,"software"),this.flushPendingUnits();else if(n.data.type==="frame"&&n.data.frame){const c=n.data.frame;if(this.closed){c.close();return}this.sendVideoFrame(c)}else n.data.type==="error"&&(this.waitingForKeyFrame=!0,(a=(s=this.options).onKeyFrameNeeded)==null||a.call(s),this.report(new Error(n.data.message??"Software decoder failed")))},r.onerror=n=>this.report(new Error(n.message||"Software decoder worker failed")),r.postMessage({type:"init",decoderJsUrl:`${e}libde265.mjs`,wasmUrl:`${e}libde265.wasm`})}async fallbackToSoftware(e){var r,n,i;if(!(this.closed||this.mode==="software"||this.videoCodec!=="h265")){(r=this.hardwareDecoder)==null||r.close(),this.hardwareDecoder=void 0,this.mode=void 0,this.waitingForKeyFrame=!0,this.pendingUnits.length=0,(i=(n=this.options).onKeyFrameNeeded)==null||i.call(n),this.report(new Error(`视频硬解码失败,切换软件解码:${e.message}`));try{await this.useSoftware()}catch(o){this.report(o)}}}decode(e){var n,i,o,s,a;const r=this.videoTimestampUs(e.timestamp);if(!this.mode){if(this.pendingUnits.length>=16){this.pendingUnits.length=0,this.waitingForKeyFrame=!0,(i=(n=this.options).onKeyFrameNeeded)==null||i.call(n);return}this.pendingUnits.push(e);return}if(this.mode==="hardware"&&((o=this.hardwareDecoder)==null?void 0:o.state)==="configured"){if(this.hardwareDecoder.decodeQueueSize>30){this.videoCodec==="h265"?this.fallbackToSoftware(new Error("硬解码队列积压")):(this.waitingForKeyFrame=!0,(a=(s=this.options).onKeyFrameNeeded)==null||a.call(s));return}try{this.hardwareDecoder.decode(new EncodedVideoChunk({type:e.keyFrame?"key":"delta",timestamp:r,data:e.data}));return}catch(c){this.videoCodec==="h265"?this.fallbackToSoftware(c instanceof Error?c:new Error(String(c))):this.report(c)}}if(!this.waitingForKeyFrame&&this.videoCodec==="h265"&&(this.mode==="software"||this.mode===void 0)&&this.softwareWorker){const c=e.data.slice();this.softwareWorker.postMessage({type:"decode",data:c.buffer,timestampUs:r},[c.buffer])}}async renderWebCodecsFrame(e){let r=!1;try{if(this.closed||this.mode!=="hardware"||this.closed)return;this.sendVideoFrame(e),r=!0}catch(n){this.report(n)}finally{r||e.close()}}sendVideoFrame(e){if(this.closed){e.close();return}const r=this.videoFrameWriter;if(!r){e.close();return}r.ready.then(()=>r.write(e)).then(()=>{var n,i;(i=(n=this.options).onFrameRendered)==null||i.call(n)}).catch(n=>{e.close(),this.report(n)})}flushPendingUnits(){const e=this.pendingUnits.splice(0);for(const r of e)this.decode(r)}videoTimestampUs(e){this.videoTimestampBase===void 0&&(this.videoTimestampBase=e);let r=e-this.videoTimestampBase>>>0;return r>2147483647&&(r-=4294967296),Math.max(0,Math.round(r*1e6/9e4))}report(e){var r,n;(n=(r=this.options).onError)==null||n.call(r,e instanceof Error?e:new Error(String(e)))}}function cd(t){let e;try{e=JSON.parse(t)}catch{throw new Error("Invalid stream description: expected a JSON object")}if(!ss(e))throw new Error("Invalid stream description: expected a JSON object");const r=os(e.video,"video"),n=r.media.trim().toLowerCase();if(n!=="h264"&&n!=="h265")throw new Error(`Unsupported video media "${r.media}"; expected h264 or h265`);const i={videoCodec:n,videoPayloadType:r.payloadType,videoChannel:r.channel};if(e.audio!==void 0&&e.audio!==null){const o=os(e.audio,"audio");if(o.media.trim().toLowerCase()!=="pcma")throw new Error(`Unsupported audio media "${o.media}"; expected pcma`);i.audioPayloadType=o.payloadType,i.audioChannel=o.channel}if(i.audioPayloadType===i.videoPayloadType)throw new Error("Audio and video payload types must be different");return i}function os(t,e){if(!ss(t))throw new Error(`Stream description is missing ${e} media`);if(typeof t.media!="string"||t.media.trim()==="")throw new Error(`Invalid ${e}.media`);if(!Number.isInteger(t.channel)||t.channel<0)throw new Error(`Invalid ${e}.channel`);if(!Number.isInteger(t.payloadType)||t.payloadType<0||t.payloadType>127)throw new Error(`Invalid ${e}.payloadType; expected an integer from 0 to 127`);return{media:t.media,channel:t.channel,payloadType:t.payloadType}}function ss(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}class ld{constructor(e){y(this,"listener");y(this,"socket");y(this,"player");y(this,"remoteStream");y(this,"messageQueue",Promise.resolve());y(this,"generation",0);this.options=e}setRtspPullSessionListener(e){this.listener=e,this.remoteStream&&e.onAddRemoteStream(this.remoteStream)}start(){var n,i;if(this.socket&&this.socket.readyState<WebSocket.CLOSING)return;const e=++this.generation;let r;try{const o=new URL(this.options.url);if(o.protocol!=="ws:"&&o.protocol!=="wss:")throw new Error("WebSocket URL must use ws:// or wss://");o.searchParams.set("stream",btoa(this.options.rtspUrl)),r=new WebSocket(o),r.binaryType="arraybuffer"}catch(o){this.report(o);return}this.socket=r,this.messageQueue=Promise.resolve(),(i=(n=this.options).onConnectionStateChange)==null||i.call(n,"connecting"),r.onopen=()=>{var o,s;this.isCurrent(r,e)&&((s=(o=this.options).onConnectionStateChange)==null||s.call(o,"connected"))},r.onmessage=({data:o})=>{this.messageQueue=this.messageQueue.then(async()=>{if(this.isCurrent(r,e))if(typeof o=="string")this.handleDescription(o,r,e);else if(o instanceof ArrayBuffer)this.handleRtpPacket(o);else if(o instanceof Blob)this.handleRtpPacket(await o.arrayBuffer());else throw new Error("Unsupported WebSocket message type")}).catch(s=>this.report(s))},r.onerror=()=>{this.isCurrent(r,e)&&this.report(new Error("WebSocket connection error"))},r.onclose=o=>{var s,a;this.isCurrent(r,e)&&(this.socket=void 0,this.disposePlayer(),(a=(s=this.options).onConnectionStateChange)==null||a.call(s,"disconnected"),o.wasClean||this.report(new Error(`WebSocket disconnected (${o.code})`)))}}stop(){var r,n;++this.generation;const e=this.socket;this.socket=void 0,e&&(e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null,e.readyState<WebSocket.CLOSING&&e.close(1e3,"client stopped")),this.disposePlayer(),(n=(r=this.options).onConnectionStateChange)==null||n.call(r,"disconnected")}handleDescription(e,r,n){var s,a;const i=cd(e);(a=(s=this.options).onStreamConfig)==null||a.call(s,i),this.disposePlayer();const o=new ad({videoPayloadType:i.videoPayloadType,videoCodec:i.videoCodec,audioPayloadType:i.audioPayloadType,audioClockRate:8e3,audioChannels:1,decoderAssetsBaseUrl:this.options.decoderAssetsBaseUrl,onDecoderChange:this.options.onDecoderChange,onKeyFrameNeeded:this.options.onKeyFrameNeeded,onVideoSequenceGap:this.options.onVideoSequenceGap,onFrameRendered:this.options.onFrameRendered,onError:c=>this.report(c)});this.player=o,o.getMediaStream().then(c=>{var l;if(!this.isCurrent(r,n)||this.player!==o){c.getTracks().forEach(u=>u.stop());return}this.remoteStream=c,(l=this.listener)==null||l.onAddRemoteStream(c)}).catch(c=>this.report(c))}handleRtpPacket(e){var r,n;if(!this.player){this.report(new Error("Received RTP before the private JSON stream description"));return}this.player.pushRtpPacket(e),(n=(r=this.options).onRtpPacket)==null||n.call(r,e.byteLength)}disposePlayer(){var e;(e=this.player)==null||e.close(),this.player=void 0,this.remoteStream=void 0}isCurrent(e,r){return this.socket===e&&this.generation===r}report(e){var r;(r=this.listener)==null||r.onError(e instanceof Error?e:new Error(String(e)))}}let nn=new io("/"),as="/media-server/ws/voip",cs="/media-server/ws/b-trun-c",ls="/media-server/ws/video-play",on=new URL((window.location.protocol=="https:"?"wss://":"ws://")+window.location.host+as),sn=new URL((window.location.protocol=="https:"?"wss://":"ws://")+window.location.host+cs),We=new URL((window.location.protocol=="https:"?"wss://":"ws://")+window.location.host+ls);function ud(t){let e=new URL(t);const r=e.protocol;if(r!="http:"&&r!="https:"&&r!="wss:"&&r!="ws:"){console.debug("moduleInit protocol error, init failed",r);return}e.protocol=="https:"?e.protocol="wss:":e.protocol=="http:"&&(e.protocol="ws:"),fs(e.toString()),e.protocol=="wss:"?e.protocol="https:":e.protocol=="ws:"&&(e.protocol="http:"),us(e.toString())}function us(t){const e=new URL(t).protocol;if(e!="http:"&&e!="https:"){console.debug("videoModuleInit protocol error, init failed",e);return}nn=new io(t),We=new URL(t),We.protocol=="https:"?We.protocol="wss:":We.protocol="ws:",We.pathname=ls}function fd(t){return Uf()?new xf(t,nn):new ld({url:We.toString(),rtspUrl:t,decoderAssetsBaseUrl:If()})}function dd(t,e){return new Gf(t,nn,e)}function fs(t){const e=new URL(t).protocol;if(e!="ws:"&&e!="wss:"){console.debug("voipModuleInit protocol error, init failed",e);return}on=new URL(t),on.pathname=as,sn=new URL(t),sn.pathname=cs}function pd(t){return new Yo(on.toString(),t)}function hd(t,e){return new Kf(sn.toString(),t,e)}k.createAppCallSession=hd,k.createBroadcastSession=dd,k.createCallSession=pd,k.createRtspPullSession=fd,k.moduleInit=ud,k.setAllowEmpty=Mf,k.setDecoderAssets=kf,k.setTranscode=Ff,k.videoModuleInit=us,k.voipModuleInit=fs,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})});