PageSourceSearch

https://bbvasegurosserviciosvida.com/assets/QuickBloxApp-C86PSY4Z.js

js bbvasegurosserviciosvida.com collected 2026-10-08 23:24:06 UTC 373,551 bytes, 88 lines download raw bytes

1import{c as Mn,j as se}from"./constants-GDyudX3t.js";import{av as Pi,j as qn,u as Nt,L as Mi}from"./Loading-BHGVJLob.js";import{I as ki,f as Ve,g as jr,r as ne,R as Hr}from"./components-Bc5E3RVO.js";import{T as Qr,U as Bi,V as Fn,W as qi,X as Fi}from"./ProfileSettingsMenu-DaDsrYdI.js";import{r as Ui}from"./index-CvHK6Ik1.js";import{r as ji}from"./download-url-BPps9Vrf.js";import{S as Hi}from"./SomethingWentWrongPage-DkSdVLSE.js";import{T as Qi}from"./Trash-BlnkvNwi.js";import"./context-CjJKLtB3.js";import"./UnauthorizedError-BcFCC5_3.js";import"./Button-DbtDf4mr.js";import"./Modal-qO3GT9CY.js";import"./typeform-BpYVhgDr.js";import"./toDate-qOSwr3PX.js";import"./iframe-BsOo2mJb.js";import"./useSanitizeContent-CDFxBEOV.js";import"./mapValues-BBMzutht.js";import"./InfoCircle-DYOqYoDc.js";import"./ErrorPage-BGys6pLO.js";var $t,Un;function Re(){if(Un)return $t;Un=1;var e={version:"2.23.1",buildNumber:"1179",creds:{appId:0,authKey:"",authSecret:"",accountKey:""},endpoints:{api:"api.quickblox.com",chat:"chat.quickblox.com",muc:"muc.chat.quickblox.com"},hash:"sha1",streamManagement:{enable:!1},chatProtocol:{bosh:"https://chat.quickblox.com:5281",websocket:"wss://chat.quickblox.com:5291",active:2},pingTimeout:1,pingDebug:!1,initBlockOnSettings:!1,initBlockDurationMs:3e3,pingLocalhostTimeInterval:5,chatReconnectionTimeInterval:3,chatPingMissLimit:3,webrtc:{answerTimeInterval:60,autoReject:!0,incomingLimit:1,dialingTimeInterval:5,disconnectTimeInterval:30,statsReportTimeInterval:!1,iceTransportPolicy:void 0,iceServers:[{urls:["turn:turn.quickblox.com","stun:turn.quickblox.com"],username:"quickblox",credential:"baccb97ba2d92d71e26eb9886da5f1e0"}]},urls:{account:"account_settings",session:"session",login:"login",users:"users",chat:"chat",blobs:"blobs",geodata:"geodata",pushtokens:"push_tokens",subscriptions:"subscriptions",events:"events",data:"data",addressbook:"address_book",addressbookReg
1istered:"address_book/registered_users",type:".json"},on:{sessionExpired:null},timeout:null,debug:{mode:0,file:null},addISOTime:!1,qbTokenExpirationDate:null,liveSessionInterval:120,callBackInterval:30};return e.set=function(i){typeof i.endpoints=="object"&&i.endpoints.chat&&(e.endpoints.muc="muc."+i.endpoints.chat,e.chatProtocol.bosh="https://"+i.endpoints.chat+":5281",e.chatProtocol.websocket="wss://"+i.endpoints.chat+":5291"),Object.keys(i).forEach(function(t){t!=="set"&&Object.prototype.hasOwnProperty.call(e,t)&&(typeof i[t]!="object"||i[t]===null?typeof i[t]<"u"&&(e[t]=i[t]):Object.keys(i[t]).forEach(function(r){Object.prototype.hasOwnProperty.call(e[t],r)&&typeof i[t][r]<"u"&&(e[t][r]=i[t][r])})),t==="iceServers"&&typeof i[t]<"u"&&(e.webrtc.iceServers=i[t]),t==="iceTransportPolicy"&&typeof i[t]<"u"&&(e.webrtc.iceTransportPolicy=i[t])})},e.updateSessionExpirationDate=function(i,t=!1){var r=1,a;if(t){var f=i.replaceAll("-","/");a=new Date(f),a.setMinutes(a.getMinutes()-r)}else a=new Date(i),a.setMinutes(a.getMinutes()-r),a.setMinutes(a.getMinutes()+e.liveSessionInterval);e.qbTokenExpirationDate=a},$t=e,$t}var Kt={exports:{}};const Gi=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Ht=ki(Gi);var jn;function Oe(){return jn||(jn=1,(function(e,i){var t=Re(),r="This function isn't supported outside of the browser (...yet)",a=typeof Ve=="object"&&(Ve.hasOwnProperty("android")||Ve.hasOwnProperty("NSObject")),f=typeof window>"u"&&!0&&!a,p=typeof window<"u";if(f)var d=Ht,v=Ht;var T={machine:Math.floor(Math.random()*16777216).toString(16),pid:Math.floor(Math.random()*32767).toString(16),increment:0},g={getEnv:function(){return{nativescript:a,browser:p,node:f}},_getOSInfoFromNodeJS:function(){return v.platform()},_getOSInfoFromBrowser:function(){return window.navigator.userAgent},_getOSInfoFromNativeScript:function(){return(Ve&&Ve.hasOwnProperty("android")?"Android":"iOS")+" - NativeScript"},getOS:function(){var c=this,u="An unknown OS",n=[{osName:"Windows",codeNames:["Windows","win32"]},{osName:"Linux",codeNames:["Linux","linux"]},{osName:"macOS",codeNames:["Mac OS","darwin"]}],s;if(c.getEnv().browser)s=c._getOSInfoFromBrowser();else if(c.getEnv().node)s=c._getOSInfoFromNodeJS();else if(c.getEnv().nativescript)return c._getOSInfoFromNativeScript();return n.forEach(function(S){S.codeNames.forEach(function(l){var m=s.indexOf(l);m!==-1&&(u=S.osName)})}),u},safeCallbackCall:function(){for(var c=arguments[0].toString(),u=c.split("(")[0].split(" ")[1],n=[],s,S=0;S<arguments.length;S++)n.push(arguments[S]);s=n.shift();try{s.apply(null,n)}catch(l){console.error(u===""?"Error: "+l:"Error in listener "+u+": "+l)}},randomNonce:function(){return Math.floor(Math.random()*1e4)},unixTime:function(){return Math.floor(Date.now()/1e3)},getUrl:function(c,u){var n=u?"/"+u:"";return"https://"+t.endpoints.api+"/"+c+n+t.urls.type},formatUrl:function(c,u){var n=u?"/"+u:"";return"https://"+t.endpoints.api+"/"+c+n},isArray:function(c){return Object.prototype.toString.call(c)==="[object Array]"},isObject:function(c){return Object.prototype.toString.call(c)==="[object Object]"},getBsonObjectId:function(){var c=this.unixTime().toString(16),u=(T.increment++).toString(16);return u>16777215&&(T.increment=0),"00000000".substr(0,8-c.length)+c+"000000".substr(0,6-T.machine.length)+T.machine+"0000".substr(0,4-T.pid.length)+T.pid+"000000".substr(0,6-u.length)+u},getCurrentTime:function(){return new Date().toTimeString().split(" ")[0]},injectISOTimes:function(c){if(c.created_at)typeof c.created_at=="number"&&(c.iso_created_at=new Date(c.created_at*1e3).toISOString()),typeof c.updated_at=="number"&&(c.iso_updated_at=new Date(c.updated_at*1e3).toISOString());else if(c.items)for(var u=0,n=c.items.length;u<n;++u)typeof c.items[u].created_at=="number"&&(c.items[u].iso_created_at=new Date(c.items[u].created_at*1e3).toISOString()),typeof c.items[u].updated_at=="number"&&(c.items[u].iso_updated_at=new Date(c.items[u].updated_at*1e3).toISOString());return c},QBLog:function(){var c=Array.prototype.slice.call(arguments);function u(A){var x="ping";try{if(A==null)return!1;if(typeof A=="string")return A.toLowerCase().indexOf(x)!==-1;if(typeof A=="number"||typeof A=="boolean")return!1;if(typeof A=="object"){if(typeof A.outerHTML=="string"){var M=A.outerHTML.replace(/\s+/g," ").toLowerCase();if(M.indexOf("urn:xmpp:sm:3")!==-1&&(/^<\s*r\b/.test(M)||/^<\s*a\b/.test(M)))return!0}for(var P=[A.textContent,A.innerHTML,A.outerHTML,A.nodeName,A.tagName,A.id],L=0;L<P.length;L++){var G=P[L];if(typeof G=="string"&&G.toLowerCase().indexOf(x)!==-1)return!0}}}catch{}return!1}let n=t&&t.pingDebug===!1,s=c.some(u),S=n&&s;if(this.loggers){for(var l=0;l<this.loggers.length;++l)S||this.loggers[l](arguments);return}var m;this.loggers=[];var y=function(){var A=function(x){console.log.apply(console,Array.prototype.slice.call(x))};return A},b=function(){var A=function(x){if(d){for(var M=[],P=0;P<x.length;P++)M.push(JSON.stringify(x[P]));M=M.join(" ");var L=`
2`+new Date+". "+M;d.appendFile(t.debug.file,L,function(G){if(G)return console.error("Error while writing log to file. Error: "+G)})}else throw r};return A};if(typeof t.debug=="object"){if(typeof t.debug.mode=="number")t.debug.mode==1?(m=y(),this.loggers.push(m)):t.debug.mode==2&&(m=b(),this.loggers.push(m));else if(typeof t.debug.mode=="object"){var R=this;t.debug.mode.forEach(function(A){A===1?(m=y(),R.loggers.push(m)):A===2&&(m=b(),R.loggers.push(m))})}}else typeof t.debug=="boolean"&&t.debug&&(m=y(),this.loggers.push(m));if(this.loggers)for(var I=0;I<this.loggers.length;++I)S||this.loggers[I](arguments)},isWebRTCAvailble:function(){var c=window.RTCPeerConnection,u=window.RTCIceCandidate,n=window.RTCSessionDescription,s=window.navigator.mediaDevices;return!!c&&!!u&&!!n&&!!s},getError:function(c,u,n){var s={code:c,status:"error",detail:u};switch(c){case 401:s.message="Unauthorized";break;case 403:s.message="Forbidden";break;case 408:s.message="Request Timeout";break;case 422:s.message="Unprocessable Entity";break;case 502:s.message="Bad Gateway";break;default:s.message="Unknown error";break}return this.QBLog("["+n+"]","Error:",u),s},MergeArrayOfObjects:function(c,u){var n=JSON.parse(JSON.stringify(c));e:for(var s=0;s<u.length;s++){for(var S=u[s],l=0;l<n.length;
2l++)if(S.user_id===n[l].user_id){n[l]=S;continue e}n.push(S)}return n},getTimeIntervalForCallBackMessage:function(){return(typeof t.callBackInterval>"u"?2:t.callBackInterval)*1e3}};e.exports=g})(Kt)),Kt.exports}var Lt={exports:{}},Hn;function Vi(){return Hn||(Hn=1,(function(e,i){var t=function(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof Ve<"u")return Ve;throw new Error("unable to locate global object")},r=t();e.exports=i=r.fetch,r.fetch&&(i.default=r.fetch.bind(r)),i.Headers=r.Headers,i.Request=r.Request,i.Response=r.Response})(Lt,Lt.exports)),Lt.exports}var Yt,Qn;function zi(){return Qn||(Qn=1,Yt=typeof self=="object"?self.FormData:window.FormData),Yt}var Zt,Gn;function Ji(){if(Gn)return Zt;Gn=1;var e=Re(),i=Oe(),t,r;i.getEnv().node?(t=Vi(),r=zi()):(t=fetch,r=FormData);function a(){this.qbInst={config:e,session:null},this.reqCount=0}return a.prototype={_fetchingSettings:!1,_queue:[],setSession:function(f){this.qbInst.session=f},getSession:function(){return this.qbInst.session},handleResponse:function(f,p,d,v){if(f){const T=f.message?JSON.stringify(f.message).toLowerCase():"";typeof e.on.sessionExpired=="function"&&f.code===401&&T.indexOf("session does not exist")>-1?e.on.sessionExpired(function(){d(f,p)},v):d(f,null)}else e.addISOTime&&(p=i.injectISOTimes(p)),d(null,p)},startLogger:function(f){var p;++this.reqCount,f.data&&f.data.file?(p=JSON.parse(JSON.stringify(f.data)),p.file="..."):i.getEnv().nativescript?p=JSON.stringify(f.data):p=f.data,i.QBLog("[Request]["+this.reqCount+"]",(f.type||"GET")+" "+f.url,p||"")},ajax:function(f,p){if(this._fetchingSettings){this._queue.push([f,p]);return}this.startLogger(f);var d=this,v=!f.type||f.type==="GET"||f.type==="HEAD",T=d.qbInst&&d.qbInst.session&&d.qbInst.session.token,g=f.url.indexOf("s3.amazonaws.com")===-1,
2c=f.contentType===!1,u=f.dataType||"json",n=f.url,s={},S,l;s.method=f.type||"GET",f.data&&(S=y(),v?n+="?"+S:s.body=S),c||(s.headers={"Content-Type":f.contentType||"application/x-www-form-urlencoded; charset=UTF-8"}),g&&(s.headers||(s.headers={}),s.headers["QB-OS"]=i.getOS(),s.headers["QB-SDK"]="JS "+e.version+" - Client",T&&(s.headers["QB-Token"]=T),f.url.indexOf(e.urls.account)>-1&&(s.headers["QB-Account-Key"]=e.creds.accountKey,this._fetchingSettings=!0)),f.headers&&Object.keys(f.headers).forEach(function(I){s.headers[I]=f.headers[I]}),e.timeout&&(s.timeout=e.timeout),t(n,s).then(function(I){if(l=I,s.method==="GET"||s.method==="POST"){var A=l.headers.get("qb-token-expirationdate"),x=!(A===null||typeof A>"u");A=x?A:new Date,d.qbInst.config.updateSessionExpirationDate(A,x),i.QBLog("[Request][ajax]","header has token:",x),i.QBLog("[Request][ajax]","updateSessionExpirationDate ... Set value: ",d.qbInst.config.qbTokenExpirationDate)}return u==="text"?I.text():I.json()},function(){return l={status:200}," "}).then(function(I){b(null,l,I)},function(I){b(I)}).catch(I=>{console.log("qbProxy fetch ... catch, error: ",I),b(I)});function m(I){return encodeURIComponent(I).replace(/[#$&+,/:;=?@\[\]]/g,function(A){return"%"+A.charCodeAt(0).toString(16)})}function y(){var I=f.data,A;return c?(A=new r,Object.keys(I).forEach(function(x){f.fileToCustomObject&&x==="file"?A.append(x,I[x].data,I[x].name):A.append(x,f.data[x])})):f.isNeedStringify?A=JSON.stringify(I):A=Object.keys(I).map(function(x){return i.isObject(I[x])?Object.keys(I[x]).map(function(M){return m(x)+"["+(i.isArray(I[x])?"":M)+"]="+m(I[x][M])}).sort().join("&"):m(x)+(i.isArray(I[x])?"[]":"")+"="+m(I[x])}).sort().join("&"),A}function b(I,A,x){var M=A&&(A.status||A.statusCode),P,L;if(I||M!==200&&M!==201&&M!==202){var G;try{G={code:A&&M||I&&I.code,status:A&&A.headers&&A.headers.status||"error",message:x||I&&I.errno,detail:x&&x.errors||I&&I.syscall}}catch{G=I}L=x||I||x.errors,P=i.getEnv().nativescript?JSON.stringify(L):L,i.QBLog("[Response]["+d.reqCount+"]","error",M,P),d.handleResponse(G,null,p,R)}else L=x&&x!==" "?x:"empty body",P=i.getEnv().nativescript?JSON.stringify(L):L,i.QBLog("[Response]["+d.reqCount+"]",P),d.handleResponse(null,x,p,R);if(d._fetchingSettings){d._fetchingSettings=!1;var $="api.quickblox.com",Q="chat.quickblox.com";$=$.replace(/^https?:\/\//i,"").replace(/\/+$/,""),Q=Q.replace(/^https?:\/\//i,"").replace(/\/+$/,"");for(var W=new RegExp("^https?://"+$.replace(/\./g,"\\.")+"(?=[:/]|$)","i"),w=new RegExp("^https?://"+Q.replace(/\./g,"\\.")+"(?=[:/]|$)","i"),B=(d.qbInst.config.endpoints.api||"").replace(/^https?:\/\//i,"").replace(/\/+$/,""),U=(d.qbInst.config.endpoints.chat||"").replace(/^https?:\/\//i,"").replace(/\/+$/,""),F="https://"+B,V="https://"+U;d._queue.length;){var H=d._queue.shift(),z=H&&H[0];if(z&&typeof z.url=="string"){var re=z.url,Y=!1;W.test(re)&&(re=re.replace(W,F),Y=!0),w.test(re)&&(re=re.replace(w,V),Y=!0),Y&&(z.url=re)}d.ajax.apply(d,H)}}}function R(I){I&&(d.setSession(I),d.ajax(f,p))}}},Zt=a,Zt}var wt={exports:{}};function Wi(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Pt={exports:{}},Xi=Pt.exports,Vn;function It(){return Vn||(Vn=1,(function(e,i){(function(t,r){e.exports=r()})(Xi,function(){var t=t||(function(r,a){var f;if(typeof window<"u"&&window.crypto&&(f=window.crypto),typeof self<"u"&&self.crypto&&(f=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(f=globalThis.crypto),!f&&typeof window<"u"&&window.msCrypto&&(f=window.msCrypto),!f&&typeof Ve<"u"&&Ve.crypto&&(f=Ve.crypto),!f&&typeof Wi=="function")try{f=Pi}catch{}var p=function(){if(f){if(typeof f.getRandomValues=="function")try{return f.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof f.randomBytes=="function")try{return f.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},d=Object.create||(function(){function y(){}return function(b){var R;return y.prototype=b,R=new y,y.prototype=null,R}})(),v={},T=v.lib={},g=T.Base=(function(){return{extend:function(y){var b=d(this);
vendor: 6,228 bytes, line 2
2return y&&b.mixIn(y),(!b.hasOwnProperty("init")||this.init===b.init)&&(b.init=function(){b.$super.init.apply(this,arguments)}),b.init.prototype=b,b.$super=this,b},create:function(){var y=this.extend();return y.init.apply(y,arguments),y},init:function(){},mixIn:function(y){for(var b in y)y.hasOwnProperty(b)&&(this[b]=y[b]);y.hasOwnProperty("toString")&&(this.toString=y.toString)},clone:function(){return this.init.prototype.extend(this)}}})(),c=T.WordArray=g.extend({init:function(y,b){y=this.words=y||[],b!=a?this.sigBytes=b:this.sigBytes=y.length*4},toString:function(y){return(y||n).stringify(this)},concat:function(y){var b=this.words,R=y.words,I=this.sigBytes,A=y.sigBytes;if(this.clamp(),I%4)for(var x=0;x<A;x++){var M=R[x>>>2]>>>24-x%4*8&255;b[I+x>>>2]|=M<<24-(I+x)%4*8}else for(var P=0;P<A;P+=4)b[I+P>>>2]=R[P>>>2];return this.sigBytes+=A,this},clamp:function(){var y=this.words,b=this.sigBytes;y[b>>>2]&=4294967295<<32-b%4*8,y.length=r.ceil(b/4)},clone:function(){var y=g.clone.call(this);return y.words=this.words.slice(0),y},random:function(y){for(var b=[],R=0;R<y;R+=4)b.push(p());return new c.init(b,y)}}),u=v.enc={},n=u.Hex={stringify:function(y){for(var b=y.words,R=y.sigBytes,I=[],A=0;A<R;A++){var x=b[A>>>2]>>>24-A%4*8&255;I.push((x>>>4).toString(16)),I.push((x&15).toString(16))}return I.join("")},parse:function(y){for(var b=y.length,R=[],I=0;I<b;I+=2)R[I>>>3]|=parseInt(y.substr(I,2),16)<<24-I%8*4;return new c.init(R,b/2)}},s=u.Latin1={stringify:function(y){for(var b=y.words,R=y.sigBytes,I=[],A=0;A<R;A++){var x=b[A>>>2]>>>24-A%4*8&255;I.push(String.fromCharCode(x))}return I.join("")},parse:function(y){for(var b=y.length,R=[],I=0;I<b;I++)R[I>>>2]|=(y.charCodeAt(I)&255)<<24-I%4*8;return new c.init(R,b)}},S=u.Utf8={stringify:function(y){try{return decodeURIComponent(escape(s.stringify(y)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(y){return s.parse(unescape(encodeURIComponent(y)))}},l=T.BufferedBlockAlgorithm=g.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(y){typeof y=="string"&&(y=S.parse(y)),this._data.concat(y),this._nDataBytes+=y.sigBytes},_process:function(y){var b,R=this._data,I=R.words,A=R.sigBytes,x=this.blockSize,M=x*4,P=A/M;y?P=r.ceil(P):P=r.max((P|0)-this._minBufferSize,0);var L=P*x,G=r.min(L*4,A);if(L){for(var $=0;$<L;$+=x)this._doProcessBlock(I,$);b=I.splice(0,L),R.sigBytes-=G}return new c.init(b,G)},clone:function(){var y=g.clone.call(this);return y._data=this._data.clone(),y},_minBufferSize:0});T.Hasher=l.extend({cfg:g.extend(),init:function(y){this.cfg=this.cfg.extend(y),this.reset()},reset:function(){l.reset.call(this),this._doReset()},update:function(y){return this._append(y),this._process(),this},finalize:function(y){y&&this._append(y);var b=this._doFinalize();return b},blockSize:16,_createHelper:function(y){return function(b,R){return new y.init(R).finalize(b)}},_createHmacHelper:function(y){return function(b,R){return new m.HMAC.init(y,R).finalize(b)}}});var m=v.algo={};return v})(Math);return t})})(Pt)),Pt.exports}var Mt={exports:{}},$i=Mt.exports,zn;function Ki(){return zn||(zn=1,(function(e,i){(function(t,r){e.exports=r(It())})($i,function(t){return(function(){var r=t,a=r.lib,f=a.WordArray,p=a.Hasher,d=r.algo,v=[],T=d.SHA1=p.extend({_doReset:function(){this._hash=new f.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(g,c){for(var u=this._hash.words,n=u[0],s=u[1],S=u[2],l=u[3],m=u[4],y=0;y<80;y++){if(y<16)v[y]=g[c+y]|0;else{var b=v[y-3]^v[y-8]^v[y-14]^v[y-16];v[y]=b<<1|b>>>31}var R=(n<<5|n>>>27)+m+v[y];y<20?R+=(s&S|~s&l)+1518500249:y<40?R+=(s^S^l)+1859775393:y<60?R+=(s&S|s&l|S&l)-1894007588:R+=(s^S^l)-899497514,m=l,l=S,S=s<<30|s>>>2,s=n,n=R}u[0]=u[0]+n|0,u[1]=u[1]+s|0,u[2]=u[2]+S|0,u[3]=u[3]+l|0,u[4]=u[4]+m|0},_doFinalize:function(){var g=this._data,c=g.words,u=this._nDataBytes*8,n=g.sigBytes*8;return c[n>>>5]|=128<<24-n%32,c[(n+64>>>9<<4)+14]=Math.floor(u/4294967296),c[(n+64>>>9<<4)+15]=u,g.sigBytes=c.length*4,this._process(),this._hash},clone:function(){var g=p.clone.call(this);return g._hash=this._hash.clone(),g}});r.SHA1=p._createHelper(T),r.HmacSHA1=p._createHmacHelper(T)})(),t.SHA1})})(Mt)),Mt.exports}var kt={exports:{}},Yi=kt.exports,Jn;function Gr(){return Jn||(Jn=1,(function(e,i){(function(t,r){e.exports=r(It())})(Yi,function(t){(function(){var r=t,a=r.lib,f=a.Base,p=r.enc,d=p.Utf8,v=r.algo;v.HMAC=f.extend({init:function(T,g){T=this._hasher=new T.init,typeof g=="string"&&(g=d.parse(g));var c=T.blockSize,u=c*4;g.sigBytes>u&&(g=T.finalize(g)),g.clamp();for(var n=this._oKey=g.clone(),s=this._iKey=g.clone(),S=n.words,l=s.words,m=0;m<c;m++)S[m]^=1549556828,l[m]^=909522486;n.sigBytes=s.sigBytes=u,this.reset()},reset:function(){var T=this._hasher;T.reset(),T.update(this._iKey)},update:function(T){return this._hasher.update(T),this},finalize:function(T){var g=this._hasher,c=g.finalize(T);g.reset();var u=g.finalize(this._oKey.clone().concat(c));return u}})})()})})(kt)),kt.exports}var Zi=wt.exports,Wn;function es(){return Wn||(Wn=1,(function(e,i){(function(t,r,a){e.exports=r(It(),Ki(),Gr())})(Zi,function(t){return t.HmacSHA1})})(wt)),wt.exports}var Bt={exports:{}},qt={exports:{}},ts=qt.exports,Xn;function ns(){return Xn||(Xn=1,(function(e,i){(function(t,r){e.exports=r(It())})(ts,function(t){return(function(r){var a=t,f=a.lib,p=f.WordArray,d=f.Hasher,v=a.algo,T=[],g=[];(function(){function n(m){for(var y=r.sqrt(m),b=2;b<=y;b++)if(!(m%b))return!1;return!0}function s(m){return(m-(m|0))*4294967296|0}for(var S=2,l=0;l<64;)n(S)&&(l<8&&(T[l]=s(r.pow(S,1/2))),g[l]=s(r.pow(S,1/3)),l++),S++})();var c=[],u=v.SHA256=d.extend({_doReset:function(){this._hash=new p.init(T.slice(0))},_doProcessBlock:function(n,s){for(var S=this._hash.words,l=S[0],m=S[1],y=S[2],b=S[3],R=S[4],I=S[5],A=S[6],x=S[7],M=0;M<64;M++){if(M<16)c[M]=n[s+M]|0;else{var P=c[M-15],L=(P<<25|P>>>7)^(P<<14|P>>>18)^P>>>3,G=c[M-2],$=(G<<15|G>>>17)^(G<<13|G>>>19)^G>>>10;c[M]=L+c[M-7]+$+c[M-16]}var Q=R&I^~R&A,W=l&m^l&y^m&y,w=(l<<30|l>>>2)^(l<<19|l>>>13)^(l<<10|l>>>22),B=(R<<26|R>>>6)^(R<<21|R>>>11)^(R<<7|R>>>25),U=x+B+Q+g[M]+c[M],F=w+W;x=A,A=I,I=R,R=b+U|0,b=y,y=m,m=l,l=U+F|0}S[0]=S[0]+l|0,S[1]=S[1]+m|0,S[2]=S[2]+y|0,S[3]=S[3]+b|0,S[4]=S[4]+R|0,S[5]=S[5
2]+I|0,S[6]=S[6]+A|0,S[7]=S[7]+x|0},_doFinalize:function(){var n=this._data,s=n.words,S=this._nDataBytes*8,l=n.sigBytes*8;return s[l>>>5]|=128<<24-l%32,s[(l+64>>>9<<4)+14]=r.floor(S/4294967296),s[(l+64>>>9<<4)+15]=S,n.sigBytes=s.length*4,this._process(),this._hash},clone:function(){var n=d.clone.call(this);return n._hash=this._hash.clone(),n}});a.SHA256=d._createHelper(u),a.HmacSHA256=d._createHmacHelper(u)})(Math),t.SHA256})})(qt)),qt.exports}var rs=Bt.exports,$n;function is(){return $n||($n=1,(function(e,i){(function(t,r,a){e.exports=r(It(),ns(),Gr())})(rs,function(t){return t.HmacSHA256})})(Bt)),Bt.exports}var en,Kn;function ss(){if(Kn)return en;Kn=1;var e=Re(),i=Oe(),t=es(),r=is();function a(d){this.service=d}a.prototype={getSession:function(d){this.service.ajax({url:i.getUrl(e.urls.session)},function(v,T){v?d(v,null):d(v,T)})},createSession:function(d,v){if(e.creds.appId===""||e.creds.authKey===""||e.creds.authSecret==="")throw new Error("Cannot create a new session without app credentials (app ID, auth key and auth secret)");var T=this,g;typeof d=="function"&&typeof v>"u"&&(v=d,d={}),g=f(d),g.signature=p(g,e.creds.authSecret),this.service.ajax({url:i.getUrl(e.urls.session),type:"POST",data:g},function(c,u){c?v(c,null):(T.service.setSession(u.session),v(null,u.session))})},destroySession:function(d){var v=this;this.service.ajax({url:i.getUrl(e.urls.session),type:"DELETE",dataType:"text"},function(T,g){T?d(T,null):(v.service.setSession(null),d(null,g))})},login:function(d,v){var T={type:"POST",url:i.getUrl(e.urls.login),data:d};function g(c,u){c?v(c,null):v(null,u.user)}this.service.ajax(T,g)},logout:function(d){this.service.ajax({url:i.getUrl(e.urls.login),type:"DELETE",dataType:"text"},d)}},en=a;function f(d){var v={application_id:e.creds.appId,auth_key:e.creds.authKey,nonce:i.randomNonce(),timestamp:i.unixTime()};return d.login&&d.password?v.user={login:d.login,password:d.password}:d.email&&d.password?v.user={email:d.email,password:d.password}:d.provider&&(v.provider=d.provider,d.scope&&(v.scope=d.scope),d.keys&&d.keys.token&&(v.keys={token:d.keys.token}),d.keys&&d.keys.secret&&(v.keys.secret=d.keys.secret)),v}function p(d,v){var T=Object.keys(d).map(function(c){return typeof d[c]=="object"?Object.keys(d[c]).map(function(u){return c+"["+u+"]="+d[c][u]}).sort().join("&"):c+"="+d[c]}).sort().join("&"),g;if(e.hash==="sha1")g=t(T,v).toString();else if(e.hash==="sha256")g=r(T,v).toString();else throw new Error("Quickblox SDK: unknown crypto standards, available sha1 or sha256");return g}return en}var tn,Yn;function os(){if(Yn)return tn;Yn=1;var e=Re(),i=Oe(),t=["created_at","updated_at","last_request_at"],r=["id","external_user_id"],a=e.urls.users+"/password/reset";function f(v){this.service=v}f.prototype={listUsers:function(v,T){var g={},c=[],u;typeof v=="function"&&typeof T>"u"&&(T=v,v={}),v&&v.filter&&(i.isArray(v.filter)?v.filter.forEach(function(n){u=p(n),c.push(u)}):(u=p(v.filter),c.push(u)),g.filter=c),v.order&&(g.order=d(v.order)),v.page&&(g.page=v.page),v.per_page&&(g.per_page=v.per_page),this.service.ajax({url:i.getUrl(e.urls.users),data:g},T)},get:function(v,T){var g;typeof v=="number"?(g=v,v={}):v.login?g="by_login":v.full_name?g="by_full_name":v.facebook_id?g="by_facebook_id":v.twitter_id?g="by_twitter_id":v.phone?g="phone":v.email?g="by_email":v.tags?g="by_tags":v.external&&(g="external/"+v.external,v={}),this.service.ajax({url:i.getUrl(e.urls.users,g),data:v},function(c,u){c?T(c,null):T(null,u.user||u)})},create:function(v,T){this.service.ajax({url:i.getUrl(e.urls.users),type:"POST",data:{user:v}},function(g,c){g?T(g,null):T(null,c.user)})},update:function(v,T,g){this.service.ajax({url:i.getUrl(e.urls.users,v),type:"PUT",data:{user:T}},function(c,u){c?g(c,null):g(null,u.user)})},delete:function(v,T){var g;typeof v=="number"?g=v:v.external&&(g="external/"+v.external),this.service.ajax({url:i.getUrl(e.urls.users,g),type:"DELETE",dataType:"text"},T)},resetPassword:function(v,T){this.service.ajax({url:i.getUrl(a),data:{email:v},dataType:"text"},T)}},tn=f;function p(v){var T=v.field in t?"date":typeof v.value;return i.isArray(v.value)&&(T==="object"&&(T=typeof v.value[0]),v.value=v.value.toString()),[T,v.field,v.param,v.value].join(" ")}function d(v){var T=v.field in t?"date":v.field in r?"number":"string";return[v.sort,T,v.field].join(" ")}return tn}var nn,Zn;function as(){if(Zn)return nn;Zn=1;var e=Re(),i=Oe();function t(a){this.service=a}t.prototype={list:function(a,f){typeof a=="function"&&typeof f>"u"&&(f=a,a=null),this.service.ajax({url:i.getUrl(e.urls.blobs),data:a,type:"GET"},function(p,d){p?f(p,null):f(p,d)})},create:function(a,f){this.service.ajax({type:"POST",data:{blob:a},url:i.getUrl(e.urls.blobs)},function(p,d){p?f(p,null):f(p,d.blob)})},delete:function(a,f){this.service.ajax({url:i.getUrl(e.urls.blobs,a),type:"DELETE",dataType:"text"},function(p,d){p?f(p,null):f(null,!0)})},createAndUpload:function(a,f){var p=this,d={},v,T,g,c,u,n=JSON.parse(JSON.stringify(a));n.file.data="...",v=a.file,T=a.name||v.name,g=a.type||v.type,c=a.size||v.size,d.name=T,d.content_type=g,a.public&&(d.public=a.public),a.tag_list&&(d.tag_list=a.tag_list),this.create(d,function(s,S){if(s)f(s,null);else{var l=r(S.blob_object_access.params),m=l.protocol+"://"+l.authority+l.path,y={url:m},b={};
2u=S.id,S.size=c,Object.keys(l.queryKey).forEach(function(R){b[R]=decodeURIComponent(l.queryKey[R])}),b.file=v,b.name=T,y.data=b,p.upload(y,function(R,I){R?f(R,null):p.markUploaded({id:u,size:c},function(A,x){A?f(A,null):f(null,S)})})}})},upload:function(a,f){var p=Object.assign({},a.data),d={data:a.data.file,name:a.data.name||a.data.file.name};p.file=d;var v={type:"POST",dataType:"text",contentType:!1,url:a.url,data:p,fileToCustomObject:!0};this.service.ajax(v,function(T,g){T?f(T,null):f(null,{})})},markUploaded:function(a,f){this.service.ajax({url:i.getUrl(e.urls.blobs,a.id+"/complete"),type:"PUT",data:{size:a.size},dataType:"text"},function(p,d){p?f(p,null):f(null,d)})},getInfo:function(a,f){this.service.ajax({url:i.getUrl(e.urls.blobs,a)},function(p,d){p?f(p,null):f(null,d)})},getFile:function(a,f){this.service.ajax({url:i.getUrl(e.urls.blobs,a)},function(p,d){p?f(p,null):f(null,d)})},update:function(a,f){var p={};p.blob={},typeof a.name<"u"&&(p.blob.name=a.name),this.service.ajax({url:i.getUrl(e.urls.blobs,a.id),data:p},function(d,v){d?f(d,null):f(null,v)})},privateUrl:function(a){return"https://"+e.endpoints.api+"/blobs/"+a+"?token="+this.service.getSession().token},publicUrl:function(a){return"https://"+e.endpoints.api+"/blobs/"+a}},nn=t;function r(a){for(var f=r.options,p=f.parser[f.strictMode?"strict":"loose"].exec(a),d={},v=14;v--;)d[f.key[v]]=p[v]||"";return d[f.q.name]={},d[f.key[12]].replace(f.q.parser,function(T,g,c){g&&(d[f.q.name][g]=c)}),d}return r.options={strictMode:!1,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}},nn}var rn,er;function us(){if(er)return rn;er=1;var e=Re(),i=Oe(),t=typeof window<"u";function r(p){this.service=p,this.subscriptions=new a(p),this.events=new f(p),this.base64Encode=function(d){return t?btoa(encodeURIComponent(d).replace(/%([0-9A-F]{2})/g,function(v,T){return String.fromCharCode("0x"+T)})):new Buffer(d).toString("base64")}}function a(p){this.service=p}a.prototype={create:function(p,d){this.service.ajax({url:i.getUrl(e.urls.subscriptions),type:"POST",data:p},d)},list:function(p){this.service.ajax({url:i.getUrl(e.urls.subscriptions)},p)},delete:function(p,d){var v={type:"DELETE",dataType:"text",url:i.getUrl(e.urls.subscriptions,p)};this.service.ajax(v,function(T,g){T?d(T,null):d(null,!0)})}};function f(p){this.service=p}return f.prototype={create:function(p,d){this.service.ajax({url:i.getUrl(e.urls.events),type:"POST",contentType:"application/json; charset=utf-8",isNeedStringify:!0,data:{event:p}},d)},list:function(p,d){typeof p=="function"&&typeof d>"u"&&(d=p,p=null),this.service.ajax({url:i.getUrl(e.urls.events),data:p},d)},get:function(p,d){this.service.ajax({url:i.getUrl(e.urls.events,p)},d)},delete:function(p,d){this.service.ajax({url:i.getUrl(e.urls.events,p),dataType:"text",type:"DELETE"},d)},status:function(p,d){this.service.ajax({url:i.getUrl(e.urls.events,p+"/status")},d)}},rn=r,rn}var sn,tr;function cs(){if(tr)return sn;tr=1;var e=Re(),i=Oe();function t(r){this.service=r}return t.prototype={create:function(r,a,f){var p={type:"POST",data:a,isNeedStringify:!0,contentType:"application/json; charset=utf-8",url:i.getUrl(e.urls.data,r)};this.service.ajax(p,function(d,v){d?f(d,null):f(d,v)})},list:function(r,a,f){typeof f>"u"&&typeof a=="function"&&(f=a,a=null),this.service.ajax({url:i.getUrl(e.urls.data,r),data:a},function(p,d){p?f(p,null):f(p,d)})},update:function(r,a,f){this.service.ajax({url:i.getUrl(e.urls.data,r+"/"+a._id),type:"PUT",contentType:"application/json; charset=utf-8",isNeedStringify:!0,data:a},function(p,d){p?f(p,null):f(p,d)})},delete:function(r,a,f){var p={id:1,ids:2,criteria:3},d,v={deleted:[],deletedCount:0},T={type:"DELETE",dataType:"text"};
2typeof a=="string"?d=p.id:i.isArray(a)?d=p.ids:i.isObject(a)&&(d=p.criteria),d===p.id?T.url=i.getUrl(e.urls.data,r+"/"+a):d===p.ids?T.url=i.getUrl(e.urls.data,r+"/"+a.toString()):d===p.criteria&&(T.url=i.getUrl(e.urls.data,r+"/by_criteria"),T.data=a);function g(c,u){if(c)f(c,null);else{var n;d===p.id?(v.deleted.push(a),v.deletedCount=v.deleted.length):d===p.ids?(n=JSON.parse(u),v.deleted=n.SuccessfullyDeleted.ids.slice(0),v.deletedCount=v.deleted.length):d===p.criteria&&(n=JSON.parse(u),v.deleted=null,v.deletedCount=n.total_deleted),f(c,v)}}this.service.ajax(T,g)},uploadFile:function(r,a,f){var p={field_name:a.field_name,file:{data:a.file,name:a.name}};this.service.ajax({url:i.getUrl(e.urls.data,r+"/"+a.id+"/file"),type:"POST",fileToCustomObject:!0,contentType:!1,data:p},function(d,v){d?f(d,null):f(d,v)})},downloadFile:function(r,a,f){var p=i.getUrl(e.urls.data,r+"/"+a.id+"/file");p+="?field_name="+a.field_name+"&token="+this.service.getSession().token,f(null,p)},fileUrl:function(r,a){var f=i.getUrl(e.urls.data,r+"/"+a.id+"/file");return f+="?field_name="+a.field_name+"&token="+this.service.getSession().token,f},deleteFile:function(r,a,f){this.service.ajax({url:i.getUrl(e.urls.data,r+"/"+a.id+"/file"),data:{field_name:a.field_name},dataType:"text",type:"DELETE"},function(p,d){p?f(p,null):f(p,!0)})}},sn=t,sn}var on,nr;function ls(){if(nr)return on;nr=1;var e=Oe(),i=Re();function t(a){this.service=a}t.prototype={uploadAddressBook:function(a,f,p){if(Array.isArray(a)){var d,v;r(f)?v=f:(d=f,v=p);var T={contacts:a};d&&(d.force&&(T.force=d.force),d.udid&&(T.udid=d.udid)),this.service.ajax({type:"POST",url:e.getUrl(i.urls.addressbook),data:T,contentType:"application/json; charset=utf-8",isNeedStringify:!0},function(g,c){g?v(g,null):v(null,c)})}},_isFakeErrorEmptyAddressBook:function(a){var f=a.detail?a.detail:a.message.errors;return a.code===404&&f[0]==="Empty address book"},get:function(a,f){var p=this,d,v;if(r(a)?v=a:(d=a,v=f),!r(v))throw new Error("The QB.addressbook.get accept callback function is required.");var T={type:"GET",url:e.getUrl(i.urls.addressbook),contentType:"application/json; charset=utf-8",isNeedStringify:!0};d&&(T.data={udid:d}),this.service.ajax(T,function(g,c){if(g){var u=p._isFakeErrorEmptyAddressBook(g);u?v(null,[]):v(g,null)}else v(null,c)})},getRegisteredUsers:function(a,f){var p=this,d,v;if(r(a)?v=a:(d=a,v=f),!r(v))throw new Error("The QB.addressbook.get accept callback function is required.");
2var T={type:"GET",url:e.getUrl(i.urls.addressbookRegistered),contentType:"application/json; charset=utf-8"};d&&(T.data={compact:1}),this.service.ajax(T,function(g,c){if(g){var u=p._isFakeErrorEmptyAddressBook(g);u?v(null,[]):v(g,null)}else v(null,c)})}},on=t;function r(a){return!!(a&&a.constructor&&a.call&&a.apply)}return on}var an,rr;function Vr(){if(rr)return an;rr=1;var e=Oe(),i=Re(),t="Unknown interface. SDK support browser / node env.",r={CLIENT:"jabber:client",CHAT:"urn:xmpp:chat-markers:0",STATES:"http://jabber.org/protocol/chatstates",MARKERS:"urn:xmpp:chat-markers:0",CARBONS:"urn:xmpp:carbons:2",ROSTER:"jabber:iq:roster",MUC:"http://jabber.org/protocol/muc",PRIVACY:"jabber:iq:privacy",LAST:"jabber:iq:last"};function a(p,d,v){var T=new Error(p,d,v);return T.name="ChatNotConnectedError",Object.setPrototypeOf(T,Object.getPrototypeOf(this)),Error.captureStackTrace&&Error.captureStackTrace(T,a),T}a.prototype=Object.create(Error.prototype,{constructor:{value:Error,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(a,Error):a.__proto__=Error;var f={MARKERS:r,ChatNotConnectedError:a,buildUserJid:function(p){var d;return"userId"in p?(d=p.userId+"-"+i.creds.appId+"@"+i.endpoints.chat,"resource"in p&&(d=d+"/"+p.resource)):"jid"in p&&(d=p.jid),d},createStanza:function(p,d,v){var T;return e.getEnv().browser?T=p(d):T=new p(v||"message",d),T},getAttr:function(p,d){var v;return p?(typeof p.getAttribute=="function"?v=p.getAttribute(d):p.attrs&&(v=p.attrs[d]),v||null):null},getElement:function(p,d){var v;if(typeof p.querySelector=="function")v=p.querySelector(d);else if(typeof p.getChild=="function")v=p.getChild(d)||p.children.find(T=>typeof T.getChild=="function"&&this.getElement(T,d));else throw t;return v||null},getAllElements:function(p,d){var v;if(typeof p.querySelectorAll=="function")v=p.querySelectorAll(d);else if(typeof p.getChild=="function")v=p.getChild(d);else throw t;return v||null},getElementText:function(p,d){var v,T;if(typeof p.querySelector=="function")v=p.querySelector(d),T=v?v.textContent:null;else if(typeof p.getChildText=="function")T=p.getChildText(d)||p.children.find(g=>typeof g.getChildText=="function"&&this.getElementText(g,d));else throw t;return T||null},_JStoXML:function(p,d,v){var T=this;v.c(p),Object.keys(d).forEach(function(g){typeof d[g]=="object"?T._JStoXML(g,d[g],v):v.c(g).t(d[g]).up()}),v.up()},_XMLtoJS:function(p,d,v){var T=this;p[d]={};for(var g=0,c=v.childNodes.length;g<c;g++)v.childNodes[g].childNodes.length>1?p[d]=T._XMLtoJS(p[d],v.childNodes[g].tagName,v.childNodes[g]):p[d][v.childNodes[g].tagName]=v.childNodes[g].textContent;return p},filledExtraParams:function(p,d){var v=this;return Object.keys(d).forEach(function(T){T==="attachments"?d[T].forEach(function(g){e.getEnv().browser?p.c("attachment",g).up():p.getChild("extraParams").c("attachment",g).up()}):typeof d[T]=="object"?v._JStoXML(T,d[T],p):e.getEnv().browser?p.c(T).t(d[T]).up():p.getChild("extraParams").c(T).t(d[T]).up()}),p.up(),p},parseExtraParams:function(p){var d=this;if(!p)return null;var v={},T,g,c,u=[];if(e.getEnv().browser)for(var n=0,s=p.childNodes.length;n<s;n++)if(p.childNodes[n].tagName==="attachment"){g={},c=p.childNodes[n].attributes;for(var S=0,l=c.length;S<l;S++)c[S].name==="size"?g[c[S].name]=parseInt(c[S].value):g[c[S].name]=c[S].value;u.push(g)}else if(p.childNodes[n].tagName==="dialog_id")T=p.childNodes[n].textContent,v.dialog_id=T;else if(p.childNodes[n].childNodes.length>1){var m=p.childNodes[n].textContent.length;if(m>4096){for(var y="",b=0;b<p.childNodes[n].childNodes.length;++b)y+=p.childNodes[n].childNodes[b].textContent;v[p.childNodes[n].tagName]=y}else v=d._XMLtoJS(v,p.childNodes[n].tagName,p.childNodes[n])}else v[p.childNodes[n].tagName]=p.childNodes[n].textContent;else for(var R=0,I=p.children.length;R<I;R++){if(p.children[R].name==="attachment"){g={},c=p.children[R].attrs;for(var A=Object.keys(c),x=0;x<A.length;x++)A[x]==="size"?g.size=parseInt(c.size):g[A[x]]=c[A[x]];u.push(g)}else p.children[R].name==="dialog_id"&&(T=p.getChildText("dialog_id"),v.dialog_id=T);if(p.children[R].children.length===1){var M=p.children[R];v[M.name]=M.children[0]}}if(u.length>0&&(v.attachments=u),v.moduleIdentifier&&delete v.moduleIdentifier,v.date_sent){var P=Number(v.date_sent);Number.isFinite(P)&&(v.date_sent=Math.trunc(P).toString())}return{extension:v,dialogId:T}},getUniqueId:function(p){var d="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(v){var T=Math.random()*16|0,g=v=="x"?T:T&3|8;return g.toString(16)});return typeof p=="string"||typeof p=="number"?d+":"+p:d+""},getErrorFromXMLNode:function(p){var d=this.getElement(p,"error"),v=parseInt(this.getAttr(d,"code")),T=this.getElementText(d,"text");return e.getError(v,T)}
2,getLocalTime:function(){return new Date().toTimeString().split(" ")[0]}};return an=f,an}var un,ir;function ds(){if(ir)return un;ir=1;var e=Oe(),i=Vr();function t(r){this._NS="urn:xmpp:sm:3",this._isStreamManagementEnabled=!1,this._clientProcessedStanzasCounter=null,this._clientSentStanzasCounter=null,this._intervalId=null,this._timeInterval=e.getTimeIntervalForCallBackMessage(),this.sentMessageCallback=null,e.getEnv().browser&&(this._parser=new DOMParser),this._c=null,this._nodeBuilder=null,this._originalSend=null,this._stanzasQueue=[]}return t.prototype.enable=function(r,a){var f=this,p,d={xmlns:f._NS};f._isStreamManagementEnabled||(f._c=r,f._originalSend=this._c.send,f._c.send=this.send.bind(f)),e.getEnv().browser?(this._clientProcessedStanzasCounter=null,this._clientSentStanzasCounter=null,f._addEnableHandlers(),p=$build("enable",d)):(f._nodeBuilder=a.Stanza,f._addEnableHandlers(),p=i.createStanza(f._nodeBuilder,d,"enable")),f._c.send(p)},t.prototype._timeoutCallback=function(){var r=this,a=Date.now(),f=[];if(r._stanzasQueue.length){for(var p=0;p<r._stanzasQueue.length;p++)r._stanzasQueue[p]&&r._stanzasQueue[p].time<a?r.sentMessageCallback(r._stanzasQueue[p].message):f.push(r._stanzasQueue[p]);r._stanzasQueue=f}},t.prototype._addEnableHandlers=function(){var r=this;e.getEnv().browser?r._c.XAddTrackedHandler(a.bind(r)):r._c.on("stanza",a.bind(r));function a(f){var p=f.name||f.tagName||f.nodeTree.tagName;if(p==="enabled")return r._isStreamManagementEnabled=!0,!0;if(r._isStreamManagementEnabled&&p==="message")return clearInterval(r._intervalId),r._intervalId=setInterval(r._timeoutCallback.bind(r),r._timeInterval),!0;if(i.getAttr(f,"xmlns")!==r._NS&&r._increaseReceivedStanzasCounter(),p==="r"){var d={xmlns:r._NS,h:r._clientProcessedStanzasCounter},v=e.getEnv().browser?$build("a",d):i.createStanza(r._nodeBuilder,d,"a");return r._originalSend.call(r._c,v),!0}if(p==="a"){var T=parseInt(i.getAttr(f,"h"));r._checkCounterOnIncomeStanza(T)}return!0}},t.prototype.send=function(r,a){var f=this,p=r.nodeTree?this._parser.parseFromString(r.nodeTree.outerHTML,"application/xml").childNodes[0]:r,d=p.name||p.tagName||p.nodeTree.tagName,v=i.getAttr(p,"type"),T=i.getElementText(p,"body")||"",g=i.getAllElements(p,"attachment")||"";try{f._originalSend.call(f._c,r)}catch(c){e.QBLog("[QBChat]",c.message)}finally{d==="message"&&(v==="chat"||v==="groupchat")&&(T||g.length)&&f._sendStanzasRequest({message:a,time:Date.now()+f._timeInterval,expect:f._clientSentStanzasCounter}),f._clientSentStanzasCounter++}},t.prototype._sendStanzasRequest=function(r){var a=this;if(a._isStreamManagementEnabled){a._stanzasQueue.push(r);var f=e.getEnv().browser?$build("r",{xmlns:a._NS}):i.createStanza(a._nodeBuilder,{xmlns:a._NS},"r");a._c.connected?a._originalSend.call(a._c,f):a._checkCounterOnIncomeStanza()}},t.prototype.getClientSentStanzasCounter=function(){return this._clientSentStanzasCounter},t.prototype._checkCounterOnIncomeStanza=function(r){var a=[];if(this._stanzasQueue.length){for(var f=0;f<this._stanzasQueue.length;f++)this._stanzasQueue[f].expect==r?this.sentMessageCallback(null,this._stanzasQueue[f].message):a.push(this._stanzasQueue[f]);this._stanzasQueue=a}},t.prototype._increaseReceivedStanzasCounter=function(){this._clientProcessedStanzasCounter++},un=t,un}var bt={exports:{}},cn,sr;function fs(){return sr||(sr=1,cn=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}),cn}var de={},xe={},or;function Ct(){if(or)return xe;or=1;function e(m,y,b){if(b===void 0&&(b=Array.prototype),m&&typeof b.find=="function")return b.find.call(m,y);for(var R=0;R<m.length;R++)if(t(m,R)){var I=m[R];if(y.call(void 0,I,R,m))return I}}function i(m,y){return y===void 0&&(y=Object),y&&typeof y.getOwnPropertyDescriptors=="function"&&(m=y.create(null,y.getOwnPropertyDescriptors(m))),y&&typeof y.freeze=="function"?y.freeze(m):m}function t(m,y){return Object.prototype.hasOwnProperty.call(m,y)}function r(m,y){if(m===null||typeof m!="object")throw new TypeError("target is not an object");for(var b in y)t(y,b)&&(m[b]=y[b]);return m}var a=i({allowfullscreen:!0,async:!0,autofocus:!0,autoplay:!0,checked:!0,controls:!0,default:!0,defer:!0,disabled:!0,formnovalidate:!0,hidden:!0,ismap:!0,itemscope:!0,loop:!0,multiple:!0,muted:!0,nomodule:!0,novalidate:!0,open:!0,playsinline:!0,readonly:!0,required:!0,reversed:!0,selected:!0});function f(m){return t(a,m.toLowerCase())}var p=i({area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function d(m){return t(p,m.toLowerCase())}var v=i({script:!1,style:!1,textarea:!0,title:!0});function T(m){var y=m.toLowerCase();return t(v,y)&&!v[y]}function g(m){var y=m.toLowerCase();return t(v,y)&&v[y]}function c(m){return m===n.HTML}function u(m){return c(m)||m===n.XML_XHTML_APPLICATION}var n=i({HTML:"text/html",XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),s=Object.keys(n).map(function(m){return n[m]});function S(m){return s.indexOf(m)>-1}var l=i({HTML:"http://www.w3.org/1999/xhtml",SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});return xe.assign=r,xe.find=e,xe.freeze=i,xe.HTML_BOOLEAN_ATTRIBUTES=a,xe.HTML_RAW_TEXT_ELEMENTS=v,xe.HTML_VOID_ELEMENTS=p,xe.hasDefaultHTMLNamespace=u,xe.hasOwn=t,xe.isHTMLBooleanAttribute=f,xe.isHTMLRawTextElement=T,xe.isHTMLEscapableRawTextElement=g,xe.isHTMLMimeType=c,xe.isHTMLVoidElement=d,xe.isValidMimeType=S,xe.MIME_TYPE=n,xe.NAMESPACE=l,xe}var mt={},ar;function Qt(){if(ar)return mt;ar=1;var e=Ct();function i(u,n){u.prototype=Object.create(Error.prototype,{constructor:{value:u},name:{value:u.name,enumerable:!0,writable:n}})}var t=e.freeze({Error:"Error",IndexSizeError:"IndexSizeError",DomstringSizeError:"DomstringSizeError",HierarchyRequestError:"HierarchyRequestError",WrongDocumentError:"WrongDocumentError",InvalidCharacterError:"InvalidCharacterError",NoDataAllowedError:"NoDataAllowedError",NoModificationAllowedError:"NoModificationAllowedError",NotFoundError:"NotFoundError",NotSupportedError:"NotSupportedError",InUseAttributeError:"InUseAttributeError",InvalidStateError:"InvalidStateError",SyntaxError:"SyntaxError",InvalidModificationError:"InvalidModificationError",NamespaceError:"NamespaceError",InvalidAccessError:"InvalidAccessError",ValidationError:"ValidationError",TypeMismatchError:"TypeMismatchError",SecurityError:"SecurityError",NetworkError:"NetworkError",AbortError:"AbortError",URLMismatchError:"URLMismatchError",QuotaExceededError:"QuotaExceededError",TimeoutError:"TimeoutError",InvalidNodeTypeError:"InvalidNodeTypeError",DataCloneError:"DataCloneError",EncodingError:"EncodingError",NotReadableError:"NotReadableError",UnknownError:"UnknownError",ConstraintError:"ConstraintError",DataError:"DataError",TransactionInactiveError:"TransactionInactiveError",ReadOnlyError:"ReadOnlyError",VersionError:"VersionError",OperationError:"OperationError",NotAllowedError:"NotAllowedError",OptOutError:"OptOutError"}),r=Object.keys(t);function a(u){return typeof u=="number"&&u>=1&&u<=25}function f(u){return typeof u=="string"&&u.substring(u.length-t.Error.length)===t.Error}function p(u,n){a(u)?(this.name=r[u],this.message=n||""):(this.message=u,this.name=f(n)?n:t.Error),Error.captureStackTrace&&Error.captureStackTrace(this,p)}
2i(p,!0),Object.defineProperties(p.prototype,{code:{enumerable:!0,get:function(){var u=r.indexOf(this.name);return a(u)?u:0}}});for(var d={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25},v=Object.entries(d),T=0;T<v.length;T++){var g=v[T][0];p[g]=v[T][1]}function c(u,n){this.message=u,this.locator=n,Error.captureStackTrace&&Error.captureStackTrace(this,c)}return i(c),mt.DOMException=p,mt.DOMExceptionName=t,mt.ExceptionCode=d,mt.ParseError=c,mt}var Te={},ue={},ur;function zr(){if(ur)return ue;ur=1;function e(pe){try{typeof pe!="function"&&(pe=RegExp);var be=new pe("𝌆","u").exec("𝌆");return!!be&&be[0].length===2}catch{}return!1}var i=e();function t(pe){if(pe.source[0]!=="[")throw new Error(pe+" can not be used with chars");return pe.source.slice(1,pe.source.lastIndexOf("]"))}function r(pe,be){if(pe.source[0]!=="[")throw new Error("/"+pe.source+"/ can not be used with chars_without");if(!be||typeof be!="string")throw new Error(JSON.stringify(be)+" is not a valid search");if(pe.source.indexOf(be)===-1)throw new Error('"'+be+'" is not is /'+pe.source+"/");if(be==="-"&&pe.source.indexOf(be)!==1)throw new Error('"'+be+'" is not at the first postion of /'+pe.source+"/");return new RegExp(pe.source.replace(be,""),i?"u":"")}function a(pe){var be=this;return new RegExp(Array.prototype.slice.call(arguments).map(function($e){var O=typeof $e=="string";if(O&&be===void 0&&$e==="|")throw new Error("use regg instead of reg to wrap expressions with `|`!");return O?$e:$e.source}).join(""),i?"mu":"m")}function f(pe){if(arguments.length===0)throw new Error("no parameters provided");return a.apply(f,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}var p="�",d=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;i&&(d=a("[",t(d),"\\u{10000}-\\u{10FFFF}","]"));var v=new RegExp("[^"+t(d)+"]",i?"u":""),T=/[\x20\x09\x0D\x0A]/,g=t(T),c=a(T,"+"),u=a(T,"*"),n=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;i&&(n=a("[",t(n),"\\u{10000}-\\u{10FFFF}","]"));var s=t(n),S=a("[",s,t(/[-.0-9\xB7]/),t(/[\u0300-\u036F\u203F-\u2040]/),"]"),l=a(n,S,"*"),m=a(S,"+"),y=a("&",l,";"),b=f(/&#[0-9]+;|&#x[0-9a-fA-F]+;/),R=f(y,"|",b),I=a("%",l,";"),A=f(a('"',f(/[^%&"]/,"|",I,"|",R),"*",'"'),"|",a("'",f(/[^%&']/,"|",I,"|",R),"*","'")),x=f('"',f(/[^<&"]/,"|",R),"*",'"',"|","'",f(/[^<&']/,"|",R),"*","'"),M=r(n,":"),P=r(S,":"),L=a(M,P,"*"),G=a(L,f(":",L),"?"),$=a("^",G,"$"),Q=a("(",G,")"),W=f(/"[^"]*"|'[^']*'/),w=a(/^<\?/,"(",l,")",f(c,"(?!",T,")(",d,"*?)"),"?",/\?>/),B=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,U=f('"',B,'*"',"|","'",r(B,"'"),"*'"),F="<!--",V="-->",H=a(F,f(r(d,"-"),"|",a("-",r(d,"-"))),"*",V),z="#PCDATA",re=f(a(/\(/,u,z,f(u,/\|/,u,G),"*",u,/\)\*/),"|",a(/\(/,u,z,u,/\)/)),Y=/[?*+]?/,X=a(/\([^>]+\)/,Y),K=f("EMPTY","|","ANY","|",re,"|",X),ee="<!ELEMENT",oe=a(ee,c,f(G,"|",I),c,f(K,"|",I),u,">"),Ce=a("NOTATION",c,/\(/,u,l,f(u,/\|/,u,l),"*",u,/\)/),ae=a(/\(/,u,m,f(u,/\|/,u,m),"*",u,/\)/),le=f(Ce,"|",ae),te=f(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",le),J=f(/#REQUIRED|#IMPLIED/,"|",f(f("#FIXED",c),"?",x)),ce=f(c,l,c,te,c,J),ye="<!ATTLIST",fe=a(ye,c,l,ce,"*",u,">"),ve="about:legacy-compat",Ee=f('"'+ve+'"',"|","'"+ve+"'"),we="SYSTEM",Be="PUBLIC",qe=f(f(we,c,W),"|",f(Be,c,U,c,W)),ze=a("^",f(f(we,c,"(?<SystemLiteralOnly>",W,")"),"|",f(Be,c,"(?<PubidLiteral>",U,")",c,"(?<SystemLiteral>",W,")"))),Ze=a("^",U,"$"),me=a("^",W,"$"),Le=f(c,"NDATA",c,l),De=f(A,"|",f(qe,Le,"?")),Je="<!ENTITY",je=a(Je,c,l,c,De,u,">"),Qe=f(A,"|",qe),et=a(Je,c,"%",c,l,c,Qe,u,">"),ie=f(je,"|",et),_e=a(Be,c,U),Ne=a("<!NOTATION",c,l,c,f(qe,"|",_e),u,">
2"),Ie=a(u,"=",u),Fe=/1[.]\d+/,We=a(c,"version",Ie,f("'",Fe,"'","|",'"',Fe,'"')),Xe=/[A-Za-z][-A-Za-z0-9._]*/,tt=f(c,"encoding",Ie,f('"',Xe,'"',"|","'",Xe,"'")),nt=f(c,"standalone",Ie,f("'",f("yes","|","no"),"'","|",'"',f("yes","|","no"),'"')),ot=a(/^<\?xml/,We,tt,"?",nt,"?",u,/\?>/),Me="<!DOCTYPE",rt="<![CDATA[",Ge="]]>",it=/<!\[CDATA\[/,dt=/\]\]>/,ft=a(d,"*?",dt),ht=a(it,ft);return ue.chars=t,ue.chars_without=r,ue.detectUnicodeSupport=e,ue.reg=a,ue.regg=f,ue.ABOUT_LEGACY_COMPAT=ve,ue.ABOUT_LEGACY_COMPAT_SystemLiteral=Ee,ue.AttlistDecl=fe,ue.CDATA_START=rt,ue.CDATA_END=Ge,ue.CDSect=ht,ue.Char=d,ue.Comment=H,ue.COMMENT_START=F,ue.COMMENT_END=V,ue.DOCTYPE_DECL_START=Me,ue.elementdecl=oe,ue.EntityDecl=ie,ue.EntityValue=A,ue.ExternalID=qe,ue.ExternalID_match=ze,ue.Name=l,ue.NotationDecl=Ne,ue.Reference=R,ue.PEReference=I,ue.PI=w,ue.PUBLIC=Be,ue.PubidLiteral=U,ue.PubidLiteral_match=Ze,ue.QName=G,ue.QName_exact=$,ue.QName_group=Q,ue.S=c,ue.SChar_s=g,ue.S_OPT=u,ue.SYSTEM=we,ue.SystemLiteral=W,ue.SystemLiteral_match=me,ue.InvalidChar=v,ue.UNICODE_REPLACEMENT_CHARACTER=p,ue.UNICODE_SUPPORT=i,ue.XMLDecl=ot,ue}var cr;function Jr(){if(cr)return Te;cr=1;var e=Ct(),i=e.find,t=e.hasDefaultHTMLNamespace,r=e.hasOwn,a=e.isHTMLMimeType,f=e.isHTMLRawTextElement,p=e.isHTMLVoidElement,d=e.MIME_TYPE,v=e.NAMESPACE,T=Symbol(),g=Qt(),c=g.DOMException,u=g.DOMExceptionName,n=zr();function s(E){if(E!==T)throw new TypeError("Illegal constructor")}function S(E){return E!==""}function l(E){return E?E.split(/[\t\n\f\r ]+/).filter(S):[]}function m(E,D){return r(E,D)||(E[D]=!0),E}function y(E){if(!E)return[];var D=l(E);return Object.keys(D.reduce(m,{}))}function b(E){return function(D){return E&&E.indexOf(D)!==-1}}function R(E){if(!n.QName_exact.test(E))throw new c(c.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+E+'"')}function I(E,D){R(D),E=E||null;var C=null,o=D;if(D.indexOf(":")>=0){var h=D.split(":");C=h[0],o=h[1]}if(C!==null&&E===null)throw new c(c.NAMESPACE_ERR,"prefix is non-null and namespace is null");if(C==="xml"&&E!==e.NAMESPACE.XML)throw new c(c.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if((C==="xmlns"||D==="xmlns")&&E!==e.NAMESPACE.XMLNS)throw new c(c.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(E===e.NAMESPACE.XMLNS&&C!=="xmlns"&&D!=="xmlns")throw new c(c.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return[E,C,o]}function A(E,D){for(var C in E)r(E,C)&&(D[C]=E[C])}function x(E,D){var C=E.prototype;if(!(C instanceof D)){let o=function(){};o.prototype=D.prototype,o=new o,A(C,o),E.prototype=C=o}C.constructor!=E&&(typeof E!="function"&&console.error("unknown Class:"+E),C.constructor=E)}var M={},P=M.ELEMENT_NODE=1,L=M.ATTRIBUTE_NODE=2,G=M.TEXT_NODE=3,$=M.CDATA_SECTION_NODE=4,Q=M.ENTITY_REFERENCE_NODE=5,W=M.ENTITY_NODE=6,w=M.PROCESSING_INSTRUCTION_NODE=7,B=M.COMMENT_NODE=8,U=M.DOCUMENT_NODE=9,F=M.DOCUMENT_TYPE_NODE=10,V=M.DOCUMENT_FRAGMENT_NODE=11,H=M.NOTATION_NODE=12,z=e.freeze({DOCUMENT_POSITION_DISCONNECTED:1,DOCUMENT_POSITION_PRECEDING:2,DOCUMENT_POSITION_FOLLOWING:4,DOCUMENT_POSITION_CONTAINS:8,DOCUMENT_POSITION_CONTAINED_BY:16,DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:32});function re(E,D){if(D.length<E.length)return re(D,E);var C=null;for(var o in E){if(E[o]!==D[o])return C;C=E[o]}return C}function Y(E){return E.guid||(E.guid=Math.random()),E.guid}function X(){}X.prototype={length:0,item:function(E){return E>=0&&E<this.length?this[E]:null},toString:function(E){var D;typeof E=="function"?D={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:E}:E?D={requireWellFormed:!!E.requireWellFormed,splitCDATASections:E.splitCDATASections!==!1,nodeFilter:E.nodeFilter||null}:D={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:null};for(var C=[],o=0;o<this.length;o++)be(this[o],C,null,D);return C.join("")},filter:function(E){return Array.prototype.filter.call(this,E)},indexOf:function(E){return Array.prototype.indexOf.call(this,E)}},X.prototype[Symbol.iterator]=function(){var E=this,D=0;return{next:function(){return D<E.length?{value:E[D++],done:!1}:{done:!0}},return:function(){return{done:!0}}}};function K(E,D){this._node=E,this._refresh=D,ee(this)}function ee(E){var D=E._node._inc||E._node.ownerDocument._inc;if(E._inc!==D){var C=E._refresh(E._node);
2if(xt(E,"length",C.length),!E.$$length||C.length<E.$$length)for(var o=C.length;o in E;o++)r(E,o)&&delete E[o];A(C,E),E._inc=D}}K.prototype.item=function(E){return ee(this),this[E]||null},x(K,X);function oe(){}function Ce(E,D){for(var C=0;C<E.length;){if(E[C]===D)return C;C++}}function ae(E,D,C,o){if(o?D[Ce(D,o)]=C:(D[D.length]=C,D.length++),E){C.ownerElement=E;var h=E.ownerDocument;h&&(o&&we(h,E,o),Ee(h,E,C))}}function le(E,D,C){var o=Ce(D,C);if(o>=0){for(var h=D.length-1;o<=h;)D[o]=D[++o];if(D.length=h,E){var _=E.ownerDocument;_&&we(_,E,C),C.ownerElement=null}}}oe.prototype={length:0,item:X.prototype.item,getNamedItem:function(E){this._ownerElement&&this._ownerElement._isInHTMLDocumentAndNamespace()&&(E=E.toLowerCase());for(var D=0;D<this.length;){var C=this[D];if(C.nodeName===E)return C;D++}return null},setNamedItem:function(E){var D=E.ownerElement;if(D&&D!==this._ownerElement)throw new c(c.INUSE_ATTRIBUTE_ERR);var C=this.getNamedItemNS(E.namespaceURI,E.localName);return C===E?E:(ae(this._ownerElement,this,E,C),C)},setNamedItemNS:function(E){return this.setNamedItem(E)},removeNamedItem:function(E){var D=this.getNamedItem(E);if(!D)throw new c(c.NOT_FOUND_ERR,E);return le(this._ownerElement,this,D),D},removeNamedItemNS:function(E,D){var C=this.getNamedItemNS(E,D);if(!C)throw new c(c.NOT_FOUND_ERR,E?E+" : "+D:D);return le(this._ownerElement,this,C),C},getNamedItemNS:function(E,D){E||(E=null);for(var C=0;C<this.length;){var o=this[C];if(o.localName===D&&o.namespaceURI===E)return o;C++}return null}},oe.prototype[Symbol.iterator]=function(){var E=this,D=0;return{next:function(){return D<E.length?{value:E[D++],done:!1}:{done:!0}},return:function(){return{done:!0}}}};function te(){}te.prototype={hasFeature:function(E,D){return!0},createDocument:function(E,D,C){var o=d.XML_APPLICATION;E===v.HTML?o=d.XML_XHTML_APPLICATION:E===v.SVG&&(o=d.XML_SVG_IMAGE);var h=new ve(T,{contentType:o});if(h.implementation=this,h.childNodes=new X,h.doctype=C||null,C&&h.appendChild(C),D){var _=h.createElementNS(E,D);h.appendChild(_)}return h},createDocumentType:function(E,D,C,o){R(E);var h=new nt(T);return h.name=E,h.nodeName=E,h.publicId=D||"",h.systemId=C||"",h.internalSubset=o||"",h.childNodes=new X,h},createHTMLDocument:function(E){var D=new ve(T,{contentType:d.HTML});if(D.implementation=this,D.childNodes=new X,E!==!1){D.doctype=this.createDocumentType("html"),D.doctype.ownerDocument=D,D.appendChild(D.doctype);var C=D.createElement("html");D.appendChild(C);var o=D.createElement("head");if(C.appendChild(o),typeof E=="string"){var h=D.createElement("title");h.appendChild(D.createTextNode(E)),o.appendChild(h)}C.appendChild(D.createElement("body"))}return D}};function J(E){s(E)}J.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,parentNode:null,get parentElement(){return this.parentNode&&this.parentNode.nodeType===this.ELEMENT_NODE?this.parentNode:null},childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,baseURI:"about:blank",get isConnected(){var E=this.getRootNode();return E&&E.nodeType===E.DOCUMENT_NODE},contains:function(E){if(!E)return!1;var D=E;do{if(this===D)return!0;D=D.parentNode}while(D);return!1},getRootNode:function(E){var D=this;do{if(!D.parentNode)return D;D=D.parentNode}while(D)},isEqualNode:function(E){if(!E)return!1;for(var D=[{node:this,other:E}];D.length>0;){var C=D.pop(),o=C.node,h=C.other;if(o.nodeType!==h.nodeType)return!1;switch(o.nodeType){case o.DOCUMENT_TYPE_NODE:if(o.name!==h.name||o.publicId!==h.publicId||o.systemId!==h.systemId)return!1;break;case o.ELEMENT_NODE:if(o.namespaceURI!==h.namespaceURI||o.prefix!==h.prefix||o.localName!==h.localName||o.attributes.length!==h.attributes.length)return!1;for(var _=0;_<o.attributes.length;_++){var N=o.attributes.item(_),k=h.getAttributeNodeNS(N.namespaceURI,N.localName);if(!k)return!1;D.push({node:N,other:k})}break;case o.ATTRIBUTE_NODE:if(o.namespaceURI!==h.namespaceURI||o.localName!==h.localName||o.value!==h.value)return!1;break;case o.PROCESSING_INSTRUCTION_NODE:if(o.target!==h.target||o.data!==h.data)return!1;break;case o.TEXT_NODE:case o.CDATA_SECTION_NODE:case o.COMMENT_NODE:if(o.data!==h.data)return!1;break}if(o.childNodes.length!==h.childNodes.length)return!1;for(var _=o.childNodes.length-1;_>=0;_--)D.push({node:o.childNodes[_],other:h.childNodes[_]})}return!0},isSameNode:function(E){return this===E},insertBefore:function(E,D){return _e(this,E,D)},replaceChild:function(E,D){_e(this,E,D,ie),D&&this.removeChild(D)},removeChild:function(E){return qe(this,E)},appendChild:function(E){return this.insertBefore(E,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(E){return O(this.ownerDocument||this,this,E)},normalize:function(){fe(this,null,{enter:function(E){for(var D=E.firstChild;D;
2){var C=D.nextSibling;C!==null&&C.nodeType===G&&D.nodeType===G?(E.removeChild(C),D.appendData(C.data)):D=C}return!0}})},isSupported:function(E,D){return this.ownerDocument.implementation.hasFeature(E,D)},lookupPrefix:function(E){for(var D=this;D;){var C=D._nsMap;if(C){for(var o in C)if(r(C,o)&&C[o]===E)return o}D=D.nodeType==L?D.ownerDocument:D.parentNode}return null},lookupNamespaceURI:function(E){for(var D=this;D;){var C=D._nsMap;if(C&&r(C,E))return C[E];D=D.nodeType==L?D.ownerDocument:D.parentNode}return null},isDefaultNamespace:function(E){var D=this.lookupPrefix(E);return D==null},compareDocumentPosition:function(E){if(this===E)return 0;var D=E,C=this,o=null,h=null;if(D instanceof Ie&&(o=D,D=o.ownerElement),C instanceof Ie&&(h=C,C=h.ownerElement,o&&D&&C===D))for(var _=0,N;N=C.attributes[_];_++){if(N===o)return z.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+z.DOCUMENT_POSITION_PRECEDING;if(N===h)return z.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+z.DOCUMENT_POSITION_FOLLOWING}if(!D||!C||C.ownerDocument!==D.ownerDocument)return z.DOCUMENT_POSITION_DISCONNECTED+z.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+(Y(C.ownerDocument)>Y(D.ownerDocument)?z.DOCUMENT_POSITION_FOLLOWING:z.DOCUMENT_POSITION_PRECEDING);if(h&&D===C)return z.DOCUMENT_POSITION_CONTAINS+z.DOCUMENT_POSITION_PRECEDING;if(o&&D===C)return z.DOCUMENT_POSITION_CONTAINED_BY+z.DOCUMENT_POSITION_FOLLOWING;for(var k=[],j=D.parentNode;j;){if(!h&&j===C)return z.DOCUMENT_POSITION_CONTAINED_BY+z.DOCUMENT_POSITION_FOLLOWING;k.push(j),j=j.parentNode}k.reverse();for(var q=[],Z=C.parentNode;Z;){if(!o&&Z===D)return z.DOCUMENT_POSITION_CONTAINS+z.DOCUMENT_POSITION_PRECEDING;q.push(Z),Z=Z.parentNode}q.reverse();var he=re(k,q);for(var ge in he.childNodes){var Se=he.childNodes[ge];if(Se===C)return z.DOCUMENT_POSITION_FOLLOWING;if(Se===D)return z.DOCUMENT_POSITION_PRECEDING;if(q.indexOf(Se)>=0)return z.DOCUMENT_POSITION_FOLLOWING;if(k.indexOf(Se)>=0)return z.DOCUMENT_POSITION_PRECEDING}return 0}};function ce(E){return E=="<"&&"&lt;"||E==">"&&"&gt;"||E=="&"&&"&amp;"||E=='"'&&"&quot;"||"&#"+E.charCodeAt()+";"}A(M,J),A(M,J.prototype),A(z,J),A(z,J.prototype);function ye(E,D){fe(E,null,{enter:function(C){return D(C)?fe.STOP:!0}})}function fe(E,D,C){for(var o=[{node:E,context:D,phase:fe.ENTER}];o.length>0;){var h=o.pop();if(h.phase===fe.ENTER){var _=C.enter(h.node,h.context);if(_===fe.STOP)return fe.STOP;if(o.push({node:h.node,context:_,phase:fe.EXIT}),_==null)continue;for(var N=h.node.lastChild;N;)o.push({node:N,context:_,phase:fe.ENTER}),N=N.previousSibling}else C.exit&&C.exit(h.node,h.context)}}fe.STOP=Symbol("walkDOM.STOP"),fe.ENTER=0,fe.EXIT=1;function ve(E,D){s(E);var C=D||{};this.ownerDocument=this,this.contentType=C.contentType||d.XML_APPLICATION,this.type=a(this.contentType)?"html":"xml"}function Ee(E,D,C){E&&E._inc++;var o=C.namespaceURI;o===v.XMLNS&&(D._nsMap[C.prefix?C.localName:""]=C.value)}function we(E,D,C,o){E&&E._inc++;var h=C.namespaceURI;h===v.XMLNS&&delete D._nsMap[C.prefix?C.localName:""]}function Be(E,D,C){if(E&&E._inc){E._inc++;var o=D.childNodes;if(C&&!C.nextSibling)o[o.length++]=C;else{for(var h=D.firstChild,_=0;h;)o[_++]=h,h=h.nextSibling;o.length=_,delete o[o.length]}}}function qe(E,D){if(E!==D.parentNode)throw new c(c.NOT_FOUND_ERR,"child's parent is not parent");var C=D.previousSibling,o=D.nextSibling;return C?C.nextSibling=o:E.firstChild=o,o?o.previousSibling=C:E.lastChild=C,Be(E.ownerDocument,E),D.parentNode=null,D.previousSibling=null,D.nextSibling=null,D}function ze(E){return E&&(E.nodeType===J.DOCUMENT_NODE||E.nodeType===J.DOCUMENT_FRAGMENT_NODE||E.nodeType===J.ELEMENT_NODE)}function Ze(E){return E&&(E.nodeType===J.CDATA_SECTION_NODE||E.nodeType===J.COMMENT_NODE||E.nodeType===J.DOCUMENT_FRAGMENT_NODE||E.nodeType===J.DOCUMENT_TYPE_NODE||E.nodeType===J.ELEMENT_NODE||E.nodeType===J.PROCESSING_INSTRUCTION_NODE||E.nodeType===J.TEXT_NODE)}function me(E){return E&&E.nodeType===J.DOCUMENT_TYPE_NODE}function Le(E){return E&&E.nodeType===J.ELEMENT_NODE}function De(E){return E&&E.nodeType===J.TEXT_NODE}function Je(E,D){var C=E.childNodes||[];if(i(C,Le)||me(D))return!1;var o=i(C,me);return!(D&&o&&C.indexOf(o)>C.indexOf(D))}function je(E,D){var C=E.childNodes||[];function o(_){return Le(_)&&_!==D}if(i(C,o))return!1;var h=i(C,me);return!(D&&h&&C.indexOf(h)>C.indexOf(D))}function Qe(E,D,C){if(!ze(E))throw new c(c.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+E.nodeType);if(C&&C.parentNode!==E)throw new c(c.NOT_FOUND_ERR,"child not in parent");
2if(!Ze(D)||me(D)&&E.nodeType!==J.DOCUMENT_NODE)throw new c(c.HIERARCHY_REQUEST_ERR,"Unexpected node type "+D.nodeType+" for parent node type "+E.nodeType)}function et(E,D,C){var o=E.childNodes||[],h=D.childNodes||[];if(D.nodeType===J.DOCUMENT_FRAGMENT_NODE){var _=h.filter(Le);if(_.length>1||i(h,De))throw new c(c.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(_.length===1&&!Je(E,C))throw new c(c.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(Le(D)&&!Je(E,C))throw new c(c.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(me(D)){if(i(o,me))throw new c(c.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var N=i(o,Le);if(C&&o.indexOf(N)<o.indexOf(C))throw new c(c.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element");if(!C&&N)throw new c(c.HIERARCHY_REQUEST_ERR,"Doctype can not be appended since element is present")}}function ie(E,D,C){var o=E.childNodes||[],h=D.childNodes||[];if(D.nodeType===J.DOCUMENT_FRAGMENT_NODE){var _=h.filter(Le);if(_.length>1||i(h,De))throw new c(c.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(_.length===1&&!je(E,C))throw new c(c.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(Le(D)&&!je(E,C))throw new c(c.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(me(D)){if(i(o,function(j){return me(j)&&j!==C}))throw new c(c.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var N=i(o,Le);if(C&&o.indexOf(N)<o.indexOf(C))throw new c(c.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element")}}function _e(E,D,C,o){Qe(E,D,C),E.nodeType===J.DOCUMENT_NODE&&(o||et)(E,D,C);var h=D.parentNode;if(h&&h.removeChild(D),D.nodeType===V){var _=D.firstChild;if(_==null)return D;var N=D.lastChild}else _=N=D;var k=C?C.previousSibling:E.lastChild;_.previousSibling=k,N.nextSibling=C,k?k.nextSibling=_:E.firstChild=_,C==null?E.lastChild=N:C.previousSibling=N;do _.parentNode=E;while(_!==N&&(_=_.nextSibling));return Be(E.ownerDocument||E,E,D),D.nodeType==V&&(D.firstChild=D.lastChild=null),D}ve.prototype={implementation:null,nodeName:"#document",nodeType:U,doctype:null,documentElement:null,_inc:1,insertBefore:function(E,D){if(E.nodeType===V){for(var C=E.firstChild;C;){var o=C.nextSibling;this.insertBefore(C,D),C=o}return E}return _e(this,E,D),E.ownerDocument=this,this.documentElement===null&&E.nodeType===P&&(this.documentElement=E),E},removeChild:function(E){var D=qe(this,E);return D===this.documentElement&&(this.documentElement=null),D},replaceChild:function(E,D){_e(this,E,D,ie),E.ownerDocument=this,D&&this.removeChild(D),Le(E)&&(this.documentElement=E)},importNode:function(E,D){return $e(this,E,D)},getElementById:function(E){var D=null;return ye(this.documentElement,function(C){if(C.nodeType==P&&C.getAttribute("id")==E)return D=C,!0}),D},createElement:function(E){var D=new Ne(T);D.ownerDocument=this,this.type==="html"&&(E=E.toLowerCase()),t(this.contentType)&&(D.namespaceURI=v.HTML),D.nodeName=E,D.tagName=E,D.localName=E,D.childNodes=new X;var C=D.attributes=new oe;return C._ownerElement=D,D},createDocumentFragment:function(){var E=new Ge(T);return E.ownerDocument=this,E.childNodes=new X,E},createTextNode:function(E){var D=new We(T);return D.ownerDocument=this,D.childNodes=new X,D.appendData(E),D},createComment:function(E){var D=new Xe(T);return D.ownerDocument=this,D.childNodes=new X,D.appendData(E),D},createCDATASection:function(E){if(E.indexOf("]]>")!==-1)throw new c(c.INVALID_CHARACTER_ERR,'data contains "]]>"');var D=new tt(T);return D.ownerDocument=this,D.childNodes=new X,D.appendData(E),D},createProcessingInstruction:function(E,D){var C=new it(T);return C.ownerDocument=this,C.childNodes=new X,C.nodeName=C.target=E,C.nodeValue=C.data=D,C},createAttribute:function(E){if(!n.QName_exact.test(E))throw new c(c.INVALID_CHARACTER_ERR,'invalid character in name "'+E+'"');return this.type==="html"&&(E=E.toLowerCase()),this._createAttribute(E)},_createAttribute:function(E){var D=new Ie(T);return D.ownerDocument=this,D.childNodes=new X,D.name=E,D.nodeName=E,D.localName=E,D.specified=!0,D},createEntityReference:function(E){if(!n.Name.test(E))throw new c(c.INVALID_CHARACTER_ERR,'not a valid xml name "'+E+'"');
2if(this.type==="html")throw new c("document is an html document",u.NotSupportedError);var D=new rt(T);return D.ownerDocument=this,D.childNodes=new X,D.nodeName=E,D},createElementNS:function(E,D){var C=I(E,D),o=new Ne(T),h=o.attributes=new oe;return o.childNodes=new X,o.ownerDocument=this,o.nodeName=D,o.tagName=D,o.namespaceURI=C[0],o.prefix=C[1],o.localName=C[2],h._ownerElement=o,o},createAttributeNS:function(E,D){var C=I(E,D),o=new Ie(T);return o.ownerDocument=this,o.childNodes=new X,o.nodeName=D,o.name=D,o.specified=!0,o.namespaceURI=C[0],o.prefix=C[1],o.localName=C[2],o}},x(ve,J);function Ne(E){s(E),this._nsMap=Object.create(null)}Ne.prototype={nodeType:P,attributes:null,getQualifiedName:function(){return this.prefix?this.prefix+":"+this.localName:this.localName},_isInHTMLDocumentAndNamespace:function(){return this.ownerDocument.type==="html"&&this.namespaceURI===v.HTML},hasAttributes:function(){return!!(this.attributes&&this.attributes.length)},hasAttribute:function(E){return!!this.getAttributeNode(E)},getAttribute:function(E){var D=this.getAttributeNode(E);return D?D.value:null},getAttributeNode:function(E){return this._isInHTMLDocumentAndNamespace()&&(E=E.toLowerCase()),this.attributes.getNamedItem(E)},setAttribute:function(E,D){this._isInHTMLDocumentAndNamespace()&&(E=E.toLowerCase());var C=this.getAttributeNode(E);C?C.value=C.nodeValue=""+D:(C=this.ownerDocument._createAttribute(E),C.value=C.nodeValue=""+D,this.setAttributeNode(C))},removeAttribute:function(E){var D=this.getAttributeNode(E);D&&this.removeAttributeNode(D)},setAttributeNode:function(E){return this.attributes.setNamedItem(E)},setAttributeNodeNS:function(E){return this.attributes.setNamedItemNS(E)},removeAttributeNode:function(E){return this.attributes.removeNamedItem(E.nodeName)},removeAttributeNS:function(E,D){var C=this.getAttributeNodeNS(E,D);C&&this.removeAttributeNode(C)},hasAttributeNS:function(E,D){return this.getAttributeNodeNS(E,D)!=null},getAttributeNS:function(E,D){var C=this.getAttributeNodeNS(E,D);return C?C.value:null},setAttributeNS:function(E,D,C){var o=I(E,D),h=o[2],_=this.getAttributeNodeNS(E,h);_?_.value=_.nodeValue=""+C:(_=this.ownerDocument.createAttributeNS(E,D),_.value=_.nodeValue=""+C,this.setAttributeNode(_))},getAttributeNodeNS:function(E,D){return this.attributes.getNamedItemNS(E,D)},getElementsByClassName:function(E){var D=y(E);return new K(this,function(C){var o=[];return D.length>0&&ye(C,function(h){if(h!==C&&h.nodeType===P){var _=h.getAttribute("class");if(_){var N=E===_;if(!N){var k=y(_);N=D.every(b(k))}N&&o.push(h)}}}),o})},getElementsByTagName:function(E){var D=(this.nodeType===U?this:this.ownerDocument).type==="html",C=E.toLowerCase();return new K(this,function(o){var h=[];return ye(o,function(_){if(!(_===o||_.nodeType!==P))if(E==="*")h.push(_);else{var N=_.getQualifiedName(),k=D&&_.namespaceURI===v.HTML?C:E;N===k&&h.push(_)}}),h})},getElementsByTagNameNS:function(E,D){return new K(this,function(C){var o=[];return ye(C,function(h){h!==C&&h.nodeType===P&&(E==="*"||h.namespaceURI===E)&&(D==="*"||h.localName==D)&&o.push(h)}),o})}},ve.prototype.getElementsByClassName=Ne.prototype.getElementsByClassName,ve.prototype.getElementsByTagName=Ne.prototype.getElementsByTagName,ve.prototype.getElementsByTagNameNS=Ne.prototype.getElementsByTagNameNS,x(Ne,J);function Ie(E){s(E),this.namespaceURI=null,this.prefix=null,this.ownerElement=null}Ie.prototype.nodeType=L,x(Ie,J);function Fe(E){s(E)}Fe.prototype={data:"",substringData:function(E,D){return this.data.substring(E,E+D)},appendData:function(E){E=this.data+E,this.nodeValue=this.data=E,this.length=E.length},insertData:function(E,D){this.replaceData(E,0,D)},deleteData:function(E,D){this.replaceData(E,D,"")},replaceData:function(E,D,C){var o=this.data.substring(0,E),h=this.data.substring(E+D);C=o+C+h,this.nodeValue=this.data=C,this.length=C.length}},x(Fe,J);function We(E){s(E)}We.prototype={nodeName:"#text",nodeType:G,splitText:function(E){var D=this.data,C=D.substring(E);D=D.substring(0,E),this.data=this.nodeValue=D,this.length=D.length;var o=this.ownerDocument.createTextNode(C);return this.parentNode&&this.parentNode.insertBefore(o,this.nextSibling),o}},x(We,Fe);function Xe(E){s(E)}Xe.prototype={nodeName:"#comment",nodeType:B},x(Xe,Fe);function tt(E){s(E)}tt.prototype={nodeName:"#cdata-section",nodeType:$},x(tt,We);function nt(E){s(E)}nt.prototype.nodeType=F,x(nt,J);function ot(E){s(E)}ot.prototype.nodeType=H,x(ot,J);function Me(E){s(E)}Me.prototype.nodeType=W,x(Me,J);function rt(E){s(E)}rt.prototype.nodeType=Q,x(rt,J);function Ge(E){s(E)}Ge.prototype.nodeName="#document-fragment",Ge.prototype.nodeType=V,x(Ge,J);function it(E){s(E)}it.prototype.nodeType=w,x(it,Fe);function dt(){}dt.prototype.serializeToString=function(E,D){return ft.call(E,D)},J.prototype.toString=ft;function ft(E){var D;typeof E=="function"?D={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:E}:E!=null?D={requireWellFormed:!!E.requireWellFormed,splitCDATASections:E.splitCDATASections!==!1,nodeFilter:E.nodeFilter||null}:D={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:null};var C=[],o=this.nodeType===U&&this.documentElement||this,h=o.prefix,_=o.namespaceURI;if(_&&h==null){var h=o.lookupPrefix(_);if(h==null)var N=[{namespace:_,prefix:null}]}return be(this,C,N,D),C.join("")}function ht(E,D,C){var o=E.prefix||"",h=E.namespaceURI;if(!h||o==="xml"&&h===v.XML||h===v.XMLNS)return!1;for(var _=C.length;_--;){var N=C[_];if(N.prefix===o)return N.namespace!==h}return!0}function pe(E,D,C,o){if(o&&!n.QName_exact.test(D))throw new c('The attribute name "'+D+'" is not a valid XML QName',u.InvalidStateError);E.push(" ",D,'="',C.replace(/[<>&"\t\n\r]/g,ce),'"')}function be(E,D,C,o){C||(C=[]);var h=o.nodeFilter,_=o.requireWellFormed,N=o.splitCDATASections,k=E.nodeType===U?E:E.ownerDocument,j=k.type==="html";fe(E,{ns:C}
2,{enter:function(q,Z){var he=Z.ns;if(h)if(q=h(q),q){if(typeof q=="string")return D.push(q),null}else return null;switch(q.nodeType){case P:var ge=q.attributes,Se=ge.length,Pe=q.tagName,ke=Pe;if(!j&&!q.prefix&&q.namespaceURI){for(var Ke,Ae=0;Ae<ge.length;Ae++)if(ge.item(Ae).name==="xmlns"){Ke=ge.item(Ae).value;break}if(!Ke)for(var Ue=he.length-1;Ue>=0;Ue--){var at=he[Ue];if(at.prefix===""&&at.namespace===q.namespaceURI){Ke=at.namespace;break}}if(Ke!==q.namespaceURI)for(var Ue=he.length-1;Ue>=0;Ue--){var at=he[Ue];if(at.namespace===q.namespaceURI){at.prefix&&(ke=at.prefix+":"+Pe);break}}}if(_&&!n.QName_exact.test(ke))throw new c('The element name "'+ke+'" is not a valid XML QName',u.InvalidStateError);D.push("<",ke);for(var st=he.slice(),ut=0;ut<Se;ut++){var He=ge.item(ut);He.prefix=="xmlns"?st.push({prefix:He.localName,namespace:He.value}):He.nodeName=="xmlns"&&st.push({prefix:"",namespace:He.value})}for(var ut=0;ut<Se;ut++){var He=ge.item(ut);if(ht(He,j,st)){var Jt=He.prefix||"",St=He.namespaceURI;pe(D,Jt?"xmlns:"+Jt:"xmlns",St,_),st.push({prefix:Jt,namespace:St})}var Tt=h?h(He):He;Tt&&(typeof Tt=="string"?D.push(Tt):pe(D,Tt.name,Tt.value,_))}if(Pe===ke&&ht(q,j,st)){var Wt=q.prefix||"",St=q.namespaceURI;pe(D,Wt?"xmlns:"+Wt:"xmlns",St,_),st.push({prefix:Wt,namespace:St})}var Xt=!q.firstChild;if(Xt&&(j||q.namespaceURI===v.HTML)&&(Xt=p(Pe)),Xt)return D.push("/>"),null;if(D.push(">"),j&&f(Pe)){for(var gt=q.firstChild;gt;)gt.data?D.push(gt.data):be(gt,D,st.slice(),o),gt=gt.nextSibling;return D.push("</",ke,">"),null}return{ns:st,tag:ke};case U:case V:if(_&&q.nodeType===U&&q.documentElement==null)throw new c("The Document has no documentElement",u.InvalidStateError);return{ns:he};case L:return pe(D,q.name,q.value,_),null;case G:if(_&&n.InvalidChar.test(q.data))throw new c("The Text node data contains characters outside the XML Char production",u.InvalidStateError);return D.push(q.data.replace(/[<&>]/g,ce)),null;case $:if(_&&q.data.indexOf("]]>")!==-1)throw new c('The CDATASection data contains "]]>"',u.InvalidStateError);return N?D.push(n.CDATA_START,q.data.replace(/]]>/g,"]]]]><![CDATA[>"),n.CDATA_END):D.push(n.CDATA_START,q.data,n.CDATA_END),null;case B:if(_){if(n.InvalidChar.test(q.data))throw new c("The comment node data contains characters outside the XML Char production",u.InvalidStateError);if(q.data.indexOf("--")!==-1||q.data[q.data.length-1]==="-")throw new c('The comment node data contains "--" or ends with "-"',u.InvalidStateError)}return D.push(n.COMMENT_START,q.data,n.COMMENT_END),null;case F:var Ot=q.publicId,Ye=q.systemId;if(_){if(Ot&&!n.PubidLiteral_match.test(Ot))throw new c("DocumentType publicId is not a valid PubidLiteral",u.InvalidStateError);if(Ye&&Ye!=="."&&!n.SystemLiteral_match.test(Ye))throw new c("DocumentType systemId is not a valid SystemLiteral",u.InvalidStateError);if(q.internalSubset&&q.internalSubset.indexOf("]>")!==-1)throw new c('DocumentType internalSubset contains "]>"',u.InvalidStateError)}return D.push(n.DOCTYPE_DECL_START," ",q.name),Ot?(D.push(" ",n.PUBLIC," ",Ot),Ye&&Ye!=="."&&D.push(" ",Ye)):Ye&&Ye!=="."&&D.push(" ",n.SYSTEM," ",Ye),q.internalSubset&&D.push(" [",q.internalSubset,"]"),D.push(">"),null;case w:if(_){if(q.target.indexOf(":")!==-1||q.target.toLowerCase()==="xml")throw new c("The ProcessingInstruction target is not well-formed",u.InvalidStateError);if(n.InvalidChar.test(q.data))throw new c("The ProcessingInstruction data contains characters outside the XML Char production",u.InvalidStateError);if(q.data.indexOf("?>")!==-1)throw new c('The ProcessingInstruction data contains "?>"',u.InvalidStateError)}return D.push("<?",q.target," ",q.data,"?>"),null;case Q:return D.push("&",q.nodeName,";"),null;default:return D.push("??",q.nodeName),null}},exit:function(q,Z){Z&&Z.tag&&D.push("</",Z.tag,">")}})}function $e(E,D,C){var o;return fe(D,null,{enter:function(h,_){var N=h.cloneNode(!1);N.ownerDocument=E,N.parentNode=null,_===null?o=N:_.appendChild(N);var k=h.nodeType===L||C;return k?N:null}}),o}function O(E,D,C){var o;return fe(D,null,{enter:function(h,_){var N=new h.constructor(T);for(var k in h)if(r(h,k)){var j=h[k];typeof j!="object"&&j!=N[k]&&(N[k]=j)}h.childNodes&&(N.childNodes=new X),N.ownerDocument=E;var q=C;
2switch(N.nodeType){case P:var Z=h.attributes,he=N.attributes=new oe,ge=Z.length;he._ownerElement=N;for(var Se=0;Se<ge;Se++)N.setAttributeNode(O(E,Z.item(Se),!0));break;case L:q=!0}return _!==null?_.appendChild(N):o=N,q?N:null}}),o}function xt(E,D,C){E[D]=C}function pt(E){for(var D=[],C=E.firstChild;C;)C.nodeType===P&&D.push(C),C=C.nextSibling;return D}try{Object.defineProperty&&(Object.defineProperty(K.prototype,"length",{get:function(){return ee(this),this.$$length}}),Object.defineProperty(J.prototype,"textContent",{get:function(){if(this.nodeType===P||this.nodeType===V){var E=[];return fe(this,null,{enter:function(D){if(D.nodeType===P||D.nodeType===V)return!0;if(D.nodeType===w||D.nodeType===B)return null;E.push(D.nodeValue)}}),E.join("")}return this.nodeValue},set:function(E){switch(this.nodeType){case P:case V:for(;this.firstChild;)this.removeChild(this.firstChild);(E||String(E))&&this.appendChild(this.ownerDocument.createTextNode(E));break;default:this.data=E,this.value=E,this.nodeValue=E}}}),Object.defineProperty(Fe.prototype,"data",{get:function(){return this._data!=null?this._data:""},set:function(E){this._data=E,this.length=typeof E=="string"?E.length:0}}),Object.defineProperty(Fe.prototype,"nodeValue",{get:function(){return this.data},set:function(E){this.data=E},enumerable:!0,configurable:!0}),Object.defineProperty(Ne.prototype,"children",{get:function(){return new K(this,pt)}}),Object.defineProperty(ve.prototype,"children",{get:function(){return new K(this,pt)}}),Object.defineProperty(Ge.prototype,"children",{get:function(){return new K(this,pt)}}),xt=function(E,D,C){E["$$"+D]=C})}catch{}return Te._updateLiveList=ee,Te.Attr=Ie,Te.CDATASection=tt,Te.CharacterData=Fe,Te.Comment=Xe,Te.Document=ve,Te.DocumentFragment=Ge,Te.DocumentType=nt,Te.DOMImplementation=te,Te.Element=Ne,Te.Entity=Me,Te.EntityReference=rt,Te.LiveNodeList=K,Te.NamedNodeMap=oe,Te.Node=J,Te.NodeList=X,Te.Notation=ot,Te.Text=We,Te.ProcessingInstruction=it,Te.walkDOM=fe,Te.XMLSerializer=dt,Te}var ct={},ln={},lr;function hs(){return lr||(lr=1,(function(e){var i=Ct().freeze;e.XML_ENTITIES=i({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),e.HTML_ENTITIES=i
vendor: 14,815 bytes, line 2
2({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:
2`
3`
vendor: 9,925 bytes, line 3
3,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"
3	",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),e.entityMap=e.HTML_ENTITIES})(ln)),ln}var _t={},dr;function ps(){if(dr)return _t;dr=1;var e=Ct(),i=zr(),t=Qt(),r=e.isHTMLEscapableRawTextElement,a=e.isHTMLMimeType,f=e.isHTMLRawTextElement,p=e.hasOwn,d=e.NAMESPACE,v=t.ParseError,T=t.DOMException,g=0,c=1,u=2,n=3,s=4,S=5,l=6,m=7;function y(){}y.prototype={parse:function(w,B,U){var F=this.domBuilder;F.startDocument(),P(B,B=Object.create(null)),R(w,B,U,F,this.errorHandler),F.endDocument()}};var b=/&#?\w+;?/g;function R(w,B,U,F,V){var H=a(F.mimeType);w.indexOf(i.UNICODE_REPLACEMENT_CHARACTER)>=0&&V.warning("Unicode replacement character detected, source encoding issues?");function z(ie){if(ie>65535){ie-=65536;var _e=55296+(ie>>10),Ne=56320+(ie&1023);return String.fromCharCode(_e,Ne)}else return String.fromCharCode(ie)}function re(ie){var _e=ie[ie.length-1]===";"?ie:ie+";";if(!H&&_e!==ie)return V.error("EntityRef: expecting ;"),ie;var Ne=i.Reference.exec(_e);
3if(!Ne||Ne[0].length!==_e.length)return V.error("entity not matching Reference production: "+ie),ie;var Ie=_e.slice(1,-1);return p(U,Ie)?U[Ie]:Ie.charAt(0)==="#"?z(parseInt(Ie.substring(1).replace("x","0x"))):(V.error("entity not found:"+ie),ie)}function Y(ie){if(ie>te){var _e=w.substring(te,ie).replace(b,re);oe&&Ce(te),F.characters(_e,0,ie-te),te=ie}}var X=0,K=0,ee=/\r\n?|\n|$/g,oe=F.locator;function Ce(ie,_e){for(;ie>=K&&(_e=ee.exec(w));)X=K,K=_e.index+_e[0].length,oe.lineNumber++;oe.columnNumber=ie-X+1}for(var ae=[{currentNSMap:B}],le=[],te=0;;){try{var J=w.indexOf("<",te);if(J<0){if(!H&&le.length>0)return V.fatalError("unclosed xml tag(s): "+le.join(", "));if(!w.substring(te).match(/^\s*$/)){var ce=F.doc,ye=ce.createTextNode(w.substring(te));if(ce.documentElement)return V.error("Extra content at the end of the document");ce.appendChild(ye),F.currentElement=ye}return}if(J>te){var fe=w.substring(te,J);!H&&le.length===0&&(fe=fe.replace(new RegExp(i.S_OPT.source,"g"),""),fe&&V.error("Unexpected content outside root element: '"+fe+"'")),Y(J)}switch(w.charAt(J+1)){case"/":var De=w.indexOf(">",J+2),ve=w.substring(J+2,De>0?De:void 0);if(!ve)return V.fatalError("end tag name missing");var Ee=De>0&&i.reg("^",i.QName_group,i.S_OPT,"$").exec(ve);if(!Ee)return V.fatalError('end tag name contains invalid characters: "'+ve+'"');if(!F.currentElement&&!F.doc.documentElement)return;var we=le[le.length-1]||F.currentElement.tagName||F.doc.documentElement.tagName||"";if(we!==Ee[1]){var Be=Ee[1].toLowerCase();if(!H||we.toLowerCase()!==Be)return V.fatalError('Opening and ending tag mismatch: "'+we+'" != "'+ve+'"')}var qe=ae.pop();le.pop();var ze=qe.localNSMap;if(F.endElement(qe.uri,qe.localName,we),ze)for(var Ze in ze)p(ze,Ze)&&F.endPrefixMapping(Ze);De++;break;case"?":oe&&Ce(J),De=Q(w,J,F,V);break;case"!":oe&&Ce(J),De=$(w,J,F,V,H);break;default:oe&&Ce(J);var me=new W,Le=ae[ae.length-1].currentNSMap,De=A(w,J,me,Le,re,V,H),Je=me.length;if(me.closed||(H&&e.isHTMLVoidElement(me.tagName)?me.closed=!0:le.push(me.tagName)),oe&&Je){for(var je=I(oe,{}),Qe=0;Qe<Je;Qe++){var et=me[Qe];Ce(et.offset),et.locator=I(oe,{})}F.locator=je,x(me,F,Le)&&ae.push(me),F.locator=oe}else x(me,F,Le)&&ae.push(me);H&&!me.closed?De=M(w,De,me.tagName,re,F):De++}}catch(ie){if(ie instanceof v)throw ie;if(ie instanceof T)throw new v(ie.name+": "+ie.message,F.locator,ie);V.error("element parse error: "+ie),De=-1}De>te?te=De:Y(Math.max(J,te)+1)}}function I(w,B){return B.lineNumber=w.lineNumber,B.columnNumber=w.columnNumber,B}function A(w,B,U,F,V,H,z){function re(Ce,ae,le){if(p(U.attributeNames,Ce))return H.fatalError("Attribute "+Ce+" redefined");if(!z&&ae.indexOf("<")>=0)return H.fatalError("Unescaped '<' not allowed in attributes values");U.addValue(Ce,ae.replace(/[\t\n\r]/g," ").replace(b,V),le)}for(var Y,X,K=++B,ee=g;;){var oe=w.charAt(K);switch(oe){case"=":if(ee===c)Y=w.slice(B,K),ee=n;else if(ee===u)ee=n;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(ee===n||ee===c)if(ee===c&&(H.warning('attribute value must after "="'),Y=w.slice(B,K)),B=K+1,K=w.indexOf(oe,B),K>0)X=w.slice(B,K),re(Y,X,B-1),ee=S;else throw new Error("attribute value no end '"+oe+"' match");else if(ee==s)X=w.slice(B,K),re(Y,X,B),H.warning('attribute "'+Y+'" missed start quot('+oe+")!!"),B=K+1,ee=S;else throw new Error('attribute value must after "="');break;case"/":switch(ee){case g:U.setTagName(w.slice(B,K));case S:case l:case m:ee=m,U.closed=!0;case s:case c:break;case u:U.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return H.error("unexpected end of input"),ee==g&&U.setTagName(w.slice(B,K)),K;case">":switch(ee){case g:U.setTagName(w.slice(B,K));case S:case l:case m:break;case s:case c:X=w.slice(B,K),X.slice(-1)==="/"&&(U.closed=!0,X=X.slice(0,-1));case u:ee===u&&(X=Y),ee==s?(H.warning('attribute "'+X+'" missed quot(")!'),re(Y,X,B)):(z||H.warning('attribute "'+X+'" missed value!! "'+X+'" instead!!'),re(X,X,B));break;case n:if(!z)return H.fatalError(`AttValue: ' or " expected`)}return K;case"€":oe=" ";default:if(oe<=" ")switch(ee){case g:U.setTagName(w.slice(B,K)),ee=l;break;case c:Y=w.slice(B,K),ee=u;break;case s:var X=w.slice(B,K);H.warning('attribute "'+X+'" missed quot(")!!'),re(Y,X,B);case S:ee=l;break}else switch(ee){case u:z||H.warning('attribute "'+Y+'" missed value!! "'+Y+'" instead2!!'),re(Y,Y,B),B=K,ee=c;break;case S:H.warning('attribute space is required"'+Y+'"!!');case l:ee=c,B=K;break;case n:ee=s,B=K;break;case m:throw new Error("elements closed character '/' and '>' must be connected to")}}K++}}function x(w,B,U){for(var F=w.tagName,V=null,ee=w.length;ee--;){var H=w[ee],z=H.qName,re=H.value,oe=z.indexOf(":");if(oe>0)var Y=H.prefix=z.slice(0,oe),X=z.slice(oe+1),K=Y==="xmlns"&&X;else X=z,Y=null,K=z==="xmlns"&&"";H.localName=X,K!==!1&&(V==null&&(V=Object.create(null),P(U,U=Object.create(null))),U[K]=V[K]=re,H.uri=d.XMLNS,B.startPrefixMapping(K,re))}for(var ee=w.length;ee--;)H=w[ee],H.prefix&&(H.prefix==="xml"&&(H.uri=d.XML),H.prefix!=="xmlns"&&(H.uri=U[H.prefix]));var oe=F.indexOf(":");oe>0?(Y=w.prefix=F.slice(0,oe),X=w.localName=F.slice(oe+1)):(Y=null,X=w.localName=F);var Ce=w.uri=U[Y||""];if(B.startElement(Ce,X,F,w),w.closed){if(B.endElement(Ce,X,F),V)for(Y in V)p(V,Y)&&B.endPrefixMapping(Y)}else return w.currentNSMap=U,w.localNSMap=V,!0}function M(w,B,U,F,V){var H=r(U);if(H||f(U)){var z=w.indexOf("</"+U+">",B),re=w.substring(B+1,z);return H&&(re=re.replace(b,F)),V.characters(re,0,re.length),z}return B+1}function P(w,B){for(var U in w)p(w,U)&&(B[U]=w[U])}function L(w,B){var U=B;function F(K){return K=K||0,w.charAt(U+K)}function V(K){K=K||1,U+=K}function H(){for(var K=0;U<w.length;){var ee=F();if(ee!==" "&&ee!==`
4`&&ee!=="	"&&ee!=="\r")return K;K++,V()}return-1}function z(){return w.substring(U)}function re(K){return w.substring(U,U+K.length)===K}function Y(K){return w.substring(U,U+K.length).toUpperCase()===K.toUpperCase()}function X(K){var ee=i.reg("^",K),oe=ee.exec(z());return oe?(V(oe[0].length),oe[0]):null}return{char:F,getIndex:function(){return U}
4,getMatch:X,getSource:function(){return w},skip:V,skipBlanks:H,substringFromIndex:z,substringStartsWith:re,substringStartsWithCaseInsensitive:Y}}function G(w,B){function U(re,Y){var X=i.PI.exec(re.substringFromIndex());return X?X[1].toLowerCase()==="xml"?Y.fatalError("xml declaration is only allowed at the start of the document, but found at position "+re.getIndex()):(re.skip(X[0].length),X[0]):Y.fatalError("processing instruction is not well-formed at position "+re.getIndex())}var F=w.getSource();if(w.char()==="["){w.skip(1);for(var V=w.getIndex();w.getIndex()<F.length;){if(w.skipBlanks(),w.char()==="]"){var H=F.substring(V,w.getIndex());return w.skip(1),H}var z=null;if(w.char()==="<"&&w.char(1)==="!")switch(w.char(2)){case"E":w.char(3)==="L"?z=w.getMatch(i.elementdecl):w.char(3)==="N"&&(z=w.getMatch(i.EntityDecl));break;case"A":z=w.getMatch(i.AttlistDecl);break;case"N":z=w.getMatch(i.NotationDecl);break;case"-":z=w.getMatch(i.Comment);break}else if(w.char()==="<"&&w.char(1)==="?")z=U(w,B);else if(w.char()==="%")z=w.getMatch(i.PEReference);else return B.fatalError("Error detected in Markup declaration");if(!z)return B.fatalError("Error in internal subset at position "+w.getIndex())}return B.fatalError("doctype internal subset is not well-formed, missing ]")}}function $(w,B,U,F,V){var H=L(w,B);switch(V?H.char(2).toUpperCase():H.char(2)){case"-":var z=H.getMatch(i.Comment);return z?(U.comment(z,i.COMMENT_START.length,z.length-i.COMMENT_START.length-i.COMMENT_END.length),H.getIndex()):F.fatalError("comment is not well-formed at position "+H.getIndex());case"[":var re=H.getMatch(i.CDSect);return re?!V&&!U.currentElement?F.fatalError("CDATA outside of element"):(U.startCDATA(),U.characters(re,i.CDATA_START.length,re.length-i.CDATA_START.length-i.CDATA_END.length),U.endCDATA(),H.getIndex()):F.fatalError("Invalid CDATA starting at position "+B);case"D":{if(U.doc&&U.doc.documentElement)return F.fatalError("Doctype not allowed inside or after documentElement at position "+H.getIndex());if(V?!H.substringStartsWithCaseInsensitive(i.DOCTYPE_DECL_START):!H.substringStartsWith(i.DOCTYPE_DECL_START))return F.fatalError("Expected "+i.DOCTYPE_DECL_START+" at position "+H.getIndex());if(H.skip(i.DOCTYPE_DECL_START.length),H.skipBlanks()<1)return F.fatalError("Expected whitespace after "+i.DOCTYPE_DECL_START+" at position "+H.getIndex());var Y={name:void 0,publicId:void 0,systemId:void 0,internalSubset:void 0};if(Y.name=H.getMatch(i.Name),!Y.name)return F.fatalError("doctype name missing or contains unexpected characters at position "+H.getIndex());if(V&&Y.name.toLowerCase()!=="html"&&F.warning("Unexpected DOCTYPE in HTML document at position "+H.getIndex()),H.skipBlanks(),H.substringStartsWith(i.PUBLIC)||H.substringStartsWith(i.SYSTEM)){var X=i.ExternalID_match.exec(H.substringFromIndex());if(!X)return F.fatalError("doctype external id is not well-formed at position "+H.getIndex());X.groups.SystemLiteralOnly!==void 0?Y.systemId=X.groups.SystemLiteralOnly:(Y.systemId=X.groups.SystemLiteral,Y.publicId=X.groups.PubidLiteral),H.skip(X[0].length)}else if(V&&H.substringStartsWithCaseInsensitive(i.SYSTEM)){if(H.skip(i.SYSTEM.length),H.skipBlanks()<1)return F.fatalError("Expected whitespace after "+i.SYSTEM+" at position "+H.getIndex());if(Y.systemId=H.getMatch(i.ABOUT_LEGACY_COMPAT_SystemLiteral),!Y.systemId)return F.fatalError("Expected "+i.ABOUT_LEGACY_COMPAT+" in single or double quotes after "+i.SYSTEM+" at position "+H.getIndex())}return V&&Y.systemId&&!i.ABOUT_LEGACY_COMPAT_SystemLiteral.test(Y.systemId)&&F.warning("Unexpected doctype.systemId in HTML document at position "+H.getIndex()),V||(H.skipBlanks(),Y.internalSubset=G(H,F)),H.skipBlanks(),H.char()!==">"?F.fatalError("doctype not terminated with > at position "+H.getIndex()):(H.skip(1),U.startDTD(Y.name,Y.publicId,Y.systemId,Y.internalSubset),U.endDTD(),H.getIndex())}default:return F.fatalError('Not well-formed XML starting with "<!" at position '+B)}}function Q(w,B,U,F){var V=w.substring(B).match(i.PI);if(!V)return F.fatalError("Invalid processing instruction starting at position "+B);if(V[1].toLowerCase()==="xml"){if(B>0)return F.fatalError("processing instruction at position "+B+" is an xml declaration which is only at the start of the document");
4if(!i.XMLDecl.test(w.substring(B)))return F.fatalError("xml declaration is not well-formed")}return U.processingInstruction(V[1],V[2]),B+V[0].length}function W(){this.attributeNames=Object.create(null)}return W.prototype={setTagName:function(w){if(!i.QName_exact.test(w))throw new Error("invalid tagName:"+w);this.tagName=w},addValue:function(w,B,U){if(!i.QName_exact.test(w))throw new Error("invalid attribute:"+w);this.attributeNames[w]=this.length,this[this.length++]={qName:w,value:B,offset:U}},length:0,getLocalName:function(w){return this[w].localName},getLocator:function(w){return this[w].locator},getQName:function(w){return this[w].qName},getURI:function(w){return this[w].uri},getValue:function(w){return this[w].value}},_t.XMLReader=y,_t.parseUtils=L,_t.parseDoctypeCommentOrCData=$,_t}var fr;function gs(){if(fr)return ct;fr=1;var e=Ct(),i=Jr(),t=Qt(),r=hs(),a=ps(),f=i.DOMImplementation,p=e.hasDefaultHTMLNamespace,d=e.isHTMLMimeType,v=e.isValidMimeType,T=e.MIME_TYPE,g=e.NAMESPACE,c=t.ParseError,u=a.XMLReader;function n(A){return A.replace(/\r[\n\u0085]/g,`
5`).replace(/[\r\u0085\u2028\u2029]/g,`
6`)}function s(A){if(A=A||{},A.locator===void 0&&(A.locator=!0),this.assign=A.assign||e.assign,this.domHandler=A.domHandler||S,this.onError=A.onError||A.errorHandler,A.errorHandler&&typeof A.errorHandler!="function")throw new TypeError("errorHandler object is no longer supported, switch to onError!");A.errorHandler&&A.errorHandler("warning","The `errorHandler` option has been deprecated, use `onError` instead!",this),this.normalizeLineEndings=A.normalizeLineEndings||n,this.locator=!!A.locator,this.xmlns=this.assign(Object.create(null),A.xmlns)}s.prototype.parseFromString=function(A,x){if(!v(x))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+x+'" is not valid.');var M=this.assign(Object.create(null),this.xmlns),P=r.XML_ENTITIES,L=M[""]||null;p(x)?(P=r.HTML_ENTITIES,L=g.HTML):x===T.XML_SVG_IMAGE&&(L=g.SVG),M[""]=L,M.xml=M.xml||g.XML;var G=new this.domHandler({mimeType:x,defaultNamespace:L,onError:this.onError}),$=this.locator?{}:void 0;this.locator&&G.setDocumentLocator($);var Q=new u;Q.errorHandler=G,Q.domBuilder=G;var W=!e.isHTMLMimeType(x);return W&&typeof A!="string"&&Q.errorHandler.fatalError("source is not a string"),Q.parse(this.normalizeLineEndings(String(A)),M,P),G.doc.documentElement||Q.errorHandler.fatalError("missing root element"),G.doc};function S(A){var x=A||{};this.mimeType=x.mimeType||T.XML_APPLICATION,this.defaultNamespace=x.defaultNamespace||null,this.cdata=!1,this.currentElement=void 0,this.doc=void 0,this.locator=void 0,this.onError=x.onError}function l(A,x){x.lineNumber=A.lineNumber,x.columnNumber=A.columnNumber}S.prototype={startDocument:function(){var A=new f;this.doc=d(this.mimeType)?A.createHTMLDocument(!1):A.createDocument(this.defaultNamespace,"")},startElement:function(A,x,M,P){var L=this.doc,G=L.createElementNS(A,M||x),$=P.length;b(this,G),this.currentElement=G,this.locator&&l(this.locator,G);for(var Q=0;Q<$;Q++){var A=P.getURI(Q),W=P.getValue(Q),M=P.getQName(Q),w=L.createAttributeNS(A,M);this.locator&&l(P.getLocator(Q),w),w.value=w.nodeValue=W,G.setAttributeNode(w)}},endElement:function(A,x,M){this.currentElement=this.currentElement.parentNode},startPrefixMapping:function(A,x){},endPrefixMapping:function(A){},processingInstruction:function(A,x){var M=this.doc.createProcessingInstruction(A,x);this.locator&&l(this.locator,M),b(this,M)},ignorableWhitespace:function(A,x,M){},characters:function(A,x,M){if(A=y.apply(this,arguments),A){if(this.cdata)var P=this.doc.createCDATASection(A);else var P=this.doc.createTextNode(A);this.currentElement?this.currentElement.appendChild(P):/^\s*$/.test(A)&&this.doc.appendChild(P),this.locator&&l(this.locator,P)}},skippedEntity:function(A){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(A){A&&(A.lineNumber=0),this.locator=A},comment:function(A,x,M){A=y.apply(this,arguments);var P=this.doc.createComment(A);this.locator&&l(this.locator,P),b(this,P)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(A,x,M,P){var L=this.doc.implementation;if(L&&L.createDocumentType){var G=L.createDocumentType(A,x,M,P);this.locator&&l(this.locator,G),b(this,G),this.doc.doctype=G}},reportError:function(A,x){if(typeof this.onError=="function")try{this.onError(A,x,this)}catch(M){throw new c("Reporting "+A+' "'+x+'" caused '+M,this.locator)}else console.error("[xmldom "+A+"]	"+x,m(this.locator))},warning:function(A){this.reportError("warning",A)},error:function(A){this.reportError("error",A)},fatalError:function(A){throw this.reportError("fatalError",A),new c(A,this.locator)}};function m(A){if(A)return`
7@#[line:`+A.lineNumber+",col:"+A.columnNumber+"]"}function y(A,x,M){return typeof A=="string"?A.substr(x,M):A.length>=x+M||x?new java.lang.String(A,x,M)+"":A}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(A){S.prototype[A]=function(){return null}});function b(A,x){A.currentElement?A.currentElement.appendChild(x):A.doc.appendChild(x)}function R(A){if(A==="error")throw"onErrorStopParsing"}function I(){throw"onWarningStopParsing"}
7return ct.__DOMHandler=S,ct.DOMParser=s,ct.normalizeLineEndings=n,ct.onErrorStopParsing=R,ct.onWarningStopParsing=I,ct}var hr;function pr(){if(hr)return de;hr=1;var e=Ct();de.assign=e.assign,de.hasDefaultHTMLNamespace=e.hasDefaultHTMLNamespace,de.isHTMLMimeType=e.isHTMLMimeType,de.isValidMimeType=e.isValidMimeType,de.MIME_TYPE=e.MIME_TYPE,de.NAMESPACE=e.NAMESPACE;var i=Qt();de.DOMException=i.DOMException,de.DOMExceptionName=i.DOMExceptionName,de.ExceptionCode=i.ExceptionCode,de.ParseError=i.ParseError;var t=Jr();de.Attr=t.Attr,de.CDATASection=t.CDATASection,de.CharacterData=t.CharacterData,de.Comment=t.Comment,de.Document=t.Document,de.DocumentFragment=t.DocumentFragment,de.DocumentType=t.DocumentType,de.DOMImplementation=t.DOMImplementation,de.Element=t.Element,de.Entity=t.Entity,de.EntityReference=t.EntityReference,de.LiveNodeList=t.LiveNodeList,de.NamedNodeMap=t.NamedNodeMap,de.Node=t.Node,de.NodeList=t.NodeList,de.Notation=t.Notation,de.ProcessingInstruction=t.ProcessingInstruction,de.Text=t.Text,de.XMLSerializer=t.XMLSerializer;var r=gs();return de.DOMParser=r.DOMParser,de.normalizeLineEndings=r.normalizeLineEndings,de.onErrorStopParsing=r.onErrorStopParsing,de.onWarningStopParsing=r.onWarningStopParsing,de}var ms=bt.exports,gr;function vt(){return gr||(gr=1,(function(e,i){(function(t,r){r(i)})(ms,(function(t){function r(){if(typeof globalThis.WebSocket>"u")try{return fs()}catch{throw new Error('You must install the "ws" package to use Strophe in nodejs.')}return globalThis.WebSocket}const a=r();function f(){let C=globalThis.DOMParser;if(typeof C>"u")try{C=pr().DOMParser}catch{throw new Error('You must install the "@xmldom/xmldom" package to use Strophe in nodejs.')}return C}const p=f();function d(){if(typeof document>"u")try{const C=pr().DOMImplementation;return new C().createDocument("jabber:client","strophe",null)}catch{throw new Error('You must install the "@xmldom/xmldom" package to use Strophe in nodejs.')}return document.implementation.createDocument("jabber:client","strophe",null)}var v=Object.freeze({__proto__:null,WebSocket:a,DOMParser:p,getDummyXMLDOMDocument:d});const T={HTTPBIND:"http://jabber.org/protocol/httpbind",BOSH:"urn:xmpp:xbosh",CLIENT:"jabber:client",AUTH:"jabber:iq:auth",ROSTER:"jabber:iq:roster",PROFILE:"jabber:iq:profile",DISCO_INFO:"http://jabber.org/protocol/disco#info",DISCO_ITEMS:"http://jabber.org/protocol/disco#items",MUC:"http://jabber.org/protocol/muc",SASL:"urn:ietf:params:xml:ns:xmpp-sasl",STREAM:"http://etherx.jabber.org/streams",FRAMING:"urn:ietf:params:xml:ns:xmpp-framing",BIND:"urn:ietf:params:xml:ns:xmpp-bind",SESSION:"urn:ietf:params:xml:ns:xmpp-session",VERSION:"jabber:iq:version",STANZAS:"urn:ietf:params:xml:ns:xmpp-stanzas",XHTML_IM:"http://jabber.org/protocol/xhtml-im",XHTML:"http://www.w3.org/1999/xhtml"},g={tags:["a","blockquote","br","cite","em","img","li","ol","p","span","strong","ul","body"],attributes:{a:["href"],blockquote:["style"],br:[],cite:["style"],em:[],img:["src","alt","style","height","width"],li:["style"],ol:["style"],p:["style"],span:["style"],strong:[],ul:["style"],body:[]},css:["background-color","color","font-family","font-size","font-style","font-weight","margin-left","margin-right","text-align","text-decoration"]},c={ERROR:0,CONNECTING:1,CONNFAIL:2,AUTHENTICATING:3,AUTHFAIL:4,CONNECTED:5,DISCONNECTED:6,DISCONNECTING:7,ATTACHED:8,REDIRECT:9,CONNTIMEOUT:10,BINDREQUIRED:11,ATTACHFAIL:12,RECONNECTING:13},u={BAD_FORMAT:"bad-format",CONFLICT:"conflict",MISSING_JID_NODE:"x-strophe-bad-non-anon-jid",NO_AUTH_MECH:"no-auth-mech",UNKNOWN_REASON:"unknown"},n={DEBUG:0,INFO:1,WARN:2,ERROR:3,FATAL:4},s={NORMAL:1,TEXT:3,CDATA:4,FRAGMENT:11};function S(C,o){return new b(C,o)}function l(C){return new b("message",C)}function m(C){return new b("iq",C)}function y(C){return new b("presence",C)}class b{constructor(o,h){(o==="presence"||o==="message"||o==="iq")&&(h&&!h.xmlns?h.xmlns=T.CLIENT:h||(h={xmlns:T.CLIENT})),this.nodeTree=W(o,h),this.node=this.nodeTree}tree(){return this.nodeTree}toString(){return Y(this.nodeTree)}up(){return this.node=this.node.parentElement,this}root(){return this.node=this.nodeTree,this}attrs(o){for(const h in o)Object.prototype.hasOwnProperty.call(o,h)&&(o[h]!=null?this.node.setAttribute(h,o[h].toString()):this.node.removeAttribute(h));return this}c(o,h,_){const N=W(o,h,_);return this.node.appendChild(N),typeof _!="string"&&typeof _!="number"&&(this.node=N),this}cnode(o){let h;const _=G();try{h=_.importNode!==void 0}catch{h=!1}const N=h?_.importNode(o,!0):H(o);return this.node.appendChild(N),this.node=N,this}t(o){const h=$(o);return this.node.appendChild(h),this}h(o){const h=G().createElement("body");h.innerHTML=o;const _=V(h);for(;_.childNodes.length>0;)this.node.appendChild(_.childNodes[0]);return this}}function R(C){let o="";const h=C.length;for(let _=0;_<h;_++){const N=C.charCodeAt(_);N>=0&&N<=127?o+=C.charAt(_):N>2047?(o+=String.fromCharCode(224|N>>12&15),o+=String.fromCharCode(128|N>>6&63),o+=String.fromCharCode(128|N>>0&63)):(o+=String.fromCharCode(192|N>>6&31),o+=String.fromCharCode(128|N>>0&63))}return o}function I(C,o){const h=new Uint8Array(C),_=new Uint8Array(o),N=new Uint8Array(C.byteLength);for(let k=0;k<C.byteLength;k++)N[k]=h[k]^_[k];return N.buffer}function A(C){let o="";const h=new Uint8Array(C),_=h.byteLength;for(let N=0;N<_;N++)o+=String.fromCharCode(h[N]);return btoa(o)}function x(C){var o;return(o=Uint8Array.from(atob(C),h=>
7h.charCodeAt(0)))===null||o===void 0?void 0:o.buffer}function M(C){return new TextEncoder().encode(C).buffer}function P(C){typeof document>"u"&&O.log(O.LogLevel.ERROR,"addCookies: not adding any cookies, since there's no document object"),C=C||{};for(const o in C)if(Object.prototype.hasOwnProperty.call(C,o)){let h="",_="",N="";const k=C[o],j=typeof k=="object",q=escape(unescape(j?k.value:k));j&&(h=k.expires?";expires="+k.expires:"",_=k.domain?";domain="+k.domain:"",N=k.path?";path="+k.path:""),document.cookie=o+"="+q+h+_+N}}let L=null;function G(){return L||(L=d()),L}function $(C){return G().createTextNode(C)}function Q(C){return new p().parseFromString(C,"text/xml")}function W(C,o,h){if(!C)return null;const _=G().createElement(C);if(h&&(typeof h=="string"||typeof h=="number"))_.appendChild($(h.toString()));else{if(typeof o=="string"||typeof o=="number")return _.appendChild($(o.toString())),_;if(!o)return _}if(Array.isArray(o))for(const N of o)Array.isArray(N)&&N[0]!=null&&N[1]!=null&&_.setAttribute(N[0],N[1]);else if(typeof o=="object")for(const N of Object.keys(o))N&&o[N]!=null&&_.setAttribute(N,o[N].toString());return _}function w(C){for(let o=0;o<g.tags.length;o++)if(C===g.tags[o])return!0;return!1}function B(C,o){const h=g.attributes[C];if(h?.length>0){for(let _=0;_<h.length;_++)if(o===h[_])return!0}return!1}function U(C){for(let o=0;o<g.css.length;o++)if(C===g.css[o])return!0;return!1}function F(C){let o;const h=C.nodeName.toLowerCase();if(w(h))try{if(o=W(h),h in g.attributes){const N=g.attributes[h];for(let k=0;k<N.length;k++){const j=N[k];let q=C.getAttribute(j);if(!(typeof q>"u"||q===null||q==="")){if(j==="style"&&typeof q=="object"){var _;q=(_=q.cssText)!==null&&_!==void 0?_:q}if(j==="style"){const Z=[],he=q.split(";");for(let ge=0;ge<he.length;ge++){const Se=he[ge].split(":"),Pe=Se[0].replace(/^\s*/,"").replace(/\s*$/,"").toLowerCase();if(U(Pe)){const ke=Se[1].replace(/^\s*/,"").replace(/\s*$/,"");Z.push(Pe+": "+ke)}}Z.length>0&&(q=Z.join("; "),o.setAttribute(j,q))}else o.setAttribute(j,q)}}for(let k=0;k<C.childNodes.length;k++)o.appendChild(V(C.childNodes[k]))}}catch{o=$("")}else{o=G().createDocumentFragment();for(let N=0;N<C.childNodes.length;N++)o.appendChild(V(C.childNodes[N]))}return o}function V(C){if(C.nodeType===s.NORMAL)return F(C);if(C.nodeType===s.FRAGMENT){const o=G().createDocumentFragment();for(let h=0;h<C.childNodes.length;h++)o.appendChild(V(C.childNodes[h]));return o}else if(C.nodeType===s.TEXT)return $(C.nodeValue)}function H(C){let o;if(C.nodeType===s.NORMAL){const h=C;o=W(h.tagName);for(let _=0;_<h.attributes.length;_++)o.setAttribute(h.attributes[_].nodeName,h.attributes[_].value);for(let _=0;_<h.childNodes.length;_++)o.appendChild(H(h.childNodes[_]))}else C.nodeType===s.TEXT&&(o=G().createTextNode(C.nodeValue));return o}function z(C){return C=C.replace(/\&/g,"&amp;"),C=C.replace(/</g,"&lt;"),C=C.replace(/>/g,"&gt;"),C=C.replace(/'/g,"&apos;"),C=C.replace(/"/g,"&quot;"),C}function re(C){return C=C.replace(/\&amp;/g,"&"),C=C.replace(/&lt;/g,"<"),C=C.replace(/&gt;/g,">"),C=C.replace(/&apos;/g,"'"),C=C.replace(/&quot;/g,'"'),C}function Y(C){if(!C)return null;const o=C instanceof b?C.tree():C,h=[...Array(o.attributes.length).keys()].map(N=>o.attributes[N].nodeName);h.sort();let _=h.reduce((N,k)=>`${N} ${k}="${z(o.attributes.getNamedItem(k).value)}"`,`<${o.nodeName}`);if(o.childNodes.length>0){_+=">";for(let N=0;N<o.childNodes.length;N++){const k=o.childNodes[N];switch(k.nodeType){case s.NORMAL:_+=Y(k);break;case s.TEXT:_+=z(k.nodeValue);break;case s.CDATA:_+="<![CDATA["+k.nodeValue+"]]>"}}_+="</"+o.nodeName+">"}else _+="/>";return _}function X(C,o,h){for(let _=0;_<C.childNodes.length;_++){const N=C.childNodes[_];N.nodeType===s.NORMAL&&(!o||this.isTagEqual(N,o))&&h(N)}}function K(C,o){return C.tagName===o}function ee(C){var o;if(!C)return null;let h="";!((o=C.childNodes)!==null&&o!==void 0&&o.length)&&C.nodeType===s.TEXT&&(h+=C.nodeValue);for(let k=0;(_=k<((N=C.childNodes)===null||N===void 0?void 0:N.length))!==null&&_!==void 0&&_;k++){var _,N;C.childNodes[k].nodeType===s.TEXT&&(h+=C.childNodes[k].nodeValue)}return z(h)}function oe(C){return typeof C!="string"?C:C.replace(/^\s+|\s+$/g,"").replace(/\\/g,"\\5c").replace(/ /g,"\\20").replace(/\"/g,"\\22").replace(/\&/g,"\\26").replace(/\'/g,"\\27").replace(/\//g,"\\2f").replace(/:/g,"\\3a").replace(/</g,"\\3c").replace(/>/g,"\\3e").replace(/@/g,"\\40")}function Ce(C){return typeof C!="string"?C:C.replace(/\\20/g," ").replace(/\\22/g,'"').replace(/\\26/g,"&").replace(/\\27/g,"'").replace(/\\2f/g,"/").replace(/\\3a/g,":").replace(/\\3c/g,"<").replace(/\\3e/g,">").replace(/\\40/g,"@").replace(/\\5c/g,"\\")}function ae(C){return C.indexOf("@")<0?null:C.split("@")[0]}function le(C){const o=J(C);if(o.indexOf("@")<0)return o;{const h=o.split("@");return h.splice(0,1),h.join("@")}}function te(C){if(!C)return null;const o=C.split("/");return o.length<2?null:(o.splice(0,1),o.join("/"))}function J(C){return C?C.split("/")[0]:null}const ce={utf16to8:R,xorArrayBuffers:I,arrayBufToBase64:A,base64ToArrayBuf:x,stringToArrayBuf:M,addCookies:P};var ye=Object.freeze({__proto__:null,utf16to8:R,xorArrayBuffers:I,arrayBufToBase64:A,base64ToArrayBuf:x,stringToArrayBuf:M,addCookies:P,xmlGenerator:G,xmlTextNode:$,xmlHtmlNode:Q,xmlElement:W,validTag:w,validAttribute:B,validCSS:U,createHtml:V,copyElement:H,xmlescape:z,xmlunescape:re,serialize:Y,forEachChild:X,isTagEqual:K,getText:ee,escapeNode:oe,unescapeNode:Ce,getNodeFromJid:ae,getDomainFromJid:le,getResourceFromJid:te,getBareJidFromJid:J,default:ce});class fe{constructor(o,h,_,N,k,j,q){this.handler=o,this.ns=h,this.name=_,this.type=N,this.id=k,this.options=q||{matchBareFromJid:!1,ignoreNamespaceFragment:!1},this.options.matchBareFromJid?this.from=j?J(j):null:this.from=j,this.user=!0}getNamespace(o){let h=o.getAttribute("xmlns");return h&&this.options.ignoreNamespaceFragment&&(h=h.split("#")[0]),h}namespaceMatch(o){let h=!1;return this.ns?(X(o,null,_=>{this.getNamespace(_)===this.ns&&(h=!0)}),h||this.getNamespace(o)===this.ns):!0}isMatch(o){let h=o.getAttribute("from");this.options.matchBareFromJid&&(h=J(h));const _=o.getAttribute("type");return!!(this.namespaceMatch(o)&&(!this.name||O.isTagEqual(o,this.name))&&(!this.type||(Array.isArray(this.type)?this.type.indexOf(_)!==-1:_===this.type))&&(!this.id||o.getAttribute("id")===this.id)&&(!this.from||h===this.from))}run(o){let h=null;try{h=this.handler(o)}catch(_){throw O._handleError(_),_}return h}toString(){return"{Handler: "+this.handler+"("+this.name+","+this.id+","+this.ns+")}"}}class ve{constructor(o,h){this.period=o,this.handler=h,this.lastCalled=new Date().getTime(),this.user=!0}run(){return this.lastCalled=new Date().getTime(),this.handler()}reset(){this.lastCalled=new Date().getTime()}toString(){return"{TimedHandler: "+this.handler+"("+this.period+")}"}}function Ee(C){if(arguments.length===0)throw new TypeError("1 argument required, but only 0 present.");if(C=`${C}`,C=C.replace(/[ \t\n\f\r]/g,""),C.length%4===0&&(C=C.replace(/==?$/,"")),C.length%4===1||/[^+/0-9A-Za-z]/.test(C))return null;let o="",h=0,_=0;for(let N=0;N<C.length;N++)h<<=6,h|=Be(C[N]),_+=6,_===24&&(o+=String.fromCharCode((h&16711680)>>16),o+=String.fromCharCode((h&65280)>>8),o+=String.fromCharCode(h&255),h=_=0);return _===12?(h>>=4,o+=String.fromCharCode(h)):_===18&&(h>>=2,o+=String.fromCharCode((h&65280)>>8),o+=String.fromCharCode(h&255)),o}const we="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
7+/";function Be(C){const o=we.indexOf(C);return o<0?void 0:o}var qe=Ee;function ze(C){if(arguments.length===0)throw new TypeError("1 argument required, but only 0 present.");let o;for(C=`${C}`,o=0;o<C.length;o++)if(C.charCodeAt(o)>255)return null;let h="";for(o=0;o<C.length;o+=3){const _=[void 0,void 0,void 0,void 0];_[0]=C.charCodeAt(o)>>2,_[1]=(C.charCodeAt(o)&3)<<4,C.length>o+1&&(_[1]|=C.charCodeAt(o+1)>>4,_[2]=(C.charCodeAt(o+1)&15)<<2),C.length>o+2&&(_[2]|=C.charCodeAt(o+2)>>6,_[3]=C.charCodeAt(o+2)&63);for(let N=0;N<_.length;N++)typeof _[N]>"u"?h+="=":h+=me(_[N])}return h}const Ze="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function me(C){if(C>=0&&C<64)return Ze[C]}var Le=ze,je={atob:qe,btoa:Le};class Qe extends Error{constructor(o){super(o),this.name="StropheSessionError"}}class et{constructor(o,h={}){this.service=o,this.options=h,this.setProtocol(),this.jid="",this.domain=null,this.features=null,this._sasl_data={},this.do_bind=!1,this.do_session=!1,this.mechanisms={},this.timedHandlers=[],this.handlers=[],this.removeTimeds=[],this.removeHandlers=[],this.addTimeds=[],this.addHandlers=[],this.protocolErrorHandlers={HTTP:{},websocket:{}},this._idleTimeout=null,this._disconnectTimeout=null,this.authenticated=!1,this.connected=!1,this.disconnecting=!1,this.do_authentication=!0,this.paused=!1,this.restored=!1,this._data=[],this._uniqueId=0,this._sasl_success_handler=null,this._sasl_failure_handler=null,this._sasl_challenge_handler=null,this.maxRetries=5,this._idleTimeout=setTimeout(()=>this._onIdle(),100),P(this.options.cookies),this.registerSASLMechanisms(this.options.mechanisms),this.iqFallbackHandler=new fe(_=>this.send(m({type:"error",id:_.getAttribute("id")}).c("error",{type:"cancel"}).c("service-unavailable",{xmlns:O.NS.STANZAS})),null,"iq",["get","set"]);for(const _ in O._connectionPlugins)if(Object.prototype.hasOwnProperty.call(O._connectionPlugins,_)){const N=function(){};N.prototype=O._connectionPlugins[_],this[_]=new N,this[_].init(this)}}setProtocol(){const o=this.options.protocol||"";this.options.worker?this._proto=new O.WorkerWebsocket(this):this.service.indexOf("ws:")===0||this.service.indexOf("wss:")===0||o.indexOf("ws")===0?this._proto=new O.Websocket(this):this._proto=new O.Bosh(this)}reset(){this._proto._reset(),this.do_session=!1,this.do_bind=!1,this.timedHandlers=[],this.handlers=[],this.removeTimeds=[],this.removeHandlers=[],this.addTimeds=[],this.addHandlers=[],this.authenticated=!1,this.connected=!1,this.disconnecting=!1,this.restored=!1,this._data=[],this._requests=[],this._uniqueId=0}pause(){this.paused=!0}resume(){this.paused=!1}getUniqueId(o){const h="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(_){const N=Math.random()*16|0;return(_==="x"?N:N&3|8).toString(16)});return typeof o=="string"||typeof o=="number"?h+":"+o:h+""}addProtocolErrorHandler(o,h,_){this.protocolErrorHandlers[o][h]=_}connect(o,h,_,N,k,j,q,Z=3e3){this.jid=o,this.authzid=O.getBareJidFromJid(this.jid),this.authcid=q||O.getNodeFromJid(this.jid),this.pass=h,this.scram_keys=null,this.connect_callback=_,this.disconnecting=!1,this.connected=!1,this.authenticated=!1,this.restored=!1,this.disconnection_timeout=Z,this.domain=O.getDomainFromJid(this.jid),this._changeConnectStatus(c.CONNECTING,null),this._proto._connect(N,k,j)}attach(o,h,_,N,k,j,q){if(this._proto instanceof O.Bosh&&typeof o=="string")return this._proto._attach(o,h,_,N,k,j,q);if(this._proto instanceof O.WorkerWebsocket&&typeof o=="function"){const Z=o;return this._proto._attach(Z)}else throw new Qe('The "attach" method is not available for your connection protocol')}restore(o,h,_,N,k){if(!(this._proto instanceof O.Bosh)||!this._sessionCachingSupported())throw new Qe('The "restore" method can only be used with a BOSH connection.');this._sessionCachingSupported()&&this._proto._restore(o,h,_,N,k)}_sessionCachingSupported(){if(this._proto instanceof O.Bosh){if(!JSON)return!1;try{sessionStorage.setItem("_strophe_","_strophe_"),sessionStorage.removeItem("_strophe_")}catch{return!1}return!0}return!1}xmlInput(o){}xmlOutput(o){}rawInput(o){}rawOutput(o){}nextValidRid(o){}
7send(o){if(o!==null){if(Array.isArray(o))o.forEach(h=>this._queueData(h instanceof b?h.tree():h));else{const h=o instanceof b?o.tree():o;this._queueData(h)}this._proto._send()}}flush(){clearTimeout(this._idleTimeout),this._onIdle()}sendPresence(o,h,_,N){let k=null;const j=o instanceof b?o.tree():o;let q=j.getAttribute("id");if(q||(q=this.getUniqueId("sendPresence"),j.setAttribute("id",q)),typeof h=="function"||typeof _=="function"){const Z=this.addHandler(he=>{k&&this.deleteTimedHandler(k),he.getAttribute("type")==="error"?_?.(he):h&&h(he)},null,"presence",null,q);N&&(k=this.addTimedHandler(N,()=>(this.deleteHandler(Z),_?.(null),!1)))}return this.send(j),q}sendIQ(o,h,_,N){let k=null;const j=o instanceof b?o.tree():o;let q=j.getAttribute("id");if(q||(q=this.getUniqueId("sendIQ"),j.setAttribute("id",q)),typeof h=="function"||typeof _=="function"){const Z=this.addHandler(he=>{k&&this.deleteTimedHandler(k);const ge=he.getAttribute("type");if(ge==="result")h?.(he);else if(ge==="error")_?.(he);else{const Se=new Error(`Got bad IQ type of ${ge}`);throw Se.name="StropheError",Se}},null,"iq",["error","result"],q);N&&(k=this.addTimedHandler(N,()=>(this.deleteHandler(Z),_?.(null),!1)))}return this.send(j),q}_queueData(o){if(o===null||!o.tagName||!o.childNodes){const h=new Error("Cannot queue non-DOMElement.");throw h.name="StropheError",h}this._data.push(o)}_sendRestart(){this._data.push("restart"),this._proto._sendRestart(),this._idleTimeout=setTimeout(()=>this._onIdle(),100)}addTimedHandler(o,h){const _=new O.TimedHandler(o,h);return this.addTimeds.push(_),_}deleteTimedHandler(o){this.removeTimeds.push(o)}addHandler(o,h,_,N,k,j,q){const Z=new fe(o,h,_,N,k,j,q);return this.addHandlers.push(Z),Z}deleteHandler(o){this.removeHandlers.push(o);const h=this.addHandlers.indexOf(o);h>=0&&this.addHandlers.splice(h,1)}registerSASLMechanisms(o){this.mechanisms={},(o||[O.SASLAnonymous,O.SASLExternal,O.SASLOAuthBearer,O.SASLXOAuth2,O.SASLPlain,O.SASLSHA1,O.SASLSHA256,O.SASLSHA384,O.SASLSHA512]).forEach(h=>this.registerSASLMechanism(h))}registerSASLMechanism(o){const h=new o;this.mechanisms[h.mechname]=h}disconnect(o){if(this._changeConnectStatus(c.DISCONNECTING,o),o?O.warn("Disconnect was called because: "+o):O.info("Disconnect was called"),this.connected){let h=null;this.disconnecting=!0,this.authenticated&&(h=y({xmlns:O.NS.CLIENT,type:"unavailable"})),this._disconnectTimeout=this._addSysTimedHandler(this.disconnection_timeout,this._onDisconnectTimeout.bind(this)),this._proto._disconnect(h)}else O.warn("Disconnect was called before Strophe connected to the server"),this._proto._abortAllRequests(),this._doDisconnect()}_changeConnectStatus(o,h,_){for(const N in O._connectionPlugins)if(Object.prototype.hasOwnProperty.call(O._connectionPlugins,N)){const k=this[N];if(k.statusChanged)try{k.statusChanged(o,h)}catch(j){O.error(`${N} plugin caused an exception changing status: ${j}`)}}if(this.connect_callback)try{this.connect_callback(o,h,_)}catch(N){O._handleError(N),O.error(`User connection callback caused an exception: ${N}`)}}_doDisconnect(o){typeof this._idleTimeout=="number"&&clearTimeout(this._idleTimeout),this._disconnectTimeout!==null&&(this.deleteTimedHandler(this._disconnectTimeout),this._disconnectTimeout=null),O.debug("_doDisconnect was called"),this._proto._doDisconnect(),this.authenticated=!1,this.disconnecting=!1,this.restored=!1,this.handlers=[],this.timedHandlers=[],this.removeTimeds=[],this.removeHandlers=[],this.addTimeds=[],this.addHandlers=[],this._changeConnectStatus(c.DISCONNECTED,o),this.connected=!1}_dataRecv(o,h){const _="_reqToData"in this._proto?this._proto._reqToData(o):o;if(_===null)return;for(this.xmlInput!==O.Connection.prototype.xmlInput&&(_.nodeName===this._proto.strip&&_.childNodes.length?this.xmlInput(_.childNodes[0]):this.xmlInput(_)),this.rawInput!==O.Connection.prototype.rawInput&&(h?this.rawInput(h):this.rawInput(O.serialize(_)));this.removeHandlers.length>0;){const k=this.removeHandlers.pop(),j=this.handlers.indexOf(k);j>=0&&this.handlers.splice(j,1)}for(;this.addHandlers.length>0;)this.handlers.push(this.addHandlers.pop());if(this.disconnecting&&this._proto._emptyQueue()){this._doDisconnect();return}const N=_.getAttribute("type");if(N!==null&&N==="terminate"){if(this.disconnecting)return;let k=_.getAttribute("condition");const j=_.getElementsByTagName("conflict");k!==null?(k==="remote-stream-error"&&j.length>0&&(k="conflict"),this._changeConnectStatus(c.CONNFAIL,k)):this._changeConnectStatus(c.CONNFAIL,O.ErrorCondition.UNKNOWN_REASON),this._doDisconnect(k);return}O.forEachChild(_,null,k=>{const j=[];this.handlers=this.handlers.reduce((q,Z)=>{try{Z.isMatch(k)&&(this.authenticated||!Z.user)?(Z.run(k)&&q.push(Z),j.push(Z)):q.push(Z)}catch(he){O.warn("Removing Strophe handlers due to uncaught exception: "+he.message)}return q},[]),!j.length&&this.iqFallbackHandler.isMatch(k)&&this.iqFallbackHandler.run(k)})}_connect_cb(o,h,_){O.debug("_connect_cb was called"),this.connected=!0;let N;try{N="_reqToData"in this._proto?this._proto._reqToData(o):o}catch(Z){if(Z.name!==O.ErrorCondition.BAD_FORMAT)throw Z;this._changeConnectStatus(c.CONNFAIL,O.ErrorCondition.BAD_FORMAT),this._doDisconnect(O.ErrorCondition.BAD_FORMAT)}if(!N||(this.xmlInput!==O.Connection.prototype.xmlInput&&(N.nodeName===this._proto.strip&&N.childNodes.length?this.xmlInput(N.childNodes[0]):this.xmlInput(N)),this.rawInput!==O.Connection.prototype.rawInput&&(_?this.rawInput(_):this.rawInput(O.serialize(N))),this._proto._connect_cb(N)===c.CONNFAIL))return;let j;if(N.getElementsByTagNameNS?j=N.getElementsByTagNameNS(O.NS.STREAM,"features").length>0:j=N.getElementsByTagName("stream:features").length>0||N.getElementsByTagName("features").length>0,!j){this._proto._no_auth_received(h);return}const q=Array.from(N.getElementsByTagName("mechanism")).map(Z=>this.mechanisms[Z.textContent]).filter(Z=>Z);if(q.length===0&&N.getElementsByTagName("auth").length===0){this._proto._no_auth_received(h);return}this.do_authentication!==!1&&this.authenticate(q)}sortMechanismsByPriority(o){for(let h=0;h<o.length-1;++h){let _=h;for(let N=h+1;N<o.length;++N)o[N].priority>o[_].priority&&(_=N);if(_!==h){const N=o[h];o[h]=o[_],o[_]=N}}return o}authenticate(o){this._attemptSASLAuth(o)||this._attemptLegacyAuth()}_attemptSASLAuth(o){o=this.sortMechanismsByPriority(o||[]);let h=!1;for(let _=0;_<o.length;++_){if(!o[_].test(this))continue;this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null),this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null),this._sasl_challenge_handler=this._addSysHandler(this._sasl_challenge_cb.bind(this),null,"challenge",null,null),this._sasl_mechanism=o[_],this._sasl_mechanism.onStart(this);const N=S("auth",{xmlns:O.NS.SASL,mechanism:this._sasl_mechanism.mechname});if(this._sasl_mechanism.isClientFirst){const k=this._sasl_mechanism.clientChallenge(this);N.t(je.btoa(k))}this.send(N.tree()),h=!0;break}return h}async _sasl_challenge_cb(o){const h=je.atob(ee(o)),_=await this._sasl_mechanism.onCh
7allenge(this,h),N=S("response",{xmlns:O.NS.SASL});return _&&N.t(je.btoa(_)),this.send(N.tree()),!0}_attemptLegacyAuth(){O.getNodeFromJid(this.jid)===null?(this._changeConnectStatus(c.CONNFAIL,O.ErrorCondition.MISSING_JID_NODE),this.disconnect(O.ErrorCondition.MISSING_JID_NODE)):(this._changeConnectStatus(c.AUTHENTICATING,null),this._addSysHandler(this._onLegacyAuthIQResult.bind(this),null,null,null,"_auth_1"),this.send(m({type:"get",to:this.domain,id:"_auth_1"}).c("query",{xmlns:O.NS.AUTH}).c("username",{}).t(O.getNodeFromJid(this.jid)).tree()))}_onLegacyAuthIQResult(){const o=typeof this.pass=="string"?this.pass:"",h=m({type:"set",id:"_auth_2"}).c("query",{xmlns:O.NS.AUTH}).c("username",{}).t(O.getNodeFromJid(this.jid)).up().c("password").t(o);return O.getResourceFromJid(this.jid)||(this.jid=O.getBareJidFromJid(this.jid)+"/strophe"),h.up().c("resource",{}).t(O.getResourceFromJid(this.jid)),this._addSysHandler(this._auth2_cb.bind(this),null,null,null,"_auth_2"),this.send(h.tree()),!1}_sasl_success_cb(o){if(this._sasl_data["server-signature"]){let N;const k=je.atob(ee(o)),j=/([a-z]+)=([^,]+)(,|$)/,q=k.match(j);if(q[1]==="v"&&(N=q[2]),N!==this._sasl_data["server-signature"])return this.deleteHandler(this._sasl_failure_handler),this._sasl_failure_handler=null,this._sasl_challenge_handler&&(this.deleteHandler(this._sasl_challenge_handler),this._sasl_challenge_handler=null),this._sasl_data={},this._sasl_failure_cb(null)}O.info("SASL authentication succeeded."),this._sasl_data.keys&&(this.scram_keys=this._sasl_data.keys),this._sasl_mechanism&&this._sasl_mechanism.onSuccess(),this.deleteHandler(this._sasl_failure_handler),this._sasl_failure_handler=null,this._sasl_challenge_handler&&(this.deleteHandler(this._sasl_challenge_handler),this._sasl_challenge_handler=null);const h=[],_=(N,k)=>{for(;N.length;)this.deleteHandler(N.pop());return this._onStreamFeaturesAfterSASL(k),!1};return h.push(this._addSysHandler(N=>_(h,N),null,"stream:features",null,null)),h.push(this._addSysHandler(N=>_(h,N),O.NS.STREAM,"features",null,null)),this._sendRestart(),!1}_onStreamFeaturesAfterSASL(o){this.features=o;for(let h=0;h<o.childNodes.length;h++){const _=o.childNodes[h];_.nodeName==="bind"&&(this.do_bind=!0),_.nodeName==="session"&&(this.do_session=!0)}if(this.do_bind)this.options.explicitResourceBinding?this._changeConnectStatus(c.BINDREQUIRED,null):this.bind();else return this._changeConnectStatus(c.AUTHFAIL,null),!1;return!1}bind(){if(!this.do_bind){O.log(O.LogLevel.INFO,'Strophe.Connection.prototype.bind called but "do_bind" is false');return}
7this._addSysHandler(this._onResourceBindResultIQ.bind(this),null,null,null,"_bind_auth_2");const o=O.getResourceFromJid(this.jid);o?this.send(m({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:O.NS.BIND}).c("resource",{}).t(o).tree()):this.send(m({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:O.NS.BIND}).tree())}_onResourceBindResultIQ(o){if(o.getAttribute("type")==="error"){O.warn("Resource binding failed.");const _=o.getElementsByTagName("conflict");let N;return _.length>0&&(N=O.ErrorCondition.CONFLICT),this._changeConnectStatus(c.AUTHFAIL,N,o),!1}const h=o.getElementsByTagName("bind");if(h.length>0){const _=h[0].getElementsByTagName("jid");_.length>0&&(this.authenticated=!0,this.jid=ee(_[0]),this.do_session?this._establishSession():this._changeConnectStatus(c.CONNECTED,null))}else return O.warn("Resource binding failed."),this._changeConnectStatus(c.AUTHFAIL,null,o),!1}_establishSession(){if(!this.do_session)throw new Error(`Strophe.Connection.prototype._establishSession called but apparently ${O.NS.SESSION} wasn't advertised by the server`);this._addSysHandler(this._onSessionResultIQ.bind(this),null,null,null,"_session_auth_2"),this.send(m({type:"set",id:"_session_auth_2"}).c("session",{xmlns:O.NS.SESSION}).tree())}_onSessionResultIQ(o){if(o.getAttribute("type")==="result")this.authenticated=!0,this._changeConnectStatus(c.CONNECTED,null);else if(o.getAttribute("type")==="error")return this.authenticated=!1,O.warn("Session creation failed."),this._changeConnectStatus(c.AUTHFAIL,null,o),!1;return!1}_sasl_failure_cb(o){return this._sasl_success_handler&&(this.deleteHandler(this._sasl_success_handler),this._sasl_success_handler=null),this._sasl_challenge_handler&&(this.deleteHandler(this._sasl_challenge_handler),this._sasl_challenge_handler=null),this._sasl_mechanism&&this._sasl_mechanism.onFailure(),this._changeConnectStatus(c.AUTHFAIL,null,o),!1}_auth2_cb(o){return o.getAttribute("type")==="result"?(this.authenticated=!0,this._changeConnectStatus(c.CONNECTED,null)):o.getAttribute("type")==="error"&&(this._changeConnectStatus(c.AUTHFAIL,null,o),this.disconnect("authentication failed")),!1}_addSysTimedHandler(o,h){const _=new ve(o,h);return _.user=!1,this.addTimeds.push(_),_}_addSysHandler(o,h,_,N,k){const j=new fe(o,h,_,N,k);return j.user=!1,this.addHandlers.push(j),j}_onDisconnectTimeout(){return O.debug("_onDisconnectTimeout was called"),this._changeConnectStatus(c.CONNTIMEOUT,null),this._proto._onDisconnectTimeout(),this._doDisconnect(),!1}_onIdle(){for(;this.addTimeds.length>0;)this.timedHandlers.push(this.addTimeds.pop());for(;this.removeTimeds.length>0;){const _=this.removeTimeds.pop(),N=this.timedHandlers.indexOf(_);N>=0&&this.timedHandlers.splice(N,1)}const o=new Date().getTime(),h=[];for(let _=0;_<this.timedHandlers.length;_++){const N=this.timedHandlers[_];(this.authenticated||!N.user)&&(N.lastCalled+N.period-o<=0?N.run()&&h.push(N):h.push(N))}this.timedHandlers=h,clearTimeout(this._idleTimeout),this._proto._onIdle(),this.connected&&(this._idleTimeout=setTimeout(()=>this._onIdle(),100))}}class ie{constructor(o,h,_){this.mechname=o,this.isClientFirst=h,this.priority=_}test(o){return!0}onStart(o){this._connection=o}onChallenge(o,h){throw new Error("You should implement challenge handling!")}clientChallenge(o){if(!this.isClientFirst)throw new Error("clientChallenge should not be called if isClientFirst is false!");return this.onChallenge(o)}onFailure(){this._connection=null}onSuccess(){this._connection=null}}class _e extends ie{constructor(o="ANONYMOUS",h=!1,_=20){super(o,h,_)}test(o){return o.authcid===null}}class Ne extends ie{constructor(o="EXTERNAL",h=!0,_=10){super(o,h,_)}onChallenge(o){return o.authcid===o.authzid?"":o.authzid}}class Ie extends ie{constructor(o="OAUTHBEARER",h=!0,_=40){super(o,h,_)}test(o){return o.pass!==null}onChallenge(o){let h="n,";return o.authcid!==null&&(h=h+"a="+o.authzid),h=h+",",h=h+"�",h=h+"auth=Bearer ",h=h+o.pass,h=h+"�",h=h+"�",ce.utf16to8(h)}}class Fe extends ie{constructor(o="PLAIN",h=!0,_=50){super(o,h,_)}test(o){return o.authcid!==null}onChallenge(o){const{authcid:h,authzid:_,domain:N,pass:k}=o;if(!N)throw new Error("SASLPlain onChallenge: domain is not defined!");let j=_!==`${h}@${N}`?_:"";return j=j+"\0",j=j+h,j=j+"\0",j=j+k,ce.utf16to8(j)}}async function We(C,o,h){const _=await crypto.subtle.importKey("raw",await crypto.subtle.digest(h,o),{name:"HMAC",hash:h},!1,["sign"]),N=await crypto.subtle.sign("HMAC",_,ce.stringToArrayBuf(C));return ce.xorArrayBuffers(o,N)}function Xe(C){let o,h,_;const N=/([a-z]+)=([^,]+)(,|$)/;for(;C.match(N);){const k=C.match(N);switch(C=C.replace(k[0],""),k[1]){case"r":o=k[2];break;case"s":h=ce.base64ToArrayBuf(k[2]);break;case"i":_=parseInt(k[2],10);break;case"m":return}}if(isNaN(_)||_<4096){O.warn("Failing SCRAM authentication because server supplied iteration count < 4096.");return}if(!h){O.warn("Failing SCRAM authentication because server supplied incorrect salt.");return}return{nonce:o,salt:h,iter:_}}async function tt(C,o,h,_,N){const k=await crypto.subtle.deriveBits({name:"PBKDF2",salt:o,iterations:h,hash:{name:_}},await crypto.subtle.importKey("raw",ce.stringToArrayBuf(C),"PBKDF2",!1,["deriveBits"]),N),j=await crypto.subtle.importKey("raw",k,{name:"HMAC",hash:_},!1,["sign"]);return{ck:await crypto.subtle.sign("HMAC",j,ce.stringToArrayBuf("Client Key")),sk:await crypto.subtle.sign("HMAC",j,ce.stringToArrayBuf("Server Key"))}}async function nt(C,o,h){const _=await crypto.subtle.importKey("raw",o,{name:"HMAC",hash:h},!1,["sign"]);return crypto.subtle.sign("HMAC",_,ce.stringToArrayBuf(C))}function ot(){const C=new Uint8Array(16);return ce.arrayBufToBase64(crypto.getRandomValues(C).buffer)}const Me={async scramResponse(C,o,h,_){const N=C._sasl_data.cnonce,k=Xe(o);if(!k&&k?.nonce.slice(0,N.length)!==N)return O.warn("Failing SCRAM authentication because server supplied incorrect nonce."),C._sasl_data={},C._sasl_failure_cb();let j,q;const{pass:Z}=C;
7if(typeof C.pass=="string"||C.pass instanceof String){const Ae=await tt(Z,k.salt,k.iter,h,_);j=Ae.ck,q=Ae.sk}else if(Z?.name===h&&Z?.salt===ce.arrayBufToBase64(k.salt)&&Z?.iter===k.iter){const{ck:Ae,sk:Ue}=Z;j=ce.base64ToArrayBuf(Ae),q=ce.base64ToArrayBuf(Ue)}else return C._sasl_failure_cb();const he=C._sasl_data["client-first-message-bare"],ge=o,Se=`c=biws,r=${k.nonce}`,Pe=`${he},${ge},${Se}`,ke=await We(Pe,j,h),Ke=await nt(Pe,q,h);return C._sasl_data["server-signature"]=ce.arrayBufToBase64(Ke),C._sasl_data.keys={name:h,iter:k.iter,salt:ce.arrayBufToBase64(k.salt),ck:ce.arrayBufToBase64(j),sk:ce.arrayBufToBase64(q)},`${Se},p=${ce.arrayBufToBase64(ke)}`},clientChallenge(C,o){const h=o||ot(),_=`n=${C.authcid},r=${h}`;return C._sasl_data.cnonce=h,C._sasl_data["client-first-message-bare"]=_,`n,,${_}`}};class rt extends ie{constructor(o="SCRAM-SHA-1",h=!0,_=60){super(o,h,_)}test(o){return o.authcid!==null}async onChallenge(o,h){return await Me.scramResponse(o,h,"SHA-1",160)}clientChallenge(o,h){return Me.clientChallenge(o,h)}}class Ge extends ie{constructor(o="SCRAM-SHA-256",h=!0,_=70){super(o,h,_)}test(o){return o.authcid!==null}async onChallenge(o,h){return await Me.scramResponse(o,h,"SHA-256",256)}clientChallenge(o,h){return Me.clientChallenge(o,h)}}class it extends ie{constructor(o="SCRAM-SHA-384",h=!0,_=71){super(o,h,_)}test(o){return o.authcid!==null}async onChallenge(o,h){return await Me.scramResponse(o,h,"SHA-384",384)}clientChallenge(o,h){return Me.clientChallenge(o,h)}}class dt extends ie{constructor(o="SCRAM-SHA-512",h=!0,_=72){super(o,h,_)}test(o){return o.authcid!==null}async onChallenge(o,h){return await Me.scramResponse(o,h,"SHA-512",512)}clientChallenge(o,h){return Me.clientChallenge(o,h)}}class ft extends ie{constructor(o="X-OAUTH2",h=!0,_=30){super(o,h,_)}test(o){return o.pass!==null}onChallenge(o){let h="\0";return o.authcid!==null&&(h=h+o.authzid),h=h+"\0",h=h+o.pass,ce.utf16to8(h)}}class ht{constructor(o,h,_,N=0){this.id=++O._requestId,this.xmlData=o,this.data=O.serialize(o),this.origFunc=h,this.func=h,this.rid=_,this.date=NaN,this.sends=N,this.abort=!1,this.dead=null,this.age=()=>this.date?(new Date().valueOf()-this.date.valueOf())/1e3:0,this.timeDead=()=>this.dead?(new Date().valueOf()-this.dead.valueOf())/1e3:0,this.xhr=this._newXHR()}getResponse(){var o;let h=(o=this.xhr.responseXML)===null||o===void 0?void 0:o.documentElement;if(h){if(h.tagName==="parsererror")throw O.error("invalid response received"),O.error("responseText: "+this.xhr.responseText),O.error("responseXML: "+O.serialize(h)),new Error("parsererror")}else if(this.xhr.responseText){var _;O.debug("Got responseText but no responseXML; attempting to parse it with DOMParser..."),h=new p().parseFromString(this.xhr.responseText,"application/xml").documentElement;const N=(_=h)===null||_===void 0?void 0:_.querySelector("parsererror");if(!h||N){N&&(O.error("invalid response received: "+N.textContent),O.error("responseText: "+this.xhr.responseText));const k=new Error;throw k.name=O.ErrorCondition.BAD_FORMAT,k}}return h}_newXHR(){const o=new XMLHttpRequest;return o.overrideMimeType&&o.overrideMimeType("text/xml; charset=utf-8"),o.onreadystatechange=this.func.bind(null,this),o}}class pe{constructor(o){var h;this._conn=o,this.rid=Math.floor(Math.random()*4294967295),this.sid=null,this.hold=1,this.wait=60,this.window=5,this.errors=0,this.inactivity=null,this.strip=(h=pe.prototype.strip)!==null&&h!==void 0?h:!1,this.lastResponseHeaders=null,this._requests=[]}_buildBody(){const o=S("body",{rid:this.rid++,xmlns:O.NS.HTTPBIND});return this.sid!==null&&o.attrs({sid:this.sid}),this._conn.options.keepalive&&this._conn._sessionCachingSupported()&&this._cacheSession(),o}_reset(){this.rid=Math.floor(Math.random()*4294967295),this.sid=null,this.errors=0,this._conn._sessionCachingSupported()&&sessionStorage.removeItem("strophe-bosh-session"),this._conn.nextValidRid(this.rid)}_connect(o,h,_){this.wait=o||this.wait,this.hold=h||this.hold,this.errors=0;const N=this._buildBody().attrs({to:this._conn.domain,"xml:lang":"en",wait:this.wait,hold:this.hold,content:"text/xml; charset=utf-8",ver:"1.6","xmpp:version":"1.0","xmlns:xmpp":O.NS.BOSH});_&&N.attrs({route:_});const k=this._conn._connect_cb;
7this._requests.push(new O.Request(N.tree(),this._onRequestStateChange.bind(this,k.bind(this._conn)),Number(N.tree().getAttribute("rid")))),this._throttledRequestHandler()}_attach(o,h,_,N,k,j,q){this._conn.jid=o,this.sid=h,this.rid=_,this._conn.connect_callback=N,this._conn.domain=O.getDomainFromJid(this._conn.jid),this._conn.authenticated=!0,this._conn.connected=!0,this.wait=k||this.wait,this.hold=j||this.hold,this.window=q||this.window,this._conn._changeConnectStatus(O.Status.ATTACHED,null)}_restore(o,h,_,N,k){const j=JSON.parse(sessionStorage.getItem("strophe-bosh-session"));if(typeof j<"u"&&j!==null&&j.rid&&j.sid&&j.jid&&(typeof o>"u"||o===null||O.getBareJidFromJid(j.jid)===O.getBareJidFromJid(o)||O.getNodeFromJid(o)===null&&O.getDomainFromJid(j.jid)===o))this._conn.restored=!0,this._attach(j.jid,j.sid,j.rid,h,_,N,k);else{const q=new Error("_restore: no restoreable session.");throw q.name="StropheSessionError",q}}_cacheSession(){this._conn.authenticated?this._conn.jid&&this.rid&&this.sid&&sessionStorage.setItem("strophe-bosh-session",JSON.stringify({jid:this._conn.jid,rid:this.rid,sid:this.sid})):sessionStorage.removeItem("strophe-bosh-session")}_connect_cb(o){const h=o.getAttribute("type");if(h!==null&&h==="terminate"){let q=o.getAttribute("condition");O.error("BOSH-Connection failed: "+q);const Z=o.getElementsByTagName("conflict");return q!==null?(q==="remote-stream-error"&&Z.length>0&&(q="conflict"),this._conn._changeConnectStatus(O.Status.CONNFAIL,q)):this._conn._changeConnectStatus(O.Status.CONNFAIL,"unknown"),this._conn._doDisconnect(q),O.Status.CONNFAIL}this.sid||(this.sid=o.getAttribute("sid"));const _=o.getAttribute("requests");_&&(this.window=parseInt(_,10));const N=o.getAttribute("hold");N&&(this.hold=parseInt(N,10));const k=o.getAttribute("wait");k&&(this.wait=parseInt(k,10));const j=o.getAttribute("inactivity");j&&(this.inactivity=parseInt(j,10))}_disconnect(o){this._sendTerminate(o)}_doDisconnect(){this.sid=null,this.rid=Math.floor(Math.random()*4294967295),this._conn._sessionCachingSupported()&&sessionStorage.removeItem("strophe-bosh-session"),this._conn.nextValidRid(this.rid)}_emptyQueue(){return this._requests.length===0}_callProtocolErrorHandlers(o){const h=pe._getRequestStatus(o),_=this._conn.protocolErrorHandlers.HTTP[h];_&&_.call(this,h)}_hitError(o){this.errors++,O.warn("request errored, status: "+o+", number of errors: "+this.errors),this.errors>4&&this._conn._onDisconnectTimeout()}_no_auth_received(o){O.warn("Server did not yet offer a supported authentication mechanism. Sending a blank poll request."),o?o=o.bind(this._conn):o=this._conn._connect_cb.bind(this._conn);const h=this._buildBody();this._requests.push(new O.Request(h.tree(),this._onRequestStateChange.bind(this,o),Number(h.tree().getAttribute("rid")))),this._throttledRequestHandler()}_onDisconnectTimeout(){this._abortAllRequests()}_abortAllRequests(){for(;this._requests.length>0;){const o=this._requests.pop();o.abort=!0,o.xhr.abort(),o.xhr.onreadystatechange=function(){}}}_onIdle(){const o=this._conn._data;if(this._conn.authenticated&&this._requests.length===0&&o.length===0&&!this._conn.disconnecting&&(O.debug("no requests during idle cycle, sending blank request"),o.push(null)),!this._conn.paused){if(this._requests.length<2&&o.length>0){const h=this._buildBody();for(let _=0;_<o.length;_++)o[_]!==null&&(o[_]==="restart"?h.attrs({to:this._conn.domain,"xml:lang":"en","xmpp:restart":"true","xmlns:xmpp":O.NS.BOSH}):h.cnode(o[_]).up());delete this._conn._data,this._conn._data=[],this._requests.push(new O.Request(h.tree(),this._onRequestStateChange.bind(this,this._conn._dataRecv.bind(this._conn)),Number(h.tree().getAttribute("rid")))),this._throttledRequestHandler()}if(this._requests.length>0){const h=this._requests[0].age();this._requests[0].dead!==null&&this._requests[0].timeDead()>Math.floor(O.SECONDARY_TIMEOUT*this.wait)&&this._throttledRequestHandler(),h>Math.floor(O.TIMEOUT*this.wait)&&(O.warn("Request "+this._requests[0].id+" timed out, over "+Math.floor(O.TIMEOUT*this.wait)+" seconds since last activity"),this._throttledRequestHandler())}}}static _getRequestStatus(o,h){let _;if(o.xhr.readyState===4)try{_=o.xhr.status}catch{O.error("Caught an error while retrieving a request's status, reqStatus: "+_)}return typeof _>"u"&&(_=typeof h=="number"?h:0),_}_onRequestStateChange(o,h){if(O.debug("request id "+h.id+"."+h.sends+" state changed to "+h.xhr.readyState),h.abort){h.abort=!1;return}if(h.xhr.readyState!==4)return;const _=pe._getRequestStatus(h);if(this.lastResponseHeaders=h.xhr.getAllResponseHeaders(),this._conn.disconnecting&&_>=400){this._hitError(_),this._callProtocolErrorHandlers(h);return}const N=this._requests[0]===h,k=this._requests[1]===h,j=_>0&&_<500,q=h.sends>this._conn.maxRetries;(j||q)&&(this._removeRequest(h),O.debug("request id "+h.id+" should now be removed")),_===200?((k||N&&this._requests.length>0&&this._requests[0].age()>Math.floor(O.SECONDARY_TIMEOUT*this.wait))&&this._restartRequest
7(0),this._conn.nextValidRid(h.rid+1),O.debug("request id "+h.id+"."+h.sends+" got 200"),o(h),this.errors=0):_===0||_>=400&&_<600||_>=12e3?(O.error("request id "+h.id+"."+h.sends+" error "+_+" happened"),this._hitError(_),this._callProtocolErrorHandlers(h),_>=400&&_<500&&(this._conn._changeConnectStatus(O.Status.DISCONNECTING,null),this._conn._doDisconnect())):O.error("request id "+h.id+"."+h.sends+" error "+_+" happened"),!j&&!q?this._throttledRequestHandler():q&&!this._conn.connected&&this._conn._changeConnectStatus(O.Status.CONNFAIL,"giving-up")}_processRequest(o){let h=this._requests[o];const _=pe._getRequestStatus(h,-1);if(h.sends>this._conn.maxRetries){this._conn._onDisconnectTimeout();return}const N=h.age(),k=!isNaN(N)&&N>Math.floor(O.TIMEOUT*this.wait),j=h.dead!==null&&h.timeDead()>Math.floor(O.SECONDARY_TIMEOUT*this.wait),q=h.xhr.readyState===4&&(_<1||_>=500);if((k||j||q)&&(j&&O.error(`Request ${this._requests[o].id} timed out (secondary), restarting`),h.abort=!0,h.xhr.abort(),h.xhr.onreadystatechange=function(){},this._requests[o]=new O.Request(h.xmlData,h.origFunc,h.rid,h.sends),h=this._requests[o]),h.xhr.readyState===0){var Z,he;O.debug("request id "+h.id+"."+h.sends+" posting");try{const Ae=this._conn.options.contentType||"text/xml; charset=utf-8";h.xhr.open("POST",this._conn.service,!this._conn.options.sync),typeof h.xhr.setRequestHeader<"u"&&h.xhr.setRequestHeader("Content-Type",Ae),this._conn.options.withCredentials&&(h.xhr.withCredentials=!0)}catch(Ae){O.error("XHR open failed: "+Ae.toString()),this._conn.connected||this._conn._changeConnectStatus(O.Status.CONNFAIL,"bad-service"),this._conn.disconnect();return}const Ke=()=>{if(h.date=new Date().valueOf(),this._conn.options.customHeaders){const Ae=this._conn.options.customHeaders;for(const Ue in Ae)Object.prototype.hasOwnProperty.call(Ae,Ue)&&h.xhr.setRequestHeader(Ue,Ae[Ue])}h.xhr.send(h.data)};if(h.sends>1){const Ae=Math.min(Math.floor(O.TIMEOUT*this.wait),Math.pow(h.sends,3))*1e3;setTimeout(function(){Ke()},Ae)}else Ke();if(h.sends++,this.strip&&h.xmlData.nodeName==="body"&&h.xmlData.childNodes.length){var ge,Se;(ge=(Se=this._conn).xmlOutput)===null||ge===void 0||ge.call(Se,h.xmlData.children[0])}else{var Pe,ke;(Pe=(ke=this._conn).xmlOutput)===null||Pe===void 0||Pe.call(ke,h.xmlData)}(Z=(he=this._conn).rawOutput)===null||Z===void 0||Z.call(he,h.data)}else O.debug("_processRequest: "+(o===0?"first":"second")+" request has readyState of "+h.xhr.readyState)}_removeRequest(o){O.debug("removing request");for(let h=this._requests.length-1;h>=0;h--)o===this._requests[h]&&this._requests.splice(h,1);o.xhr.onreadystatechange=function(){},this._throttledRequestHandler()}_restartRequest(o){const h=this._requests[o];h.dead===null&&(h.dead=new Date),this._processRequest(o)}_reqToData(o){try{return o.getResponse()}catch(h){if(h.message!=="parsererror")throw h;this._conn.disconnect("strophe-parsererror")}}_sendTerminate(o){O.debug("_sendTerminate was called");const h=this._buildBody().attrs({type:"terminate"}),_=o instanceof b?o.tree():o;o&&h.cnode(_);const N=new O.Request(h.tree(),this._onRequestStateChange.bind(this,this._conn._dataRecv.bind(this._conn)),Number(h.tree().getAttribute("rid")));this._requests.push(N),this._throttledRequestHandler()}_send(){clearTimeout(this._conn._idleTimeout),this._throttledRequestHandler(),this._conn._idleTimeout=setTimeout(()=>this._conn._onIdle(),100)}_sendRestart(){this._throttledRequestHandler(),clearTimeout(this._conn._idleTimeout)}_throttledRequestHandler(){this._requests?O.debug("_throttledRequestHandler called with "+this._requests.length+" requests"):O.debug("_throttledRequestHandler called with undefined requests"),!(!this._requests||this._requests.length===0)&&(this._requests.length>0&&this._processRequest(0),this._requests.length>1&&Math.abs(this._requests[0].rid-this._requests[1].rid)<this.window&&this._processRequest(1))}}class be{constructor(o){this._conn=o,this.strip="wrapper";const h=o.service;if(h.indexOf("ws:")!==0&&h.indexOf("wss:")!==0){let _="";o.options.protocol==="ws"&&location.protocol!=="https:"?_+="ws":_+="wss",_+="://"+location.host,h.indexOf("/")!==0?_+=location.pathname+h:_+=h,o.service=_}}_buildStream(){return S("open",{xmlns:O.NS.FRAMING,to:this._conn.domain,version:"1.0"})}_checkStreamError(o,h){let _;if(o.getElementsByTagNameNS?_=o.getElementsByTagNameNS(O.NS.STREAM,"error"):_=o.getElementsByTagName("stream:error"),_.length===0)return!1;const N=_[0];let k="",j="";const q="urn:ietf:params:xml:ns:xmpp-streams";for(let he=0;he<N.childNodes.length;he++){const ge=N.children[he];if(ge.getAttribute("xmlns")!==q)break;ge.nodeName==="text"?j=ge.textContent:k=ge.nodeName}let Z="WebSocket stream error: ";return k?Z+=k:Z+="unknown",j&&(Z+=" - "+j),O.error(Z),this._conn._changeConnectStatus(h,k),this._conn._doDisconnect(),!0}_reset(){}_connect(){this._closeSocket(),this.socket=new a(this._conn.service,"xmpp"),this.socket.onopen=()=>this._onOpen(),this.socket.onerror=o=>this._onError(o),this.socket.onclose=o=>this._onClose(o),this.socket.onmessage=o=>this._onInitialMessage(o)}_connect_cb(o){if(this._checkStreamError(o,O.Status.CONNFAIL))return O.Status.CONNFAIL}_handleStreamStart(o){let h=null;const _=o.getAttribute("xmlns");typeof _!="string"?h="Missing xmlns in <open />":_!==O.NS.FRAMING&&(h="Wrong xmlns in <open />: "+_);const N=o.getAttribute("version");
7return typeof N!="string"?h="Missing version in <open />":N!=="1.0"&&(h="Wrong version in <open />: "+N),h?(this._conn._changeConnectStatus(O.Status.CONNFAIL,h),this._conn._doDisconnect(),!1):!0}_onInitialMessage(o){if(o.data.indexOf("<open ")===0||o.data.indexOf("<?xml")===0){const h=o.data.replace(/^(<\?.*?\?>\s*)*/,"");if(h==="")return;const _=new p().parseFromString(h,"text/xml").documentElement;this._conn.xmlInput(_),this._conn.rawInput(o.data),this._handleStreamStart(_)&&this._connect_cb(_)}else if(o.data.indexOf("<close ")===0){const h=new p().parseFromString(o.data,"text/xml").documentElement;this._conn.xmlInput(h),this._conn.rawInput(o.data);const _=h.getAttribute("see-other-uri");if(_){const N=this._conn.service;(N.indexOf("wss:")>=0&&_.indexOf("wss:")>=0||N.indexOf("ws:")>=0)&&(this._conn._changeConnectStatus(O.Status.REDIRECT,"Received see-other-uri, resetting connection"),this._conn.reset(),this._conn.service=_,this._connect())}else this._conn._changeConnectStatus(O.Status.CONNFAIL,"Received closing stream"),this._conn._doDisconnect()}else{this._replaceMessageHandler();const h=this._streamWrap(o.data),_=new p().parseFromString(h,"text/xml").documentElement;this._conn._connect_cb(_,null,o.data)}}_replaceMessageHandler(){this.socket.onmessage=o=>this._onMessage(o)}_disconnect(o){if(this.socket&&this.socket.readyState!==a.CLOSED){o&&this._conn.send(o);const h=S("close",{xmlns:O.NS.FRAMING});this._conn.xmlOutput(h.tree());const _=O.serialize(h);this._conn.rawOutput(_);try{this.socket.send(_)}catch{O.warn("Couldn't send <close /> tag.")}}setTimeout(()=>this._conn._doDisconnect(),0)}_doDisconnect(){O.debug("WebSockets _doDisconnect was called"),this._closeSocket()}_streamWrap(o){return"<wrapper>"+o+"</wrapper>"}_closeSocket(){if(this.socket)try{this.socket.onclose=null,this.socket.onerror=null,this.socket.onmessage=null,this.socket.close()}catch(o){O.debug(o.message)}this.socket=null}_emptyQueue(){return!0}_onClose(o){this._conn.connected&&!this._conn.disconnecting?(O.error("Websocket closed unexpectedly"),this._conn._doDisconnect()):o&&o.code===1006&&!this._conn.connected&&this.socket?(O.error("Websocket closed unexcectedly"),this._conn._changeConnectStatus(O.Status.CONNFAIL,"The WebSocket connection could not be established or was disconnected."),this._conn._doDisconnect()):O.debug("Websocket closed")}_no_auth_received(o){O.error("Server did not offer a supported authentication mechanism"),this._conn._changeConnectStatus(O.Status.CONNFAIL,O.ErrorCondition.NO_AUTH_MECH),o?.call(this._conn),this._conn._doDisconnect()}_onDisconnectTimeout(){}_abortAllRequests(){}_onError(o){O.error("Websocket error "+JSON.stringify(o)),this._conn._changeConnectStatus(O.Status.CONNFAIL,"The WebSocket connection could not be established or was disconnected."),this._disconnect()}_onIdle(){const o=this._conn._data;if(o.length>0&&!this._conn.paused){for(let h=0;h<o.length;h++)if(o[h]!==null){const _=o[h]==="restart"?this._buildStream().tree():o[h];if(_==="restart")throw new Error("Wrong type for stanza");const N=O.serialize(_);this._conn.xmlOutput(_),this._conn.rawOutput(N),this.socket.send(N)}this._conn._data=[]}}_onMessage(o){let h;const _='<close xmlns="urn:ietf:params:xml:ns:xmpp-framing" />';if(o.data===_){this._conn.rawInput(_),this._conn.xmlInput(o),this._conn.disconnecting||this._conn._doDisconnect();return}else if(o.data.search("<open ")===0){if(h=new p().parseFromString(o.data,"text/xml").documentElement,!this._handleStreamStart(h))return}else{const N=this._streamWrap(o.data);h=new p().parseFromString(N,"text/xml").documentElement}if(!this._checkStreamError(h,O.Status.ERROR)){if(this._conn.disconnecting&&h.firstElementChild.nodeName==="presence"&&h.firstElementChild.getAttribute("type")==="unavailable"){this._conn.xmlInput(h),this._conn.rawInput(O.serialize(h));return}this._conn._dataRecv(h,o.data)}}_onOpen(){O.debug("Websocket open");const o=this._buildStream();this._conn.xmlOutput(o.tree());const h=O.serialize(o);this._conn.rawOutput(h),this.socket.send(h)}_send(){this._conn.flush()}_sendRestart(){clearTimeout(this._conn._idleTimeout),this._conn._onIdle.bind(this._conn)()}}class $e extends be{constructor(o){super(o),this._conn=o,this.worker=new SharedWorker(this._conn.options.worker,"Strophe XMPP Connection"),this.worker.onerror=h=>{var _;(_=console)===null||_===void 0||_.error(h),O.log(O.LogLevel.ERROR,`Shared Worker Error: ${h}`)}}_setSocket(){this.socket={send:o=>this.worker.port.postMessage(["send",o]),close:()=>this.worker.port.postMessage(["_closeSocket"]),onopen:()=>{},onerror:o=>this._onError(o),onclose:o=>this._onClose(o),onmessage:()=>{},readyState:null}}_connect(){this._setSocket(),this._messageHandler=o=>this._onInitialMessage(o),this.worker.port.start(),this.worker.port.onmessage=o=>this._onWorkerMessage(o),this.worker.port.postMessage(["_connect",this._conn.service,this._conn.jid])}_attach(o){this._setSocket(),this._messageHandler=h=>this._onMessage(h),this._conn.connect_callback=o,this.worker.port.start(),this.worker.port.onmessage=h=>this._onWorkerMessage(h),this.worker.port.postMessage(["_attach",this._conn.service])}_attachCallback(o,h){o===O.Status.ATTACHED?(this._conn.jid=h,this._conn.authenticated=!0,this._conn.connected=!0,this._conn.restored=!0,this._conn._changeConnectStatus(O.Status.ATTACHED)):o===O.Status.ATTACHFAIL&&(this._conn.authenticated=!1,this._conn.connected=!1,this._conn.restored=!1,this._conn._changeConnectStatus(O.Status.ATTACHFAIL))}_disconnect(o){o&&this._conn.send(o);const h=S("close",{xmlns:O.NS.FRAMING});this._conn.xmlOutput(h.tree());const _=O.serialize(h);this._conn.rawOutput(_),this.worker.port.postMessage(["send",_]),this._conn._doDisconnect()}_closeSocket(){this.socket.close()}_replaceMessageHandler(){this._messageHandler=o=>this._onMessage(o)}_onWorkerMessage(o){const h={};h.debug=O.LogLevel.DEBUG,h.info=O.LogLevel.INFO,h.warn=O.LogLevel.WARN,h.error=O.LogLevel.ERROR,h.fatal=O.LogLevel.FATAL;const{data:_}=o,N=_[0];if(N==="_onMessage")this._messageHandler(_[1]);else if(N in this)try{this[N].apply(this,o.data.slice(1))}catch(k){O.log(O.LogLevel.ERROR,k)}else if(N==="log"){const k=_[1],j=_[2];O.log(h[k],j)}else O.log(O.LogLevel.ERROR,`Found unhandled service worker message: ${_}`)}}const O={VERSION:"1.6.1",TIMEOUT:1.1,SECONDARY_TIMEOUT:.1,shims:v,Request:ht,Bosh:pe,Websocket:be,WorkerWebsocket:$e,SASLAnonymous:_e,SASLPlain:Fe,SASLSHA1:rt,SASLSHA256:Ge,SASLSHA384:it,SASLSHA512:dt,SA
7SLOAuthBearer:Ie,SASLExternal:Ne,SASLXOAuth2:ft,Builder:b,Connection:et,ElementType:s,ErrorCondition:u,Handler:fe,LogLevel:n,NS:T,SASLMechanism:ie,Status:c,TimedHandler:ve,...ye,XHTML:{...g,validTag:w,validCSS:U,validAttribute:B},addNamespace(C,o){O.NS[C]=o},_handleError(C){typeof C.stack<"u"&&O.fatal(C.stack),O.fatal("error: "+C.message)},log(C,o){if(C===this.LogLevel.FATAL){var h;(h=console)===null||h===void 0||h.error(o)}},debug(C){this.log(this.LogLevel.DEBUG,C)},info(C){this.log(this.LogLevel.INFO,C)},warn(C){this.log(this.LogLevel.WARN,C)},error(C){this.log(this.LogLevel.ERROR,C)},fatal(C){this.log(this.LogLevel.FATAL,C)},_requestId:0,_connectionPlugins:{},addConnectionPlugin(C,o){O._connectionPlugins[C]=o}},xt="http://www.w3.org/1999/xhtml";function pt(C,o){const h=O.xmlHtmlNode(C);if(h.getElementsByTagNameNS(xt,"parsererror").length)throw new Error(`Parser Error: ${C}`);const _=h.firstElementChild;if(["message","iq","presence"].includes(_.nodeName.toLowerCase())&&_.namespaceURI!=="jabber:client"&&_.namespaceURI!=="jabber:server"){const N=`Invalid namespaceURI ${_.namespaceURI}`;if(o)throw new Error(N);O.log(O.LogLevel.ERROR,N)}return _}class E{constructor(o,h){this.strings=o,this.values=h}toString(){return this.string=this.string||this.strings.reduce((o,h)=>{const _=this.strings.indexOf(h),N=this.values.length>_?this.values[_].toString():"";return o+h+N},""),this.string}tree(){var o;return this.node=(o=this.node)!==null&&o!==void 0?o:pt(this.toString(),!0),this.node}}function D(C,...o){return new E(C,o)}globalThis.$build=S,globalThis.$iq=m,globalThis.$msg=l,globalThis.$pres=y,globalThis.Strophe=O,t.$build=S,t.$iq=m,t.$msg=l,t.$pres=y,t.Builder=b,t.Strophe=O,t.stx=D,t.toStanza=pt,Object.defineProperty(t,"__esModule",{value:!0})}))})(bt,bt.exports)),bt.exports}var dn,mr;function vs(){if(mr)return dn;mr=1;var e;try{e=vt()}catch{e=vt()}var i=e&&(e.Strophe||e.default||e)||void 0;if(!i||!i.Connection)throw new Error("[QBChat] Strophe import failed: Connection class not found");var t=Re(),r=t.chatProtocol,a=Oe();function f(p){var d=r.active===1?r.bosh:r.websocket,v=new i.Connection(d),T=t.debug?p:null,g=function(c,u){if(T=t.debug?p:null,T&&typeof T=="function"){var n=u&&u.id?u.id:"",s=u&&u.innerHTML?u.innerHTML:"",S=u&&u.outerHTML?u.outerHTML:"";a.safeCallbackCall(T,"[QBChat][QBStrophe]"+c+" id:"+n+" innerHTML: "+s+" outerHTML: "+S+JSON.stringify(u))}};return r.active===1?(v.xmlInput=function(c){if(c.childNodes[0])for(var u=0,n=c.childNodes.length;u<n;u++)a.QBLog("[QBChat]","RECV:",c.childNodes[u]),g("RECV:",c.childNodes[u])},v.xmlOutput=function(c){if(c.childNodes[0])for(var u=0,n=c.childNodes.length;u<n;u++)a.QBLog("[QBChat]","SENT:",c.childNodes[u]),g("SENT",c.childNodes[u])}):(v.xmlInput=function(c){a.QBLog("[QBChat]","RECV:",c),g("RECV:",c),typeof c=="string"&&c.indexOf("groupchat")!==-1&&a.QBLog("[QBChat]","[TRANSPORT] Groupchat stanza received at WebSocket level");try{let s=new DOMParser().parseFromString(c,"text/xml").getElementsByTagName("error");if(s.length>0){let S=s[0].getElementsByTagName("condition");if(S.length>0){let l=S[0].textContent;console.log("Disconnect condition:",l),g("DISCONNECTED CONDITION:",l)}}}catch(u){console.error("Error parsing XML input:",u)}},v.xmlOutput=function(c){a.QBLog("[QBChat]","SENT:",c),g("SENT",c)}),v}return dn=f,dn}var fn,vr;function Cs(){if(vr)return fn;vr=1;var e=Vr(),i=Re(),t=Oe(),r=ds(),a="This function isn't supported outside of the browser (...yet)",f;if(t.getEnv().browser){var p=vs();Strophe.addNamespace("CARBONS",e.MARKERS.CARBONS),Strophe.addNamespace("CHAT_MARKERS",e.MARKERS.CHAT),Strophe.addNamespace("PRIVACY_LIST",e.MARKERS.PRIVACY),Strophe.addNamespace("CHAT_STATES",e.MARKERS.STATES)}else(t.getEnv().nativescript||t.getEnv().node)&&(f=Ht);function d(u){var n=this,s;n.webrtcSignalingProcessor=null,t.getEnv().browser?(n.connection=p(n._OnLogListener.bind(this)),n.connection.XHandlerReferences=[],n.connection.XAddTrackedHandler=function(l,m,y,b,R,I,A){n.connection.XHandlerReferences.push(n.connection.addHandler(l,m,y,b,R,I,A))},n.connection.XDeleteHandlers=function(){for(;n.connection.XHandlerReferences.length;)n.connection.deleteHandler(n.connection.XHandlerReferences.pop())},s=n.connection.send,n.connection.send=function(l){if(!n.connection.connected)throw new e.ChatNotConnectedError("Chat is not connected");s.call(n.connection,l)}):(t.getEnv().nativescript?n.Client=new f.Client({websocket:{url:i.chatProtocol.websocket},autostart:!1}):t.getEnv().node&&(n.Client=new f({autostart:!1})),s=n.Client.send,n.Client.send=function(l){t.QBLog("[QBChat]","SENT:",l.toString()),s.call(n.Client,l)},n.nodeStanzasCallbacks={}),this.service=u,this.isConnected=!1,this._isConnecting=!1,this._isLogout=!1,this._checkConnectionTimer=void 0,this._checkConnectionPingTimer=void 0,this._chatPingFailedCounter=0,this._onlineStatus=!0,this._checkExpiredSessionTimer=void 0,this._sessionHasExpired=!1,this._pings={},this._isConnectionVerified=!1,this._isReconnectListenerPending=!1,this.helpers=new c;var S={service:u,helpers:n.helpers,stropheClient:n.connection,xmppClient:n.Client,nodeStanzasCallbacks:n.nodeStanzasCallbacks};this.roster=new v(S),this.privacylist=new g(S),this.muc=new T(S),this.chatUtils=e,i.streamManagement.enable&&(i.chatProtocol.active===2?(this.streamManagement=new r(i.streamManagement),n._sentMessageCallback=function(l,m){typeof n.onSentMessageCallback=="function"&&(m?n.onSentMessageCallback(null,m):n.onSentMessageCallback(l))}):t.QBLog("[QBChat] StreamManagement:",`BOSH protocol doesn't support stream management. Set WebSocket as the "chatProtocol" parameter to use this functionality. https://quickblox.com/developers/Javascript#Configuration`)),this._onMessage=function(l){var m=e.getAttr(l,"from");e.getAttr(l,"to");var y=e.getAttr(l,"type"),b=e.getAttr(l,"id");t.QBLog("[QBChat]","[MSG_HANDLER] _onMessage invoked: type="+y+" from="+m+" id="+b);var R=e.getElement(l,"markable"),I=e.getElement(l,"received"),A=e.getElement(l,"displayed"),x=e.getElement(l,"composing"),M=e.getElement(l,"paused"),P=e.getElement(l,"invite"),L=e.getElement(l,"delay"),G=e.getElement(l,"extraParams"),$=e.getElementText(l,"body"),Q=e.getElement(l,"forwarded"),W,w,B,U;if(t.getEnv().browser)B=l.querySelector("forwarded")?l.querySelector("forwarded").querySelector("message").getAttribute("to"):null,U=n.connection.jid;else{var F=Q?e.getElement(Q,"message"):null;B=F?e.getAttr(F,"to"):null,U=n.Client.options.jid.user}w=B?n.helpers.getIdFromNode(B):null;
7var V=y==="groupchat"?n.helpers.getDialogIdFromNode(m):null,H=y==="groupchat"?n.helpers.getIdFromResource(m):n.helpers.getIdFromNode(m),z=I||A||null;if(P)return!0;if(G&&(W=e.parseExtraParams(G),W.dialogId&&(V=W.dialogId)),x||M)return typeof n.onMessageTypingListener=="function"&&(y==="chat"||y==="groupchat"||!L)&&t.safeCallbackCall(n.onMessageTypingListener,!!x,H,V),!0;if(z)return I?typeof n.onDeliveredStatusListener=="function"&&y==="chat"&&t.safeCallbackCall(n.onDeliveredStatusListener,e.getAttr(I,"id"),V,H):typeof n.onReadStatusListener=="function"&&y==="chat"&&t.safeCallbackCall(n.onReadStatusListener,e.getAttr(A,"id"),V,H),!0;if(R&&H!=n.helpers.getIdFromNode(U)){var re={messageId:b,userId:H,dialogId:V};n.sendDeliveredStatus(re)}var Y={id:b,dialog_id:V,recipient_id:w,type:y,body:$,extension:W?W.extension:null,delay:L};return R&&(Y.markable=1),typeof n.onMessageListener=="function"&&(y==="chat"||y==="groupchat")&&(t.QBLog("[QBChat]","[MSG_HANDLER] Calling onMessageListener: type="+y+" userId="+H+" msgId="+b),t.safeCallbackCall(n.onMessageListener,H,Y)),!0},this._onPresence=function(l){var m=e.getAttr(l,"from");e.getAttr(l,"to");var y=e.getAttr(l,"id"),b=e.getAttr(l,"type"),R=n.helpers.getIdFromNode(n.helpers.userCurrentJid(t.getEnv().browser?n.connection:n.Client)),I=e.getElement(l,"x"),A,x,M,P,L;if(I&&(A=e.getAttr(I,"xmlns"),x=e.getElement(I,"status"),x&&(M=e.getAttr(x,"code"))),A&&A.indexOf("muc")!==-1&&t.QBLog("[QBChat]","[MUC_PRESENCE] from="+m+" type="+(b||"available")+" statusCode="+(M||"none")+" id="+y+" xmlns="+A),A&&A=="http://jabber.org/protocol/muc#user"){if(P=n.helpers.getDialogIdFromN
7ode(m),L=n.helpers.getUserIdFromRoomJid(m),x&&M=="301"){if(typeof n.onKickOccupant=="function"){var G=e.getElement(e.getElement(I,"item"),"actor"),$=e.getAttr(G,"jid");t.safeCallbackCall(n.onKickOccupant,P,n.helpers.getIdFromNode($))}return delete n.muc.joinedRooms[n.helpers.getRoomJidFromRoomFullJid(m)],!0}else if(!x&&L!=R)return b&&b==="unavailable"?(typeof n.onLeaveOccupant=="function"&&t.safeCallbackCall(n.onLeaveOccupant,P,parseInt(L)),!0):(typeof n.onJoinOccupant=="function"&&t.safeCallbackCall(n.onJoinOccupant,P,parseInt(L)),!0)}if(!t.getEnv().browser&&A){if(A=="http://jabber.org/protocol/muc#user"){if(b&&b==="unavailable")return x&&M=="110"&&typeof n.nodeStanzasCallbacks["muc:leave"]=="function"&&t.safeCallbackCall(n.nodeStanzasCallbacks["muc:leave"],null),!0;if(y.endsWith(":join")&&x&&M=="110")return typeof n.nodeStanzasCallbacks[y]=="function"&&n.nodeStanzasCallbacks[y](l),!0}else if(b&&b==="error"&&A=="http://jabber.org/protocol/muc")return y.endsWith(":join")&&typeof n.nodeStanzasCallbacks[y]=="function"&&n.nodeStanzasCallbacks[y](l),!0}if(L=n.helpers.getIdFromNode(m),!b)typeof n.onContactListListener=="function"&&n.roster.contacts[L]&&n.roster.contacts[L].subscription!=="none"&&t.safeCallbackCall(n.onContactListListener,L);else switch(b){case"subscribe":n.roster.contacts[L]&&n.roster.contacts[L].subscription==="to"?(n.roster.contacts[L]={subscription:"both",ask:null},n.roster._sendSubscriptionPresence({jid:m,type:"subscribed"})):typeof n.onSubscribeListener=="function"&&t.safeCallbackCall(n.onSubscribeListener,L);break;case"subscribed":n.roster.contacts[L]&&n.roster.contacts[L].subscription==="from"?n.roster.contacts[L]={subscription:"both",ask:null}:(n.roster.contacts[L]={subscription:"to",ask:null},typeof n.onConfirmSubscribeListener=="function"&&t.safeCallbackCall(n.onConfirmSubscribeListener,L));break;case"unsubscribed":n.roster.contacts[L]={subscription:"none",ask:null},typeof n.onRejectSubscribeListener=="function"&&t.safeCallbackCall(n.onRejectSubscribeListener,L);break;case"unsubscribe":n.roster.contacts[L]={subscription:"to",ask:null};break;case"unavailable":typeof n.onContactListListener=="function"&&n.roster.contacts[L]&&n.roster.contacts[L].subscription!=="none"&&t.safeCallbackCall(n.onContactListListener,L,b),L===R&&(t.getEnv().browser?n.connection.send($pres()):n.Client.send(e.createStanza(f.Stanza,null,"presence")));break}return!0},this._onIQ=function(l){var m=e.getAttr(l,"id"),y=m.indexOf("lastActivity")>-1,b=m.indexOf("ping")>-1,R=e.getElement(l,"ping"),I=e.getAttr(l,"type"),A=e.getAttr(l,"from"),x=A?n.helpers.getIdFromNode(A):null;if(typeof n.onLastUserActivityListener=="function"&&y){var M=e.getElement(l,"query"),P=e.getElement(l,"error"),L=P?void 0:+e.getAttr(M,"seconds");t.safeCallbackCall(n.onLastUserActivityListener,x,L)}if((R||b)&&I)if(I==="get"&&R&&n.isConnected){var G=t.getEnv().browser?$iq:f.Stanza,$={from:n.helpers.getUserCurrentJid(),id:m,to:A,type:"result"},Q=e.createStanza(G,$,"iq");t.getEnv().browser?n.connection.send(Q):n.Client.send(Q)}else{var W=n._pings[m];W&&(W.callback&&W.callback(null),W.interval&&clearInterval(W.interval),n._pings[m]=void 0,delete n._pings[m])}return t.getEnv().browser||n.nodeStanzasCallbacks[m]&&(t.safeCallbackCall(n.nodeStanzasCallbacks[m],l),delete n.nodeStanzasCallbacks[m]),!0},this._onSystemMessageListener=function(l){var m=e.getAttr(l,"from");e.getAttr(l,"to");var y=e.getAttr(l,"id"),b=e.getElement(l,"extraParams"),R=n.helpers.getIdFromNode(m),I=e.getElement(l,"delay"),A=e.getElementText(b,"moduleIdentifier"),x=e.getElementText(l,"body"),M=e.parseExtraParams(b),P;return A==="SystemNotifications"&&typeof n.onSystemMessageListener=="function"?(P={id:y,userId:R,body:x,extension:M.extension},t.safeCallbackCall(n.onSystemMessageListener,P)):n.webrtcSignalingProcessor&&!I&&A==="WebRTCVideoChat"&&n.webrtcSignalingProcessor._onMessage(m,b,I,R,M.extension),!0},this._onMessageErrorListener=function(l){var m=e.getAttr(l,"id"),y=e.getErrorFromXMLNode(l);return typeof n.onMessageErrorListener=="function"&&t.safeCallbackCall(n.onMessageErrorListener,m,y),!0}}d.prototype={_OnLogListener:function(u){var n=this;typeof n.onLogListener=="function"&&t.safeCallbackCall(n.onLogListener,u)},connect:function(u,n){t.QBLog("[QBChat]","Connect with parameters "+JSON.stringify(u));var s=this,S=e.buildUserJid(u),l=typeof n=="function",m;if(s._isConnecting){m=t.getError(422,"Status.REJECT - The connection is still in the Status.CONNECTING state","QBChat"),l&&n(m,null);return}if(s.isConnected){t.QBLog("[QBChat]","Status.CONNECTED - You are already connected"),l&&n(null,s.roster.contacts);return}s._isConnecting=!0,s._isLogout=!1,t.getEnv().browser&&(t.QBLog("[QBChat]","!!---Browser env - connected--!!"),s.c
7onnection.connect(S,u.password,function(y,b,R){switch(t.QBLog("[QBChat]","self.connection.connect called with status "+y),t.QBLog("[QBChat]","self.connection.connect called with condition "+b),t.QBLog("[QBChat]","self.connection.connect called with elem "+R),y){case Strophe.Status.ERROR:t.QBLog("[QBChat]","Status.ERROR at "+e.getLocalTime()),t.QBLog("[QBChat]","ERROR CONDITION: "+b),typeof s.onLogListener=="function"&&t.safeCallbackCall(s.onLogListener,"[QBChat][SDK v"+i.version+"] Status.ERROR at "+e.getLocalTime()+" ERROR CONDITION: "+b),s.isConnected=!1,s._isConnecting=!1,m=t.getError(422,"Status.ERROR - An error has occurred","QBChat"),l&&n(m,null);break;case Strophe.Status.CONNFAIL:t.QBLog("[QBChat]","Status.CONNFAIL at "+e.getLocalTime()),t.QBLog("[QBChat]","CONNFAIL CONDITION: "+b),typeof s.onLogListener=="function"&&t.safeCallbackCall(s.onLogListener,"[QBChat][SDK v"+i.version+"] Status.CONNFAIL at "+e.getLocalTime()+" CONNFAIL CONDITION: "+b),s.isConnected=!1,s._isConnecting=!1,m=t.getError(422,"Status.CONNFAIL - The connection attempt failed","QBChat"),l&&n(m,null);break;case Strophe.Status.AUTHENTICATING:t.QBLog("[QBChat]","Status.AUTHENTICATING at "+e.getLocalTime()),t.QBLog("[QBChat]","AUTHENTICATING CONDITION: "+b),typeof s.onLogListener=="function"&&t.safeCallbackCall(s.onLogListener,"[QBChat][SDK v"+i.version+"] Status.AUTHENTICATING at "+e.getLocalTime()+" AUTHENTICATING CONDITION: "+b);break;case Strophe.Status.AUTHFAIL:t.QBLog("[QBChat]","Status.AUTHFAIL at "+e.getLocalTime()),t.QBLog("[QBChat]","AUTHFAIL CONDITION: "+b),typeof s.onLogListener=="function"&&t.safeCallbackCall(s.onLogListener,"[QBChat][SDK v"+i.version+"] Status.AUTHFAIL at "+e.getLocalTime()+" AUTHFAIL CONDITION: "+b),s.isConnected=!1,s._isConnecting=!1,m=t.getError(401,"Status.AUTHFAIL - The authentication attempt failed","QBChat"),l&&n(m,null),!s.isConnected&&typeof s.onReconnectFailedListener=="function"&&t.safeCallbackCall(s.onReconnectFailedListener,m);break;case Strophe.Status.CONNECTING:t.QBLog("[QBChat]","Status.CONNECTING","(Chat Protocol - "+(i.chatProtocol.active===1?"BOSH":"WebSocket)")),t.QBLog("[QBChat]","Status.CONNECTING at "+e.getLocalTime()),t.QBLog("[QBChat]","CONNECTING CONDITION: "+b),typeof s.onLogListener=="function"&&t.safeCallbackCall(s.onLogListener,"[QBChat][SDK v"+i.version+"] Status.CONNECTING at (Chat Protocol - "+i.chatProtocol.active===1?"BOSH":"WebSocket)"+e.getLocalTime()+" CONNECTING CONDITION: "+b);break;case Strophe.Status.CONNECTED:t.QBLog("[QBChat]","Status.CONNECTED at "+e.getLocalTime()),t.QBLog("[QBChat]","CONNECTED CONDITION: "+b),typeof s.onLogListener=="function"&&t.safeCallbackCall(s.onLogListener,"[QBChat][SDK v"+i.version+"] Status.CONNECTED at "+e.getLocalTime()+" CONNECTED CONDITION: "+b),s.connection.XDeleteHandlers(),s.connection.XAddTrackedHandler(s._onMessage,null,"message","chat"),s.connection.XAddTrackedHandler(s._onMessage,null,"message","groupchat"),s.connection.XAddTrackedHandler(s._onPresence,null,"presence"),s.connection.XAddTrackedHandler(s._onIQ,null,"iq"),s.connection.XAddTrackedHandler(s._onSystemMessageListener,null,"message","headline"),s.connection.XAddTrackedHandler(s._onMessageErrorListener,null,"message","error"),t.QBLog("[QBChat]","[HANDLERS] Registered handler count after reconnect: "+s.connection.XHandlerReferences.length);var I=typeof s._checkConnectionPingTimer>"u";if(I=i.pingLocalhostTimeInterval===0?!1:I,I&&(t.QBLog("[QBChat]","Init ping to chat at ",t.getCurrentTime()),s._checkConnectionPingTimer=setInterval(function(){try{s.pingchat(function(x){x?(t.QBLog("[QBChat]","Chat Ping: ","failed, at ",t.getCurrentTime(),"_chatPingFailedCounter: ",s._chatPingFailedCounter," error: ",x),s._chatPingFailedCounter+=1,s._chatPingFailedCounter>=i.chatPingMissLimit&&(s.isConnected&&s._isConnectionVerified&&typeof s.onDisconnectedListener=="function"&&t.safeCallbackCall(s.onDisconnectedListener),s._isConnectionVerified=!1,s._isReconnectListenerPending=!1,s.isConnected=!1,s._isConnecting=!1,s._chatPingFailedCounter=0,s._checkConnectionPingTimer!==void 0&&(clearInterval(s._checkConnectionPingTimer),s._checkConnectionPingTimer=void 0),s._establishConnection(u,"CONNECTED have SDK ping failed"))):(t.QBLog("[QBChat]","Chat Ping: ","ok, at ",t.getCurrentTime(),"_chatPingFailedCounter: ",s._chatPingFailedCounter),s._chatPingFailedCounter=0,s._isReconnectListenerPending&&!s._isLogout?(s._isConnectionVerified=!0,s._isReconnectListenerPending=!1,t.QBLog("[QBChat]","[QC-1550] First pong success, firing deferred onReconnectListener at ",t.getCurrentTime()),typeof s.onLogListener=="function"&&t.safeCallbackCall(s.onLogListener,"[QBChat] [QC-1550] First pong success, firing deferred onReconnectListener at "+e.getLocalTime()),typeof s.onReconnectListener=="function"&&t.safeCallbackCall(s.onReconnectListener)):!s._isConnectionVerified&&!s._isLogout&&(s._isConnectionVerified=!0))})}catch(x){t.QBLog("[QBChat]","Chat Ping: ","Exception, at ",t.getCurrentTime(),", detail info: ",x)}},i.pingLocalhostTimeInterval*1e3)),typeof s.onSessionExpiredListener=="function"){var A=typeof s._checkExpiredSessionTimer>"u";A&&(t.QBLog("[QBChat]","Init timer for check session expired at ",new Date().toTimeStr
7ing().split(" ")[0]),s._checkExpiredSessionTimer=setInterval(function(){var x=new Date;if(typeof i.qbTokenExpirationDate<"u"){var M=Math.round((x.getTime()-i.qbTokenExpirationDate.getTime())/6e4);M>=0&&(s._sessionHasExpired=!0,t.safeCallbackCall(s.onSessionExpiredListener,null))}},5*1e3))}s._postConnectActions(function(x){n(null,x)},l);break;case Strophe.Status.DISCONNECTING:t.QBLog("[QBChat]","Status.DISCONNECTING at "+e.getLocalTime()),t.QBLog("[QBChat]","DISCONNECTING CONDITION: "+b),typeof s.onLogListener=="function"&&t.safeCallbackCall(s.onLogListener,"[QBChat][SDK v"+i.version+"] Status.DISCONNECTING at "+e.getLocalTime()+" DISCONNECTING CONDITION: "+b);break;case Strophe.Status.DISCONNECTED:t.QBLog("[QBChat]","Status.DISCONNECTED at "+e.getLocalTime()),t.QBLog("[QBChat]","DISCONNECTED CONDITION: "+b),typeof s.onLogListener=="function"&&t.safeCallbackCall(s.onLogListener,"[QBChat][SDK v"+i.version+"] Status.DISCONNECTED at "+e.getLocalTime()+" DISCONNECTED CONDITION: "+b),s.isConnected&&s._isConnectionVerified&&typeof s.onDisconnectedListener=="function"&&t.safeCallbackCall(s.onDisconnectedListener),s._isConnectionVerified=!1,s._isReconnectListenerPending=!1,s._checkConnectionPingTimer!==void 0&&(clearInterval(s._checkConnectionPingTimer),s._checkConnectionPingTimer=void 0),s.isConnected=!1,s._isConnecting=!1,s.connection.reset(),s._establishConnection(u,"DISCONNECTED");break;case Strophe.Status.ATTACHED:t.QBLog("[QBChat]","Status.ATTACHED at "+e.getLocalTime()),t.QBLog("[QBChat]","ATTACHED CONDITION: "+b),typeof s.onLogListener=="function"&&t.safeCallbackCall(s.onLogListener,"[QBChat][SDK v"+i.version+"] Status.ATTACHED at "+e.getLocalTime()+" ATTACHED CONDITION: "+b);break;case Strophe.Status.REDIRECT:t.QBLog("[QBChat]","Status.REDIRECT at "+e.getLocalTime()),t.QBLog("[QBChat]","REDIRECT CONDITION: "+b),typeof s.onLogListener=="function"&&t.safeCallbackCall(s.onLogListener,"[QBChat][SDK v"+i.version+"] Status.REDIRECT at "+e.getLocalTime()+" REDIRECT CONDITION: "+b);break;case Strophe.Status.CONNTIMEOUT:t.QBLog("[QBChat]","Status.CONNTIMEOUT at "+e.getLocalTime()),t.QBLog("[QBChat]","CONNTIMEOUT CONDITION: "+b),typeof s.onLogListener=="function"&&t.safeCallbackCall(s.onLogListener,"[QBChat][SDK v"+i.version+"] Status.CONNTIMEOUT at "+e.getLocalTime()+" CONNTIMEOUT CONDITION: "+b);break;case Strophe.Status.BINDREQUIRED:t.QBLog("[QBChat]","Status.BINDREQUIRED at "+e.getLocalTime()),t.QBLog("[QBChat]","BINDREQUIRED CONDITION: "+b),typeof s.onLogListener=="function"&&t.safeCallbackCall(s.onLogListener,"[QBChat][SDK v"+i.version+"] Status.BINDREQUIRED at "+e.getLocalTime()+" BINDREQUIRED CONDITION: "+b);break;case Strophe.Status.ATTACHFAIL:t.QBLog("[QBChat]","Status.ATTACHFAIL at "+e.getLocalTime()),t.QBLog("[QBChat]","ATTACHFAIL CONDITION: "+b),typeof s.onLogListener=="function"&&t.safeCallbackCall(s.onLogListener,"[QBChat][SDK v"+i.version+"] Status.ATTACHFAIL at "+e.getLocalTime()+" ATTACHFAIL CONDITION: "+b);break;default:t.QBLog("[QBChat]","Status is unknown at "+e.getLocalTime()),t.QBLog("[QBChat]","unknown CONDITION: "+b),typeof s.onLogListener=="function"&&t.safeCallbackCall(s.onLogListener,"[QBChat][SDK v"+i.version+"] Status is unknown at "+e.getLocalTime()+" unknown CONDITION: "+b);break}})),t.getEnv().browser||(t.QBLog("[QBChat]","!!--call branch code connect for node--!!"),s.Client.removeAllListeners(),s.Client.on("connect",function(){t.QBLog("[QBChat]","Status.CONNECTING","(Chat Protocol - "+(i.chatProtocol.active===1?"BOSH":"WebSocket)"))}),s.Client.on("auth",function(){t.QBLog("[QBChat]","Status.AUTHENTICATING")}),s.Client.on("online",function(){s._postConnectActions(function(y){n(null,y)},l)}),s.Client.on("stanza",function(y){t.QBLog("[QBChat] RECV:",y.toString()),y.is("presence")?s._onPresence(y):y.is("iq")?s._onIQ(y):y.is("message")&&(y.attrs.type==="headline"?s._onSystemMessageListener(y):y.attrs.type==="error"?s._onMessageErrorListener(y):s._onMessage(y))}),s.Client.on("disconnect",function(){t.QBLog("[QBChat]","Status.DISCONNECTED - "+e.getLocalTime()),typeof s.onDisconnectedListener=="function"&&t.safeCallbackCall(s.onDisconnectedListener),s.isConnected=!1,s._isConnecting=!1,s._establishConnection(u,"NODE:DISCONNECTED")}),s.Client.on("error",function(){t.QBLog("[QBChat]","Status.ERROR - "+e.getLocalTime()),m=t.getError(422,"Status.ERROR - An error has occurred","QBChat"),l&&n(m,null),s.isConnected=!1,s._isConnecting=!1}),s.Client.on("end",function(){s.Client.removeAllListeners()}),s.Client.options.jid=S,s.Client.options.password=u.password,s.Client.connect())},_postConnectActions:function(u,n){t.QBLog("[QBChat]","Status.CONNECTED at "+e.getLocalTime());var s=this,S=t.getEnv().browser,l=S?s.connection:s.Client,m=S?$pres():e.createStanza(f.Stanza,null,"presence");if(i.streamManagement.enable&&i.chatProtocol.active===2&&(s.streamManagement.enable(s.connection,null),s.streamManagement.sentMessageCallback=s._sentMessageCallback),s.helpers.setUserCurrentJid(s.helpers.userCurrentJid(l)),s.isConnected=!0,s._isConnecting=!1,s._sessionHasExpired=!1,s._enableCarbons(),n)s._isConnectionVerified=!0,s._isReconnectListenerPending=!1,s.roster.get(function(I){l.send(m),s.roster.contacts=I,u(s.roster.contacts)});else{var y=Object.keys(s.muc.joinedRooms);l.send(m),t.QBLog("[QBChat]","Re-joining "+y.length+" rooms...");for(var b=0,R=y.length;b<R;b++)(function(I,A){t.QBLog("[QBChat]","[MUC_REJOIN] Sending join for room "+(A+1)+"/"+R+": "+I),s.muc.join(I,function(x,M){M&&M.dialogId?t.QBLog("[QBChat]","[MUC_REJOIN] Room join CONFIRMED by server: dialogId="+M.dialogId+" room="+I):t.QBLog("[QBChat]","[MUC_REJOIN] Room join RESPONSE (possible error): room="+I+" error="+JSON.stringify(x))})})(y[b],b);t.QBLog("[QBChat]","[MUC_REJOIN] All "+y.length+" join presences sent. Awaiting server confirmations..."),s._isConnectionVerified=!1,i.pingLocalhostTimeInterval===0?(t.QBLog("[QBChat]","[QC-1550] pingLocalhostTimeInterval=0, firing onReconnectListener immediately (ping disabled)"),s._isConnectionVerified=!0,s._isReconnectListenerPending=!1,typeof s.onReconnectListener=="function"&&t.safeCallbackCall(s.onReconnectListener)):(s._isReconnectListenerPending=!0,t.QBLog("[QBChat]","[QC-1550] onReconnectListener deferred until first pong success"),typeof s.onLogListener=="function"&&t.safeCallbackCall(s.onLogListener,"[QBChat] [QC-1550] onReconnectListener deferred at "+e.getLocalTime()+" — awaiting first pong"))}},_establishConnection:function(u,n){var s=this;if(t.QBLog("[QBChat]","[RECONNECT] _establishConnection called at "+e.getLocalTime()+" in "+n+" _isLogout="+s._isLogout+" timerExists="+!!s._checkConnectionTimer+" _isConnecting="+s._isConnecting+" isConnected="+s.isConnected+" verified="+s._isConnectionVerified+" pending="+s._isReconnectListenerPending),typeof s.onLogListener=="function"&&t.safeCallbackCall(s.onLogListener,"[QBChat] [RECONNECT] _establishConnection called at "+e.getLocalTime()+" in "+n+" _isLogout="+s._isLogout+" timerExists="+!!s._checkConnectionTimer+" _isConnecting="+s._isConnecting+" isConnected="+s.isConnected+" verified="+s._isConnectionVerified+" pending="+s._isReconnectListenerPending),s._isLogout||s._checkConnectionTimer){t.QBLog("[QBChat]","[RECONNECT] _establishConnection SKIPPED at "+e.getLocalTime()+" — _isLogout="+s._isLogout+" timerExists="+!!s._checkConnectionTimer),typeof s.onLogListener=="function"&&t.safeCallbackCall(s.onLogListener,"[QBChat] [RECONNECT] _establishConnection SKIPPED at "+e.getLocalTime()+" — _isLogout="+s._isLogout+" timerExists="+!!s._checkConnectionTimer);return}var S=function(){t.QBLog("[QBChat]","[RECONNECT] _connect() at "+e.getLocalTime()+" isConnected="+s.isConnected+" _isConnecting="+s._isConnecting+" _sessionHasExpired="+s._sessionHasExpired+" verified="+s._isConnectionVerified+" pending="+s._isReconnectListenerPending),typeof s.onLogListener=="function"&&t.safeCallbackCall(s.onLogListener,"[QBChat] [RECONNECT] _connect() at "+e.getLocalTime()+" isConnected="+s.isConnected+" _isConnecting="+s._isConnecting+" _sessionHasExpired="+s._sessionHasExpired+" verified="+s._isConnectionVerified+" pending="+s._isReconnectListenerPending),!s.isConnected&&!s._isConnecting&&!s._sessionHasExpired?(t.QBLog("[QBChat]","[RECONNECT] executing connect() at "+e.getLocalTime()),typeof s.onLogListener=="function"&&t.safeCallbackCall(s.onLogListener,"[QBChat] [RECONNECT] executing connect() at "+e.getLocalTime()+" in "+n),s.connect(u)):s.isConnected||s._sessionHasExpired?(t.QBLog("[QBChat]","[RECONNECT] timer stopped at "+e.getLocalTime()+" — isConnected="+s.isConnected+" _sessionHasExpired="+s._sessionHasExpired+" verified="+s._isConnectionVerified+" pending="+s._isReconnectListenerPending),clearInterval(s._checkConnectionTimer),s._checkConnectionTimer=void 0,typeof s.onLogListener=="function"&&t.safeCallbackCall(s.onLogListener,"[QBChat] [RECONNECT] timer stopped at "+e.getLocalTime()+" — isConnected="+s.isConnected+" _sessionHasExpired="+s._sessionHasExpired+" verified="+s._isConnectionVerified+" pending="+s._isReconnectListenerPending)):(t.QBLog("[QBChat]","[RECONNECT] _connect() SKIPPED at "+e.getLocalTime()+" — _isConnecting=true, waiting for next tick"),typeof s.onLogListener=="function"&&t.safeCallbackCall(s.onLogListener,"[QBChat] [RECONNECT] _connect() SKIPPED at "+e.getLocalTime()+" — _isConnecting=true, waiting for next tick"))};S(),s._checkConnectionTimer=setInterval(function(){t.QBLog("[QBChat]","[RECONNECT] timer tick at "+e.getLocalTime()+" interval="+i.chatReconnectionTimeInterval+"s"),typeof s.onLogListener=="function"&&t.safeCallbackCall(s.onLogListener,"[QBChat] [RECONNECT] timer tick at "+e.getLocalTime()+" interval="+i.chatReconnectionTimeInterval+"s"),S()},i.chatReconnectionTimeInterval*1e3)},reconnect:function(){t.QBLog("[QBChat]","Call reconnect "),typeof this.onLogListener=="function"&&t.safeCallbackCall(this.onLogListener,"[QBChat][SDK v"+i.version+"] Call reconnect "+e.getLocalTime()),clearInterval(this._checkConnectionTimer),this._checkConnectionTimer=void 0,this._checkConnectionPingTimer!==void 0&&(clearInterval(this._checkConnectionPingTimer),this._checkConnectionPingTimer=void 0),this._isConnectionVerified=!1,this._isReconnectListenerPending=!1,this.muc.joinedRooms={},this.helpers.setUserCurrentJid(""),t.getEnv().browser?(this.connection.flush(),this.connection.disconnect("call Qb.chat.re
7connect")):this.Client.end()},send:function(u,n){t.QBLog("[QBChat]","Call send "+JSON.stringify(n));var s=this,S=t.getEnv().browser?$msg:f.Stanza,l={from:s.helpers.getUserCurrentJid(),to:this.helpers.jidOrUserId(u),type:n.type?n.type:"chat",id:n.id?n.id:t.getBsonObjectId()},m=e.createStanza(S,l);return n.body&&m.c("body",{xmlns:e.MARKERS.CLIENT}).t(n.body).up(),n.markable&&m.c("markable",{xmlns:e.MARKERS.CHAT}).up(),n.extension&&(m.c("extraParams",{xmlns:e.MARKERS.CLIENT}),m=e.filledExtraParams(m,n.extension)),t.getEnv().browser?i.streamManagement.enable?(n.id=l.id,n.jid_or_user_id=u,s.connection.send(m,n)):s.connection.send(m):i.streamManagement.enable?(n.id=l.id,n.jid_or_user_id=u,s.Client.send(m,n)):s.Client.send(m),l.id},sendSystemMessage:function(u,n){t.QBLog("[QBChat]","Call sendSystemMessage "+JSON.stringify(n));var s=this,S=t.getEnv().browser?$msg:f.Stanza,l={type:"headline",id:n.id?n.id:t.getBsonObjectId(),to:this.helpers.jidOrUserId(u)},m=e.createStanza(S,l);return n.body&&m.c("body",{xmlns:e.MARKERS.CLIENT}).t(n.body).up(),t.getEnv().browser?(n.extension&&(m.c("extraParams",{xmlns:e.MARKERS.CLIENT}).c("moduleIdentifier").t("SystemNotifications").up(),m=e.filledExtraParams(m,n.extension)),s.connection.send(m)):(n.extension&&(m.c("extraParams",{xmlns:e.MARKERS.CLIENT}).c("moduleIdentifier").t("SystemNotifications"),m=e.filledExtraParams(m,n.extension)),s.Client.send(m)),l.id},sendIsTypingStatus:function(u){t.QBLog("[QBChat]","Call sendIsTypingStatus ");var n=this,s={from:n.helpers.getUserCurrentJid(),to:this.helpers.jidOrUserId(u),type:this.helpers.typeChat(u)},S=t.getEnv().browser?$msg:f.Stanza,l=e.createStanza(S,s);l.c("composing",{xmlns:e.MARKERS.STATES}),t.getEnv().browser?n.connection.send(l):n.Client.send(l)},sendIsStopTypingStatus:function(u){t.QBLog("[QBChat]","Call sendIsStopTypingStatus ");var n=this,s={from:n.helpers.getUserCurrentJid(),to:this.helpers.jidOrUserId(u),type:this.helpers.typeChat(u)},S=t.getEnv().browser?$msg:f.Stanza,l=e.createStanza(S,s);l.c("paused",{xmlns:e.MARKERS.STATES}),t.getEnv().browser?n.connection.send(l):n.Client.send(l)},sendDeliveredStatus:function(u){t.QBLog("[QBChat]","Call sendDeliveredStatus ");var n=this,s={type:"chat",from:n.helpers.getUserCurrentJid(),id:t.getBsonObjectId(),to:this.helpers.jidOrUserId(u.userId)},S=t.getEnv().browser?$msg:f.Stanza,l=e.createStanza(S,s);l.c("received",{xmlns:e.MARKERS.MARKERS,id:u.messageId}).up(),l.c("extraParams",{xmlns:e.MARKERS.CLIENT}).c("dialog_id").t(u.dialogId),t.getEnv().browser?n.connection.send(l):n.Client.send(l)},sendReadStatus:function(u){t.QBLog("[QBChat]","Call sendReadStatus "+JSON.stringify(u));var n=this,s={type:"chat",from:n.helpers.getUserCurrentJid(),to:this.helpers.jidOrUserId(u.userId),id:t.getBsonObjectId()},S=t.getEnv().browser?$msg:f.Stanza,l=e.createStanza(S,s);l.c("displayed",{xmlns:e.MARKERS.MARKERS,id:u.messageId}).up(),l.c("extraParams",{xmlns:e.MARKERS.CLIENT}).c("dialog_id").t(u.dialogId),t.getEnv().browser?n.connection.send(l):n.Client.send(l)},getLastUserActivity:function(u){t.QBLog("[QBChat]","Call getLastUserActivity ");var n,s,S;n={from:this.helpers.getUserCurrentJid(),id:this.helpers.getUniqueId("lastActivity"),to:this.helpers.jidOrUserId(u),type:"get"},s=t.getEnv().browser?$iq:f.Stanza,S=e.createStanza(s,n,"iq"),S.c("query",{xmlns:e.MARKERS.LAST}),t.getEnv().browser?this.connection.sendIQ(S):this.Client.send(S)},pingchat:function(u){t.QBLog("[QBChat]","ping chat");var n=this,s=this.helpers.getUniqueId("ping"),S=t.getEnv().browser?$iq:f.Stanza,l,m,y;l=i.endpoints.chat?i.endpoints.chat:"chat.quickblox.com",m=u;var b={from:this.helpers.getUserCurrentJid(),id:s,to:l,type:"get"};y=e.createStanza(S,b,"iq"),y.c("ping",{xmlns:"urn:xmpp:ping"});var R=function(){m("Chat ping No answer"),n._pings[s]=void 0,delete n._pings[s]};return t.getEnv().browser?this.connection.send(y):this.Client.send(y),this._pings[s]={callback:m,interval:setTimeout(R,i.pingTimeout*1e3)},s},ping:function(u,n){t.QBLog("[QBChat]","Call ping ");var s=this,S=this.helpers.getUniqueId("ping"),l=t.getEnv().browser?$iq:f.Stanza,m,y,b;if((typeof u=="string"||typeof u=="number")&&typeof n=="function")m=this.helpers.jidOrUserId(u),y=n;else if(typeof u=="function"&&!n)m=i.endpoints.chat,y=u;else throw new Error("Invalid arguments provided. Either userId/jid (number/string) and callback or only callback should be provided.");var R={from:this.helpers.getUserCurrentJid(),id:S,to:m,type:"get"};b=e.createStanza(l,R,"iq"),b.c("ping",{xmlns:"urn:xmpp:ping"});var I=function(){y("No answer"),s._pings[S]=void 0,delete s._pings[S]};return t.getEnv().browser?this.connection.send(b):this.Client.send(b),this._pings[S]={callback:y,interval:setTimeout(I,i.pingTimeout*1e3)},S},disconnect:function(){t.QBLog("[QBChat]","Call disconnect "),typeof this.onLogListener=="function"&&t.safeCallbackCall(this.onLogListener,"[QBChat][SDK v"+i.version+"] Call disconnect "+e.getLocalTime()),clearInterval(this._checkConnectionTimer),clearInterval(this._checkExpiredSessionTimer),this._checkConnectionTimer=void 0,this._checkExpiredSessionTimer=void 0,this.muc.joinedRooms={},this._isConnectionVerified=!1,this._isReconnectListenerPending=!1,this._isLogout=!0,this.helpers.setUserCurrentJid(""),t.getEnv().browser?(this.connection.flush(),this.connection.disconnect("call QB.chat.disconnect"),this._checkConnectionPingTimer!==void 0&&(t.QBLog("[QBChat]","Stop ping"),clearInterval(this._checkConnectionPingTimer),this._checkConnectionPingTimer=void 0)):this.Client.end()},addListener:function(u,n){if(t.QBLog("[Deprecated!]","Avoid using it, this feature will be removed in future version."),!t.getEnv().browser)throw new Error(a);return this.connection.XAddTrackedHandler(s,null,u.name||null,u.type||null,u.id||null,u.from||null);function s(){return n(),u.live!==!1}},deleteListener:function(u){if(t.QBLog("[Deprecated!]","Avoid using it, this feature will be removed in future version."),!t.getEnv().browser)throw new Error(a);this.connection.deleteHandler(u)},_enableCarbons:function(u){var n=this,s={type:"set",from:n.helpers.getUserCurrentJid(),id:e.getUniqueId("enableCarbons")},S=t.getEnv().browser?$iq:f.Stanza,l=e.createStanza(S,s,"iq");l.c("enable",{xmlns:e.MARKERS.CARBONS}),t.getEnv().browser?n.connection.sendIQ(l):n.Client.send(l)}};function v(u){this.service=u.service,this.helpers=u.helpers,this.connection=u.stropheClient,this.Client=u.xmppClient,this.nodeStanzasCallbacks=u.nodeStanzasCallbacks,this.contacts={}}v.prototype={get:function(u){var n=this,s={},S={type:"get",from:n.helpers.getUserCurrentJid(),id:e.getUniqueId("getRoster")},l=t.getEnv().browser?$iq:f.Stanza,m=e.createStanza(l,S,"iq");function y(R){return t.getEnv().browser?R.getElementsByTagName("item"):R.getChild("query").children}function b(R){for(var I=y(R),A=0,x=I.length;A<x;A++){var M=n.helpers.getIdFromNode(e.getAttr(I[A],"jid")),P=e.getAttr(I[A],"ask"),L=e.getAttr(I[A],"subscription");s[M]={subscription:L,ask:P||null}}u(s)}m.c("query",{xmlns:e.MARKERS.ROSTER}),t.getEnv().browser?n.connection.sendIQ(m,b):(n.nodeStanzasCallbacks[S.id]=b,n.Client.send(m))},add:function(u,n){var s=this,S=this.helpers.jidOrUserId(u),l=this.helpers.getIdFromNode(S).toString();s.contacts[l]={subscription:"none",ask:"subscribe"},s._sendSubscriptionPresence({jid:S,type:"subscribe"}),typeof n=="function"&&n()},confirm:function(u,n){var s=this,S=this.helpers.jidOrUserId(u),l=this.helpers.getIdFromNode(S).toString();s.contacts[l]={subscription:"from",ask:"subscribe"},s._sendSubscriptionPresence({jid:S,type:"subscribed"}),s._sendSubscriptionPresence({jid:S,type:"subscribe"}),typeof n=="function"&&n()},reject:function(u,n){var s=this,S=this.helpers.jidOrUserId(u),l=this.helpers.getIdFromNode(S).toString();s.contacts[l]={subscription:"none",ask:null},s._sendSubscriptionPresence({jid:S,type:"unsubscribed"}),typeof n=="function"&&n()},remove:function(u,n){var s=this,S=this.helpers.jidOrUserId(u),l=this.helpers.getIdFromNode(S),m={type:"set",from:s.connection?s.connection.jid:s.Client.jid.user,id:e.getUniqueId("getRoster")},y=t.getEnv().browser?$iq:f.Stanza,b=e.createStanza(y,m,"iq");function R(){delete s.contacts[l],typeof n=="function"&&n()}b.c("query",{xmlns:e.MARKERS.ROSTER}).c("item",{jid:S,subscription:"remove"}
7),t.getEnv().browser?s.connection.sendIQ(b,R):(s.nodeStanzasCallbacks[m.id]=R,s.Client.send(b))},_sendSubscriptionPresence:function(u){var n=t.getEnv().browser?$pres:f.Stanza,s={to:u.jid,type:u.type},S=e.createStanza(n,s,"presence");t.getEnv().browser?this.connection.send(S):this.Client.send(S)}};function T(u){this.service=u.service,this.helpers=u.helpers,this.connection=u.stropheClient,this.Client=u.xmppClient,this.nodeStanzasCallbacks=u.nodeStanzasCallbacks,this.joinedRooms={}}T.prototype={join:function(u,n){var s=this,S=e.getUniqueId("join"),l=this.helpers.getDialogJid(u),m={id:S,from:s.helpers.getUserCurrentJid(),to:s.helpers.getRoomJid(l)},y=t.getEnv().browser?$pres:f.Stanza,b=e.createStanza(y,m,"presence");b.c("x",{xmlns:e.MARKERS.MUC}).c("history",{maxstanzas:0}),this.joinedRooms[l]=!0;function R(I){var A=e.getAttr(I,"id"),x=e.getAttr(I,"from"),M=s.helpers.getDialogIdFromNode(x),P=e.getElement(I,"x"),L=e.getAttr(P,"xmlns"),G=e.getElement(P,"status"),$=e.getAttr(G,"code");if(n.length==1)return t.safeCallbackCall(n,I),!0;if(G&&$=="110")t.safeCallbackCall(n,null,{dialogId:M});else{var Q=e.getAttr(I,"type");if(Q&&Q==="error"&&L=="http://jabber.org/protocol/muc"&&A.endsWith(":join")){var W=e.getElement(I,"error"),w=e.getAttr(W,"code"),B=e.getElementText(W,"text");t.safeCallbackCall(n,{code:w||500,message:B||"Unknown issue"},{dialogId:M})}}}t.getEnv().browser?(typeof n=="function"&&s.connection.XAddTrackedHandler(R,null,"presence",null,S),s.connection.send(b)):(typeof n=="function"&&(s.nodeStanzasCallbacks[S]=R),s.Client.send(b))},leave:function(u,n){var s=this,S={type:"unavailable",from:s.helpers.getUserCurrentJid(),to:s.helpers.getRoomJid(u)},l=t.getEnv().browser?$pres:f.Stanza,m=e.createStanza(l,S,"presence");delete this.joinedRooms[u];function y(R){var I=e.getAttr(R,"id"),A=e.getAttr(R,"from"),x=s.helpers.getDialogIdFromN
7ode(A),M=e.getElement(R,"x"),P=e.getAttr(M,"xmlns"),L=e.getElement(M,"status"),G=e.getAttr(L,"code");if(L&&G=="110")t.safeCallbackCall(n,null,{dialogId:x});else{var $=e.getAttr(R,"type");if($&&$==="error"&&P=="http://jabber.org/protocol/muc"&&I.endsWith(":join")){var Q=e.getElement(R,"error"),W=e.getAttr(Q,"code"),w=e.getElementText(Q,"text");t.safeCallbackCall(n,{code:W||500,message:w||"Unknown issue"},null)}}}if(t.getEnv().browser){var b=s.helpers.getRoomJid(u);typeof n=="function"&&s.connection.XAddTrackedHandler(y,null,"presence",S.type,null,b),s.connection.send(m)}else typeof n=="function"&&(s.nodeStanzasCallbacks["muc:leave"]=y),s.Client.send(m)},listOnlineUsers:function(u,n){var s=this,S=[],l={type:"get",to:u,from:s.helpers.getUserCurrentJid(),id:e.getUniqueId("muc_disco_items")},m=t.getEnv().browser?$iq:f.Stanza,y=e.createStanza(m,l,"iq");y.c("query",{xmlns:"http://jabber.org/protocol/disco#items"});function b(R){var I=R.attrs.id;if(s.nodeStanzasCallbacks[I]){for(var A=[],x=R.getChild("query").getChildElements("item"),M,P=0,L=x.length;P<L;P++)M=s.helpers.getUserIdFromRoomJid(x[P].attrs.jid),A.push(parseInt(M));n(A)}}t.getEnv().browser?s.connection.sendIQ(y,function(R){for(var I=R.getElementsByTagName("item"),A,x=0,M=I.length;x<M;x++)A=s.helpers.getUserIdFromRoomJid(I[x].getAttribute("jid")),S.push(parseInt(A));n(S)}):(s.Client.send(y),s.nodeStanzasCallbacks[l.id]=b)}};function g(u){this.service=u.service,this.helpers=u.helpers,this.connection=u.stropheClient,this.Client=u.xmppClient,this.nodeStanzasCallbacks=u.nodeStanzasCallbacks}g.prototype={create:function(u,n){for(var s=this,S,l,m,y,b,R={},I=[],A=u.items.length-1;A>=0;A--){var x=u.items[A];R[x.user_id]={action:x.action,mutualBlock:x.mutualBlock===!0}}I=Object.keys(R);var M={type:"set",from:s.helpers.getUserCurrentJid(),id:e.getUniqueId("edit")},P=t.getEnv().browser?$iq:f.Stanza,L=e.createStanza(P,M,"iq");L.c("query",{xmlns:e.MARKERS.PRIVACY}).c("list",{name:u.name});function G(B,U){if(t.getEnv().browser)B.c("item",{type:"jid",value:U.jidOrMuc,action:U.userAction,order:U.order}).c("message",{}).up().c("presence-in",{}).up().c("presence-out",{}).up().c("iq",{}).up().up();else{var F=B.getChild("query").getChild("list");F.c("item",{type:"jid",value:U.jidOrMuc,action:U.userAction,order:U.order}).c("message",{}).up().c("presence-in",{}).up().c("presence-out",{}).up().c("iq",{}).up().up()}return B}function $(B,U){if(t.getEnv().browser)B.c("item",{type:"jid",value:U.jidOrMuc,action:U.userAction,order:U.order}).up();else{var F=B.getChild("query").getChild("list");F.c("item",{type:"jid",value:U.jidOrMuc,action:U.userAction,order:U.order}).up()}return B}for(var Q=0,W=0,w=I.length;Q<w;Q++,W=W+2)S=I[Q],b=R[S].mutualBlock,y=R[S].action,l=s.helpers.jidOrUserId(parseInt(S,10)),m=s.helpers.getUserNickWithMucDomain(S),b&&y==="deny"?(L=$(L,{order:W+1,jidOrMuc:l,userAction:y}),L=$(L,{order:W+2,jidOrMuc:m,userAction:y}).up().up()):(L=G(L,{order:W+1,jidOrMuc:l,userAction:y}),L=G(L,{order:W+2,jidOrMuc:m,userAction:y}));t.getEnv().browser?s.connection.sendIQ(L,function(B){n(null)},function(B){if(B){var U=e.getErrorFromXMLNode(B);n(U)}else n(t.getError(408))}):(s.Client.send(L),s.nodeStanzasCallbacks[M.id]=function(B){B.getChildElements("error").length?n(t.getError(408)):n(null)})},getList:function(u,n){var s=this,S,l,m,y=[],b={},R={type:"get",from:s.helpers.getUserCurrentJid(),id:e.getUniqueId("getlist")},I=t.getEnv().browser?$iq:f.Stanza,A=e.createStanza(I,R,"iq");A.c("query",{xmlns:e.MARKERS.PRIVACY}).c("list",{name:u}),t.getEnv().browser?s.connection.sendIQ(A,function(x){S=x.getElementsByTagName("item");for(var M=0,P=S.length;M<P;M=M+2)l=S[M].getAttribute("value"),m=s.helpers.getIdFromNode(l),y.push({user_id:m,action:S[M].getAttribute("action")});b={name:u,items:y},n(null,b)},function(x){if(x){var M=e.getErrorFromXMLNode(x);n(M,null)}else n(t.getError(408),null)}):(s.nodeStanzasCallbacks[R.id]=function(x){for(var M=x.getChild("query"),P=M?M.getChild("list"):null,L=P?P.getChildElements("item"):null,G,$,Q=[],W=0,w=L.length;W<w;W=W+2)G=L[W].attrs.value,$=s.helpers.getIdFromNode(G),Q.push({user_id:$,action:L[W].attrs.action});P={name:P.attrs.name,items:Q},n(null,P),delete s.nodeStanzasCallbacks[R.id]},s.Client.send(A))},update:function(u,n){var s=this;s.getList(u.name,function(S,l){if(S)n(S,null);else{var m={};m.items=t.MergeArrayOfObjects(l.items,u.items),m.name=u.name,s.create(m,function(y,b){S?n(y,null):n(null,b)})}})},getNames:function(u){var n=this,s,S={type:"get",from:n.helpers.getUserCurrentJid(),id:e.getUniqueId("getNames")};t.getEnv().browser?(s=$iq(S).c("query",{xmlns:Strophe.NS.PRIVACY_LIST}),n.connection.sendIQ(s,function(l){for(var m=[],y={},b=l.getElementsByTagName("default"),R=l.getElementsByTagName("active"),I=l.getElementsByTagName("list"),A=b&&b.length>0?b[0].getAttribute("name"):null,x=R&&R.length>0?R[0].getAttribute("name"):null,M=0,P=I.length;M<P;M++)m.push(I[M].getAttribute("name"));y={default:A,active:x,names:m},u(null,y)},function(l){if(l){var m=e.getErrorFromXMLNode(l);u(m,null)}else u(t.getError(408),null)})):(s=new f.Stanza("iq",S),s.c("query",{xmlns:e.MARKERS.PRIVACY}),n.nodeStanzasCallbacks[s.attrs.id]=function(l){if(l.attrs.type!=="error"){for(var m=[],y={},b=l.getChild("query"),R=b.getChild("default"),I=b.getChild("active"),A=b.getChildElements("list"),x=R?R.attrs.name:null,M=I?I.attrs.name:null,P=0,L=A.length;P<L;P++)m.push(A[P].attrs.name);y={default:x,active:M,names:m},u(null,y)}else u(t.getError(408))},n.Client.send(s))},delete:function(u,n){var s,S={from:this.connection?this.connection.jid:this.Client.jid.user,type:"set",id:e.getUniqueId("remove")};t.getEnv().browser?(s=$iq(S).c("query",{xmlns:Strophe.NS.PRIVACY_LIST}).c("list",{name:u||""}),this.connection.sendIQ(s,function(l){n(null)},function(l){if(l){var m=e.getErrorFromXMLNode(l);n(m)}else n(t.getError(408))})):(s=new f.Stanza("iq",S),s.c("query",{xmlns:e.MARKERS.PRIVACY}).c("list",{name:u||""}),this.nodeStanzasCallbacks[S.id]=function(l){l.getChildElements("error").length?n(t.getError(408)):n(null)},this.Client.send(s))},setAsDefault:function(u,n){var s=this,S,l={from:this.connection?this.connection.jid:this.Client.jid.user,type:"set",id:e.getUniqueId("default")};t.getEnv().browser?(S=$iq(l).c("query",{xmlns:Strophe.NS.PRIVACY_LIST}).c("default",u&&u.length>0?{name:u}:{}),this.connection.sendIQ(S,function(y){m(s)},function(y){if(y){var b=e.getErrorFromXMLNode(y);n(b)}else n(t.getError(408))})):(S=new f.Stanza("iq",l),S.c("query",{xmlns:e.MARKERS.PRIVACY}).c("default",u&&u.length>0?{name:u}:{}),this.nodeStanzasCallbacks[l.id]=function(y){y.getChildElements("error").length?n(t.getError(408)):m(s)},this.Client.send(S));function m(y){var b,R={from:y.connection?y.connection.jid:y.Client.jid.user,type:"set",id:e.getUniqueId("active1")};t.getEnv().browser?(b=$iq(R).c("query",{xmlns:Strophe.NS.PRIVACY_LIST}).c("active",u&&u.length>0?{name:u}:{}),y.connection.sendIQ(b,function(I){n(null)},function(I){if(I){var A=e.getErrorFromXMLNode(I);n(A)}else n(t.getError(408))})):(b=new f.Stanza("iq",R),b.c("query",{xmlns:e.MARKERS.PRIVACY}).c("active",u&&u.length>0?{name:u}:{}),y.nodeStanzasCallbacks[R.id]=function(I){I.getChildElements("error").length?n(t.getError(408)):n(null)},y.Client.send(b))}}};function c(){this._userCurrentJid=""}return c.prototype={getUniqueId:e.getUniqueId,jidOrUserId:function(u){var n;if(typeof u=="string")n=u;else if(typeof u=="number")n=u+"-"+i.creds.appId+"@"+i.endpoints.chat;else throw new Error('The method "jidOrUserId" may take jid or id');return n},typeChat:function(u){var n;if(typeof u=="string")n=u.indexOf("muc")>-1?"groupchat":"chat";else if(typeof u=="number")n="chat";else throw new Error(a);return n},getRecipientId:function(u,n){var s=null;return u.forEach(function(S){S!=n&&(s=S)}),s},getUserJid:function(u,n){return n?u+"-"+n+"@"+i.endpoints.chat:u+"-"+i.creds.appId+"@"+i.endpoints.chat},getUserNickWithMucDomain:function(u){return i.endpoints.muc+"/"+u},getIdFromNode:function(u){return u.indexOf("@")<0?null:parseInt(u.split("@")[0].split("-")[0])}
7,getDialogIdFromNode:function(u){return u.indexOf("@")<0?null:u.split("@")[0].split("_")[1]},getRoomJidFromDialogId:function(u){return i.creds.appId+"_"+u+"@"+i.endpoints.muc},getRoomJid:function(u){return u+"/"+this.getIdFromNode(this._userCurrentJid)},getIdFromResource:function(u){var n=u.split("/");return n.length<2?null:(n.splice(0,1),parseInt(n.join("/")))},getRoomJidFromRoomFullJid:function(u){var n=u.split("/");return n.length<2?null:n[0]},getBsonObjectId:function(){return t.getBsonObjectId()},getUserIdFromRoomJid:function(u){var n=u.toString().split("/");return n.length===0?null:n[n.length-1]},userCurrentJid:function(u){try{return u instanceof Strophe.Connection?u.jid:u.jid.user+"@"+u.jid._domain+"/"+u.jid._resource}catch{return u.jid.user+"@"+u.jid._domain+"/"+u.jid._resource}},getUserCurrentJid:function(){return this._userCurrentJid},setUserCurrentJid:function(u){this._userCurrentJid=u},getDialogJid:function(u){return u.indexOf("@")>0?u:this.getRoomJidFromDialogId(u)}},fn=d,fn}var hn,Cr;function Es(){if(Cr)return hn;Cr=1;var e=Re(),i=Oe(),t=e.urls.chat+"/Dialog";function r(a){this.service=a}return r.prototype={list:function(a,f){typeof a=="function"&&typeof f>"u"&&(f=a,a={}),this.service.ajax({url:i.getUrl(t),data:a},f)},create:function(a,f){a&&a.occupants_ids&&i.isArray(a.occupants_ids)&&(a.occupants_ids=a.occupants_ids.join(", ")),a&&a.is_join_required!==void 0&&a.is_join_required!==null&&a.is_join_required!==0&&a.is_join_required!==1&&(i.QBLog("[QBChat]","Warning: is_join_required must be 0 or 1, got: "+a.is_join_required+". Parameter ignored."),delete a.is_join_required),this.service.ajax({url:i.getUrl(t),type:"POST",data:a},f)},update:function(a,f,p){f&&f.is_join_required!==void 0&&(i.QBLog("[QBChat]","Warning: is_join_required is not supported in dialog.update(). Parameter ignored."),delete f.is_join_required),this.service.ajax({url:i.getUrl(t,a),type:"PUT",contentType:"application/json; charset=utf-8",isNeedStringify:!0,data:f},p)},delete:function(a,f,p){var d={url:i.getUrl(t,a),type:"DELETE",dataType:"text"};arguments.length===2?this.service.ajax(d,f):arguments.length===3&&(d.data=f,this.service.ajax(d,p))}},hn=r,hn}var pn,Er;function ys(){if(Er)return pn;Er=1;var e=Re(),i=Oe(),t=e.urls.chat+"/Message";function r(a){this.service=a}return r.prototype={list:function(a,f){this.service.ajax({url:i.getUrl(t),data:a},f)},create:function(a,f){this.service.ajax({url:i.getUrl(t),type:"POST",contentType:"application/json; charset=utf-8",isNeedStringify:!0,data:a},f)},update:function(a,f,p){var d={type:"PUT",dataType:"text",url:i.getUrl(t,a),data:f};this.service.ajax(d,p)},delete:function(a,f,p){var d={url:i.getUrl(t,a),type:"DELETE",dataType:"text"};arguments.length===2?this.service.ajax(d,f):arguments.length===3&&(d.data=f,this.service.ajax(d,p))},unreadCount:function(a,f){a&&a.chat_dialog_ids&&i.isArray(a.chat_dialog_ids)&&(a.chat_dialog_ids=a.chat_dialog_ids.join()),this.service.ajax({url:i.getUrl(t+"/unread"),data:a},f)}},pn=r,pn}var gn,yr;function Ss(){if(yr)return gn;yr=1;var e=Oe(),i="ai/ai_extensions";function t(r){this.service=r}return t.prototype={answerAssist:function(r,a,f,p){if(!p||typeof p!="function")throw new Error("Callback function is required and must be a function");function d(g){var c={user:"user",assistant:"assistant"};if(g!=null){if(!Array.isArray(g))throw new Error("History must be an array");for(var u=0;u<g.length;u++){var n=g[u];if(typeof n!="object"||n===null||Array.isArray(n))throw new Error("Each element of history must be an object");if(!("role"in n)||!("message"in n))throw new Error("Each element of history must have an role and message fields");if(!(n.role===c.user||n.role===c.assistant))throw new Error("Invalid role in history item");if(typeof n.message!="string")throw new Error("Message of history item must be a string")}}return!0}d(f);var v=f?{smart_chat_assistant_id:r,message:a,history:f}:{smart_chat_assistant_id:r,message:a},T={type:"POST",url:e.formatUrl(i+"/ai_answer_assist"),data:v,contentType:"application/json; charset=utf-8",isNeedStringify:!0};this.service.ajax(T,p)},translate:function(r,a,f,p){if(!p||typeof p!="function")throw new Error("Callback function is required and must be a function");var d={smart_chat_assistant_id:r,text:a,to_language:f||"en"},v={type:"POST",url:e.formatUrl(i+"/ai_translate"),data:d};this.service.ajax(v,p)},gateway:function(r,a,f,p){var d,v;if(typeof f=="function"?(v=f,d={}):(d=f||{},v=p),!v||typeof v!="function")throw new Error("Callback function is required and must be a function");if(!r||typeof r!="string")throw new Error("smartChatAssistantId is required and must be a string");
7this._validateGatewayMessages(a);var T={smart_chat_assistant_id:r,messages:a},g={type:"POST",url:e.formatUrl(i+"/ai_gateway"),data:T,contentType:"application/json; charset=utf-8",isNeedStringify:!0};d.apiKey&&(g.headers={Authorization:"ApiKey "+d.apiKey}),this.service.ajax(g,v)},_validateGatewayMessages:function(r){var a=["user","assistant","developer"],f=["text","image_url"];if(!r||!Array.isArray(r))throw new Error("messages is required and must be an array");if(r.length===0)throw new Error("messages array cannot be empty");for(var p=0;p<r.length;p++){var d=r[p];if(typeof d!="object"||d===null||Array.isArray(d))throw new Error("Each message must be an object");if(!d.role||a.indexOf(d.role)===-1)throw new Error("Each message must have a valid role (user, assistant, or developer)");if(d.content===void 0||d.content===null)throw new Error("Each message must have content (string or array)");if(typeof d.content=="string"){if(d.content.length===0)throw new Error("String content cannot be empty");continue}if(!Array.isArray(d.content))throw new Error("Message content must be a string or array");if(d.content.length===0)throw new Error("Content array cannot be empty");for(var v=0;v<d.content.length;v++){var T=d.content[v];if(typeof T!="object"||T===null)throw new Error("Each content item must be an object");if(!T.type||f.indexOf(T.type)===-1)throw new Error("Each content item must have a valid type (text or image_url)");if(T.type==="text"){if(typeof T.text!="string")throw new Error("Text content item must have a text string")}else if(T.type==="image_url"&&(!T.image_url||typeof T.image_url.url!="string"))throw new Error("Image content item must have image_url.url string")}}return!0},summarize:function(r,a,f){if(!f||typeof f!="function")throw new Error("Callback function is required and must be a function");if(!r||typeof r!="string")throw new Error("smartChatAssistantId is required and must be a string");if(!a||typeof a!="string")throw new Error("dialogId is required and must be a string");var p={smart_chat_assistant_id:r,dialog_id:a},d={type:"POST",url:e.formatUrl(i+"/ai_summarize"),data:p,contentType:"application/json; charset=utf-8",isNeedStringify:!0};this.service.ajax(d,f)}},gn=t,gn}let Wr=!0,Xr=!0;function Dt(e,i,t){const r=e.match(i);return r&&r.length>=t&&parseInt(r[t],10)}function Et(e,i,t){if(!e.RTCPeerConnection)return;const r=e.RTCPeerConnection.prototype,a=r.addEventListener;r.addEventListener=function(p,d){if(p!==i)return a.apply(this,arguments);const v=T=>{const g=t(T);g&&(d.handleEvent?d.handleEvent(g):d(g))};return this._eventMap=this._eventMap||{},this._eventMap[i]||(this._eventMap[i]=new Map),this._eventMap[i].set(d,v),a.apply(this,[p,v])};const f=r.removeEventListener;r.removeEventListener=function(p,d){if(p!==i||!this._eventMap||!this._eventMap[i])return f.apply(this,arguments);if(!this._eventMap[i].has(d))return f.apply(this,arguments);const v=this._eventMap[i].get(d);return this._eventMap[i].delete(d),this._eventMap[i].size===0&&delete this._eventMap[i],Object.keys(this._eventMap).length===0&&delete this._eventMap,f.apply(this,[p,v])},Object.defineProperty(r,"on"+i,{get(){return this["_on"+i]},set(p){this["_on"+i]&&(this.removeEventListener(i,this["_on"+i]),delete this["_on"+i]),p&&this.addEventListener(i,this["_on"+i]=p)},enumerable:!0,configurable:!0})}function Ts(e){return typeof e!="boolean"?new Error("Argument type: "+typeof e+". Please use a boolean."):(Wr=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function _s(e){return typeof e!="boolean"?new Error("Argument type: "+typeof e+". Please use a boolean."):(Xr=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function kn(){if(typeof window=="object"){if(Wr)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function Gt(e,i){Xr&&console.warn(e+" is deprecated, please use "+i+" instead.")}function bs(e){const i={browser:null,version:null};if(typeof e>"u"||!e.navigator)return i.browser="Not a browser.",i;const{navigator:t}=e;if(t.mozGetUserMedia)i.browser="firefox",i.version=Dt(t.userAgent,/Firefox\/(\d+)\./,1);else if(t.webkitGetUserMedia||e.isSecureContext===!1&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)i.browser="chrome",i.version=Dt(t.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(t.mediaDevices&&t.userAgent.match(/Edge\/(\d+).(\d+)$/))i.browser="edge",i.version=Dt(t.userAgent,/Edge\/(\d+).(\d+)$/,2);
vendor: 4,781 bytes, line 7
7else if(e.RTCPeerConnection&&t.userAgent.match(/AppleWebKit\/(\d+)\./))i.browser="safari",i.version=Dt(t.userAgent,/AppleWebKit\/(\d+)\./,1),i.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype;else return i.browser="Not a supported browser.",i;return i}function Sr(e){return Object.prototype.toString.call(e)==="[object Object]"}function $r(e){return Sr(e)?Object.keys(e).reduce(function(i,t){const r=Sr(e[t]),a=r?$r(e[t]):e[t],f=r&&!Object.keys(a).length;return a===void 0||f?i:Object.assign(i,{[t]:a})},{}):e}function In(e,i,t){!i||t.has(i.id)||(t.set(i.id,i),Object.keys(i).forEach(r=>{r.endsWith("Id")?In(e,e.get(i[r]),t):r.endsWith("Ids")&&i[r].forEach(a=>{In(e,e.get(a),t)})}))}function Tr(e,i,t){const r=t?"outbound-rtp":"inbound-rtp",a=new Map;if(i===null)return a;const f=[];return e.forEach(p=>{p.type==="track"&&p.trackIdentifier===i.id&&f.push(p)}),f.forEach(p=>{e.forEach(d=>{d.type===r&&d.trackId===p.id&&In(e,d,a)})}),a}const _r=kn;function Kr(e,i){const t=e&&e.navigator;if(!t.mediaDevices)return;const r=function(d){if(typeof d!="object"||d.mandatory||d.optional)return d;const v={};return Object.keys(d).forEach(T=>{if(T==="require"||T==="advanced"||T==="mediaSource")return;const g=typeof d[T]=="object"?d[T]:{ideal:d[T]};g.exact!==void 0&&typeof g.exact=="number"&&(g.min=g.max=g.exact);const c=function(u,n){return u?u+n.charAt(0).toUpperCase()+n.slice(1):n==="deviceId"?"sourceId":n};if(g.ideal!==void 0){v.optional=v.optional||[];let u={};typeof g.ideal=="number"?(u[c("min",T)]=g.ideal,v.optional.push(u),u={},u[c("max",T)]=g.ideal,v.optional.push(u)):(u[c("",T)]=g.ideal,v.optional.push(u))}g.exact!==void 0&&typeof g.exact!="number"?(v.mandatory=v.mandatory||{},v.mandatory[c("",T)]=g.exact):["min","max"].forEach(u=>{g[u]!==void 0&&(v.mandatory=v.mandatory||{},v.mandatory[c(u,T)]=g[u])})}),d.advanced&&(v.optional=(v.optional||[]).concat(d.advanced)),v},a=function(d,v){if(i.version>=61)return v(d);if(d=JSON.parse(JSON.stringify(d)),d&&typeof d.audio=="object"){const T=function(g,c,u){c in g&&!(u in g)&&(g[u]=g[c],delete g[c])};d=JSON.parse(JSON.stringify(d)),T(d.audio,"autoGainControl","googAutoGainControl"),T(d.audio,"noiseSuppression","googNoiseSuppression"),d.audio=r(d.audio)}if(d&&typeof d.video=="object"){let T=d.video.facingMode;T=T&&(typeof T=="object"?T:{ideal:T});const g=i.version<66;if(T&&(T.exact==="user"||T.exact==="environment"||T.ideal==="user"||T.ideal==="environment")&&!(t.mediaDevices.getSupportedConstraints&&t.mediaDevices.getSupportedConstraints().facingMode&&!g)){delete d.video.facingMode;let c;if(T.exact==="environment"||T.ideal==="environment"?c=["back","rear"]:(T.exact==="user"||T.ideal==="user")&&(c=["front"]),c)return t.mediaDevices.enumerateDevices().then(u=>{u=u.filter(s=>s.kind==="videoinput");let n=u.find(s=>c.some(S=>s.label.toLowerCase().includes(S)));return!n&&u.length&&c.includes("back")&&(n=u[u.length-1]),n&&(d.video.deviceId=T.exact?{exact:n.deviceId}:{ideal:n.deviceId}),d.video=r(d.video),_r("chrome: "+JSON.stringify(d)),v(d)})}d.video=r(d.video)}return _r("chrome: "+JSON.stringify(d)),v(d)},f=function(d){return i.version>=64?d:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[d.name]||d.name,message:d.message,constraint:d.constraint||d.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},p=function(d,v,T){a(d,g=>{t.webkitGetUserMedia(g,v,c=>{T&&T(f(c))})})};if(t.getUserMedia=p.bind(t),t.mediaDevices.getUserMedia){const d=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(v){return a(v,T=>d(T).then(g=>{if(T.audio&&!g.getAudioTracks().length||T.video&&!g.getVideoTracks().length)throw g.getTracks().forEach(c=>{c.stop()}),new DOMException("","NotFoundError");return g},g=>Promise.reject(f(g))))}}}function Ds(e,i){if(!(e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices)&&e.navigator.mediaDevices){if(typeof i!="function"){console.error("shimGetDisplayMedia: getSourceId argument is not a function");return}e.navigator.mediaDevices.getDisplayMedia=function(r){return i(r).then(a=>{const f=r.video&&r.video.width,p=r.video&&r.video.height,d=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:a,maxFrameRate:d||3}},f&&(r.video.mandatory.maxWidth=f),p&&(r.video.mandatory.maxHeight=p),e.navigator.mediaDevices.getUserMedia(r)})}}}
7function Yr(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function Zr(e){if(typeof e=="object"&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(t){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=t)},enumerable:!0,configurable:!0});const i=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=r=>{r.stream.addEventListener("addtrack",a=>{let f;e.RTCPeerConnection.prototype.getReceivers?f=this.getReceivers().find(d=>d.track&&d.track.id===a.track.id):f={track:a.track};const p=new Event("track");p.track=a.track,p.receiver=f,p.transceiver={receiver:f},p.streams=[r.stream],this.dispatchEvent(p)}),r.stream.getTracks().forEach(a=>{let f;e.RTCPeerConnection.prototype.getReceivers?f=this.getReceivers().find(d=>d.track&&d.track.id===a.id):f={track:a};const p=new Event("track");p.track=a,p.receiver=f,p.transceiver={receiver:f},p.streams=[r.stream],this.dispatchEvent(p)})},this.addEventListener("addstream",this._ontrackpoly)),i.apply(this,arguments)}}else Et(e,"track",i=>(i.transceiver||Object.defineProperty(i,"transceiver",{value:{receiver:i.receiver}}),i))}function ei(e){if(typeof e=="object"&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const i=function(a,f){return{track:f,get dtmf(){return this._dtmf===void 0&&(f.kind==="audio"?this._dtmf=a.createDTMFSender(f):this._dtmf=null),this._dtmf},_pc:a}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const a=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(d,v){let T=a.apply(this,arguments);return T||(T=i(this,d),this._senders.push(T)),T};const f=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(d){f.apply(this,arguments);const v=this._senders.indexOf(d);v!==-1&&this._senders.splice(v,1)}}const t=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(f){this._senders=this._senders||[],t.apply(this,[f]),f.getTracks().forEach(p=>{this._senders.push(i(this,p))})};const r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(f){this._senders=this._senders||[],r.apply(this,[f]),f.getTracks().forEach(p=>{const d=this._senders.find(v=>v.track===p);d&&this._senders.splice(this._senders.indexOf(d),1)})}}else if(typeof e=="object"&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const i=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const r=i.apply(this,[]);return r.forEach(a=>a._pc=this),r},Object.defineProperty(e.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 ti(e){if(!e.RTCPeerConnection)return;const i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[r,a,f]=arguments;if(arguments.length>0&&typeof r=="function")return i.apply(this,arguments);if(i.length===0&&(arguments.length===0||typeof r!="function"))return i.apply(this,[]);const p=function(v){const T={};return v.result().forEach(c=>{const u={id:c.id,timestamp:c.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[c.type]||c.type};c.names().forEach(n=>{u[n]=c.stat(n)}),T[u.id]=u}),T},d=function(v){return new Map(Object.keys(v).map(T=>[T,v[T]]))};if(arguments.length>=2){const v=function(T){a(d(p(T)))};return i.apply(this,[v,r])}return new Promise((v,T)=>{i.apply(this,[function(g){v(d(p(g)))},T])}).then(a,f)}}function ni(e){if(!(typeof e=="object"&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const f=t.apply(this,[]);return f.forEach(p=>p._pc=this),f});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const f=r.apply(this,arguments);return f._pc=this,f}),e.RTCRtpSender.prototype.getStats=function(){const f=this;return this._pc.getStats().then(p=>Tr(p,f.track,!0))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const a=t.apply(this,[]);return a.forEach(f=>f._pc=this),a}),Et(e,"track",r=>(r.receiver._pc=r.srcElement,r)),e.RTCRtpReceiver.prototype.getStats=function(){const a=this;return this._pc.getStats().then(f=>Tr(f,a.track,!1))}}if(!("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype))return;const i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){const r=arguments[0];let a,f,p;
vendor: 4,118 bytes, line 7
7return this.getSenders().forEach(d=>{d.track===r&&(a?p=!0:a=d)}),this.getReceivers().forEach(d=>(d.track===r&&(f?p=!0:f=d),d.track===r)),p||a&&f?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):a?a.getStats():f?f.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return i.apply(this,arguments)}}function ri(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(p=>this._shimmedLocalStreams[p][0])};const i=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(p,d){if(!d)return i.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const v=i.apply(this,arguments);return this._shimmedLocalStreams[d.id]?this._shimmedLocalStreams[d.id].indexOf(v)===-1&&this._shimmedLocalStreams[d.id].push(v):this._shimmedLocalStreams[d.id]=[d,v],v};const t=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(p){this._shimmedLocalStreams=this._shimmedLocalStreams||{},p.getTracks().forEach(T=>{if(this.getSenders().find(c=>c.track===T))throw new DOMException("Track already exists.","InvalidAccessError")});const d=this.getSenders();t.apply(this,arguments);const v=this.getSenders().filter(T=>d.indexOf(T)===-1);this._shimmedLocalStreams[p.id]=[p].concat(v)};const r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(p){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[p.id],r.apply(this,arguments)};const a=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(p){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},p&&Object.keys(this._shimmedLocalStreams).forEach(d=>{const v=this._shimmedLocalStreams[d].indexOf(p);v!==-1&&this._shimmedLocalStreams[d].splice(v,1),this._shimmedLocalStreams[d].length===1&&delete this._shimmedLocalStreams[d]}),a.apply(this,arguments)}}function ii(e,i){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&i.version>=65)return ri(e);const t=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const g=t.apply(this);return this._reverseStreams=this._reverseStreams||{},g.map(c=>this._reverseStreams[c.id])};const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(g){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},g.getTracks().forEach(c=>{if(this.getSenders().find(n=>n.track===c))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[g.id]){const c=new e.MediaStream(g.getTracks());this._streams[g.id]=c,this._reverseStreams[c.id]=g,g=c}r.apply(this,[g])};const a=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(g){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},a.apply(this,[this._streams[g.id]||g]),delete this._reverseStreams[this._streams[g.id]?this._streams[g.id].id:g.id],delete this._streams[g.id]},e.RTCPeerConnection.prototype.addTrack=function(g,c){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const u=[].slice.call(arguments,1);if(u.length!==1||!u[0].getTracks().find(S=>S===g))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===g))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const s=this._streams[c.id];if(s)s.addTrack(g),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const S=new e.MediaStream([g]);this._streams[c.id]=S,this._reverseStreams[S.id]=c,this.addStream(S)}
7return this.getSenders().find(S=>S.track===g)};function f(T,g){let c=g.sdp;return Object.keys(T._reverseStreams||[]).forEach(u=>{const n=T._reverseStreams[u],s=T._streams[n.id];c=c.replace(new RegExp(s.id,"g"),n.id)}),new RTCSessionDescription({type:g.type,sdp:c})}function p(T,g){let c=g.sdp;return Object.keys(T._reverseStreams||[]).forEach(u=>{const n=T._reverseStreams[u],s=T._streams[n.id];c=c.replace(new RegExp(n.id,"g"),s.id)}),new RTCSessionDescription({type:g.type,sdp:c})}["createOffer","createAnswer"].forEach(function(T){const g=e.RTCPeerConnection.prototype[T],c={[T](){const u=arguments;return arguments.length&&typeof arguments[0]=="function"?g.apply(this,[s=>{const S=f(this,s);u[0].apply(null,[S])},s=>{u[1]&&u[1].apply(null,s)},arguments[2]]):g.apply(this,arguments).then(s=>f(this,s))}};e.RTCPeerConnection.prototype[T]=c[T]});const d=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?d.apply(this,arguments):(arguments[0]=p(this,arguments[0]),d.apply(this,arguments))};const v=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const T=v.get.apply(this);return T.type===""?T:f(this,T)}}),e.RTCPeerConnection.prototype.removeTrack=function(g){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!g._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(g._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let u;Object.keys(this._streams).forEach(n=>{this._streams[n].getTracks().find(S=>g.track===S)&&(u=this._streams[n])}),u&&(u.getTracks().length===1?this.removeStream(this._reverseStreams[u.id]):u.removeTrack(g.track),this.dispatchEvent(new Event("negotiationneeded")))}}function xn(e,i){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&i.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){const r=e.RTCPeerConnection.prototype[t],a={[t](){return arguments[0]=new(t==="addIceCandidate"?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=a[t]})}function si(e,i){Et(e,"negotiationneeded",t=>{const r=t.target;if(!((i.version<72||r.getConfiguration&&r.getConfiguration().sdpSemantics==="plan-b")&&r.signalingState!=="stable"))return t})}const br=Object.freeze(Object.defineProperty({__proto__:null,fixNegotiationNeeded:si,shimAddTrackRemoveTrack:ii,shimAddTrackRemoveTrackWithNative:ri,shimGetDisplayMedia:Ds,shimGetSendersWithDtmf:ei,shimGetStats:ti,shimGetUserMedia:Kr,shimMediaStream:Yr,shimOnTrack:Zr,shimPeerConnection:xn,shimSenderReceiverGetStats:ni},Symbol.toStringTag,{value:"Module"}));function As(e,i){let t=!1;return e=JSON.parse(JSON.stringify(e)),e.filter(r=>{if(r&&(r.urls||r.url)){let a=r.urls||r.url;r.url&&!r.urls&&Gt("RTCIceServer.url","RTCIceServer.urls");const f=typeof a=="string";return f&&(a=[a]),a=a.filter(p=>{if(p.indexOf("stun:")===0)return!1;const d=p.startsWith("turn")&&!p.startsWith("turn:[")&&p.includes("transport=udp");return d&&!t?(t=!0,!0):d&&!t}),delete r.url,r.urls=f?a[0]:a,!!a.length}})}var mn={exports:{}},Dr;function oi(){return Dr||(Dr=1,(function(e){var i={};i.generateIdentifier=function(){return Math.random().toString(36).substr(2,10)},i.localCName=i.generateIdentifier(),i.splitLines=function(t){return t.trim().split(`
8`).map(function(r){return r.trim()})},i.splitSections=function(t){var r=t.split(`
9m=`);return r.map(function(a,f){return(f>0?"m="+a:a).trim()+`\r
10`})},i.getDescription=function(t){var r=i.splitSections(t);return r&&r[0]},i.getMediaSections=function(t){var r=i.splitSections(t);return r.shift(),r},i.matchPrefix=function(t,r){return i.splitLines(t).filter(function(a){return a.indexOf(r)===0})},i.parseCandidate=function(t){var r;t.indexOf("a=candidate:")===0?r=t.substring(12).split(" "):r=t.substring(10).split(" ");for(var a={foundation:r[0],component:parseInt(r[1],10),protocol:r[2].toLowerCase(),priority:parseInt(r[3],10),ip:r[4],address:r[4],port:parseInt(r[5],10),type:r[7]},f=8;f<r.length;f+=2)switch(r[f]){case"raddr":a.relatedAddress=r[f+1];break;case"rport":a.relatedPort=parseInt(r[f+1],10);break;case"tcptype":a.tcpType=r[f+1];break;case"ufrag":a.ufrag=r[f+1],a.usernameFragment=r[f+1];break;default:a[r[f]]=r[f+1];break}return a},i.writeCandidate=function(t){var r=[];r.push(t.foundation),r.push(t.component),r.push(t.protocol.toUpperCase()),r.push(t.priority),r.push(t.address||t.ip),r.push(t.port);var a=t.type;return r.push("typ"),r.push(a),a!=="host"&&t.relatedAddress&&t.relatedPort&&(r.push("raddr"),r.push(t.relatedAddress),r.push("rport"),r.push(t.relatedPort)),t.tcpType&&t.protocol.toLowerCase()==="tcp"&&(r.push("tcptype"),r.push(t.tcpType)),(t.usernameFragment||t.ufrag)&&(r.push("ufrag"),r.push(t.usernameFragment||t.ufrag)),"candidate:"+r.join(" ")},i.parseIceOptions=function(t){return t.substr(14).split(" ")},i.parseRtpMap=function(t){var r=t.substr(9).split(" "),a={payloadType:parseInt(r.shift(),10)};return r=r[0].split("/"),a.name=r[0],a.clockRate=parseInt(r[1],10),a.channels=r.length===3?parseInt(r[2],10):1,a.numChannels=a.channels,a},i.writeRtpMap=function(t){var r=t.payloadType;t.preferredPayloadType!==void 0&&(r=t.preferredPayloadType);var a=t.channels||t.numChannels||1;return"a=rtpmap:"+r+" "+t.name+"/"+t.clockRate+(a!==1?"/"+a:"")+`\r
11`},i.parseExtmap=function(t){var r=t.substr(9).split(" ");return{id:parseInt(r[0],10),direction:r[0].indexOf("/")>0?r[0].split("/")[1]:"sendrecv",uri:r[1]}},i.writeExtmap=function(t){return"a=extmap:"+(t.id||t.preferredId)+(t.direction&&t.direction!=="sendrecv"?"/"+t.direction:"")+" "+t.uri+`\r
12`},i.parseFmtp=function(t){for(var r={},a,f=t.substr(t.indexOf(" ")+1).split(";"),p=0;p<f.length;p++)a=f[p].trim().split("="),r[a[0].trim()]=a[1];return r},i.writeFmtp=function(t){var r="",a=t.payloadType;if(t.preferredPayloadType!==void 0&&(a=t.preferredPayloadType),t.parameters&&Object.keys(t.parameters).length){var f=[];
12Object.keys(t.parameters).forEach(function(p){t.parameters[p]?f.push(p+"="+t.parameters[p]):f.push(p)}),r+="a=fmtp:"+a+" "+f.join(";")+`\r
13`}return r},i.parseRtcpFb=function(t){var r=t.substr(t.indexOf(" ")+1).split(" ");return{type:r.shift(),parameter:r.join(" ")}},i.writeRtcpFb=function(t){var r="",a=t.payloadType;return t.preferredPayloadType!==void 0&&(a=t.preferredPayloadType),t.rtcpFeedback&&t.rtcpFeedback.length&&t.rtcpFeedback.forEach(function(f){r+="a=rtcp-fb:"+a+" "+f.type+(f.parameter&&f.parameter.length?" "+f.parameter:"")+`\r
14`}),r},i.parseSsrcMedia=function(t){var r=t.indexOf(" "),a={ssrc:parseInt(t.substr(7,r-7),10)},f=t.indexOf(":",r);return f>-1?(a.attribute=t.substr(r+1,f-r-1),a.value=t.substr(f+1)):a.attribute=t.substr(r+1),a},i.parseSsrcGroup=function(t){var r=t.substr(13).split(" ");return{semantics:r.shift(),ssrcs:r.map(function(a){return parseInt(a,10)})}},i.getMid=function(t){var r=i.matchPrefix(t,"a=mid:")[0];if(r)return r.substr(6)},i.parseFingerprint=function(t){var r=t.substr(14).split(" ");return{algorithm:r[0].toLowerCase(),value:r[1]}},i.getDtlsParameters=function(t,r){var a=i.matchPrefix(t+r,"a=fingerprint:");return{role:"auto",fingerprints:a.map(i.parseFingerprint)}},i.writeDtlsParameters=function(t,r){var a="a=setup:"+r+`\r
15`;return t.fingerprints.forEach(function(f){a+="a=fingerprint:"+f.algorithm+" "+f.value+`\r
16`}),a},i.parseCryptoLine=function(t){var r=t.substr(9).split(" ");return{tag:parseInt(r[0],10),cryptoSuite:r[1],keyParams:r[2],sessionParams:r.slice(3)}},i.writeCryptoLine=function(t){return"a=crypto:"+t.tag+" "+t.cryptoSuite+" "+(typeof t.keyParams=="object"?i.writeCryptoKeyParams(t.keyParams):t.keyParams)+(t.sessionParams?" "+t.sessionParams.join(" "):"")+`\r
17`},i.parseCryptoKeyParams=function(t){if(t.indexOf("inline:")!==0)return null;var r=t.substr(7).split("|");return{keyMethod:"inline",keySalt:r[0],lifeTime:r[1],mkiValue:r[2]?r[2].split(":")[0]:void 0,mkiLength:r[2]?r[2].split(":")[1]:void 0}},i.writeCryptoKeyParams=function(t){return t.keyMethod+":"+t.keySalt+(t.lifeTime?"|"+t.lifeTime:"")+(t.mkiValue&&t.mkiLength?"|"+t.mkiValue+":"+t.mkiLength:"")},i.getCryptoParameters=function(t,r){var a=i.matchPrefix(t+r,"a=crypto:");return a.map(i.parseCryptoLine)},i.getIceParameters=function(t,r){var a=i.matchPrefix(t+r,"a=ice-ufrag:")[0],f=i.matchPrefix(t+r,"a=ice-pwd:")[0];return a&&f?{usernameFragment:a.substr(12),password:f.substr(10)}:null},i.writeIceParameters=function(t){return"a=ice-ufrag:"+t.usernameFragment+`\r
18a=ice-pwd:`+t.password+`\r
19`},i.parseRtpParameters=function(t){for(var r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},a=i.splitLines(t),f=a[0].split(" "),p=3;p<f.length;p++){var d=f[p],v=i.matchPrefix(t,"a=rtpmap:"+d+" ")[0];if(v){var T=i.parseRtpMap(v),g=i.matchPrefix(t,"a=fmtp:"+d+" ");switch(T.parameters=g.length?i.parseFmtp(g[0]):{},T.rtcpFeedback=i.matchPrefix(t,"a=rtcp-fb:"+d+" ").map(i.parseRtcpFb),r.codecs.push(T),T.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(T.name.toUpperCase());break}}}return i.matchPrefix(t,"a=extmap:").forEach(function(c){r.headerExtensions.push(i.parseExtmap(c))}),r},i.writeRtpDescription=function(t,r){var a="";a+="m="+t+" ",a+=r.codecs.length>0?"9":"0",a+=" UDP/TLS/RTP/SAVPF ",a+=r.codecs.map(function(p){return p.preferredPayloadType!==void 0?p.preferredPayloadType:p.payloadType}).join(" ")+`\r
20`,a+=`c=IN IP4 0.0.0.0\r
21`,a+=`a=rtcp:9 IN IP4 0.0.0.0\r
22`,r.codecs.forEach(function(p){a+=i.writeRtpMap(p),a+=i.writeFmtp(p),a+=i.writeRtcpFb(p)});var f=0;return r.codecs.forEach(function(p){p.maxptime>f&&(f=p.maxptime)}),f>0&&(a+="a=maxptime:"+f+`\r
23`),a+=`a=rtcp-mux\r
24`,r.headerExtensions&&r.headerExtensions.forEach(function(p){a+=i.writeExtmap(p)}),a},i.parseRtpEncodingParameters=function(t){var r=[],a=i.parseRtpParameters(t),f=a.fecMechanisms.indexOf("RED")!==-1,p=a.fecMechanisms.indexOf("ULPFEC")!==-1,d=i.matchPrefix(t,"a=ssrc:").map(function(u){return i.parseSsrcMedia(u)}).filter(function(u){return u.attribute==="cname"}),v=d.length>0&&d[0].ssrc,T,g=i.matchPrefix(t,"a=ssrc-group:FID").map(function(u){var n=u.substr(17).split(" ");return n.map(function(s){return parseInt(s,10)})});g.length>0&&g[0].length>1&&g[0][0]===v&&(T=g[0][1]),a.codecs.forEach(function(u){if(u.name.toUpperCase()==="RTX"&&u.parameters.apt){var n={ssrc:v,codecPayloadType:parseInt(u.parameters.apt,10)};v&&T&&(n.rtx={ssrc:T}),r.push(n),f&&(n=JSON.parse(JSON.stringify(n)),n.fec={ssrc:v,mechanism:p?"red+ulpfec":"red"},r.push(n))}}),r.length===0&&v&&r.push({ssrc:v});var c=i.matchPrefix(t,"b=");return c.length&&(c[0].indexOf("b=TIAS:")===0?c=parseInt(c[0].substr(7),10):c[0].indexOf("b=AS:")===0?c=parseInt(c[0].substr(5),10)*1e3*.95-2e3*8:c=void 0,r.forEach(function(u){u.maxBitrate=c})),r},i.parseRtcpParameters=function(t){var r={},a=i.matchPrefix(t,"a=ssrc:").map(function(d){return i.parseSsrcMedia(d)}).filter(function(d){return d.attribute==="cname"})[0];a&&(r.cname=a.value,r.ssrc=a.ssrc);var f=i.matchPrefix(t,"a=rtcp-rsize");r.reducedSize=f.length>0,r.compound=f.length===0;var p=i.matchPrefix(t,"a=rtcp-mux");return r.mux=p.length>0,r},i.parseMsid=function(t){var r,a=i.matchPrefix(t,"a=msid:");if(a.length===1)return r=a[0].substr(7).split(" "),{stream:r[0],track:r[1]};var f=i.matchPrefix(t,"a=ssrc:").map(function(p){return i.parseSsrcMedia(p)}).filter(function(p){return p.attribute==="msid"});if(f.length>0)return r=f[0].value.split(" "),{stream:r[0],track:r[1]}},i.parseSctpDescription=function(t){var r=i.parseMLine(t),a=i.matchPrefix(t,"a=max-message-size:"),f;a.length>0&&(f=parseInt(a[0].substr(19),10)),isNaN(f)&&(f=65536);var p=i.matchPrefix(t,"a=sctp-port:");if(p.length>0)return{port:parseInt(p[0].substr(12),10),protocol:r.fmt,maxMessageSize:f};var d=i.matchPrefix(t,"a=sctpmap:");if(d.length>0){var v=i.matchPrefix(t,"a=sctpmap:")[0].substr(10).split(" ");return{port:parseInt(v[0],10),protocol:v[1],maxMessageSize:f}}},i.writeSctpDescription=function(t,r){var a=[];return t.protocol!=="DTLS/SCTP"?a=["m="+t.kind+" 9 "+t.protocol+" "+r.protocol+`\r
25`,`c=IN IP4 0.0.0.0\r
26`,"a=sctp-port:"+r.port+`\r
27`]:a=["m="+t.kind+" 9 "+t.protocol+" "+r.port+`\r
28`,`c=IN IP4 0.0.0.0\r
29`,"a=sctpmap:"+r.port+" "+r.protocol+` 65535\r
30`],r.maxMessageSize!==void 0&&a.push("a=max-message-size:"+r.maxMessageSize+`\r
31`),a.join("")},i.generateSessionId=function(){return Math.random().toString().substr(2,21)},i.writeSessionBoilerplate=function(t,r,a){var f,p=r!==void 0?r:2;t?f=t:f=i.generateSessionId();var d=a||"thisisadapterortc";return`v=0\r
32o=`+d+" "+f+" "+p+` IN IP4 127.0.0.1\r
33s=-\r
34t=0 0\r
35`},i.writeMediaSection=function(t,r,a,f){var p=i.writeRtpDescription(t.kind,r);if(p+=i.writeIceParameters(t.iceGatherer.getLocalParameters()),p+=i.writeDtlsParameters(t.dtlsTransport.getLocalParameters(),a==="offer"?"actpass":"active"),p+="a=mid:"+t.mid+`\r
36`,t.direction?p+="a="+t.direction+`\r
37`:t.rtpSender&&t.rtpReceiver?p+=`a=sendrecv\r
38`:t.rtpSender?p+=`a=sendonly\r
39`:t.rtpReceiver?p+=`a=recvonly\r
40`:p+=`a=inactive\r
41`,t.rtpSender){var d="msid:"+f.id+" "+t.rtpSender.track.id+`\r
42`;p+="a="+d,p+="a=ssrc:"+t.sendEncodingParameters[0].ssrc+" "+d,t.sendEncodingParameters[0].rtx&&(p+="a=ssrc:"+t.sendEncodingParameters[0].rtx.ssrc+" "+d,p+="a=ssrc-group:FID "+t.sendEncodingParameters[0].ssrc+" "+t.sendEncodingParameters[0].rtx.ssrc+`\r
43`)}return p+="a=ssrc:"+t.sendEncodingParameters[0].ssrc+" cname:"+i.localCName+`\r
44`,t.rtpSender&&t.sendEncodingParameters[0].rtx&&(p+="a=ssrc:"+t.sendEncodingParameters[0].rtx.ssrc+" cname:"+i.localCName+`\r
45`),p},i.getDirection=function(t,r){for(var a=i.splitLines(t),f=0;f<a.length;f++)switch(a[f]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return a[f].substr(2)}return r?i.getDirection(r):"sendrecv"},i.getKind=function(t){var r=i.splitLines(t),a=r[0].split(" ");return a[0].substr(2)},i.isRejected=function(t){return t.split(" ",2)[1]==="0"},i.parseMLine=function(t){var r=i.splitLines(t),a=r[0].substr(2).split(" ");return{kind:a[0],port:parseInt(a[1],10),protocol:a[2],fmt:a.slice(3).join(" ")}},i.parseOLine=function(t){var r=i.matchPrefix(t,"o=")[0],a=r.substr(2).split(" ");return{username:a[0],sessionId:a[1],sessionVersion:parseInt(a[2],10),netType:a[3],addressType:a[4],address:a[5]}},i.isValidSDP=function(t){if(typeof t!="string"||t.length===0)return!1;for(var r=i.splitLines(t),a=0;a<r.length;a++)if(r[a].length<2||r[a].charAt(1)!=="=")return!1;return!0},e.exports=i})(mn)),mn.exports}var vn,Ar;function Rs(){if(Ar)return vn;Ar=1;var e=oi();function i(v){return{inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[v.type]||v.type}function t(v,T,g,c,u){var n=e.writeRtpDescription(v.kind,T);if(n+=e.writeIceParameters(v.iceGatherer.getLocalParameters()),n+=e.writeDtlsParameters(v.dtlsTransport.getLocalParameters(),g==="offer"?"actpass":u||"active"),n+="a=mid:"+v.mid+`\r
46`,v.rtpSender&&v.rtpReceiver?n+=`a=sendrecv\r
47`:v.rtpSender?n+=`a=sendonly\r
48`:v.rtpReceiver?n+=`a=recvonly\r
49`:n+=`a=inactive\r
50`,v.rtpSender){var s=v.rtpSender._initialTrackId||v.rtpSender.track.id;v.rtpSender._initialTrackId=s;var S="msid:"+(c?c.id:"-")+" "+s+`\r
51`;n+="a="+S,n+="a=ssrc:"+v.sendEncodingParameters[0].ssrc+" "+S,v.sendEncodingParameters[0].rtx&&(n+="a=ssrc:"+v.sendEncodingParameters[0].rtx.ssrc+" "+S,n+="a=ssrc-group:FID "+v.sendEncodingParameters[0].ssrc+" "+v.sendEncodingParameters[0].rtx.ssrc+`\r
52`)}return n+="a=ssrc:"+v.sendEncodingParameters[0].ssrc+" cname:"+e.localCName+`\r
53`,v.rtpSender&&v.sendEncodingParameters[0].rtx&&(n+="a=ssrc:"+v.sendEncodingParameters[0].rtx.ssrc+" cname:"+e.localCName+`\r
54`),n}function r(v,T){var g=!1;return v=JSON.parse(JSON.stringify(v)),v.filter(function(c){if(c&&(c.urls||c.url)){var u=c.urls||c.url;c.url&&!c.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var n=typeof u=="string";return n&&(u=[u]),u=u.filter(function(s){var S=s.indexOf("turn:")===0&&s.indexOf("transport=udp")!==-1&&s.indexOf("turn:[")===-1&&!g;return S?(g=!0,!0):s.indexOf("stun:")===0&&T>=14393&&s.indexOf("?transport=udp")===-1}),delete c.url,c.urls=n?u[0]:u,!!u.length}})}function a(v,T){var g={codecs:[],headerExtensions:[],fecMechanisms:[]},c=function(n,s){n=parseInt(n,10);for(var S=0;S<s.length;S++)if(s[S].payloadType===n||s[S].preferredPayloadType===n)return s[S]},u=function(n,s,S,l){var m=c(n.parameters.apt,S),y=c(s.parameters.apt,l);return m&&y&&m.name.toLowerCase()===y.name.toLowerCase()};return v.codecs.forEach(function(n){for(var s=0;s<T.codecs.length;s++){var S=T.codecs[s];if(n.name.toLowerCase()===S.name.toLowerCase()&&n.clockRate===S.clockRate){if(n.name.toLowerCase()==="rtx"&&n.parameters&&S.parameters.apt&&!u(n,S,v.codecs,T.codecs))continue;S=JSON.parse(JSON.stringify(S)),S.numChannels=Math.min(n.numChannels,S.numChannels),g.codecs.push(S),S.rtcpFeedback=S.rtcpFeedback.filter(function(l){for(var m=0;m<n.rtcpFeedback.length;m++)if(n.rtcpFeedback[m].type===l.type&&n.rtcpFeedback[m].parameter===l.parameter)return!0;return!1});break}}}),v.headerExtensions.forEach(function(n){for(var s=0;s<T.headerExtensions.length;s++){var S=T.headerExtensions[s];if(n.uri===S.uri){g.headerExtensions.push(S);break}}}),g}function f(v,T,g){return{offer:{setLocalDescription:["stable","have-local-offer"],setRemoteDescription:["stable","have-remote-offer"]},answer:{setLocalDescription:["have-remote-offer","have-local-pranswer"],setRemoteDescription:["have-local-offer","have-remote-pranswer"]}}[T][v].indexOf(g)!==-1}function p(v,T){var g=v.getRemoteCandidates().find(function(c){return T.foundation===c.foundation&&T.ip===c.ip&&T.port===c.port&&T.priority===c.priority&&T.protocol===c.protocol&&T.type===c.type});return g||v.addRemoteCandidate(T),!g}function d(v,T){var g=new Error(T);return g.name=v,g.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[v],g}return vn=function(v,T){function g(l,m){m.addTrack(l),m.dispatchEvent(new v.MediaStreamTrackEvent("addtrack",{track:l}))}function c(l,m){m.removeTrack(l),m.dispatchEvent(new v.MediaStreamTrackEvent("removetrack",{track:l}))}function u(l,m,y,b){var R=new Event("track");R.track=m,R.receiver=y,R.transceiver={receiver:y},R.streams=b,v.setTimeout(function(){l._dispatchEvent("track",R)})}var n=function(l){var m=this,y=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach(function(R){m[R]=y[R].bind(y)}),this.canTrickleIceCandidates=null,this.needNegotiation=!1,this.localStreams=[],this.remoteStreams=[],this._localDescription=null,this._remoteDescription=null,this.signalingState="stable",this.iceConnectionState="new",this.connectionState="new",this.iceGatheringState="new",l=JSON.parse(JSON.stringify(l||{})),this.usingBundle=l.bundlePolicy==="max-bundle",l.rtcpMuxPolicy==="negotiate")throw d("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(l.rtcpMuxPolicy||(l.rtcpMuxPolicy="require"),l.iceTransportPolicy){case"all":case"relay":break;default:l.iceTransportPolicy="all";break}switch(l.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:l.bundlePolicy="balanced";break}if(l.iceServers=r(l.iceServers||[],T),this._iceGatherers=[],l.iceCandidatePoolSize)for(var b=l.iceCandidatePoolSize;b>0;b--)this._iceGatherers.push(new v.RTCIceGatherer({iceServers:l.iceServers,gatherPolicy:l.iceTransportPolicy}));else l.iceCandidatePoolSize=0;this._config=l,this.transceivers=[],this._sdpSessionId=e.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1}
54;Object.defineProperty(n.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(n.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),n.prototype.onicecandidate=null,n.prototype.onaddstream=null,n.prototype.ontrack=null,n.prototype.onremovestream=null,n.prototype.onsignalingstatechange=null,n.prototype.oniceconnectionstatechange=null,n.prototype.onconnectionstatechange=null,n.prototype.onicegatheringstatechange=null,n.prototype.onnegotiationneeded=null,n.prototype.ondatachannel=null,n.prototype._dispatchEvent=function(l,m){this._isClosed||(this.dispatchEvent(m),typeof this["on"+l]=="function"&&this["on"+l](m))},n.prototype._emitGatheringStateChange=function(){var l=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",l)},n.prototype.getConfiguration=function(){return this._config},n.prototype.getLocalStreams=function(){return this.localStreams},n.prototype.getRemoteStreams=function(){return this.remoteStreams},n.prototype._createTransceiver=function(l,m){var y=this.transceivers.length>0,b={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:l,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};
54if(this.usingBundle&&y)b.iceTransport=this.transceivers[0].iceTransport,b.dtlsTransport=this.transceivers[0].dtlsTransport;else{var R=this._createIceAndDtlsTransports();b.iceTransport=R.iceTransport,b.dtlsTransport=R.dtlsTransport}return m||this.transceivers.push(b),b},n.prototype.addTrack=function(l,m){if(this._isClosed)throw d("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var y=this.transceivers.find(function(I){return I.track===l});if(y)throw d("InvalidAccessError","Track already exists.");for(var b,R=0;R<this.transceivers.length;R++)!this.transceivers[R].track&&this.transceivers[R].kind===l.kind&&(b=this.transceivers[R]);return b||(b=this._createTransceiver(l.kind)),this._maybeFireNegotiationNeeded(),this.localStreams.indexOf(m)===-1&&this.localStreams.push(m),b.track=l,b.stream=m,b.rtpSender=new v.RTCRtpSender(l,b.dtlsTransport),b.rtpSender},n.prototype.addStream=function(l){var m=this;if(T>=15025)l.getTracks().forEach(function(b){m.addTrack(b,l)});else{var y=l.clone();l.getTracks().forEach(function(b,R){var I=y.getTracks()[R];b.addEventListener("enabled",function(A){I.enabled=A.enabled})}),y.getTracks().forEach(function(b){m.addTrack(b,y)})}},n.prototype.removeTrack=function(l){if(this._isClosed)throw d("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(l instanceof v.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var m=this.transceivers.find(function(R){return R.rtpSender===l});if(!m)throw d("InvalidAccessError","Sender was not created by this connection.");var y=m.stream;m.rtpSender.stop(),m.rtpSender=null,m.track=null,m.stream=null;var b=this.transceivers.map(function(R){return R.stream});b.indexOf(y)===-1&&this.localStreams.indexOf(y)>-1&&this.localStreams.splice(this.localStreams.indexOf(y),1),this._maybeFireNegotiationNeeded()},n.prototype.removeStream=function(l){var m=this;l.getTracks().forEach(function(y){var b=m.getSenders().find(function(R){return R.track===y});b&&m.removeTrack(b)})},n.prototype.getSenders=function(){return this.transceivers.filter(function(l){return!!l.rtpSender}).map(function(l){return l.rtpSender})},n.prototype.getReceivers=function(){return this.transceivers.filter(function(l){return!!l.rtpReceiver}).map(function(l){return l.rtpReceiver})},n.prototype._createIceGatherer=function(l,m){var y=this;if(m&&l>
540)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var b=new v.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(b,"state",{value:"new",writable:!0}),this.transceivers[l].bufferedCandidateEvents=[],this.transceivers[l].bufferCandidates=function(R){var I=!R.candidate||Object.keys(R.candidate).length===0;b.state=I?"completed":"gathering",y.transceivers[l].bufferedCandidateEvents!==null&&y.transceivers[l].bufferedCandidateEvents.push(R)},b.addEventListener("localcandidate",this.transceivers[l].bufferCandidates),b},n.prototype._gather=function(l,m){var y=this,b=this.transceivers[m].iceGatherer;if(!b.onlocalcandidate){var R=this.transceivers[m].bufferedCandidateEvents;this.transceivers[m].bufferedCandidateEvents=null,b.removeEventListener("localcandidate",this.transceivers[m].bufferCandidates),b.onlocalcandidate=function(I){if(!(y.usingBundle&&m>0)){var A=new Event("icecandidate");A.candidate={sdpMid:l,sdpMLineIndex:m};var x=I.candidate,M=!x||Object.keys(x).length===0;if(M)(b.state==="new"||b.state==="gathering")&&(b.state="completed");else{b.state==="new"&&(b.state="gathering"),x.component=1,x.ufrag=b.getLocalParameters().usernameFragment;var P=e.writeCandidate(x);A.candidate=Object.assign(A.candidate,e.parseCandidate(P)),A.candidate.candidate=P,A.candidate.toJSON=function(){return{candidate:A.candidate.candidate,sdpMid:A.candidate.sdpMid,sdpMLineIndex:A.candidate.sdpMLineIndex,usernameFragment:A.candidate.usernameFragment}}}var L=e.getMediaSections(y._localDescription.sdp);M?L[A.candidate.sdpMLineIndex]+=`a=end-of-candidates\r
55`:L[A.candidate.sdpMLineIndex]+="a="+A.candidate.candidate+`\r
56`,y._localDescription.sdp=e.getDescription(y._localDescription.sdp)+L.join("");var G=y.transceivers.every(function($){return $.iceGatherer&&$.iceGatherer.state==="completed"});y.iceGatheringState!=="gathering"&&(y.iceGatheringState="gathering",y._emitGatheringStateChange()),M||y._dispatchEvent("icecandidate",A),G&&(y._dispatchEvent("icecandidate",new Event("icecandidate")),y.iceGatheringState="complete",y._emitGatheringStateChange())}},v.setTimeout(function(){R.forEach(function(I){b.onlocalcandidate(I)})},0)}},n.prototype._createIceAndDtlsTransports=function(){var l=this,m=new v.RTCIceTransport(null);m.onicestatechange=function(){l._updateIceConnectionState(),l._updateConnectionState()};var y=new v.RTCDtlsTransport(m);return y.ondtlsstatechange=function(){l._updateConnectionState()},y.onerror=function(){Object.defineProperty(y,"state",{value:"failed",writable:!0}),l._updateConnectionState()},{iceTransport:m,dtlsTransport:y}},n.prototype._disposeIceAndDtlsTransports=function(l){var m=this.transceivers[l].iceGatherer;m&&(delete m.onlocalcandidate,delete this.transceivers[l].iceGatherer);var y=this.transceivers[l].iceTransport;y&&(delete y.onicestatechange,delete this.transceivers[l].iceTransport);var b=this.transceivers[l].dtlsTransport;b&&(delete b.ondtlsstatechange,delete b.onerror,delete this.transceivers[l].dtlsTransport)},n.prototype._transceive=function(l,m,y){var b=a(l.localCapabilities,l.remoteCapabilities);m&&l.rtpSender&&(b.encodings=l.sendEncodingParameters,b.rtcp={cname:e.localCName,compound:l.rtcpParameters.compound},l.recvEncodingParameters.length&&(b.rtcp.ssrc=l.recvEncodingParameters[0].ssrc),l.rtpSender.send(b)),y&&l.rtpReceiver&&b.codecs.length>0&&(l.kind==="video"&&l.recvEncodingParameters&&T<15019&&l.recvEncodingParameters.forEach(function(R){delete R.rtx}),l.recvEncodingParameters.length?b.encodings=l.recvEncodingParameters:b.encodings=[{}],b.rtcp={compound:l.rtcpParameters.compound},l.rtcpParameters.cname&&(b.rtcp.cname=l.rtcpParameters.cname),l.sendEncodingParameters.length&&(b.rtcp.ssrc=l.sendEncodingParameters[0].ssrc),l.rtpReceiver.receive(b))},n.prototype.setLocalDescription=function(l){var m=this;if(["offer","answer"].indexOf(l.type)===-1)return Promise.reject(d("TypeError",'Unsupported type "'+l.type+'"'));if(!f("setLocalDescription",l.type,m.signalingState)||m._isClosed)return Promise.reject(d("InvalidStateError","Can not set local "+l.type+" in state "+m.signalingState));var y,b;if(l.type==="offer")y=e.splitSections(l.sdp),b=y.shift(),y.forEac
56h(function(I,A){var x=e.parseRtpParameters(I);m.transceivers[A].localCapabilities=x}),m.transceivers.forEach(function(I,A){m._gather(I.mid,A)});else if(l.type==="answer"){y=e.splitSections(m._remoteDescription.sdp),b=y.shift();var R=e.matchPrefix(b,"a=ice-lite").length>0;y.forEach(function(I,A){var x=m.transceivers[A],M=x.iceGatherer,P=x.iceTransport,L=x.dtlsTransport,G=x.localCapabilities,$=x.remoteCapabilities,Q=e.isRejected(I)&&e.matchPrefix(I,"a=bundle-only").length===0;if(!Q&&!x.rejected){var W=e.getIceParameters(I,b),w=e.getDtlsParameters(I,b);R&&(w.role="server"),(!m.usingBundle||A===0)&&(m._gather(x.mid,A),P.state==="new"&&P.start(M,W,R?"controlling":"controlled"),L.state==="new"&&L.start(w));var B=a(G,$);m._transceive(x,B.codecs.length>0,!1)}})}return m._localDescription={type:l.type,sdp:l.sdp},l.type==="offer"?m._updateSignalingState("have-local-offer"):m._updateSignalingState("stable"),Promise.resolve()},n.prototype.setRemoteDescription=function(l){var m=this;if(["offer","answer"].indexOf(l.type)===-1)return Promise.reject(d("TypeError",'Unsupported type "'+l.type+'"'));if(!f("setRemoteDescription",l.type,m.signalingState)||m._isClosed)return Promise.reject(d("InvalidStateError","Can not set remote "+l.type+" in state "+m.signalingState));var y={};m.remoteStreams.forEach(function(P){y[P.id]=P});var b=[],R=e.splitSections(l.sdp),I=R.shift(),A=e.matchPrefix(I,"a=ice-lite").length>0,x=e.matchPrefix(I,"a=group:BUNDLE ").length>0;m.usingBundle=x;var M=e.matchPrefix(I,"a=ice-options:")[0];return M?m.canTrickleIceCandidates=M.substr(14).split(" ").indexOf("trickle")>=0:m.canTrickleIceCandidates=!1,R.forEach(function(P,L){var G=e.splitLines(P),$=e.getKind(P),Q=e.isRejected(P)&&e.matchPrefix(P,"a=bundle-only").length===0,W=G[0].substr(2).split(" ")[2],w=e.getDirection(P,I),B=e.parseMsid(P),U=e.getMid(P)||e.generateIdentifier();if(Q||$==="application"&&(W==="DTLS/SCTP"||W==="UDP/DTLS/SCTP")){m.transceivers[L]={mid:U,kind:$,protocol:W,rejected:!0};return}!Q&&m.transceivers[L]&&m.transceivers[L].rejected&&(m.transceivers[L]=m._createTransceiver($,!0));var F,V,H,z,re,Y,X,K,ee,oe=e.parseRtpParameters(P),Ce,ae;Q||(Ce=e.getIceParameters(P,I),ae=e.getDtlsParameters(P,I),ae.role="client"),X=e.parseRtpEncodingParameters(P);var le=e.parseRtcpParameters(P),te=e.matchPrefix(P,"a=end-of-candidates",I).length>0,J=e.matchPrefix(P,"a=candidate:").map(function(Ee){return e.parseCandidate(Ee)}).filter(function(Ee){return Ee.component===1});if((l.type==="offer"||l.type==="answer")&&!Q&&x&&L>0&&m.transceivers[L]&&(m._disposeIceAndDtlsTransports(L),m.transceivers[L].iceGatherer=m.transceivers[
560].iceGatherer,m.transceivers[L].iceTransport=m.transceivers[0].iceTransport,m.transceivers[L].dtlsTransport=m.transceivers[0].dtlsTransport,m.transceivers[L].rtpSender&&m.transceivers[L].rtpSender.setTransport(m.transceivers[0].dtlsTransport),m.transceivers[L].rtpReceiver&&m.transceivers[L].rtpReceiver.setTransport(m.transceivers[0].dtlsTransport)),l.type==="offer"&&!Q){F=m.transceivers[L]||m._createTransceiver($),F.mid=U,F.iceGatherer||(F.iceGatherer=m._createIceGatherer(L,x)),J.length&&F.iceTransport.state==="new"&&(te&&(!x||L===0)?F.iceTransport.setRemoteCandidates(J):J.forEach(function(Ee){p(F.iceTransport,Ee)})),K=v.RTCRtpReceiver.getCapabilities($),T<15019&&(K.codecs=K.codecs.filter(function(Ee){return Ee.name!=="rtx"})),Y=F.sendEncodingParameters||[{ssrc:(2*L+2)*1001}];var ce=!1;if(w==="sendrecv"||w==="sendonly"){if(ce=!F.rtpReceiver,re=F.rtpReceiver||new v.RTCRtpReceiver(F.dtlsTransport,$),ce){var ye;ee=re.track,B&&B.stream==="-"||(B?(y[B.stream]||(y[B.stream]=new v.MediaStream,Object.defineProperty(y[B.stream],"id",{get:function(){return B.stream}})),Object.defineProperty(ee,"id",{get:function(){return B.track}}),ye=y[B.stream]):(y.default||(y.default=new v.MediaStream),ye=y.default)),ye&&(g(ee,ye),F.associatedRemoteMediaStreams.push(ye)),b.push([ee,re,ye])}}else F.rtpReceiver&&F.rtpReceiver.track&&(F.associatedRemoteMediaStreams.forEach(function(Ee){var we=Ee.getTracks().find(function(Be){return Be.id===F.rtpReceiver.track.id});we&&c(we,Ee)}),F.associatedRemoteMediaStreams=[]);F.localCapabilities=K,F.remoteCapabilities=oe,F.rtpReceiver=re,F.rtcpParameters=le,F.sendEncodingParameters=Y,F.recvEncodingParameters=X,m._transceive(m.transceivers[L],!1,ce)}else if(l.type==="answer"&&!Q){F=m.transceivers[L],V=F.iceGatherer,H=F.iceTransport,z=F.dtlsTransport,re=F.rtpReceiver,Y=F.sendEncodingParameters,K=F.localCapabilities,m.transceivers[L].recvEncodingParameters=X,m.transceivers[L].remoteCapabilities=oe,m.transceivers[L].rtcpParameters=le,J.length&&H.state==="new"&&((A||te)&&(!x||L===0)?H.setRemoteCandidates(J):J.forEach(function(Ee){p(F.iceTransport,Ee)})),(!x||L===0)&&(H.state==="new"&&H.start(V,Ce,"controlling"),z.state==="new"&&z.start(ae));var fe=a(F.localCapabilities,F.remoteCapabilities),ve=fe.codecs.filter(function(Ee){return Ee.name.toLowerCase()==="rtx"}).length;!ve&&F.sendEncodingParameters[0].rtx&&delete F.sendEncodingParameters[0].rtx,m._transceive(F,w==="sendrecv"||w==="recvonly",w==="sendrecv"||w==="sendonly"),re&&(w==="sendrecv"||w==="sendonly")?(ee=re.track,B?(y[B.stream]||(y[B.stream]=new v.MediaStream),g(ee,y[B.stream]),b.push([ee,re,y[B.stream]])):(y.default||(y.default=new v.MediaStream),g(ee,y.default),b.push([ee,re,y.default]))):delete F.rtpReceiver}}),m._dtlsRole===void 0&&(m._dtlsRole=l.type==="offer"?"active":"passive"),m._remoteDescription={type:l.type,sdp:l.sdp},l.type==="offer"?m._updateSignalingState("have-remote-offer"):m._updateSignalingState("stable"),Object.keys(y).forEach(function(P){var L=y[P];if(L.getTracks().length){if(m.remoteStreams.indexOf(L)===-1){m.remoteStreams.push(L);var G=new Event("addstream");G.stream=L,v.setTimeout(function(){m._dispatchEvent("addstream",G)})}b.forEach(function($){var Q=$[0],W=$[1];L.id===$[2].id&&u(m,Q,W,[L])})}}),b.forEach(function(P){P[2]||u(m,P[0],P[1],[])}),v.setTimeout(function(){m&&m.transceivers&&m.transceivers.forEach(function(P){P.iceTransport&&P.iceTransport.state==="new"&&P.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),P.iceTransport.addRemoteCandidate({}))})},4e3),Promise.resolve()},n.prototype.close=function(){this.transceivers.forEach(function(l){l.iceTransport&&l.iceTransport.stop(),l.dtlsTransport&&l.dtlsTransport.stop(),l.rtpSender&&l.rtpSender.stop(),l.rtpReceiver&&l.rtpReceiver.stop()}),this._isClosed=!0,this._updateSignalingState("closed")},n.prototype._updateSignalingState=function(l){this.signalingState=l;var m=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",m)},n.prototype._maybeFireNegotiationNeeded=function(){var l=this;this.signalingState!=="stable"||this.needNegotiation===!0||(this.needNegotiation=!0,v.setTimeout(function(){if(l.needNegotiation){l.needNegotiation=!1;var m=new Event("negotiationneeded");l._dispatchEvent("negotiationneeded",m)}},0))},n.prototype._updateIceConnectionState=function(){var l,m={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};
56if(this.transceivers.forEach(function(b){b.iceTransport&&!b.rejected&&m[b.iceTransport.state]++}),l="new",m.failed>0?l="failed":m.checking>0?l="checking":m.disconnected>0?l="disconnected":m.new>0?l="new":m.connected>0?l="connected":m.completed>0&&(l="completed"),l!==this.iceConnectionState){this.iceConnectionState=l;var y=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",y)}},n.prototype._updateConnectionState=function(){var l,m={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(b){b.iceTransport&&b.dtlsTransport&&!b.rejected&&(m[b.iceTransport.state]++,m[b.dtlsTransport.state]++)}),m.connected+=m.completed,l="new",m.failed>0?l="failed":m.connecting>0?l="connecting":m.disconnected>0?l="disconnected":m.new>0?l="new":m.connected>0&&(l="connected"),l!==this.connectionState){this.connectionState=l;var y=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",y)}},n.prototype.createOffer=function(){var l=this;if(l._isClosed)return Promise.reject(d("InvalidStateError","Can not call createOffer after close"));var m=l.transceivers.filter(function(A){return A.kind==="audio"}).length,y=l.transceivers.filter(function(A){return A.kind==="video"}).length,b=arguments[0];if(b){if(b.mandatory||b.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");b.offerToReceiveAudio!==void 0&&(b.offerToReceiveAudio===!0?m=1:b.offerToReceiveAudio===!1?m=0:m=b.offerToReceiveAudio),b.offerToReceiveVideo!==void 0&&(b.offerToReceiveVideo===!0?y=1:b.offerToReceiveVideo===!1?y=0:y=b.offerToReceiveVideo)}for(l.transceivers.forEach(function(A){A.kind==="audio"?(m--,m<0&&(A.wantReceive=!1)):A.kind==="video"&&(y--,y<0&&(A.wantReceive=!1))});m>0||y>0;)m>0&&(l._createTransceiver("audio"),m--),y>0&&(l._createTransceiver("video"),y--);var R=e.writeSessionBoilerplate(l._sdpSessionId,l._sdpSessionVersion++);l.transceivers.forEach(function(A,x){var M=A.track,P=A.kind,L=A.mid||e.generateIdentifier();A.mid=L,A.iceGatherer||(A.iceGatherer=l._createIceGatherer(x,l.usingBundle));var G=v.RTCRtpSender.getCapabilities(P);T<15019&&(G.codecs=G.codecs.filter(function(Q){return Q.name!=="rtx"})),G.codecs.forEach(function(Q){Q.name==="H264"&&Q.parameters["level-asymmetry-allowed"]===void 0&&(Q.parameters["level-asymmetry-allowed"]="1"),A.remoteCapabilities&&A.remoteCapabilities.codecs&&A.remoteCapabilities.codecs.forEach(function(W){Q.name.toLowerCase()===W.name.toLowerCase()&&Q.clockRate===W.clockRate&&(Q.preferredPayloadType=W.payloadType)})}),G.headerExtensions.forEach(function(Q){var W=A.remoteCapabilities&&A.remoteCapabilities.headerExtensions||[];W.forEach(function(w){Q.uri===w.uri&&(Q.id=w.id)})});var $=A.sendEncodingParameters||[{ssrc:(2*x+1)*1001}];M&&T>=15019&&P==="video"&&!$[0].rtx&&($[0].rtx={ssrc:$[0].ssrc+1}),A.wantReceive&&(A.rtpReceiver=new v.RTCRtpReceiver(A.dtlsTransport,P)),A.localCapabilities=G,A.sendEncodingParameters=$}),l._config.bundlePolicy!=="max-compat"&&(R+="a=group:BUNDLE "+l.transceivers.map(function(A){return A.mid}).join(" ")+`\r
57`),R+=`a=ice-options:trickle\r
58`,l.transceivers.forEach(function(A,x){R+=t(A,A.localCapabilities,"offer",A.stream,l._dtlsRole),R+=`a=rtcp-rsize\r
59`,A.iceGatherer&&l.iceGatheringState!=="new"&&(x===0||!l.usingBundle)&&(A.iceGatherer.getLocalCandidates().forEac
59h(function(M){M.component=1,R+="a="+e.writeCandidate(M)+`\r
60`}),A.iceGatherer.state==="completed"&&(R+=`a=end-of-candidates\r
61`))});var I=new v.RTCSessionDescription({type:"offer",sdp:R});return Promise.resolve(I)},n.prototype.createAnswer=function(){var l=this;if(l._isClosed)return Promise.reject(d("InvalidStateError","Can not call createAnswer after close"));if(!(l.signalingState==="have-remote-offer"||l.signalingState==="have-local-pranswer"))return Promise.reject(d("InvalidStateError","Can not call createAnswer in signalingState "+l.signalingState));var m=e.writeSessionBoilerplate(l._sdpSessionId,l._sdpSessionVersion++);l.usingBundle&&(m+="a=group:BUNDLE "+l.transceivers.map(function(R){return R.mid}).join(" ")+`\r
62`),m+=`a=ice-options:trickle\r
63`;var y=e.getMediaSections(l._remoteDescription.sdp).length;l.transceivers.forEach(function(R,I){if(!(I+1>y)){if(R.rejected){R.kind==="application"?R.protocol==="DTLS/SCTP"?m+=`m=application 0 DTLS/SCTP 5000\r
64`:m+="m=application 0 "+R.protocol+` webrtc-datachannel\r
65`:R.kind==="audio"?m+=`m=audio 0 UDP/TLS/RTP/SAVPF 0\r
66a=rtpmap:0 PCMU/8000\r
67`:R.kind==="video"&&(m+=`m=video 0 UDP/TLS/RTP/SAVPF 120\r
68a=rtpmap:120 VP8/90000\r
69`),m+=`c=IN IP4 0.0.0.0\r
70a=inactive\r
71a=mid:`+R.mid+`\r
72`;return}if(R.stream){var A;R.kind==="audio"?A=R.stream.getAudioTracks()[0]:R.kind==="video"&&(A=R.stream.getVideoTracks()[0]),A&&T>=15019&&R.kind==="video"&&!R.sendEncodingParameters[0].rtx&&(R.sendEncodingParameters[0].rtx={ssrc:R.sendEncodingParameters[0].ssrc+1})}var x=a(R.localCapabilities,R.remoteCapabilities),M=x.codecs.filter(function(P){return P.name.toLowerCase()==="rtx"}).length;!M&&R.sendEncodingParameters[0].rtx&&delete R.sendEncodingParameters[0].rtx,m+=t(R,x,"answer",R.stream,l._dtlsRole),R.rtcpParameters&&R.rtcpParameters.reducedSize&&(m+=`a=rtcp-rsize\r
73`)}});var b=new v.RTCSessionDescription({type:"answer",sdp:m});return Promise.resolve(b)},n.prototype.addIceCandidate=function(l){var m=this,y;return l&&!(l.sdpMLineIndex!==void 0||l.sdpMid)?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise(function(b,R){if(m._remoteDescription)if(!l||l.candidate==="")for(var I=0;I<m.transceivers.length&&!(!m.transceivers[I].rejected&&(m.transceivers[I].iceTransport.addRemoteCandidate({}),y=e.getMediaSections(m._remoteDescription.sdp),y[I]+=`a=end-of-candidates\r
74`,m._remoteDescription.sdp=e.getDescription(m._remoteDescription.sdp)+y.join(""),m.usingBundle));I++);else{var A=l.sdpMLineIndex;if(l.sdpMid){for(var x=0;x<m.transceivers.length;x++)if(m.transceivers[x].mid===l.sdpMid){A=x;break}}var M=m.transceivers[A];if(M){if(M.rejected)return b();var P=Object.keys(l.candidate).length>0?e.parseCandidate(l.candidate):{};if(P.protocol==="tcp"&&(P.port===0||P.port===9)||P.component&&P.component!==1)return b();if((A===0||A>
740&&M.iceTransport!==m.transceivers[0].iceTransport)&&!p(M.iceTransport,P))return R(d("OperationError","Can not add ICE candidate"));var L=l.candidate.trim();L.indexOf("a=")===0&&(L=L.substr(2)),y=e.getMediaSections(m._remoteDescription.sdp),y[A]+="a="+(P.type?L:"end-of-candidates")+`\r
75`,m._remoteDescription.sdp=e.getDescription(m._remoteDescription.sdp)+y.join("")}else return R(d("OperationError","Can not add ICE candidate"))}else return R(d("InvalidStateError","Can not add ICE candidate without a remote description"));b()})},n.prototype.getStats=function(l){if(l&&l instanceof v.MediaStreamTrack){var m=null;if(this.transceivers.forEach(function(b){b.rtpSender&&b.rtpSender.track===l?m=b.rtpSender:b.rtpReceiver&&b.rtpReceiver.track===l&&(m=b.rtpReceiver)}),!m)throw d("InvalidAccessError","Invalid selector.");return m.getStats()}var y=[];return this.transceivers.forEach(function(b){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach(function(R){b[R]&&y.push(b[R].getStats())})}),Promise.all(y).then(function(b){var R=new Map;return b.forEach(function(I){I.forEach(function(A){R.set(A.id,A)})}),R})};var s=["RTCRtpSender","RTCRtpReceiver","RTCIceGatherer","RTCIceTransport","RTCDtlsTransport"];s.forEach(function(l){var m=v[l];if(m&&m.prototype&&m.prototype.getStats){var y=m.prototype.getStats;m.prototype.getStats=function(){return y.apply(this).then(function(b){var R=new Map;return Object.keys(b).forEach(function(I){b[I].type=i(b[I]),R.set(I,b[I])}),R})}}});var S=["createOffer","createAnswer"];return S.forEach(function(l){var m=n.prototype[l];n.prototype[l]=function(){var y=arguments;return typeof y[0]=="function"||typeof y[1]=="function"?m.apply(this,[arguments[2]]).then(function(b){typeof y[0]=="function"&&y[0].apply(null,[b])},function(b){typeof y[1]=="function"&&y[1].apply(null,[b])}):m.apply(this,arguments)}}),S=["setLocalDescription","setRemoteDescription","addIceCandidate"],S.forEac
75h(function(l){var m=n.prototype[l];n.prototype[l]=function(){var y=arguments;return typeof y[1]=="function"||typeof y[2]=="function"?m.apply(this,arguments).then(function(){typeof y[1]=="function"&&y[1].apply(null)},function(b){typeof y[2]=="function"&&y[2].apply(null,[b])}):m.apply(this,arguments)}}),["getStats"].forEach(function(l){var m=n.prototype[l];n.prototype[l]=function(){var y=arguments;return typeof y[1]=="function"?m.apply(this,arguments).then(function(){typeof y[1]=="function"&&y[1].apply(null)}):m.apply(this,arguments)}}),n},vn}var Ns=Rs();const Is=jr(Ns);function ai(e){const i=e&&e.navigator,t=function(a){return{name:{PermissionDeniedError:"NotAllowedError"}[a.name]||a.name,message:a.message,constraint:a.constraint,toString(){return this.name}}},r=i.mediaDevices.getUserMedia.bind(i.mediaDevices);i.mediaDevices.getUserMedia=function(a){return r(a).catch(f=>Promise.reject(t(f)))}}function ui(e){"getDisplayMedia"in e.navigator&&e.navigator.mediaDevices&&(e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||(e.navigator.mediaDevices.getDisplayMedia=e.navigator.getDisplayMedia.bind(e.navigator)))}function On(e,i){if(e.RTCIceGatherer&&(e.RTCIceCandidate||(e.RTCIceCandidate=function(a){return a}),e.RTCSessionDescription||(e.RTCSessionDescription=function(a){return a}),i.version<15025)){const r=Object.getOwnPropertyDescriptor(e.MediaStreamTrack.prototype,"enabled");Object.defineProperty(e.MediaStreamTrack.prototype,"enabled",{set(a){r.set.call(this,a);const f=new Event("enabled");f.enabled=a,this.dispatchEvent(f)}})}e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)&&Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=new e.RTCDtmfSender(this):this.track.kind==="video"&&(this._dtmf=null)),this._dtmf}}),e.RTCDtmfSender&&!e.RTCDTMFSender&&(e.RTCDTMFSender=e.RTCDtmfSender);const t=Is(e,i.version);e.RTCPeerConnection=function(a){return a&&a.iceServers&&(a.iceServers=As(a.iceServers,i.version),kn("ICE servers after filtering:",a.iceServers)),new t(a)},e.RTCPeerConnection.prototype=t.prototype}function ci(e){e.RTCRtpSender&&!("replaceTrack"in e.RTCRtpSender.prototype)&&(e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack)}const Rr=Object.freeze(Object.defineProperty({__proto__:null,shimGetDisplayMedia:ui,shimGetUserMedia:ai,shimPeerConnection:On,shimReplaceTrack:ci},Symbol.toStringTag,{value:"Module"}));function li(e,i){const t=e&&e.navigator,r=e&&e.MediaStreamTrack;if(t.getUserMedia=function(a,f,p){Gt("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),t.mediaDevices.getUserMedia(a).then(f,p)},!(i.version>55&&"autoGainControl"in t.mediaDevices.getSupportedConstraints())){const a=function(p,d,v){d in p&&!(v in p)&&(p[v]=p[d],delete p[d])},f=t.mediaDevices.getUserMedia.bind(t.mediaDevices);if(t.mediaDevices.getUserMedia=function(p){return typeof p=="object"&&typeof p.audio=="object"&&(p=JSON.parse(JSON.stringify(p)),a(p.audio,"autoGainControl","mozAutoGainControl"),a(p.audio,"noiseSuppression","mozNoiseSuppression")),f(p)},r&&r.prototype.getSettings){const p=r.prototype.getSettings;r.prototype.getSettings=function(){const d=p.apply(this,arguments);return a(d,"mozAutoGainControl","autoGainControl"),a(d,"mozNoiseSuppression","noiseSuppression"),d}}if(r&&r.prototype.applyConstraints){const p=r.prototype.applyConstraints;r.prototype.applyConstraints=function(d){return this.kind==="audio"&&typeof d=="object"&&(d=JSON.parse(JSON.stringify(d)),a(d,"autoGainControl","mozAutoGainControl"),a(d,"noiseSuppression","mozNoiseSuppression")),p.apply(this,[d])}}}}function xs(e,i){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!(r&&r.video)){const a=new DOMException("getDisplayMedia without video constraints is undefined");return a.name="NotFoundError",a.code=8,Promise.reject(a)}return r.video===!0?r.video={mediaSource:i}:r.video.mediaSource=i,e.navigator.mediaDevices.getUserMedia(r)})}function di(e){typeof e=="object"&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Ln(e,i){if(typeof e!="object"||!(e.RTCPeerConnection||e.mozRTCPeerConnection))return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),i.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(a){const f=e.RTCPeerConnection.prototype[a],p={[a](){return arguments[0]=new(a==="addIceCandidate"?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),f.apply(this,arguments)}};e.RTCPeerConnection.prototype[a]=p[a]});
vendor: 15,550 bytes, lines 75-78
75const t={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[f,p,d]=arguments;return r.apply(this,[f||null]).then(v=>{if(i.version<53&&!p)try{v.forEach(T=>{T.type=t[T.type]||T.type})}catch(T){if(T.name!=="TypeError")throw T;v.forEach((g,c)=>{v.set(c,Object.assign({},g,{type:t[g.type]||g.type}))})}return v}).then(p,d)}}function fi(e){if(!(typeof e=="object"&&e.RTCPeerConnection&&e.RTCRtpSender)||e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;const i=e.RTCPeerConnection.prototype.getSenders;i&&(e.RTCPeerConnection.prototype.getSenders=function(){const a=i.apply(this,[]);return a.forEach(f=>f._pc=this),a});const t=e.RTCPeerConnection.prototype.addTrack;t&&(e.RTCPeerConnection.prototype.addTrack=function(){const a=t.apply(this,arguments);return a._pc=this,a}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function hi(e){if(!(typeof e=="object"&&e.RTCPeerConnection&&e.RTCRtpSender)||e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;const i=e.RTCPeerConnection.prototype.getReceivers;i&&(e.RTCPeerConnection.prototype.getReceivers=function(){const r=i.apply(this,[]);return r.forEach(a=>a._pc=this),r}),Et(e,"track",t=>(t.receiver._pc=t.srcElement,t)),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function pi(e){!e.RTCPeerConnection||"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(t){Gt("removeStream","removeTrack"),this.getSenders().forEach(r=>{r.track&&t.getTracks().includes(r.track)&&this.removeTrack(r)})})}function gi(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function mi(e){if(!(typeof e=="object"&&e.RTCPeerConnection))return;const i=e.RTCPeerConnection.prototype.addTransceiver;i&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];const r=arguments[1],a=r&&"sendEncodings"in r;a&&r.sendEncodings.forEach(p=>{if("rid"in p&&!/^[a-z0-9]{0,16}$/i.test(p.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in p&&!(parseFloat(p.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in p&&!(parseFloat(p.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const f=i.apply(this,arguments);if(a){const{sender:p}=f,d=p.getParameters();(!("encodings"in d)||d.encodings.length===1&&Object.keys(d.encodings[0]).length===0)&&(d.encodings=r.sendEncodings,p.sendEncodings=r.sendEncodings,this.setParametersPromises.push(p.setParameters(d).then(()=>{delete p.sendEncodings}).catch(()=>{delete p.sendEncodings})))}return f})}function vi(e){if(!(typeof e=="object"&&e.RTCRtpSender))return;const i=e.RTCRtpSender.prototype.getParameters;i&&(e.RTCRtpSender.prototype.getParameters=function(){const r=i.apply(this,arguments);return"encodings"in r||(r.encodings=[].concat(this.sendEncodings||[{}])),r})}function Ci(e){if(!(typeof e=="object"&&e.RTCPeerConnection))return;const i=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>i.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):i.apply(this,arguments)}}function Ei(e){if(!(typeof e=="object"&&e.RTCPeerConnection))return;const i=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>i.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):i.apply(this,arguments)}}const Nr=Object.freeze(Object.defineProperty({__proto__:null,shimAddTransceiver:mi,shimCreateAnswer:Ei,shimCreateOffer:Ci,shimGetDisplayMedia:xs,shimGetParameters:vi,shimGetUserMedia:li,shimOnTrack:di,shimPeerConnection:Ln,shimRTCDataChannel:gi,shimReceiverGetStats:hi,shimRemoveStream:pi,shimSenderGetStats:fi},Symbol.toStringTag,{value:"Module"}));function yi(e){if(!(typeof e!="object"||!e.RTCPeerConnection)){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){const i=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(r){this._localStreams||(this._localStreams=[]),this._localStreams.includes(r)||this._localStreams.push(r),r.getAudioTracks().forEach(a=>i.call(this,a,r)),r.getVideoTracks().forEach(a=>i.call(this,a,r))},e.RTCPeerConnection.prototype.addTrack=function(r,...a){return a&&a.forEach(f=>{this._localStreams?this._localStreams.includes(f)||this._localStreams.push(f):this._localStreams=[f]}),i.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(t){this._localStreams||(this._localStreams=[]);const r=this._localStreams.indexOf(t);if(r===-1)return;this._localStreams.splice(r,1);const a=t.getTracks();this.getSenders().forEach(f=>{a.includes(f.track)&&this.removeTrack(f)})})}}function Si(e){if(!(typeof e!="object"||!e.RTCPeerConnection)&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(t){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=t),this.addEventListener("track",this._onaddstreampoly=r=>{r.streams.forEach(a=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(a))return;this._remoteStreams.push(a);const f=new Event("addstream");f.stream=a,this.dispatchEvent(f)})})}});const i=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){const r=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(a){a.streams.forEach(f=>{if(r._remoteStreams||(r._remoteStreams=[]),r._remoteStreams.indexOf(f)>=0)return;r._remoteStreams.push(f);const p=new Event("addstream");p.stream=f,r.dispatchEvent(p)})}),i.apply(r,arguments)}}}function Ti(e){if(typeof e!="object"||!e.RTCPeerConnection)return;const i=e.RTCPeerConnection.prototype,t=i.createOffer,r=i.createAnswer,a=i.setLocalDescription,f=i.setRemoteDescription,p=i.addIceCandidate;i.createOffer=function(T,g){const c=arguments.length>=2?arguments[2]:arguments[0],u=t.apply(this,[c]);return g?(u.then(T,g),Promise.resolve()):u},i.createAnswer=function(T,g){const c=arguments.length>=2?arguments[2]:arguments[0],u=r.apply(this,[c]);return g?(u.then(T,g),Promise.resolve()):u};let d=function(v,T,g){const c=a.apply(this,[v]);return g?(c.then(T,g),Promise.resolve()):c};i.setLocalDescription=d,d=function(v,T,g){const c=f.apply(this,[v]);return g?(c.then(T,g),Promise.resolve()):c},i.setRemoteDescription=d,d=function(v,T,g){const c=p.apply(this,[v]);return g?(c.then(T,g),Promise.resolve()):c},i.addIceCandidate=d}function _i(e){const i=e&&e.navigator;if(i.mediaDevices&&i.mediaDevices.getUserMedia){const t=i.mediaDevices,r=t.getUserMedia.bind(t);i.mediaDevices.getUserMedia=a=>r(bi(a))}!i.getUserMedia&&i.mediaDevices&&i.mediaDevices.getUserMedia&&(i.getUserMedia=(function(r,a,f){i.mediaDevices.getUserMedia(r).then(a,f)}).bind(i))}function bi(e){return e&&e.video!==void 0?Object.assign({},e,{video:$r(e.video)}):e}function Di(e){if(!e.RTCPeerConnection)return;const i=e.RTCPeerConnection;e.RTCPeerConnection=function(r,a){if(r&&r.iceServers){const f=[];for(let p=0;p<r.iceServers.length;p++){let d=r.iceServers[p];!d.hasOwnProperty("urls")&&d.hasOwnProperty("url")?(Gt("RTCIceServer.url","RTCIceServer.urls"),d=JSON.parse(JSON.stringify(d)),d.urls=d.url,delete d.url,f.push(d)):f.push(r.iceServers[p])}r.iceServers=f}return new i(r,a)},e.RTCPeerConnection.prototype=i.prototype,"generateCertificate"in i&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get(){return i.generateCertificate}})}function Ai(e){typeof e=="object"&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Ri(e){const i=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(r){if(r){typeof r.offerToReceiveAudio<"u"&&(r.offerToReceiveAudio=!!r.offerToReceiveAudio);const a=this.getTransceivers().find(p=>p.receiver.track.kind==="audio");r.offerToReceiveAudio===!1&&a?a.direction==="sendrecv"?a.setDirection?a.setDirection("sendonly"):a.direction="sendonly":a.direction==="recvonly"&&(a.setDirection?a.setDirection("inactive"):a.direction="inactive"):r.offerToReceiveAudio===!0&&!a&&this.addTransceiver("audio"),typeof r.offerToReceiveVideo<"u"&&(r.offerToReceiveVideo=!!r.offerToReceiveVideo);const f=this.getTransceivers().find(p=>p.receiver.track.kind==="video");r.offerToReceiveVideo===!1&&f?f.direction==="sendrecv"?f.setDirection?f.setDirection("sendonly"):f.direction="sendonly":f.direction==="recvonly"&&(f.setDirection?f.setDirection("inactive"):f.direction="inactive"):r.offerToReceiveVideo===!0&&!f&&this.addTransceiver("video")}return i.apply(this,arguments)}}function Ni(e){typeof e!="object"||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}const Ir=Object.freeze(Object.defineProperty({__proto__:null,shimAudioContext:Ni,shimCallbacksAPI:Ti,shimConstraints:bi,shimCreateOfferLegacy:Ri,shimGetUserMedia:_i,shimLocalStreamsAPI:yi,shimRTCIceServerUrls:Di,shimRemoteStreamsAPI:Si,shimTrackEventTransceiver:Ai},Symbol.toStringTag,{value:"Module"}));var Os=oi();const Ft=jr(Os);function Ut(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;const i=e.RTCIceCandidate;e.RTCIceCandidate=function(r){if(typeof r=="object"&&r.candidate&&r.candidate.indexOf("a=")===0&&(r=JSON.parse(JSON.stringify(r)),r.candidate=r.candidate.substr(2)),r.candidate&&r.candidate.length){const a=new i(r),f=Ft.parseCandidate(r.candidate),p=Object.assign(a,f);return p.toJSON=function(){return{candidate:p.candidate,sdpMid:p.sdpMid,sdpMLineIndex:p.sdpMLineIndex,usernameFragment:p.usernameFragment}},p}return new i(r)},e.RTCIceCandidate.prototype=i.prototype,Et(e,"icecandidate",t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t))}function At(e,i){if(!e.RTCPeerConnection)return;"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp}});const t=function(d){if(!d||!d.sdp)return!1;const v=Ft.splitSections(d.sdp);return v.shift(),v.some(T=>{const g=Ft.parseMLine(T);return g&&g.kind==="application"&&g.protocol.indexOf("SCTP")!==-1})},r=function(d){const v=d.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(v===null||v.length<2)return-1;const T=parseInt(v[1],10);return T!==T?-1:T},a=function(d){let v=65536;return i.browser==="firefox"&&(i.version<57?d===-1?v=16384:v=2147483637:i.version<60?v=i.version===57?65535:65536:v=2147483637),v},f=function(d,v){let T=65536;i.browser==="firefox"&&i.version===57&&(T=65535);const g=Ft.matchPrefix(d.sdp,"a=max-message-size:");return g.length>0?T=parseInt(g[0].substr(19),10):i.browser==="firefox"&&v!==-1&&(T=2147483637),T},p=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,i.browser==="chrome"&&i.version>=76){const{sdpSemantics:v}=this.getConfiguration();v==="plan-b"&&Object.defineProperty(this,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp},enumerable:!0,configurable:!0})}if(t(arguments[0])){const v=r(arguments[0]),T=a(v),g=f(arguments[0],v);let c;T===0&&g===0?c=Number.POSITIVE_INFINITY:T===0||g===0?c=Math.max(T,g):c=Math.min(T,g);const u={};Object.defineProperty(u,"maxMessageSize",{get(){return c}}),this._sctp=u}return p.apply(this,arguments)}}function Rt(e){if(!(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype))return;function i(r,a){const f=r.send;r.send=function(){const d=arguments[0],v=d.length||d.size||d.byteLength;if(r.readyState==="open"&&a.sctp&&v>a.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+a.sctp.maxMessageSize+" bytes)");return f.apply(r,arguments)}}const t=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const a=t.apply(this,arguments);return i(a,this),a},Et(e,"datachannel",r=>(i(r.channel,r.target),r))}function wn(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;const i=e.RTCPeerConnection.prototype;Object.defineProperty(i,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(i,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(t){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),t&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=t)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(t=>{const r=i[t];i[t]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=a=>{const f=a.target;if(f._lastConnectionState!==f.connectionState){f._lastConnectionState=f.connectionState;const p=new Event("connectionstatechange",a);f.dispatchEvent(p)}return a},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}})}function Pn(e,i){if(!e.RTCPeerConnection||i.browser==="chrome"&&i.version>=71||i.browser==="safari"&&i.version>=605)return;const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(a){if(a&&a.sdp&&a.sdp.indexOf(`
76a=extmap-allow-mixed`)!==-1){const f=a.sdp.split(`
77`).filter(p=>p.trim()!=="a=extmap-allow-mixed").join(`
78`);e.RTCSessionDescription&&a instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:a.type,sdp:f}):a.sdp=f}return t.apply(this,arguments)}}function jt(e,i){if(!(e.RTCPeerConnection&&e.RTCPeerConnection.prototype))return;const t=e.RTCPeerConnection.prototype.addIceCandidate;!t||t.length===0||(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(i.browser==="chrome"&&i.version<78||i.browser==="firefox"&&i.version<68||i.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():t.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}const Ls=Object.freeze(Object.defineProperty({__proto__:null,removeExtmapAllowMixed:Pn,shimAddIceCandidateNullOrEmpty:jt,shimConnectionState:wn,shimMaxMessageSize:At,shimRTCIceCandidate:Ut,shimSendThrowTypeError:Rt},Symbol.toStringTag,{value:"Module"}));function ws({window:e}={}
78,i={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0}){const t=kn,r=bs(e),a={browserDetails:r,commonShim:Ls,extractVersion:Dt,disableLog:Ts,disableWarnings:_s};switch(r.browser){case"chrome":if(!br||!xn||!i.shimChrome)return t("Chrome shim is not included in this adapter release."),a;if(r.version===null)return t("Chrome shim can not determine version, not shimming."),a;t("adapter.js shimming chrome."),a.browserShim=br,jt(e,r),Kr(e,r),Yr(e),xn(e,r),Zr(e),ii(e,r),ei(e),ti(e),ni(e),si(e,r),Ut(e),wn(e),At(e,r),Rt(e),Pn(e,r);break;case"firefox":if(!Nr||!Ln||!i.shimFirefox)return t("Firefox shim is not included in this adapter release."),a;t("adapter.js shimming firefox."),a.browserShim=Nr,jt(e,r),li(e,r),Ln(e,r),di(e),pi(e),fi(e),hi(e),gi(e),mi(e),vi(e),Ci(e),Ei(e),Ut(e),wn(e),At(e,r),Rt(e);break;case"edge":if(!Rr||!On||!i.shimEdge)return t("MS edge shim is not included in this adapter release."),a;t("adapter.js shimming edge."),a.browserShim=Rr,ai(e),ui(e),On(e,r),ci(e),At(e,r),Rt(e);break;case"safari":if(!Ir||!i.shimSafari)return t("Safari shim is not included in this adapter release."),a;t("adapter.js shimming safari."),a.browserShim=Ir,jt(e,r),Di(e),Ri(e),Ti(e),yi(e),Si(e),Ai(e),_i(e),Ni(e),Ut(e),At(e,r),Rt(e),Pn(e,r);break;default:t("Unsupported browser!");break}return a}ws({window:typeof window>"u"?void 0:window});var Cn,xr;function Vt(){if(xr)return Cn;xr=1;var e=Re(),i={getUserJid:function(t,r){return t+"-"+r+"@"+e.endpoints.chat},getIdFromNode:function(t){return t.indexOf("@")<0?null:parseInt(t.split("@")[0].split("-")[0])},trace:function(t){e.debug&&console.log("[QBWebRTC]:",t)},traceWarning:function(t){e.debug&&console.warn("[QBWebRTC]:",t)},traceError:function(t){e.debug&&console.error("[QBWebRTC]:",t)},getLocalTime:function(){var t=new Date().toString().split(" ");return t.slice(1,5).join("-")},isIOS:function(){if(!window||!window.navigator||!window.navigator.userAgent)return!1;var t=window.navigator.userAgent;return!!t.match(/iP(ad|hone)/i)},isIOSSafari:function(){if(!window||!window.navigator||!window.navigator.userAgent)return!1;var t=window.navigator.userAgent,r=!!t.match(/iP(ad|hone)/i),a=!!t.match(/WebKit/i),f=!!t.match(/CriOS/i);return r&&a&&!f},isIOSChrome:function(){if(!window||!window.navigator||!window.navigator.userAgent)return!1;var t=window.navigator.userAgent,r=!!t.match(/iP(ad|hone)/i),a=!!t.match(/WebKit/i),f=!!t.match(/CriOS/i);return r&&!a&&f},getVersionFirefox:function(){var t=navigator?navigator.userAgent:!1,r;if(t){var a=t.match(/(?:firefox)[ \/](\d+)/i)||[];r=a[1]?+a[1]:null}return r},getVersionSafari:function(){var t=navigator?navigator.userAgent:!1,r;if(t){var a=t.match(/(?:safari)[ \/](\d+)/i)||[];if(a.length){var f=t.match(/(?:version)[ \/](\d+)/i)||[];f?r=f[1]?+f[1]:null:r=null}else r=null}return r},delay:function(t){return t=typeof t=="number"&&t>0?t:0,new Promise(function(r){setTimeout(r,t)})},SessionConnectionState:{UNDEFINED:0,CONNECTING:1,CONNECTED:2,FAILED:3,DISCONNECTED:4,CLOSED:5,COMPLETED:6},CallType:{VIDEO:1,AUDIO:2}};return Cn=i,Cn}var En,Or;function Ii(){if(Or)return En;Or=1;var e=Re(),i=Vt(),t=function(s){this._pc=new window.RTCPeerConnection(s),this.remoteStream=void 0,this.preferredCodec="VP8"};t.State={NEW:1,CONNECTING:2,CHECKING:3,CONNECTED:4,DISCONNECTED:5,FAILED:6,CLOSED:7,COMPLETED:8},t.prototype._init=function(n,s,S,l){i.trace("RTCPeerConnection init.","userID: ",s,", sessionID: ",S,", polite: ",l),this.delegate=n,this.localIceCandidates=[],this.remoteIceCandidates=[],this.remoteSDP=void 0,this.sessionID=S,this.polite=l,this.userID=s,this._reconnecting=!1,this.state=t.State.NEW,this._pc.onicecandidate=this.onIceCandidateCallback.bind(this),this._pc.onsignalingstatechange=this.onSignalingStateCallback.bind(this),this._pc.oniceconnectionstatechange=this.onIceConnectionStateCallback.bind(this),this._pc.ontrack=this.onTrackCallback.bind(this),this.dialingTimer=null,this.answerTimeInterval=0,this.statsReportTimer=null},t.prototype.release=function(){this._clearDialingTimer(),this._clearStatsReportTimer(),this._pc.close(),this.state=t.State.CLOSED,this._pc.onicecandidate=null,this._pc.onsignalingstatechange=null,this._pc.oniceconnectionstatechange=null,this._pc.ontrack=null,navigator.userAgent.includes("Edge")&&(this.connectionState="closed",this.iceConnectionState="closed")},t.prototype.negotiate=function(){var n=this;return this.setLocalSessionDescription({type:"offer",options:{iceRestart:!0}},function(s){if(s)return i.traceError("Error in 'negotiate': "+s);var S=n._pc.localDescription.toJSON();n.delegate.update({reason:"reconnect",sessionDescription:{offerId:n.offerId,sdp:S.sdp,type:S.type}},n.userID)})},t.prototype.setRemoteSDP=function(n){if(n)this.remoteSDP=n;else throw new Error("sdp string can't be empty.")},t.prototype.getRemoteSDP=function(){return this.remoteSDP},t.prototype.setLocalSessionDescription=function(n,s){var S=this;S.state=t.State.CONNECTING;var l=window.RTCRtpTransceiver&&"setCodecPreferences"in window.RTCRtpTransceiver.prototype&&!!i.getVersionSafari();
78l&&S._pc.getTransceivers().forEach(function(y){var b=y.sender.track.kind,R=window.RTCRtpSender.getCapabilities(b).codecs,I=window.RTCRtpReceiver.getCapabilities(b).codecs;if(b==="video"){var A=R.findIndex(function(Q){return Q.mimeType.toLowerCase().includes(S.preferredCodec.toLowerCase())});if(A!==-1){var x=R.splice(A,1);R.unshift(x[0])}var M=I.findIndex(function(Q){return Q.mimeType.toLowerCase().includes(S.preferredCodec.toLowerCase())});if(M!==-1){var P=I.splice(M,1);I.unshift(P[0])}var L=R.filter(function(Q){return!Q.mimeType.toLowerCase().includes("h264")}),G=I.filter(function(Q){return!Q.mimeType.toLowerCase().includes("h264")}),$=L.concat(G);y.setCodecPreferences($)}});function m(y){var b=c(y);b.sdp=g(b.sdp,"video",S.preferredCodec),S.delegate.bandwidth&&(b.sdp=u(b.sdp,"video",S.delegate.bandwidth)),S._pc.setLocalDescription(b).then(function(){s(null)}).catch(function(R){i.traceError("Error in 'setLocalSessionDescription': "+R),s(R)})}n.type==="answer"?this._pc.createAnswer(n.options).then(m).catch(s):this._pc.createOffer(n.options).then(m).catch(s)},t.prototype.setRemoteSessionDescription=function(n,s){var S=this.delegate.bandwidth?{type:n.type,sdp:u(n.sdp,"video",this.delegate.bandwidth)}:n;this._pc.setRemoteDescription(S).then(function(){s()}).catch(function(l){i.traceError("Error in 'setRemoteSessionDescription': "+l),s(l)})},t.prototype.addLocalStream=function(n){if(!n)throw new Error("'qbRTCPeerConnection.addLocalStream' error: stream is not defined");var s=this;n.getTracks().forEach(function(S){s._pc.addTrack(S,n)})},t.prototype._addIceCandidate=function(n){return this._pc.addIceCandidate(n).catch(function(s){i.traceError("Error on 'addIceCandidate': "+s)})},t.prototype.addCandidates=function(n){var s=this;n.forEach(function(S){s.remoteIceCandidates.push(S)}),this._pc.remoteDescription&&s.remoteIceCandidates.forEach(function(S){s._addIceCandidate(S)})},t.prototype.toString=function(){return"sessionID: "+this.sessionID+", userID:  "+this.userID+", state: "+this.state},t.prototype.onSignalingStateCallback=function(){if(this._pc.signalingState==="stable"&&this.localIceCandidates.length>0)for(this.delegate.processIceCandidates(this,this.localIceCandidates);this.localIceCandidates.length;)this.localIceCandidates.pop()},t.prototype.onIceCandidateCallback=function(n){if(n.candidate){var s={candidate:n.candidate.candidate,sdpMid:n.candidate.sdpMid,sdpMLineIndex:n.candidate.sdpMLineIndex};this._pc.signalingState==="stable"?this.delegate.processIceCandidates(this,[s]):this.localIceCandidates.push(s)}},t.prototype.onTrackCallback=function(n){this.remoteStream=n.streams[0],typeof this.delegate._onRemoteStreamListener=="function"&&["connected","completed"].includes(this._pc.iceConnectionState)&&this.delegate._onRemoteStreamListener(this.userID,this.remoteStream),this._getStatsWrap()},t.prototype.onIceConnectionStateCallback=function(){i.trace("onIceConnectionStateCallback: "+this._pc.iceConnectionState);var n=null;switch(this._pc.iceConnectionState){case"checking":this.state=t.State.CHECKING,n=i.SessionConnectionState.CONNECTING;break;case"connected":this._reconnecting&&this.delegate._stopReconnectTimer(this.userID),this.state=t.State.CONNECTED,n=i.SessionConnectionState.CONNECTED;break;case"completed":this._reconnecting&&this.delegate._stopReconnectTimer(this.userID),this.state=t.State.COMPLETED,n=i.SessionConnectionState.COMPLETED;break;case"failed":this.delegate._startReconnectTimer(this.userID),this.state=t.State.FAILED,n=i.SessionConnectionState.FAILED;break;case"disconnected":this.delegate._startReconnectTimer(this.userID),this.state=t.State.DISCONNECTED,n=i.SessionConnectionState.DISCONNECTED;break;case"closed":this.delegate._stopReconnectTimer(this.userID),this.state=t.State.CLOSED,n=i.SessionConnectionState.CLOSED;break}typeof this.delegate._onSessionConnectionStateChangedListener=="function"&&n&&this.delegate._onSessionConnectionStateChangedListener(this.userID,n),this._pc.iceConnectionState==="connected"&&typeof this.delegate._onRemoteStreamListener=="function"&&this.delegate._onRemoteStreamListener(this.userID,this.remoteStream)},t.prototype._clearStatsReportTimer=function(){this.statsReportTimer&&(clearInterval(this.statsReportTimer),this.statsReportTimer=null)},t.prototype._getStatsWrap=function(){var n=this,s,S;if(e.webrtc&&e.webrtc.statsReportTimeInterval&&!n.statsReportTimer){if(isNaN(+e.webrtc.statsReportTimeInterval)){i.traceError("statsReportTimeInterval ("+e.webrtc.statsReportTimeInterval+") must be integer.");return}s=e.webrtc.statsReportTimeInterval*1e3;var l=function(){r(n._pc,S,function(m,y){S=y,n.delegate._onCallStatsReport(n.userID,m,null)},function(y){i.traceError("_getStats error. "+y.name+": "+y.message),n.delegate._onCallStatsReport(n.userID,null,y)})};i.trace("Stats tracker has been started."),n.statsReportTimer=setInterval(l,s)}},t.prototype._clearDialingTimer=function(){this.dialingTimer&&(i.trace("_clearDialingTimer"),clearInterval(this.dialingTimer),this.dialingTimer=null,this.answerTimeInterval=0)},t.prototype._startDialingTimer=function(n){var s=this,S=e.webrtc.dialingTimeInterval*1e3;i.trace("_startDialingTimer, dialingTimeInterval: "+S);var l=function(m,y){y||(s.answerTimeInterval+=S),i.trace("_dialingCallback, answerTimeInterval: "+s.answerTimeInterval),s.answerTimeInterval>=e.webrtc.answerTimeInterval*1e3?(s._clearDialingTimer(),s.delegate.processOnNotAnswer(s)):s.delegate.processCall(s,m)};s.dialingTimer=setInterval(l,S,n,!1),l(n,!0)};function r(n,s,S,l){var m={local:{audio:{},video:{},candidate:{}},remote:{audio:{},video:{},candidate:{}}};if(i.getVersionFirefox()){var y=n.getLocalStreams().length?n.getLocalStreams()[0]:n.delegate.localStream,b=y.getVideoTracks().length?y.getVideoTracks()[0].getSettings():null;m.local.video.frameHeight=b&&b.height,m.local.video.frameWidth=b&&b.width}n.getStats(null).then(function(R){R.forEach(function(I){a(m,I,s)}),S(m,R)},l)}function a(n,s,S){var l,m=s.mediaType||s.kind;
78s.bytesReceived&&s.type==="inbound-rtp"?(l=n.remote[m],l?(l.bitrate=f(s,S,!1),l.bytesReceived=s.bytesReceived,l.packetsReceived=s.packetsReceived,l.timestamp=s.timestamp,m==="video"&&s.framerateMean&&(l.framesPerSecond=Math.round(s.framerateMean*10)/10)):i.traceWarning("_getStats: skipping inbound-rtp report with unknown mediaType/kind: "+m)):s.bytesSent&&s.type==="outbound-rtp"?(l=n.local[m],l?(l.bitrate=f(s,S,!0),l.bytesSent=s.bytesSent,l.packetsSent=s.packetsSent,l.timestamp=s.timestamp,m==="video"&&s.framerateMean&&(l.framesPerSecond=Math.round(s.framerateMean*10)/10)):i.traceWarning("_getStats: skipping outbound-rtp report with unknown mediaType/kind: "+m)):s.type==="local-candidate"?(l=n.local.candidate,s.candidateType==="host"&&s.mozLocalTransport==="udp"&&s.transport==="udp"?(l.protocol=s.transport,l.ip=s.ipAddress,l.port=s.portNumber):i.getVersionFirefox()||(l.protocol=s.protocol,l.ip=s.ip,l.port=s.port)):s.type==="remote-candidate"?(l=n.remote.candidate,l.protocol=s.protocol||s.transport,l.ip=s.ip||s.ipAddress,l.port=s.port||s.portNumber):s.type==="track"&&s.kind==="video"&&!i.getVersionFirefox()&&(s.remoteSource?(l=n.remote.video,l.frameHeight=s.frameHeight,l.frameWidth=s.frameWidth,l.framesPerSecond=p(s,S,!1)):(l=n.local.video,l.frameHeight=s.frameHeight,l.frameWidth=s.frameWidth,l.framesPerSecond=p(s,S,!0)))}function f(n,s,S){var l=s&&s.get(n.id),m=l?(n.timestamp-l.timestamp)/1e3:5,y=1024,b=8,R;return l?S?R=b*(n.bytesSent-l.bytesSent)/(y*m):R=b*(n.bytesReceived-l.bytesReceived)/(y*m):R=0,Math.round(R)}function p(n,s,S){var l=s&&s.get(n.id),m=l?(n.timestamp-l.timestamp)/1e3:5,y;return l?S?y=(n.framesSent-l.framesSent)/m:y=(n.framesReceived-l.framesReceived)/m:y=0,Math.round(y*10)/10}function d(n,s,S,l,m,y){if(y===void 0&&(y="asc"),y=y||"asc",y==="asc"){for(var b=S!==-1?S:n.length,R=s;R<b;++R)if(n[R].indexOf(l)===0&&(!m||n[R].toLowerCase().indexOf(m.toLowerCase())!==-1))return R}else for(var I=s!==-1?s:n.length-1,A=I;A>=0;--A)if(n[A].indexOf(l)===0&&(!m||n[A].toLowerCase().indexOf(m.toLowerCase())!==-1))return A;return null}function v(n){var s=new RegExp("a=rtpmap:(\\d+) [a-zA-Z0-9-]+\\/\\d+"),S=n.match(s);return S&&S.length===2?S[1]:null}function T(n,s){var S=n.split(" "),l=S.slice(0,3);l.push(s);for(var m=3;m<S.length;m++)S[m]!==s&&l.push(S[m]);return l.join(" ")}function g(n,s,S){if(!S)return n;var l=n.split(`\r
79`),m=d(l,0,-1,"m=",s);if(m===null)return n;for(var y=null,b=l.length-1;b>=0;--b){var R=d(l,b,0,"a=rtpmap",S,"desc");if(R!==null)b=R,y=v(l[R]),y&&(l[m]=T(l[m],y));else break}return n=l.join(`\r
80`),n}function c(n){return n&&n.sdp&&n.sdp.indexOf(`
81a=extmap-allow-mixed`)!==-1&&(n.sdp=n.sdp.split(`
82`).filter(function(s){return s.trim()!=="a=extmap-allow-mixed"}).join(`
83`)),n}function u(n,s,S){if(!S)return n.replace(/b=AS:.*\r\n/,"").replace(/b=TIAS:.*\r\n/,"");for(var l=n.split(`
84`),m=-1,y=i.getVersionFirefox()?"TIAS":"AS",b=i.getVersionFirefox()?S*1024:S,R=0;R<l.length;R++)if(l[R].indexOf("m="+s)===0){m=R;break}if(m===-1)return n;for(m++;l[m].indexOf("i=")===0||l[m].indexOf("c=")===0;)m++;if(l[m].indexOf("b")===0)return l[m]="b="+y+":"+b,l.join(`
85`);var I=l.slice(0,m);return I.push("b="+y+":"+b),I=I.concat(l.slice(m,l.length)),I.join(`
86`)}return t._applyStatReport=a,En=t,En}var yn,Lr;function zt(){if(Lr)return yn;Lr=1;function e(){}return e.MODULE_ID="WebRTCVideoChat",e.SignalingType={CALL:"call",ACCEPT:"accept",REJECT:"reject",STOP:"hangUp",CANDIDATE:"iceCandidates",PARAMETERS_CHANGED:"update"},yn=e,yn}var Sn,wr;function Ps(){if(wr)return Sn;wr=1;var e=Re(),i=Ii(),t=Oe(),r=Vt(),a=zt(),f=5e3;d.State={NEW:1,ACTIVE:2,HUNGUP:3,REJECTED:4,CLOSED:5};var p={RECONNECTING:"reconnecting",RECONNECTED:"reconnected",FAILED:"failed"};function d(g){this.ID=g.sessionID?g.sessionID:v(),this.state=d.State.NEW,this.initiatorID=parseInt(g.initiatorID),this.opponentsIDs=g.opIDs,this.callType=parseInt(g.callType),this.peerConnections={},this.mediaParams=null,this.iceConnectTimers={},this.reconnectTimers={},this.signalingProvider=g.signalingProvider,this.currentUserID=g.currentUserID,this.bandwidth=g.bandwidth,this.answerTimer=null,this.startCallTime=0,this.acceptCallTime=0,this.localStream=void 0}d.prototype.getUserMedia=function(g,c){if(!navigator.mediaDevices.getUserMedia)throw new Error("getUserMedia() is not supported in your browser");var u=this,n={audio:g.audio||!1,video:g.video||!1};function s(S){u.localStream=S,u.mediaParams=Object.assign({},g),g.elemId&&u.attachMediaStream(g.elemId,S,g.options),c&&typeof c=="function"&&c(void 0,S)}navigator.mediaDevices.getUserMedia(n).then(s).catch(c)},d.prototype.connectionStateForUser=function(g){var c=this.peerConnections[g];return c?c.state:void 0},d.prototype.attachMediaStream=function(g,c,u){var n=document.getElementById(g);if(n)if(n instanceof HTMLMediaElement)"srcObject"in n?n.srcObject=c:n.src=window.URL.createObjectURL(c),u&&u.muted&&(n.muted=!0),u&&u.mirror&&(n.style.transform="scaleX(-1)"),n.autoplay||(n.onloadedmetadata=function(){n.play()});else throw new Error('Cannot attach media stream to element with id "'+g+'" because it is not of type HTMLMediaElement');else throw new Error('Unable to attach media stream, cannot find element by Id "'+g+'"')},d.prototype.detachMediaStream=function(g,c){var u=document.getElementById(g);u&&u instanceof HTMLMediaElement&&(u.pause(),c&&c.stopTracks&&u.srcObject&&typeof u.srcObject=="object"&&u.srcObject.getTracks().forEac
86h(function(n){n.stop(),n.enabled=!1}),u.srcObject=null,u.removeAttribute("src"),u.removeAttribute("srcObject"))},d.prototype.switchMediaTracks=function(g,c){if(!navigator.mediaDevices.getUserMedia)throw new Error("getUserMedia() is not supported in your browser");var u=this;g&&g.audio&&(this.mediaParams.audio.deviceId=g.audio),g&&g.video&&(this.mediaParams.video.deviceId=g.video),this.localStream.getTracks().forEach(function(n){n.stop()}),navigator.mediaDevices.getUserMedia({audio:u.mediaParams.audio||!1,video:u.mediaParams.video||!1}).then(function(n){return u._replaceTracks(n).then(function(){c(null,n)})}).catch(function(n){c(n,null)})},d.prototype.replaceVideoTrack=function(g){var c=this.localStream,u=this.mediaParams.elemId,n=c.getVideoTracks()[0];if(n&&(n.stop(),c.removeTrack(n)),c.addTrack(g),u){var s=document.getElementById(u);s&&s instanceof HTMLMediaElement&&(s.srcObject=c)}function S(l){var m=l.getSenders().find(function(y){return y.track&&y.track.kind==="video"});return m?m.replaceTrack(g):Promise.resolve()}return Promise.all(Object.values(this.peerConnections).map(function(l){return l._pc}).map(S))},d.prototype._replaceTracks=function(g){var c=this.localStream,u=this.mediaParams.elemId,n=g.getTracks();if(n.forEach(function(l){var m=c.getTracks().find(function(y){return y.kind===l.kind});m&&(m.stop(),c.removeTrack(m)),c.addTrack(l)}),u){var s=document.getElementById(u);s&&s instanceof HTMLMediaElement&&(s.srcObject=c)}function S(l){return Promise.all(l.getSenders().filter(function(m){return m.track!==null}).map(function(m){var y=n.find(function(b){return b.kind===m.track.kind});return y?m.replaceTrack(y):Promise.resolve()}))}return Promise.all(Object.values(this.peerConnections).map(function(l){return l._pc}).map(S))},d.prototype.call=function(g,c){var u=this,n=T(g);r.trace("Call, extension: "+JSON.stringify(n.userInfo)),u.state=d.State.ACTIVE,u._reconnectToChat(function(){u.state===d.State.ACTIVE&&u.opponentsIDs.forEach(function(s){u._callInternal(s,n)})}),typeof c=="function"&&c(null)},d.prototype._callInternal=function(g,c){var u=this,n=this._createPeer(g,this.currentUserID<g);this.peerConnections[g]=n,n.addLocalStream(u.localStream),n.setLocalSessionDescription({type:"offer"},function(s){s?r.trace("setLocalSessionDescription error: "+s):(r.trace("setLocalSessionDescription success"),n._startDialingTimer(c))})},d.prototype.accept=function(g){var c=this,u=T(g);if(r.trace("Accept, extension: "+JSON.stringify(u.userInfo)),c.state===d.State.ACTIVE){r.traceError("Can't accept, the session is already active, return.");return}if(c.state===d.State.CLOSED){r.traceError("Can't accept, the session is already closed, return."),c.stop({});return}c.state=d.State.ACTIVE,c.acceptCallTime=new Date,c._clearAnswerTimer(),c._acceptInternal(c.initiatorID,u);var n=c._uniqueOpponentsIDsWithoutInitiator();if(n.length>0){var s=(c.acceptCallTime-c.startCallTime)/1e3;c._startWaitingOfferOrAnswerTimer(s),n.forEach(function(S,l,m){c.currentUserID>S&&c._callInternal(S,{},!0)})}},d.prototype._acceptInternal=function(g,c){var u=this,n=this.peerConnections[g];if(n){var s=n.getRemoteSDP();n.addLocalStream(u.localStream),n.setRemoteSessionDescription(s,function(S){S?r.traceError("'setRemoteSessionDescription' error: "+S):(r.trace("'setRemoteSessionDescription' success"),n.setLocalSessionDescription({type:"answer"},function(l){l?r.trace("setLocalSessionDescription error: "+l):(r.trace("'setLocalSessionDescription' success"),c.sessionID=u.ID,c.callType=u.callType,c.callerID=u.initiatorID,c.opponentsIDs=u.opponentsIDs,n._pc.localDescription&&(c.sdp=n._pc.localDescription.toJSON().sdp),u.signalingProvider.sendMessage(g,c,a.SignalingType.ACCEPT))}))})}else r.traceError("Can't accept the call, peer connection for userID "+g+" was not found")},d.prototype.reject=function(g){var c=this,u=T(g);r.trace("Reject, extension: "+JSON.stringify(u.userInfo)),c.state=d.State.REJECTED,c._clearAnswerTimer(),u.sessionID=c.ID,u.callType=c.callType,u.callerID=c.initiatorID,u.opponentsIDs=c.opponentsIDs,Object.keys(c.peerConnections).forEach(function(n){var s=c.peerConnections[n];c.signalingProvider.sendMessage(s.userID,u,a.SignalingType.REJECT)}),c._close()},d.prototype.stop=function(g){var c=this,u=T(g);r.trace("Stop, extension: "+JSON.stringify(u.userInfo)),c.state=d.State.HUNGUP,c.answerTimer&&c._clearAnswerTimer(),u.sessionID=c.ID,u.callType=c.callType,u.callerID=c.initiatorID,u.opponentsIDs=c.opponentsIDs,Object.keys(c.peerConnections).forEac
86h(function(n){var s=c.peerConnections[n];c.signalingProvider.sendMessage(s.userID,u,a.SignalingType.STOP)}),c._close()},d.prototype.closeConnection=function(g){var c=this,u=this.peerConnections[g];if(!u)return r.traceWarn("Not found connection with user ("+g+")"),!1;try{u.release()}catch(n){r.traceError(n)}finally{c._closeSessionIfAllConnectionsClosed()}},d.prototype.update=function(g,c){var u=this,n=typeof g=="object"?g:{};if(r.trace("Update, extension: "+JSON.stringify(g)),g===null){r.trace("extension is null, no parameters to update");return}if(n.sessionID=this.ID,n.callType=this.callType,n.callerID=this.initiatorID,n.opponentsIDs=this.opponentsIDs,c)u.signalingProvider.sendMessage(c,n,a.SignalingType.PARAMETERS_CHANGED);else for(var s in u.peerConnections){var S=u.peerConnections[s];u.signalingProvider.sendMessage(S.userID,n,a.SignalingType.PARAMETERS_CHANGED)}},d.prototype.mute=function(g){this._muteStream(0,g)},d.prototype.unmute=function(g){this._muteStream(1,g)},d.prototype.processOnCall=function(g,c){var u=this,n=u._uniqueOpponentsIDs();n.forEach(function(s){var S=u.peerConnections[s];S||(S=u._createPeer(s,u.currentUserID<s),u.peerConnections[s]=S,s==g&&u._startAnswerTimer()),s==g&&(S.setRemoteSDP(new window.RTCSessionDescription({sdp:c.sdp,type:"offer"})),g!=u.initiatorID&&u.state===d.State.ACTIVE&&u._acceptInternal(g,{}))})},d.prototype.processOnAccept=function(g,c){var u=this,n=this.peerConnections[g];if(n)if(n._clearDialingTimer(),n._pc.signalingState!=="stable"){var s=new window.RTCSessionDescription({sdp:c.sdp,type:"answer"});n.setRemoteSDP(s),n.setRemoteSessionDescription(s,function(S){S?r.traceError("'setRemoteSessionDescription' error: "+S):(r.trace("'setRemoteSessionDescription' success"),u.state!==d.State.ACTIVE&&(u.state=d.State.ACTIVE))})}else r.traceError("Ignore 'onAccept', PeerConnection is already in 'stable' state");else r.traceError("Ignore 'OnAccept': peer connection for user with Id "+g+" was not found")},d.prototype.processOnReject=function(g,c){var u=this.peerConnections[g];this._clearWaitingOfferOrAnswerTimer(),u?u.release():r.traceError("Ignore 'OnReject', there is no information about peer connection by some reason."),this._closeSessionIfAllConnectionsClosed()},d.prototype.processOnStop=function(g,c){var u=this;this._clearAnswerTimer();var n=u.peerConnections[g];n?(n.release(),n._reconnecting&&(n._reconnecting=!1),this._stopReconnectTimer(g)):r.traceError("Ignore 'OnStop', there is no information about peer connection by some reason."),this._closeSessionIfAllConnectionsClosed()},d.prototype.processOnIceCandidates=function(g,c){var u=this.peerConnections[g];u?u.addCandidates(c.iceCandidates):r.traceError("Ignore 'OnIceCandidates', there is no information about peer connection by some reason.")},d.prototype.processOnUpdate=function(g,c){var u=c.sessionDescription,n=c.reason,s=this.state===d.State.ACTIVE;if(s&&n&&n==="reconnect"){var S=this.peerConnections[g];S?u&&(u.type==="offer"?this._processReconnectOffer(g,u):this._processReconnectAnswer(g,u)):r.traceError("Ignore 'OnUpdate': peer connection for user with Id "+g+" was not found")}},d.prototype._processReconnectOffer=function(g,c){var u=this;if(this.peerConnections[g].polite){this._reconnect(this.peerConnections[g]);var n=this.peerConnections[g],s=c.offerId,S=new window.RTCSessionDescription({sdp:c.sdp,type:c.type});n.setRemoteSDP(S),n.setRemoteSessionDescription(S,function(l){l?r.traceError('"setRemoteSessionDescription" error:'+l.message):n.setLocalSessionDescription({type:"answer"},function(){var m=n._pc.localDescription.toJSON(),y={reason:"reconnect",sessionDescription:{offerId:s,sdp:m.sdp,type:m.type}};u.update(y,g)})})}else this._reconnect(this.peerConnections[g],!0)},d.prototype._processReconnectAnswer=function(g,c){var u=this.peerConnections[g],n=c.offerId;if(u&&u.offerId&&n&&u.offerId===n){var s=new window.RTCSessionDescription({sdp:c.sdp,type:c.type});u.setRemoteSDP(s),u.setRemoteSessionDescription(s,function(S){S&&r.traceError('"setRemoteSessionDescription" error:'+S.message)})}},d.prototype.processCall=function(g,c){var u=c||{};g._pc.localDescription&&(u.sessionID=this.ID,u.callType=this.callType,u.callerID=this.initiatorID,u.opponentsIDs=this.opponentsIDs,u.sdp=g._pc.localDescription.sdp,u.userInfo=c&&c.userInfo?c.userInfo:{},u.userInfo.bandwidth=this.bandwidth,this.signalingProvider.sendMessage(g.userID,u,a.SignalingType.CALL))},d.prototype.processIceCandidates=function(g,c){var u={};u.sessionID=this.ID,u.callType=this.callType,u.callerID=this.initiatorID,u.opponentsIDs=this.opponentsIDs,this.signalingProvider.sendCandidate(g.userID,c,u)},d.prototype.processOnNotAnswer=function(g){r.trace("Answer timeout callback for session "+this.ID+" for user "+g.userID),this._clearWaitingOfferOrAnswerTimer(),g.release(),typeof this.onUserNotAnswerListener=="function"&&t.safeCallbackCall(this.onUserNotAnswerListener,this,g.userID),this._closeSessionIfAllConnectionsClosed()},d.prototype._onRemoteStreamListener=function(g,c){typeof this.onRemoteStreamListener=="function"&&t.safeCallbackCall(this.onRemoteStreamListener,this,g,c)},d.prototype._onCallStatsReport=function(g,c,u){typeof this.onCallStatsReport=="function"&&t.safeCallbackCall(this.onCallStatsReport,this,g,c,u)},d.prototype._onSessionConnectionStateChangedListener=function(g,c){var u=r.SessionConnectionState.CLOSED,n=this.peerConnections[g];typeof this.onSessionConnectionStateChangedListener=="function"&&t.safeCallbackCall(this.onSessionConnectionStateChangedListener,this,g,c),c===u&&n&&(n._pc.onicecandidate=null,n._pc.onsignalingstatechange=null,n._pc.ontrack=null,n._pc.oniceconnectionstatechange=null,delete this.peerConnections[g])},d.prototype._createPeer=function(g,c){if(!window.RTCPeerConnection)throw new Error("_createPeer error: RTCPeerConnection is not supported in your browser");this.startCallTime=new Date;const u={iceServers:e.webrtc.iceServers},n=typeof e.webrtc.iceTransportPolicy>"u"?{}:{iceTransportPolicy:e.webrtc.iceTransportPolicy},s=Object.assign({},u,n);r.trace("_createPeer configuration: "+JSON.stringify(s));var S=new i(s);return S._init(this,g,this.ID,c),S},d.prototype._startReconnectTimer=function(g){var c=this,u=e.webrtc.disconnectTimeInterval*1e3,n=this.peerConnections[g];n._reconnecting=!0;var s=function(){r.trace("disconnectTimeInterval reached for userID "+g),c._stopReconnectTimer(g),c.peerConnections[g].release(),c._onSessionConnectionStateChangedListener(g,r.SessionConnectionState.CLOSED),c._closeSessionIfAllConnectionsClosed()};typeof this.onReconnectListener=="function"&&t.safeCallbackCall(this.onReconnectListener,this,g,p.RECONNECTING),r.trace("_startReconnectTimer for userID:"+g+", timeout: "+u);var S=function(){r.trace("iceConnectTimeout reached for user "+g),c.iceConnectTimers[g]&&(clearTimeout(c.iceConnectTimers[g]),c.iceConnectTimers[g]=void 0,c.reconnectTimers[g]||(c.reconnectTimers[g]=setTimeout(s,u-f),c._reconnectToChat(function(){c.state===d.State.ACTIVE&&c.reconnectTimers[g]&&c._reconnect(n,!0)})))};this.iceConnectTimers[g]||(this.iceConnectTimers[g]=setTimeout(S,f))},d.prototype._stopReconnectTimer=function(g){var c=this.peerConnections[g];if(this.iceConnectTimers[g]&&(clearTimeout(this.iceConnectTimers[g]),this.iceConnectTimers[g]=void 0),this.reconnectTimers[g]&&(r.trace("_stopReconnectTimer for userID: "+g),clearTimeout(this.reconnectTimers[g]),this.reconnectTimers[g]=void 0),c&&c._reconnecting&&(c._reconnecting=!1,typeof this.onReconnectListener=="function")){var u=c._pc.iceConnectionState;t.safeCallbackCall(this.onReconnectListener,this,g,u==="connected"?p.RECONNECTED:p.FAILED)}},d.prototype._reconnectToChat=function(g){var c=this,u=this.signalingProvider,n=function(){var s=u.chat.onReconnectListener;u.chat.onReconnectListener=function(){typeof s=="function"&&s(),u.chat.onReconnectListener=s,g()}
86,u.chat.reconnect()};if(u&&u.chat)try{u.chat.ping(function(s){c.state!==d.State.CLOSED&&(s?n():g())})}catch{c.state!==d.State.CLOSED&&n()}},d.prototype._reconnect=function(g,c){if(!g||!g.userID)return;var u=g.userID,n=g.polite,s=g._reconnecting;g.release();const S={iceServers:e.webrtc.iceServers},l=typeof e.webrtc.iceTransportPolicy>"u"?{}:{iceTransportPolicy:e.webrtc.iceTransportPolicy},m=Object.assign({},S,l);r.trace("_reconnect peer configuration: "+JSON.stringify(m));var y=new i(m);this.peerConnections[u]=y,y._init(this,u,this.ID,n),y._reconnecting=s,y.addLocalStream(this.localStream),c&&(y.offerId=v(),y.negotiate())},d.prototype._close=function(){r.trace("_close");for(var g in this.peerConnections){var c=this.peerConnections[g];this._stopReconnectTimer(c.userID);try{c.release()}catch(u){console.warn("Peer close error:",u)}}this._closeLocalMediaStream(),typeof this._detectSilentAudioTaskCleanup=="function"&&(this._detectSilentAudioTaskCleanup(),this._detectSilentAudioTaskCleanup=void 0),typeof this._detectSilentVideoTaskCleanup=="function"&&(this._detectSilentVideoTaskCleanup(),this._detectSilentVideoTaskCleanup=void 0),this.state=d.State.CLOSED,typeof this.onSessionCloseListener=="function"&&t.safeCallbackCall(this.onSessionCloseListener,this)},d.prototype._closeSessionIfAllConnectionsClosed=function(){var g=Object.values(this.peerConnections).every(function(c){return c.state===i.State.CLOSED});r.trace("All peer connections closed: "+g),g&&(this._closeLocalMediaStream(),typeof this.onSessionCloseListener=="function"&&this.onSessionCloseListener(this),this.state=d.State.CLOSED)},d.prototype._closeLocalMediaStream=function(){this.localStream&&(this.localStream.getTracks().forEach(function(g){g.stop(),g.enabled=!1}),this.localStream=null)},d.prototype._muteStream=function(g,c){if(c==="audio"&&this.localStream.getAudioTracks().length>0){this.localStream.getAudioTracks().forEach(function(u){u.enabled=!!g});return}if(c==="video"&&this.localStream.getVideoTracks().length>0){this.localStream.getVideoTracks().forEach(function(u){u.enabled=!!g});return}},d.prototype._clearAnswerTimer=function(){this.answerTimer&&(r.trace("_clearAnswerTimer"),clearTimeout(this.answerTimer),this.answerTimer=null)},d.prototype._startAnswerTimer=function(){r.trace("_startAnswerTimer");var g=this,c=function(){r.trace("_answerTimeoutCallback"),typeof g.onSessionCloseListener=="function"&&g._close(),g.answerTimer=null},u=e.webrtc.answerTimeInterval*1e3;this.answerTimer=setTimeout(c,u)},d.prototype._clearWaitingOfferOrAnswerTimer=function(){this.waitingOfferOrAnswerTimer&&(r.trace("_clearWaitingOfferOrAnswerTimer"),clearTimeout(this.waitingOfferOrAnswerTimer),this.waitingOfferOrAnswerTimer=null)},d.prototype._startWaitingOfferOrAnswerTimer=function(g){var c=this,u=e.webrtc.answerTimeInterval-g<0?1:e.webrtc.answerTimeInterval-g,n=function(){r.trace("waitingOfferOrAnswerTimeoutCallback"),Object.keys(c.peerConnections).length>0&&Object.keys(c.peerConnections).forEach(function(s){var S=c.peerConnections[s];(S.state===i.State.CONNECTING||S.state===i.State.NEW)&&c.processOnNotAnswer(S)}),c.waitingOfferOrAnswerTimer=null};r.trace("_startWaitingOfferOrAnswerTimer, timeout: "+u),this.waitingOfferOrAnswerTimer=setTimeout(n,u*1e3)},d.prototype._uniqueOpponentsIDs=function(){var g=this,c=[];return this.initiatorID!==this.currentUserID&&c.push(this.initiatorID),this.opponentsIDs.forEach(function(u,n,s){u!=g.currentUserID&&c.push(parseInt(u))}),c},d.prototype._uniqueOpponentsIDsWithoutInitiator=function(){var g=this,c=[];return this.opponentsIDs.forEach(function(u,n,s){u!=g.currentUserID&&c.push(parseInt(u))}),c},d.prototype.toString=function(){return"ID: "+this.ID+", initiatorID:  "+this.initiatorID+", opponentsIDs: "+this.opponentsIDs+", state: "+this.state+", callType: "+this.callType};function v(){var g=new Date().getTime(),c="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(u){var n=(g+Math.random()*16)%16|0;return g=Math.floor(g/16),(u=="x"?n:n&3|8).toString(16)});return c}function T(g){var c={};try{if({}.toString.call(g)==="[object Object]")c.userInfo=g,c=JSON.parse(JSON.stringify(c).replace(/null/g,'""'));else throw new Error('Invalid type of "extension" object.')}catch(u){r.traceWarning(u.message)}return c}return Sn=d,Sn}var Tn,Pr;function Ms(){if(Pr)return Tn;Pr=1;var e;try{e=vt()}catch{e=vt()}var i=e&&(e.Strophe||e.default||e)||void 0;if(!i||!i.Connection)throw new Error("[QBChat] Strophe import failed: Connection class not found");var t=zt();function r(a,f){var p=this;p.service=a,p.delegate=f,this._onMessage=function(d,v,T,g){var c=p._getExtension(v),u=c.sessionID,n=c.signalType;switch(delete c.moduleIdentifier,delete c.sessionID,delete c.signalType,n){case t.SignalingType.CALL:typeof p.delegate._onCallListener=="function"&&p.delegate._onCallListener(g,u,c);break;case t.SignalingType.ACCEPT:typeof p.delegate._onAcceptListener=="function"&&p.delegate._onAcceptListener(g,u,c);break;case t.SignalingType.REJECT:typeof p.delegate._onRejectListener=="function"&&p.delegate._onRejectListener(g,u,c);break;case t.SignalingType.STOP:typeof p.delegate._onStopListener=="function"&&p.delegate._onStopListener(g,u,c);break;case t.SignalingType.CANDIDATE:typeof p.delegate._onIceCandidatesListener=="function"&&p.delegate._onIceCandidatesListener(g,u,c);break;case t.SignalingType.PARAMETERS_CHANGED:typeof p.delegate._onUpdateListener=="function"&&p.delegate._onUpdateListener(g,u,c);break}},this._getExtension=function(d){if(!d)return{};var v={},T=[],g=[];
86return d.childNodes.forEach(function(c){c.nodeName==="iceCandidates"?c.childNodes.forEach(function(u){var n={};u.childNodes.forEach(function(s){n[s.nodeName]=s.textContent}),T.push(n)}):c.nodeName==="opponentsIDs"?c.childNodes.forEach(function(u){var n=u.textContent;g.push(parseInt(n))}):c.childNodes.length>1||c.nodeName==="userInfo"?v=p._XMLtoJS(v,c.nodeName,c):v[c.nodeName]=c.textContent}),T.length>0&&(v.iceCandidates=T),g.length>0&&(v.opponentsIDs=g),v},this._XMLtoJS=function(d,v,T){var g=this;return d[v]={},T.childNodes.forEach(function(c){c.childNodes.length>1?d[v]=g._XMLtoJS(d[v],c.nodeName,c):d[v][c.nodeName]=c.textContent}),d}}return Tn=r,Tn}var _n,Mr;function ks(){if(Mr)return _n;Mr=1;var e;try{e=vt()}catch{e=vt()}var i=e&&(e.Strophe||e.default||e)||void 0;if(!i||!i.Connection)throw new Error("[QBChat] Strophe import failed: Connection class not found");var t=Vt(),r=zt(),a=Oe(),f=Re();function p(d,v){this.service=d,this.chat=v}return p.prototype.sendCandidate=function(d,v,T){var g=T||{};g.iceCandidates=v,this.sendMessage(d,g,r.SignalingType.CANDIDATE)},p.prototype.sendMessage=function(d,v,T){var g=v||{},c=this;g.moduleIdentifier=r.MODULE_ID,g.signalType=T,g.platform="web",g.userInfo&&!Object.keys(g.userInfo).length&&delete g.userInfo;var u={to:t.getUserJid(d,f.creds.appId),type:"headline",id:a.getBsonObjectId()},n=$msg(u).c("extraParams",{xmlns:i.NS.CLIENT});Object.keys(g).forEach(function(s){s==="iceCandidates"?(n.c("iceCandidates"),g[s].forEach(function(S){n.c("iceCandidate"),Object.keys(S).forEach(function(l){n.c(l).t(S[l]).up()}),n.up()}),n.up()):s==="opponentsIDs"?(n.c("opponentsIDs"),g[s].forEach(function(S){n.c("opponentID").t(S).up()}),n.up()):typeof g[s]=="object"?c._JStoXML(s,g[s],n):n.c(s).t(g[s]).up()}),this.chat.connection.send(n)},p.prototype._JStoXML=function(d,v,T){var g=this;T.c(d),Object.keys(v).forEach(function(c){typeof v[c]=="object"?g._JStoXML(c,v[c],T):T.c(c).t(v[c]).up()}),T.up()},_n=p,_n}var bn,kr;function Br(){if(kr)return bn;kr=1;var e=Ps(),i=Ms(),t=ks(),r=Vt(),a=Ii(),f=zt(),p=Oe(),d=Re(),v=[e.State.NEW,e.State.CONNECTING,e.State.ACTIVE];function T(u,n){this.chat=n,this.signalingProcessor=new i(u,this),this.signalingProvider=new t(u,n),n.webrtcSignalingProcessor=this.signalingProcessor,this.SessionConnectionState=r.SessionConnectionState,this.CallType=r.CallType,this.PeerConnectionState=a.State,this.sessions={},navigator.mediaDevices&&"ondevicechange"in navigator.mediaDevices&&(navigator.mediaDevices.ondevicechange=this._onDevicesChangeListener.bind(this))}T.prototype.getMediaDevices=function(u){var n=[],s="Browser does not support output device selection.";return new Promise(function(S,l){!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices?(l(s),r.traceWarning(s)):navigator.mediaDevices.enumerateDevices().then(function(m){u?(m.forEach(function(y,b){y.kind===u&&n.push(y)}),S(n)):S(m)})})},T.prototype.sessions={},T.prototype.createNewSession=function(u,n,s,S){var l=c(this.sessions),m=s||r.getIdFromNode(this.chat.connection.jid),y=S&&S.bandwidth&&!isNaN(S.bandwidth)?+S.bandwidth:0,b=!1,R=n||2;if(!u)throw new Error("Can't create a session without the opponentsIDs.");if(!Array.isArray(u))throw new Error('"opponentsIDs" should be Array of numbers');if(u.forEach(function(I){var A=parseInt(I);if(isNaN(A))throw new Error('"opponentsIDs" should be Array of numbers');I=A}),b=g(l,u),b)throw new Error("Can't create a session with the same opponentsIDs. There is a session already in NEW or ACTIVE state.");return this._createAndStoreSession(null,m,u,R,y)},T.prototype._createAndStoreSession=function(u,n,s,S,l){var m=new e({sessionID:u,initiatorID:n,opIDs:s,callType:S,signalingProvider:this.signalingProvider,currentUserID:r.getIdFromNode(this.chat.connection.jid),bandwidth:l});return m.onUserNotAnswerListener=this.onUserNotAnswerListener,m.onReconnectListener=this.onReconnectListener,m.onRemoteStreamListener=this.onRemoteStreamListener,m.onSessionConnectionStateChangedListener=this.onSessionConnectionStateChangedListener,m.onSessionCloseListener=this.onSessionCloseListener,m.onCallStatsReport=this.onCallStatsReport,this.sessions[m.ID]=m,m},T.prototype.clearSession=function(u){delete T.sessions[u]},T.prototype.isExistLiveSessionExceptSessionID=function(u){var n=!1,s=this.sessions;return Object.keys(s).length>0&&(n=Object.keys(s).some(function(S){var l=s[S],m=v.includes(l.state);return m&&l.ID!==u})),n},T.prototype.getNewSessionsCount=function(u){var n=this.sessions;return Object.keys(n).reduce(function(s,S){var l=n[S];if(l.ID===u)return s;var m=l.state===e.State.NEW;return m?s+1:s},0)},T.prototype._onCallListener=function(u,n,s){var S=s.userInfo||{},l=r.getIdFromNode(this.chat.connection.jid);if(u===l&&!s.opponentsIDs.includes(l)){r.trace('Ignore "onCall" signal from current user. userID:'+u+", sessionID: "+n);return}r.trace("onCall. UserID:"+u+". SessionID: "+n);var m=this.isExistLiveSessionExceptSessionID(n),y=this.getNewSessionsCount(n);m&&!this.sessions[n]&&y++;var b=m&&(d.webrtc.autoReject||y>d.webrtc.incomingLimit);
86if(b)r.trace("User with id "+u+" is busy at the moment."),delete s.sessionDescription,delete s.platform,s.sessionID=n,this.signalingProvider.sendMessage(u,s,f.SignalingType.REJECT),typeof this.onInvalidEventsListener=="function"&&p.safeCallbackCall(this.onInvalidEventsListener,"onCall",n,u,S);else{var R=this.sessions[n],I=+S.bandwidth||0;R||(R=this._createAndStoreSession(n,s.callerID,s.opponentsIDs,s.callType,I),typeof this.onCallListener=="function"&&p.safeCallbackCall(this.onCallListener,R,S)),R.processOnCall(u,s)}},T.prototype._onAcceptListener=function(u,n,s){var S=this.sessions[n],l=s.userInfo||{};r.trace("onAccept. UserID:"+u+". SessionID: "+n),S?S.state===e.State.CONNECTING||S.state===e.State.ACTIVE?(typeof this.onAcceptCallListener=="function"&&p.safeCallbackCall(this.onAcceptCallListener,S,u,l),S.processOnAccept(u,s)):(typeof this.onInvalidEventsListener=="function"&&p.safeCallbackCall(this.onInvalidEventsListener,"onAccept",S,u,l),r.traceWarning("Ignore 'onAccept', the session( "+n+" ) has invalid state.")):r.traceError("Ignore 'onAccept', there is no information about session "+n+" by some reason.")},T.prototype._onRejectListener=function(u,n,s){var S=this,l=S.sessions[n];if(r.trace("onReject. UserID:"+u+". SessionID: "+n),l){var m=s.userInfo||{};typeof this.onRejectCallListener=="function"&&p.safeCallbackCall(S.onRejectCallListener,l,u,m),l.processOnReject(u,s)}else r.traceError("Ignore 'onReject', there is no information about session "+n+" by some reason.")},T.prototype._onStopListener=function(u,n,s){r.trace("onStop. UserID:"+u+". SessionID: "+n);var S=this.sessions[n],l=s.userInfo||{};S&&v.includes(S.state)?(typeof this.onStopCallListener=="function"&&p.safeCallbackCall(this.onStopCallListener,S,u,l),setTimeout(S.processOnStop.bind(S),10,u,s)):(typeof this.onInvalidEventsListener=="function"&&p.safeCallbackCall(this.onInvalidEventsListener,"onStop",S,u,l),r.traceError("Ignore 'onStop', there is no information about session "+n+" by some reason."))},T.prototype._onIceCandidatesListener=function(u,n,s){var S=this.sessions[n];r.trace("onIceCandidates. UserID:"+u+". SessionID: "+n+". ICE candidates count: "+s.iceCandidates.length),S?S.state===e.State.CONNECTING||S.state===e.State.ACTIVE?S.processOnIceCandidates(u,s):r.traceWarning("Ignore 'OnIceCandidates', the session ( "+n+" ) has invalid state."):r.traceError("Ignore 'OnIceCandidates', there is no information about session "+n+" by some reason.")},T.prototype._onUpdateListener=function(u,n,s){var S=this.sessions[n],l=s.userInfo||{};r.trace("onUpdate. UserID:"+u+". SessionID: "+n+". Extension: "+JSON.stringify(l)),S&&(s.reason&&S.processOnUpdate(u,s),typeof this.onUpdateCallListener=="function"&&p.safeCallbackCall(this.onUpdateCallListener,S,u,l))},T.prototype._onDevicesChangeListener=function(){typeof this.onDevicesChangeListener=="function"&&p.safeCallbackCall(this.onDevicesChangeListener)},bn=T;function g(u,n){var s=!1,S=n.sort();return u.length&&u.forEach(function(l){var m=l.sort();s=m.length==S.length&&m.every(function(y,b){return y===S[b]})}),s}function c(u){var n=[];return Object.keys(u).length>0&&Object.keys(u).forEach(function(s,S,l){var m=u[s];(m.state===e.State.NEW||m.state===e.State.ACTIVE)&&n.push(m.opponentsIDs)}),n}return bn}var Dn,qr;function Bs(){if(qr)return Dn;qr=1;var e=Re(),i=Oe();function t(){}t.prototype={version:e.version,buildNumber:e.buildNumber,_getOS:i.getOS.bind(i),init:function(a,f,p,d,v){console.log("current platform: ",i.getEnv()),typeof d=="string"&&d.length?(v&&typeof v=="object"&&e.set(v),e.creds.accountKey=d):(console.warn('Parameter "accountKey" is missing. This will lead to error in next major release'),console.warn('NOTE: Account migration will not work without "accountKey"'),typeof d=="object"&&e.set(d));var T="api.quickblox.com",g="chat.quickblox.com",c=Ji(),u=ss(),n=os(),s=as(),S=us(),l=cs(),m=ls(),y=Cs(),b=Es(),R=ys(),I=Ss();if(this.service=new c,this.auth=new u(this.service),this.users=new n(this.service),this.content=new s(this.service),this.pushnotifications=new S(this.service),this.data=new l(this.service),this.addressbook=new m(this.service),this.chat=new y(this.service),this.chat.dialog=new b(this.service),this.chat.message=new R(this.service),this.ai=new I(this.service),i.getEnv().browser)if(i.isWebRTCAvailble()){var A=Br();this.webrtc=new A(this.service,this.chat)}else this.webrtc=!1;else this.webrtc=!1;
86this._initReady=Promise.resolve();var x=typeof e.initBlockOnSettings=="boolean"?e.initBlockOnSettings:!0,M=typeof e.initBlockDurationMs=="number"?e.initBlockDurationMs:3e3;typeof a=="string"&&(!f||typeof f=="number")&&!p?(typeof f=="number"&&(e.creds.appId=f),this.service.setSession({token:a})):(e.creds.appId=a,e.creds.authKey=f,e.creds.authSecret=p);var P=e.creds.accountKey&&(!e.endpoints.api||e.endpoints.api===T||!e.endpoints.chat||e.endpoints.chat===g);if(P){var L=["https://",T,"/",e.urls.account,e.urls.type].join(""),G=function(w){var B={};return w&&Object.keys(w).forEach(function(U){/^on[A-Z]/.test(U)&&typeof w[U]=="function"&&(B[U]=w[U])}),B},$=function(w,B){!w||!B||Object.keys(B).forEach(function(U){w[U]=B[U]})},Q=this;this._initReady=new Promise(function(w){Q.service.ajax({url:L},function(B,U){if(!B&&typeof U=="object"){var F={endpoints:{api:U.api_endpoint.replace(/^https?:\/\//,""),chat:U.chat_endpoint}};e.set(F);var V=G(Q.chat),H=G(Q.webrtc);if(Q.pushnotifications=new S(Q.service),Q.chat=new y(Q.service),Q.chat.dialog=new b(Q.service),Q.chat.message=new R(Q.service),i.getEnv().browser)if(i.isWebRTCAvailble()){var z=Br();Q.webrtc=new z(Q.service,Q.chat)}else Q.webrtc=!1;else Q.webrtc=!1;$(Q.chat,V),$(Q.webrtc,H)}w()})})}if(P&&x)try{for(var W=Date.now()+M;Date.now()<W;);}catch{}},ready:function(){return this._initReady||Promise.resolve()},initWithAppId:function(a,f,p){if(typeof a!="number")throw new Error("Type of appId must be a number");if(a===""||a===void 0||a===null||f===""||f===void 0||f===null)throw new Error("Cannot init QuickBlox without app credentials (app ID, auth key)");this.init("",a,null,f,p)},getSession:function(a){this.auth.getSession(a)},startSessionWithToken:function(a,f){if(a===void 0)throw new Error("Cannot start session with undefined token");if(a==="")throw new Error("Cannot start session with empty string token");if(a===null)throw new Error("Cannot start session with null value token");if(typeof f!="function")throw new Error("Cannot start session without callback function");try{this.service.setSession({token:a})}catch(p){f(p,null)}if(typeof f=="function")try{this.auth.getSession(f)}catch(p){f(p,null)}},createSession:function(a,f){this.auth.createSession(a,f)},destroySession:function(a){this.auth.destroySession(a)},login:function(a,f){this.auth.login(a,f)},logout:function(a){this.auth.logout(a)}};var r=new t;return r.QuickBlox=t,Dn=r,Dn}var qs=Bs();class Fr{quickblox;configuration;currentDialog=null;listeners={};constructor(i){this.configuration=i,this.quickblox=new qs.QuickBlox,this.quickblox.init(i.sessionToken,i.applicationId,null,i.accountKey,{endpoints:i.endpoints})}connect(){const i={jid:this.quickblox.chat.helpers.getUserJid(this.configuration.userId,this.configuration.applicationId),password:this.configuration.password};return this.quickblox.chat.isConnected?(console.info("Quickblox already connected"),Promise.resolve()):new Promise((t,r)=>{this.quickblox.chat.connect(i,(a,f)=>{if(a)return r(a);t(f)})})}disconnect(){return new Promise(i=>{console.info("Quickblox disconnecting..."),this.quickblox.chat.onDisconnectedListener=()=>{console.info("Quickblox disconnected"),i()},this.quickblox.chat.disconnect()})}isQBError(i){return!(i===null||i!==null&&typeof i=="object"&&"isConnected"in i&&i.isConnected)}async joinDialog(i){if(this.currentDialog?._id===i)return Promise.resolve(!0);const t=await this.getDialog(i);return new Promise((r,a)=>{this.quickblox.chat.muc.join(t.xmpp_room_jid,f=>{this.isQBError(f)&&a(f),this.currentDialog=t,r(!0)})})}leaveDialog(i){const t=this.quickblox.chat.helpers.getRoomJidFromDialogId(i);return new Promise((r,a)=>{this.quickblox.chat.muc.leave(t,f=>{if(f)return a(f);this.currentDialog=null,r(!0)})})}getDialog(i){return this.currentDialog?._id===i?Promise.resolve(this.currentDialog):new Promise((t,r)=>{this.quickblox.chat.dialog.list({_id:i},(a,f)=>{if(a)return r(a);if(f.items.length===0)return r(new Error("no dialogs found"));t(f.items[0])})})}async getDialogUsers(i){const r={filter:{field:"id",param:"in",value:(await this.getDialog(i)).occupants_ids}};return new Promise((a,f)=>{this.quickblox.users.listUsers(r,function(p,d){if(p)return f(p);const v={};for(const T of d.items)v[T.id]=T;a(v)})})}sendMessage(i,t){if(!this.currentDialog)throw new Error("You have not joined a dialog yet");const r={type:"groupchat",body:i,extension:{save_to_history:1,author_type:"client",dialog_id:this.currentDialog._id},markable:1},a=this.currentDialog.xmpp_room_jid;return new Promise((f,p)=>{t?this.uploadAttachment(t).then(d=>{r.extension.attachments=[d],this.quickblox.chat.send(a,r),f(!0)}).catch(d=>p(d)):(this.quickblox.chat.send(a,r),f(!0))})}uploadAttachment(i){return new Promise((t,r)=>{const a={name:i.name,file:i,type:i.type,size:i.size,public:!1};this.quickblox.content.createAndUpload(a,(f,p)=>
86{if(f)return r(f);t({id:p.id,type:i.type})})})}getContent(i){return new Promise((t,r)=>{this.quickblox.content.getInfo(Number(i),(a,f)=>{if(a)return r(a);const p=f.blob;p.url=this.quickblox.content.publicUrl(i)+"/download?token="+this.configuration.sessionToken,t(p)})})}getMessages(i,t=1,r=100){return new Promise((a,f)=>{const p={chat_dialog_id:i,sort_desc:"date_sent",limit:r,skip:(t-1)*r};this.quickblox.chat.message.list(p,(d,v)=>{if(d)return f(d);a({page:t,nextPage:v.items.length<r?null:t+1,messages:v.items})})})}onMessageListener(i){this.quickblox.chat.onMessageListener=this.onMessageMiddleware(i)}onSystemMessageListener(i){this.quickblox.chat.onSystemMessageListener=i}onMessageTypingListener(i){this.quickblox.chat.onMessageTypingListener=i}onReconnectFailedListener(i){this.quickblox.chat.onReconnectFailedListener=i}onDeliveredStatusListener(i){this.quickblox.chat.onDeliveredStatusListener=i}onReadStatusListener(i){this.quickblox.chat.onReadStatusListener=i}onKickOccupantListener(i){this.quickblox.chat.onKickOccupant=i}onOnline(i){window.addEventListener("online",i)}onOffline(i){window.addEventListener("offline",i)}static createMessageFromEvent(i,t){if(!t.id)throw new Error("message ID must be defined");return{_id:t.id,message:t.body,author_type:t.extension.author_type,sender_id:i,status:Qr,attachments:t.extension.attachments}}addAMOSChatMessageEventListener=(i,t)=>{this.listeners[i]=t};onAMOSChatMessageEvent=(i,t,r)=>{typeof this.listeners[i]<"u"&&this.listeners[i](t,r)};onMessageMiddleware=i=>(t,r)=>{r.extension.author_type==="system"&&r.extension.message_type&&this.onAMOSChatMessageEvent(r.extension.message_type,t,r),i(t,r)}}const{client:Fs}=Ui(),Us=async()=>(await Fs.get("/clients-me/get-quick-blox-data")).data.data,An=e=>{const i={};for(const t of e)i[t._id]=t;return i},Rn=e=>{if(e.length===0)return[];const i=[];let t=null;for(const r of e){const a=r.author_type;t||(t={type:a,messages:[]}),a!==t.type&&(i.push(t),t={type:a,messages:[]}),t.messages.push(r)}return t!==null&&i.push(t),i},js=(e,i)=>{const t=e.author_type,r=[...i.groups];r.length>0&&r[r.length-1].type===t&&r[r.length-1].messages.slice(-1)[0]._id!==e._id&&r[r.length-1].messages.push(e),(r.length===0||r[r.length-1].type!==t)&&r.push({type:t,messages:[e]});const a={...i.messages};return a[e._id]=e,[a,r]},xi=e=>i=>{const t=e[i];return typeof t>"u"?null:t},Oi=e=>i=>{const t=e[i];return typeof t>"u"?null:t.status?t.status:"delivered"},lt={messagesState:{messages:{},groups:[],loading:!0,nextPage:null},loading:!0,error:null,typingUserId:null,online:!0,sendMessage:(e,i)=>Promise.resolve(!1),getUser:xi({}),getMessageStatus:Oi({}),getContent:(e,i)=>Promise.reject(new Error("not initialized")),loadMore:()=>Promise.resolve(!1),usersState:{currentUserId:null,users:{}},chatClosed:!1},Li=Hr.createContext(lt),Hs=({consultationId:e,dialogId:i,children:t,consultationStatus:r,chatEnded:a,messagesPerPage:f,maxUploadSize:p})=>{const[d,v]=ne.useState(lt.messagesState),[T,g]=ne.useState(lt.loading),[c,u]=ne.useState(lt.online),[n,s]=ne.useState(lt.error),[S,l]=ne.useState(lt.typingUserId),[m,y]=ne.useState(lt.usersState),[b,R]=ne.useState(a||r==="canceled"||r==="done"||r==="closed"),[I,A]=ne.useState(r==="canceled"||r==="done"||r==="closed"),x=qn({queryKey:["quickblox-credentials"],queryFn:Us,enabled:!I});ne.useEffect(()=>{x.isError&&(g(!1),s(x.error.message))},[x.error,x.isError]);const{data:M}=x,{data:P}=qn({queryKey:["amos-chat-messages",e,1],queryFn:()=>Fn(e,1),enabled:I,gcTime:0}),L=ne.useRef(null),G=ne.useRef(new Audio("/audio/music_marimba_chord.mp3")),$=ne.useRef(new Audio("/audio/beep_short_on.mp3")),Q=ne.useRef(new Audio("/audio/beep_short_off.mp3")),W=ne.useCallback((ae,le)=>{v(te=>{const J=Fr.createMessageFromEvent(ae,le);J.sender_id!==m.currentUserId&&document.hidden&&G.current.play();const[ce,ye]=js(J,te);return{messages:ce,groups:ye,loading:!1,nextPage:te.nextPage}})},[m.currentUserId]),w=ne.useCallback((ae,le)=>{l(ae?le:null)},[]),B=ne.useCallback(ae=>{v(le=>{const te={...le.messages},J=te[ae];return typeof J>"u"?le:(J.status=Bi,{messages:te,groups:[...le.groups],loading:!1,nextPage:le.nextPage})})},[]),U=ne.useCallback(ae=>{W(null,ae)},[W]),F=ne.useCallback(()=>{u(!1)},[]),V=ne.useCallback(()=>{u(!0)},[]),H=ne.useCallback(()=>
86{s("Error while trying to reconnect")},[]),z=ne.useCallback(()=>{Q.current.play(),R(!0)},[]),re=ne.useCallback(()=>{Q.current.play(),A(!0),R(!0)},[]),Y=ne.useCallback(()=>{$.current.play(),R(!1)},[]);ne.useEffect(()=>{const ae=te=>{te.onMessageListener(W),te.onMessageTypingListener(w),te.onDeliveredStatusListener(B),te.onSystemMessageListener(U),te.onReconnectFailedListener(H),te.onOffline(F),te.onOnline(V),te.onKickOccupantListener(z),te.addAMOSChatMessageEventListener("dialog_completed",z),te.addAMOSChatMessageEventListener("dialog_canceled",z),te.addAMOSChatMessageEventListener("dialog_closed",z),te.addAMOSChatMessageEventListener("dialog_assigned",Y)},le=async te=>{const J=new Fr(te),ce=te.userId;L.current=J,ae(J),await J.connect(),a||await J.joinDialog(i);const ye=await J.getMessages(i,1,f),fe=[...ye.messages].reverse(),ve=ye.nextPage;y({currentUserId:ce,users:{}}),v({messages:An(fe),groups:Rn(fe),loading:!1,nextPage:ve}),g(!1)};M&&!L.current&&le(M).catch(te=>{te?.code!==422&&Mn.error(te)}),!I&&L.current&&(ae(L.current),g(!1))},[b,a,I,e,r,i,Y,z,re,B,W,U,F,V,H,w,f,M]),ne.useEffect(()=>{if(P){const ae=P.messages.reverse(),le=P.nextPage;v({messages:An(ae),groups:Rn(ae),nextPage:le,loading:!1}),g(!1)}},[P,I,e,f]),ne.useEffect(()=>()=>{L.current&&(L.current.disconnect(),L.current=null)},[]);const X=(ae,le)=>L.current?L.current.sendMessage(ae,le):(s("no instance created"),Promise.reject(new Error("no instance created"))),K=ne.useCallback(ae=>xi(m.users)(ae),[m.users]),ee=ne.useCallback(ae=>Oi(d.messages)(ae),[d.messages]),oe=ne.useCallback((ae,le="filename")=>{if(I){const te=le??"filename";return ji({fileUUID:ae,fileName:te}).then(J=>({url:J,name:te}))}return L.current?L.current.getContent(ae).then(te=>({name:te.name,url:`/download/quickblox?contentUrl=${btoa(te.url)}`})):Promise.reject(new Error("no instance created"))},[I]),Ce=ne.useCallback(()=>{const ae=d.nextPage;if(!ae)return Promise.resolve(!1);if(!I&&!L.current)return s("no instance created"),Promise.reject(new Error("no instance created"));const le=!I&&L.current?L.current.getMessages(i,ae,f):Fn(e,ae);return v(te=>({...te,loading:!0})),le.then(te=>{v(J=>{if(te===null)return J;const ce=te.messages.reverse().concat(Object.values(J.messages));return{messages:An(ce),groups:Rn(ce),loading:!1,nextPage:te.nextPage}})}).catch(()=>{v(te=>({...te,loading:!1}))})},[I,e,i,f,d.nextPage]);return se.jsx(Li.Provider,{value:{messagesState:d,loading:T,error:n,typingUserId:S,online:c,sendMessage:X,usersState:m,getUser:K,getMessageStatus:ee,getContent:oe,loadMore:Ce,chatClosed:b,maxUploadSize:p},children:t})};function yt(){return ne.useContext(Li)}function Bn(){return se.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",className:"",children:se.jsx("path",{fill:"#b1b3b3",d:"M14.964 15.01c-.03 2.75-2.259 4.98-4.999 4.99-2.738.01-4.952-2.205-4.963-4.954H5l.035-10.022.005-1.253C5.047 1.696 6.726.007 8.79 0a3.716 3.716 0 0 1 3.724 3.745l-.095 10.99h-.004a2.48 2.48 0 0 1-2.45 2.43 2.408 2.408 0 0 1-2.421-2.4h-.005l.009-1.226.037-6.134 1.22-.007-.045 7.36a1.205 1.205 0 0 0 1.212 1.219 1.242 1.242 0 0 0 1.227-1.235l.069-10.993h-.003l.003-.039a2.477 2.477 0 0 0-2.483-2.496 2.52 2.52 0 0 0-2.5 2.514l.003.04h-.002L6.28 5.02l-.035 10.022a3.716 3.716 0 0 0 3.724 3.745c2.064-.008 3.743-1.696 3.75-3.771l.03-8.77.005-1.252L15 4.99l-.004 1.253-.03 8.768h-.002z"})})}const Qs=({onFileChange:e,disabled:i})=>{const{t}=Nt(),r=ne.useRef(null),a=ne.useCallback(({target:p})=>{if(!p.files)return;const d=p.files[0];if(qi.indexOf(d.type)===-1){alert(t("chat.file_type_not_allowed"));return}e(d)},[e,t]),f=ne.useCallback(()=>{r.current?.click()},[]);return se.jsxs("button",{className:"attachment",onClick:f,disabled:i,children:[se.jsx(Bn,{}),se.jsx("input",{ref:r,type:"file",accept:Fi.join(","),onChange:a,style:{display:"none"}})]})},Gs=({file:e,onRemoveFile:i,disabled:t})=>{const r=ne.useCallback(()=>{t||i()},[i,t]);return se.jsxs("div",{className:"o-chat__attachedFile",style:{color:t?"#ddd":""},children:[se.jsx(Bn,{}),e.name,se.jsx("span",{className:"o-grid__span--grow"}),se.jsx("div",{onClick:r,children:se.jsx(Qi,{})})]})};function Vs(){return se.jsx("svg",{width:"25",height:"25",viewBox:"0 0 20 19",fill:"none",className:"",children:se.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1.42578 17V11.18L13.8939 9.5L1.42578 7.82V2L18.8319 9.5L1.42578 17Z",fill:"white"})})}const zs=({onClick:e,disabled:i,loading:t})=>se.jsx("button",{className:"sendChat",onClick:e,disabled:i||t,children:t?se.jsx("div",{style:{marginLeft:"-21px",marginTop:"-8px",position:"relative"},children:se.jsx("div",{className:"m-loading__spinner",style:{width:40,height:40}})}):se.jsx(Vs,{})}),Nn=e=>!e||/^\s*$/.test(e),Js=({disabled:e})=>{const{sendMessage:i,maxUploadSize:t}=yt(),[r,a]=ne.useState(""),[f,p]=ne.useState(null),[d,v]=ne.useState(!1),T=ne.useRef(null),{t:g}=Nt(),c=ne.useCallback(({target:l})=>{a(l.value)},[]),u=ne.useCallback(l=>{if(T.current?.focus(),t&&l.size>t){alert(g("validation.files.too_large"));return}p(l)},[t,g]),n=ne.useCallback(()=>
86{if(Nn(r)&&!f)return;v(!0);const l=Nn(r)&&f?f.name:r.replace(/\n$/,"");i(l,f).catch(m=>{Mn.error(m)}).finally(()=>{p(null),a(""),v(!1),setTimeout(()=>T.current?.focus(),500)})},[f,r,i]),s=ne.useCallback(l=>{!l.shiftKey&&!l.ctrlKey&&l.keyCode===13&&n(),l.ctrlKey&&l.keyCode===13&&a(m=>m+`
87`)},[n]),S=ne.useCallback(()=>{p(null)},[]);return se.jsxs("div",{className:"o-chat__write",children:[se.jsxs("div",{className:"o-chat__textareaCont",children:[se.jsx("textarea",{ref:T,className:"a-textarea",name:"name",rows:5,cols:80,placeholder:g("chat.write_here"),value:r,onChange:c,onKeyUp:s,disabled:d||e}),f&&se.jsx(Gs,{file:f,onRemoveFile:S,disabled:d||e})]}),se.jsxs("div",{className:"o-chat__buttonsArea",children:[!f&&se.jsx(Qs,{onFileChange:u,disabled:d||e}),se.jsx(zs,{onClick:n,disabled:Nn(r)&&!f||e,loading:d})]})]})};function wi(e,i={delayActivation:200}){const t=ne.useRef(void 0),r=ne.useRef(void 0),a=ne.useRef(0),f=ne.useCallback(d=>{const v=d[0];if(!v.isIntersecting||v.boundingClientRect.y<a.current)return;a.current=v.boundingClientRect.y;const g=e(),c=i.scrollParentAfterCallback;typeof g<"u"&&c&&Promise.resolve(g).then(()=>{r.current?.parentElement?.scroll(0,c)})},[e,i.scrollParentAfterCallback]);return[ne.useCallback(d=>{if(!d||(t.current&&t.current.unobserve(d),i.disabled))return;const v={root:d.parentElement,rootMargin:"0px",threshold:1,...i};t.current=new IntersectionObserver(f,v),setTimeout(()=>{t.current&&t.current.observe(d)},i.delayActivation),r.current=d},[f,i])]}const Ws=({disabled:e=!1,containerRef:i,parentRef:t})=>{const r=ne.useRef(!0),a=ne.useRef(null),f=ne.useCallback(p=>{i&&i(p),a.current=p},[i]);return ne.useEffect(()=>{if(e)return;const p={left:0,top:t.current?.scrollHeight};r.current||(p.behavior="smooth"),r.current=!1,t.current?.scrollTo(p)}),se.jsx("div",{ref:f,style:Xs})},Xs={height:5},$s=({onLoadMore:e,disabled:i})=>{const{t}=Nt(),{messagesState:{loading:r},loadMore:a}=yt(),f=ne.useCallback(()=>{if(!r)return e&&e(),a()},[a,r,e]),[p]=wi(f,{scrollParentAfterCallback:Ur.height});return i?null:se.jsx("div",{ref:p,style:Ur,children:r?t("common.loading"):" "})},Ur={height:30,textAlign:"center"},Ks=e=>e?se.jsx(se.Fragment,{children:e.split(`
88`).map((i,t)=>se.jsx("div",{children:i},t))}):se.jsx("div",{children:" "}),Ys=({message:e,status:i,attachmentId:t,attachmentName:r})=>{const[a,f]=ne.useState(null),{getContent:p}=yt(),{t:d}=Nt();return ne.useEffect(()=>{let v=!0;return t&&p(t,r).then(T=>{v&&T&&f(T)}).catch(T=>{Mn.error(T)}),()=>{v=!1}},[t,r,p]),se.jsxs("div",{className:`m-chat-bubble ${i==="typing"?"writingBubble":""} status-${i??""}`,children:[Ks(e),t&&se.jsxs("div",{className:"m-chat__attachedFile",children:[se.jsx(Bn,{}),a?se.jsx("a",{href:a.url,className:"a-text-link",download:a.name,children:a.name}):d("common.loading")]})]})},Zs=Hr.memo(Ys),eo=e=>`o-chat-block ${e.type==="client"?"user":e.type}Block`;function to({group:e}){const{getMessageStatus:i}=yt();return se.jsx("div",{className:eo(e),children:e.messages.map(t=>{const r=t.attachments&&t.attachments.length>0?t.attachments[0]:null;return se.jsx(Zs,{message:t.message,status:i(t._id),attachmentId:r?.id,attachmentName:r?.name},t._id)})})}const no=({getUser:e,t:i})=>(t,r)=>{const a=t.length-1,f=e(r),p=f?f.full_name:"",d={_id:String(new Date().getTime()),sender_id:r,author_type:"doctor",message:i("chat.is_writting",{name:p}),status:Qr};t[a].type==="doctor"&&(t[a]={type:"doctor",messages:[...t[a].messages,d]}),t[a].type!=="doctor"&&t.push({type:"doctor",messages:[d]})};function ro(){const[e,i]=ne.useState(!1),{messagesState:{groups:t,nextPage:r},typingUserId:a,getUser:f}=yt(),p=ne.useRef(null),{t:d}=Nt(),v=ne.useCallback(()=>{i(!0)},[i]),T=ne.useCallback(()=>{i(!1)},[]),[g]=wi(T,{root:null});return a&&no({getUser:f,t:d})(t,a),se.jsxs("div",{className:"o-chat__window",ref:p,children:[se.jsx($s,{onLoadMore:v,disabled:!r}),t.map((c,u)=>se.jsx(to,{group:c},u)),se.jsx(Ws,{disabled:e,containerRef:g,parentRef:p})]})}const io=()=>{const{loading:e,usersState:i,error:t,chatClosed:r}=yt();return t?se.jsx(Hi,{error:t,userId:i.currentUserId}):se.jsxs("div",{className:"o-chat-wrapper",children:[e?se.jsx("div",{className:"o-chat__window",children:se.jsx(Mi,{})}):se.jsx(ro,{}),se.jsx(Js,{disabled:r||e||!!t})]})},Do=({dialogId:e,consultationId:i,consultationStatus:t,chatEnded:r,messagesPerPage:a,maxUploadSize:f})=>se.jsx(Hs,{dialogId:e,consultationId:i,consultationStatus:t,chatEnded:r,messagesPerPage:a,maxUploadSize:f,children:se.jsx(io,{})});
88export{Do as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.