@dao42/d42paas-front 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/1569.js +2 -2
- package/dist/1585.js +2 -2
- package/dist/1593.js +2 -2
- package/dist/1594.js +2 -2
- package/dist/162.js +2 -2
- package/dist/1649.js +2 -2
- package/dist/17.js +168 -0
- package/dist/1941.js +2 -2
- package/dist/2014.js +2 -2
- package/dist/2088.js +2 -2
- package/dist/2235.js +247 -247
- package/dist/2271.js +2 -2
- package/dist/2287.js +3 -3
- package/dist/2388.js +2 -2
- package/dist/2583.js +2 -2
- package/dist/2862.js +2 -2
- package/dist/2906.js +2 -2
- package/dist/300.js +2 -2
- package/dist/3008.js +2 -2
- package/dist/317.js +7 -7
- package/dist/3315.js +2 -2
- package/dist/3399.js +2 -2
- package/dist/3504.js +2 -2
- package/dist/3553.js +2 -2
- package/dist/3673.js +2 -2
- package/dist/3780.js +3 -3
- package/dist/3855.js +2 -2
- package/dist/4035.js +3 -3
- package/dist/4073.js +2 -2
- package/dist/4246.js +5 -5
- package/dist/4289.js +171 -0
- package/dist/4366.js +4 -4
- package/dist/4369.js +2 -2
- package/dist/4454.js +2 -2
- package/dist/4511.js +2 -2
- package/dist/4558.js +2 -2
- package/dist/4610.js +2 -2
- package/dist/471.js +2 -2
- package/dist/4858.js +3 -3
- package/dist/4896.js +2 -2
- package/dist/491.js +2 -2
- package/dist/5257.js +2 -2
- package/dist/5454.js +2 -2
- package/dist/5524.js +2 -2
- package/dist/5669.js +2 -2
- package/dist/5881.js +2 -2
- package/dist/5900.js +2 -2
- package/dist/5924.js +2 -2
- package/dist/5925.js +2 -2
- package/dist/5972.js +2 -2
- package/dist/5974.js +2 -2
- package/dist/6022.js +2 -2
- package/dist/615.js +4 -4
- package/dist/6162.js +2 -2
- package/dist/6175.js +2 -2
- package/dist/622.js +2 -2
- package/dist/6223.js +2 -2
- package/dist/6330.js +2 -2
- package/dist/6331.js +2 -2
- package/dist/6354.js +2 -2
- package/dist/6751.js +2 -2
- package/dist/6792.js +2 -2
- package/dist/6844.js +2 -2
- package/dist/7125.js +2 -2
- package/dist/7127.js +2 -2
- package/dist/7135.js +2 -2
- package/dist/7148.js +2 -2
- package/dist/7447.js +2 -2
- package/dist/7453.js +2 -2
- package/dist/7483.js +2 -2
- package/dist/7604.js +2 -2
- package/dist/7971.js +2 -2
- package/dist/8147.js +2 -2
- package/dist/8308.js +2 -2
- package/dist/8309.js +2 -2
- package/dist/8327.js +2 -2
- package/dist/849.js +2 -2
- package/dist/8677.js +2 -2
- package/dist/868.js +2 -2
- package/dist/8947.js +2 -2
- package/dist/930.js +1 -1
- package/dist/9342.js +2 -2
- package/dist/9482.js +2 -2
- package/dist/9538.js +2 -2
- package/dist/9741.js +2 -2
- package/dist/9909.js +7 -7
- package/dist/9953.js +2 -2
- package/dist/css.worker.js +23 -23
- package/dist/daoPaaS.js +3 -4
- package/dist/editor.worker.js +7 -7
- package/dist/html.worker.js +19 -19
- package/dist/index.html +1 -1
- package/dist/json.worker.js +19 -19
- package/dist/ts.worker.js +21 -21
- package/package.json +1 -1
- package/dist/1742.js +0 -171
- package/dist/6120.js +0 -155
package/dist/4289.js
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
var s0=Object.defineProperty,o0=Object.defineProperties;var a0=Object.getOwnPropertyDescriptors;var Au=Object.getOwnPropertySymbols;var Pg=Object.prototype.hasOwnProperty,xg=Object.prototype.propertyIsEnumerable;var Mg=(Ne,de,H)=>de in Ne?s0(Ne,de,{enumerable:!0,configurable:!0,writable:!0,value:H}):Ne[de]=H,al=(Ne,de)=>{for(var H in de||(de={}))Pg.call(de,H)&&Mg(Ne,H,de[H]);if(Au)for(var H of Au(de))xg.call(de,H)&&Mg(Ne,H,de[H]);return Ne},kg=(Ne,de)=>o0(Ne,a0(de));var rh=(Ne,de)=>{var H={};for(var k in Ne)Pg.call(Ne,k)&&de.indexOf(k)<0&&(H[k]=Ne[k]);if(Ne!=null&&Au)for(var k of Au(Ne))de.indexOf(k)<0&&xg.call(Ne,k)&&(H[k]=Ne[k]);return H};var Ee=(Ne,de,H)=>new Promise((k,j)=>{var N=O=>{try{L(H.next(O))}catch(D){j(D)}},v=O=>{try{L(H.throw(O))}catch(D){j(D)}},L=O=>O.done?k(O.value):Promise.resolve(O.value).then(N,v);L((H=H.apply(Ne,de)).next())});exports.id=4289,exports.ids=[4289],exports.modules={2354:(Ne,de,H)=>{"use strict";H.d(de,{A7:()=>a,$V:()=>E,zW:()=>T});var k=H(79640),j=H.n(k),N=H(45904),v=H.n(N),L=H(88711),O=H.n(L);/*! *****************************************************************************
|
|
2
|
+
Copyright (c) Microsoft Corporation.
|
|
3
|
+
|
|
4
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
+
purpose with or without fee is hereby granted.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
8
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
+
***************************************************************************** */function D(n,s,l,d){return new(l||(l=Promise))(function(A,S){function R(m){try{_(d.next(m))}catch(I){S(I)}}function y(m){try{_(d.throw(m))}catch(I){S(I)}}function _(m){var I;m.done?A(m.value):(I=m.value,I instanceof l?I:new l(function(B){B(I)})).then(R,y)}_((d=d.apply(n,s||[])).next())})}function w(n,s){var l,d,A,S,R={label:0,sent:function(){if(1&A[0])throw A[1];return A[1]},trys:[],ops:[]};return S={next:y(0),throw:y(1),return:y(2)},typeof Symbol=="function"&&(S[Symbol.iterator]=function(){return this}),S;function y(_){return function(m){return function(I){if(l)throw new TypeError("Generator is already executing.");for(;R;)try{if(l=1,d&&(A=2&I[0]?d.return:I[0]?d.throw||((A=d.return)&&A.call(d),0):d.next)&&!(A=A.call(d,I[1])).done)return A;switch(d=0,A&&(I=[2&I[0],A.value]),I[0]){case 0:case 1:A=I;break;case 4:return R.label++,{value:I[1],done:!1};case 5:R.label++,d=I[1],I=[0];continue;case 7:I=R.ops.pop(),R.trys.pop();continue;default:if(A=R.trys,!((A=A.length>0&&A[A.length-1])||I[0]!==6&&I[0]!==2)){R=0;continue}if(I[0]===3&&(!A||I[1]>A[0]&&I[1]<A[3])){R.label=I[1];break}if(I[0]===6&&R.label<A[1]){R.label=A[1],A=I;break}if(A&&R.label<A[2]){R.label=A[2],R.ops.push(I);break}A[2]&&R.ops.pop(),R.trys.pop();continue}I=s.call(n,R)}catch(B){I=[6,B],d=0}finally{l=A=0}if(5&I[0])throw I[1];return{value:I[0]?I[1]:void 0,done:!0}}([_,m])}}}function g(n,s){return n.cid===s.cid&&n.uid===s.uid&&n.sid===s.sid}function b(n,s){return s===void 0&&(s="_"),n.split(s)}var T;(function(n){n.userAudioStart="user_audio_start",n.userAudioClose="user_audio_close",n.userVideoStart="user_video_start",n.userVideoClose="user_video_close"})(T||(T={}));var f=function(){function n(s,l){var d;this.server=s,this.localAudioTrack=null,this.localVideoTrack=null,this.client=v().createClient({mode:"rtc",codec:"vp8"}),this.id=l,this.callback=((d={})[T.userAudioStart]=function(A){},d[T.userAudioClose]=function(A){},d[T.userVideoStart]=function(A){},d[T.userVideoClose]=function(A){},d)}return n.prototype.on=function(s,l){this.callback[s]=l},n.prototype.join=function(){return D(this,void 0,void 0,function(){var s;return w(this,function(l){switch(l.label){case 0:return s={appId:"",channel:this.id.cid,token:"",uid:(d=this.id.uid,A=this.id.sid,S===void 0&&(S="_"),d+S+A)},[4,fetch(this.server+"/rtc/api/agora/token",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({user:s.uid.toString(),channel:s.channel})}).then(function(R){return R.json()}).then(function(R){s.appId=R.appid,s.token=R.token,console.log(R)},function(R){console.log(R)})];case 1:return l.sent(),[4,this.client.join(s.appId,s.channel,s.token,s.uid)];case 2:return l.sent(),this.call(),[2]}var d,A,S})})},n.prototype.onVideoStream=function(s,l){j().debug(s,l)},n.prototype.onAudioStream=function(s,l){j().debug(s,l)},n.prototype.startVideo=function(){var s;return D(this,void 0,void 0,function(){var l,d;return w(this,function(A){switch(A.label){case 0:return l=this,[4,v().createCameraVideoTrack()];case 1:return l.localVideoTrack=A.sent(),(d=(s=this.localVideoTrack)===null||s===void 0?void 0:s.getMediaStreamTrack())&&this.onVideoStream(this.id,new MediaStream([d])),[4,this.client.publish([this.localVideoTrack])];case 2:return A.sent(),console.log("publish video success!"),[2]}})})},n.prototype.startAudio=function(){var s;return D(this,void 0,void 0,function(){var l,d;return w(this,function(A){switch(A.label){case 0:return l=this,[4,v().createMicrophoneAudioTrack()];case 1:return l.localAudioTrack=A.sent(),(d=(s=this.localAudioTrack)===null||s===void 0?void 0:s.getMediaStreamTrack())&&this.onAudioStream(this.id,new MediaStream([d])),[4,this.client.publish([this.localAudioTrack])];case 2:return A.sent(),console.log("publish audio success!"),[2]}})})},n.prototype.call=function(){return D(this,void 0,void 0,function(){var s=this;return w(this,function(l){return this.client.on("user-published",function(d,A){return D(s,void 0,void 0,function(){var S,R,y,_,m,I,B=this;return w(this,function(P){switch(P.label){case 0:return[4,this.client.subscribe(d,A)];case 1:return P.sent(),console.log("subscribe success"),S=b(d.uid.toString()),R=S[0],y=S[1],console.log("remote user uid: ",R,", sid: ",y),A==="video"&&(_=(m=d.videoTrack)===null||m===void 0?void 0:m.getMediaStreamTrack())&&this.onVideoStream({cid:this.id.cid,uid:R,sid:y},new MediaStream([_])),A==="audio"&&(_=(I=d.audioTrack)===null||I===void 0?void 0:I.getMediaStreamTrack())&&this.onAudioStream({cid:this.id.cid,uid:R,sid:y},new MediaStream([_])),this.client.on("user-unpublished",function(M,U){return D(B,void 0,void 0,function(){var K,W,X;return w(this,function(ie){return console.log(M,U),K=b(M.uid.toString()),W=K[0],X=K[1],console.log("remote close user uid: ",W,", sid: ",X),U==="audio"&&this.callback[T.userAudioClose]({cid:this.id.cid,uid:W,sid:X}),U==="video"&&this.callback[T.userVideoClose]({cid:this.id.cid,uid:W,sid:X}),[2]})})}),[2]}})})}),[2]})})},n.prototype.closeVideo=function(s){return D(this,void 0,void 0,function(){return w(this,function(l){return g(this.id,s)&&(this.localVideoTrack.close(),this.client.unpublish(this.localVideoTrack)),[2]})})},n.prototype.closeAudio=function(s){return D(this,void 0,void 0,function(){return w(this,function(l){return g(this.id,s)&&(this.localAudioTrack.close(),this.client.unpublish(this.localAudioTrack)),[2]})})},n.prototype.leave=function(){return D(this,void 0,void 0,function(){return w(this,function(s){switch(s.label){case 0:return[4,this.client.leave()];case 1:return s.sent(),j().debug("already closed"),[2]}})})},n.prototype.startRecord=function(){return D(this,void 0,void 0,function(){var s=this;return w(this,function(l){return[2,new Promise(function(d){fetch(s.server+"/rtc/api/agora/recording/start/"+s.id.cid,{method:"post",headers:{"Content-Type":"application/json"}}).then(function(A){return A.json()}).then(function(A){console.log(A),d(A.id)},function(A){console.log(A),d("")})})]})})},n.prototype.closeRecord=function(){return D(this,void 0,void 0,function(){return w(this,function(s){return[2]})})},n.prototype.playbackCid=function(s,l){var d="/rtc/api/agora/playback/"+s;if(l.canPlayType("application/vnd.apple.mpegurl"))l.src=d;else if(O().isSupported()){var A=new(O());A.loadSource(d),A.attachMedia(l)}},n.prototype.playbackSegment=function(s,l){var d="/rtc/api/agora/playback/segment/"+s;if(l.canPlayType("application/vnd.apple.mpegurl"))l.src=d;else if(O().isSupported()){var A=new(O());A.loadSource(d),A.attachMedia(l)}},n}(),p=["webrtc-echo","webrtc-1v1","webrtc-mesh","webrtc-sfu","webrtc-mcu","janus","agora","pano","tcloud","qiniu","rongcloud"],E=function(){function n(s,l,d,A){var S,R,y;this.server=s,this.store={line:"agora",joined:!1,record:!1,video:(S={},S[l.uid]=!1,S),audio:(R={},R[l.uid]=!1,R)},this.featSet=d,this.io=A,this.able=[],this.line="auto",this.provide=p,this.rtc=new f(s,l),this.id=l,this.callback=((y={})[T.userAudioStart]=function(_){},y[T.userAudioClose]=function(_){},y[T.userVideoStart]=function(_){},y[T.userVideoClose]=function(_){},y.userpub=function(_){j().debug(_)},y),this.onVideoStream=function(_,m){j().debug(_,m)},this.onAudioStream=function(_,m){j().debug(_,m)}}return Object.defineProperty(n.prototype,"onVideoStream",{set:function(s){this.rtc.onVideoStream=s},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"onAudioStream",{set:function(s){this.rtc.onAudioStream=s},enumerable:!1,configurable:!0}),n.prototype.join=function(){return D(this,void 0,void 0,function(){return w(this,function(s){return this.store.joined=!0,this.rtc.join(),[2]})})},n.prototype.startVideo=function(){return D(this,void 0,void 0,function(){return w(this,function(s){return this.store.video[this.id.uid]=!0,this.rtc.startVideo(),[2]})})},n.prototype.startAudio=function(){return D(this,void 0,void 0,function(){return w(this,function(s){return this.store.audio[this.id.uid]=!0,this.rtc.startAudio(),[2]})})},n.prototype.closeVideo=function(s){return D(this,void 0,void 0,function(){return w(this,function(l){return this.store.video[s.uid]=!1,this.rtc.closeVideo(s),[2]})})},n.prototype.closeAudio=function(s){return D(this,void 0,void 0,function(){return w(this,function(l){return this.store.audio[s.uid]=!1,this.rtc.closeAudio(s),[2]})})},n.prototype.leave=function(){return D(this,void 0,void 0,function(){return w(this,function(s){return this.store.joined=!1,this.rtc.leave(),[2]})})},n.prototype.startRecord=function(){return D(this,void 0,void 0,function(){return w(this,function(s){return this.store.record=!0,[2,this.rtc.startRecord()]})})},n.prototype.closeRecord=function(){return D(this,void 0,void 0,function(){return w(this,function(s){return this.store.record=!1,this.rtc.closeRecord(),[2]})})},n.prototype.playbackCid=function(s,l){this.rtc.playbackCid(s,l)},n.prototype.playbackSegment=function(s,l){this.rtc.playbackSegment(s,l)},n.prototype.on=function(s,l){this.callback[s]=l,this.rtc.on(s,l)},n.prototype.setState=function(s){var l=this;s.joined&&(this.join(),setTimeout(function(){s.video[l.id.uid]&&l.startVideo(),s.audio[l.id.uid]&&l.startAudio()},1e3)),this.store=s},n.prototype.getState=function(){return this.store},n}(),u=function(){function n(s,l){this.key=s,this.io=l}return n.prototype.send=function(s){var l;this.io.send(((l={})[this.key]=s,l))},n.prototype.recv=function(s){},n.prototype.on=function(s){this.recv=s},n}(),a=function(){function n(s){this.io=s,this.map={}}return n.prototype.send=function(s){this.io.send(s)},n.prototype.recv=function(s){var l=this;Object.keys(s).forEach(function(d){l.map[d]&&l.map[d].recv(s[d])})},n.prototype.chan=function(s){var l=new u(s,this);return this.map[s]=l,l},n}()},25050:(Ne,de,H)=>{"use strict";H.d(de,{iv:()=>ae});var k=H(51647),j=H(31206),N=H(34053),v=H(86894),L=`You have illegal escape sequence in your template literal, most likely inside content's property value.
|
|
15
|
+
Because you write your CSS inside a JavaScript string you actually have to do double escaping, so for example "content: '\\00d7';" should become "content: '\\\\00d7';".
|
|
16
|
+
You can read more about this here:
|
|
17
|
+
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences`,O="You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key).",D=/[A-Z]|^ms/g,w=/_EMO_([^_]+?)_([^]*?)_EMO_/g,g=function(Te){return Te.charCodeAt(1)===45},b=function(Te){return Te!=null&&typeof Te!="boolean"},T=(0,v.Z)(function(Ue){return g(Ue)?Ue:Ue.replace(D,"-$&").toLowerCase()}),f=function(Te,Fe){switch(Te){case"animation":case"animationName":if(typeof Fe=="string")return Fe.replace(w,function($e,Ye,Ge){return R={name:Ye,styles:Ge,next:R},Ye})}return N.Z[Te]!==1&&!g(Te)&&typeof Fe=="number"&&Fe!==0?Fe+"px":Fe};if(!1)var p,E,u,a,n,s;function l(Ue,Te,Fe){if(Fe==null)return"";if(Fe.__emotion_styles!==void 0)return Fe;switch(typeof Fe){case"boolean":return"";case"object":{if(Fe.anim===1)return R={name:Fe.name,styles:Fe.styles,next:R},Fe.name;if(Fe.styles!==void 0){var $e=Fe.next;if($e!==void 0)for(;$e!==void 0;)R={name:$e.name,styles:$e.styles,next:R},$e=$e.next;var Ye=Fe.styles+";";return Ye}return d(Ue,Te,Fe)}case"function":{if(Ue!==void 0){var Ge=R,st=Fe(Ue);return R=Ge,l(Ue,Te,st)}break}case"string":if(!1)var Ft,Bt;break}if(Te==null)return Fe;var Pt=Te[Fe];return Pt!==void 0?Pt:Fe}function d(Ue,Te,Fe){var $e="";if(Array.isArray(Fe))for(var Ye=0;Ye<Fe.length;Ye++)$e+=l(Ue,Te,Fe[Ye])+";";else for(var Ge in Fe){var st=Fe[Ge];if(typeof st!="object")Te!=null&&Te[st]!==void 0?$e+=Ge+"{"+Te[st]+"}":b(st)&&($e+=T(Ge)+":"+f(Ge,st)+";");else if(Array.isArray(st)&&typeof st[0]=="string"&&(Te==null||Te[st[0]]===void 0))for(var Ft=0;Ft<st.length;Ft++)b(st[Ft])&&($e+=T(Ge)+":"+f(Ge,st[Ft])+";");else{var Bt=l(Ue,Te,st);switch(Ge){case"animation":case"animationName":{$e+=T(Ge)+":"+Bt+";";break}default:$e+=Ge+"{"+Bt+"}"}}}return $e}var A=/label:\s*([^\s;\n{]+)\s*(;|$)/g,S,R,y=function(Te,Fe,$e){if(Te.length===1&&typeof Te[0]=="object"&&Te[0]!==null&&Te[0].styles!==void 0)return Te[0];var Ye=!0,Ge="";R=void 0;var st=Te[0];st==null||st.raw===void 0?(Ye=!1,Ge+=l($e,Fe,st)):Ge+=st[0];for(var Ft=1;Ft<Te.length;Ft++)Ge+=l($e,Fe,Te[Ft]),Ye&&(Ge+=st[Ft]);var Bt;A.lastIndex=0;for(var Pt="",Dt;(Dt=A.exec(Ge))!==null;)Pt+="-"+Dt[1];var qt=(0,j.Z)(Ge)+Pt;return{name:qt,styles:Ge,next:R}},_=typeof document!="undefined";function m(Ue,Te,Fe){var $e="";return Fe.split(" ").forEach(function(Ye){Ue[Ye]!==void 0?Te.push(Ue[Ye]+";"):$e+=Ye+" "}),$e}var I=function(Te,Fe,$e){var Ye=Te.key+"-"+Fe.name;if(($e===!1||_===!1&&Te.compat!==void 0)&&Te.registered[Ye]===void 0&&(Te.registered[Ye]=Fe.styles),Te.inserted[Fe.name]===void 0){var Ge="",st=Fe;do{var Ft=Te.insert(Fe===st?"."+Ye:"",st,Te.sheet,!0);!_&&Ft!==void 0&&(Ge+=Ft),st=st.next}while(st!==void 0);if(!_&&Ge.length!==0)return Ge}};function B(Ue,Te){if(Ue.inserted[Te.name]===void 0)return Ue.insert("",Te,Ue.sheet,!0)}function P(Ue,Te,Fe){var $e=[],Ye=m(Ue,$e,Fe);return $e.length<2?Fe:Ye+Te($e)}var M=function(Te){var Fe=(0,k.Z)(Te);Fe.sheet.speedy=function(Ft){this.isSpeedy=Ft},Fe.compat=!0;var $e=function(){for(var Bt=arguments.length,Pt=new Array(Bt),Dt=0;Dt<Bt;Dt++)Pt[Dt]=arguments[Dt];var qt=y(Pt,Fe.registered,void 0);return I(Fe,qt,!1),Fe.key+"-"+qt.name},Ye=function(){for(var Bt=arguments.length,Pt=new Array(Bt),Dt=0;Dt<Bt;Dt++)Pt[Dt]=arguments[Dt];var qt=y(Pt,Fe.registered),Or="animation-"+qt.name;return B(Fe,{name:qt.name,styles:"@keyframes "+Or+"{"+qt.styles+"}"}),Or},Ge=function(){for(var Bt=arguments.length,Pt=new Array(Bt),Dt=0;Dt<Bt;Dt++)Pt[Dt]=arguments[Dt];var qt=y(Pt,Fe.registered);B(Fe,qt)},st=function(){for(var Bt=arguments.length,Pt=new Array(Bt),Dt=0;Dt<Bt;Dt++)Pt[Dt]=arguments[Dt];return P(Fe.registered,$e,U(Pt))};return{css:$e,cx:st,injectGlobal:Ge,keyframes:Ye,hydrate:function(Bt){Bt.forEach(function(Pt){Fe.inserted[Pt]=!0})},flush:function(){Fe.registered={},Fe.inserted={},Fe.sheet.flush()},sheet:Fe.sheet,cache:Fe,getRegisteredStyles:m.bind(null,Fe.registered),merge:P.bind(null,Fe.registered,$e)}},U=function Ue(Te){for(var Fe="",$e=0;$e<Te.length;$e++){var Ye=Te[$e];if(Ye!=null){var Ge=void 0;switch(typeof Ye){case"boolean":break;case"object":{if(Array.isArray(Ye))Ge=Ue(Ye);else{Ge="";for(var st in Ye)Ye[st]&&st&&(Ge&&(Ge+=" "),Ge+=st)}break}default:Ge=Ye}Ge&&(Fe&&(Fe+=" "),Fe+=Ge)}}return Fe},W=M({key:"css"}),X=W.flush,ie=W.hydrate,se=W.cx,le=W.merge,ve=W.getRegisteredStyles,q=W.injectGlobal,ee=W.keyframes,ae=W.css,_e=W.sheet,fe=W.cache},11918:(Ne,de,H)=>{"use strict";function k(g){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?k=function(T){return typeof T}:k=function(T){return T&&typeof Symbol=="function"&&T.constructor===Symbol&&T!==Symbol.prototype?"symbol":typeof T},k(g)}Object.defineProperty(de,"__esModule",{value:!0}),de.default=void 0;var j=v(H(2784));function N(){if(typeof WeakMap!="function")return null;var g=new WeakMap;return N=function(){return g},g}function v(g){if(g&&g.__esModule)return g;if(g===null||k(g)!=="object"&&typeof g!="function")return{default:g};var b=N();if(b&&b.has(g))return b.get(g);var T={},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in g)if(Object.prototype.hasOwnProperty.call(g,p)){var E=f?Object.getOwnPropertyDescriptor(g,p):null;E&&(E.get||E.set)?Object.defineProperty(T,p,E):T[p]=g[p]}return T.default=g,b&&b.set(g,T),T}function L(){return L=Object.assign||function(g){for(var b=1;b<arguments.length;b++){var T=arguments[b];for(var f in T)Object.prototype.hasOwnProperty.call(T,f)&&(g[f]=T[f])}return g},L.apply(this,arguments)}function O(g,b){return j.createElement("svg",L({width:"1em",height:"1em",viewBox:"0 0 21 32",fill:"currentColor",ref:b},g),j.createElement("path",{d:"M19.196 13.143a.612.612 0 01-.179.411l-8.321 8.321c-.107.107-.268.179-.411.179s-.304-.071-.411-.179l-8.321-8.321c-.107-.107-.179-.268-.179-.411s.071-.304.179-.411l.893-.893a.582.582 0 01.411-.179c.143 0 .304.071.411.179l7.018 7.018 7.018-7.018c.107-.107.268-.179.411-.179s.304.071.411.179l.893.893a.617.617 0 01.179.411z"}))}var D=j.forwardRef(O),w=D;de.default=w},35885:(Ne,de,H)=>{"use strict";function k(g){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?k=function(T){return typeof T}:k=function(T){return T&&typeof Symbol=="function"&&T.constructor===Symbol&&T!==Symbol.prototype?"symbol":typeof T},k(g)}Object.defineProperty(de,"__esModule",{value:!0}),de.default=void 0;var j=v(H(2784));function N(){if(typeof WeakMap!="function")return null;var g=new WeakMap;return N=function(){return g},g}function v(g){if(g&&g.__esModule)return g;if(g===null||k(g)!=="object"&&typeof g!="function")return{default:g};var b=N();if(b&&b.has(g))return b.get(g);var T={},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in g)if(Object.prototype.hasOwnProperty.call(g,p)){var E=f?Object.getOwnPropertyDescriptor(g,p):null;E&&(E.get||E.set)?Object.defineProperty(T,p,E):T[p]=g[p]}return T.default=g,b&&b.set(g,T),T}function L(){return L=Object.assign||function(g){for(var b=1;b<arguments.length;b++){var T=arguments[b];for(var f in T)Object.prototype.hasOwnProperty.call(T,f)&&(g[f]=T[f])}return g},L.apply(this,arguments)}function O(g,b){return j.createElement("svg",L({width:"1em",height:"1em",viewBox:"0 0 12 32",fill:"currentColor",ref:b},g),j.createElement("path",{d:"M11.196 9.714a.612.612 0 01-.179.411l-7.018 7.018 7.018 7.018c.107.107.179.268.179.411s-.071.304-.179.411l-.893.893c-.107.107-.268.179-.411.179s-.304-.071-.411-.179L.981 17.555c-.107-.107-.179-.268-.179-.411s.071-.304.179-.411l8.321-8.321c.107-.107.268-.179.411-.179s.304.071.411.179l.893.893c.107.107.179.25.179.411z"}))}var D=j.forwardRef(O),w=D;de.default=w},89406:(Ne,de,H)=>{"use strict";function k(g){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?k=function(T){return typeof T}:k=function(T){return T&&typeof Symbol=="function"&&T.constructor===Symbol&&T!==Symbol.prototype?"symbol":typeof T},k(g)}Object.defineProperty(de,"__esModule",{value:!0}),de.default=void 0;var j=v(H(2784));function N(){if(typeof WeakMap!="function")return null;var g=new WeakMap;return N=function(){return g},g}function v(g){if(g&&g.__esModule)return g;if(g===null||k(g)!=="object"&&typeof g!="function")return{default:g};var b=N();if(b&&b.has(g))return b.get(g);var T={},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in g)if(Object.prototype.hasOwnProperty.call(g,p)){var E=f?Object.getOwnPropertyDescriptor(g,p):null;E&&(E.get||E.set)?Object.defineProperty(T,p,E):T[p]=g[p]}return T.default=g,b&&b.set(g,T),T}function L(){return L=Object.assign||function(g){for(var b=1;b<arguments.length;b++){var T=arguments[b];for(var f in T)Object.prototype.hasOwnProperty.call(T,f)&&(g[f]=T[f])}return g},L.apply(this,arguments)}function O(g,b){return j.createElement("svg",L({width:"1em",height:"1em",viewBox:"0 0 11 32",fill:"currentColor",ref:b},g),j.createElement("path",{d:"M10.625 17.143a.612.612 0 01-.179.411l-8.321 8.321c-.107.107-.268.179-.411.179s-.304-.071-.411-.179l-.893-.893a.582.582 0 01-.179-.411c0-.143.071-.304.179-.411l7.018-7.018L.41 10.124c-.107-.107-.179-.268-.179-.411s.071-.304.179-.411l.893-.893c.107-.107.268-.179.411-.179s.304.071.411.179l8.321 8.321a.617.617 0 01.179.411z"}))}var D=j.forwardRef(O),w=D;de.default=w},57559:(Ne,de,H)=>{"use strict";function k(g){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?k=function(T){return typeof T}:k=function(T){return T&&typeof Symbol=="function"&&T.constructor===Symbol&&T!==Symbol.prototype?"symbol":typeof T},k(g)}Object.defineProperty(de,"__esModule",{value:!0}),de.default=void 0;var j=v(H(2784));function N(){if(typeof WeakMap!="function")return null;var g=new WeakMap;return N=function(){return g},g}function v(g){if(g&&g.__esModule)return g;if(g===null||k(g)!=="object"&&typeof g!="function")return{default:g};var b=N();if(b&&b.has(g))return b.get(g);var T={},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in g)if(Object.prototype.hasOwnProperty.call(g,p)){var E=f?Object.getOwnPropertyDescriptor(g,p):null;E&&(E.get||E.set)?Object.defineProperty(T,p,E):T[p]=g[p]}return T.default=g,b&&b.set(g,T),T}function L(){return L=Object.assign||function(g){for(var b=1;b<arguments.length;b++){var T=arguments[b];for(var f in T)Object.prototype.hasOwnProperty.call(T,f)&&(g[f]=T[f])}return g},L.apply(this,arguments)}function O(g,b){return j.createElement("svg",L({width:"1em",height:"1em",viewBox:"0 0 21 32",fill:"currentColor",ref:b},g),j.createElement("path",{d:"M19.196 21.143a.612.612 0 01-.179.411l-.893.893a.582.582 0 01-.411.179.612.612 0 01-.411-.179l-7.018-7.018-7.018 7.018c-.107.107-.268.179-.411.179s-.304-.071-.411-.179l-.893-.893c-.107-.107-.179-.268-.179-.411s.071-.304.179-.411l8.321-8.321c.107-.107.268-.179.411-.179s.304.071.411.179l8.321 8.321a.617.617 0 01.179.411z"}))}var D=j.forwardRef(O),w=D;de.default=w},28801:(Ne,de,H)=>{"use strict";var k;k={value:!0},Object.defineProperty(de,"Z",{enumerable:!0,get:function(){return j.default}});var j=N(H(75939));function N(v){return v&&v.__esModule?v:{default:v}}},7582:(Ne,de,H)=>{"use strict";var k;k={value:!0},Object.defineProperty(de,"Z",{enumerable:!0,get:function(){return j.default}});var j=N(H(70816));function N(v){return v&&v.__esModule?v:{default:v}}},41840:(Ne,de,H)=>{"use strict";var k;k={value:!0},Object.defineProperty(de,"Z",{enumerable:!0,get:function(){return j.default}});var j=N(H(85911));function N(v){return v&&v.__esModule?v:{default:v}}},70095:(Ne,de,H)=>{"use strict";var k;k={value:!0},Object.defineProperty(de,"Z",{enumerable:!0,get:function(){return j.default}});var j=N(H(14586));function N(v){return v&&v.__esModule?v:{default:v}}},75939:(Ne,de,H)=>{"use strict";var k=H(14859);de.__esModule=!0,de.default=void 0;var j=k(H(620)),N=k(H(11918)),v=(0,j.default)({as:N.default,ariaLabel:"angle down",category:"legacy",displayName:"AngleDown"}),L=v;de.default=L,Ne.exports=de.default},70816:(Ne,de,H)=>{"use strict";var k=H(14859);de.__esModule=!0,de.default=void 0;var j=k(H(620)),N=k(H(35885)),v=(0,j.default)({as:N.default,ariaLabel:"angle left",category:"legacy",displayName:"AngleLeft"}),L=v;de.default=L,Ne.exports=de.default},85911:(Ne,de,H)=>{"use strict";var k=H(14859);de.__esModule=!0,de.default=void 0;var j=k(H(620)),N=k(H(89406)),v=(0,j.default)({as:N.default,ariaLabel:"angle right",category:"legacy",displayName:"AngleRight"}),L=v;de.default=L,Ne.exports=de.default},14586:(Ne,de,H)=>{"use strict";var k=H(14859);de.__esModule=!0,de.default=void 0;var j=k(H(620)),N=k(H(57559)),v=(0,j.default)({as:N.default,ariaLabel:"angle up",category:"legacy",displayName:"AngleUp"}),L=v;de.default=L,Ne.exports=de.default},45904:function(Ne){"use strict";/*
|
|
18
|
+
@license
|
|
19
|
+
UAParser.js v0.7.28
|
|
20
|
+
Lightweight JavaScript-based User-Agent string parser
|
|
21
|
+
https://github.com/faisalman/ua-parser-js
|
|
22
|
+
|
|
23
|
+
Copyright ? 2012-2021 Faisal Salman <f@faisalman.com>
|
|
24
|
+
Licensed under MIT License
|
|
25
|
+
*****************************************************************************
|
|
26
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
27
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
28
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
29
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
30
|
+
|
|
31
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
32
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
33
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
34
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
35
|
+
|
|
36
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
37
|
+
and limitations under the License.
|
|
38
|
+
*****************************************************************************/(function(de,H){Ne.exports=H()})(this,function(){function de(t,e,r){return t(r={path:e,exports:{},require:function(i,o){throw Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}},r.exports),r.exports}function H(t,e,r){return(t=t.match(e))&&t.length>=r&&Si(t[r],10)}function k(t,e,r){if(t.RTCPeerConnection){t=t.RTCPeerConnection.prototype;var i=t.addEventListener;t.addEventListener=function(c,h){if(c!==e)return i.apply(this,arguments);let C=x=>{(x=r(x))&&h(x)};return this._eventMap=this._eventMap||{},this._eventMap[h]=C,i.apply(this,[c,C])};var o=t.removeEventListener;t.removeEventListener=function(c,h){if(c!==e||!this._eventMap||!this._eventMap[h])return o.apply(this,arguments);let C=this._eventMap[h];return delete this._eventMap[h],o.apply(this,[c,C])},mr(t,"on"+e,{get(){return this["_on"+e]},set(c){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),c&&this.addEventListener(e,this["_on"+e]=c)},enumerable:!0,configurable:!0})}}function j(t){return typeof t!="boolean"?Error("Argument type: "+typeof t+". Please use a boolean."):(Ih=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function N(t){return typeof t!="boolean"?Error("Argument type: "+typeof t+". Please use a boolean."):(Sh=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function v(){typeof window!="object"||Ih||typeof console!="undefined"&&typeof console.log=="function"&&console.log.apply(console,arguments)}function L(t,e){Sh&&console.warn(t+" is deprecated, please use "+e+" instead.")}function O(t){let{navigator:e}=t,r={browser:null,version:null};if(t===void 0||!t.navigator)return r.browser="Not a browser.",r;if(e.mozGetUserMedia)r.browser="firefox",r.version=H(e.userAgent,/Firefox\/(\d+)\./,1);else if(e.webkitGetUserMedia||t.isSecureContext===!1&&t.webkitRTCPeerConnection&&!t.RTCIceGatherer)r.browser="chrome",r.version=H(e.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(e.mediaDevices&&e.userAgent.match(/Edge\/(\d+).(\d+)$/))r.browser="edge",r.version=H(e.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!t.RTCPeerConnection||!e.userAgent.match(/AppleWebKit\/(\d+)\./))return r.browser="Not a supported browser.",r;r.browser="safari",r.version=H(e.userAgent,/AppleWebKit\/(\d+)\./,1),r.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype}return r}function D(t){var e;return Object.prototype.toString.call(t)==="[object Object]"?Ul(e=vr(t)).call(e,function(r,i){var o=Object.prototype.toString.call(t[i])==="[object Object]";let c=o?D(t[i]):t[i];return o=o&&!vr(c).length,c===void 0||o?r:Dn(r,{[i]:c})},{}):t}function w(t,e,r){let i=r?"outbound-rtp":"inbound-rtp",o=new Tr;if(e===null)return o;let c=[];return Re(t).call(t,h=>{h.type==="track"&&h.trackIdentifier===e.id&&c.push(h)}),Re(c).call(c,h=>{Re(t).call(t,C=>{C.type===i&&C.trackId===h.id&&function x(Q,F,V){var Y;F&&!V.has(F.id)&&(V.set(F.id,F),Re(Y=vr(F)).call(Y,$=>{if(gh($).call($,"Id"))x(Q,Q.get(F[$]),V);else if(gh($).call($,"Ids")){var te;Re(te=F[$]).call(te,ce=>{x(Q,Q.get(ce),V)})}}))}(t,C,o)})}),o}function g(t){let e=t&&t.navigator;if(e.mediaDevices){var r=O(t),i=function(C){var x;if(typeof C!="object"||C.mandatory||C.optional)return C;const Q={};var F;return Re(x=vr(C)).call(x,V=>{if(V!=="require"&&V!=="advanced"&&V!=="mediaSource"){var Y=typeof C[V]=="object"?C[V]:{ideal:C[V]};Y.exact!==void 0&&typeof Y.exact=="number"&&(Y.min=Y.max=Y.exact);var $=function(ce,Ae){return ce?ce+Ae.charAt(0).toUpperCase()+en(Ae).call(Ae,1):Ae==="deviceId"?"sourceId":Ae};if(Y.ideal!==void 0){Q.optional=Q.optional||[];let ce={};typeof Y.ideal=="number"?(ce[$("min",V)]=Y.ideal,Q.optional.push(ce),ce={},ce[$("max",V)]=Y.ideal,Q.optional.push(ce)):(ce[$("",V)]=Y.ideal,Q.optional.push(ce))}var te;Y.exact!==void 0&&typeof Y.exact!="number"?(Q.mandatory=Q.mandatory||{},Q.mandatory[$("",V)]=Y.exact):Re(te=["min","max"]).call(te,ce=>{Y[ce]!==void 0&&(Q.mandatory=Q.mandatory||{},Q.mandatory[$(ce,V)]=Y[ce])})}}),C.advanced&&(Q.optional=ne(F=Q.optional||[]).call(F,C.advanced)),Q},o=function(C,x){if(61<=r.version)return x(C);if((C=JSON.parse(ht(C)))&&typeof C.audio=="object"){var Q=function(F,V,Y){V in F&&!(Y in F)&&(F[Y]=F[V],delete F[V])};Q((C=JSON.parse(ht(C))).audio,"autoGainControl","googAutoGainControl"),Q(C.audio,"noiseSuppression","googNoiseSuppression"),C.audio=i(C.audio)}if(C&&typeof C.video=="object"){let F=C.video.facingMode;if(F=F&&(typeof F=="object"?F:{ideal:F}),Q=66>r.version,!(!F||F.exact!=="user"&&F.exact!=="environment"&&F.ideal!=="user"&&F.ideal!=="environment"||e.mediaDevices.getSupportedConstraints&&e.mediaDevices.getSupportedConstraints().facingMode&&!Q)){let V;if(delete C.video.facingMode,F.exact==="environment"||F.ideal==="environment"?V=["back","rear"]:F.exact!=="user"&&F.ideal!=="user"||(V=["front"]),V)return e.mediaDevices.enumerateDevices().then(Y=>{Y=Wt(Y).call(Y,te=>te.kind==="videoinput");let $=rr(Y).call(Y,te=>hf(V).call(V,ce=>{var Ae;return _r(Ae=te.label.toLowerCase()).call(Ae,ce)}));return!$&&Y.length&&_r(V).call(V,"back")&&($=Y[Y.length-1]),$&&(C.video.deviceId=F.exact?{exact:$.deviceId}:{ideal:$.deviceId}),C.video=i(C.video),ff("chrome: "+ht(C)),x(C)})}C.video=i(C.video)}return ff("chrome: "+ht(C)),x(C)},c=function(C){return 64<=r.version?C:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[C.name]||C.name,message:C.message,constraint:C.constraint||C.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(t=function(C,x,Q){o(C,F=>{e.webkitGetUserMedia(F,x,V=>{Q&&Q(c(V))})})},e.getUserMedia=Ti(t).call(t,e),e.mediaDevices.getUserMedia){var h;let C=Ti(h=e.mediaDevices.getUserMedia).call(h,e.mediaDevices);e.mediaDevices.getUserMedia=function(x){return o(x,Q=>C(Q).then(F=>{var V;if(Q.audio&&!F.getAudioTracks().length||Q.video&&!F.getVideoTracks().length)throw Re(V=F.getTracks()).call(V,Y=>{Y.stop()}),new DOMException("","NotFoundError");return F},F=>it.reject(c(F))))}}}}function b(t){t.MediaStream=t.MediaStream||t.webkitMediaStream}function T(t){if(typeof t!="object"||!t.RTCPeerConnection||"ontrack"in t.RTCPeerConnection.prototype)k(t,"track",e=>(e.transceiver||mr(e,"transceiver",{value:{receiver:e.receiver}}),e));else{mr(t.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(r){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=r)},enumerable:!0,configurable:!0});let e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=r=>{var i;r.stream.addEventListener("addtrack",o=>{let c;var h;t.RTCPeerConnection.prototype.getReceivers?c=rr(h=this.getReceivers()).call(h,C=>C.track&&C.track.id===o.track.id):c={track:o.track},h=new Event("track"),h.track=o.track,h.receiver=c,h.transceiver={receiver:c},h.streams=[r.stream],this.dispatchEvent(h)}),Re(i=r.stream.getTracks()).call(i,o=>{let c;var h;t.RTCPeerConnection.prototype.getReceivers?c=rr(h=this.getReceivers()).call(h,C=>C.track&&C.track.id===o.id):c={track:o},h=new Event("track"),h.track=o,h.receiver=c,h.transceiver={receiver:c},h.streams=[r.stream],this.dispatchEvent(h)})},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}}function f(t){if(typeof t=="object"&&t.RTCPeerConnection&&!("getSenders"in t.RTCPeerConnection.prototype)&&"createDTMFSender"in t.RTCPeerConnection.prototype){let e=function(o,c){return{track:c,get dtmf(){return this._dtmf===void 0&&(c.kind==="audio"?this._dtmf=o.createDTMFSender(c):this._dtmf=null),this._dtmf},_pc:o}};if(!t.RTCPeerConnection.prototype.getSenders){t.RTCPeerConnection.prototype.getSenders=function(){var h;return this._senders=this._senders||[],en(h=this._senders).call(h)};let o=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(h,C){let x=o.apply(this,arguments);return x||(x=e(this,h),this._senders.push(x)),x};let c=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(h){var C;c.apply(this,arguments);let x=Vt(C=this._senders).call(C,h);var Q;x!==-1&&An(Q=this._senders).call(Q,x,1)}}let r=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(o){var c;this._senders=this._senders||[],r.apply(this,[o]),Re(c=o.getTracks()).call(c,h=>{this._senders.push(e(this,h))})};let i=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(o){var c;this._senders=this._senders||[],i.apply(this,[o]),Re(c=o.getTracks()).call(c,h=>{var C;let x=rr(C=this._senders).call(C,V=>V.track===h);var Q,F;x&&An(Q=this._senders).call(Q,Vt(F=this._senders).call(F,x),1)})}}else if(typeof t=="object"&&t.RTCPeerConnection&&"getSenders"in t.RTCPeerConnection.prototype&&"createDTMFSender"in t.RTCPeerConnection.prototype&&t.RTCRtpSender&&!("dtmf"in t.RTCRtpSender.prototype)){let e=t.RTCPeerConnection.prototype.getSenders;t.RTCPeerConnection.prototype.getSenders=function(){let r=e.apply(this,[]);return Re(r).call(r,i=>i._pc=this),r},mr(t.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function p(t){if(t.RTCPeerConnection){var e=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){let[r,i,o]=arguments;if(0<arguments.length&&typeof r=="function")return e.apply(this,arguments);if(e.length===0&&(arguments.length===0||typeof r!="function"))return e.apply(this,[]);let c=function(C){const x={};return C=C.result(),Re(C).call(C,Q=>{var F;const V={id:Q.id,timestamp:Q.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[Q.type]||Q.type};Re(F=Q.names()).call(F,Y=>{V[Y]=Q.stat(Y)}),x[V.id]=V}),x},h=function(C){var x;return new Tr(_t(x=vr(C)).call(x,Q=>[Q,C[Q]]))};return 2<=arguments.length?e.apply(this,[function(C){i(h(c(C)))},r]):new it((C,x)=>{e.apply(this,[function(Q){C(h(c(Q)))},x])}).then(i,o)}}}function E(t){if(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender&&t.RTCRtpReceiver){if(!("getStats"in t.RTCRtpSender.prototype)){let r=t.RTCPeerConnection.prototype.getSenders;r&&(t.RTCPeerConnection.prototype.getSenders=function(){let o=r.apply(this,[]);return Re(o).call(o,c=>c._pc=this),o});let i=t.RTCPeerConnection.prototype.addTrack;i&&(t.RTCPeerConnection.prototype.addTrack=function(){let o=i.apply(this,arguments);return o._pc=this,o}),t.RTCRtpSender.prototype.getStats=function(){let o=this;return this._pc.getStats().then(c=>w(c,o.track,!0))}}if(!("getStats"in t.RTCRtpReceiver.prototype)){let r=t.RTCPeerConnection.prototype.getReceivers;r&&(t.RTCPeerConnection.prototype.getReceivers=function(){let i=r.apply(this,[]);return Re(i).call(i,o=>o._pc=this),i}),k(t,"track",i=>(i.receiver._pc=i.srcElement,i)),t.RTCRtpReceiver.prototype.getStats=function(){let i=this;return this._pc.getStats().then(o=>w(o,i.track,!1))}}if("getStats"in t.RTCRtpSender.prototype&&"getStats"in t.RTCRtpReceiver.prototype){var e=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){if(0<arguments.length&&arguments[0]instanceof t.MediaStreamTrack){var r,i;let o=arguments[0],c,h,C;return Re(r=this.getSenders()).call(r,x=>{x.track===o&&(c?C=!0:c=x)}),Re(i=this.getReceivers()).call(i,x=>(x.track===o&&(h?C=!0:h=x),x.track===o)),C||c&&h?it.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):c?c.getStats():h?h.getStats():it.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}}}function u(t){t.RTCPeerConnection.prototype.getLocalStreams=function(){var c;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},_t(c=vr(this._shimmedLocalStreams)).call(c,h=>this._shimmedLocalStreams[h][0])};let e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(c,h){var C;if(!h)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};let x=e.apply(this,arguments);return this._shimmedLocalStreams[h.id]?Vt(C=this._shimmedLocalStreams[h.id]).call(C,x)===-1&&this._shimmedLocalStreams[h.id].push(x):this._shimmedLocalStreams[h.id]=[h,x],x};let r=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(c){var h,C,x;this._shimmedLocalStreams=this._shimmedLocalStreams||{},Re(h=c.getTracks()).call(h,F=>{var V;if(rr(V=this.getSenders()).call(V,Y=>Y.track===F))throw new DOMException("Track already exists.","InvalidAccessError")});let Q=this.getSenders();r.apply(this,arguments),h=Wt(C=this.getSenders()).call(C,F=>Vt(Q).call(Q,F)===-1),this._shimmedLocalStreams[c.id]=ne(x=[c]).call(x,h)};let i=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(c){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[c.id],i.apply(this,arguments)};let o=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(c){var h;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},c&&Re(h=vr(this._shimmedLocalStreams)).call(h,C=>{var x;let Q=Vt(x=this._shimmedLocalStreams[C]).call(x,c);var F;Q!==-1&&An(F=this._shimmedLocalStreams[C]).call(F,Q,1),this._shimmedLocalStreams[C].length===1&&delete this._shimmedLocalStreams[C]}),o.apply(this,arguments)}}function a(t){function e(F,V){var Y;let $=V.sdp;return Re(Y=vr(F._reverseStreams||[])).call(Y,te=>{te=F._reverseStreams[te],$=$.replace(new RegExp(F._streams[te.id].id,"g"),te.id)}),new RTCSessionDescription({type:V.type,sdp:$})}function r(F,V){var Y;let $=V.sdp;return Re(Y=vr(F._reverseStreams||[])).call(Y,te=>{te=F._reverseStreams[te],$=$.replace(new RegExp(te.id,"g"),F._streams[te.id].id)}),new RTCSessionDescription({type:V.type,sdp:$})}var i;if(t.RTCPeerConnection){var o=O(t);if(t.RTCPeerConnection.prototype.addTrack&&65<=o.version)return u(t);var c=t.RTCPeerConnection.prototype.getLocalStreams;t.RTCPeerConnection.prototype.getLocalStreams=function(){let F=c.apply(this);return this._reverseStreams=this._reverseStreams||{},_t(F).call(F,V=>this._reverseStreams[V.id])};var h=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(F){var V;this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},Re(V=F.getTracks()).call(V,Y=>{var $;if(rr($=this.getSenders()).call($,te=>te.track===Y))throw new DOMException("Track already exists.","InvalidAccessError")}),this._reverseStreams[F.id]||(V=new t.MediaStream(F.getTracks()),this._streams[F.id]=V,this._reverseStreams[V.id]=F,F=V),h.apply(this,[F])};var C=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(F){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},C.apply(this,[this._streams[F.id]||F]),delete this._reverseStreams[this._streams[F.id]?this._streams[F.id].id:F.id],delete this._streams[F.id]},t.RTCPeerConnection.prototype.addTrack=function(F,V){var Y,$,te;if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");let ce=en([]).call(arguments,1);if(ce.length!==1||!rr(Y=ce[0].getTracks()).call(Y,Ae=>Ae===F))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(rr($=this.getSenders()).call($,Ae=>Ae.track===F))throw new DOMException("Track already exists.","InvalidAccessError");return this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},(Y=this._streams[V.id])?(Y.addTrack(F),it.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))})):(Y=new t.MediaStream([F]),this._streams[V.id]=Y,this._reverseStreams[Y.id]=V,this.addStream(Y)),rr(te=this.getSenders()).call(te,Ae=>Ae.track===F)},Re(i=["createOffer","createAnswer"]).call(i,function(F){let V=t.RTCPeerConnection.prototype[F];t.RTCPeerConnection.prototype[F]={[F](){const Y=arguments;return arguments.length&&typeof arguments[0]=="function"?V.apply(this,[$=>{$=e(this,$),Y[0].apply(null,[$])},$=>{Y[1]&&Y[1].apply(null,$)},arguments[2]]):V.apply(this,arguments).then($=>e(this,$))}}[F]});var x=t.RTCPeerConnection.prototype.setLocalDescription;t.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=r(this,arguments[0]),x.apply(this,arguments)):x.apply(this,arguments)};var Q=Ar(t.RTCPeerConnection.prototype,"localDescription");mr(t.RTCPeerConnection.prototype,"localDescription",{get(){let F=Q.get.apply(this);return F.type===""?F:e(this,F)}}),t.RTCPeerConnection.prototype.removeTrack=function(F){var V;if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!F._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(F._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let Y;this._streams=this._streams||{},Re(V=vr(this._streams)).call(V,$=>{var te;rr(te=this._streams[$].getTracks()).call(te,ce=>F.track===ce)&&(Y=this._streams[$])}),Y&&(Y.getTracks().length===1?this.removeStream(this._reverseStreams[Y.id]):Y.removeTrack(F.track),this.dispatchEvent(new Event("negotiationneeded")))}}}function n(t){let e=O(t);if(!t.RTCPeerConnection&&t.webkitRTCPeerConnection&&(t.RTCPeerConnection=t.webkitRTCPeerConnection),t.RTCPeerConnection){var r;53>e.version&&Re(r=["setLocalDescription","setRemoteDescription","addIceCandidate"]).call(r,function(o){let c=t.RTCPeerConnection.prototype[o];t.RTCPeerConnection.prototype[o]={[o](){return arguments[0]=new(o==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),c.apply(this,arguments)}}[o]});var i=t.RTCPeerConnection.prototype.addIceCandidate;t.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?78>e.version&&arguments[0]&&arguments[0].candidate===""?it.resolve():i.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),it.resolve())}}}function s(t){k(t,"negotiationneeded",e=>{if(e.target.signalingState==="stable")return e})}function l(t,e,r,i,o){return e=jt.writeRtpDescription(t.kind,e),e+=jt.writeIceParameters(t.iceGatherer.getLocalParameters()),e+=jt.writeDtlsParameters(t.dtlsTransport.getLocalParameters(),r==="offer"?"actpass":o||"active"),e+="a=mid:"+t.mid+`\r
|
|
39
|
+
`,t.rtpSender&&t.rtpReceiver?e+=`a=sendrecv\r
|
|
40
|
+
`:t.rtpSender?e+=`a=sendonly\r
|
|
41
|
+
`:t.rtpReceiver?e+=`a=recvonly\r
|
|
42
|
+
`:e+=`a=inactive\r
|
|
43
|
+
`,t.rtpSender&&(r=t.rtpSender._initialTrackId||t.rtpSender.track.id,t.rtpSender._initialTrackId=r,i="msid:"+(i?i.id:"-")+" "+r+`\r
|
|
44
|
+
`,e=e+("a="+i)+("a=ssrc:"+t.sendEncodingParameters[0].ssrc+" "+i),t.sendEncodingParameters[0].rtx&&(e+="a=ssrc:"+t.sendEncodingParameters[0].rtx.ssrc+" "+i,e+="a=ssrc-group:FID "+t.sendEncodingParameters[0].ssrc+" "+t.sendEncodingParameters[0].rtx.ssrc+`\r
|
|
45
|
+
`)),e+="a=ssrc:"+t.sendEncodingParameters[0].ssrc+" cname:"+jt.localCName+`\r
|
|
46
|
+
`,t.rtpSender&&t.sendEncodingParameters[0].rtx&&(e+="a=ssrc:"+t.sendEncodingParameters[0].rtx.ssrc+" cname:"+jt.localCName+`\r
|
|
47
|
+
`),e}function d(t,e){var r={codecs:[],headerExtensions:[],fecMechanisms:[]},i=function(c,h){c=parseInt(c,10);for(var C=0;C<h.length;C++)if(h[C].payloadType===c||h[C].preferredPayloadType===c)return h[C]},o=function(c,h,C,x){return c=i(c.parameters.apt,C),h=i(h.parameters.apt,x),c&&h&&c.name.toLowerCase()===h.name.toLowerCase()};return t.codecs.forEach(function(c){for(var h=0;h<e.codecs.length;h++){var C=e.codecs[h];if(c.name.toLowerCase()===C.name.toLowerCase()&&c.clockRate===C.clockRate&&(c.name.toLowerCase()!=="rtx"||!c.parameters||!C.parameters.apt||o(c,C,t.codecs,e.codecs))){(C=JSON.parse(JSON.stringify(C))).numChannels=Math.min(c.numChannels,C.numChannels),r.codecs.push(C),C.rtcpFeedback=C.rtcpFeedback.filter(function(x){for(var Q=0;Q<c.rtcpFeedback.length;Q++)if(c.rtcpFeedback[Q].type===x.type&&c.rtcpFeedback[Q].parameter===x.parameter)return!0;return!1});break}}}),t.headerExtensions.forEach(function(c){for(var h=0;h<e.headerExtensions.length;h++){var C=e.headerExtensions[h];if(c.uri===C.uri){r.headerExtensions.push(C);break}}}),r}function A(t,e,r){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"]}}[e][t].indexOf(r)!==-1}function S(t,e){var r=t.getRemoteCandidates().find(function(i){return e.foundation===i.foundation&&e.ip===i.ip&&e.port===i.port&&e.priority===i.priority&&e.protocol===i.protocol&&e.type===i.type});return r||t.addRemoteCandidate(e),!r}function R(t,e){return e=Error(e),e.name=t,e.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[t],e}function y(t){var e;t=t&&t.navigator;let r=Ti(e=t.mediaDevices.getUserMedia).call(e,t.mediaDevices);t.mediaDevices.getUserMedia=function(i){return r(i).catch(o=>it.reject(function(c){return{name:{PermissionDeniedError:"NotAllowedError"}[c.name]||c.name,message:c.message,constraint:c.constraint,toString(){return this.name}}}(o)))}}function _(t){var e;"getDisplayMedia"in t.navigator&&t.navigator.mediaDevices&&(t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||(t.navigator.mediaDevices.getDisplayMedia=Ti(e=t.navigator.getDisplayMedia).call(e,t.navigator)))}function m(t){let e=O(t);if(t.RTCIceGatherer&&(t.RTCIceCandidate||(t.RTCIceCandidate=function(i){return i}),t.RTCSessionDescription||(t.RTCSessionDescription=function(i){return i}),15025>e.version)){let i=Ar(t.MediaStreamTrack.prototype,"enabled");mr(t.MediaStreamTrack.prototype,"enabled",{set(o){i.set.call(this,o);let c=new Event("enabled");c.enabled=o,this.dispatchEvent(c)}})}!t.RTCRtpSender||"dtmf"in t.RTCRtpSender.prototype||mr(t.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=new t.RTCDtmfSender(this):this.track.kind==="video"&&(this._dtmf=null)),this._dtmf}}),t.RTCDtmfSender&&!t.RTCDTMFSender&&(t.RTCDTMFSender=t.RTCDtmfSender);let r=Hp(t,e.version);t.RTCPeerConnection=function(i){return i&&i.iceServers&&(i.iceServers=function(o,c){let h=!1;return o=JSON.parse(ht(o)),Wt(o).call(o,C=>{if(C&&(C.urls||C.url)){var x=C.urls||C.url;C.url&&!C.urls&&L("RTCIceServer.url","RTCIceServer.urls");let Q=typeof x=="string";return Q&&(x=[x]),x=Wt(x).call(x,F=>Vt(F).call(F,"stun:")===0?!1:(F=Gc(F).call(F,"turn")&&!Gc(F).call(F,"turn:[")&&_r(F).call(F,"transport=udp"))&&!h?(h=!0,!0):F&&!h),delete C.url,C.urls=Q?x[0]:x,!!x.length}})}(i.iceServers,e.version),v("ICE servers after filtering:",i.iceServers)),new r(i)},t.RTCPeerConnection.prototype=r.prototype}function I(t){!t.RTCRtpSender||"replaceTrack"in t.RTCRtpSender.prototype||(t.RTCRtpSender.prototype.replaceTrack=t.RTCRtpSender.prototype.setTrack)}function B(t){let e=O(t),r=t&&t.navigator;if(t=t&&t.MediaStreamTrack,r.getUserMedia=function(o,c,h){L("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(o).then(c,h)},!(55<e.version&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){var i;let o=function(h,C,x){C in h&&!(x in h)&&(h[x]=h[C],delete h[C])},c=Ti(i=r.mediaDevices.getUserMedia).call(i,r.mediaDevices);if(r.mediaDevices.getUserMedia=function(h){return typeof h=="object"&&typeof h.audio=="object"&&(h=JSON.parse(ht(h)),o(h.audio,"autoGainControl","mozAutoGainControl"),o(h.audio,"noiseSuppression","mozNoiseSuppression")),c(h)},t&&t.prototype.getSettings){let h=t.prototype.getSettings;t.prototype.getSettings=function(){let C=h.apply(this,arguments);return o(C,"mozAutoGainControl","autoGainControl"),o(C,"mozNoiseSuppression","noiseSuppression"),C}}if(t&&t.prototype.applyConstraints){let h=t.prototype.applyConstraints;t.prototype.applyConstraints=function(C){return this.kind==="audio"&&typeof C=="object"&&(C=JSON.parse(ht(C)),o(C,"autoGainControl","mozAutoGainControl"),o(C,"noiseSuppression","mozNoiseSuppression")),h.apply(this,[C])}}}}function P(t){typeof t=="object"&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&mr(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function M(t){let e=O(t);if(typeof t=="object"&&(t.RTCPeerConnection||t.mozRTCPeerConnection)){var r;!t.RTCPeerConnection&&t.mozRTCPeerConnection&&(t.RTCPeerConnection=t.mozRTCPeerConnection),53>e.version&&Re(r=["setLocalDescription","setRemoteDescription","addIceCandidate"]).call(r,function(h){let C=t.RTCPeerConnection.prototype[h];t.RTCPeerConnection.prototype[h]={[h](){return arguments[0]=new(h==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),C.apply(this,arguments)}}[h]});var i=t.RTCPeerConnection.prototype.addIceCandidate;t.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?68>e.version&&arguments[0]&&arguments[0].candidate===""?it.resolve():i.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),it.resolve())};var o={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},c=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){let[h,C,x]=arguments;return c.apply(this,[h||null]).then(Q=>{if(53>e.version&&!C)try{Re(Q).call(Q,F=>{F.type=o[F.type]||F.type})}catch(F){if(F.name!=="TypeError")throw F;Re(Q).call(Q,(V,Y)=>{Q.set(Y,Dn({},V,{type:o[V.type]||V.type}))})}return Q}).then(C,x)}}}function U(t){if(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender&&!(t.RTCRtpSender&&"getStats"in t.RTCRtpSender.prototype)){var e=t.RTCPeerConnection.prototype.getSenders;e&&(t.RTCPeerConnection.prototype.getSenders=function(){let i=e.apply(this,[]);return Re(i).call(i,o=>o._pc=this),i});var r=t.RTCPeerConnection.prototype.addTrack;r&&(t.RTCPeerConnection.prototype.addTrack=function(){let i=r.apply(this,arguments);return i._pc=this,i}),t.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):it.resolve(new Tr)}}}function K(t){if(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender&&!(t.RTCRtpSender&&"getStats"in t.RTCRtpReceiver.prototype)){var e=t.RTCPeerConnection.prototype.getReceivers;e&&(t.RTCPeerConnection.prototype.getReceivers=function(){let r=e.apply(this,[]);return Re(r).call(r,i=>i._pc=this),r}),k(t,"track",r=>(r.receiver._pc=r.srcElement,r)),t.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function W(t){!t.RTCPeerConnection||"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(e){var r;L("removeStream","removeTrack"),Re(r=this.getSenders()).call(r,i=>{var o;i.track&&_r(o=e.getTracks()).call(o,i.track)&&this.removeTrack(i)})})}function X(t){t.DataChannel&&!t.RTCDataChannel&&(t.RTCDataChannel=t.DataChannel)}function ie(t){if(typeof t=="object"&&t.RTCPeerConnection){if("getLocalStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in t.RTCPeerConnection.prototype)){let e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addStream=function(r){var i,o,c;this._localStreams||(this._localStreams=[]),_r(i=this._localStreams).call(i,r)||this._localStreams.push(r),Re(o=r.getAudioTracks()).call(o,h=>e.call(this,h,r)),Re(c=r.getVideoTracks()).call(c,h=>e.call(this,h,r))},t.RTCPeerConnection.prototype.addTrack=function(r,i){var o;return i&&(this._localStreams?_r(o=this._localStreams).call(o,i)||this._localStreams.push(i):this._localStreams=[i]),e.call(this,r,i)}}"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(e){var r,i,o;this._localStreams||(this._localStreams=[]);let c=Vt(r=this._localStreams).call(r,e);if(c!==-1){An(i=this._localStreams).call(i,c,1);var h=e.getTracks();Re(o=this.getSenders()).call(o,C=>{_r(h).call(h,C.track)&&this.removeTrack(C)})}})}}function se(t){if(typeof t=="object"&&t.RTCPeerConnection&&("getRemoteStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in t.RTCPeerConnection.prototype))){mr(t.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(r){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=r),this.addEventListener("track",this._onaddstreampoly=i=>{var o;Re(o=i.streams).call(o,c=>{var h;this._remoteStreams||(this._remoteStreams=[]),_r(h=this._remoteStreams).call(h,c)||(this._remoteStreams.push(c),h=new Event("addstream"),h.stream=c,this.dispatchEvent(h))})})}});let e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){let r=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(i){var o;Re(o=i.streams).call(o,c=>{var h;r._remoteStreams||(r._remoteStreams=[]),0<=Vt(h=r._remoteStreams).call(h,c)||(r._remoteStreams.push(c),h=new Event("addstream"),h.stream=c,r.dispatchEvent(h))})}),e.apply(r,arguments)}}}function le(t){if(typeof t=="object"&&t.RTCPeerConnection){t=t.RTCPeerConnection.prototype;var e=t.createOffer,r=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,c=t.addIceCandidate;t.createOffer=function(C,x){let Q=e.apply(this,[2<=arguments.length?arguments[2]:arguments[0]]);return x?(Q.then(C,x),it.resolve()):Q},t.createAnswer=function(C,x){let Q=r.apply(this,[2<=arguments.length?arguments[2]:arguments[0]]);return x?(Q.then(C,x),it.resolve()):Q};var h=function(C,x,Q){return C=i.apply(this,[C]),Q?(C.then(x,Q),it.resolve()):C};t.setLocalDescription=h,h=function(C,x,Q){return C=o.apply(this,[C]),Q?(C.then(x,Q),it.resolve()):C},t.setRemoteDescription=h,h=function(C,x,Q){return C=c.apply(this,[C]),Q?(C.then(x,Q),it.resolve()):C},t.addIceCandidate=h}}function ve(t){let e=t&&t.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){var r;t=e.mediaDevices;let o=Ti(r=t.getUserMedia).call(r,t);e.mediaDevices.getUserMedia=c=>o(q(c))}var i;!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=Ti(i=function(o,c,h){e.mediaDevices.getUserMedia(o).then(c,h)}).call(i,e))}function q(t){return t&&t.video!==void 0?Dn({},t,{video:D(t.video)}):t}function ee(t){let e=t.RTCPeerConnection;t.RTCPeerConnection=function(r,i){if(r&&r.iceServers){let o=[];for(let c=0;c<r.iceServers.length;c++){let h=r.iceServers[c];!h.hasOwnProperty("urls")&&h.hasOwnProperty("url")?(L("RTCIceServer.url","RTCIceServer.urls"),h=JSON.parse(ht(h)),h.urls=h.url,delete h.url,o.push(h)):o.push(r.iceServers[c])}r.iceServers=o}return new e(r,i)},t.RTCPeerConnection.prototype=e.prototype,"generateCertificate"in t.RTCPeerConnection&&mr(t.RTCPeerConnection,"generateCertificate",{get:()=>e.generateCertificate})}function ae(t){typeof t=="object"&&t.RTCPeerConnection&&"receiver"in t.RTCTrackEvent.prototype&&!t.RTCTransceiver&&mr(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function _e(t){let e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(r){if(r){var i,o;r.offerToReceiveAudio!==void 0&&(r.offerToReceiveAudio=!!r.offerToReceiveAudio);let c=rr(i=this.getTransceivers()).call(i,h=>h.receiver.track.kind==="audio");r.offerToReceiveAudio===!1&&c?c.direction==="sendrecv"?c.setDirection?c.setDirection("sendonly"):c.direction="sendonly":c.direction==="recvonly"&&(c.setDirection?c.setDirection("inactive"):c.direction="inactive"):r.offerToReceiveAudio!==!0||c||this.addTransceiver("audio"),r.offerToReceiveVideo!==void 0&&(r.offerToReceiveVideo=!!r.offerToReceiveVideo),i=rr(o=this.getTransceivers()).call(o,h=>h.receiver.track.kind==="video"),r.offerToReceiveVideo===!1&&i?i.direction==="sendrecv"?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":i.direction==="recvonly"&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):r.offerToReceiveVideo!==!0||i||this.addTransceiver("video")}return e.apply(this,arguments)}}function fe(t){if(t.RTCIceCandidate&&!(t.RTCIceCandidate&&"foundation"in t.RTCIceCandidate.prototype)){var e=t.RTCIceCandidate;t.RTCIceCandidate=function(r){var i;if(typeof r=="object"&&r.candidate&&Vt(i=r.candidate).call(i,"a=")===0&&((r=JSON.parse(ht(r))).candidate=r.candidate.substr(2)),r.candidate&&r.candidate.length){i=new e(r),r=jt.parseCandidate(r.candidate);let o=Dn(i,r);return o.toJSON=function(){return{candidate:o.candidate,sdpMid:o.sdpMid,sdpMLineIndex:o.sdpMLineIndex,usernameFragment:o.usernameFragment}},o}return new e(r)},t.RTCIceCandidate.prototype=e.prototype,k(t,"icecandidate",r=>(r.candidate&&mr(r,"candidate",{value:new t.RTCIceCandidate(r.candidate),writable:"false"}),r))}}function Ue(t){if(t.RTCPeerConnection){var e=O(t);"sctp"in t.RTCPeerConnection.prototype||mr(t.RTCPeerConnection.prototype,"sctp",{get(){return this._sctp===void 0?null:this._sctp}});var r=function(C){return!C||!C.sdp?!1:(C=jt.splitSections(C.sdp),C.shift(),hf(C).call(C,x=>{var Q;return(x=jt.parseMLine(x))&&x.kind==="application"&&Vt(Q=x.protocol).call(Q,"SCTP")!==-1}))},i=function(C){return C=C.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/),C===null||2>C.length?-1:(C=Si(C[1],10),C!=C?-1:C)},o=function(C){let x=65536;return e.browser==="firefox"&&(x=57>e.version?C===-1?16384:2147483637:60>e.version?e.version===57?65535:65536:2147483637),x},c=function(C,x){let Q=65536;return e.browser==="firefox"&&e.version===57&&(Q=65535),C=jt.matchPrefix(C.sdp,"a=max-message-size:"),0<C.length?Q=Si(C[0].substr(19),10):e.browser==="firefox"&&x!==-1&&(Q=2147483637),Q},h=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,e.browser==="chrome"&&76<=e.version){var{sdpSemantics:C}=this.getConfiguration();C==="plan-b"&&mr(this,"sctp",{get(){return this._sctp===void 0?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){var x=i(arguments[0]);C=o(x),x=c(arguments[0],x);let Q;Q=C===0&&x===0?Number.POSITIVE_INFINITY:C===0||x===0?Math.max(C,x):Math.min(C,x),C={},mr(C,"maxMessageSize",{get:()=>Q}),this._sctp=C}return h.apply(this,arguments)}}}function Te(t){function e(i,o){let c=i.send;i.send=function(){var h=arguments[0];if(h=h.length||h.size||h.byteLength,i.readyState==="open"&&o.sctp&&h>o.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+o.sctp.maxMessageSize+" bytes)");return c.apply(i,arguments)}}if(t.RTCPeerConnection&&"createDataChannel"in t.RTCPeerConnection.prototype){var r=t.RTCPeerConnection.prototype.createDataChannel;t.RTCPeerConnection.prototype.createDataChannel=function(){let i=r.apply(this,arguments);return e(i,this),i},k(t,"datachannel",i=>(e(i.channel,i.target),i))}}function Fe(t){var e;if(t.RTCPeerConnection&&!("connectionState"in t.RTCPeerConnection.prototype)){var r=t.RTCPeerConnection.prototype;mr(r,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),mr(r,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(i){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),i&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=i)},enumerable:!0,configurable:!0}),Re(e=["setLocalDescription","setRemoteDescription"]).call(e,i=>{let o=r[i];r[i]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=c=>{let h=c.target;if(h._lastConnectionState!==h.connectionState){h._lastConnectionState=h.connectionState;let C=new Event("connectionstatechange",c);h.dispatchEvent(C)}return c},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),o.apply(this,arguments)}})}}function $e(t){if(t.RTCPeerConnection){var e=O(t);if(!(e.browser==="chrome"&&71<=e.version)){var r=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(i){var o,c;return i&&i.sdp&&Vt(o=i.sdp).call(o,`
|
|
48
|
+
a=extmap-allow-mixed`)!==-1&&(i.sdp=Wt(c=i.sdp.split(`
|
|
49
|
+
`)).call(c,h=>ba(h).call(h)!=="a=extmap-allow-mixed").join(`
|
|
50
|
+
`)),r.apply(this,arguments)}}}}function Ye(t){t&&od.setUA(t),kn=od.getResult(),t=Ge(kn);var e,r=(e=kn.engine.name==="Blink"?kn.engine.version||"":kn.browser.version||"",e.split(".")[0]);e:switch(kn.os.name){case"Windows":e=kn.os.version?kn.os.name+" "+kn.os.version:kn.os.name;break e;default:e=kn.os.name||""}return{name:t,version:r,os:e,osVersion:kn.os.version}}function Ge(t){if(t.engine.name==="Blink")return ir.CHROME;switch(t.browser.name){case"Chrome Headless":case"Chrome":case"Chromium":return ir.CHROME;case"Safari":case"Mobile Safari":return ir.SAFARI;case"Edge":return ir.EDGE;case"Firefox":return ir.FIREFOX;case"QQBrowser":return ir.QQ;case"Opera":return ir.OPERA;case"WeChat":return ir.WECHAT;default:return t.browser.name||""}}function st(){let t=Ye();return!!(kn.engine.name==="WebKit"&&t.os===tn.MAC_OS&&navigator.maxTouchPoints&&0<navigator.maxTouchPoints&&t.name!==ir.SAFARI||qt()&&t.name!==ir.SAFARI)}function Ft(){var t=Ye();return!!(st()&&(t.os===tn.MAC_OS||t.os===tn.IOS&&((t=kn.os.version&&kn.os.version.split("."))&&Number(t[0])===14&&t[1]&&3<=Number(t[1])||t&&14<Number(t[0]))))}function Bt(){return Ye().name===ir.CHROME}function Pt(){return Ye().name===ir.SAFARI}function Dt(){return Ye().name===ir.FIREFOX}function qt(){return Ye().os===tn.IOS}function Or(){var t=Ye();return t.os!==tn.IOS||!t.osVersion?!1:(t=t.osVersion.split("."),Number(t[0])===15)}function Ci(){var t=Ye();return t.os!==tn.IOS||!t.osVersion?!1:(t=t.osVersion.split("."),Number(t[0])===15&&Number(t[1])===0)}function Li(){var t=Ye();return t.os!==tn.IOS||!t.osVersion?!1:(t=t.osVersion.split("."),Number(t[0])===15&&1<=Number(t[1]))}function dr(){return Pt()&&0<navigator.maxTouchPoints}function Qr(){return window.navigator.appVersion&&window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)!==null&&35>=window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)[1]}function Ji(){let t=Ye();return t.name===ir.EDGE||t.name===ir.SAFARI?!1:!!navigator.userAgent.toLocaleLowerCase().match(/chrome\/[\d]./i)}function kr(t){return typeof t=="string"?Dn({},Wp[t]):t}function Bi(t){return typeof t=="string"?Dn({},jp[t]):t}function gi(t){return typeof t=="string"?Dn({},Vp[t]):t}function Ei(t){return typeof t=="string"?Dn({},Yp[t]):t}function Gr(t,e){var r;_r(r=vr(Xe)).call(r,t)&&(Xe[t]=e)}function Hr(t,e,r){return{sampleRate:t,stereo:e,bitrate:r}}function wt(t,e,r,i,o){return{width:t,height:e,frameRate:r,bitrateMin:i,bitrateMax:o}}function Ir(t,e,r,i,o){return{width:{max:t},height:{max:e},frameRate:r,bitrateMin:i,bitrateMax:o}}function Ui(t,e){return{numSpatialLayers:t,numTemporalLayers:e}}function on(t){return nc.call(t)==="[object Array]"}function Gn(t){return t!==null&&typeof t=="object"}function an(t){return nc.call(t)==="[object Function]"}function _i(t,e){if(t!=null)if(typeof t!="object"&&(t=[t]),on(t))for(var r=0,i=t.length;r<i;r++)e.call(null,t[r],r,t);else for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.call(null,t[r],r,t)}function _n(t){return encodeURIComponent(t).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Cn(){this.handlers=[]}function Ni(t,e){!Jt.isUndefined(t)&&Jt.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function yn(t){this.defaults=t,this.interceptors={request:new wf,response:new wf}}function as(t){this.message=t}function Hn(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var r=this;t(function(i){r.reason||(r.reason=new bf(i),e(r.reason))})}function Hs(t){t=new Vl(t);var e=Tf(Vl.prototype.request,t);return Jt.extend(e,Vl.prototype,t),Jt.extend(e,t),e}function Ks(){let t=new Date;return t.toTimeString().split(" ")[0]+":"+t.getMilliseconds()}function cs(t,e){if(typeof t!="boolean")throw new ue(oe.INVALID_PARAMS,"Invalid ".concat(e,": The value is of the boolean type."))}function ui(t,e,r){var i;if(!_r(r).call(r,t))throw new ue(oe.INVALID_PARAMS,ne(i="".concat(e," can only be set as ")).call(i,ht(r)))}function Xt(t,e,r=1,i=1e4,o=!0){if(t<r||t>i||o&&(typeof t!="number"||t%1!=0)){var c,h;throw new ue(oe.INVALID_PARAMS,ne(c=ne(h="invalid ".concat(e,": the value range is [")).call(h,r,", ")).call(c,i,"]. integer only"))}}function Ur(t,e,r=1,i=255,o=!0){if(t==null)throw new ue(oe.INVALID_PARAMS,"".concat(e||"param"," cannot be empty"));var c,h,C;if(!Lo(t,r,i,o))throw new ue(oe.INVALID_PARAMS,ne(c=ne(h=ne(C="Invalid ".concat(e||"string param",": Length of the string: [")).call(C,r,",")).call(h,i,"].")).call(c,o?" ASCII characters only.":""))}function Rs(t,e){if(!so(t))throw new ue(oe.INVALID_PARAMS,"".concat(e," should be an array"))}function Xn(t){if(typeof t!="string"||!/^[a-zA-Z0-9 !#\$%&\(\)\+\-:;<=\.>\?@\[\]\^_\{\}\|~,]{1,64}$/.test(t))throw z.error("Invalid Channel Name ".concat(t)),new ue(oe.INVALID_PARAMS,"The length must be within 64 bytes. The supported characters: a-z,A-Z,0-9,space,!, #, $, %, &, (, ), +, -, :, ;, <, =, ., >, ?, @, [, ], ^, _, {, }, |, ~, ,")}function ho(t){var e;if(!(typeof t=="number"&&Math.floor(t)===t&&0<=t&&4294967295>=t||Lo(t,1,255)))throw z.error(ne(e="Invalid UID ".concat(t," ")).call(e,typeof t)),new ue(oe.INVALID_PARAMS,"[String uid] Length of the string: [1,255]. ASCII characters only. [Number uid] The value range is [0,10000]");typeof t=="string"&&z.warning("You input a string as the user ID, to ensure better end-user experience, Agora highly suggests not using a string as the user ID.")}function Lo(t,e=1,r=255,i=!0){if(e=typeof t=="string"&&t.length<=r&&t.length>=e){if(!(i=!i))e:if(typeof t!="string")i=!1;else{for(i=0;i<t.length;i+=1)if(e=t.charCodeAt(i),0>e||255<e){i=!1;break e}i=!0}e=i}return e}function sa(t){return Ur(t.reportId,"params.reportId",0,100,!1),Ur(t.category,"params.category",0,100,!1),Ur(t.event,"params.event",0,100,!1),Ur(t.label,"params.label",0,100,!1),Xt(t.value,"params.value",-9007199254740991,9007199254740991,!1),!0}function Do(t){return Xt(t.timeout,"config.timeout",0,1e5),Xt(t.timeoutFactor,"config.timeoutFactor",0,100,!1),Xt(t.maxRetryCount,"config.maxRetryConfig",0,1/0),Xt(t.maxRetryTimeout,"config.maxRetryTimeout",0,1/0),!0}function oa(t){if(!so(t)||1>t.length)return!1;try{Re(t).call(t,e=>{if(!e.urls)throw Error()})}catch(e){return!1}return!0}function bo(t){return Ur(t.turnServerURL,"turnServerURL"),Ur(t.username,"username"),Ur(t.password,"password"),t.udpport&&Xt(t.udpport,"udpport",1,99999,!0),t.forceturn&&cs(t.forceturn,"forceturn"),t.security&&cs(t.security,"security"),t.tcpport&&Xt(t.tcpport,"tcpport",1,99999,!0),!0}function Oo(t){return t.level!==void 0&&ui(t.level,"level",[1,2,3]),!0}function Bo(t,e){Ur(t.url,"".concat(e,".url"),1,1e3,!1),t.x==null||Xt(t.x,"".concat(e,".x"),0,1e4),t.y==null||Xt(t.y,"".concat(e,".y"),0,1e4),t.width==null||Xt(t.width,"".concat(e,".width"),0,1e4),t.height==null||Xt(t.height,"".concat(e,".height"),0,1e4),t.zOrder==null||Xt(t.zOrder,"".concat(e,".zOrder"),0,255),t.alpha==null||Xt(t.alpha,"".concat(e,".alpha"),0,1,!1)}function No(t){if(!t.channelName)throw new ue(oe.INVALID_PARAMS,"invalid channelName in info");if(!t.uid||typeof t.uid!="number")throw new ue(oe.INVALID_PARAMS,"invalid uid in info, uid must be a number");return t.token&&Ur(t.token,"info.token",1,2047),ho(t.uid),Xn(t.channelName),!0}function Ws(t){return ui(t,"mediaSource",["screen","window","application"]),!0}function fo(t,e){var r=vr(t);if(xr){var i=xr(t);e&&(i=Wt(i).call(i,function(o){return Ar(t,o).enumerable})),r.push.apply(r,i)}return r}function cn(t,e,r){return new it((i,o)=>{e.timeout=e.timeout||Xe.HTTP_CONNECT_TIMEOUT,e.responseType=e.responseType||"json",e.data&&!r?(e.data=ht(e.data),ql+=zs(e.data)):r&&(e.data.size?ql+=e.data.size:e.data instanceof FormData?ql+=function(c){let h=0;return/DingTalk/i.test(navigator.userAgent)&&c.realFormData&&(c=c.realFormData),Re(c).call(c,C=>{h+=typeof C=="string"?zs(C):C.size}),h+138}(e.data):ql+=zs(ht(e.data))),e.headers=e.headers||{},e.headers["Content-Type"]=e.headers["Content-Type"]||"application/json",e.method="POST",e.url=t,So.request(e).then(c=>{typeof c.data=="string"?Id+=zs(c.data):c.data instanceof ArrayBuffer||c.data instanceof Uint8Array?Id+=c.data.byteLength:Id+=zs(ht(c.data)),i(c.data)}).catch(c=>{So.isCancel(c)?o(new ue(oe.OPERATION_ABORTED,"cancel token canceled")):c.code==="ECONNABORTED"?o(new ue(oe.NETWORK_TIMEOUT,c.message)):c.response?o(new ue(oe.NETWORK_RESPONSE_ERROR,c.response.status)):o(new ue(oe.NETWORK_ERROR,c.message))})})}function ls(t,e){return Ee(this,null,function*(){let r=new Blob([e.data],{type:"buffer"});return yield cn(t,function(i){for(var o=1;o<arguments.length;o++){var c,h=arguments[o]!=null?arguments[o]:{};if(o%2)Re(c=fo(Object(h),!0)).call(c,function(x){Qn(i,x,h[x])});else if(Pr)Un(i,Pr(h));else{var C;Re(C=fo(Object(h))).call(C,function(x){mr(i,x,Ar(h,x))})}}return i}({},e,{data:r,headers:{"Content-Type":"application/octet-stream"}}),!0)})}function yi(t,e,r,i){let o=Dn({},Ki,i),c=o.timeout,h=()=>Ee(this,null,function*(){yield zi(c),c*=o.timeoutFactor,c=Math.min(o.maxRetryTimeout,c)}),C=!1;return i=new it((x,Q)=>Ee(this,null,function*(){e=e||(()=>!1),r=r||(()=>!0);for(let F=0;F<o.maxRetryCount;F+=1){if(C)return Q(new ue(oe.OPERATION_ABORTED));try{const V=yield t();if(!e(V,F)||F+1===o.maxRetryCount)return x(V);yield h()}catch(V){if(!r(V,F)||F+1===o.maxRetryCount)return Q(V);yield h()}}})),i.cancel=()=>C=!0,i}function Po(t,e){var r=vr(t);if(xr){var i=xr(t);e&&(i=Wt(i).call(i,function(o){return Ar(t,o).enumerable})),r.push.apply(r,i)}return r}function Jr(t){for(var e=1;e<arguments.length;e++){var r,i=arguments[e]!=null?arguments[e]:{};if(e%2)Re(r=Po(Object(i),!0)).call(r,function(c){Qn(t,c,i[c])});else if(Pr)Un(t,Pr(i));else{var o;Re(o=Po(Object(i))).call(o,function(c){mr(t,c,Ar(i,c))})}}return t}function us(t={report:ke}){return function(e,r,i){let o=e[r];if(typeof o=="function"){let c=e.constructor.name==="AgoraRTCClient"?"Client":e.constructor.name;i.value=function(...h){var C;let x=t.report.reportApiInvoke(this._sessionId||null,{name:ne(C="".concat(c,".")).call(C,r),options:h,tag:bt.TRACER});try{let Q=o.apply(this,h);return x.onSuccess(),Q}catch(Q){throw x.onError(Q),Q}}}return i}}function Ao(t={report:ke}){return function(e,r,i){let o=e[r];if(typeof o=="function"){let c=e.constructor.name==="AgoraRTCClient"?"Client":e.constructor.name;i.value=function(...h){return Ee(this,null,function*(){var C;let x=t.report.reportApiInvoke(this._sessionId||null,{name:ne(C="".concat(c,".")).call(C,r),options:h,tag:bt.TRACER});try{let Q=yield o.apply(this,h);return x.onSuccess(),Q}catch(Q){throw x.onError(Q),Q}})}}return i}}function ws(){$f?(z.info("create audio context"),lo=new $f,hr.curState=lo.state,lo.onstatechange=()=>{var t;hr.prevState=hr.curState,hr.curState=lo?lo.state:void 0,z.debug("AudioContext State Change",ne(t="".concat(hr.prevState,"=>")).call(t,hr.curState)),(qt()||dr())&&hr.prevState==="running"&&hr.curState==="interrupted"&&(z.info("ios-interruption-start"),hr.emit(Wi.IOS_INTERRUPTION_START)),(qt()||dr())&&hr.prevState==="interrupted"&&hr.curState==="running"&&(z.info("ios-interruption-end"),hr.emit(Wi.IOS_INTERRUPTION_END)),hr.emit("state-change")},function(t){return Ee(this,null,function*(){function e(te){t.state==="running"?r(!1):qt()||dr()?t.state==="suspended"&&(r(!0),te?t.resume().then(i,i):r(!1)):t.state!=="closed"&&(r(!0),te?t.resume().then(i,i):r(!1))}function r(te){if(V!==te){V=te;for(let ce=0,Ae=Q;ce<Ae.length;ce+=1){let Me=Ae[ce];te?window.addEventListener(Me,o,{capture:!0,passive:!0}):window.removeEventListener(Me,o,{capture:!0,passive:!0})}}}function i(){e(!1)}function o(){e(!0)}function c(te){if(!$)if(F.paused)if(te){h(!1),$=!0,te=void 0;try{(te=F.play())?te.then(C,C):(F.addEventListener("playing",C),F.addEventListener("abort",C),F.addEventListener("error",C))}catch(ce){C()}}else h(!0);else h(!1)}function h(te){if(Y!==te){Y=te;for(let ce=0,Ae=Q;ce<Ae.length;ce++){let Me=Ae[ce];te?window.addEventListener(Me,x,{capture:!0,passive:!0}):window.removeEventListener(Me,x,{capture:!0,passive:!0})}}}function C(){F.removeEventListener("playing",C),F.removeEventListener("abort",C),F.removeEventListener("error",C),$=!1,c(!1)}function x(){c(!0)}let Q="click contextmenu auxclick dblclick mousedown mouseup touchend keydown keyup".split(" "),F,V=!1,Y=!1,$=!1;if(qt()){let te=t.createMediaStreamDestination(),ce=document.createElement("div");ce.innerHTML="<audio x-webkit-airplay='deny'></audio>",F=ce.children.item(0),F.controls=!1,F.disableRemotePlayback=!0,F.preload="auto",F.srcObject=te.stream,c(!0)}hr.on("state-change",function(){e(!0)}),e(!1)})}(lo)):z.error("your browser is not support web audio")}function ln(){if(!lo&&(ws(),!lo))throw new ue(oe.NOT_SUPPORTED,"can not create audio context");return lo}function Ls(t){if(!function(){if(Sd!==null)return Sd;var i=ln();let o=i.createBufferSource(),c=i.createGain();i=i.createGain(),o.connect(c),o.connect(i),o.disconnect(c),i=!1;try{o.disconnect(c)}catch(h){i=!0}return o.disconnect(),Sd=i,i}()){z.debug("polyfill audio node");var e=t.connect,r=t.disconnect;t.connect=(i,o,c)=>{var h;return t._inputNodes||(t._inputNodes=[]),_r(h=t._inputNodes).call(h,i)||(i instanceof AudioNode?(t._inputNodes.push(i),e.call(t,i,o,c)):e.call(t,i,o)),t},t.disconnect=(i,o,c)=>{r.call(t),i?Fi(t._inputNodes,i):t._inputNodes=[];for(let h of t._inputNodes)e.call(t,h)}}}function js(t,e){let r=1/e,i=ln(),o=i.createGain();o.gain.value=0,o.connect(i.destination);let c=!1,h=()=>{if(c)return void(o=null);const C=i.createOscillator();C.onended=h,C.connect(o),C.start(0),C.stop(i.currentTime+r),t(i.currentTime)};return h(),()=>{c=!0}}function Vs(t,e){return Ee(this,null,function*(){let r=(i,o)=>i?typeof i!="number"?i.max||i.exact||i.ideal||i.min||o:i:o;return t={audio:!1,video:{mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxHeight:r(e.height,1080),maxWidth:r(e.width,1920)}}},e.frameRate&&typeof e.frameRate!="number"?(t.video.mandatory.maxFrameRate=e.frameRate.max,t.video.mandatory.minFrameRate=e.frameRate.min):typeof e.frameRate=="number"&&(t.video.mandatory.maxFrameRate=e.frameRate),yield navigator.mediaDevices.getUserMedia(t)})}function xo(t){return Ee(this,null,function*(){let e=yield function(r){return new it((i,o)=>{const c=document.createElement("div");c.innerText="share screen",c.setAttribute("style","text-align: center; height: 25px; line-height: 25px; border-radius: 4px 4px 0 0; background: #D4D2D4; border-bottom: solid 1px #B9B8B9;");const h=document.createElement("div");h.setAttribute("style","width: 100%; height: 500px; padding: 15px 25px ; box-sizing: border-box;");const C=document.createElement("div");C.innerText="Agora Web Screensharing wants to share the contents of your screen with webdemo.agorabeckon.com. Choose what you'd like to share.",C.setAttribute("style","height: 12%;");const x=document.createElement("div");x.setAttribute("style","width: 100%; height: 80%; background: #FFF; border: solid 1px #CBCBCB; display: flex; flex-wrap: wrap; justify-content: space-around; overflow-y: scroll; padding: 0 15px; box-sizing: border-box;");const Q=document.createElement("div");Q.setAttribute("style","text-align: right; padding: 16px 0;");const F=document.createElement("button");F.innerHTML="cancel",F.setAttribute("style","width: 85px;"),F.onclick=()=>{document.body.removeChild(V);const Y=Error("NotAllowedError");Y.name="NotAllowedError",o(Y)},Q.appendChild(F),h.appendChild(C),h.appendChild(x),h.appendChild(Q);const V=document.createElement("div");V.setAttribute("style","position: fixed; z-index: 99999999; top: 50%; left: 50%; width: 620px; height: 525px; background: #ECECEC; border-radius: 4px; -webkit-transform: translate(-50%,-50%); transform: translate(-50%,-50%);"),V.appendChild(c),V.appendChild(h),document.body.appendChild(V),_t(r).call(r,Y=>{if(Y.id){const $=document.createElement("div");$.setAttribute("style","width: 30%; height: 160px; padding: 20px 0; text-align: center;box-sizing: content-box;");let te=Y.thumbnail;const{width:ce}=te.getSize();1920<ce&&(te=te.resize({width:1920})),$.innerHTML='<div style="height: 120px; display: table-cell; vertical-align: middle;"><img style="width: 100%; background: #333333; box-shadow: 1px 1px 1px 1px rgba(0, 0, 0, 0.2);" src='+te.toDataURL()+' /></div><span style=" height: 40px; line-height: 40px; display: inline-block; width: 70%; word-break: keep-all; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">'+(Y.name.replace(/[\u00A0-\u9999<>&]/g,function(Ae){return"&#"+Ae.charCodeAt(0)+";"})+"</span>"),$.onclick=()=>{document.body.removeChild(V),i(Y.id)},x.appendChild($)}})})}(yield go(t.mediaSource));return yield Vs(e,t)})}function go(t){return Ee(this,null,function*(){let e=["window","screen"];t!=="application"&&t!=="window"||(e=["window"]),t==="screen"&&(e=["screen"]);let r=Mo();if(!r)throw new ue(oe.ELECTRON_IS_NULL);t=null;try{t=r.desktopCapturer.getSources({types:e})}catch(i){t=null}t&&t.then||(t=new it((i,o)=>{r.desktopCapturer.getSources({types:e},(c,h)=>{c?o(c):i(h)})}));try{return yield t}catch(i){throw new ue(oe.ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR,i.toString())}})}function Mo(){if(Zl)return Zl;try{return Zl=window.require("electron"),Zl}catch(t){return null}}function Ii(t,e){return Ee(this,null,function*(){let r=0,i=null;for(;2>r;)try{i=yield Ys(t,e,0<r);break}catch(h){var o,c;if(h instanceof ue)throw z.error(ne(c="[".concat(e,"] ")).call(c,h.toString())),h;let C=Ds(h.name||h.code||h,h.message);if(C.code===oe.MEDIA_OPTION_INVALID)z.debug("[".concat(e,"] detect media option invalid, retry")),r+=1,yield zi(500);else throw z.error(ne(o="[".concat(e,"] ")).call(o,C.toString())),C}if(!i)throw new ue(oe.UNEXPECTED_ERROR,"can not find stream after getUserMedia");return i})}function Ys(t,e,r){return Ee(this,null,function*(){if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new ue(oe.NOT_SUPPORTED,"can not find getUserMedia");r&&(t.video&&(delete t.video.width,delete t.video.height),t.screen&&(delete t.screen.width,delete t.screen.height));var i=Nr;if(r=new MediaStream,t.audioSource&&r.addTrack(t.audioSource),t.videoSource&&r.addTrack(t.videoSource),!t.audio&&!t.video&&!t.screen)return z.debug("Using Video Source/ Audio Source"),r;if(t.screen)if(Mo())t.screen.sourceId?bs(r,yield Vs(t.screen.sourceId,t.screen)):bs(r,yield xo(t.screen));else if(Bt()&&t.screen.extensionId&&t.screen.mandatory){if(!i.getStreamFromExtension)throw new ue(oe.NOT_SUPPORTED,"This browser does not support screen sharing");z.debug("[".concat(e,'] Screen access on chrome stable, looking for extension"'));var o=yield(c=t.screen.extensionId,h=e,new it((x,Q)=>{try{chrome.runtime.sendMessage(c,{getStream:!0},V=>{if(!V||!V.streamId)return z.error("[".concat(h,"] No response from Chrome Plugin. Plugin not installed properly"),V),void Q(new ue(oe.CHROME_PLUGIN_NO_RESPONSE,"No response from Chrome Plugin. Plugin not installed properly"));x(V.streamId)})}catch(V){var F;z.error(ne(F="[".concat(h,"] AgoraRTC screensharing plugin is not accessible(")).call(F,c,")"),V.toString()),Q(new ue(oe.CHROME_PLUGIN_NOT_INSTALL))}}));t.screen.mandatory.chromeMediaSourceId=o,bs(r,yield navigator.mediaDevices.getUserMedia({video:{mandatory:t.screen.mandatory}}))}else if(i.getDisplayMedia)t.screen.mediaSource&&Ws(t.screen.mediaSource),o={width:t.screen.width,height:t.screen.height,frameRate:t.screen.frameRate,displaySurface:t.screen.mediaSource==="screen"?"monitor":t.screen.mediaSource},z.debug("[".concat(e,"] getDisplayMedia:"),ht({video:o,audio:!!t.screenAudio})),bs(r,yield navigator.mediaDevices.getDisplayMedia({video:o,audio:!!t.screenAudio}));else{if(!Dt())throw z.error("[".concat(e,"] This browser does not support screenSharing")),new ue(oe.NOT_SUPPORTED,"This browser does not support screen sharing");t.screen.mediaSource&&Ws(t.screen.mediaSource),i={video:{mediaSource:t.screen.mediaSource,width:t.screen.width,height:t.screen.height,frameRate:t.screen.frameRate}},z.debug(ne(o="[".concat(e,"] getUserMedia: ")).call(o,ht(i))),bs(r,yield navigator.mediaDevices.getUserMedia(i))}var c,h;if(!t.video&&!t.audio)return r;t={video:t.video,audio:t.audio},z.debug("[".concat(e,"] GetUserMedia"),ht(t)),Ye();let C;e=null,(Pt()||qt()||st())&&(e=yield Td.lock());try{C=yield navigator.mediaDevices.getUserMedia(t)}catch(x){throw e&&e(),x}return t.audio&&(rA=!0),t.video&&(iA=!0),bs(r,C),e&&e(),r})}function Ds(t,e){switch(t){case"Starting video failed":case"OverconstrainedError":case"TrackStartError":var r;return new ue(oe.MEDIA_OPTION_INVALID,ne(r="".concat(t,": ")).call(r,e));case"NotFoundError":case"DevicesNotFoundError":var i;return new ue(oe.DEVICE_NOT_FOUND,ne(i="".concat(t,": ")).call(i,e));case"NotSupportedError":var o;return new ue(oe.NOT_SUPPORTED,ne(o="".concat(t,": ")).call(o,e));case"NotReadableError":var c;return new ue(oe.NOT_READABLE,ne(c="".concat(t,": ")).call(c,e));case"InvalidStateError":case"NotAllowedError":case"PERMISSION_DENIED":case"PermissionDeniedError":var h;return new ue(oe.PERMISSION_DENIED,ne(h="".concat(t,": ")).call(h,e));case"ConstraintNotSatisfiedError":var C;return new ue(oe.CONSTRAINT_NOT_SATISFIED,ne(C="".concat(t,": ")).call(C,e));default:var x;return z.error("getUserMedia unexpected error",t),new ue(oe.UNEXPECTED_ERROR,ne(x="".concat(t,": ")).call(x,e))}}function bs(t,e){let r=t.getVideoTracks()[0],i=t.getAudioTracks()[0],o=e.getVideoTracks()[0];(e=e.getAudioTracks()[0])&&(i&&t.removeTrack(i),t.addTrack(e)),o&&(r&&t.removeTrack(r),t.addTrack(o))}function aa(){if(!Rd){let t=e=>{e.preventDefault(),Rd=!1,document.body.removeEventListener("touchstart",t,!0),document.body.removeEventListener("mousedown",t,!0)};Rd=!0,document.body.addEventListener("touchstart",t,!0),document.body.addEventListener("mousedown",t,!0),oA.emit("autoplay-failed")}}function or(){return function(t,e,r){let i=t[e];typeof i=="function"&&(r.value=function(...o){this._isClosed&&new ue(oe.INVALID_OPERATION,"[".concat(this.getTrackId(),"] cannot operate a closed track")).print("warning");let c=i.apply(this,o);return c instanceof it?new it((h,C)=>{c.then(h).catch(C)}):c})}}function ds(t,e){var r=vr(t);if(xr){var i=xr(t);e&&(i=Wt(i).call(i,function(o){return Ar(t,o).enumerable})),r.push.apply(r,i)}return r}function Js(t){for(var e=1;e<arguments.length;e++){var r,i=arguments[e]!=null?arguments[e]:{};if(e%2)Re(r=ds(Object(i),!0)).call(r,function(c){Qn(t,c,i[c])});else if(Pr)Un(t,Pr(i));else{var o;Re(o=ds(Object(i))).call(o,function(c){mr(t,c,Ar(i,c))})}}return t}function ko(t,e){var r=vr(t);if(xr){var i=xr(t);e&&(i=Wt(i).call(i,function(o){return Ar(t,o).enumerable})),r.push.apply(r,i)}return r}function In(t){for(var e=1;e<arguments.length;e++){var r,i=arguments[e]!=null?arguments[e]:{};if(e%2)Re(r=ko(Object(i),!0)).call(r,function(c){Qn(t,c,i[c])});else if(Pr)Un(t,Pr(i));else{var o;Re(o=ko(Object(i))).call(o,function(c){mr(t,c,Ar(i,c))})}}return t}function ca(t,e){var r=vr(t);if(xr){var i=xr(t);e&&(i=Wt(i).call(i,function(o){return Ar(t,o).enumerable})),r.push.apply(r,i)}return r}function Uo(t){for(var e=1;e<arguments.length;e++){var r,i=arguments[e]!=null?arguments[e]:{};if(e%2)Re(r=ca(Object(i),!0)).call(r,function(c){Qn(t,c,i[c])});else if(Pr)Un(t,Pr(i));else{var o;Re(o=ca(Object(i))).call(o,function(c){mr(t,c,Ar(i,c))})}}return t}function _a(t){if(!t.address||!t.tcp)throw new ue(oe.UNEXPECTED_RESPONSE,"Invalid address format ".concat(t));return t.address.match(/^[\.:\d]+$/)?"".concat(t.address.replace(/[^\d]/g,"-"),".edge.agora.io"):(z.info("Cannot recognized as IP address ".concat(t.address,". Used As Host instead")),ne(e="".concat(t.address,":")).call(e,t.tcp));var e}function Fo(t,e){var r;let i=Xe.GATEWAY_DOMAINS,o=i[1]&&Vt(e).call(e,i[1])!==-1?1:0;return t.addresses=t.addresses||[],{gatewayAddrs:_t(r=t.addresses).call(r,c=>{var h,C,x;return c.ip.match(/^[\.:\d]+$/)?ne(h=ne(C="".concat(c.ip.replace(/[^\d]/g,"-"),".")).call(C,i[o++%i.length],":")).call(h,c.port):(z.info("Cannot recognized as IP address ".concat(c.ip,". Used As Host instead")),ne(x="".concat(c.ip,":")).call(x,c.port))}),uid:t.uid,cid:t.cid,vid:t.detail&&t.detail[8],uni_lbs_ip:t.detail&&t.detail[1],res:t,csIp:t.detail&&t.detail[502]}}function Zn(t){return typeof t=="number"?t:t.exact||t.ideal||t.max||t.min||0}function po(t,e){let r=t.videoSend[0];return r?(e=e&&e.videoSend[0]?e.videoSend[0].inputFrame:void 0,t={id:be(10,""),timestamp:new Date(t.timestamp).toISOString(),mediaType:"video",type:"ssrc",ssrc:r.ssrc.toString()},r.inputFrame&&(e&&r.inputFrame.height===e.height||(t.A_fhi=r.inputFrame.height?r.inputFrame.height.toString():"0"),e&&r.inputFrame.width===e.width||(t.A_fwi=r.inputFrame.width?r.inputFrame.width.toString():"0"),e&&r.inputFrame.frameRate===e.frameRate||(t.A_fri=r.inputFrame.frameRate?r.inputFrame.frameRate.toString():"0")),t):null}function Qo(t){return 0<=t&&.17>t?1:.17<=t&&.36>t?2:.36<=t&&.59>t?3:.59<=t&&1>=t?4:1<t?5:0}function Ca(t,e){let r={};return t.height&&t.width&&(e=e._videoHeight||e.getMediaStreamTrack(!0).getSettings().height,r.scaleResolutionDownBy=e?e/Zn(t.height):4),r.maxFramerate=t.framerate?Zn(t.framerate):void 0,r.maxBitrate=t.bitrate?1e3*t.bitrate:void 0,r}function Go(t,e){var r;let i,o;switch(e){case Fn.CHOOSE_SERVER:i=4096,e="choose server";break;case Fn.CLOUD_PROXY:i=1048576,e="proxy";break;case Fn.CLOUD_PROXY_5:i=4194304,e="proxy5";break;default:throw new ue(oe.UNEXPECTED_ERROR,"multi unlibs response transformer get unknown service id",{csIp:t.detail&&t.detail[502],retry:!1})}if(Re(r=t.response_body).call(r,c=>{var h;c.buffer&&c.buffer.flag===i&&(o={code:c.buffer.code,addresses:_t(h=c.buffer.edges_services).call(h,C=>Uo({},C,{ticket:c.buffer.cert})),server_ts:t.enter_ts,uid:c.buffer.uid,cid:c.buffer.cid,cname:c.buffer.cname,detail:Uo({},c.buffer.detail,{},t.detail),flag:c.buffer.flag,opid:t.opid})}),!o)throw new ue(oe.MULTI_UNILBS_RESPONSE_ERROR,"cannot parse response ".concat(e," from multi unilbs response"),{csIp:t.detail&&t.detail[502]});return o}function Fa(t){var e;return _t(e=t.addresses).call(e,r=>({address:r.ip,tcpport:r.port,udpport:r.port,username:rn.username,password:rn.password}))}function Ho(t,e){var r=vr(t);if(xr){var i=xr(t);e&&(i=Wt(i).call(i,function(o){return Ar(t,o).enumerable})),r.push.apply(r,i)}return r}function la(t){for(var e=1;e<arguments.length;e++){var r,i=arguments[e]!=null?arguments[e]:{};if(e%2)Re(r=Ho(Object(i),!0)).call(r,function(c){Qn(t,c,i[c])});else if(Pr)Un(t,Pr(i));else{var o;Re(o=Ho(Object(i))).call(o,function(c){mr(t,c,Ar(i,c))})}}return t}function zs(t){return window.TextEncoder?new TextEncoder().encode(t).length:t.length}function zi(t){return new it(e=>{window.setTimeout(e,t)})}function Qa(t){let e=new ue(oe.TIMEOUT,"timeout");return new it((r,i)=>{window.setTimeout(()=>i(e),t)})}function be(t=7,e){var r,i;let o=Math.random().toString(16).substr(2,t).toLowerCase();return o.length===t?ne(r="".concat(e)).call(r,o):ne(i="".concat(e)).call(i,o)+be(t-o.length,"")}function xe(t){return new it((e,r)=>{let i=!1,o=document.createElement("video");o.setAttribute("autoplay",""),o.setAttribute("muted",""),o.muted=!0,o.autoplay=!0,o.setAttribute("playsinline",""),o.setAttribute("style","position: fixed; top: 0; left: 0; width: 1px; height: 1px"),document.body.appendChild(o),r=qt()?"canplay":"playing",o.addEventListener(r,()=>{let c=o.videoWidth,h=o.videoHeight;!c&&Dt()||(i=!0,o.srcObject=null,o.remove(),e([c,h]))}),o.srcObject=new MediaStream([t]),o.play().catch($l),_s(()=>{i||(o.srcObject=null,o.remove(),e([o.videoWidth,o.videoHeight]))},4e3)})}function qi(t){return it.all(_t(t).call(t,e=>e.then(r=>{throw r},r=>r))).then(e=>{throw e},e=>e)}function Kr(t,e,...r){return t.getListeners(e).length===0?it.reject(new ue(oe.UNEXPECTED_ERROR,"can not emit promise")):new it((i,o)=>{t.emit(e,...r,i,o)})}function di(t,e,...r){return t.getListeners(e).length===0?it.resolve():Kr(t,e,...r)}function zr(t,e,...r){return t.getListeners(e).length===0?null:un(t,e,...r)}function un(t,e,...r){let i=null,o=null;if(t.emit(e,...r,c=>{i=c},c=>{o=c}),o!==null)throw o;if(i===null)throw new ue(oe.UNEXPECTED_ERROR,"handler is not sync");return i}function Fi(t,e){e=Vt(t).call(t,e),e!==-1&&An(t).call(t,e,1)}function hs(t){let e=[];return Re(t).call(t,r=>{Vt(e).call(e,r)===-1&&e.push(r)}),e}function Fr(t){it.resolve().then(t)}function Pi(t,e){uA[e]||(uA[e]=!0,t())}function qs(t){t=window.atob(t);let e=new Uint8Array(new ArrayBuffer(t.length));for(let r=0;r<t.length;r+=1)e[r]=t.charCodeAt(r);return e}function Os(t){let e="";for(let r=0;r<t.length;r+=1)e+=String.fromCharCode(t[r]);return window.btoa(e)}function fs(t){var e=wv[Math.floor(t/1e4)];if(!e)return{desc:"unkonw error",retry:!1};if(e=e[t%1e4],!e){if(Math.floor(t/1e4)===sc.ACCESS_POINT){if(e=t%1e4,e.toString()[0]==="1")return{desc:t.toString(),retry:!1};if(e.toString()[0]==="2")return{desc:t.toString(),retry:!0}}return{desc:"unkonw error",retry:!1}}return e}function Xs(t){return Lv[t]||{desc:"UNKNOW_ERROR_".concat(t),action:"failed"}}function dn(){return Ee(this,null,function*(){function t(ut){let Gt=C["_"+ut];var It;return It="Cannot call unknown function "+ut+", make sure it is exported",Gt||r("Assertion failed: "+It),Gt}function e(ut,Gt,It,Mi,ka){ka={string:function(ur){let li=0;if(ur!=null&&ur!==0){var Yi=1+(ur.length<<2);li=ct(Yi);var ki=et,wi=li;if(0<Yi){Yi=wi+Yi-1;for(let uo=0;uo<ur.length;++uo){let sn=ur.charCodeAt(uo);if(55296<=sn&&57343>=sn&&(sn=65536+((1023&sn)<<10)|1023&ur.charCodeAt(++uo)),127>=sn){if(wi>=Yi)break;ki[wi++]=sn}else{if(2047>=sn){if(wi+1>=Yi)break;ki[wi++]=192|sn>>6}else{if(65535>=sn){if(wi+2>=Yi)break;ki[wi++]=224|sn>>12}else{if(wi+3>=Yi)break;ki[wi++]=240|sn>>18,ki[wi++]=128|sn>>12&63}ki[wi++]=128|sn>>6&63}ki[wi++]=128|63&sn}}ki[wi]=0}}return li},array:function(ur){const li=ct(ur.length);return Me.set(ur,li),li}};let Ua=t(ut),gc=[];if(ut=0,Mi)for(let ur=0;ur<Mi.length;ur++){let li=ka[It[ur]];li?(ut===0&&(ut=Pe()),gc[ur]=li(Mi[ur])):gc[ur]=Mi[ur]}return It=Ua.apply(null,gc),It=function(ur){if(Gt==="string")if(ki=ur){ur=et;var li=ki+Yi,Yi=ki;let wi="";for(;ur[Yi]&&!(Yi>=li);)++Yi;if(16<Yi-ki&&ur.subarray&&Ae)ur=Ae.decode(ur.subarray(ki,Yi));else{for(;ki<Yi;){if(li=ur[ki++],!(128&li)){wi+=String.fromCharCode(li);continue}let uo=63&ur[ki++];if((224&li)==192){wi+=String.fromCharCode((31&li)<<6|uo);continue}let sn=63&ur[ki++];li=(240&li)==224?(15&li)<<12|uo<<6|sn:(7&li)<<18|uo<<12|sn<<6|63&ur[ki++],65536>li?wi+=String.fromCharCode(li):(li-=65536,wi+=String.fromCharCode(55296|li>>10,56320|1023&li))}ur=wi}}else ur="";else ur=Gt==="boolean"?!!ur:ur;return ur;var ki}(It),ut!==0&&Je(ut),It}function r(ut){throw C.onAbort&&C.onAbort(ut),$(ut+=""),ce=!0,new WebAssembly.RuntimeError("abort("+ut+"). Build with -s ASSERTIONS=1 for more info.")}function i(ut){for(;0<ut.length;){let Gt=ut.shift();if(typeof Gt=="function"){Gt(C);continue}let It=Gt.func;typeof It=="number"?Gt.arg===void 0?pt.get(It)():pt.get(It)(Gt.arg):It(Gt.arg===void 0?null:Gt.arg)}}function o(ut){function Gt(){if(!Wr&&(Wr=!0,C.calledRun=!0,!ce)){if(i(kt),i(Rr),C.onRuntimeInitialized&&C.onRuntimeInitialized(),C.postRun)for(typeof C.postRun=="function"&&(C.postRun=[C.postRun]);C.postRun.length;){var It=C.postRun.shift();mt.unshift(It)}i(mt)}}0<sr||(function(){if(C.preRun)for(typeof C.preRun=="function"&&(C.preRun=[C.preRun]);C.preRun.length;){var It=C.preRun.shift();Qt.unshift(It)}i(Qt)}(),0<sr||(C.setStatus?(C.setStatus("Running..."),_s(function(){_s(function(){C.setStatus("")},1),Gt()},1)):Gt()))}var c,h;if(Dd)return Dd;let C={},x,Q={};for(x in C)Object.prototype.hasOwnProperty.call(C,x)&&(Q[x]=C[x]);let F=!1,V=!1;F=typeof window=="object",V=typeof importScripts=="function";let Y="";(F||V)&&(V?Y=self.location.href:typeof document!="undefined"&&document.currentScript&&(Y=document.currentScript.src),Y=Vt(Y).call(Y,"blob:")!==0?Y.substr(0,Qv(Y).call(Y,"/")+1):""),C.print||Ti(c=console.log).call(c,console);let $=C.printErr||Ti(h=console.warn).call(h,console);for(x in Q)Object.prototype.hasOwnProperty.call(Q,x)&&(C[x]=Q[x]);let te;Q=null,typeof WebAssembly!="object"&&r("no native wasm support detected");let ce=!1,Ae=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):void 0;typeof TextDecoder!="undefined"&&new TextDecoder("utf-16le");let Me,et,pt,Qt=[],kt=[],Rr=[],mt=[];kt.push({func:function(){On()}});let sr=0,yr=null;C.preloadedImages={},C.preloadedAudios={},c="deflate.wasm";var ci;Gc(ci=c).call(ci,"data:application/octet-stream;base64,")||(c=function(ut){return C.locateFile?C.locateFile(ut,Y):Y+ut}(c));let Vi={emscripten_memcpy_big:function(ut,Gt,It){var Mi=et.copyWithin;(et===fA||et instanceof Array&&Mi===fA.copyWithin?Ov:Mi).call(et,ut,Gt,Gt+It)},emscripten_resize_heap:function(ut){r("OOM")}};yield function(){return Ee(this,null,function*(){function ut(It,Mi){C.asm=It.exports,te=C.asm.memory,It=te.buffer,C.HEAP8=Me=new Int8Array(It),C.HEAP16=new Int16Array(It),C.HEAP32=new Int32Array(It),C.HEAPU8=et=new Uint8Array(It),C.HEAPU16=new Uint16Array(It),C.HEAPU32=new Uint32Array(It),C.HEAPF32=new Float32Array(It),C.HEAPF64=new Float64Array(It),pt=C.asm.__indirect_function_table,sr--,C.monitorRunDependencies&&C.monitorRunDependencies(sr),sr==0&&yr&&(It=yr,yr=null,It())}let Gt={env:Vi,wasi_snapshot_preview1:Vi};if(sr++,C.monitorRunDependencies&&C.monitorRunDependencies(sr),C.instantiateWasm)try{return C.instantiateWasm(Gt,ut)}catch(It){return $("Module.instantiateWasm callback failed with error: "+It),!1}return yield function(It){return new it((Mi,ka)=>{Mi(Gv().buffer)}).then(function(Mi){return WebAssembly.instantiate(Mi,Gt)}).then(It,function(Mi){$("failed to asynchronously prepare wasm: "+Mi),r(Mi)})}(function(It){ut(It.instance)}),{}})}();let Wr,On=C.___wasm_call_ctors=function(){return(On=C.___wasm_call_ctors=C.asm.__wasm_call_ctors).apply(null,arguments)},Ce=C._malloc=function(){return(Ce=C._malloc=C.asm.malloc).apply(null,arguments)};C._free=function(){return(C._free=C.asm.free).apply(null,arguments)},C.___errno_location=function(){return(C.___errno_location=C.asm.__errno_location).apply(null,arguments)},C._zlibCompress=function(){return(C._zlibCompress=C.asm.zlibCompress).apply(null,arguments)};let Pe=C.stackSave=function(){return(Pe=C.stackSave=C.asm.stackSave).apply(null,arguments)},Je=C.stackRestore=function(){return(Je=C.stackRestore=C.asm.stackRestore).apply(null,arguments)},ct=C.stackAlloc=function(){return(ct=C.stackAlloc=C.asm.stackAlloc).apply(null,arguments)};if(C.ccall=e,C.cwrap=function(ut,Gt,It,Mi){let ka=Nv(It=It||[]).call(It,function(Ua){return Ua==="number"});return Gt!=="string"&&ka&&!Mi?t(ut):function(){return e(ut,Gt,It,arguments)}},C.allocate=function(ut,Gt){let It;return It=Gt==1?ct(ut.length):Ce(ut.length),ut.subarray||en(ut)?et.set(ut,It):et.set(new Uint8Array(ut),It),It},yr=function ut(){Wr||o(),Wr||(yr=ut)},C.run=o,C.preInit)for(typeof C.preInit=="function"&&(C.preInit=[C.preInit]);0<C.preInit.length;)C.preInit.pop()();return o(),Dd=C,C})}function hn(t,e){var r=vr(t);if(xr){var i=xr(t);e&&(i=Wt(i).call(i,function(o){return Ar(t,o).enumerable})),r.push.apply(r,i)}return r}function ri(t){for(var e=1;e<arguments.length;e++){var r,i=arguments[e]!=null?arguments[e]:{};if(e%2)Re(r=hn(Object(i),!0)).call(r,function(c){Qn(t,c,i[c])});else if(Pr)Un(t,Pr(i));else{var o;Re(o=hn(Object(i))).call(o,function(c){mr(t,c,Ar(i,c))})}}return t}function Sn(t,e){var r=vr(t);if(xr){var i=xr(t);e&&(i=Wt(i).call(i,function(o){return Ar(t,o).enumerable})),r.push.apply(r,i)}return r}function fn(t,e,r,i,o){qd+=1;let c={sid:r.sid,command:"convergeAllocateEdge",uid:"666",appId:r.appId,ts:Math.floor(at()/1e3),seq:qd,requestId:qd,version:rs,cname:r.cname},h={service_name:e,json_body:ht(c)},C,x,Q=t[0];return yi(()=>Ee(this,null,function*(){C=at();var F=yield cn(Q,{data:h,cancelToken:i,headers:{"X-Packet-Service-Type":"0","X-Packet-URI":"61"}});if(x=at()-C,F.code!==0){var V=new ue(oe.UNEXPECTED_RESPONSE,"live streaming ap error, code"+F.code,{retry:!0,responseTime:x});throw z.error(V.toString()),V}if(F=JSON.parse(F.json_body),F.code!==200)throw F=new ue(oe.UNEXPECTED_RESPONSE,ne(V="live streaming app center error, code: ".concat(F.code,", reason: ")).call(V,F.reason),{code:F.code,responseTime:x}),z.error(F.toString()),F;if(!F.servers||F.servers.length===0)throw V=new ue(oe.UNEXPECTED_RESPONSE,"live streaming app center empty server",{code:F.code,responseTime:x}),z.error(V.toString()),V;return V=function(Y,$){var te;return{addressList:_t(te=Y.servers).call(te,ce=>{var Ae,Me;return ne(Ae=ne(Me="wss://".concat(ce.address.replace(/\./g,"-"),".edge.agora.io:")).call(Me,ce.wss,"?serviceName=")).call(Ae,encodeURIComponent($))}),workerToken:Y.workerToken,vid:Y.vid}}(F,e),Xe.LIVE_STREAMING_ADDRESS&&(V.addressList=Xe.LIVE_STREAMING_ADDRESS instanceof Array?Xe.LIVE_STREAMING_ADDRESS:[Xe.LIVE_STREAMING_ADDRESS]),function(Y){for(var $=1;$<arguments.length;$++){var te,ce=arguments[$]!=null?arguments[$]:{};if($%2)Re(te=Sn(Object(ce),!0)).call(te,function(Me){Qn(Y,Me,ce[Me])});else if(Pr)Un(Y,Pr(ce));else{var Ae;Re(Ae=Sn(Object(ce))).call(Ae,function(Me){mr(Y,Me,Ar(ce,Me))})}}return Y}({},V,{responseTime:x})}),(F,V)=>(ke.apworkerEvent(r.sid,{success:!0,sc:200,serviceName:e,responseDetail:ht(F.addressList),firstSuccess:V===0,responseTime:x,serverIp:t[V%t.length]}),!1),(F,V)=>(ke.apworkerEvent(r.sid,{success:!1,sc:F.data&&F.data.code||200,serviceName:e,responseTime:x,serverIp:t[V%t.length]}),!!(F.code!==oe.OPERATION_ABORTED&&F.code!==oe.UNEXPECTED_RESPONSE||F.data&&F.data.retry)&&(Q=t[(V+1)%t.length],!0)),o)}function As({url:t,areaCode:e},r,i,o){let c=at(),[h,C]=sg(r,e,[Fn.CHOOSE_SERVER]),x=ss.networkState;return yi(()=>Ee(this,null,function*(){x&&ss.networkState===Qs.OFFLINE&&ss.onlineWaiter&&(yield it.race([ss.onlineWaiter,zi(o&&o.maxRetryTimeout||Ki.maxRetryTimeout)])),x=ss.networkState;var Q=yield cn(t,{data:h,cancelToken:i,headers:{"Content-Type":"multipart/form-data;"}},!0);return ig(Q,t,r,c,[Fn.CHOOSE_SERVER]),Q=Go(Q,Fn.CHOOSE_SERVER),ng(Q),Fo(Q,t)}),Q=>(Q&&ke.joinChooseServer(r.sid,{lts:c,succ:!0,csAddr:t,opid:C,serverList:Q.gatewayAddrs,ec:null,cid:Q.cid.toString(),uid:Q.uid.toString(),csIp:Q.csIp,unilbsServerIds:[Fn.CHOOSE_SERVER].toString()}),!1),Q=>Q.code!==oe.OPERATION_ABORTED&&(Q.code===oe.CAN_NOT_GET_GATEWAY_SERVER?Q.data.retry:(ke.joinChooseServer(r.sid,{lts:c,succ:!1,csAddr:t,serverList:null,opid:C,ec:Q.code,csIp:Q.data&&Q.data.csIp,unilbsServerIds:[Fn.CHOOSE_SERVER].toString(),extend:ht({networkState:x})}),z.warning("[".concat(r.clientId,"] Choose server network error, retry"),Q),!0)),o)}function Bs({url:t,areaCode:e,serviceIds:r},i,o,c){let h=at(),[C,x]=sg(i,e,r),Q;return yi(()=>Ee(this,null,function*(){Q&&ss.networkState===Qs.OFFLINE&&ss.onlineWaiter&&(yield it.race([ss.onlineWaiter,zi(c&&c.maxRetryTimeout||Ki.maxRetryTimeout)])),Q=ss.networkState;var F=yield cn(t,{data:C,cancelToken:o,headers:{"Content-Type":"multipart/form-data;"}},!0);ig(F,t,i,h,r);let V=Go(F,Fn.CHOOSE_SERVER);return F=Go(F,i.cloudProxyServer==="proxy5"?Fn.CLOUD_PROXY_5:Fn.CLOUD_PROXY),ng(V),{gatewayInfo:Fo(V,t),proxyInfo:F,url:t}}),F=>{var V;return F.gatewayInfo&&ke.joinChooseServer(i.sid,{lts:h,succ:!0,csAddr:t,serverList:F.gatewayInfo.gatewayAddrs,ec:null,opid:x,cid:F.gatewayInfo.cid.toString(),uid:F.gatewayInfo.uid.toString(),csIp:F.gatewayInfo.csIp,unilbsServerIds:r.toString()}),F.proxyInfo&&ke.joinWebProxyAP(i.sid,{lts:h,sucess:1,apServerAddr:t,turnServerAddrList:_t(V=F.proxyInfo.addresses).call(V,Y=>Y.ip).join(","),errorCode:null,eventType:i.cloudProxyServer,unilbsServerIds:r.toString()}),!1},F=>F.code!==oe.OPERATION_ABORTED&&(F.code===oe.CAN_NOT_GET_GATEWAY_SERVER?F.data.retry:(ke.joinWebProxyAP(i.sid,{lts:h,sucess:0,apServerAddr:t,turnServerAddrList:null,errorCode:F.code,eventType:i.cloudProxyServer,unilbsServerIds:r.toString(),extend:ht({networkState:Q})}),z.warning("[".concat(i.clientId,"] multi unilbs network error, retry"),F),!0)),c)}function Ns(t,e,r){return Ee(this,null,function*(){return{gatewayInfo:yield function(i,o,c){return Ee(this,null,function*(){var h,C;const x=_t(h=en(C=Xe.WEBCS_DOMAIN).call(C,0,Xe.AJAX_REQUEST_CONCURRENT)).call(h,V=>{var Y;return{url:i.proxyServer?ne(Y="https://".concat(i.proxyServer,"/ap/?url=")).call(Y,V+"/api/v2/transpond/webrtc?v=2"):"https://".concat(V,"/api/v2/transpond/webrtc?v=2"),areaCode:el()}});let Q=null;const F=[];return Q=yield qi([(()=>Ee(this,null,function*(){return yield uc({fragementLength:Xe.FRAGEMENT_LENGTH,referenceList:x,asyncMapHandler:V=>(z.debug("[".concat(i.clientId,"] Connect to choose_server:"),V.url),As(V,i,o,c)),allFailedhandler:V=>{throw V[0]},promisesCollector:F})}))(),(()=>Ee(this,null,function*(){var V;if(yield zi(1e3),Q!==null)return Q;const Y=_t(V=Xe.WEBCS_DOMAIN_BACKUP_LIST).call(V,$=>{var te;return{url:i.proxyServer?ne(te="https://".concat(i.proxyServer,"/ap/?url=")).call(te,$+"/api/v2/transpond/webrtc?v=2"):"https://".concat($,"/api/v2/transpond/webrtc?v=2"),areaCode:el()}});return yield uc({fragementLength:Xe.FRAGEMENT_LENGTH,referenceList:Y,asyncMapHandler:$=>(z.debug("[".concat(i.clientId,"] Connect to backup choose_server:"),$.url),As($,i,o,c)),allFailedhandler:$=>{throw $[0]},promisesCollector:F})}))()]),F.length&&Re(F).call(F,V=>V.cancel&&typeof V.cancel=="function"&&V.cancel()),Q})}(t,e,r)}})}function $n(t,e,r,i){return Ee(this,null,function*(){var o,c;if(t.cloudProxyServer==="disabled")return i?yield Ns(t,e,r):void 0;let h;if(t.cloudProxyServer==="443only"||t.cloudProxyServer==="normal"){var C;let x;i?t.cloudProxyServer!=="normal"?[x,h]=yield it.all([es(t,e,r),Ns(t,e,r)]):(x=yield es(t,e,r),t.proxyServer=x.addresses[0],ke.setProxyServer(t.proxyServer),z.setProxyServer(t.proxyServer),h=yield Ns(t,e,r)):(h=void 0,t.cloudProxyServer!=="normal"?x=yield es(t,e,r):(x=yield es(t,e,r),t.proxyServer=x.addresses[0],ke.setProxyServer(t.proxyServer),z.setProxyServer(t.proxyServer))),t.turnServer={mode:"manual",servers:_t(C=x.addresses).call(C,Q=>({turnServerURL:Q,tcpport:t.cloudProxyServer==="proxy3"?void 0:x.serverResponse.tcpport?x.serverResponse.tcpport:rn.tcpport,udpport:t.cloudProxyServer==="proxy4"?void 0:x.serverResponse.udpport?x.serverResponse.udpport:rn.udpport,username:x.serverResponse.username||rn.username,password:x.serverResponse.password||rn.password,forceturn:t.cloudProxyServer!=="proxy4"&&t.cloudProxyServer!=="proxy5",security:t.cloudProxyServer==="proxy5"}))}}else{let{proxyInfo:x,gatewayInfo:Q}=yield function(F,V,Y){return Ee(this,null,function*(){var $,te;const ce=Xe.PROXY_SERVER_TYPE3,Ae=(mt,sr)=>{var yr;let ci=ce;return so(ci)&&(ci=sr%2==0?ce[1]:ce[0]),ne(yr="https://".concat(ci,"/ap/?url=")).call(yr,mt)},Me=_t($=en(te=Xe.WEBCS_DOMAIN).call(te,0,Xe.AJAX_REQUEST_CONCURRENT)).call($,(mt,sr)=>({url:Ae("".concat(mt,"/api/v2/transpond/webrtc?v=2"),sr),areaCode:el(),serviceIds:[Fn.CHOOSE_SERVER,F.cloudProxyServer==="proxy5"?Fn.CLOUD_PROXY_5:Fn.CLOUD_PROXY]}));let et=null;const pt=[],{gatewayInfo:Qt,proxyInfo:kt,url:Rr}=yield qi([(()=>Ee(this,null,function*(){return yield uc({fragementLength:Xe.FRAGEMENT_LENGTH,referenceList:Me,asyncMapHandler:mt=>(z.debug("[".concat(F.clientId,"] Connect to choose_server:"),mt.url),Bs(mt,F,V,Y)),allFailedhandler:mt=>{throw mt[0]},promisesCollector:pt})}))(),(()=>Ee(this,null,function*(){var mt;if(yield zi(1e3),et!==null)return et;const sr=_t(mt=Xe.WEBCS_DOMAIN_BACKUP_LIST).call(mt,(yr,ci)=>({url:Ae("".concat(yr,"/api/v2/transpond/webrtc?v=2"),ci),areaCode:el(),serviceIds:[11,18]}));return yield uc({fragementLength:Xe.FRAGEMENT_LENGTH,referenceList:sr,asyncMapHandler:yr=>(z.debug("[".concat(F.clientId,"] Connect to backup choose_server:"),yr.url),Bs(yr,F,V,Y)),allFailedhandler:yr=>{throw yr[0]},promisesCollector:pt})}))()]);if(pt.length&&Re(pt).call(pt,mt=>mt.cancel&&typeof mt.cancel=="function"&&mt.cancel()),!Qt||!kt)throw new ue(oe.UNEXPECTED_ERROR,"missing gateway or proxy response").print();return so(ce)&&Rr&&($=new Cm(Rr).host,_r(ce).call(ce,$)&&(F.proxyServer=$,z.setProxyServer($),ke.setProxyServer($))),et={gatewayInfo:Qt,proxyInfo:Fa(kt)},et})}(t,e,r);h={gatewayInfo:Q},t.turnServer={mode:"manual",servers:_t(x).call(x,F=>({turnServerURL:F.address,tcpport:t.cloudProxyServer==="proxy3"?void 0:F.tcpport?F.tcpport:rn.tcpport,udpport:t.cloudProxyServer==="proxy4"?void 0:F.udpport?F.udpport:rn.udpport,username:F.username||rn.username,password:F.password||rn.password,forceturn:t.cloudProxyServer!=="proxy4"&&t.cloudProxyServer!=="proxy5",security:t.cloudProxyServer==="proxy5"}))}}return z.debug(ne(o=ne(c="[".concat(t.clientId,"] set proxy server: ")).call(c,t.proxyServer,", mode: ")).call(o,t.cloudProxyServer)),h})}function Xi(t,e,r,i){return Ee(this,null,function*(){var o;let c=en(o=Xe.ACCOUNT_REGISTER).call(o,0,Xe.AJAX_REQUEST_CONCURRENT);return o=[],o=e.proxyServer?_t(c).call(c,h=>{var C;return ne(C="https://".concat(e.proxyServer,"/ap/?url=")).call(C,h+"/api/v1")}):_t(c).call(c,h=>"https://".concat(h,"/api/v1")),(yield function(h,C,x,Q,F){return Ee(this,null,function*(){let V=at(),Y={sid:x.sid,opid:10,appid:x.appId,string_uid:C},$=h[0];if(x=yield yi(()=>cn($+"".concat(Vt($).call($,"?")===-1?"?":"&","action=stringuid"),{data:Y,cancelToken:Q,headers:{"X-Packet-Service-Type":0,"X-Packet-URI":72}}),(te,ce)=>{if(te.code===0){var Ae;if(0>=te.uid||te.uid>=Math.pow(2,32))throw z.error(ne(Ae="Invalid Uint Uid ".concat(C," => ")).call(Ae,te.uid),te),ke.reqUserAccount(Y.sid,{lts:V,success:!1,serverAddr:$,stringUid:Y.string_uid,uid:te.uid,errorCode:oe.INVALID_UINT_UID_FROM_STRING_UID,extend:Y}),new ue(oe.INVALID_UINT_UID_FROM_STRING_UID);return ke.reqUserAccount(Y.sid,{lts:V,success:!0,serverAddr:$,stringUid:Y.string_uid,uid:te.uid,errorCode:null,extend:Y}),!1}return Ae=fs(te.code),Ae.retry&&($=h[(ce+1)%h.length]),ke.reqUserAccount(Y.sid,{lts:V,success:!1,serverAddr:$,stringUid:Y.string_uid,uid:te.uid,errorCode:Ae.desc,extend:Y}),Ae.retry},(te,ce)=>te.code!==oe.OPERATION_ABORTED&&(ke.reqUserAccount(Y.sid,{lts:V,success:!1,serverAddr:$,stringUid:Y.string_uid,uid:null,errorCode:te.code,extend:Y}),$=h[(ce+1)%h.length],!0),F),x.code!==0)throw x=fs(x.code),new ue(oe.UNEXPECTED_RESPONSE,x.desc);return x})}(o,t,e,r,i)).uid})}function es(t,e,r){return Ee(this,null,function*(){var i,o=at(),c=_t(i=Xe[t.cloudProxyServer==="normal"?"PROXY_CS":"WEBCS_DOMAIN"]).call(i,C=>{var x;return t.proxyServer?ne(x="https://".concat(t.proxyServer,"/ap/?url=")).call(x,C+"/api/v1"):"https://".concat(C,"/api/v1")});if(t.cloudProxyServer==="proxy3"||t.cloudProxyServer==="proxy4"||t.cloudProxyServer==="proxy5"){o=_t(c).call(c,C=>({url:C,areaCode:el()}));var h=null;if(h=yield uc({fragementLength:Xe.FRAGEMENT_LENGTH,referenceList:o,asyncMapHandler:C=>function({url:x,areaCode:Q},F,V,Y){let $=at(),te={opid:133,flag:F.cloudProxyServer==="proxy5"?4194304:1048576,ts:+new Date,key:F.token,cname:F.cname,sid:F.sid,detail:{6:F.stringUid,11:Q},uid:F.uid||0};return yi(()=>Ee(this,null,function*(){return yield cn(x,{data:te,cancelToken:V,headers:{"X-Packet-Service-Type":0,"X-Packet-URI":69}})}),ce=>{var Ae;if(ce.code===0)return ke.joinWebProxyAP(F.sid,{lts:$,sucess:1,apServerAddr:x,turnServerAddrList:_t(Ae=ce.addresses).call(Ae,Me=>Me.ip).join(","),errorCode:null,eventType:F.cloudProxyServer}),!1;throw ce=fs(ce.code),new ue(oe.CAN_NOT_GET_GATEWAY_SERVER,ce.desc,{retry:ce.retry})},ce=>{return ce.code!==oe.OPERATION_ABORTED&&(ce.code===oe.CAN_NOT_GET_GATEWAY_SERVER?(ke.joinWebProxyAP(te.sid,{lts:$,sucess:0,apServerAddr:x,turnServerAddrList:null,errorCode:ce.code,eventType:F.cloudProxyServer}),z.warning(ne(Ae=ne(Me=ne(et="[".concat(F.clientId,"] proxy ap server ")).call(et,x," failed, message: ")).call(Me,ce.message,", retry: ")).call(Ae,ce.data.retry)),ce.data.retry):(ke.joinWebProxyAP(te.sid,{lts:$,sucess:0,apServerAddr:x,turnServerAddrList:null,errorCode:ce.code,eventType:F.cloudProxyServer}),!0));var Ae,Me,et},Y)}(C,t,e,r),allFailedhandler:()=>{throw z.error("[".concat(t.clientId,"] can not get proxy server after trying several times")),new ue(oe.CAN_NOT_GET_PROXY_SERVER)}}),o=h.addresses,!o||o.length===0)throw z.error("[".concat(t.clientId,"] can not get proxy server, empty proxy server list")),new ue(oe.CAN_NOT_GET_PROXY_SERVER,"empty proxy server list");return{addresses:_t(o).call(o,C=>C.ip),serverResponse:{tcpport:o[0].port||443,udpport:o[0].port||rn.udpport,username:rn.username,password:rn.password}}}if(i=null,i=yield uc({fragementLength:Xe.FRAGEMENT_LENGTH,referenceList:c,asyncMapHandler:C=>function(x,Q,F,V){let Y=at(),$={command:"convergeAllocateEdge",sid:Q.sid,appId:Q.appId,token:Q.token,uid:Q.uid,cname:Q.cname,ts:Math.floor(at()/1e3),version:rs,seq:0,requestId:1};return yi(()=>Ee(this,null,function*(){return{res:yield cn(x,{data:{service_name:"webrtc_proxy",json_body:ht($)},cancelToken:F,headers:{"X-Packet-Service-Type":0,"X-Packet-URI":61}}),url:x}}),te=>{if(!te.res.json_body)throw z.debug("[".concat(Q.clientId,"] Get proxy server failed: no json_body")),new ue(oe.UNEXPECTED_RESPONSE,ht(te.res));let ce=JSON.parse(te.res.json_body);var Ae,Me;if(ce.code!==200)throw z.debug(ne(Ae=ne(Me="[".concat(Q.clientId,"] Get proxy server failed: response code [")).call(Me,ce.code,"], reason [")).call(Ae,ce.reason,"]")),new ue(oe.UNEXPECTED_RESPONSE,ht(te.res));return z.debug("[".concat(Q.clientId,"] App return server length"),ce.servers.length),!1},te=>te.code!==oe.OPERATION_ABORTED&&(ke.requestProxyAppCenter($.sid,{lts:Y,succ:!1,APAddr:x,workerManagerList:null,ec:te.code,response:te.message}),!0),V)}(C,t,e,r),allFailedhandler:()=>{throw z.error("[".concat(t.clientId,"] can not get proxy server after trying several times")),new ue(oe.CAN_NOT_GET_PROXY_SERVER)}}),c=JSON.parse(i.res.json_body),c=_t(h=c.servers).call(h,_a),t.cloudProxyServer==="443only")return{addresses:c,serverResponse:{tcpport:443,udpport:rn.udpport,username:rn.username,password:rn.password}};ke.requestProxyAppCenter(t.sid,{lts:o,succ:!0,APAddr:i.url,workerManagerList:ht(c),ec:null,response:ht(i.res)}),o=at(),h=_t(c).call(c,C=>function(x,Q,F,V){const Y=at();let $=x;Gc(x).call(x,"http")||($="https://".concat(x,":4000/v2/machine"));const te={command:"request",gatewayType:"http",appId:Q.appId,cname:Q.cname,uid:(Q.uid||"").toString(),sdkVersion:"2.3.1",sid:Q.sid,seq:1,ts:at(),requestId:3,clientRequest:{appId:Q.appId,cname:Q.cname,uid:(Q.uid||"").toString(),sid:Q.sid}};return yi(()=>Ee(this,null,function*(){return{res:yield cn($,{data:te,cancelToken:F}),url:x}}),ce=>{if(!ce.res.serverResponse)throw new ue(oe.UNEXPECTED_RESPONSE,"requeet worker manager server failed: serverResponse is undefined");return!1},ce=>ce.code!==oe.OPERATION_ABORTED&&(ke.requestProxyWorkerManager(te.sid,{lts:Y,succ:!1,workerManagerAddr:x,ec:ce.code,response:ce.message}),!0),V)}(C,t,e,r)),i=null;try{i=yield qi(h)}catch(C){throw z.error("[".concat(t.clientId,"] can not get worker manager after trying several times")),new ue(oe.CAN_NOT_GET_PROXY_SERVER)}return Re(h).call(h,C=>C.cancel()),ke.requestProxyWorkerManager(t.sid,{lts:o,succ:!0,workerManagerAddr:i.url,ec:null,response:ht(i.res)}),{addresses:[i.url],serverResponse:i.res.serverResponse}})}function ya(t,e,r){return Ee(this,null,function*(){var i,o,c=_t(i=en(o=Xe.CDS_AP).call(o,0,Xe.AJAX_REQUEST_CONCURRENT)).call(i,C=>{var x;return t.proxyServer?ne(x="https://".concat(t.proxyServer,"/ap/?url=")).call(x,C+"/api/v1"):"https://".concat(C,"/api/v1?action=config")});i=_t(c).call(c,C=>function(x,Q,F,V){const Y=Ye(),$={flag:64,cipher_method:0,features:{device:Y.name,system:Y.os,vendor:Q.appId,version:rs,cname:Q.cname,sid:Q.sid,session_id:Q.sid,detail:"",proxyServer:Q.proxyServer}};return yi(()=>cn(x,{data:$,timeout:1e3,cancelToken:F,headers:{"X-Packet-Service-Type":0,"X-Packet-URI":54}}),void 0,te=>te.code!==oe.OPERATION_ABORTED,V)}(C,t,e,r)),c=o=null;let h={};try{o=yield qi(i)}catch(C){if(C.code===oe.OPERATION_ABORTED)throw C;c=C}if(Re(i).call(i,C=>C.cancel()),ke.reportApiInvoke(t.sid,{name:Ot.REQUEST_CONFIG_DISTRIBUTE,options:{error:c,res:o}}).onSuccess(),o&&o.test_tags)try{h=function(C){if(!C.test_tags)return{};let x=C.test_tags;C=vr(x);let Q={};return Re(C).call(C,F=>{var V;let Y=ba(V=en(F).call(F,4)).call(V);F=JSON.parse(x[F])[1],Q[Y]=F}),Q}(o)}catch(C){}return h})}function ua(t,e,r,i){return Ee(this,null,function*(){var o,c;let h=_t(o=en(c=Xe.UAP_AP).call(c,0,Xe.AJAX_REQUEST_CONCURRENT)).call(o,C=>{var x;return e.proxyServer?ne(x="https://".concat(e.proxyServer,"/ap/?url=")).call(x,C+"/api/v1?action=uap"):"https://".concat(C,"/api/v1?action=uap")});return yield fn(h,t,e,r,i)})}function Bn(t,e,r){return Ee(this,null,function*(){var i,o;let c=_t(i=en(o=Xe.UAP_AP).call(o,0,Xe.AJAX_REQUEST_CONCURRENT)).call(i,h=>{var C;return t.proxyServer?ne(C="https://".concat(t.proxyServer,"/ap/?url=")).call(C,h+"/api/v1?action=uap"):"https://".concat(h,"/api/v1?action=uap")});i=_t(c).call(c,h=>function(C,x,Q,F){x={command:"convergeAllocateEdge",sid:x.sid,appId:x.appId,token:x.token,ts:at(),version:rs,cname:x.cname,uid:x.uid.toString(),requestId:Xd,seq:Xd},Xd+=1;const V={service_name:"tele_channel",json_body:ht(x)};return yi(()=>Ee(this,null,function*(){var Y=yield cn(C,{data:V,cancelToken:Q,headers:{"X-Packet-Service-Type":0,"X-Packet-URI":61}});if(Y.code!==0){var $=new ue(oe.UNEXPECTED_RESPONSE,"cross channel ap error, code"+Y.code,{retry:!0});throw z.error($.toString()),$}if(Y=JSON.parse(Y.json_body),Y.code!==200){var te=new ue(oe.UNEXPECTED_RESPONSE,ne($="cross channel app center error, code: ".concat(Y.code,", reason: ")).call($,Y.reason));throw z.error(te.toString()),te}if(!Y.servers||Y.servers.length===0)throw $=new ue(oe.UNEXPECTED_RESPONSE,"cross channel app center empty server"),z.error($.toString()),$;return{vid:Y.vid,workerToken:Y.workerToken,addressList:_t(te=Y.servers).call(te,ce=>{var Ae;return ne(Ae="wss://".concat(ce.address.replace(/\./g,"-"),".edge.agora.io:")).call(Ae,ce.wss)})}}),void 0,Y=>!!(Y.code!==oe.OPERATION_ABORTED&&Y.code!==oe.UNEXPECTED_RESPONSE||Y.data&&Y.data.retry),F)}(h,t,e,r));try{let h=yield qi(i);return Re(i).call(i,C=>C.cancel()),h}catch(h){throw h[0]}})}function Ps(t,e){var r=vr(t);if(xr){var i=xr(t);e&&(i=Wt(i).call(i,function(o){return Ar(t,o).enumerable})),r.push.apply(r,i)}return r}function xi(t){if(Array.isArray(t))return t.map(function(i){return i});if(!cl(t))return t;var e={},r;for(r in t)cl(t[r])||Array.isArray(t[r])?e[r]=xi(t[r]):e[r]=t[r];return e}function cl(t){return!(typeof t!="object"||Array.isArray(t)||!t)}function _c(t,e){function r(){this.constructor=t}og(t,e),t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Cc(t,e,r,i){return new(r||(r=Promise))(function(o,c){function h(Q){try{x(i.next(Q))}catch(F){c(F)}}function C(Q){try{x(i.throw(Q))}catch(F){c(F)}}function x(Q){Q.done?o(Q.value):new r(function(F){F(Q.value)}).then(h,C)}x((i=i.apply(t,e||[])).next())})}function Ia(t,e){function r(x){return function(Q){return function(F){if(i)throw new TypeError("Generator is already executing.");for(;C;)try{if(i=1,o&&(c=2&F[0]?o.return:F[0]?o.throw||((c=o.return)&&c.call(o),0):o.next)&&!(c=c.call(o,F[1])).done)return c;switch(o=0,c&&(F=[2&F[0],c.value]),F[0]){case 0:case 1:c=F;break;case 4:return C.label++,{value:F[1],done:!1};case 5:C.label++,o=F[1],F=[0];continue;case 7:F=C.ops.pop(),C.trys.pop();continue;default:if(c=C.trys,!((c=0<c.length&&c[c.length-1])||F[0]!==6&&F[0]!==2)){C=0;continue}if(F[0]===3&&(!c||F[1]>c[0]&&F[1]<c[3]))C.label=F[1];else if(F[0]===6&&C.label<c[1])C.label=c[1],c=F;else if(c&&C.label<c[2])C.label=c[2],C.ops.push(F);else{c[2]&&C.ops.pop(),C.trys.pop();continue}}F=e.call(t,C)}catch(V){F=[6,V],o=0}finally{i=c=0}if(5&F[0])throw F[1];return{value:F[0]?F[1]:void 0,done:!0}}([x,Q])}}var i,o,c,h,C={label:0,sent:function(){if(1&c[0])throw c[1];return c[1]},trys:[],ops:[]};return h={next:r(0),throw:r(1),return:r(2)},typeof Symbol=="function"&&(h[Symbol.iterator]=function(){return this}),h}function gu(t,e,r){return r=t.createShader(r),r?(t.shaderSource(r,e),t.compileShader(r),t.getShaderParameter(r,t.COMPILE_STATUS)?r:(e=t.getShaderInfoLog(r),t.deleteShader(r),new ue(oe.WEBGL_INTERNAL_ERROR,"error compiling shader:"+e).throw())):new ue(oe.WEBGL_INTERNAL_ERROR,"can not create shader").throw()}function Lr(t,e,r,i){let o=[];for(let c=0;c<e.length;++c)o.push(gu(t,e[c],c===0?t.VERTEX_SHADER:t.FRAGMENT_SHADER));return function(c,h,C,x){let Q=c.createProgram();if(!Q)throw new ue(oe.WEBGL_INTERNAL_ERROR,"can not create webgl program");if(Re(h).call(h,F=>{c.attachShader(Q,F)}),C&&Re(C).call(C,(F,V)=>{c.bindAttribLocation(Q,x?x[V]:V,F)}),c.linkProgram(Q),!c.getProgramParameter(Q,c.LINK_STATUS))throw h=c.getProgramInfoLog(Q),c.deleteProgram(Q),new ue(oe.WEBGL_INTERNAL_ERROR,"error in program linking:"+h);return Q}(t,o,r,i)}function ll(t){var e=new Uint8Array([99,114,121,112,116,105,105]),r=e.length;let i=t.length,o=new Uint8Array(i),c=new Uint8Array(256);for(var h=0;256>h;h++)c[h]=h;h=0;for(var C=0;256>C;C++)h=(h+c[C]+e[C%r])%256,[c[C],c[h]]=[c[h],c[C]];for(h=r=0,C=0;C<0+i;C++)r=(r+1)%256,h=(h+c[r])%256,[c[r],c[h]]=[c[h],c[r]],e=c[(c[r]+c[h])%256],0<=C&&(o[C-0]=t[C-0]^e);return t=String.fromCharCode.apply(null,co(o)),Function("var winSize = 5; return `"+t+"`")()}function yc(t){let e={};return t.facingMode&&(e.facingMode=t.facingMode),t.cameraId&&(e.deviceId={exact:t.cameraId}),t.encoderConfig?(t=kr(t.encoderConfig),e.width=t.width,e.height=t.height,!Qr()&&t.frameRate&&(e.frameRate=t.frameRate),Ye().name===ir.EDGE&&typeof e.frameRate=="object"&&(e.frameRate.max=60),Dt()&&(e.frameRate={ideal:30,max:30}),e):e}function ul(t){let e={};if(Qr()||(t.AGC!==void 0&&(e.autoGainControl=t.AGC,Bt()&&(e.googAutoGainControl=t.AGC,e.googAutoGainControl2=t.AGC)),t.AEC!==void 0&&(e.echoCancellation=t.AEC),t.ANS!==void 0&&(e.noiseSuppression=t.ANS,Bt()&&(e.googNoiseSuppression=t.ANS))),t.encoderConfig){let r=Ei(t.encoderConfig);e.channelCount=r.stereo?2:1,e.sampleRate=r.sampleRate,e.sampleSize=r.sampleSize}return t.microphoneId&&(e.deviceId={exact:t.microphoneId}),Bt()&&e.channelCount===2&&(e.googAutoGainControl=!1,e.googAutoGainControl2=!1,e.echoCancellation=!1,e.googNoiseSuppression=!1),Ye().os===tn.ANDROID&&(e.sampleRate=void 0),e}function dl(t,e){var r=vr(t);if(xr){var i=xr(t);e&&(i=Wt(i).call(i,function(o){return Ar(t,o).enumerable})),r.push.apply(r,i)}return r}function da(t){for(var e=1;e<arguments.length;e++){var r,i=arguments[e]!=null?arguments[e]:{};if(e%2)Re(r=dl(Object(i),!0)).call(r,function(c){Qn(t,c,i[c])});else if(Pr)Un(t,Pr(i));else{var o;Re(o=dl(Object(i))).call(o,function(c){mr(t,c,Ar(i,c))})}}return t}function hl(t){let e={video:[],audio:[]};return t.match(/ VP8/i)&&e.video.push("VP8"),t.match(/ VP9/i)&&e.video.push("VP9"),t.match(/ AV1X/i)&&e.video.push("AV1"),t.match(/ H264/i)&&e.video.push("H264"),t.match(/ opus/i)&&e.audio.push("OPUS"),e}function Ga(t,e){var r=t.match(/a=rtpmap:(\d+) opus/);if(!r||!r[0]||!r[1])return t;var i=r[1];if(r=t.match("a=fmtp:".concat(i,`.*\r
|
|
51
|
+
`)),!r||!r[0])return t;i="a=fmtp:".concat(i," minptime=10;useinbandfec=1;");var o;return e.bitrate&&!Dt()&&(i+="maxaveragebitrate=".concat(Math.floor(1e3*e.bitrate),";")),e.sampleRate&&(i+=ne(o="maxplaybackrate=".concat(e.sampleRate,";sprop-maxcapturerate=")).call(o,e.sampleRate,";")),e.stereo&&(i+="stereo=1;sprop-stereo-1;"),i+=`\r
|
|
52
|
+
`,t.replace(r[0],i)}function Ic(t){return t.replace("minptime=10","minptime=10;stereo=1;sprop-stereo=1")}function fl(t,e,r){var i=!1;switch(e){case"h264":return t;case"vp8":if(!Xe.SIMULCAST)return t;r&&(r.numSpatialLayers=2);case"vp9":case"av1":i=!0}if(i){var o;let pt=Ti(o=RegExp.prototype.test).call(o,/^([a-z])=(.*)/),Qt=t.split("m="),kt,Rr,mt=null,sr=null,yr=null,ci=[];o=[];var c;e=[];let Vi=i=null;var h;let Wr=[],On=[];for(var C=0;C<Qt.length;++C)if(mt=Qt[C].match(/a=msid-semantic:/),mt){mt=Qt[C];break}for(C=0;C<Qt.length;++C)if(sr=Qt[C].match(/audio /),sr){kt=C,sr="m="+Qt[C];break}for(C=0;C<Qt.length;++C)if(yr=Qt[C].match(/video /),yr){Rr=C,yr="m="+Qt[C];break}if(mt&&(ci=Wt(c=mt.split(/(\r\n|\r|\n)/)).call(c,pt)),0<ci.length&&(e=ne(e).call(e,ci)),sr&&(o=Wt(h=sr.split(/(\r\n|\r|\n)/)).call(h,pt)),!yr)return t;var x;for(c=Wt(x=yr.split(/(\r\n|\r|\n)/)).call(x,pt),x=0;x<c.length;++x)if(i===null&&(i=c[x].match(/cname:/),i!==null)){i="cname:"+c[x].split("cname:")[1];break}for(h=0;h<c.length;++h)if(Vi===null&&(Vi=c[h].match(/a=msid:/),Vi!==null&&(Vi="msid:"+c[h].split(":")[1])),c[h].match(/a=ssrc-group:FID/)){x=c[h].split(" "),Wr.push(Number(x[1])),x[2]&&On.push(Number(x[2])),c.length=h;break}for(x=1;x<r.numSpatialLayers;++x)Wr.push(Wr[0]+x),0<On.length&&On.push(On[0]+x);for(x="a=ssrc-group:SIM ",h=0;h<Wr.length;++h)x=ne(x).call(x,String(Wr[h])),h<Wr.length-1&&(x=ne(x).call(x," "));for(c.push(x),x=0;x<r.numSpatialLayers;++x){var Q,F;h=ne(Q=ne(F=ne("a=ssrc-group:FID ").call("a=ssrc-group:FID ",String(Wr[x]))).call(F," ")).call(Q,String(On[x])),c.push(h)}for(Q=0;Q<r.numSpatialLayers;++Q){var V,Y,$,te;if(i===null||Vi===null)return t;F=ne(V=ne(Y="a=ssrc:".concat(String(Wr[Q]))).call(Y," ")).call(V,i),x=ne($=ne(te="a=ssrc:".concat(String(Wr[Q]))).call(te," ")).call($,Vi),c.push(F),c.push(x)}for(V=0;V<r.numSpatialLayers;++V){var ce,Ae,Me,et;if(i===null||Vi===null)return t;Y=ne(ce=ne(Ae="a=ssrc:".concat(String(On[V]))).call(Ae," ")).call(ce,i),$=ne(Me=ne(et="a=ssrc:".concat(String(On[V]))).call(et," ")).call(Me,Vi),c.push(Y),c.push($)}kt&&Rr&&kt>Rr?(e=ne(e).call(e,c),e=ne(e).call(e,o)):(e=ne(e).call(e,o),e=ne(e).call(e,c)),t=e.join(`\r
|
|
53
|
+
`)+`\r
|
|
54
|
+
`}return t}function Sa(t,e){let r=(o,c)=>{const h=Sg(o,c);return h?r(i(o,h),c):o},i=(o,c)=>{var h,C;const x=Ti(h=RegExp.prototype.test).call(h,/^([a-z])=(.*)/),Q=["a=rtpmap:".concat(c),"a=rtcp-fb:".concat(c),"a=fmtp:".concat(c)],F=Wt(C=o.split(/(\r\n|\r|\n)/)).call(C,x),V=[];if(Re(F).call(F,($,te)=>{Re(Q).call(Q,ce=>{_r($).call($,ce)&&V.push(te)})}),o=du(F).call(F,$=>_r($).call($,"apt=".concat(c))),o){V.push(o,o-1);var Y=(Y=F[o-1].match(/a=rtpmap:(\d+) rtx.*/))&&Y[1]}return Re(V).call(V,$=>{F[$]=""}),o=du(F).call(F,$=>_r($).call($,"m=video")),F[o]=F[o].replace(" ".concat(c),""),Y&&(F[o]=F[o].replace(" ".concat(Y),"")),Wt(F).call(F,$=>!!$).join(`\r
|
|
55
|
+
`)+`\r
|
|
56
|
+
`};return Re(e).call(e,o=>{t=r(t,o)}),t}function pu(t,e){let r=document.createElement("video"),i=document.createElement("canvas");r.setAttribute("style","display:none"),i.setAttribute("style","display:none"),r.setAttribute("muted",""),r.muted=!0,r.setAttribute("autoplay",""),r.autoplay=!0,r.setAttribute("playsinline",""),i.width=Zn(e.width),i.height=Zn(e.height),e=Zn(e.framerate||15),document.body.append(r),document.body.append(i);let o=t._mediaStreamTrack;r.srcObject=new MediaStream([o]),r.play();let c=i.getContext("2d");if(!c)throw new ue(oe.UNEXPECTED_ERROR,"can not get canvas context");let h=i.captureStream(Nr.supportRequestFrame?0:e).getVideoTracks()[0],C=js(()=>{if(r.paused&&r.play(),2<r.videoHeight&&2<r.videoWidth){const Y=r.videoHeight/r.videoWidth*i.width;var Q,F,V;2<=Math.abs(Y-i.height)&&(z.debug("adjust low stream resolution",ne(Q=ne(F=ne(V="".concat(i.width,"x")).call(V,i.height," -> ")).call(F,i.width,"x")).call(Q,Y)),i.height=Y)}c.drawImage(r,0,0,i.width,i.height),h.requestFrame&&h.requestFrame(),o!==t._mediaStreamTrack&&(o=t._mediaStreamTrack,r.srcObject=new MediaStream([o]))},e),x=h.stop;return h.stop=()=>{x.call(h),C(),r.remove(),i.width=0,i.remove(),r=i=null,z.debug("clean low stream renderer")},h}function Di(t,e){var r=vr(t);if(xr){var i=xr(t);e&&(i=Wt(i).call(i,function(o){return Ar(t,o).enumerable})),r.push.apply(r,i)}return r}function Al(t){for(var e=1;e<arguments.length;e++){var r,i=arguments[e]!=null?arguments[e]:{};if(e%2)Re(r=Di(Object(i),!0)).call(r,function(c){Qn(t,c,i[c])});else if(Pr)Un(t,Pr(i));else{var o;Re(o=Di(Object(i))).call(o,function(c){mr(t,c,Ar(i,c))})}}return t}function gl(t,e){var r=vr(t);if(xr){var i=xr(t);e&&(i=Wt(i).call(i,function(o){return Ar(t,o).enumerable})),r.push.apply(r,i)}return r}function Sc(t){for(var e=1;e<arguments.length;e++){var r,i=arguments[e]!=null?arguments[e]:{};if(e%2)Re(r=gl(Object(i),!0)).call(r,function(c){Qn(t,c,i[c])});else if(Pr)Un(t,Pr(i));else{var o;Re(o=gl(Object(i))).call(o,function(c){mr(t,c,Ar(i,c))})}}return t}function pl(t,e){var r=vr(t);if(xr){var i=xr(t);e&&(i=Wt(i).call(i,function(o){return Ar(t,o).enumerable})),r.push.apply(r,i)}return r}function Ha(t){for(var e=1;e<arguments.length;e++){var r,i=arguments[e]!=null?arguments[e]:{};if(e%2)Re(r=pl(Object(i),!0)).call(r,function(c){Qn(t,c,i[c])});else if(Pr)Un(t,Pr(i));else{var o;Re(o=pl(Object(i))).call(o,function(c){mr(t,c,Ar(i,c))})}}return t}function vl(t,e){var r=vr(t);if(xr){var i=xr(t);e&&(i=Wt(i).call(i,function(o){return Ar(t,o).enumerable})),r.push.apply(r,i)}return r}function Zs(t){for(var e=1;e<arguments.length;e++){var r,i=arguments[e]!=null?arguments[e]:{};if(e%2)Re(r=vl(Object(i),!0)).call(r,function(c){Qn(t,c,i[c])});else if(Pr)Un(t,Pr(i));else{var o;Re(o=vl(Object(i))).call(o,function(c){mr(t,c,Ar(i,c))})}}return t}function ml(t){if(!(t instanceof wg))return new ue(oe.INVALID_PARAMS,"Config should be instance of [ChannelMediaRelayConfiguration]").throw();let e=t.getSrcChannelMediaInfo();if(t=t.getDestChannelMediaInfo(),!e)return new ue(oe.INVALID_PARAMS,"srcChannelMediaInfo should not be empty").throw();if(t.size===0)return new ue(oe.INVALID_PARAMS,"destChannelMediaInfo should not be empty").throw()}function El(t,e){var r=vr(t);if(xr){var i=xr(t);e&&(i=Wt(i).call(i,function(o){return Ar(t,o).enumerable})),r.push.apply(r,i)}return r}function $s(t){for(var e=1;e<arguments.length;e++){var r,i=arguments[e]!=null?arguments[e]:{};if(e%2)Re(r=El(Object(i),!0)).call(r,function(c){Qn(t,c,i[c])});else if(Pr)Un(t,Pr(i));else{var o;Re(o=El(Object(i))).call(o,function(c){mr(t,c,Ar(i,c))})}}return t}function vu(t,e){return Ee(this,null,function*(){var r=null;if(typeof t=="string"){let i=Lg.get(t);if(i)return z.debug("use cached audio resource: ",t),i;try{r=(yield yi(()=>So.get(t,{responseType:"arraybuffer"}),void 0,void 0,{maxRetryCount:3})).data}catch(o){throw new ue(oe.FETCH_AUDIO_FILE_FAILED,o.toString())}}else r=yield new it((i,o)=>{const c=new FileReader;c.onload=h=>{h.target?i(h.target.result):o(new ue(oe.READ_LOCAL_AUDIO_FILE_ERROR))},c.onerror=()=>{o(new ue(oe.READ_LOCAL_AUDIO_FILE_ERROR))},c.readAsArrayBuffer(t)});return r=yield function(i){const o=ln();return new it((c,h)=>{o.decodeAudioData(i,C=>{c(C)},C=>{h(new ue(oe.DECODE_AUDIO_FILE_FAILED,C.toString()))})})}(r),typeof t=="string"&&e&&Lg.set(t,r),r})}function Ka(t,e){var r=vr(t);if(xr){var i=xr(t);e&&(i=Wt(i).call(i,function(o){return Ar(t,o).enumerable})),r.push.apply(r,i)}return r}function _l(t){for(var e=1;e<arguments.length;e++){var r,i=arguments[e]!=null?arguments[e]:{};if(e%2)Re(r=Ka(Object(i),!0)).call(r,function(c){Qn(t,c,i[c])});else if(Pr)Un(t,Pr(i));else{var o;Re(o=Ka(Object(i))).call(o,function(c){mr(t,c,Ar(i,c))})}}return t}function Tc(t,e,r,i){r.optimizationMode&&(i&&i.width&&i.height?(r.encoderConfig=_l({},i,{bitrateMin:i.bitrateMin,bitrateMax:i.bitrateMax}),r.optimizationMode!=="motion"&&r.optimizationMode!=="detail"||(e.contentHint=r.optimizationMode,e.contentHint===r.optimizationMode?z.debug("[".concat(t,"] set content hint to"),r.optimizationMode):z.debug("[".concat(t,"] set content hint failed")))):z.warning("[".concat(t,"] can not apply optimization mode bitrate config, no encoderConfig")))}var Ta=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},Wa=function(t){return t&&t.Math==Math&&t},Ht=Wa(typeof globalThis=="object"&&globalThis)||Wa(typeof window=="object"&&window)||Wa(typeof self=="object"&&self)||Wa(typeof Ta=="object"&&Ta)||Function("return this")(),ii=function(t){try{return!!t()}catch(e){return!0}},xt=!ii(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7}),qr={}.propertyIsEnumerable,Rc=Object.getOwnPropertyDescriptor,vo=Rc&&!qr.call({1:2},1)?function(t){return t=Rc(this,t),!!t&&t.enumerable}:qr,gs=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},ja={}.toString,xs=function(t){return ja.call(t).slice(8,-1)},ps="".split,ha=ii(function(){return!Object("z").propertyIsEnumerable(0)})?function(t){return xs(t)=="String"?ps.call(t,""):Object(t)}:Object,Ko=function(t){if(t==null)throw TypeError("Can't call method on "+t);return t},Tn=function(t){return ha(Ko(t))},jr=function(t){return typeof t=="object"?t!==null:typeof t=="function"},mo=function(t,e){if(!jr(t))return t;var r,i;if(e&&typeof(r=t.toString)=="function"&&!jr(i=r.call(t))||typeof(r=t.valueOf)=="function"&&!jr(i=r.call(t))||!e&&typeof(r=t.toString)=="function"&&!jr(i=r.call(t)))return i;throw TypeError("Can't convert object to primitive value")},mu={}.hasOwnProperty,$t=function(t,e){return mu.call(t,e)},fa=Ht.document,Eo=jr(fa)&&jr(fa.createElement),Cl=!xt&&!ii(function(){return Object.defineProperty(Eo?fa.createElement("div"):{},"a",{get:function(){return 7}}).a!=7}),yl=Object.getOwnPropertyDescriptor,Wo=xt?yl:function(t,e){if(t=Tn(t),e=mo(e,!0),Cl)try{return yl(t,e)}catch(r){}if($t(t,e))return gs(!vo.call(t,e),t[e])},Eu=/#|\.prototype\./,jo=function(t,e){return t=Il[_u(t)],t==yu||t!=Cu&&(typeof e=="function"?ii(e):!!e)},_u=jo.normalize=function(t){return String(t).replace(Eu,".").toLowerCase()},Il=jo.data={},Cu=jo.NATIVE="N",yu=jo.POLYFILL="P",Dr={},Kn=function(t){if(typeof t!="function")throw TypeError(String(t)+" is not a function");return t},eo=function(t,e,r){if(Kn(t),e===void 0)return t;switch(r){case 0:return function(){return t.call(e)};case 1:return function(i){return t.call(e,i)};case 2:return function(i,o){return t.call(e,i,o)};case 3:return function(i,o,c){return t.call(e,i,o,c)}}return function(){return t.apply(e,arguments)}},Qi=function(t){if(!jr(t))throw TypeError(String(t)+" is not an object");return t},to=Object.defineProperty,Wn={f:xt?to:function(t,e,r){if(Qi(t),e=mo(e,!0),Qi(r),Cl)try{return to(t,e,r)}catch(i){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");return"value"in r&&(t[e]=r.value),t}},vs=xt?function(t,e,r){return Wn.f(t,e,gs(1,r))}:function(t,e,r){return t[e]=r,t},Sl=Wo,wc=function(t){var e=function(r,i,o){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(r);case 2:return new t(r,i)}return new t(r,i,o)}return t.apply(this,arguments)};return e.prototype=t.prototype,e},Kt=function(t,e){var r,i,o,c,h,C=t.target,x=t.global,Q=t.stat,F=t.proto,V=x?Ht:Q?Ht[C]:(Ht[C]||{}).prototype,Y=x?Dr:Dr[C]||(Dr[C]={}),$=Y.prototype;for(i in e){var te=!jo(x?i:C+(Q?".":"#")+i,t.forced)&&V&&$t(V,i),ce=Y[i];te&&(o=t.noTargetGet?(h=Sl(V,i))&&h.value:V[i]);var Ae=te&&o?o:e[i];te&&typeof ce==typeof Ae||(c=t.bind&&te?eo(Ae,Ht):t.wrap&&te?wc(Ae):F&&typeof Ae=="function"?eo(Function.call,Ae):Ae,(t.sham||Ae&&Ae.sham||ce&&ce.sham)&&vs(c,"sham",!0),Y[i]=c,F&&($t(Dr,r=C+"Prototype")||vs(Dr,r,{}),Dr[r][i]=Ae,t.real&&$&&!$[i]&&vs($,i,Ae)))}},Tl=function(t){return typeof t=="function"?t:void 0},ms=function(t,e){return 2>arguments.length?Tl(Dr[t])||Tl(Ht[t]):Dr[t]&&Dr[t][e]||Ht[t]&&Ht[t][e]},Va=ms("JSON","stringify"),Lc=/[\uD800-\uDFFF]/g,Rl=/^[\uD800-\uDBFF]$/,Dc=/^[\uDC00-\uDFFF]$/,wl=function(t,e,r){var i=r.charAt(e-1);return e=r.charAt(e+1),Rl.test(t)&&!Dc.test(e)||Dc.test(t)&&!Rl.test(i)?"\\u"+t.charCodeAt(0).toString(16):t},Ll=ii(function(){return Va("\uDF06\uD834")!=='"\\udf06\\ud834"'||Va("\uDEAD")!=='"\\udead"'});Va&&Kt({target:"JSON",stat:!0,forced:Ll},{stringify:function(t,e,r){var i=Va.apply(null,arguments);return typeof i=="string"?i.replace(Lc,wl):i}}),Dr.JSON||(Dr.JSON={stringify:JSON.stringify});var Vo,Aa,ht=function(t,e,r){return Dr.JSON.stringify.apply(null,arguments)},Nn=Array.isArray||function(t){return xs(t)=="Array"},jn=function(t){return Object(Ko(t))},bc=Math.ceil,Dl=Math.floor,Yo=function(t){return isNaN(t=+t)?0:(0<t?Dl:bc)(t)},Iu=Math.min,Rn=function(t){return 0<t?Iu(Yo(t),9007199254740991):0},Jo=function(t,e,r){e=mo(e),e in t?Wn.f(t,e,gs(0,r)):t[e]=r},bl=Ht["__core-js_shared__"]||function(t,e){try{vs(Ht,t,e)}catch(r){Ht[t]=e}return e}("__core-js_shared__",{}),ro=de(function(t){(t.exports=function(e,r){return bl[e]||(bl[e]=r!==void 0?r:{})})("versions",[]).push({version:"3.4.3",mode:"pure",copyright:"\xA9 2019 Denis Pushkarev (zloirock.ru)"})}),Oc=0,io=Math.random(),Ra=function(t){return"Symbol("+String(t===void 0?"":t)+")_"+(++Oc+io).toString(36)},Es=!!Object.getOwnPropertySymbols&&!ii(function(){return!String(Symbol())}),Ya=Es&&!Symbol.sham&&typeof Symbol()=="symbol",Ja=ro("wks"),za=Ht.Symbol,Ol=Ya?za:Ra,ni=function(t){return $t(Ja,t)||(Es&&$t(za,t)?Ja[t]=za[t]:Ja[t]=Ol("Symbol."+t)),Ja[t]},Su=ni("species"),qa=function(t,e){var r;return Nn(t)&&(typeof(r=t.constructor)!="function"||r!==Array&&!Nn(r.prototype)?jr(r)&&(r=r[Su])===null&&(r=void 0):r=void 0),new(r===void 0?Array:r)(e===0?0:e)},zo=ms("navigator","userAgent")||"",Bl=Ht.process,Bc=Bl&&Bl.versions,Nc=Bc&&Bc.v8;Nc?Aa=(Vo=Nc.split("."))[0]+Vo[1]:zo&&(!(Vo=zo.match(/Edge\/(\d+)/))||74<=Vo[1])&&(Vo=zo.match(/Chrome\/(\d+)/))&&(Aa=Vo[1]);var no=Aa&&+Aa,Tu=ni("species"),qo=function(t){return 51<=no||!ii(function(){var e=[];return(e.constructor={})[Tu]=function(){return{foo:1}},e[t](Boolean).foo!==1})},Nl=ni("isConcatSpreadable"),Ru=51<=no||!ii(function(){var t=[];return t[Nl]=!1,t.concat()[0]!==t}),wu=qo("concat");Kt({target:"Array",proto:!0,forced:!Ru||!wu},{concat:function(t){var e,r,i=jn(this),o=qa(i,0),c=0,h=-1;for(e=arguments.length;h<e;h++){var C=r=h===-1?i:arguments[h];if(jr(C)){var x=C[Nl];C=x!==void 0?!!x:Nn(C)}else C=!1;if(C){if(9007199254740991<c+(x=Rn(r.length)))throw TypeError("Maximum allowed index exceeded");for(C=0;C<x;C++,c++)C in r&&Jo(o,c,r[C])}else{if(9007199254740991<=c)throw TypeError("Maximum allowed index exceeded");Jo(o,c++,r)}}return o.length=c,o}});var pi=function(t){return Dr[t+"Prototype"]},Lu=pi("Array").concat,Xa=Array.prototype,ne=function(t){var e=t.concat;return t===Xa||t instanceof Array&&e===Xa.concat?Lu:e},_o={},Du=!ii(function(){return Object.isExtensible(Object.preventExtensions({}))}),Co=de(function(t){var e=Wn.f,r=Ra("meta"),i=0,o=Object.isExtensible||function(){return!0},c=function(C){e(C,r,{value:{objectID:"O"+ ++i,weakData:{}}})},h=t.exports={REQUIRED:!1,fastKey:function(C,x){if(!jr(C))return typeof C=="symbol"?C:(typeof C=="string"?"S":"P")+C;if(!$t(C,r)){if(!o(C))return"F";if(!x)return"E";c(C)}return C[r].objectID},getWeakData:function(C,x){if(!$t(C,r)){if(!o(C))return!0;if(!x)return!1;c(C)}return C[r].weakData},onFreeze:function(C){return Du&&h.REQUIRED&&o(C)&&!$t(C,r)&&c(C),C}};_o[r]=!0}),yo={},bu=ni("iterator"),Ou=Array.prototype,ga=function(t){return t!==void 0&&(yo.Array===t||Ou[bu]===t)},Bu={};Bu[ni("toStringTag")]="z";var Pc=String(Bu)==="[object z]",G=ni("toStringTag"),Z=xs(function(){return arguments}())=="Arguments",re=Pc?xs:function(t){var e;if(t===void 0)var r="Undefined";else{if(t===null)var i="Null";else{e:{var o=t=Object(t);try{i=o[G];break e}catch(c){}i=void 0}i=typeof(r=i)=="string"?r:Z?xs(t):(e=xs(t))=="Object"&&typeof t.callee=="function"?"Arguments":e}r=i}return r},ge=ni("iterator"),he=function(t){if(t!=null)return t[ge]||t["@@iterator"]||yo[re(t)]},Ie=function(t,e,r,i){try{return i?e(Qi(r)[0],r[1]):e(r)}catch(o){throw e=t.return,e!==void 0&&Qi(e.call(t)),o}},Se=de(function(t){var e=function(r,i){this.stopped=r,this.result=i};(t.exports=function(r,i,o,c,h){var C,x;if(i=eo(i,o,c?2:1),!h){if(typeof(h=he(r))!="function")throw TypeError("Target is not iterable");if(ga(h)){for(h=0,o=Rn(r.length);o>h;h++)if((C=c?i(Qi(x=r[h])[0],x[1]):i(r[h]))&&C instanceof e)return C;return new e(!1)}r=h.call(r)}for(h=r.next;!(x=h.call(r)).done;)if(typeof(C=Ie(r,i,x.value,c))=="object"&&C&&C instanceof e)return C;return new e(!1)}).stop=function(r){return new e(!0,r)}}),De=function(t,e,r){if(!(t instanceof e))throw TypeError("Incorrect "+(r?r+" ":"")+"invocation");return t},Qe=Pc?{}.toString:function(){return"[object "+re(this)+"]"},Le=Wn.f,we=ni("toStringTag"),Be=function(t,e,r,i){t&&(t=r?t:t.prototype,$t(t,we)||Le(t,we,{configurable:!0,value:e}),i&&!Pc&&vs(t,"toString",Qe))},He=[].push,We=function(t){var e=t==1,r=t==2,i=t==3,o=t==4,c=t==6,h=t==5||c;return function(C,x,Q,F){var V,Y,$=jn(C),te=ha($);x=eo(x,Q,3),Q=Rn(te.length);var ce=0;for(F=F||qa,C=e?F(C,Q):r?F(C,0):void 0;Q>ce;ce++)if((h||ce in te)&&(Y=x(V=te[ce],ce,$),t)){if(e)C[ce]=Y;else if(Y)switch(t){case 3:return!0;case 5:return V;case 6:return ce;case 2:He.call(C,V)}else if(o)return!1}return c?-1:i||o?o:C}},ze=We(0),qe=We(1),ot=We(2),je=We(3),Ke=We(4),rt=We(5),At=We(6),yt=ro("native-function-to-string",Function.toString),Ze=Ht.WeakMap,lt=typeof Ze=="function"&&/native code/.test(yt.call(Ze)),vt=ro("keys"),dt=function(t){return vt[t]||(vt[t]=Ra(t))},gt=Ht.WeakMap;if(lt)var Rt=new gt,Tt=Rt.get,Zt=Rt.has,ar=Rt.set,Yt=function(t,e){return ar.call(Rt,t,e),e},tr=function(t){return Tt.call(Rt,t)||{}},wr=function(t){return Zt.call(Rt,t)};else{var cr=dt("state");_o[cr]=!0,Yt=function(t,e){return vs(t,cr,e),e},tr=function(t){return $t(t,cr)?t[cr]:{}},wr=function(t){return $t(t,cr)}}var Lt={set:Yt,get:tr,has:wr,enforce:function(t){return wr(t)?tr(t):Yt(t,{})},getterFor:function(t){return function(e){var r;if(!jr(e)||(r=tr(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return r}}},Br=Wn.f,Xr=Lt.set,hi=Lt.getterFor,Vr=function(t,e,r){var i=t.indexOf("Map")!==-1,o=t.indexOf("Weak")!==-1,c=i?"set":"add",h=Ht[t],C=h&&h.prototype,x={};if(xt&&typeof h=="function"&&(o||C.forEach&&!ii(function(){new h().entries().next()}))){var Q=e(function(V,Y){Xr(De(V,Q,t),{type:t,collection:new h}),Y!=null&&Se(Y,V[c],V,i)}),F=hi(t);ze("add clear delete forEach get has set keys values entries".split(" "),function(V){var Y=V=="add"||V=="set";!(V in C)||o&&V=="clear"||vs(Q.prototype,V,function($,te){var ce=F(this).collection;return!Y&&o&&!jr($)?V=="get"&&void 0:($=ce[V]($===0?0:$,te),Y?this:$)})}),o||Br(Q.prototype,"size",{configurable:!0,get:function(){return F(this).collection.size}})}else Q=r.getConstructor(e,t,i,c),Co.REQUIRED=!0;return Be(Q,t,!1,!0),x[t]=Q,Kt({global:!0,forced:!0},x),o||r.setStrong(Q,t,i),Q},si=Math.max,oi=Math.min,Zi=function(t,e){return t=Yo(t),0>t?si(t+e,0):oi(t,e)},wn=function(t){return function(e,r,i){var o;e=Tn(e);var c=Rn(e.length);if(i=Zi(i,c),t&&r!=r){for(;c>i;)if((o=e[i++])!=o)return!0}else for(;c>i;i++)if((t||i in e)&&e[i]===r)return t||i||0;return!t&&-1}},Pn=wn(!0),$i=wn(!1),xn=function(t,e){var r;t=Tn(t);var i=0,o=[];for(r in t)!$t(_o,r)&&$t(t,r)&&o.push(r);for(;e.length>i;)$t(t,r=e[i++])&&(~$i(o,r)||o.push(r));return o},Ln="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),Mn=Object.keys||function(t){return xn(t,Ln)},Zr=xt?Object.defineProperties:function(t,e){Qi(t);for(var r,i=Mn(e),o=i.length,c=0;o>c;)Wn.f(t,r=i[c++],e[r]);return t},$r=ms("document","documentElement"),ft=dt("IE_PROTO"),ei=function(){},bi=function(){var t=Eo?fa.createElement("iframe"):{},e=Ln.length;for(t.style.display="none",$r.appendChild(t),t.src="javascript:",(t=t.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),bi=t.F;e--;)delete bi.prototype[Ln[e]];return bi()},Sr=Object.create||function(t,e){var r;return t!==null?(ei.prototype=Qi(t),r=new ei,ei.prototype=null,r[ft]=t):r=bi(),e===void 0?r:Zr(r,e)};_o[ft]=!0;var Vn,wa,Za,vi=function(t,e,r,i){i&&i.enumerable?t[e]=r:vs(t,e,r)},fi=function(t,e,r){for(var i in e)r&&r.unsafe&&t[i]?t[i]=e[i]:vi(t,i,e[i],r);return t},Xo=!ii(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}),Pl=dt("IE_PROTO"),Nu=Object.prototype,Pu=Xo?Object.getPrototypeOf:function(t){return t=jn(t),$t(t,Pl)?t[Pl]:typeof t.constructor=="function"&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?Nu:null},ih=(ni("iterator"),!1);[].keys&&("next"in(Za=[].keys())?(wa=Pu(Pu(Za)))!==Object.prototype&&(Vn=wa):ih=!0),Vn==null&&(Vn={});var nh=Vn,xl=ih,Ug=function(){return this},sh=function(t,e,r){return e+=" Iterator",t.prototype=Sr(nh,{next:gs(1,r)}),Be(t,e,!1,!0),yo[e]=Ug,t},Fg=(Object.setPrototypeOf||"__proto__"in{}&&function(){var t={};try{Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set.call(t,[])}catch(e){}}(),nh),xu=ni("iterator"),Qg=function(){return this},Mu=function(t,e,r,i,o,c,h){sh(r,e,i);var C,x,Q;i=function(Ae){if(Ae===o&&te)return te;if(!xl&&Ae in Y)return Y[Ae];switch(Ae){case"keys":case"values":case"entries":return function(){return new r(this,Ae)}}return function(){return new r(this)}};var F=e+" Iterator",V=!1,Y=t.prototype,$=Y[xu]||Y["@@iterator"]||o&&Y[o],te=!xl&&$||i(o),ce=e=="Array"&&Y.entries||$;if(ce&&(C=Pu(ce.call(new t)),Fg!==Object.prototype&&C.next&&(Be(C,F,!0,!0),yo[F]=Qg)),o=="values"&&$&&$.name!=="values"&&(V=!0,te=function(){return $.call(this)}),h&&Y[xu]!==te&&vs(Y,xu,te),yo[e]=te,o)if(x={values:i("values"),keys:c?te:i("keys"),entries:i("entries")},h)for(Q in x)!xl&&!V&&Q in Y||vi(Y,Q,x[Q]);else Kt({target:e,proto:!0,forced:xl||V},x);return x},oh=ni("species"),ah=function(t){t=ms(t);var e=Wn.f;xt&&t&&!t[oh]&&e(t,oh,{configurable:!0,get:function(){return this}})},Gg=Wn.f,ch=Co.fastKey,lh=Lt.set,ku=Lt.getterFor,uh=(Vr("Map",function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},{getConstructor:function(t,e,r,i){var o=t(function(x,Q){De(x,o,e),lh(x,{type:e,index:Sr(null),first:void 0,last:void 0,size:0}),xt||(x.size=0),Q!=null&&Se(Q,x[i],x,r)}),c=ku(e),h=function(x,Q,F){var V,Y,$=c(x),te=C(x,Q);return te?te.value=F:($.last=te={index:Y=ch(Q,!0),key:Q,value:F,previous:V=$.last,next:void 0,removed:!1},$.first||($.first=te),V&&(V.next=te),xt?$.size++:x.size++,Y!=="F"&&($.index[Y]=te)),x},C=function(x,Q){x=c(x);var F=ch(Q);if(F!=="F")return x.index[F];for(x=x.first;x;x=x.next)if(x.key==Q)return x};return fi(o.prototype,{clear:function(){for(var x=c(this),Q=x.index,F=x.first;F;)F.removed=!0,F.previous&&(F.previous=F.previous.next=void 0),delete Q[F.index],F=F.next;x.first=x.last=void 0,xt?x.size=0:this.size=0},delete:function(x){var Q=c(this);if(x=C(this,x)){var F=x.next,V=x.previous;delete Q.index[x.index],x.removed=!0,V&&(V.next=F),F&&(F.previous=V),Q.first==x&&(Q.first=F),Q.last==x&&(Q.last=V),xt?Q.size--:this.size--}return!!x},forEach:function(x){for(var Q,F=c(this),V=eo(x,1<arguments.length?arguments[1]:void 0,3);Q=Q?Q.next:F.first;)for(V(Q.value,Q.key,this);Q&&Q.removed;)Q=Q.previous},has:function(x){return!!C(this,x)}}),fi(o.prototype,r?{get:function(x){return(x=C(this,x))&&x.value},set:function(x,Q){return h(this,x===0?0:x,Q)}}:{add:function(x){return h(this,x=x===0?0:x,x)}}),xt&&Gg(o.prototype,"size",{get:function(){return c(this).size}}),o},setStrong:function(t,e,r){var i=e+" Iterator",o=ku(e),c=ku(i);Mu(t,e,function(h,C){lh(this,{type:i,target:h,state:o(h),kind:C,last:void 0})},function(){for(var h=c(this),C=h.kind,x=h.last;x&&x.removed;)x=x.previous;return h.target&&(h.last=x=x?x.next:h.state.first)?C=="keys"?{value:x.key,done:!1}:C=="values"?{value:x.value,done:!1}:{value:[x.key,x.value],done:!1}:(h.target=void 0,{value:void 0,done:!0})},r?"entries":"values",!r,!0),ah(e)}}),function(t){return function(e,r){var i,o;e=String(Ko(e)),r=Yo(r);var c=e.length;return 0>r||r>=c?t?"":void 0:55296>(i=e.charCodeAt(r))||56319<i||r+1===c||56320>(o=e.charCodeAt(r+1))||57343<o?t?e.charAt(r):i:t?e.slice(r,r+2):o-56320+(i-55296<<10)+65536}}),Hg=uh(!1),Kg=uh(!0),Wg=Lt.set,jg=Lt.getterFor("String Iterator");Mu(String,"String",function(t){Wg(this,{type:"String Iterator",string:String(t),index:0})},function(){var t,e=jg(this),r=e.string,i=e.index;return i>=r.length?{value:void 0,done:!0}:(t=Kg(r,i),e.index+=t.length,{value:t,done:!1})});var Vg=Lt.set,Yg=Lt.getterFor("Array Iterator");Mu(Array,"Array",function(t,e){Vg(this,{type:"Array Iterator",target:Tn(t),index:0,kind:e})},function(){var t=Yg(this),e=t.target,r=t.kind,i=t.index++;return!e||i>=e.length?(t.target=void 0,{value:void 0,done:!0}):r=="keys"?{value:i,done:!1}:r=="values"?{value:e[i],done:!1}:{value:[i,e[i]],done:!1}},"values"),yo.Arguments=yo.Array;var dh=ni("toStringTag"),Ml;for(Ml in{CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}){var hh=Ht[Ml],Uu=hh&&hh.prototype;Uu&&!Uu[dh]&&vs(Uu,dh,Ml),yo[Ml]=yo.Array}var Tr=Dr.Map,Jg=ni("match"),Fu=function(t){var e;if(jr(t)&&((e=t[Jg])!==void 0?e:xs(t)=="RegExp"))throw TypeError("The method doesn't accept regular expressions");return t},zg=ni("match"),Qu=function(t){var e=/./;try{"/./"[t](e)}catch(r){try{return e[zg]=!1,"/./"[t](e)}catch(i){}}return!1},fh="".endsWith,qg=Math.min,Xg=Qu("endsWith");Kt({target:"String",proto:!0,forced:!Xg},{endsWith:function(t){var e=String(Ko(this));Fu(t);var r=1<arguments.length?arguments[1]:void 0,i=Rn(e.length);return r=r===void 0?i:qg(Rn(r),i),i=String(t),fh?fh.call(e,i,r):e.slice(r-i.length,r)===i}});var Zg=pi("String").endsWith,Ah=String.prototype,gh=function(t){var e=t.endsWith;return typeof t=="string"||t===Ah||t instanceof String&&e===Ah.endsWith?Zg:e},La=function(t,e){var r=[][t];return!r||!ii(function(){r.call(null,e||function(){throw 1},1)})},ph=La("forEach")?function(t){return ze(this,t,1<arguments.length?arguments[1]:void 0)}:[].forEach;Kt({target:"Array",proto:!0,forced:[].forEach!=ph},{forEach:ph});var $g=pi("Array").forEach,vh=Array.prototype,ep={DOMTokenList:!0,NodeList:!0},Re=function(t){var e=t.forEach;return t===vh||t instanceof Array&&e===vh.forEach||ep.hasOwnProperty(re(t))?$g:e},xc={f:Object.getOwnPropertySymbols},kl=Object.assign,Mc=!kl||ii(function(){var t={},e={},r=Symbol();return t[r]=7,"abcdefghijklmnopqrst".split("").forEach(function(i){e[i]=i}),kl({},t)[r]!=7||Mn(kl({},e)).join("")!="abcdefghijklmnopqrst"})?function(t,e){for(var r=jn(t),i=arguments.length,o=1,c=xc.f,h=vo;i>o;)for(var C,x=ha(arguments[o++]),Q=c?Mn(x).concat(c(x)):Mn(x),F=Q.length,V=0;F>V;)C=Q[V++],xt&&!h.call(x,C)||(r[C]=x[C]);return r}:kl;Kt({target:"Object",stat:!0,forced:Object.assign!==Mc},{assign:Mc});var Dn=Dr.Object.assign,tp=ii(function(){Mn(1)});Kt({target:"Object",stat:!0,forced:tp},{keys:function(t){return Mn(jn(t))}});var vr=Dr.Object.keys,mh=function(t){return function(e,r,i,o){Kn(r),e=jn(e);var c=ha(e),h=Rn(e.length),C=t?h-1:0,x=t?-1:1;if(2>i)for(;;){if(C in c){o=c[C],C+=x;break}if(C+=x,t?0>C:h<=C)throw TypeError("Reduce of empty array with no initial value")}for(;t?0<=C:h>C;C+=x)C in c&&(o=r(o,c[C],C,e));return o}},rp={left:mh(!1),right:mh(!0)}.left;Kt({target:"Array",proto:!0,forced:La("reduce")},{reduce:function(t){return rp(this,t,arguments.length,1<arguments.length?arguments[1]:void 0)}});var ip=pi("Array").reduce,Eh=Array.prototype,Ul=function(t){var e=t.reduce;return t===Eh||t instanceof Array&&e===Eh.reduce?ip:e};Kt({target:"Object",stat:!0,forced:!xt,sham:!xt},{defineProperty:Wn.f});var _h=de(function(t){var e=Dr.Object;t=t.exports=function(r,i,o){return e.defineProperty(r,i,o)},e.defineProperty.sham&&(t.sham=!0)}),mr=_h,np=/^[\t\n\x0B\f\r \u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\ufeff][\t\n\x0B\f\r \u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\ufeff]*/,sp=/[\t\n\x0B\f\r \u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\ufeff][\t\n\x0B\f\r \u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\ufeff]*$/,Gu=function(t){return function(e){return e=String(Ko(e)),1&t&&(e=e.replace(np,"")),2&t&&(e=e.replace(sp,"")),e}};Gu(1),Gu(2);var Ch=Gu(3),Fl=Ht.parseInt,op=/^[+-]?0[Xx]/,yh=Fl(`
|
|
57
|
+
\v\f\r \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF08`)!==8||Fl(`
|
|
58
|
+
\v\f\r \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF0x16`)!==22?function(t,e){return t=Ch(String(t)),Fl(t,e>>>0||(op.test(t)?16:10))}:Fl;Kt({global:!0,forced:parseInt!=yh},{parseInt:yh});var Si=Dr.parseInt;let Ih=!0,Sh=!0;var Th=Wo,ap=ii(function(){Th(1)});Kt({target:"Object",stat:!0,forced:!xt||ap,sham:!xt},{getOwnPropertyDescriptor:function(t,e){return Th(Tn(t),e)}});var Ar=de(function(t){var e=Dr.Object;t=t.exports=function(r,i){return e.getOwnPropertyDescriptor(r,i)},e.getOwnPropertyDescriptor.sham&&(t.sham=!0)});Kt({target:"Array",proto:!0,forced:!qo("filter")},{filter:function(t){return ot(this,t,1<arguments.length?arguments[1]:void 0)}});var cp=pi("Array").filter,Rh=Array.prototype,Wt=function(t){var e=t.filter;return t===Rh||t instanceof Array&&e===Rh.filter?cp:e},lp=Ht.Promise,wh=ni("iterator"),Lh=!1;try{var up=0,Dh={next:function(){return{done:!!up++}},return:function(){Lh=!0}};Dh[wh]=function(){return this},Array.from(Dh,function(){throw 2})}catch(t){}var $a,bh,Hu,Oh=function(t,e){if(!e&&!Lh)return!1;var r=!1;try{e={},e[wh]=function(){return{next:function(){return{done:r=!0}}}},t(e)}catch(i){}return r},dp=ni("species"),Bh=function(t,e){var r;return t=Qi(t).constructor,t===void 0||(r=Qi(t)[dp])==null?e:Kn(r)},Nh=/(iphone|ipod|ipad).*applewebkit/i.test(zo),Ph=Ht.location,Ku=Ht.setImmediate,xh=Ht.clearImmediate,Mh=Ht.process,kh=Ht.MessageChannel,Wu=Ht.Dispatch,ju=0,kc={},Vu=function(t){if(kc.hasOwnProperty(t)){var e=kc[t];delete kc[t],e()}},Yu=function(t){return function(){Vu(t)}},Uh=function(t){Vu(t.data)},Fh=function(t){Ht.postMessage(t+"",Ph.protocol+"//"+Ph.host)};Ku&&xh||(Ku=function(t){for(var e=[],r=1;arguments.length>r;)e.push(arguments[r++]);return kc[++ju]=function(){(typeof t=="function"?t:Function(t)).apply(void 0,e)},$a(ju),ju},xh=function(t){delete kc[t]},xs(Mh)=="process"?$a=function(t){Mh.nextTick(Yu(t))}:Wu&&Wu.now?$a=function(t){Wu.now(Yu(t))}:kh&&!Nh?(Hu=(bh=new kh).port2,bh.port1.onmessage=Uh,$a=eo(Hu.postMessage,Hu,1)):!Ht.addEventListener||typeof postMessage!="function"||Ht.importScripts||ii(Fh)?$a="onreadystatechange"in(Eo?fa.createElement("script"):{})?function(t){$r.appendChild(Eo?fa.createElement("script"):{}).onreadystatechange=function(){$r.removeChild(this),Vu(t)}}:function(t){setTimeout(Yu(t),0)}:($a=Fh,Ht.addEventListener("message",Uh,!1)));var Uc,Da,Fc,ec,Ju,zu,qu,Qh,Xu=Ku,hp=Wo,Gh=Ht.MutationObserver||Ht.WebKitMutationObserver,Zu=Ht.process,$u=Ht.Promise,Hh=xs(Zu)=="process",Kh=hp(Ht,"queueMicrotask"),Wh=Kh&&Kh.value;Wh||(Uc=function(){var t;for(Hh&&(t=Zu.domain)&&t.exit();Da;){var e=Da.fn;Da=Da.next;try{e()}catch(r){throw Da?ec():Fc=void 0,r}}Fc=void 0,t&&t.enter()},Hh?ec=function(){Zu.nextTick(Uc)}:Gh&&!Nh?(Ju=!0,zu=document.createTextNode(""),new Gh(Uc).observe(zu,{characterData:!0}),ec=function(){zu.data=Ju=!Ju}):$u&&$u.resolve?(qu=$u.resolve(void 0),Qh=qu.then,ec=function(){Qh.call(qu,Uc)}):ec=function(){Xu.call(Ht,Uc)});var ed,jh,Vh=Wh||function(t){t={fn:t,next:void 0},Fc&&(Fc.next=t),Da||(Da=t,ec()),Fc=t},fp=function(t){var e,r;this.promise=new t(function(i,o){if(e!==void 0||r!==void 0)throw TypeError("Bad Promise constructor");e=i,r=o}),this.resolve=Kn(e),this.reject=Kn(r)},Ql={f:function(t){return new fp(t)}},td=function(t,e){return Qi(t),jr(e)&&e.constructor===t?e:(t=Ql.f(t),(0,t.resolve)(e),t.promise)},Gl=function(t){try{return{error:!1,value:t()}}catch(e){return{error:!0,value:e}}},Ap=ni("species"),Yh=Lt.get,gp=Lt.set,pp=Lt.getterFor("Promise"),ts=lp,Jh=Ht.TypeError,rd=Ht.document,Hl=Ht.process,vp=ro("inspectSource"),tc=(ms("fetch"),Ql.f),mp=tc,Qc=xs(Hl)=="process",Ep=!!(rd&&rd.createEvent&&Ht.dispatchEvent),Kl=jo("Promise",function(){if(vp(ts)===String(ts)&&(no===66||!Qc&&typeof PromiseRejectionEvent!="function")||!ts.prototype.finally)return!0;if(51<=no&&/native code/.test(ts))return!1;var t=ts.resolve(1),e=function(r){r(function(){},function(){})};return(t.constructor={})[Ap]=e,!(t.then(function(){})instanceof e)}),_p=Kl||!Oh(function(t){ts.all(t).catch(function(){})}),zh=function(t){var e;return!(!jr(t)||typeof(e=t.then)!="function")&&e},id=function(t,e,r){if(!e.notified){e.notified=!0;var i=e.reactions;Vh(function(){for(var o=e.value,c=e.state==1,h=0;i.length>h;){var C,x,Q,F=i[h++],V=c?F.ok:F.fail,Y=F.resolve,$=F.reject,te=F.domain;try{V?(c||(e.rejection===2&&yp(t,e),e.rejection=1),V===!0?C=o:(te&&te.enter(),C=V(o),te&&(te.exit(),Q=!0)),C===F.promise?$(Jh("Promise-chain cycle")):(x=zh(C))?x.call(C,Y,$):Y(C)):$(o)}catch(ce){te&&!Q&&te.exit(),$(ce)}}e.reactions=[],e.notified=!1,r&&!e.rejection&&Cp(t,e)})}},qh=function(t,e,r){var i,o;Ep?((i=rd.createEvent("Event")).promise=e,i.reason=r,i.initEvent(t,!1,!0),Ht.dispatchEvent(i)):i={promise:e,reason:r},(o=Ht["on"+t])?o(i):t==="unhandledrejection"&&function(c,h){var C=Ht.console;C&&C.error&&(arguments.length===1?C.error(c):C.error(c,h))}("Unhandled promise rejection",r)},Cp=function(t,e){Xu.call(Ht,function(){var r,i=e.value;if(e.rejection!==1&&!e.parent&&(r=Gl(function(){Qc?Hl.emit("unhandledRejection",i,t):qh("unhandledrejection",t,i)}),e.rejection=Qc||e.rejection!==1&&!e.parent?2:1,r.error))throw r.value})},yp=function(t,e){Xu.call(Ht,function(){Qc?Hl.emit("rejectionHandled",t):qh("rejectionhandled",t,e.value)})},rc=function(t,e,r,i){return function(o){t(e,r,o,i)}},ic=function(t,e,r,i){e.done||(e.done=!0,i&&(e=i),e.value=r,e.state=2,id(t,e,!0))},nd=function(t,e,r,i){if(!e.done){e.done=!0,i&&(e=i);try{if(t===r)throw Jh("Promise can't be resolved itself");var o=zh(r);o?Vh(function(){var c={done:!1};try{o.call(r,rc(nd,t,c,e),rc(ic,t,c,e))}catch(h){ic(t,c,h,e)}}):(e.value=r,e.state=1,id(t,e,!1))}catch(c){ic(t,{done:!1},c,e)}}};Kl&&(ts=function(t){De(this,ts,"Promise"),Kn(t),ed.call(this);var e=Yh(this);try{t(rc(nd,this,e),rc(ic,this,e))}catch(r){ic(this,e,r)}},(ed=function(t){gp(this,{type:"Promise",done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=fi(ts.prototype,{then:function(t,e){var r=pp(this),i=tc(Bh(this,ts));return i.ok=typeof t!="function"||t,i.fail=typeof e=="function"&&e,i.domain=Qc?Hl.domain:void 0,r.parent=!0,r.reactions.push(i),r.state!=0&&id(this,r,!1),i.promise},catch:function(t){return this.then(void 0,t)}}),jh=function(){var t=new ed,e=Yh(t);this.promise=t,this.resolve=rc(nd,t,e),this.reject=rc(ic,t,e)},Ql.f=tc=function(t){return t===ts||t===Xh?new jh(t):mp(t)}),Kt({global:!0,wrap:!0,forced:Kl},{Promise:ts}),Be(ts,"Promise",!1,!0),ah("Promise");var Xh=ms("Promise");Kt({target:"Promise",stat:!0,forced:Kl},{reject:function(t){var e=tc(this);return e.reject.call(void 0,t),e.promise}}),Kt({target:"Promise",stat:!0,forced:!0},{resolve:function(t){return td(this===Xh?ts:this,t)}}),Kt({target:"Promise",stat:!0,forced:_p},{all:function(t){var e=this,r=tc(e),i=r.resolve,o=r.reject,c=Gl(function(){var h=Kn(e.resolve),C=[],x=0,Q=1;Se(t,function(F){var V=x++,Y=!1;C.push(void 0),Q++,h.call(e,F).then(function($){Y||(Y=!0,C[V]=$,--Q||i(C))},o)}),--Q||i(C)});return c.error&&o(c.value),r.promise},race:function(t){var e=this,r=tc(e),i=r.reject,o=Gl(function(){var c=Kn(e.resolve);Se(t,function(h){c.call(e,h).then(r.resolve,i)})});return o.error&&i(o.value),r.promise}}),Kt({target:"Promise",stat:!0},{allSettled:function(t){var e=this,r=Ql.f(e),i=r.resolve,o=r.reject,c=Gl(function(){var h=Kn(e.resolve),C=[],x=0,Q=1;Se(t,function(F){var V=x++,Y=!1;C.push(void 0),Q++,h.call(e,F).then(function($){Y||(Y=!0,C[V]={status:"fulfilled",value:$},--Q||i(C))},function($){Y||(Y=!0,C[V]={status:"rejected",reason:$},--Q||i(C))})}),--Q||i(C)});return c.error&&o(c.value),r.promise}}),Kt({target:"Promise",proto:!0,real:!0},{finally:function(t){var e=Bh(this,ms("Promise")),r=typeof t=="function";return this.then(r?function(i){return td(e,t()).then(function(){return i})}:t,r?function(i){return td(e,t()).then(function(){throw i})}:t)}});var it=Dr.Promise;Kt({target:"Array",proto:!0,forced:!qo("map")},{map:function(t){return qe(this,t,1<arguments.length?arguments[1]:void 0)}});var Ip=pi("Array").map,Zh=Array.prototype,_t=function(t){var e=t.map;return t===Zh||t instanceof Array&&e===Zh.map?Ip:e},Sp=Math.max,Tp=Math.min;Kt({target:"Array",proto:!0,forced:!qo("splice")},{splice:function(t,e){var r,i,o,c,h=jn(this),C=Rn(h.length),x=Zi(t,C),Q=arguments.length;if(Q===0?r=i=0:Q===1?(r=0,i=C-x):(r=Q-2,i=Tp(Sp(Yo(e),0),C-x)),9007199254740991<C+r-i)throw TypeError("Maximum allowed length exceeded");for(Q=qa(h,i),o=0;o<i;o++)(c=x+o)in h&&Jo(Q,o,h[c]);if(Q.length=i,r<i){for(o=x;o<C-i;o++){var F=o+r;(c=o+i)in h?h[F]=h[c]:delete h[F]}for(o=C;o>C-i+r;o--)delete h[o-1]}else if(r>i)for(o=C-i;o>x;o--)F=o+r-1,(c=o+i-1)in h?h[F]=h[c]:delete h[F];for(o=0;o<r;o++)h[o+x]=arguments[o+2];return h.length=C-i+r,Q}});var Rp=pi("Array").splice,$h=Array.prototype,An=function(t){var e=t.splice;return t===$h||t instanceof Array&&e===$h.splice?Rp:e},ef=[].indexOf,tf=!!ef&&0>1/[1].indexOf(1,-0),wp=La("indexOf");Kt({target:"Array",proto:!0,forced:tf||wp},{indexOf:function(t){return tf?ef.apply(this,arguments)||0:$i(this,t,1<arguments.length?arguments[1]:void 0)}});var Lp=pi("Array").indexOf,rf=Array.prototype,Vt=function(t){var e=t.indexOf;return t===rf||t instanceof Array&&e===rf.indexOf?Lp:e},Dp=ni("species"),bp=[].slice,Op=Math.max;Kt({target:"Array",proto:!0,forced:!qo("slice")},{slice:function(t,e){var r,i=Tn(this),o=Rn(i.length);if(t=Zi(t,o),e=Zi(e===void 0?o:e,o),Nn(i)&&(typeof(r=i.constructor)!="function"||r!==Array&&!Nn(r.prototype)?jr(r)&&(r=r[Dp])===null&&(r=void 0):r=void 0,r===Array||r===void 0))return bp.call(i,t,e);for(r=new(r===void 0?Array:r)(Op(e-t,0)),o=0;t<e;t++,o++)t in i&&Jo(r,o,i[t]);return r.length=o,r}});var Bp=pi("Array").slice,nf=Array.prototype,en=function(t){var e=t.slice;return t===nf||t instanceof Array&&e===nf.slice?Bp:e},sf=!0;"find"in[]&&Array(1).find(function(){sf=!1}),Kt({target:"Array",proto:!0,forced:sf},{find:function(t){return rt(this,t,1<arguments.length?arguments[1]:void 0)}});var Np=pi("Array").find,of=Array.prototype,rr=function(t){var e=t.find;return t===of||t instanceof Array&&e===of.find?Np:e},af=[].slice,sd={};Kt({target:"Function",proto:!0},{bind:Function.bind||function(t){var e=Kn(this),r=af.call(arguments,1),i=function(){var o=r.concat(af.call(arguments));if(this instanceof i){var c=o.length;if(!(c in sd)){for(var h=[],C=0;C<c;C++)h[C]="a["+C+"]";sd[c]=Function("C,a","return new C("+h.join(",")+")")}o=sd[c](e,o)}else o=e.apply(t,o);return o};return jr(e.prototype)&&(i.prototype=e.prototype),i}});var Pp=pi("Function").bind,cf=Function.prototype,Ti=function(t){var e=t.bind;return t===cf||t instanceof Function&&e===cf.bind?Pp:e};Kt({target:"Array",proto:!0},{includes:function(t){return Pn(this,t,1<arguments.length?arguments[1]:void 0)}});var xp=pi("Array").includes;Kt({target:"String",proto:!0,forced:!Qu("includes")},{includes:function(t){return!!~String(Ko(this)).indexOf(Fu(t),1<arguments.length?arguments[1]:void 0)}});var Mp=pi("String").includes,lf=Array.prototype,uf=String.prototype,_r=function(t){var e=t.includes;return t===lf||t instanceof Array&&e===lf.includes?xp:typeof t=="string"||t===uf||t instanceof String&&e===uf.includes?Mp:e};Kt({target:"Array",proto:!0,forced:La("some")},{some:function(t){return je(this,t,1<arguments.length?arguments[1]:void 0)}});var kp=pi("Array").some,df=Array.prototype,hf=function(t){var e=t.some;return t===df||t instanceof Array&&e===df.some?kp:e};let ff=v;var Af=Object.freeze({__proto__:null,shimMediaStream:b,shimOnTrack:T,shimGetSendersWithDtmf:f,shimGetStats:p,shimSenderReceiverGetStats:E,shimAddTrackRemoveTrackWithNative:u,shimAddTrackRemoveTrack:a,shimPeerConnection:n,fixNegotiationNeeded:s,shimGetUserMedia:g,shimGetDisplayMedia:function(t,e){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&(typeof e=="function"?t.navigator.mediaDevices.getDisplayMedia=function(r){return e(r).then(i=>{let o=r.video&&r.video.width,c=r.video&&r.video.height;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:i,maxFrameRate:r.video&&r.video.frameRate||3}},o&&(r.video.mandatory.maxWidth=o),c&&(r.video.mandatory.maxHeight=c),t.navigator.mediaDevices.getUserMedia(r)})}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}}),gf="".startsWith,Up=Math.min,Fp=Qu("startsWith");Kt({target:"String",proto:!0,forced:!Fp},{startsWith:function(t){var e=String(Ko(this));Fu(t);var r=Rn(Up(1<arguments.length?arguments[1]:void 0,e.length)),i=String(t);return gf?gf.call(e,i,r):e.slice(r,r+i.length)===i}});var Qp=pi("String").startsWith,pf=String.prototype,Gc=function(t){var e=t.startsWith;return typeof t=="string"||t===pf||t instanceof String&&e===pf.startsWith?Qp:e};Kt({target:"String",proto:!0,forced:ii(function(){return`
|
|
59
|
+
\v\f\r \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF`.trim.name!=="trim"})},{trim:function(){return Ch(this)}});var Gp=pi("String").trim,vf=String.prototype,ba=function(t){var e=t.trim;return typeof t=="string"||t===vf||t instanceof String&&e===vf.trim?Gp:e},jt=de(function(t){var e={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};e.localCName=e.generateIdentifier(),e.splitLines=function(r){var i;return _t(i=ba(r).call(r).split(`
|
|
60
|
+
`)).call(i,function(o){return ba(o).call(o)})},e.splitSections=function(r){return r=r.split(`
|
|
61
|
+
m=`),_t(r).call(r,function(i,o){var c;return ba(c=0<o?"m="+i:i).call(c)+`\r
|
|
62
|
+
`})},e.getDescription=function(r){return(r=e.splitSections(r))&&r[0]},e.getMediaSections=function(r){return r=e.splitSections(r),r.shift(),r},e.matchPrefix=function(r,i){var o;return Wt(o=e.splitLines(r)).call(o,function(c){return Vt(c).call(c,i)===0})},e.parseCandidate=function(r){var i;r={foundation:(i=Vt(r).call(r,"a=candidate:")===0?r.substring(12).split(" "):r.substring(10).split(" "))[0],component:Si(i[1],10),protocol:i[2].toLowerCase(),priority:Si(i[3],10),ip:i[4],address:i[4],port:Si(i[5],10),type:i[7]};for(var o=8;o<i.length;o+=2)switch(i[o]){case"raddr":r.relatedAddress=i[o+1];break;case"rport":r.relatedPort=Si(i[o+1],10);break;case"tcptype":r.tcpType=i[o+1];break;case"ufrag":r.ufrag=i[o+1],r.usernameFragment=i[o+1];break;default:r[i[o]]=i[o+1]}return r},e.writeCandidate=function(r){var i=[];i.push(r.foundation),i.push(r.component),i.push(r.protocol.toUpperCase()),i.push(r.priority),i.push(r.address||r.ip),i.push(r.port);var o=r.type;return i.push("typ"),i.push(o),o!=="host"&&r.relatedAddress&&r.relatedPort&&(i.push("raddr"),i.push(r.relatedAddress),i.push("rport"),i.push(r.relatedPort)),r.tcpType&&r.protocol.toLowerCase()==="tcp"&&(i.push("tcptype"),i.push(r.tcpType)),(r.usernameFragment||r.ufrag)&&(i.push("ufrag"),i.push(r.usernameFragment||r.ufrag)),"candidate:"+i.join(" ")},e.parseIceOptions=function(r){return r.substr(14).split(" ")},e.parseRtpMap=function(r){r=r.substr(9).split(" ");var i={payloadType:Si(r.shift(),10)};return r=r[0].split("/"),i.name=r[0],i.clockRate=Si(r[1],10),i.channels=r.length===3?Si(r[2],10):1,i.numChannels=i.channels,i},e.writeRtpMap=function(r){var i=r.payloadType;r.preferredPayloadType!==void 0&&(i=r.preferredPayloadType);var o=r.channels||r.numChannels||1;return"a=rtpmap:"+i+" "+r.name+"/"+r.clockRate+(o!==1?"/"+o:"")+`\r
|
|
63
|
+
`},e.parseExtmap=function(r){var i;return r=r.substr(9).split(" "),{id:Si(r[0],10),direction:0<Vt(i=r[0]).call(i,"/")?r[0].split("/")[1]:"sendrecv",uri:r[1]}},e.writeExtmap=function(r){return"a=extmap:"+(r.id||r.preferredId)+(r.direction&&r.direction!=="sendrecv"?"/"+r.direction:"")+" "+r.uri+`\r
|
|
64
|
+
`},e.parseFmtp=function(r){for(var i={},o=r.substr(Vt(r).call(r," ")+1).split(";"),c=0;c<o.length;c++){var h,C;r=ba(h=o[c]).call(h).split("="),i[ba(C=r[0]).call(C)]=r[1]}return i},e.writeFmtp=function(r){var i="",o=r.payloadType;if(r.preferredPayloadType!==void 0&&(o=r.preferredPayloadType),r.parameters&&vr(r.parameters).length){var c,h=[];Re(c=vr(r.parameters)).call(c,function(C){r.parameters[C]?h.push(C+"="+r.parameters[C]):h.push(C)}),i+="a=fmtp:"+o+" "+h.join(";")+`\r
|
|
65
|
+
`}return i},e.parseRtcpFb=function(r){return r=r.substr(Vt(r).call(r," ")+1).split(" "),{type:r.shift(),parameter:r.join(" ")}},e.writeRtcpFb=function(r){var i,o="",c=r.payloadType;return r.preferredPayloadType!==void 0&&(c=r.preferredPayloadType),r.rtcpFeedback&&r.rtcpFeedback.length&&Re(i=r.rtcpFeedback).call(i,function(h){o+="a=rtcp-fb:"+c+" "+h.type+(h.parameter&&h.parameter.length?" "+h.parameter:"")+`\r
|
|
66
|
+
`}),o},e.parseSsrcMedia=function(r){var i=Vt(r).call(r," "),o={ssrc:Si(r.substr(7,i-7),10)},c=Vt(r).call(r,":",i);return-1<c?(o.attribute=r.substr(i+1,c-i-1),o.value=r.substr(c+1)):o.attribute=r.substr(i+1),o},e.parseSsrcGroup=function(r){return r=r.substr(13).split(" "),{semantics:r.shift(),ssrcs:_t(r).call(r,function(i){return Si(i,10)})}},e.getMid=function(r){if(r=e.matchPrefix(r,"a=mid:")[0])return r.substr(6)},e.parseFingerprint=function(r){return r=r.substr(14).split(" "),{algorithm:r[0].toLowerCase(),value:r[1]}},e.getDtlsParameters=function(r,i){return r=e.matchPrefix(r+i,"a=fingerprint:"),{role:"auto",fingerprints:_t(r).call(r,e.parseFingerprint)}},e.writeDtlsParameters=function(r,i){var o,c="a=setup:"+i+`\r
|
|
67
|
+
`;return Re(o=r.fingerprints).call(o,function(h){c+="a=fingerprint:"+h.algorithm+" "+h.value+`\r
|
|
68
|
+
`}),c},e.getIceParameters=function(r,i){return r=e.splitLines(r),r=ne(r).call(r,e.splitLines(i)),{usernameFragment:Wt(r).call(r,function(o){return Vt(o).call(o,"a=ice-ufrag:")===0})[0].substr(12),password:Wt(r).call(r,function(o){return Vt(o).call(o,"a=ice-pwd:")===0})[0].substr(10)}},e.writeIceParameters=function(r){return"a=ice-ufrag:"+r.usernameFragment+`\r
|
|
69
|
+
a=ice-pwd:`+r.password+`\r
|
|
70
|
+
`},e.parseRtpParameters=function(r){for(var i,o={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},c=e.splitLines(r)[0].split(" "),h=3;h<c.length;h++){var C=c[h],x=e.matchPrefix(r,"a=rtpmap:"+C+" ")[0];if(x){var Q;x=e.parseRtpMap(x);var F=e.matchPrefix(r,"a=fmtp:"+C+" ");switch(x.parameters=F.length?e.parseFmtp(F[0]):{},x.rtcpFeedback=_t(Q=e.matchPrefix(r,"a=rtcp-fb:"+C+" ")).call(Q,e.parseRtcpFb),o.codecs.push(x),x.name.toUpperCase()){case"RED":case"ULPFEC":o.fecMechanisms.push(x.name.toUpperCase())}}}return Re(i=e.matchPrefix(r,"a=extmap:")).call(i,function(V){o.headerExtensions.push(e.parseExtmap(V))}),o},e.writeRtpDescription=function(r,i){var o,c,h,C="";C+="m="+r+" ",C+=0<i.codecs.length?"9":"0",C+=" UDP/TLS/RTP/SAVPF ",C+=_t(o=i.codecs).call(o,function(F){return F.preferredPayloadType!==void 0?F.preferredPayloadType:F.payloadType}).join(" ")+`\r
|
|
71
|
+
`,C+=`c=IN IP4 0.0.0.0\r
|
|
72
|
+
`,C+=`a=rtcp:9 IN IP4 0.0.0.0\r
|
|
73
|
+
`,Re(c=i.codecs).call(c,function(F){C+=e.writeRtpMap(F),C+=e.writeFmtp(F),C+=e.writeRtcpFb(F)});var x,Q=0;return Re(h=i.codecs).call(h,function(F){F.maxptime>Q&&(Q=F.maxptime)}),0<Q&&(C+="a=maxptime:"+Q+`\r
|
|
74
|
+
`),C+=`a=rtcp-mux\r
|
|
75
|
+
`,i.headerExtensions&&Re(x=i.headerExtensions).call(x,function(F){C+=e.writeExtmap(F)}),C},e.parseRtpEncodingParameters=function(r){var i,o,c,h,C,x,Q,F=[],V=e.parseRtpParameters(r),Y=Vt(i=V.fecMechanisms).call(i,"RED")!==-1,$=Vt(o=V.fecMechanisms).call(o,"ULPFEC")!==-1;i=Wt(c=_t(h=e.matchPrefix(r,"a=ssrc:")).call(h,function(et){return e.parseSsrcMedia(et)})).call(c,function(et){return et.attribute==="cname"});var te=0<i.length&&i[0].ssrc;c=_t(C=e.matchPrefix(r,"a=ssrc-group:FID")).call(C,function(et){return et=et.substr(17).split(" "),_t(et).call(et,function(pt){return Si(pt,10)})}),0<c.length&&1<c[0].length&&c[0][0]===te&&(Q=c[0][1]),Re(x=V.codecs).call(x,function(et){et.name.toUpperCase()==="RTX"&&et.parameters.apt&&(et={ssrc:te,codecPayloadType:Si(et.parameters.apt,10)},te&&Q&&(et.rtx={ssrc:Q}),F.push(et),Y&&((et=JSON.parse(ht(et))).fec={ssrc:te,mechanism:$?"red+ulpfec":"red"},F.push(et)))}),F.length===0&&te&&F.push({ssrc:te});var ce,Ae,Me=e.matchPrefix(r,"b=");return Me.length&&(Me=Vt(ce=Me[0]).call(ce,"b=TIAS:")===0?Si(Me[0].substr(7),10):Vt(Ae=Me[0]).call(Ae,"b=AS:")===0?950*Si(Me[0].substr(5),10)-16e3:void 0,Re(F).call(F,function(et){et.maxBitrate=Me})),F},e.parseRtcpParameters=function(r){var i,o,c={},h=Wt(i=_t(o=e.matchPrefix(r,"a=ssrc:")).call(o,function(C){return e.parseSsrcMedia(C)})).call(i,function(C){return C.attribute==="cname"})[0];return h&&(c.cname=h.value,c.ssrc=h.ssrc),i=e.matchPrefix(r,"a=rtcp-rsize"),c.reducedSize=0<i.length,c.compound=i.length===0,r=e.matchPrefix(r,"a=rtcp-mux"),c.mux=0<r.length,c},e.parseMsid=function(r){var i,o,c,h=e.matchPrefix(r,"a=msid:");return h.length===1?{stream:(c=h[0].substr(7).split(" "))[0],track:c[1]}:(r=Wt(i=_t(o=e.matchPrefix(r,"a=ssrc:")).call(o,function(C){return e.parseSsrcMedia(C)})).call(i,function(C){return C.attribute==="msid"}),0<r.length?{stream:(c=r[0].value.split(" "))[0],track:c[1]}:void 0)},e.generateSessionId=function(){return Math.random().toString().substr(2,21)},e.writeSessionBoilerplate=function(r,i,o){return i=i!==void 0?i:2,`v=0\r
|
|
76
|
+
o=`+(o||"thisisadapterortc")+" "+(r||e.generateSessionId())+" "+i+` IN IP4 127.0.0.1\r
|
|
77
|
+
s=-\r
|
|
78
|
+
t=0 0\r
|
|
79
|
+
`},e.writeMediaSection=function(r,i,o,c){return i=e.writeRtpDescription(r.kind,i),i+=e.writeIceParameters(r.iceGatherer.getLocalParameters()),i+=e.writeDtlsParameters(r.dtlsTransport.getLocalParameters(),o==="offer"?"actpass":"active"),i+="a=mid:"+r.mid+`\r
|
|
80
|
+
`,r.direction?i+="a="+r.direction+`\r
|
|
81
|
+
`:r.rtpSender&&r.rtpReceiver?i+=`a=sendrecv\r
|
|
82
|
+
`:r.rtpSender?i+=`a=sendonly\r
|
|
83
|
+
`:r.rtpReceiver?i+=`a=recvonly\r
|
|
84
|
+
`:i+=`a=inactive\r
|
|
85
|
+
`,r.rtpSender&&(o="msid:"+c.id+" "+r.rtpSender.track.id+`\r
|
|
86
|
+
`,i=i+("a="+o)+("a=ssrc:"+r.sendEncodingParameters[0].ssrc+" "+o),r.sendEncodingParameters[0].rtx&&(i+="a=ssrc:"+r.sendEncodingParameters[0].rtx.ssrc+" "+o,i+="a=ssrc-group:FID "+r.sendEncodingParameters[0].ssrc+" "+r.sendEncodingParameters[0].rtx.ssrc+`\r
|
|
87
|
+
`)),i+="a=ssrc:"+r.sendEncodingParameters[0].ssrc+" cname:"+e.localCName+`\r
|
|
88
|
+
`,r.rtpSender&&r.sendEncodingParameters[0].rtx&&(i+="a=ssrc:"+r.sendEncodingParameters[0].rtx.ssrc+" cname:"+e.localCName+`\r
|
|
89
|
+
`),i},e.getDirection=function(r,i){r=e.splitLines(r);for(var o=0;o<r.length;o++)switch(r[o]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[o].substr(2)}return i?e.getDirection(i):"sendrecv"},e.getKind=function(r){return e.splitLines(r)[0].split(" ")[0].substr(2)},e.isRejected=function(r){return r.split(" ",2)[1]==="0"},e.parseMLine=function(r){return r=e.splitLines(r)[0].substr(2).split(" "),{kind:r[0],port:Si(r[1],10),protocol:r[2],fmt:en(r).call(r,3).join(" ")}},e.parseOLine=function(r){return r=e.matchPrefix(r,"o=")[0].substr(2).split(" "),{username:r[0],sessionId:r[1],sessionVersion:Si(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},e.isValidSDP=function(r){if(typeof r!="string"||r.length===0)return!1;r=e.splitLines(r);for(var i=0;i<r.length;i++)if(2>r[i].length||r[i].charAt(1)!=="=")return!1;return!0},t.exports=e}),Hp=function(t,e){function r(h,C){C.addTrack(h),C.dispatchEvent(new t.MediaStreamTrackEvent("addtrack",{track:h}))}function i(h,C,x,Q){var F=new Event("track");F.track=C,F.receiver=x,F.transceiver={receiver:x},F.streams=Q,t.setTimeout(function(){h._dispatchEvent("track",F)})}var o=function(h){var C=this,x=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach(function(F){C[F]=x[F].bind(x)}),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",h=JSON.parse(JSON.stringify(h||{})),this.usingBundle=h.bundlePolicy==="max-bundle",h.rtcpMuxPolicy==="negotiate")throw R("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(h.rtcpMuxPolicy||(h.rtcpMuxPolicy="require"),h.iceTransportPolicy){case"all":case"relay":break;default:h.iceTransportPolicy="all"}switch(h.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:h.bundlePolicy="balanced"}if(h.iceServers=function(F,V){var Y=!1;return(F=JSON.parse(JSON.stringify(F))).filter(function($){if($&&($.urls||$.url)){var te=$.urls||$.url;$.url&&!$.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var ce=typeof te=="string";return ce&&(te=[te]),te=te.filter(function(Ae){return Ae.indexOf("turn:")!==0||Ae.indexOf("transport=udp")===-1||Ae.indexOf("turn:[")!==-1||Y?Ae.indexOf("stun:")===0&&14393<=V&&Ae.indexOf("?transport=udp")===-1:(Y=!0,!0)}),delete $.url,$.urls=ce?te[0]:te,!!te.length}})}(h.iceServers||[],e),this._iceGatherers=[],h.iceCandidatePoolSize)for(var Q=h.iceCandidatePoolSize;0<Q;Q--)this._iceGatherers.push(new t.RTCIceGatherer({iceServers:h.iceServers,gatherPolicy:h.iceTransportPolicy}));else h.iceCandidatePoolSize=0;this._config=h,this.transceivers=[],this._sdpSessionId=jt.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(o.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(o.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),o.prototype.onicecandidate=null,o.prototype.onaddstream=null,o.prototype.ontrack=null,o.prototype.onremovestream=null,o.prototype.onsignalingstatechange=null,o.prototype.oniceconnectionstatechange=null,o.prototype.onconnectionstatechange=null,o.prototype.onicegatheringstatechange=null,o.prototype.onnegotiationneeded=null,o.prototype.ondatachannel=null,o.prototype._dispatchEvent=function(h,C){this._isClosed||(this.dispatchEvent(C),typeof this["on"+h]=="function"&&this["on"+h](C))},o.prototype._emitGatheringStateChange=function(){var h=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",h)},o.prototype.getConfiguration=function(){return this._config},o.prototype.getLocalStreams=function(){return this.localStreams},o.prototype.getRemoteStreams=function(){return this.remoteStreams},o.prototype._createTransceiver=function(h,C){var x=0<this.transceivers.length;return h={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:h,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0},this.usingBundle&&x?(h.iceTransport=this.transceivers[0].iceTransport,h.dtlsTransport=this.transceivers[0].dtlsTransport):(x=this._createIceAndDtlsTransports(),h.iceTransport=x.iceTransport,h.dtlsTransport=x.dtlsTransport),C||this.transceivers.push(h),h},o.prototype.addTrack=function(h,C){if(this._isClosed)throw R("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var x;if(this.transceivers.find(function(F){return F.track===h}))throw R("InvalidAccessError","Track already exists.");for(var Q=0;Q<this.transceivers.length;Q++)this.transceivers[Q].track||this.transceivers[Q].kind!==h.kind||(x=this.transceivers[Q]);return x||(x=this._createTransceiver(h.kind)),this._maybeFireNegotiationNeeded(),this.localStreams.indexOf(C)===-1&&this.localStreams.push(C),x.track=h,x.stream=C,x.rtpSender=new t.RTCRtpSender(h,x.dtlsTransport),x.rtpSender},o.prototype.addStream=function(h){var C=this;if(15025<=e)h.getTracks().forEach(function(Q){C.addTrack(Q,h)});else{var x=h.clone();h.getTracks().forEach(function(Q,F){var V=x.getTracks()[F];Q.addEventListener("enabled",function(Y){V.enabled=Y.enabled})}),x.getTracks().forEach(function(Q){C.addTrack(Q,x)})}},o.prototype.removeTrack=function(h){if(this._isClosed)throw R("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(h instanceof t.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var C=this.transceivers.find(function(Q){return Q.rtpSender===h});if(!C)throw R("InvalidAccessError","Sender was not created by this connection.");var x=C.stream;C.rtpSender.stop(),C.rtpSender=null,C.track=null,C.stream=null,this.transceivers.map(function(Q){return Q.stream}).indexOf(x)===-1&&-1<this.localStreams.indexOf(x)&&this.localStreams.splice(this.localStreams.indexOf(x),1),this._maybeFireNegotiationNeeded()},o.prototype.removeStream=function(h){var C=this;h.getTracks().forEach(function(x){var Q=C.getSenders().find(function(F){return F.track===x});Q&&C.removeTrack(Q)})},o.prototype.getSenders=function(){return this.transceivers.filter(function(h){return!!h.rtpSender}).map(function(h){return h.rtpSender})},o.prototype.getReceivers=function(){return this.transceivers.filter(function(h){return!!h.rtpReceiver}).map(function(h){return h.rtpReceiver})},o.prototype._createIceGatherer=function(h,C){var x=this;if(C&&0<h)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var Q=new t.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(Q,"state",{value:"new",writable:!0}),this.transceivers[h].bufferedCandidateEvents=[],this.transceivers[h].bufferCandidates=function(F){var V=!F.candidate||Object.keys(F.candidate).length===0;Q.state=V?"completed":"gathering",x.transceivers[h].bufferedCandidateEvents!==null&&x.transceivers[h].bufferedCandidateEvents.push(F)},Q.addEventListener("localcandidate",this.transceivers[h].bufferCandidates),Q},o.prototype._gather=function(h,C){var x=this,Q=this.transceivers[C].iceGatherer;if(!Q.onlocalcandidate){var F=this.transceivers[C].bufferedCandidateEvents;this.transceivers[C].bufferedCandidateEvents=null,Q.removeEventListener("localcandidate",this.transceivers[C].bufferCandidates),Q.onlocalcandidate=function(V){if(!(x.usingBundle&&0<C)){var Y=new Event("icecandidate");Y.candidate={sdpMid:h,sdpMLineIndex:C};var $=V.candidate;(V=!$||Object.keys($).length===0)?Q.state!=="new"&&Q.state!=="gathering"||(Q.state="completed"):(Q.state==="new"&&(Q.state="gathering"),$.component=1,$.ufrag=Q.getLocalParameters().usernameFragment,$=jt.writeCandidate($),Y.candidate=Object.assign(Y.candidate,jt.parseCandidate($)),Y.candidate.candidate=$,Y.candidate.toJSON=function(){return{candidate:Y.candidate.candidate,sdpMid:Y.candidate.sdpMid,sdpMLineIndex:Y.candidate.sdpMLineIndex,usernameFragment:Y.candidate.usernameFragment}}),$=jt.getMediaSections(x._localDescription.sdp),$[Y.candidate.sdpMLineIndex]+=V?`a=end-of-candidates\r
|
|
90
|
+
`:"a="+Y.candidate.candidate+`\r
|
|
91
|
+
`,x._localDescription.sdp=jt.getDescription(x._localDescription.sdp)+$.join(""),$=x.transceivers.every(function(te){return te.iceGatherer&&te.iceGatherer.state==="completed"}),x.iceGatheringState!=="gathering"&&(x.iceGatheringState="gathering",x._emitGatheringStateChange()),V||x._dispatchEvent("icecandidate",Y),$&&(x._dispatchEvent("icecandidate",new Event("icecandidate")),x.iceGatheringState="complete",x._emitGatheringStateChange())}},t.setTimeout(function(){F.forEach(function(V){Q.onlocalcandidate(V)})},0)}},o.prototype._createIceAndDtlsTransports=function(){var h=this,C=new t.RTCIceTransport(null);C.onicestatechange=function(){h._updateIceConnectionState(),h._updateConnectionState()};var x=new t.RTCDtlsTransport(C);return x.ondtlsstatechange=function(){h._updateConnectionState()},x.onerror=function(){Object.defineProperty(x,"state",{value:"failed",writable:!0}),h._updateConnectionState()},{iceTransport:C,dtlsTransport:x}},o.prototype._disposeIceAndDtlsTransports=function(h){var C=this.transceivers[h].iceGatherer;C&&(delete C.onlocalcandidate,delete this.transceivers[h].iceGatherer),(C=this.transceivers[h].iceTransport)&&(delete C.onicestatechange,delete this.transceivers[h].iceTransport),(C=this.transceivers[h].dtlsTransport)&&(delete C.ondtlsstatechange,delete C.onerror,delete this.transceivers[h].dtlsTransport)},o.prototype._transceive=function(h,C,x){var Q=d(h.localCapabilities,h.remoteCapabilities);C&&h.rtpSender&&(Q.encodings=h.sendEncodingParameters,Q.rtcp={cname:jt.localCName,compound:h.rtcpParameters.compound},h.recvEncodingParameters.length&&(Q.rtcp.ssrc=h.recvEncodingParameters[0].ssrc),h.rtpSender.send(Q)),x&&h.rtpReceiver&&0<Q.codecs.length&&(h.kind==="video"&&h.recvEncodingParameters&&15019>e&&h.recvEncodingParameters.forEach(function(F){delete F.rtx}),h.recvEncodingParameters.length?Q.encodings=h.recvEncodingParameters:Q.encodings=[{}],Q.rtcp={compound:h.rtcpParameters.compound},h.rtcpParameters.cname&&(Q.rtcp.cname=h.rtcpParameters.cname),h.sendEncodingParameters.length&&(Q.rtcp.ssrc=h.sendEncodingParameters[0].ssrc),h.rtpReceiver.receive(Q))},o.prototype.setLocalDescription=function(h){var C=this;if(["offer","answer"].indexOf(h.type)===-1)return Promise.reject(R("TypeError",'Unsupported type "'+h.type+'"'));if(!A("setLocalDescription",h.type,C.signalingState)||C._isClosed)return Promise.reject(R("InvalidStateError","Can not set local "+h.type+" in state "+C.signalingState));if(h.type==="offer"){var x=jt.splitSections(h.sdp),Q=x.shift();x.forEach(function(V,Y){V=jt.parseRtpParameters(V),C.transceivers[Y].localCapabilities=V}),C.transceivers.forEach(function(V,Y){C._gather(V.mid,Y)})}else if(h.type==="answer"){x=jt.splitSections(C._remoteDescription.sdp),Q=x.shift();var F=0<jt.matchPrefix(Q,"a=ice-lite").length;x.forEach(function(V,Y){var $=C.transceivers[Y],te=$.iceGatherer,ce=$.iceTransport,Ae=$.dtlsTransport,Me=$.localCapabilities,et=$.remoteCapabilities;if(!(jt.isRejected(V)&&jt.matchPrefix(V,"a=bundle-only").length===0||$.rejected)){var pt=jt.getIceParameters(V,Q);V=jt.getDtlsParameters(V,Q),F&&(V.role="server"),C.usingBundle&&Y!==0||(C._gather($.mid,Y),ce.state==="new"&&ce.start(te,pt,F?"controlling":"controlled"),Ae.state==="new"&&Ae.start(V)),Y=d(Me,et),C._transceive($,0<Y.codecs.length,!1)}})}return C._localDescription={type:h.type,sdp:h.sdp},h.type==="offer"?C._updateSignalingState("have-local-offer"):C._updateSignalingState("stable"),Promise.resolve()},o.prototype.setRemoteDescription=function(h){var C=this;if(["offer","answer"].indexOf(h.type)===-1)return Promise.reject(R("TypeError",'Unsupported type "'+h.type+'"'));if(!A("setRemoteDescription",h.type,C.signalingState)||C._isClosed)return Promise.reject(R("InvalidStateError","Can not set remote "+h.type+" in state "+C.signalingState));var x={};C.remoteStreams.forEach(function(ce){x[ce.id]=ce});var Q=[],F=jt.splitSections(h.sdp),V=F.shift(),Y=0<jt.matchPrefix(V,"a=ice-lite").length,$=0<jt.matchPrefix(V,"a=group:BUNDLE ").length;C.usingBundle=$;var te=jt.matchPrefix(V,"a=ice-options:")[0];return C.canTrickleIceCandidates=!!te&&0<=te.substr(14).split(" ").indexOf("trickle"),F.forEach(function(ce,Ae){var Me=jt.splitLines(ce),et=jt.getKind(ce),pt=jt.isRejected(ce)&&jt.matchPrefix(ce,"a=bundle-only").length===0,Qt=Me[0].substr(2).split(" ")[2];Me=jt.getDirection(ce,V);var kt=jt.parseMsid(ce),Rr=jt.getMid(ce)||jt.generateIdentifier();if(pt||et==="application"&&(Qt==="DTLS/SCTP"||Qt==="UDP/DTLS/SCTP"))C.transceivers[Ae]={mid:Rr,kind:et,protocol:Qt,rejected:!0};else{var mt,sr;!pt&&C.transceivers[Ae]&&C.transceivers[Ae].rejected&&(C.transceivers[Ae]=C._createTransceiver(et,!0));var yr,ci,Vi=jt.parseRtpParameters(ce);pt||(yr=jt.getIceParameters(ce,V),(ci=jt.getDtlsParameters(ce,V)).role="client"),Qt=jt.parseRtpEncodingParameters(ce);var Wr=jt.parseRtcpParameters(ce),On=0<jt.matchPrefix(ce,"a=end-of-candidates",V).length;if(ce=jt.matchPrefix(ce,"a=candidate:").map(function(ct){return jt.parseCandidate(ct)}).filter(function(ct){return ct.component===1}),(h.type==="offer"||h.type==="answer")&&!pt&&$&&0<Ae&&C.transceivers[Ae]&&(C._disposeIceAndDtlsTransports(Ae),C.transceivers[Ae].iceGatherer=C.transceivers[0].iceGatherer,C.transceivers[Ae].iceTransport=C.transceivers[0].iceTransport,C.transceivers[Ae].dtlsTransport=C.transceivers[0].dtlsTransport,C.transceivers[Ae].rtpSender&&C.transceivers[Ae].rtpSender.setTransport(C.transceivers[0].dtlsTransport),C.transceivers[Ae].rtpReceiver&&C.transceivers[Ae].rtpReceiver.setTransport(C.transceivers[0].dtlsTransport)),h.type!=="offer"||pt){if(h.type==="answer"&&!pt){et=(mt=C.transceivers[Ae]).iceGatherer;var Ce=mt.iceTransport,Pe=mt.dtlsTransport,Je=mt.rtpReceiver;pt=mt.sendEncodingParameters,Rr=mt.localCapabilities,C.transceivers[Ae].recvEncodingParameters=Qt,C.transceivers[Ae].remoteCapabilities=Vi,C.transceivers[Ae].rtcpParameters=Wr,ce.length&&Ce.state==="new"&&(!Y&&!On||$&&Ae!==0?ce.forEach(function(ct){S(mt.iceTransport,ct)}):Ce.setRemoteCandidates(ce)),$&&Ae!==0||(Ce.state==="new"&&Ce.start(et,yr,"controlling"),Pe.state==="new"&&Pe.start(ci)),!d(mt.localCapabilities,mt.remoteCapabilities).codecs.filter(function(ct){return ct.name.toLowerCase()==="rtx"}).length&&mt.sendEncodingParameters[0].rtx&&delete mt.sendEncodingParameters[0].rtx,C._transceive(mt,Me==="sendrecv"||Me==="recvonly",Me==="sendrecv"||Me==="sendonly"),!Je||Me!=="sendrecv"&&Me!=="sendonly"?delete mt.rtpReceiver:(sr=Je.track,kt?(x[kt.stream]||(x[kt.stream]=new t.MediaStream),r(sr,x[kt.stream]),Q.push([sr,Je,x[kt.stream]])):(x.default||(x.default=new t.MediaStream),r(sr,x.default),Q.push([sr,Je,x.default])))}}else(mt=C.transceivers[Ae]||C._createTransceiver(et)).mid=Rr,mt.iceGatherer||(mt.iceGatherer=C._createIceGatherer(Ae,$)),ce.length&&mt.iceTransport.state==="new"&&(!On||$&&Ae!==0?ce.forEach(function(ct){S(mt.iceTransport,ct)}):mt.iceTransport.setRemoteCandidates(ce)),Rr=t.RTCRtpReceiver.getCapabilities(et),15019>e&&(Rr.codecs=Rr.codecs.filter(function(ct){return ct.name!=="rtx"})),pt=mt.sendEncodingParameters||[{ssrc:1001*(2*Ae+2)}],yr=!1,Me==="sendrecv"||Me==="sendonly"?(yr=!mt.rtpReceiver,Je=mt.rtpReceiver||new t.RTCRtpReceiver(mt.dtlsTransport,et),yr&&(sr=Je.track,kt&&kt.stream==="-"||(kt?(x[kt.stream]||(x[kt.stream]=new t.MediaStream,Object.defineProperty(x[kt.stream],"id",{get:function(){return kt.stream}})),Object.defineProperty(sr,"id",{get:function(){return kt.track}}),Ce=x[kt.stream]):(x.default||(x.default=new t.MediaStream),Ce=x.default)),Ce&&(r(sr,Ce),mt.associatedRemoteMediaStreams.push(Ce)),Q.push([sr,Je,Ce]))):mt.rtpReceiver&&mt.rtpReceiver.track&&(mt.associatedRemoteMediaStreams.forEach(function(ct){var ut=ct.getTracks().find(function(Gt){return Gt.id===mt.rtpReceiver.track.id});ut&&function(Gt,It){It.removeTrack(Gt),It.dispatchEvent(new t.MediaStreamTrackEvent("removetrack",{track:Gt}))}(ut,ct)}),mt.associatedRemoteMediaStreams=[]),mt.localCapabilities=Rr,mt.remoteCapabilities=Vi,mt.rtpReceiver=Je,mt.rtcpParameters=Wr,mt.sendEncodingParameters=pt,mt.recvEncodingParameters=Qt,C._transceive(C.transceivers[Ae],!1,yr)}}),C._dtlsRole===void 0&&(C._dtlsRole=h.type==="offer"?"active":"passive"),C._remoteDescription={type:h.type,sdp:h.sdp},h.type==="offer"?C._updateSignalingState("have-remote-offer"):C._updateSignalingState("stable"),Object.keys(x).forEach(function(ce){var Ae=x[ce];if(Ae.getTracks().length){if(C.remoteStreams.indexOf(Ae)===-1){C.remoteStreams.push(Ae);var Me=new Event("addstream");Me.stream=Ae,t.setTimeout(function(){C._dispatchEvent("addstream",Me)})}Q.forEach(function(et){var pt=et[0],Qt=et[1];Ae.id===et[2].id&&i(C,pt,Qt,[Ae])})}}),Q.forEach(function(ce){ce[2]||i(C,ce[0],ce[1],[])}),t.setTimeout(function(){C&&C.transceivers&&C.transceivers.forEach(function(ce){ce.iceTransport&&ce.iceTransport.state==="new"&&0<ce.iceTransport.getRemoteCandidates().length&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),ce.iceTransport.addRemoteCandidate({}))})},4e3),Promise.resolve()},o.prototype.close=function(){this.transceivers.forEach(function(h){h.iceTransport&&h.iceTransport.stop(),h.dtlsTransport&&h.dtlsTransport.stop(),h.rtpSender&&h.rtpSender.stop(),h.rtpReceiver&&h.rtpReceiver.stop()}),this._isClosed=!0,this._updateSignalingState("closed")},o.prototype._updateSignalingState=function(h){this.signalingState=h,h=new Event("signalingstatechange"),this._dispatchEvent("signalingstatechange",h)},o.prototype._maybeFireNegotiationNeeded=function(){var h=this;this.signalingState==="stable"&&this.needNegotiation!==!0&&(this.needNegotiation=!0,t.setTimeout(function(){if(h.needNegotiation){h.needNegotiation=!1;var C=new Event("negotiationneeded");h._dispatchEvent("negotiationneeded",C)}},0))},o.prototype._updateIceConnectionState=function(){var h,C={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};this.transceivers.forEach(function(x){x.iceTransport&&!x.rejected&&C[x.iceTransport.state]++}),h="new",0<C.failed?h="failed":0<C.checking?h="checking":0<C.disconnected?h="disconnected":0<C.new?h="new":0<C.connected?h="connected":0<C.completed&&(h="completed"),h!==this.iceConnectionState&&(this.iceConnectionState=h,h=new Event("iceconnectionstatechange"),this._dispatchEvent("iceconnectionstatechange",h))},o.prototype._updateConnectionState=function(){var h,C={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};this.transceivers.forEach(function(x){x.iceTransport&&x.dtlsTransport&&!x.rejected&&(C[x.iceTransport.state]++,C[x.dtlsTransport.state]++)}),C.connected+=C.completed,h="new",0<C.failed?h="failed":0<C.connecting?h="connecting":0<C.disconnected?h="disconnected":0<C.new?h="new":0<C.connected&&(h="connected"),h!==this.connectionState&&(this.connectionState=h,h=new Event("connectionstatechange"),this._dispatchEvent("connectionstatechange",h))},o.prototype.createOffer=function(h){var C=this;if(C._isClosed)return Promise.reject(R("InvalidStateError","Can not call createOffer after close"));var x=C.transceivers.filter(function(V){return V.kind==="audio"}).length,Q=C.transceivers.filter(function(V){return V.kind==="video"}).length;if(h){if(h.mandatory||h.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");h.offerToReceiveAudio!==void 0&&(x=h.offerToReceiveAudio===!0?1:h.offerToReceiveAudio===!1?0:h.offerToReceiveAudio),h.offerToReceiveVideo!==void 0&&(Q=h.offerToReceiveVideo===!0?1:h.offerToReceiveVideo===!1?0:h.offerToReceiveVideo)}for(C.transceivers.forEach(function(V){V.kind==="audio"?0>--x&&(V.wantReceive=!1):V.kind==="video"&&0>--Q&&(V.wantReceive=!1)});0<x||0<Q;)0<x&&(C._createTransceiver("audio"),x--),0<Q&&(C._createTransceiver("video"),Q--);var F=jt.writeSessionBoilerplate(C._sdpSessionId,C._sdpSessionVersion++);return C.transceivers.forEach(function(V,Y){var $=V.track,te=V.kind,ce=V.mid||jt.generateIdentifier();V.mid=ce,V.iceGatherer||(V.iceGatherer=C._createIceGatherer(Y,C.usingBundle)),ce=t.RTCRtpSender.getCapabilities(te),15019>e&&(ce.codecs=ce.codecs.filter(function(Ae){return Ae.name!=="rtx"})),ce.codecs.forEach(function(Ae){Ae.name==="H264"&&Ae.parameters["level-asymmetry-allowed"]===void 0&&(Ae.parameters["level-asymmetry-allowed"]="1"),V.remoteCapabilities&&V.remoteCapabilities.codecs&&V.remoteCapabilities.codecs.forEach(function(Me){Ae.name.toLowerCase()===Me.name.toLowerCase()&&Ae.clockRate===Me.clockRate&&(Ae.preferredPayloadType=Me.payloadType)})}),ce.headerExtensions.forEach(function(Ae){(V.remoteCapabilities&&V.remoteCapabilities.headerExtensions||[]).forEach(function(Me){Ae.uri===Me.uri&&(Ae.id=Me.id)})}),Y=V.sendEncodingParameters||[{ssrc:1001*(2*Y+1)}],$&&15019<=e&&te==="video"&&!Y[0].rtx&&(Y[0].rtx={ssrc:Y[0].ssrc+1}),V.wantReceive&&(V.rtpReceiver=new t.RTCRtpReceiver(V.dtlsTransport,te)),V.localCapabilities=ce,V.sendEncodingParameters=Y}),C._config.bundlePolicy!=="max-compat"&&(F+="a=group:BUNDLE "+C.transceivers.map(function(V){return V.mid}).join(" ")+`\r
|
|
92
|
+
`),F+=`a=ice-options:trickle\r
|
|
93
|
+
`,C.transceivers.forEach(function(V,Y){F+=l(V,V.localCapabilities,"offer",V.stream,C._dtlsRole),F+=`a=rtcp-rsize\r
|
|
94
|
+
`,!V.iceGatherer||C.iceGatheringState==="new"||Y!==0&&C.usingBundle||(V.iceGatherer.getLocalCandidates().forEach(function($){$.component=1,F+="a="+jt.writeCandidate($)+`\r
|
|
95
|
+
`}),V.iceGatherer.state==="completed"&&(F+=`a=end-of-candidates\r
|
|
96
|
+
`))}),h=new t.RTCSessionDescription({type:"offer",sdp:F}),Promise.resolve(h)},o.prototype.createAnswer=function(){var h=this;if(h._isClosed)return Promise.reject(R("InvalidStateError","Can not call createAnswer after close"));if(h.signalingState!=="have-remote-offer"&&h.signalingState!=="have-local-pranswer")return Promise.reject(R("InvalidStateError","Can not call createAnswer in signalingState "+h.signalingState));var C=jt.writeSessionBoilerplate(h._sdpSessionId,h._sdpSessionVersion++);h.usingBundle&&(C+="a=group:BUNDLE "+h.transceivers.map(function(F){return F.mid}).join(" ")+`\r
|
|
97
|
+
`),C+=`a=ice-options:trickle\r
|
|
98
|
+
`;var x=jt.getMediaSections(h._remoteDescription.sdp).length;h.transceivers.forEach(function(F,V){if(!(V+1>x)){if(F.rejected)return F.kind==="application"?F.protocol==="DTLS/SCTP"?C+=`m=application 0 DTLS/SCTP 5000\r
|
|
99
|
+
`:C+="m=application 0 "+F.protocol+` webrtc-datachannel\r
|
|
100
|
+
`:F.kind==="audio"?C+=`m=audio 0 UDP/TLS/RTP/SAVPF 0\r
|
|
101
|
+
a=rtpmap:0 PCMU/8000\r
|
|
102
|
+
`:F.kind==="video"&&(C+=`m=video 0 UDP/TLS/RTP/SAVPF 120\r
|
|
103
|
+
a=rtpmap:120 VP8/90000\r
|
|
104
|
+
`),void(C+=`c=IN IP4 0.0.0.0\r
|
|
105
|
+
a=inactive\r
|
|
106
|
+
a=mid:`+F.mid+`\r
|
|
107
|
+
`);var Y;F.stream&&(F.kind==="audio"?Y=F.stream.getAudioTracks()[0]:F.kind==="video"&&(Y=F.stream.getVideoTracks()[0]),Y&&15019<=e&&F.kind==="video"&&!F.sendEncodingParameters[0].rtx&&(F.sendEncodingParameters[0].rtx={ssrc:F.sendEncodingParameters[0].ssrc+1})),V=d(F.localCapabilities,F.remoteCapabilities),!V.codecs.filter(function($){return $.name.toLowerCase()==="rtx"}).length&&F.sendEncodingParameters[0].rtx&&delete F.sendEncodingParameters[0].rtx,C+=l(F,V,"answer",F.stream,h._dtlsRole),F.rtcpParameters&&F.rtcpParameters.reducedSize&&(C+=`a=rtcp-rsize\r
|
|
108
|
+
`)}});var Q=new t.RTCSessionDescription({type:"answer",sdp:C});return Promise.resolve(Q)},o.prototype.addIceCandidate=function(h){var C,x=this;return h&&h.sdpMLineIndex===void 0&&!h.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise(function(Q,F){if(!x._remoteDescription)return F(R("InvalidStateError","Can not add ICE candidate without a remote description"));if(h&&h.candidate!==""){var V=h.sdpMLineIndex;if(h.sdpMid){for(var Y=0;Y<x.transceivers.length;Y++)if(x.transceivers[Y].mid===h.sdpMid){V=Y;break}}var $=x.transceivers[V];if(!$)return F(R("OperationError","Can not add ICE candidate"));if($.rejected||(Y=0<Object.keys(h.candidate).length?jt.parseCandidate(h.candidate):{},Y.protocol==="tcp"&&(Y.port===0||Y.port===9)||Y.component&&Y.component!==1))return Q();if((V===0||0<V&&$.iceTransport!==x.transceivers[0].iceTransport)&&!S($.iceTransport,Y))return F(R("OperationError","Can not add ICE candidate"));F=h.candidate.trim(),F.indexOf("a=")===0&&(F=F.substr(2)),(C=jt.getMediaSections(x._remoteDescription.sdp))[V]+="a="+(Y.type?F:"end-of-candidates")+`\r
|
|
109
|
+
`,x._remoteDescription.sdp=jt.getDescription(x._remoteDescription.sdp)+C.join("")}else for(V=0;V<x.transceivers.length&&(x.transceivers[V].rejected||(x.transceivers[V].iceTransport.addRemoteCandidate({}),(C=jt.getMediaSections(x._remoteDescription.sdp))[V]+=`a=end-of-candidates\r
|
|
110
|
+
`,x._remoteDescription.sdp=jt.getDescription(x._remoteDescription.sdp)+C.join(""),!x.usingBundle));V++);Q()})},o.prototype.getStats=function(h){if(h&&h instanceof t.MediaStreamTrack){var C=null;if(this.transceivers.forEach(function(Q){Q.rtpSender&&Q.rtpSender.track===h?C=Q.rtpSender:Q.rtpReceiver&&Q.rtpReceiver.track===h&&(C=Q.rtpReceiver)}),!C)throw R("InvalidAccessError","Invalid selector.");return C.getStats()}var x=[];return this.transceivers.forEach(function(Q){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach(function(F){Q[F]&&x.push(Q[F].getStats())})}),Promise.all(x).then(function(Q){var F=new Map;return Q.forEach(function(V){V.forEach(function(Y){F.set(Y.id,Y)})}),F})},["RTCRtpSender","RTCRtpReceiver","RTCIceGatherer","RTCIceTransport","RTCDtlsTransport"].forEach(function(h){if((h=t[h])&&h.prototype&&h.prototype.getStats){var C=h.prototype.getStats;h.prototype.getStats=function(){return C.apply(this).then(function(x){var Q=new Map;return Object.keys(x).forEach(function(F){var V;x[F].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(V=x[F]).type]||V.type,Q.set(F,x[F])}),Q})}}});var c=["createOffer","createAnswer"];return c.forEach(function(h){var C=o.prototype[h];o.prototype[h]=function(){var x=arguments;return typeof x[0]=="function"||typeof x[1]=="function"?C.apply(this,[arguments[2]]).then(function(Q){typeof x[0]=="function"&&x[0].apply(null,[Q])},function(Q){typeof x[1]=="function"&&x[1].apply(null,[Q])}):C.apply(this,arguments)}}),(c=["setLocalDescription","setRemoteDescription","addIceCandidate"]).forEach(function(h){var C=o.prototype[h];o.prototype[h]=function(){var x=arguments;return typeof x[1]=="function"||typeof x[2]=="function"?C.apply(this,arguments).then(function(){typeof x[1]=="function"&&x[1].apply(null)},function(Q){typeof x[2]=="function"&&x[2].apply(null,[Q])}):C.apply(this,arguments)}}),["getStats"].forEach(function(h){var C=o.prototype[h];o.prototype[h]=function(){var x=arguments;return typeof x[1]=="function"?C.apply(this,arguments).then(function(){typeof x[1]=="function"&&x[1].apply(null)}):C.apply(this,arguments)}}),o},mf=Object.freeze({__proto__:null,shimPeerConnection:m,shimReplaceTrack:I,shimGetUserMedia:y,shimGetDisplayMedia:_}),Ef=Object.freeze({__proto__:null,shimOnTrack:P,shimPeerConnection:M,shimSenderGetStats:U,shimReceiverGetStats:K,shimRemoveStream:W,shimRTCDataChannel:X,shimGetUserMedia:B,shimGetDisplayMedia:function(t,e){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&(t.navigator.mediaDevices.getDisplayMedia=function(r){return r&&r.video?(r.video===!0?r.video={mediaSource:e}:r.video.mediaSource=e,t.navigator.mediaDevices.getUserMedia(r)):(r=new DOMException("getDisplayMedia without video constraints is undefined"),r.name="NotFoundError",r.code=8,it.reject(r))})}}),_f=Object.freeze({__proto__:null,shimLocalStreamsAPI:ie,shimRemoteStreamsAPI:se,shimCallbacksAPI:le,shimGetUserMedia:ve,shimConstraints:q,shimRTCIceServerUrls:ee,shimTrackEventTransceiver:ae,shimCreateOfferLegacy:_e}),Kp=Object.freeze({__proto__:null,shimRTCIceCandidate:fe,shimMaxMessageSize:Ue,shimSendThrowTypeError:Te,shimConnectionState:Fe,removeAllowExtmapMixed:$e});(function({window:t}={},e={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0}){let r=O(t),i={browserDetails:r,commonShim:Kp,extractVersion:H,disableLog:j,disableWarnings:N};switch(r.browser){case"chrome":if(!Af||!n||!e.shimChrome)return v("Chrome shim is not included in this adapter release."),i;v("adapter.js shimming chrome."),i.browserShim=Af,g(t),b(t),n(t),T(t),a(t),f(t),p(t),E(t),s(t),fe(t),Fe(t),Ue(t),Te(t),$e(t);break;case"firefox":if(!Ef||!M||!e.shimFirefox)return v("Firefox shim is not included in this adapter release."),i;v("adapter.js shimming firefox."),i.browserShim=Ef,B(t),M(t),P(t),W(t),U(t),K(t),X(t),fe(t),Fe(t),Ue(t),Te(t);break;case"edge":if(!mf||!m||!e.shimEdge)return v("MS edge shim is not included in this adapter release."),i;v("adapter.js shimming edge."),i.browserShim=mf,y(t),_(t),m(t),I(t),Ue(t),Te(t);break;case"safari":if(!_f||!e.shimSafari)return v("Safari shim is not included in this adapter release."),i;v("adapter.js shimming safari."),i.browserShim=_f,ee(t),_e(t),le(t),ie(t),se(t),ae(t),ve(t),fe(t),Ue(t),Te(t),$e(t);break;default:v("Unsupported browser!")}})({window});var tn,ir;(function(t){t.WIN_10="Windows 10",t.WIN_81="Windows 8.1",t.WIN_8="Windows 8",t.WIN_7="Windows 7",t.WIN_VISTA="Windows Vista",t.WIN_SERVER_2003="Windows Server 2003",t.WIN_XP="Windows XP",t.WIN_2000="Windows 2000",t.ANDROID="Android",t.OPEN_BSD="Open BSD",t.SUN_OS="Sun OS",t.LINUX="Linux",t.IOS="iOS",t.MAC_OS="Mac OS",t.QNX="QNX",t.UNIX="UNIX",t.BEOS="BeOS",t.OS_2="OS/2",t.SEARCH_BOT="Search Bot"})(tn||(tn={})),function(t){t.CHROME="Chrome",t.SAFARI="Safari",t.EDGE="Edge",t.FIREFOX="Firefox",t.OPERA="OPR",t.QQ="QQBrowser",t.WECHAT="MicroMessenger"}(ir||(ir={}));let od=new(de(function(t,e){(function(r,i){var o={extend:function(Y,$){var te={},ce;for(ce in Y)$[ce]&&$[ce].length%2==0?te[ce]=$[ce].concat(Y[ce]):te[ce]=Y[ce];return te},has:function(Y,$){return typeof Y=="string"&&$.toLowerCase().indexOf(Y.toLowerCase())!==-1},lowerize:function(Y){return Y.toLowerCase()},major:function(Y){return typeof Y=="string"?Y.replace(/[^\d\.]/g,"").split(".")[0]:i},trim:function(Y,$){return Y=Y.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),$===void 0?Y:Y.substring(0,255)}},c=function(Y,$){for(var te,ce,Ae,Me,et,pt,Qt=0;Qt<$.length&&!et;){var kt=$[Qt],Rr=$[Qt+1];for(te=ce=0;te<kt.length&&!et;)if(et=kt[te++].exec(Y))for(Ae=0;Ae<Rr.length;Ae++)pt=et[++ce],typeof(Me=Rr[Ae])=="object"&&0<Me.length?Me.length==2?typeof Me[1]=="function"?this[Me[0]]=Me[1].call(this,pt):this[Me[0]]=Me[1]:Me.length==3?typeof Me[1]!="function"||Me[1].exec&&Me[1].test?this[Me[0]]=pt?pt.replace(Me[1],Me[2]):i:this[Me[0]]=pt?Me[1].call(this,pt,Me[2]):i:Me.length==4&&(this[Me[0]]=pt?Me[3].call(this,pt.replace(Me[1],Me[2])):i):this[Me]=pt||i;Qt+=2}},h=function(Y,$){for(var te in $)if(typeof $[te]=="object"&&0<$[te].length){for(var ce=0;ce<$[te].length;ce++)if(o.has($[te][ce],Y))return te==="?"?i:te}else if(o.has($[te],Y))return te==="?"?i:te;return Y},C={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},x={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],["version",["name","Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],["version",["name","Edge"]],[/(opera\smini)\/([\w\.-]+)/i,/(opera\s[mobiletab]{3,6})\b.+version\/([\w\.-]+)/i,/(opera)(?:.+version\/|[\/\s]+)([\w\.]+)/i],["name","version"],[/opios[\/\s]+([\w\.]+)/i],["version",["name","Opera Mini"]],[/\sopr\/([\w\.]+)/i],["version",["name","Opera"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]*)/i,/(avant\s|iemobile|slim)(?:browser)?[\/\s]?([\w\.]*)/i,/(ba?idubrowser)[\/\s]?([\w\.]+)/i,/(?:ms|\()(ie)\s([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon)\/([\w\.-]+)/i,/(rekonq|puffin|brave|whale|qqbrowserlite|qq)\/([\w\.]+)/i,/(weibo)__([\d\.]+)/i],["name","version"],[/(?:[\s\/]uc?\s?browser|(?:juc.+)ucweb)[\/\s]?([\w\.]+)/i],["version",["name","UCBrowser"]],[/(?:windowswechat)?\sqbcore\/([\w\.]+)\b.*(?:windowswechat)?/i],["version",["name","WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],["version",["name","WeChat"]],[/konqueror\/([\w\.]+)/i],["version",["name","Konqueror"]],[/trident.+rv[:\s]([\w\.]{1,9})\b.+like\sgecko/i],["version",["name","IE"]],[/yabrowser\/([\w\.]+)/i],["version",["name","Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[["name",/(.+)/,"$1 Secure Browser"],"version"],[/focus\/([\w\.]+)/i],["version",["name","Firefox Focus"]],[/opt\/([\w\.]+)/i],["version",["name","Opera Touch"]],[/coc_coc_browser\/([\w\.]+)/i],["version",["name","Coc Coc"]],[/dolfin\/([\w\.]+)/i],["version",["name","Dolphin"]],[/coast\/([\w\.]+)/i],["version",["name","Opera Coast"]],[/xiaomi\/miuibrowser\/([\w\.]+)/i],["version",["name","MIUI Browser"]],[/fxios\/([\w\.-]+)/i],["version",["name","Firefox"]],[/(qihu|qhbrowser|qihoobrowser|360browser)/i],[["name","360 Browser"]],[/(oculus|samsung|sailfish)browser\/([\w\.]+)/i],[["name",/(.+)/,"$1 Browser"],"version"],[/(comodo_dragon)\/([\w\.]+)/i],[["name",/_/g," "],"version"],[/\s(electron)\/([\w\.]+)\ssafari/i,/(tesla)(?:\sqtcarbrowser|\/(20[12]\d\.[\w\.-]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/\s]?([\w\.]+)/i],["name","version"],[/(MetaSr)[\/\s]?([\w\.]+)/i,/(LBBROWSER)/i],["name"],[/;fbav\/([\w\.]+);/i],["version",["name","Facebook"]],[/FBAN\/FBIOS|FB_IAB\/FB4A/i],[["name","Facebook"]],[/safari\s(line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/\s]([\w\.-]+)/i],["name","version"],[/\bgsa\/([\w\.]+)\s.*safari\//i],["version",["name","GSA"]],[/headlesschrome(?:\/([\w\.]+)|\s)/i],["version",["name","Chrome Headless"]],[/\swv\).+(chrome)\/([\w\.]+)/i],[["name","Chrome WebView"],"version"],[/droid.+\sversion\/([\w\.]+)\b.+(?:mobile\ssafari|safari)/i],["version",["name","Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i],["name","version"],[/version\/([\w\.]+)\s.*mobile\/\w+\s(safari)/i],["version",["name","Mobile Safari"]],[/version\/([\w\.]+)\s.*(mobile\s?safari|safari)/i],["version","name"],[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],["name",["version",h,{"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],["name","version"],[/(navigator|netscape)\/([\w\.-]+)/i],[["name","Netscape"],"version"],[/ile\svr;\srv:([\w\.]+)\).+firefox/i],["version",["name","Firefox Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([\w\.-]+)$/i,/(firefox)\/([\w\.]+)\s[\w\s\-]+\/[\w\.]+$/i,/(mozilla)\/([\w\.]+)\s.+rv:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir)[\/\s]?([\w\.]+)/i,/(links)\s\(([\w\.]+)/i,/(gobrowser)\/?([\w\.]*)/i,/(ice\s?browser)\/v?([\w\._]+)/i,/(mosaic)[\/\s]([\w\.]+)/i],["name","version"]],cpu:[[/(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i],[["architecture","amd64"]],[/(ia32(?=;))/i],[["architecture",o.lowerize]],[/((?:i[346]|x)86)[;\)]/i],[["architecture","ia32"]],[/\b(aarch64|armv?8e?l?)\b/i],[["architecture","arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[["architecture","armhf"]],[/windows\s(ce|mobile);\sppc;/i],[["architecture","arm"]],[/((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i],[["architecture",/ower/,"",o.lowerize]],[/(sun4\w)[;\)]/i],[["architecture","sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?:64|(?=v(?:[1-7]|[5-7]1)l?|;|eabi))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[["architecture",o.lowerize]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[pt]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus\s10)/i],["model",["vendor","Samsung"],["type","tablet"]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy\snexus)/i,/\ssamsung[\s-]([\w-]+)/i,/sec-(sgh\w+)/i],["model",["vendor","Samsung"],["type","mobile"]],[/\((ip(?:hone|od)[\s\w]*);/i],["model",["vendor","Apple"],["type","mobile"]],[/\((ipad);[\w\s\),;-]+apple/i,/applecoremedia\/[\w\.]+\s\((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],["model",["vendor","Apple"],["type","tablet"]],[/\b((?:agr|ags[23]|bah2?|sht?)-a?[lw]\d{2})/i],["model",["vendor","Huawei"],["type","tablet"]],[/d\/huawei([\w\s-]+)[;\)]/i,/\b(nexus\s6p|vog-[at]?l\d\d|ane-[at]?l[x\d]\d|eml-a?l\d\da?|lya-[at]?l\d[\dc]|clt-a?l\d\di?|ele-l\d\d)/i,/\b(\w{2,4}-[atu][ln][01259][019])[;\)\s]/i],["model",["vendor","Huawei"],["type","mobile"]],[/\b(poco[\s\w]+)(?:\sbuild|\))/i,/\b;\s(\w+)\sbuild\/hm\1/i,/\b(hm[\s\-_]?note?[\s_]?(?:\d\w)?)\sbuild/i,/\b(redmi[\s\-_]?(?:note|k)?[\w\s_]+)(?:\sbuild|\))/i,/\b(mi[\s\-_]?(?:a\d|one|one[\s_]plus|note lte)?[\s_]?(?:\d?\w?)[\s_]?(?:plus)?)\sbuild/i],[["model",/_/g," "],["vendor","Xiaomi"],["type","mobile"]],[/\b(mi[\s\-_]?(?:pad)(?:[\w\s_]+))(?:\sbuild|\))/i],[["model",/_/g," "],["vendor","Xiaomi"],["type","tablet"]],[/;\s(\w+)\sbuild.+\soppo/i,/\s(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007)\b/i],["model",["vendor","OPPO"],["type","mobile"]],[/\svivo\s(\w+)(?:\sbuild|\))/i,/\s(v[12]\d{3}\w?[at])(?:\sbuild|;)/i],["model",["vendor","Vivo"],["type","mobile"]],[/\s(rmx[12]\d{3})(?:\sbuild|;)/i],["model",["vendor","Realme"],["type","mobile"]],[/\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?:?(\s4g)?)\b[\w\s]+build\//i,/\smot(?:orola)?[\s-](\w*)/i,/((?:moto[\s\w\(\)]+|xt\d{3,4}|nexus\s6)(?=\sbuild|\)))/i],["model",["vendor","Motorola"],["type","mobile"]],[/\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i],["model",["vendor","Motorola"],["type","tablet"]],[/((?=lg)?[vl]k\-?\d{3})\sbuild|\s3\.[\s\w;-]{10}lg?-([06cv9]{3,4})/i],["model",["vendor","LG"],["type","tablet"]],[/(lm-?f100[nv]?|nexus\s[45])/i,/lg[e;\s\/-]+((?!browser|netcast)\w+)/i,/\blg(\-?[\d\w]+)\sbuild/i],["model",["vendor","LG"],["type","mobile"]],[/(ideatab[\w\-\s]+)/i,/lenovo\s?(s(?:5000|6000)(?:[\w-]+)|tab(?:[\s\w]+)|yt[\d\w-]{6}|tb[\d\w-]{6})/i],["model",["vendor","Lenovo"],["type","tablet"]],[/(?:maemo|nokia).*(n900|lumia\s\d+)/i,/nokia[\s_-]?([\w\.-]*)/i],[["model",/_/g," "],["vendor","Nokia"],["type","mobile"]],[/droid.+;\s(pixel\sc)[\s)]/i],["model",["vendor","Google"],["type","tablet"]],[/droid.+;\s(pixel[\s\daxl]{0,6})(?:\sbuild|\))/i],["model",["vendor","Google"],["type","mobile"]],[/droid.+\s([c-g]\d{4}|so[-l]\w+|xq-a\w[4-7][12])(?=\sbuild\/|\).+chrome\/(?![1-6]{0,1}\d\.))/i],["model",["vendor","Sony"],["type","mobile"]],[/sony\stablet\s[ps]\sbuild\//i,/(?:sony)?sgp\w+(?:\sbuild\/|\))/i],[["model","Xperia Tablet"],["vendor","Sony"],["type","tablet"]],[/\s(kb2005|in20[12]5|be20[12][59])\b/i,/\ba000(1)\sbuild/i,/\boneplus\s(a\d{4})[\s)]/i],["model",["vendor","OnePlus"],["type","mobile"]],[/(alexa)webm/i,/(kf[a-z]{2}wi)(\sbuild\/|\))/i,/(kf[a-z]+)(\sbuild\/|\)).+silk\//i],["model",["vendor","Amazon"],["type","tablet"]],[/(sd|kf)[0349hijorstuw]+(\sbuild\/|\)).+silk\//i],[["model","Fire Phone"],["vendor","Amazon"],["type","mobile"]],[/\((playbook);[\w\s\),;-]+(rim)/i],["model","vendor",["type","tablet"]],[/((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10;\s(\w+)/i],["model",["vendor","BlackBerry"],["type","mobile"]],[/(?:\b|asus_)(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus\s7|padfone|p00[cj])/i],["model",["vendor","ASUS"],["type","tablet"]],[/\s(z[es]6[027][01][km][ls]|zenfone\s\d\w?)\b/i],["model",["vendor","ASUS"],["type","mobile"]],[/(nexus\s9)/i],["model",["vendor","HTC"],["type","tablet"]],[/(htc)[;_\s-]{1,2}([\w\s]+(?=\)|\sbuild)|\w+)/i,/(zte)-(\w*)/i,/(alcatel|geeksphone|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]*)/i],["vendor",["model",/_/g," "],["type","mobile"]],[/droid[x\d\.\s;]+\s([ab][1-7]\-?[0178a]\d\d?)/i],["model",["vendor","Acer"],["type","tablet"]],[/droid.+;\s(m[1-5]\snote)\sbuild/i,/\bmz-([\w-]{2,})/i],["model",["vendor","Meizu"],["type","mobile"]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[\s_-]?([\w-]*)/i,/(hp)\s([\w\s]+\w)/i,/(asus)-?(\w+)/i,/(microsoft);\s(lumia[\s\w]+)/i,/(lenovo)[_\s-]?([\w-]+)/i,/linux;.+(jolla);/i,/droid.+;\s(oppo)\s?([\w\s]+)\sbuild/i],["vendor","model",["type","mobile"]],[/(archos)\s(gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/\s(nook)[\w\s]+build\/(\w+)/i,/(dell)\s(strea[kpr\s\d]*[\dko])/i,/[;\/]\s?(le[\s\-]+pan)[\s\-]+(\w{1,9})\sbuild/i,/[;\/]\s?(trinity)[\-\s]*(t\d{3})\sbuild/i,/\b(gigaset)[\s\-]+(q\w{1,9})\sbuild/i,/\b(vodafone)\s([\w\s]+)(?:\)|\sbuild)/i],["vendor","model",["type","tablet"]],[/\s(surface\sduo)\s/i],["model",["vendor","Microsoft"],["type","tablet"]],[/droid\s[\d\.]+;\s(fp\du?)\sbuild/i],["model",["vendor","Fairphone"],["type","mobile"]],[/\s(u304aa)\sbuild/i],["model",["vendor","AT&T"],["type","mobile"]],[/sie-(\w*)/i],["model",["vendor","Siemens"],["type","mobile"]],[/[;\/]\s?(rct\w+)\sbuild/i],["model",["vendor","RCA"],["type","tablet"]],[/[;\/\s](venue[\d\s]{2,7})\sbuild/i],["model",["vendor","Dell"],["type","tablet"]],[/[;\/]\s?(q(?:mv|ta)\w+)\sbuild/i],["model",["vendor","Verizon"],["type","tablet"]],[/[;\/]\s(?:barnes[&\s]+noble\s|bn[rt])([\w\s\+]*)\sbuild/i],["model",["vendor","Barnes & Noble"],["type","tablet"]],[/[;\/]\s(tm\d{3}\w+)\sbuild/i],["model",["vendor","NuVision"],["type","tablet"]],[/;\s(k88)\sbuild/i],["model",["vendor","ZTE"],["type","tablet"]],[/;\s(nx\d{3}j)\sbuild/i],["model",["vendor","ZTE"],["type","mobile"]],[/[;\/]\s?(gen\d{3})\sbuild.*49h/i],["model",["vendor","Swiss"],["type","mobile"]],[/[;\/]\s?(zur\d{3})\sbuild/i],["model",["vendor","Swiss"],["type","tablet"]],[/[;\/]\s?((zeki)?tb.*\b)\sbuild/i],["model",["vendor","Zeki"],["type","tablet"]],[/[;\/]\s([yr]\d{2})\sbuild/i,/[;\/]\s(dragon[\-\s]+touch\s|dt)(\w{5})\sbuild/i],[["vendor","Dragon Touch"],"model",["type","tablet"]],[/[;\/]\s?(ns-?\w{0,9})\sbuild/i],["model",["vendor","Insignia"],["type","tablet"]],[/[;\/]\s?((nxa|Next)-?\w{0,9})\sbuild/i],["model",["vendor","NextBook"],["type","tablet"]],[/[;\/]\s?(xtreme_)?(v(1[045]|2[015]|[3469]0|7[05]))\sbuild/i],[["vendor","Voice"],"model",["type","mobile"]],[/[;\/]\s?(lvtel\-)?(v1[12])\sbuild/i],[["vendor","LvTel"],"model",["type","mobile"]],[/;\s(ph-1)\s/i],["model",["vendor","Essential"],["type","mobile"]],[/[;\/]\s?(v(100md|700na|7011|917g).*\b)\sbuild/i],["model",["vendor","Envizen"],["type","tablet"]],[/[;\/]\s?(trio[\s\w\-\.]+)\sbuild/i],["model",["vendor","MachSpeed"],["type","tablet"]],[/[;\/]\s?tu_(1491)\sbuild/i],["model",["vendor","Rotor"],["type","tablet"]],[/(shield[\w\s]+)\sbuild/i],["model",["vendor","Nvidia"],["type","tablet"]],[/(sprint)\s(\w+)/i],["vendor","model",["type","mobile"]],[/(kin\.[onetw]{3})/i],[["model",/\./g," "],["vendor","Microsoft"],["type","mobile"]],[/droid\s[\d\.]+;\s(cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],["model",["vendor","Zebra"],["type","tablet"]],[/droid\s[\d\.]+;\s(ec30|ps20|tc[2-8]\d[kx])\)/i],["model",["vendor","Zebra"],["type","mobile"]],[/\s(ouya)\s/i,/(nintendo)\s([wids3utch]+)/i],["vendor","model",["type","console"]],[/droid.+;\s(shield)\sbuild/i],["model",["vendor","Nvidia"],["type","console"]],[/(playstation\s[345portablevi]+)/i],["model",["vendor","Sony"],["type","console"]],[/[\s\(;](xbox(?:\sone)?(?!;\sxbox))[\s\);]/i],["model",["vendor","Microsoft"],["type","console"]],[/smart-tv.+(samsung)/i],["vendor",["type","smarttv"]],[/hbbtv.+maple;(\d+)/i],[["model",/^/,"SmartTV"],["vendor","Samsung"],["type","smarttv"]],[/(?:linux;\snetcast.+smarttv|lg\snetcast\.tv-201\d)/i],[["vendor","LG"],["type","smarttv"]],[/(apple)\s?tv/i],["vendor",["model","Apple TV"],["type","smarttv"]],[/crkey/i],[["model","Chromecast"],["vendor","Google"],["type","smarttv"]],[/droid.+aft([\w])(\sbuild\/|\))/i],["model",["vendor","Amazon"],["type","smarttv"]],[/\(dtv[\);].+(aquos)/i],["model",["vendor","Sharp"],["type","smarttv"]],[/hbbtv\/\d+\.\d+\.\d+\s+\([\w\s]*;\s*(\w[^;]*);([^;]*)/i],[["vendor",o.trim],["model",o.trim],["type","smarttv"]],[/[\s\/\(](android\s|smart[-\s]?|opera\s)tv[;\)\s]/i],[["type","smarttv"]],[/((pebble))app\/[\d\.]+\s/i],["vendor","model",["type","wearable"]],[/droid.+;\s(glass)\s\d/i],["model",["vendor","Google"],["type","wearable"]],[/droid\s[\d\.]+;\s(wt63?0{2,3})\)/i],["model",["vendor","Zebra"],["type","wearable"]],[/(tesla)(?:\sqtcarbrowser|\/20[12]\d\.[\w\.-]+)/i],["vendor",["type","embedded"]],[/droid .+?; ([^;]+?)(?: build|\) applewebkit).+? mobile safari/i],["model",["type","mobile"]],[/droid .+?;\s([^;]+?)(?: build|\) applewebkit).+?(?! mobile) safari/i],["model",["type","tablet"]],[/\s(tablet|tab)[;\/]/i,/\s(mobile)(?:[;\/]|\ssafari)/i],[["type",o.lowerize]],[/(android[\w\.\s\-]{0,9});.+build/i],["model",["vendor","Generic"]],[/(phone)/i],[["type","mobile"]]],engine:[[/windows.+\sedge\/([\w\.]+)/i],["version",["name","EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],["version",["name","Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],["name","version"],[/rv:([\w\.]{1,9})\b.+(gecko)/i],["version","name"]],os:[[/microsoft\s(windows)\s(vista|xp)/i],["name","version"],[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*)[\s\/]?([\d\.\s\w]*)/i,/(windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)(?!.+xbox)/i],["name",["version",h,C]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[["name","Windows"],["version",h,C]],[/ip[honead]{2,4}\b(?:.*os\s([\w]+)\slike\smac|;\sopera)/i,/cfnetwork\/.+darwin/i],[["version",/_/g,"."],["name","iOS"]],[/(mac\sos\sx)\s?([\w\s\.]*)/i,/(macintosh|mac(?=_powerpc)\s)(?!.+haiku)/i],[["name","Mac OS"],["version",/_/g,"."]],[/(android|webos|palm\sos|qnx|bada|rim\stablet\sos|meego|sailfish|contiki)[\/\s-]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/\s]([\w\.]+)/i,/\((series40);/i],["name","version"],[/\(bb(10);/i],["version",["name","BlackBerry"]],[/(?:symbian\s?os|symbos|s60(?=;)|series60)[\/\s-]?([\w\.]*)/i],["version",["name","Symbian"]],[/mozilla.+\(mobile;.+gecko.+firefox/i],[["name","Firefox OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],["version",["name","webOS"]],[/crkey\/([\d\.]+)/i],["version",["name","Chromecast"]],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[["name","Chromium OS"],"version"],[/(nintendo|playstation)\s([wids345portablevuch]+)/i,/(xbox);\s+xbox\s([^\);]+)/i,/(mint)[\/\s\(\)]?(\w*)/i,/(mageia|vectorlinux)[;\s]/i,/(joli|[kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?=\slinux)|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus|raspbian)(?:\sgnu\/linux)?(?:\slinux)?[\/\s-]?(?!chrom|package)([\w\.-]*)/i,/(hurd|linux)\s?([\w\.]*)/i,/(gnu)\s?([\w\.]*)/i,/\s([frentopc-]{0,4}bsd|dragonfly)\s?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku)\s(\w+)/i],["name","version"],[/(sunos)\s?([\w\.\d]*)/i],[["name","Solaris"],"version"],[/((?:open)?solaris)[\/\s-]?([\w\.]*)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.])*/i,/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms|fuchsia)/i,/(unix)\s?([\w\.]*)/i],["name","version"]]},Q=function(Y,$){if(typeof Y=="object"&&($=Y,Y=i),!(this instanceof Q))return new Q(Y,$).getResult();var te=Y||(r!==void 0&&r.navigator&&r.navigator.userAgent?r.navigator.userAgent:""),ce=$?o.extend(x,$):x;return this.getBrowser=function(){var Ae={name:i,version:i};return c.call(Ae,te,ce.browser),Ae.major=o.major(Ae.version),Ae},this.getCPU=function(){var Ae={architecture:i};return c.call(Ae,te,ce.cpu),Ae},this.getDevice=function(){var Ae={vendor:i,model:i,type:i};return c.call(Ae,te,ce.device),Ae},this.getEngine=function(){var Ae={name:i,version:i};return c.call(Ae,te,ce.engine),Ae},this.getOS=function(){var Ae={name:i,version:i};return c.call(Ae,te,ce.os),Ae},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return te},this.setUA=function(Ae){return te=typeof Ae=="string"&&255<Ae.length?o.trim(Ae,255):Ae,this},this.setUA(te),this};Q.VERSION="0.7.28",Q.BROWSER={NAME:"name",MAJOR:"major",VERSION:"version"},Q.CPU={ARCHITECTURE:"architecture"},Q.DEVICE={MODEL:"model",VENDOR:"vendor",TYPE:"type",CONSOLE:"console",MOBILE:"mobile",SMARTTV:"smarttv",TABLET:"tablet",WEARABLE:"wearable",EMBEDDED:"embedded"},Q.ENGINE={NAME:"name",VERSION:"version"},Q.OS={NAME:"name",VERSION:"version"},t.exports&&(e=t.exports=Q),e.UAParser=Q;var F=r!==void 0&&(r.jQuery||r.Zepto);if(F&&!F.ua){var V=new Q;F.ua=V.getResult(),F.ua.get=function(){return V.getUA()},F.ua.set=function(Y){V.setUA(Y),Y=V.getResult();for(var $ in Y)F.ua[$]=Y[$]}}})(typeof window=="object"?window:Ta)})),kn=od.getResult(),rs=function(t){if(t.match(/[0-9]+\.[0-9]+\.[0-9]+$/))return t;var e=t.match(/([0-9]+\.[0-9]+\.[0-9]+)\-alpha\.([0-9]+)/);if(e&&e[1]&&e[2]){var r,i=e[2];return ne(r="".concat(e[1],".")).call(r,i)}return(e=t.match(/([0-9]+\.[0-9]+\.[0-9]+)\-special\.([0-9]+)/))&&e[1]&&e[2]?(r=e[2],ne(i="".concat(e[1],".")).call(i,100*(Number(r)+1))):"4.0.0.999"}("4.7.3");try{var Cf=JSON.parse("true")===!0}catch(t){Cf=!0}let ad=Cf,rn={username:"test",password:"111111",turnServerURL:"",tcpport:3433,udpport:3478,forceturn:!1},Wp={"90p":wt(160,90),"90p_1":wt(160,90),"120p":wt(160,120,15,30,65),"120p_1":wt(160,120,15,30,65),"120p_3":wt(120,120,15,30,50),"120p_4":wt(212,120),"180p":wt(320,180,15,30,140),"180p_1":wt(320,180,15,30,140),"180p_3":wt(180,180,15,30,100),"180p_4":wt(240,180,15,30,120),"240p":wt(320,240,15,40,200),"240p_1":wt(320,240,15,40,200),"240p_3":wt(240,240,15,40,140),"240p_4":wt(424,240,15,40,220),"360p":wt(640,360,15,80,400),"360p_1":wt(640,360,15,80,400),"360p_3":wt(360,360,15,80,260),"360p_4":wt(640,360,30,80,600),"360p_6":wt(360,360,30,80,400),"360p_7":wt(480,360,15,80,320),"360p_8":wt(480,360,30,80,490),"360p_9":wt(640,360,15,80,800),"360p_10":wt(640,360,24,80,800),"360p_11":wt(640,360,24,80,1e3),"480p":wt(640,480,15,100,500),"480p_1":wt(640,480,15,100,500),"480p_2":wt(640,480,30,100,1e3),"480p_3":wt(480,480,15,100,400),"480p_4":wt(640,480,30,100,750),"480p_6":wt(480,480,30,100,600),"480p_8":wt(848,480,15,100,610),"480p_9":wt(848,480,30,100,930),"480p_10":wt(640,480,10,100,400),"720p":wt(1280,720,15,120,1130),"720p_1":wt(1280,720,15,120,1130),"720p_2":wt(1280,720,30,120,2e3),"720p_3":wt(1280,720,30,120,1710),"720p_5":wt(960,720,15,120,910),"720p_6":wt(960,720,30,120,1380),"1080p":wt(1920,1080,15,120,2080),"1080p_1":wt(1920,1080,15,120,2080),"1080p_2":wt(1920,1080,30,120,3e3),"1080p_3":wt(1920,1080,30,120,3150),"1080p_5":wt(1920,1080,60,120,4780),"1440p":wt(2560,1440,30,120,4850),"1440p_1":wt(2560,1440,30,120,4850),"1440p_2":wt(2560,1440,60,120,7350),"4k":wt(3840,2160,30,120,8910),"4k_1":wt(3840,2160,30,120,8910),"4k_3":wt(3840,2160,60,120,13500)},jp={"480p":Ir(640,480,5),"480p_1":Ir(640,480,5),"480p_2":Ir(640,480,30),"480p_3":Ir(640,480,15),"720p":Ir(1280,720,5),"720p_1":Ir(1280,720,5),"720p_2":Ir(1280,720,30),"720p_3":Ir(1280,720,15),"1080p":Ir(1920,1080,5),"1080p_1":Ir(1920,1080,5),"1080p_2":Ir(1920,1080,30),"1080p_3":Ir(1920,1080,15)},Vp={"1SL1TL":Ui(1,1),"3SL3TL":Ui(3,3),"2SL3TL":Ui(2,3)},Yp={speech_low_quality:Hr(16e3,!1),speech_standard:Hr(32e3,!1,18),music_standard:Hr(48e3,!1),standard_stereo:Hr(48e3,!0,56),high_quality:Hr(48e3,!1,128),high_quality_stereo:Hr(48e3,!0,192)},Xe={PROCESS_ID:"",ENCRYPT_AES:!0,AREAS:["CHINA","GLOBAL"],WEBCS_DOMAIN:["webrtc2-ap-web-1.agora.io","webrtc2-2.ap.sd-rtn.com"],WEBCS_DOMAIN_BACKUP_LIST:["webrtc2-ap-web-3.agora.io","webrtc2-4.ap.sd-rtn.com"],PROXY_CS:["ap-proxy-1.agora.io","ap-proxy-2.agora.io"],CDS_AP:["cds-ap-web-1.agora.io","cds-web-2.ap.sd-rtn.com","cds-ap-web-3.agora.io","cds-web-4.ap.sd-rtn.com"],ACCOUNT_REGISTER:["sua-ap-web-1.agora.io","sua-web-2.ap.sd-rtn.com","sua-ap-web-3.agora.io","sua-web-4.ap.sd-rtn.com"],UAP_AP:["uap-ap-web-1.agora.io","uap-web-2.ap.sd-rtn.com","uap-ap-web-3.agora.io","uap-web-4.ap.sd-rtn.com"],LOG_UPLOAD_SERVER:"logservice.agora.io",EVENT_REPORT_DOMAIN:"statscollector-1.agora.io",EVENT_REPORT_BACKUP_DOMAIN:"web-2.statscollector.sd-rtn.com",GATEWAY_ADDRESS:[],GATEWAY_WSS_ADDRESS:"",LIVE_STREAMING_ADDRESS:"",ACCOUNT_REGISTER_RETRY_TIMEOUT:1,ACCOUNT_REGISTER_RETRY_RATIO:2,ACCOUNT_REGISTER_RETRY_TIMEOUT_MAX:6e4,ACCOUNT_REGISTER_RETRY_COUNT_MAX:1e5,AUDIO_CONTEXT:null,WEBCS_BACKUP_CONNECT_TIMEOUT:6e3,HTTP_CONNECT_TIMEOUT:5e3,PLAYER_STATE_DEFER:2e3,SIGNAL_REQUEST_TIMEOUT:1e4,SIGNAL_REQUEST_WATCH_INTERVAL:1e3,REPORT_STATS:!0,UPLOAD_LOG:!1,NOT_REPORT_EVENT:[],FILEPATH_LENMAX:255,SUBSCRIBE_TCC:!0,PING_PONG_TIME_OUT:10,DUALSTREAM_OPERATION_CHECK:!0,WEBSOCKET_TIMEOUT_MIN:1e4,EVENT_REPORT_SEND_INTERVAL:3e3,CONFIG_DISTRIBUTE_INTERVAL:3e5,MEDIA_ELEMENT_EXISTS_DEPTH:3,CANDIDATE_TIMEOUT:5e3,SHIM_CANDIDATE:!1,LEAVE_MSG_TIMEOUT:2e3,SHOW_REPORT_INVOKER_LOG:!1,STATS_FILTER:{transportId:!0,googTrackId:!0},JOIN_EXTEND:"",PUB_EXTEND:"",SUB_EXTEND:"",FORCE_TURN:!1,TURN_ENABLE_TCP:!0,TURN_ENABLE_UDP:!0,MAX_UPLOAD_CACHE:50,UPLOAD_CACHE_INTERVAL:2e3,AJAX_REQUEST_CONCURRENT:3,REPORT_APP_SCENARIO:void 0,GATEWAY_DOMAINS:["edge.agora.io","edge.sd-rtn.com"],EVENT_REPORT_RETRY:!0,CHROME_FORCE_PLAN_B:!1,AUDIO_SOURCE_VOLUME_UPDATE_INTERVAL:400,AUDIO_SOURCE_AVG_VOLUME_DURATION:3e3,AUDIO_VOLUME_INDICATION_INTERVAL:2e3,VOLUME_VOICE_WEIGHT:10,NORMAL_EVENT_QUEUE_CAPACITY:100,CUSTOM_REPORT:!0,CUSTOM_REPORT_LIMIT:20,PROXY_SERVER_TYPE2:"webnginx-proxy.agora.io",PROXY_SERVER_TYPE3:["webrtc-cloud-proxy.sd-rtn.com","webrtc-cloud-proxy.agora.io"],CUSTOM_PUB_ANSWER_MODIFIER:null,CUSTOM_SUB_ANSWER_MODIFIER:null,CUSTOM_PUB_OFFER_MODIFIER:null,CUSTOM_SUB_OFFER_MODIFIER:null,DSCP_TYPE:"high",REMOVE_NEW_CODECS:!0,FRAGEMENT_LENGTH:3,WEBSOCKET_COMPRESS:!1,SIMULCAST:!1,ENUMERATE_DEVICES_INTERVAL:!0};ad||(Xe.WEBCS_DOMAIN=["ap-web-1-oversea.agora.io","ap-web-1-north-america.agora.io"],Xe.WEBCS_DOMAIN_BACKUP_LIST=["ap-web-2-oversea.agora.io","ap-web-2-north-america.agora.io"],Xe.PROXY_CS=["proxy-ap-web-oversea.agora.io","proxy-ap-web-america.agora.io"],Xe.CDS_AP=["cds-ap-web-oversea.agora.io","cds-ap-web-america.agora.io","cds-ap-web-america2.agora.io"],Xe.ACCOUNT_REGISTER=["sua-ap-web-oversea.agora.io","sua-ap-web-america.agora.io","sua-ap-web-america2.agora.io"],Xe.UAP_AP=["uap-ap-web-oversea.agora.io","uap-ap-web-america.agora.io","uap-ap-web-america2.agora.io"],Xe.LOG_UPLOAD_SERVER="logservice-oversea.agora.io",Xe.EVENT_REPORT_DOMAIN="statscollector-1-oversea.agora.io",Xe.EVENT_REPORT_BACKUP_DOMAIN="statscollector-2-oversea.agora.io",Xe.PROXY_SERVER_TYPE3="webrtc-cloud-proxy.agora.io",Xe.AREAS=["NORTH_AMERICA","OVERSEA"]);let Jp=[[0,1,2,3,4,5,5],[0,2,2,3,4,5,5],[0,3,3,3,4,5,5],[0,4,4,4,4,5,5],[0,5,5,5,5,5,5]],Zo=[],pa=[];var cd=[],yf=cd.sort,zp=ii(function(){cd.sort(void 0)}),qp=ii(function(){cd.sort(null)}),Xp=La("sort");Kt({target:"Array",proto:!0,forced:zp||!qp||Xp},{sort:function(t){return t===void 0?yf.call(jn(this)):yf.call(jn(this),Kn(t))}});var Zp=pi("Array").sort,If=Array.prototype,Hc=function(t){var e=t.sort;return t===If||t instanceof Array&&e===If.sort?Zp:e};Kt({target:"Array",stat:!0},{isArray:Nn});var oe,so=Dr.Array.isArray;(function(t){t.UNEXPECTED_ERROR="UNEXPECTED_ERROR",t.UNEXPECTED_RESPONSE="UNEXPECTED_RESPONSE",t.TIMEOUT="TIMEOUT",t.INVALID_PARAMS="INVALID_PARAMS",t.NOT_READABLE="NOT_READABLE",t.NOT_SUPPORTED="NOT_SUPPORTED",t.INVALID_OPERATION="INVALID_OPERATION",t.OPERATION_ABORTED="OPERATION_ABORTED",t.WEB_SECURITY_RESTRICT="WEB_SECURITY_RESTRICT",t.NETWORK_ERROR="NETWORK_ERROR",t.NETWORK_TIMEOUT="NETWORK_TIMEOUT",t.NETWORK_RESPONSE_ERROR="NETWORK_RESPONSE_ERROR",t.API_INVOKE_TIMEOUT="API_INVOKE_TIMEOUT",t.ENUMERATE_DEVICES_FAILED="ENUMERATE_DEVICES_FAILED",t.DEVICE_NOT_FOUND="DEVICE_NOT_FOUND",t.ELECTRON_IS_NULL="ELECTRON_IS_NULL",t.ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR="ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR",t.CHROME_PLUGIN_NO_RESPONSE="CHROME_PLUGIN_NO_RESPONSE",t.CHROME_PLUGIN_NOT_INSTALL="CHROME_PLUGIN_NOT_INSTALL",t.MEDIA_OPTION_INVALID="MEDIA_OPTION_INVALID",t.PERMISSION_DENIED="PERMISSION_DENIED",t.CONSTRAINT_NOT_SATISFIED="CONSTRAINT_NOT_SATISFIED",t.TRACK_IS_DISABLED="TRACK_IS_DISABLED",t.SHARE_AUDIO_NOT_ALLOWED="SHARE_AUDIO_NOT_ALLOWED",t.LOW_STREAM_ENCODING_ERROR="LOW_STREAM_ENCODING_ERROR",t.SET_ENCODING_PARAMETER_ERROR="SET_ENCODING_PARAMETER_ERROR",t.TRACK_STATE_UNREACHABLE="TRACK_STATE_UNREACHABLE",t.INVALID_UINT_UID_FROM_STRING_UID="INVALID_UINT_UID_FROM_STRING_UID",t.CAN_NOT_GET_PROXY_SERVER="CAN_NOT_GET_PROXY_SERVER",t.CAN_NOT_GET_GATEWAY_SERVER="CAN_NOT_GET_GATEWAY_SERVER",t.VOID_GATEWAY_ADDRESS="VOID_GATEWAY_ADDRESS",t.UID_CONFLICT="UID_CONFLICT",t.MULTI_UNILBS_RESPONSE_ERROR="MULTI_UNILBS_RESPONSE_ERROR",t.INVALID_LOCAL_TRACK="INVALID_LOCAL_TRACK",t.INVALID_TRACK="INVALID_TRACK",t.SENDER_NOT_FOUND="SENDER_NOT_FOUND",t.CREATE_OFFER_FAILED="CREATE_OFFER_FAILED",t.SET_ANSWER_FAILED="SET_ANSWER_FAILED",t.ICE_FAILED="ICE_FAILED",t.PC_CLOSED="PC_CLOSED",t.SENDER_REPLACE_FAILED="SENDER_REPLACE_FAILED",t.GATEWAY_P2P_LOST="GATEWAY_P2P_LOST",t.NO_ICE_CANDIDATE="NO_ICE_CANDIDATE",t.CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS="CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS",t.CAN_NOT_PUBLISH_MULTIPLE_AUDIO_TRACKS="CAN_NOT_PUBLISH_MULTIPLE_AUDIO_TRACKS",t.EXIST_DISABLED_VIDEO_TRACK="EXIST_DISABLED_VIDEO_TRACK",t.INVALID_REMOTE_USER="INVALID_REMOTE_USER",t.REMOTE_USER_IS_NOT_PUBLISHED="REMOTE_USER_IS_NOT_PUBLISHED",t.CUSTOM_REPORT_SEND_FAILED="CUSTOM_REPORT_SEND_FAILED",t.CUSTOM_REPORT_FREQUENCY_TOO_HIGH="CUSTOM_REPORT_FREQUENCY_TOO_HIGH",t.FETCH_AUDIO_FILE_FAILED="FETCH_AUDIO_FILE_FAILED",t.READ_LOCAL_AUDIO_FILE_ERROR="READ_LOCAL_AUDIO_FILE_ERROR",t.DECODE_AUDIO_FILE_FAILED="DECODE_AUDIO_FILE_FAILED",t.WS_ABORT="WS_ABORT",t.WS_DISCONNECT="WS_DISCONNECT",t.WS_ERR="WS_ERR",t.LIVE_STREAMING_TASK_CONFLICT="LIVE_STREAMING_TASK_CONFLICT",t.LIVE_STREAMING_INVALID_ARGUMENT="LIVE_STREAMING_INVALID_ARGUMENT",t.LIVE_STREAMING_INTERNAL_SERVER_ERROR="LIVE_STREAMING_INTERNAL_SERVER_ERROR",t.LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED="LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED",t.LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED="LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED",t.LIVE_STREAMING_CDN_ERROR="LIVE_STREAMING_CDN_ERROR",t.LIVE_STREAMING_INVALID_RAW_STREAM="LIVE_STREAMING_INVALID_RAW_STREAM",t.LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT="LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT",t.LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE="LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE",t.LIVE_STREAMING_WARN_FREQUENT_REQUEST="LIVE_STREAMING_WARN_FREQUENT_REQUEST",t.WEBGL_INTERNAL_ERROR="WEBGL_INTERNAL_ERROR",t.BEAUTY_PROCESSOR_INTERNAL_ERROR="BEAUTY_PROCESSOR_INTERNAL_ERROR",t.CROSS_CHANNEL_WAIT_STATUS_ERROR="CROSS_CHANNEL_WAIT_STATUS_ERROR",t.CROSS_CHANNEL_FAILED_JOIN_SRC="CROSS_CHANNEL_FAILED_JOIN_SEC",t.CROSS_CHANNEL_FAILED_JOIN_DEST="CROSS_CHANNEL_FAILED_JOIN_DEST",t.CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST="CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST",t.CROSS_CHANNEL_SERVER_ERROR_RESPONSE="CROSS_CHANNEL_SERVER_ERROR_RESPONSE",t.METADATA_OUT_OF_RANGE="METADATA_OUT_OF_RANGE",t.LOCAL_AEC_ERROR="LOCAL_AEC_ERROR",t.INVALID_PLUGIN="INVALID_PLUGIN"})(oe||(oe={}));var $p=[].slice,ev=/MSIE .\./.test(zo),Sf=function(t){return function(e,r){var i=2<arguments.length,o=i?$p.call(arguments,2):void 0;return t(i?function(){(typeof e=="function"?e:Function(e)).apply(this,o)}:e,r)}};Kt({global:!0,bind:!0,forced:ev},{setTimeout:Sf(Ht.setTimeout),setInterval:Sf(Ht.setInterval)});var _s=Dr.setTimeout;Kt({target:"Date",stat:!0},{now:function(){return new Date().getTime()}});var at=Dr.Date.now,Tf=function(t,e){return function(){for(var r=Array(arguments.length),i=0;i<r.length;i++)r[i]=arguments[i];return t.apply(e,r)}},nc=Object.prototype.toString,Jt={isArray:on,isArrayBuffer:function(t){return nc.call(t)==="[object ArrayBuffer]"},isBuffer:function(t){return t!=null&&t.constructor!=null&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)},isFormData:function(t){return typeof FormData!="undefined"&&t instanceof FormData},isArrayBufferView:function(t){return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer},isString:function(t){return typeof t=="string"},isNumber:function(t){return typeof t=="number"},isObject:Gn,isUndefined:function(t){return t===void 0},isDate:function(t){return nc.call(t)==="[object Date]"},isFile:function(t){return nc.call(t)==="[object File]"},isBlob:function(t){return nc.call(t)==="[object Blob]"},isFunction:an,isStream:function(t){return Gn(t)&&an(t.pipe)},isURLSearchParams:function(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return(typeof navigator=="undefined"||navigator.product!=="ReactNative"&&navigator.product!=="NativeScript"&&navigator.product!=="NS")&&typeof window!="undefined"&&typeof document!="undefined"},forEach:_i,merge:function t(){function e(c,h){typeof r[h]=="object"&&typeof c=="object"?r[h]=t(r[h],c):r[h]=c}for(var r={},i=0,o=arguments.length;i<o;i++)_i(arguments[i],e);return r},deepMerge:function t(){function e(c,h){typeof r[h]=="object"&&typeof c=="object"?r[h]=t(r[h],c):r[h]=typeof c=="object"?t({},c):c}for(var r={},i=0,o=arguments.length;i<o;i++)_i(arguments[i],e);return r},extend:function(t,e,r){return _i(e,function(i,o){t[o]=r&&typeof i=="function"?Tf(i,r):i}),t},trim:function(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}},Rf=function(t,e,r){if(!e)return t;if(r)e=r(e);else if(Jt.isURLSearchParams(e))e=e.toString();else{var i=[];Jt.forEach(e,function(o,c){o!=null&&(Jt.isArray(o)?c+="[]":o=[o],Jt.forEach(o,function(h){Jt.isDate(h)?h=h.toISOString():Jt.isObject(h)&&(h=JSON.stringify(h)),i.push(_n(c)+"="+_n(h))}))}),e=i.join("&")}return e&&(r=t.indexOf("#"),r!==-1&&(t=t.slice(0,r)),t+=(t.indexOf("?")===-1?"?":"&")+e),t};Cn.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),this.handlers.length-1},Cn.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},Cn.prototype.forEach=function(t){Jt.forEach(this.handlers,function(e){e!==null&&t(e)})};var wf=Cn,ld=function(t,e,r){return Jt.forEach(r,function(i){t=i(t,e)}),t},Lf=function(t){return!(!t||!t.__CANCEL__)},Df=function(t,e){Jt.forEach(t,function(r,i){i!==e&&i.toUpperCase()===e.toUpperCase()&&(t[e]=r,delete t[i])})},Wl=function(t,e,r,i,o){return function(c,h,C,x,Q){return c.config=h,C&&(c.code=C),c.request=x,c.response=Q,c.isAxiosError=!0,c.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},c}(Error(t),e,r,i,o)},tv="age authorization content-length content-type etag expires from host if-modified-since if-unmodified-since last-modified location max-forwards proxy-authorization referer retry-after user-agent".split(" "),rv=Jt.isStandardBrowserEnv()?function(){function t(o){return r&&(i.setAttribute("href",o),o=i.href),i.setAttribute("href",o),{href:i.href,protocol:i.protocol?i.protocol.replace(/:$/,""):"",host:i.host,search:i.search?i.search.replace(/^\?/,""):"",hash:i.hash?i.hash.replace(/^#/,""):"",hostname:i.hostname,port:i.port,pathname:i.pathname.charAt(0)==="/"?i.pathname:"/"+i.pathname}}var e,r=/(msie|trident)/i.test(navigator.userAgent),i=document.createElement("a");return e=t(window.location.href),function(o){return o=Jt.isString(o)?t(o):o,o.protocol===e.protocol&&o.host===e.host}}():function(){return!0},iv=Jt.isStandardBrowserEnv()?{write:function(t,e,r,i,o,c){var h=[];h.push(t+"="+encodeURIComponent(e)),Jt.isNumber(r)&&h.push("expires="+new Date(r).toGMTString()),Jt.isString(i)&&h.push("path="+i),Jt.isString(o)&&h.push("domain="+o),c===!0&&h.push("secure"),document.cookie=h.join("; ")},read:function(t){return(t=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)")))?decodeURIComponent(t[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},nv=function(t){return new Promise(function(e,r){var i=t.data,o=t.headers;Jt.isFormData(i)&&delete o["Content-Type"];var c=new XMLHttpRequest;if(t.auth&&(o.Authorization="Basic "+btoa((t.auth.username||"")+":"+(t.auth.password||""))),c.open(t.method.toUpperCase(),Rf(t.url,t.params,t.paramsSerializer),!0),c.timeout=t.timeout,c.onreadystatechange=function(){if(c&&c.readyState===4&&(c.status!==0||c.responseURL&&c.responseURL.indexOf("file:")===0)){var C,x,Q,F,V,Y="getAllResponseHeaders"in c?(C=c.getAllResponseHeaders(),V={},C&&Jt.forEach(C.split(`
|
|
111
|
+
`),function($){F=$.indexOf(":"),x=Jt.trim($.substr(0,F)).toLowerCase(),Q=Jt.trim($.substr(F+1)),!x||V[x]&&0<=tv.indexOf(x)||(V[x]=x==="set-cookie"?(V[x]?V[x]:[]).concat([Q]):V[x]?V[x]+", "+Q:Q)}),V):null;(function($,te,ce){var Ae=ce.config.validateStatus;!Ae||Ae(ce.status)?$(ce):te(Wl("Request failed with status code "+ce.status,ce.config,null,ce.request,ce))})(e,r,{data:t.responseType&&t.responseType!=="text"?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:Y,config:t,request:c}),c=null}},c.onabort=function(){c&&(r(Wl("Request aborted",t,"ECONNABORTED",c)),c=null)},c.onerror=function(){r(Wl("Network Error",t,null,c)),c=null},c.ontimeout=function(){r(Wl("timeout of "+t.timeout+"ms exceeded",t,"ECONNABORTED",c)),c=null},Jt.isStandardBrowserEnv()){var h=(t.withCredentials||rv(t.url))&&t.xsrfCookieName?iv.read(t.xsrfCookieName):void 0;h&&(o[t.xsrfHeaderName]=h)}if("setRequestHeader"in c&&Jt.forEach(o,function(C,x){i===void 0&&x.toLowerCase()==="content-type"?delete o[x]:c.setRequestHeader(x,C)}),t.withCredentials&&(c.withCredentials=!0),t.responseType)try{c.responseType=t.responseType}catch(C){if(t.responseType!=="json")throw C}typeof t.onDownloadProgress=="function"&&c.addEventListener("progress",t.onDownloadProgress),typeof t.onUploadProgress=="function"&&c.upload&&c.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then(function(C){c&&(c.abort(),r(C),c=null)}),i===void 0&&(i=null),c.send(i)})},sv={"Content-Type":"application/x-www-form-urlencoded"},jl={adapter:function(){var t;return(typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"||typeof XMLHttpRequest!="undefined")&&(t=nv),t}(),transformRequest:[function(t,e){return Df(e,"Accept"),Df(e,"Content-Type"),Jt.isFormData(t)||Jt.isArrayBuffer(t)||Jt.isBuffer(t)||Jt.isStream(t)||Jt.isFile(t)||Jt.isBlob(t)?t:Jt.isArrayBufferView(t)?t.buffer:Jt.isURLSearchParams(t)?(Ni(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):Jt.isObject(t)?(Ni(e,"application/json;charset=utf-8"),JSON.stringify(t)):t}],transformResponse:[function(t){if(typeof t=="string")try{t=JSON.parse(t)}catch(e){}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(t){return 200<=t&&300>t},headers:{common:{Accept:"application/json, text/plain, */*"}}};Jt.forEach(["delete","get","head"],function(t){jl.headers[t]={}}),Jt.forEach(["post","put","patch"],function(t){jl.headers[t]=Jt.merge(sv)});var ov=function(t){var e,r;return t.cancelToken&&t.cancelToken.throwIfRequested(),t.baseURL&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t.url)&&(t.url=(e=t.baseURL,(r=t.url)?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e)),t.headers=t.headers||{},t.data=ld(t.data,t.headers,t.transformRequest),t.headers=Jt.merge(t.headers.common||{},t.headers[t.method]||{},t.headers||{}),Jt.forEach("delete get head post put patch common".split(" "),function(i){delete t.headers[i]}),(t.adapter||jl.adapter)(t).then(function(i){return t.cancelToken&&t.cancelToken.throwIfRequested(),i.data=ld(i.data,i.headers,t.transformResponse),i},function(i){return Lf(i)||(t.cancelToken&&t.cancelToken.throwIfRequested(),i&&i.response&&(i.response.data=ld(i.response.data,i.response.headers,t.transformResponse))),Promise.reject(i)})},ud=function(t,e){e=e||{};var r={};return Jt.forEach(["url","method","params","data"],function(i){e[i]!==void 0&&(r[i]=e[i])}),Jt.forEach(["headers","auth","proxy"],function(i){Jt.isObject(e[i])?r[i]=Jt.deepMerge(t[i],e[i]):e[i]!==void 0?r[i]=e[i]:Jt.isObject(t[i])?r[i]=Jt.deepMerge(t[i]):t[i]!==void 0&&(r[i]=t[i])}),Jt.forEach("baseURL transformRequest transformResponse paramsSerializer timeout withCredentials adapter responseType xsrfCookieName xsrfHeaderName onUploadProgress onDownloadProgress maxContentLength validateStatus maxRedirects httpAgent httpsAgent cancelToken socketPath".split(" "),function(i){e[i]!==void 0?r[i]=e[i]:t[i]!==void 0&&(r[i]=t[i])}),r};yn.prototype.request=function(t,e){typeof t=="string"?(t=e||{}).url=t:t=t||{},(t=ud(this.defaults,t)).method=t.method?t.method.toLowerCase():"get";var r=[ov,void 0];for(t=Promise.resolve(t),this.interceptors.request.forEach(function(i){r.unshift(i.fulfilled,i.rejected)}),this.interceptors.response.forEach(function(i){r.push(i.fulfilled,i.rejected)});r.length;)t=t.then(r.shift(),r.shift());return t},yn.prototype.getUri=function(t){return t=ud(this.defaults,t),Rf(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},Jt.forEach(["delete","get","head","options"],function(t){yn.prototype[t]=function(e,r){return this.request(Jt.merge(r||{},{method:t,url:e}))}}),Jt.forEach(["post","put","patch"],function(t){yn.prototype[t]=function(e,r,i){return this.request(Jt.merge(i||{},{method:t,url:e,data:r}))}});var Vl=yn;as.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},as.prototype.__CANCEL__=!0;var bf=as;Hn.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Hn.source=function(){var t;return{token:new Hn(function(e){t=e}),cancel:t}};var Io=Hs(jl);Io.Axios=Vl,Io.create=function(t){return Hs(ud(Io.defaults,t))},Io.Cancel=bf,Io.CancelToken=Hn,Io.isCancel=Lf,Io.all=function(t){return Promise.all(t)},Io.spread=function(t){return function(e){return t.apply(null,e)}};var So=Io.default=Io;let Ms={DEBUG:0,INFO:1,WARNING:2,ERROR:3,NONE:4},Of=at(),Bf=t=>{for(const e in Ms)if(Object.prototype.hasOwnProperty.call(Ms,e)&&Ms[e]===t)return e;return"DEFAULT"},z=new class{constructor(){this.logLevel=Ms.DEBUG,this.uploadState="collecting",this.uploadLogWaitingList=[],this.uploadLogUploadingList=[],this.currentLogID=this.uploadErrorCount=0}debug(...t){var e;t=ne(e=[Ms.DEBUG]).call(e,t),this.log.apply(this,t)}info(...t){var e;t=ne(e=[Ms.INFO]).call(e,t),this.log.apply(this,t)}warning(...t){var e;t=ne(e=[Ms.WARNING]).call(e,t),this.log.apply(this,t)}error(...t){var e;t=ne(e=[Ms.ERROR]).call(e,t),this.log.apply(this,t)}setLogLevel(t){this.logLevel=t=Math.min(Math.max(0,t),4)}enableLogUpload(){Gr("UPLOAD_LOG",!0)}disableLogUpload(){Gr("UPLOAD_LOG",!1),this.uploadLogUploadingList=[],this.uploadLogWaitingList=[]}setProxyServer(t){this.proxyServerURL=t}log(...t){var e,r,i,o;if(100>at()-Of)return void _s(()=>{this.log(...t)},at()-Of);const c=Math.max(0,Math.min(4,t[0]));if(t[0]=Ks()+" Agora-SDK [".concat(Bf(c),"]:"),this.appendLogToWaitingList(c,t),!(c<this.logLevel)){var h=Ks()+" %cAgora-SDK [".concat(Bf(c),"]:"),C=[];switch(c){case Ms.DEBUG:C=ne(e=[h,"color: #64B5F6;"]).call(e,en(t).call(t,1)),console.log.apply(console,C);break;case Ms.INFO:C=ne(r=[h,"color: #1E88E5; font-weight: bold;"]).call(r,en(t).call(t,1)),console.log.apply(console,C);break;case Ms.WARNING:C=ne(i=[h,"color: #FB8C00; font-weight: bold;"]).call(i,en(t).call(t,1)),console.warn.apply(console,C);break;case Ms.ERROR:C=ne(o=[h,"color: #B00020; font-weight: bold;"]).call(o,en(t).call(t,1)),console.error.apply(console,C)}}}appendLogToWaitingList(t,...e){if(Xe.UPLOAD_LOG){var r="";Re(e).call(e,i=>{typeof i=="object"&&(i=ht(i)),r+="".concat(i," ")}),this.uploadLogWaitingList.push({payload_str:r,log_level:t,log_item_id:this.currentLogID++}),this.uploadState==="uploading"&&this.uploadLogUploadingList.length===0&&this.uploadLogInterval()}}startUpload(){this.uploadState="uploading",this.uploadLogUploadingList.length===0&&this.uploadLogInterval()}uploadLogs(){return Ee(this,null,function*(){var t,e={sdk_version:rs,process_id:Xe.PROCESS_ID,payload:ht(this.uploadLogUploadingList)};if(e=yield So.post(this.url||(this.proxyServerURL?ne(t="https://".concat(this.proxyServerURL,"/ls/?h=")).call(t,Xe.LOG_UPLOAD_SERVER,"&p=443&d=upload/v1"):"https://".concat(Xe.LOG_UPLOAD_SERVER,"/upload/v1")),e,{responseType:"text"}),e.data!=="OK")throw Error("unexpected upload log response: "+e.data);this.uploadLogUploadingList=[]})}uploadLogInterval(){if(this.uploadLogUploadingList.length!==0||this.uploadLogWaitingList.length!==0){var t;this.uploadLogUploadingList.length===0&&(this.uploadLogUploadingList=An(t=this.uploadLogWaitingList).call(t,0,10)),this.uploadLogs().then(()=>{this.uploadErrorCount=0,0<this.uploadLogWaitingList.length&&window.setTimeout(()=>this.uploadLogInterval(),3e3)}).catch(e=>{this.uploadErrorCount+=1,2>this.uploadErrorCount?window.setTimeout(()=>this.uploadLogInterval(),200):window.setTimeout(()=>this.uploadLogInterval(),1e3)})}}};class ue{constructor(e,r="",i){var o;this.name="AgoraRTCException",this.code=e,this.message=ne(o="AgoraRTCError ".concat(this.code,": ")).call(o,r),this.data=i}toString(){var e;return this.data?ne(e="".concat(this.message," data: ")).call(e,ht(this.data)):this.message}print(e="error"){return e==="error"&&z.error(this.toString()),e==="warning"&&z.warning(this.toString()),this}throw(){throw this.print(),this}}var Nf,nn;(function(t){t.FREE="free",t.UPLOADING="uploading"})(Nf||(Nf={})),function(t){t.NONE="none",t.INIT="init",t.CANPLAY="canplay",t.PLAYING="playing",t.PAUSED="paused",t.SUSPEND="suspend",t.STALLED="stalled",t.WAITING="waiting",t.ERROR="error",t.DESTROYED="destroyed",t.ABORT="abort",t.ENDED="ended",t.EMPTIED="emptied"}(nn||(nn={})),Kt({target:"Number",stat:!0},{MAX_SAFE_INTEGER:9007199254740991}),Kt({target:"Number",stat:!0},{MIN_SAFE_INTEGER:-9007199254740991});let av={sid:"",lts:0,success:null,cname:null,uid:null,peer:null,cid:null,elapse:null,extend:null,vid:0};var gn,Ai,Pf,Ot,bt,Oa,$o,sc,Kc,is,pn,Nt,er,Yn,Oi,nr,br,ks,Cr,Mt,Us;(function(t){t.PUBLISH="publish",t.SUBSCRIBE="subscribe",t.SESSION_INIT="session_init",t.JOIN_CHOOSE_SERVER="join_choose_server",t.REQ_USER_ACCOUNT="req_user_account",t.JOIN_GATEWAY="join_gateway",t.STREAM_SWITCH="stream_switch",t.REQUEST_PROXY_WORKER_MANAGER="request_proxy_worker_manager",t.REQUEST_PROXY_APPCENTER="request_proxy_appcenter",t.FIRST_VIDEO_RECEIVED="first_video_received",t.FIRST_AUDIO_RECEIVED="first_audio_received",t.FIRST_VIDEO_DECODE="first_video_decode",t.FIRST_AUDIO_DECODE="first_audio_decode",t.ON_ADD_AUDIO_STREAM="on_add_audio_stream",t.ON_ADD_VIDEO_STREAM="on_add_video_stream",t.ON_UPDATE_STREAM="on_update_stream",t.ON_REMOVE_STREAM="on_remove_stream",t.USER_ANALYTICS="req_user_analytics"})(gn||(gn={})),function(t){t.SESSION="io.agora.pb.Wrtc.Session",t.JOIN_CHOOSE_SERVER="io.agora.pb.Wrtc.JoinChooseServer",t.REQ_USER_ACCOUNT="io.agora.pb.Wrtc.ReqUserAccount",t.JOIN_GATEWAT="io.agora.pb.Wrtc.JoinGateway",t.PUBLISH="io.agora.pb.Wrtc.Publish",t.SUBSCRIBE="io.agora.pb.Wrtc.Subscribe",t.STREAM_SWITCH="io.agora.pb.Wrtc.StreamSwitch",t.AUDIO_SENDING_STOPPED="io.agora.pb.Wrtc.AudioSendingStopped",t.VIDEO_SENDING_STOPPED="io.agora.pb.Wrtc.VideoSendingStopped",t.REQUEST_PROXY_APPCENTER="io.agora.pb.Wrtc.RequestProxyAppCenter",t.REQUEST_PROXY_WORKER_MANAGER="io.agora.pb.Wrtc.RequestProxyWorkerManager",t.API_INVOKE="io.agora.pb.Wrtc.ApiInvoke",t.FIRST_VIDEO_RECEIVED="io.agora.pb.Wrtc.FirstVideoReceived",t.FIRST_AUDIO_RECEIVED="io.agora.pb.Wrtc.FirstAudioReceived",t.FIRST_VIDEO_DECODE="io.agora.pb.Wrtc.FirstVideoDecode",t.FIRST_AUDIO_DECODE="io.agora.pb.Wrtc.FirstAudioDecode",t.ON_ADD_AUDIO_STREAM="io.agora.pb.Wrtc.OnAddAudioStream",t.ON_ADD_VIDEO_STREAM="io.agora.pb.Wrtc.OnAddVideoStream",t.ON_UPDATE_STREAM="io.agora.pb.Wrtc.OnUpdateStream",t.ON_REMOVE_STREAM="io.agora.pb.Wrtc.OnRemoveStream",t.JOIN_CHANNEL_TIMEOUT="io.agora.pb.Wrtc.JoinChannelTimeout",t.PEER_PUBLISH_STATUS="io.agora.pb.Wrtc.PeerPublishStatus",t.WORKER_EVENT="io.agora.pb.Wrtc.WorkerEvent",t.AP_WORKER_EVENT="io.agora.pb.Wrtc.APWorkerEvent",t.JOIN_WEB_PROXY_AP="io.agora.pb.Wrtc.JoinWebProxyAP",t.WEBSOCKET_QUIT="io.agora.pb.Wrtc.WebSocketQuit",t.USER_ANALYTICS="io.agora.pb.Wrtc.UserAnalytics"}(Ai||(Ai={})),function(t){t[t.WORKER_EVENT=156]="WORKER_EVENT",t[t.AP_WORKER_EVENT=160]="AP_WORKER_EVENT"}(Pf||(Pf={})),function(t){t.CREATE_CLIENT="createClient",t.CHECK_SYSTEM_REQUIREMENTS="checkSystemRequirements",t.SET_AREA="setArea",t.CHECK_VIDEO_TRACK_IS_ACTIVE="checkVideoTrackIsActive",t.CHECK_AUDIO_TRACK_IS_ACTIVE="checkAudioTrackIsActive",t.CREATE_MIC_AUDIO_TRACK="createMicrophoneAudioTrack",t.CREATE_CUSTOM_AUDIO_TRACK="createCustomAudioTrack",t.CREATE_BUFFER_AUDIO_TRACK="createBufferSourceAudioTrack",t.CREATE_CAM_VIDEO_TRACK="createCameraVideoTrack",t.CREATE_CUSTOM_VIDEO_TRACK="createCustomVideoTrack",t.CREATE_MIC_AND_CAM_TRACKS="createMicrophoneAndCameraTracks",t.CREATE_SCREEN_VIDEO_TRACK="createScreenVideoTrack",t.SET_ENCRYPTION_CONFIG="Client.setEncryptionConfig",t.START_PROXY_SERVER="Client.startProxyServer",t.STOP_PROXY_SERVER="Client.stopProxyServer",t.SET_PROXY_SERVER="Client.setProxyServer",t.SET_TURN_SERVER="Client.setTurnServer",t.SET_CLIENT_ROLE="Client.setClientRole",t.SET_LOW_STREAM_PARAMETER="Client.setLowStreamParameter",t.ENABLE_DUAL_STREAM="Client.enableDualStream",t.DISABLE_DUAL_STREAM="Client.disableDualStream",t.JOIN="Client.join",t.LEAVE="Client.leave",t.PUBLISH="Client.publish",t.UNPUBLISH="Client.unpublish",t.SUBSCRIBE="Client.subscribe",t.UNSUBSCRIBE="Client.unsubscribe",t.RENEW_TOKEN="Client.renewToken",t.SET_REMOTE_VIDEO_STREAM_TYPE="Client.setRemoteVideoStreamType",t.SET_STREAM_FALLBACK_OPTION="Client.setStreamFallbackOption",t.ENABLE_AUDIO_VOLUME_INDICATOR="Client.enableAudioVolumeIndicator",t.SEND_CUSTOM_REPORT_MESSAGE="Client.sendCustomReportMessage",t.ON_LIVE_STREAM_WARNING="Client.onLiveStreamWarning",t.ON_LIVE_STREAM_ERROR="Client.onLiveStreamingError",t.START_LIVE_STREAMING="Client.startLiveStreaming",t.SET_LIVE_TRANSCODING="Client.setLiveTranscoding",t.STOP_LIVE_STREAMING="Client.stopLiveStreaming",t.ADD_INJECT_STREAM_URL="Client.addInjectStreamUrl",t.REMOVE_INJECT_STREAM_URL="Client.removeInjectStreamUrl",t.START_CHANNEL_MEDIA_RELAY="Client.startChannelMediaRelay",t.UPDATE_CHANNEL_MEDIA_RELAY="Client.updateChannelMediaRelay",t.STOP_CHANNEL_MEDIA_RELAY="Client.stopChannelMediaRelay",t.REQUEST_CONFIG_DISTRIBUTE="_config-distribute-request",t.SET_CONFIG_DISTRIBUTE="_configDistribute",t.LOCAL_TRACK_SET_MUTED="LocalTrack.setMute",t.LOCAL_AUDIO_TRACK_PLAY="LocalAudioTrack.play",t.LOCAL_AUDIO_TRACK_PLAY_IN_ELEMENT="LocalAudioTrack.playInElement",t.LOCAL_AUDIO_TRACK_STOP="LocalAudioTrack.stop",t.LOCAL_AUDIO_TRACK_SET_VOLUME="LocalAudioTrack.setVolume",t.MIC_AUDIO_TRACK_SET_DEVICE="MicrophoneAudioTrack.setDevice",t.BUFFER_AUDIO_TRACK_START="BufferSourceAudioTrack.startProcessAudioBuffer",t.BUFFER_AUDIO_TRACK_STOP="BufferSourceAudioTrack.stopProcessAudioBuffer",t.BUFFER_AUDIO_TRACK_PAUSE="BufferSourceAudioTrack.pauseProcessAudioBuffer",t.BUFFER_AUDIO_TRACK_RESUME="BufferSourceAudioTrack.resumeProcessAudioBuffer",t.BUFFER_AUDIO_TRACK_SEEK="BufferSourceAudioTrack.seekAudioBuffer",t.LOCAL_VIDEO_TRACK_PLAY="LocalVideoTrack.play",t.LOCAL_VIDEO_TRACK_STOP="LocalVideoTrack.stop",t.LOCAL_VIDEO_TRACK_BEAUTY="LocalVideoTrack.setBeautyEffect",t.CAM_VIDEO_TRACK_SET_DEVICE="CameraVideoTrack.setDevice",t.CAM_VIDEO_TRACK_SET_ENCODER_CONFIG="CameraVideoTrack.setEncoderConfiguration",t.REMOTE_VIDEO_TRACK_PLAY="RemoteVideoTrack.play",t.REMOTE_VIDEO_TRACK_STOP="RemoteVideoTrack.stop",t.REMOTE_AUDIO_TRACK_PLAY="RemoteAudioTrack.play",t.REMOTE_AUDIO_TRACK_STOP="RemoteAudioTrack.stop",t.REMOTE_AUDIO_SET_VOLUME="RemoteAudioTrack.setVolume",t.REMOTE_AUDIO_SET_OUTPUT_DEVICE="RemoteAudioTrack.setOutputDevice",t.GET_MEDIA_STREAM_TRACK="Track.getMediaStreamTrack",t.STREAM_TYPE_CHANGE="streamTypeChange"}(Ot||(Ot={})),(bt||(bt={})).TRACER="tracer",function(t){t.IDLE="IDLE",t.INITING="INITING",t.INITEND="INITEND"}(Oa||(Oa={})),function(t){t.STATE_CHANGE="state_change",t.RECORDING_DEVICE_CHANGED="recordingDeviceChanged",t.PLAYOUT_DEVICE_CHANGED="playoutDeviceChanged",t.CAMERA_DEVICE_CHANGED="cameraDeviceChanged"}($o||($o={})),function(t){t[t.ACCESS_POINT=101]="ACCESS_POINT",t[t.UNILBS=201]="UNILBS",t[t.STRING_UID_ALLOCATOR=901]="STRING_UID_ALLOCATOR"}(sc||(sc={})),function(t){t[t.IIIEGAL_APPID=1]="IIIEGAL_APPID",t[t.IIIEGAL_UID=2]="IIIEGAL_UID",t[t.INTERNAL_ERROR=3]="INTERNAL_ERROR"}(Kc||(Kc={})),function(t){t[t.INVALID_VENDOR_KEY=5]="INVALID_VENDOR_KEY",t[t.INVALID_CHANNEL_NAME=7]="INVALID_CHANNEL_NAME",t[t.INTERNAL_ERROR=8]="INTERNAL_ERROR",t[t.NO_AUTHORIZED=9]="NO_AUTHORIZED",t[t.DYNAMIC_KEY_TIMEOUT=10]="DYNAMIC_KEY_TIMEOUT",t[t.NO_ACTIVE_STATUS=11]="NO_ACTIVE_STATUS",t[t.DYNAMIC_KEY_EXPIRED=13]="DYNAMIC_KEY_EXPIRED",t[t.STATIC_USE_DYNAMIC_KEY=14]="STATIC_USE_DYNAMIC_KEY",t[t.DYNAMIC_USE_STATIC_KEY=15]="DYNAMIC_USE_STATIC_KEY",t[t.USER_OVERLOAD=16]="USER_OVERLOAD",t[t.FORBIDDEN_REGION=18]="FORBIDDEN_REGION",t[t.CANNOT_MEET_AREA_DEMAND=19]="CANNOT_MEET_AREA_DEMAND"}(is||(is={})),function(t){t[t.NO_FLAG_SET=100]="NO_FLAG_SET",t[t.FLAG_SET_BUT_EMPTY=101]="FLAG_SET_BUT_EMPTY",t[t.INVALID_FALG_SET=102]="INVALID_FALG_SET",t[t.NO_SERVICE_AVAILABLE=200]="NO_SERVICE_AVAILABLE",t[t.NO_SERVICE_AVAILABLE_P2P=201]="NO_SERVICE_AVAILABLE_P2P",t[t.NO_SERVICE_AVAILABLE_VOICE=202]="NO_SERVICE_AVAILABLE_VOICE",t[t.NO_SERVICE_AVAILABLE_WEBRTC=203]="NO_SERVICE_AVAILABLE_WEBRTC",t[t.NO_SERVICE_AVAILABLE_CDS=204]="NO_SERVICE_AVAILABLE_CDS",t[t.NO_SERVICE_AVAILABLE_CDN=205]="NO_SERVICE_AVAILABLE_CDN",t[t.NO_SERVICE_AVAILABLE_TDS=206]="NO_SERVICE_AVAILABLE_TDS",t[t.NO_SERVICE_AVAILABLE_REPORT=207]="NO_SERVICE_AVAILABLE_REPORT",t[t.NO_SERVICE_AVAILABLE_APP_CENTER=208]="NO_SERVICE_AVAILABLE_APP_CENTER",t[t.NO_SERVICE_AVAILABLE_ENV0=209]="NO_SERVICE_AVAILABLE_ENV0",t[t.NO_SERVICE_AVAILABLE_VOET=210]="NO_SERVICE_AVAILABLE_VOET",t[t.NO_SERVICE_AVAILABLE_STRING_UID=211]="NO_SERVICE_AVAILABLE_STRING_UID",t[t.NO_SERVICE_AVAILABLE_WEBRTC_UNILBS=212]="NO_SERVICE_AVAILABLE_WEBRTC_UNILBS",t[t.NO_SERVICE_AVAILABLE_UNILBS_FLV=213]="NO_SERVICE_AVAILABLE_UNILBS_FLV"}(pn||(pn={})),function(t){t[t.K_TIMESTAMP_EXPIRED=2]="K_TIMESTAMP_EXPIRED",t[t.K_CHANNEL_PERMISSION_INVALID=3]="K_CHANNEL_PERMISSION_INVALID",t[t.K_CERTIFICATE_INVALID=4]="K_CERTIFICATE_INVALID",t[t.K_CHANNEL_NAME_EMPTY=5]="K_CHANNEL_NAME_EMPTY",t[t.K_CHANNEL_NOT_FOUND=6]="K_CHANNEL_NOT_FOUND",t[t.K_TICKET_INVALID=7]="K_TICKET_INVALID",t[t.K_CHANNEL_CONFLICTED=8]="K_CHANNEL_CONFLICTED",t[t.K_SERVICE_NOT_READY=9]="K_SERVICE_NOT_READY",t[t.K_SERVICE_TOO_HEAVY=10]="K_SERVICE_TOO_HEAVY",t[t.K_UID_BANNED=14]="K_UID_BANNED",t[t.K_IP_BANNED=15]="K_IP_BANNED",t[t.K_CHANNEL_BANNED=16]="K_CHANNEL_BANNED",t[t.WARN_NO_AVAILABLE_CHANNEL=103]="WARN_NO_AVAILABLE_CHANNEL",t[t.WARN_LOOKUP_CHANNEL_TIMEOUT=104]="WARN_LOOKUP_CHANNEL_TIMEOUT",t[t.WARN_LOOKUP_CHANNEL_REJECTED=105]="WARN_LOOKUP_CHANNEL_REJECTED",t[t.WARN_OPEN_CHANNEL_TIMEOUT=106]="WARN_OPEN_CHANNEL_TIMEOUT",t[t.WARN_OPEN_CHANNEL_REJECTED=107]="WARN_OPEN_CHANNEL_REJECTED",t[t.WARN_REQUEST_DEFERRED=108]="WARN_REQUEST_DEFERRED",t[t.ERR_DYNAMIC_KEY_TIMEOUT=109]="ERR_DYNAMIC_KEY_TIMEOUT",t[t.ERR_NO_AUTHORIZED=110]="ERR_NO_AUTHORIZED",t[t.ERR_VOM_SERVICE_UNAVAILABLE=111]="ERR_VOM_SERVICE_UNAVAILABLE",t[t.ERR_NO_CHANNEL_AVAILABLE_CODE=112]="ERR_NO_CHANNEL_AVAILABLE_CODE",t[t.ERR_MASTER_VOCS_UNAVAILABLE=114]="ERR_MASTER_VOCS_UNAVAILABLE",t[t.ERR_INTERNAL_ERROR=115]="ERR_INTERNAL_ERROR",t[t.ERR_NO_ACTIVE_STATUS=116]="ERR_NO_ACTIVE_STATUS",t[t.ERR_INVALID_UID=117]="ERR_INVALID_UID",t[t.ERR_DYNAMIC_KEY_EXPIRED=118]="ERR_DYNAMIC_KEY_EXPIRED",t[t.ERR_STATIC_USE_DYANMIC_KE=119]="ERR_STATIC_USE_DYANMIC_KE",t[t.ERR_DYNAMIC_USE_STATIC_KE=120]="ERR_DYNAMIC_USE_STATIC_KE",t[t.ERR_NO_VOCS_AVAILABLE=2e3]="ERR_NO_VOCS_AVAILABLE",t[t.ERR_NO_VOS_AVAILABLE=2001]="ERR_NO_VOS_AVAILABLE",t[t.ERR_JOIN_CHANNEL_TIMEOUT=2002]="ERR_JOIN_CHANNEL_TIMEOUT",t[t.ERR_REPEAT_JOIN_CHANNEL=2003]="ERR_REPEAT_JOIN_CHANNEL",t[t.ERR_JOIN_BY_MULTI_IP=2004]="ERR_JOIN_BY_MULTI_IP",t[t.ERR_NOT_JOINED=2011]="ERR_NOT_JOINED",t[t.ERR_REPEAT_JOIN_REQUEST=2012]="ERR_REPEAT_JOIN_REQUEST",t[t.ERR_INVALID_VENDOR_KEY=2013]="ERR_INVALID_VENDOR_KEY",t[t.ERR_INVALID_CHANNEL_NAME=2014]="ERR_INVALID_CHANNEL_NAME",t[t.ERR_INVALID_STRINGUID=2015]="ERR_INVALID_STRINGUID",t[t.ERR_TOO_MANY_USERS=2016]="ERR_TOO_MANY_USERS",t[t.ERR_SET_CLIENT_ROLE_TIMEOUT=2017]="ERR_SET_CLIENT_ROLE_TIMEOUT",t[t.ERR_SET_CLIENT_ROLE_NO_PERMISSION=2018]="ERR_SET_CLIENT_ROLE_NO_PERMISSION",t[t.ERR_SET_CLIENT_ROLE_ALREADY_IN_USE=2019]="ERR_SET_CLIENT_ROLE_ALREADY_IN_USE",t[t.ERR_PUBLISH_REQUEST_INVALID=2020]="ERR_PUBLISH_REQUEST_INVALID",t[t.ERR_SUBSCRIBE_REQUEST_INVALID=2021]="ERR_SUBSCRIBE_REQUEST_INVALID",t[t.ERR_NOT_SUPPORTED_MESSAGE=2022]="ERR_NOT_SUPPORTED_MESSAGE",t[t.ERR_ILLEAGAL_PLUGIN=2023]="ERR_ILLEAGAL_PLUGIN",t[t.ERR_REJOIN_TOKEN_INVALID=2024]="ERR_REJOIN_TOKEN_INVALID",t[t.ERR_REJOIN_USER_NOT_JOINED=2025]="ERR_REJOIN_USER_NOT_JOINED",t[t.ERR_INVALID_OPTIONAL_INFO=2027]="ERR_INVALID_OPTIONAL_INFO",t[t.ILLEGAL_AES_PASSWORD=2028]="ILLEGAL_AES_PASSWORD",t[t.ILLEGAL_CLIENT_ROLE_LEVEL=2029]="ILLEGAL_CLIENT_ROLE_LEVEL",t[t.ERR_TEST_RECOVER=9e3]="ERR_TEST_RECOVER",t[t.ERR_TEST_TRYNEXT=9001]="ERR_TEST_TRYNEXT",t[t.ERR_TEST_RETRY=9002]="ERR_TEST_RETRY"}(Nt||(Nt={})),function(t){t.CONNECTION_STATE_CHANGE="connection-state-change",t.MEDIA_RECONNECT_START="media-reconnect-start",t.MEDIA_RECONNECT_END="media-reconnect-end",t.IS_USING_CLOUD_PROXY="is-using-cloud-proxy",t.USER_JOINED="user-joined",t.USER_LEAVED="user-left",t.USER_PUBLISHED="user-published",t.USER_UNPUBLISHED="user-unpublished",t.USER_INFO_UPDATED="user-info-updated",t.CLIENT_BANNED="client-banned",t.CHANNEL_MEDIA_RELAY_STATE="channel-media-relay-state",t.CHANNEL_MEDIA_RELAY_EVENT="channel-media-relay-event",t.VOLUME_INDICATOR="volume-indicator",t.CRYPT_ERROR="crypt-error",t.ON_TOKEN_PRIVILEGE_WILL_EXPIRE="token-privilege-will-expire",t.ON_TOKEN_PRIVILEGE_DID_EXPIRE="token-privilege-did-expire",t.NETWORK_QUALITY="network-quality",t.STREAM_TYPE_CHANGED="stream-type-changed",t.STREAM_FALLBACK="stream-fallback",t.RECEIVE_METADATA="receive-metadata",t.STREAM_MESSAGE="stream-message",t.LIVE_STREAMING_ERROR="live-streaming-error",t.LIVE_STREAMING_WARNING="live-streaming-warning",t.INJECT_STREAM_STATUS="stream-inject-status",t.EXCEPTION="exception",t.ERROR="error",t.P2P_LOST="p2p_lost"}(er||(er={})),function(t){t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.MULTI_IP="MULTI_IP",t.TIMEOUT="TIMEOUT",t.OFFLINE="OFFLINE",t.LEAVE="LEAVE"}(Yn||(Yn={})),function(t){t.CONNECTING="connecting",t.CONNECTED="connected",t.RECONNECTING="reconnecting",t.CLOSED="closed"}(Oi||(Oi={})),function(t){t.WS_CONNECTED="ws_connected",t.WS_RECONNECTING="ws_reconnecting",t.WS_CLOSED="ws_closed",t.ON_BINARY_DATA="on_binary_data",t.REQUEST_RECOVER="request_recover",t.REQUEST_JOIN_INFO="request_join_info",t.REQUEST_REJOIN_INFO="req_rejoin_info",t.IS_P2P_DISCONNECTED="is_p2p_dis",t.DISCONNECT_P2P="dis_p2p",t.NEED_RENEW_SESSION="need-sid",t.REPORT_JOIN_GATEWAY="report_join_gateway",t.REQUEST_TIMEOUT="request_timeout",t.REQUEST_SUCCESS="request_success"}(nr||(nr={})),function(t){t.PING="ping",t.PING_BACK="ping_back",t.JOIN="join_v2",t.REJOIN="rejoin",t.LEAVE="leave",t.SET_CLIENT_ROLE="set_client_role",t.PUBLISH="publish",t.UNPUBLISH="unpublish",t.SUBSCRIBE="subscribe",t.UNSUBSCRIBE="unsubscribe",t.SUBSCRIBE_CHANGE="subscribe_change",t.TRAFFIC_STATS="traffic_stats",t.RENEW_TOKEN="renew_token",t.SWITCH_VIDEO_STREAM="switch_video_stream",t.SET_FALLBACK_OPTION="set_fallback_option",t.GATEWAY_INFO="gateway_info",t.CONTROL="control",t.SEND_METADATA="send_metadata",t.DATA_STREAM="data_stream",t.PICK_SVC_LAYER="pick_svc_layer"}(br||(br={})),function(t){t.PUBLISH_STATS="publish_stats",t.PUBLISH_RELATED_STATS="publish_related_stats",t.SUBSCRIBE_STATS="subscribe_stats",t.SUBSCRIBE_RELATED_STATS="subscribe_related_stats",t.WS_INFLATE_DATA_LENGTH="ws_inflate_data_length"}(ks||(ks={})),function(t){t.ON_USER_ONLINE="on_user_online",t.ON_USER_OFFLINE="on_user_offline",t.ON_STREAM_FALLBACK_UPDATE="on_stream_fallback_update",t.ON_PUBLISH_STREAM="on_publish_stream",t.ON_UPLINK_STATS="on_uplink_stats",t.ON_P2P_LOST="on_p2p_lost",t.ON_REMOVE_STREAM="on_remove_stream",t.ON_ADD_AUDIO_STREAM="on_add_audio_stream",t.ON_ADD_VIDEO_STREAM="on_add_video_stream",t.ON_TOKEN_PRIVILEGE_WILL_EXPIRE="on_token_privilege_will_expire",t.ON_TOKEN_PRIVILEGE_DID_EXPIRE="on_token_privilege_did_expire",t.ON_USER_BANNED="on_user_banned",t.ON_NOTIFICATION="on_notification",t.ON_CRYPT_ERROR="on_crypt_error",t.MUTE_AUDIO="mute_audio",t.MUTE_VIDEO="mute_video",t.UNMUTE_AUDIO="unmute_audio",t.UNMUTE_VIDEO="unmute_video",t.RECEIVE_METADATA="receive_metadata",t.ON_DATA_STREAM="on_data_stream",t.ENABLE_LOCAL_VIDEO="enable_local_video",t.DISABLE_LOCAL_VIDEO="disable_local_video",t.ENABLE_LOCAL_AUDIO="enable_local_audio",t.DISABLE_LOCAL_AUDIO="disable_local_audio"}(Cr||(Cr={})),function(t){t.CONNECTION_STATE_CHANGE="CONNECTION_STATE_CHANGE",t.NEED_ANSWER="NEED_ANSWER",t.NEED_RENEGOTIATE="NEED_RENEGOTIATE",t.P2P_LOST="P2P_LOST",t.GATEWAY_P2P_LOST="GATEWAY_P2P_LOST",t.NEED_UNPUB="NEED_UNPUB",t.NEED_UNSUB="NEED_UNSUB",t.NEED_UPLOAD="NEED_UPLOAD",t.NEED_CONTROL="NEED_CONTROL",t.START_RECONNECT="START_RECONNECT",t.END_RECONNECT="END_RECONNECT",t.NEED_SIGNAL_RTT="NEED_SIGNAL_RTT"}(Mt||(Mt={})),function(t){t.AUDIO_SOURCE_STATE_CHANGE="audio_source_state_change",t.RECEIVE_TRACK_BUFFER="receive_track_buffer",t.ON_AUDIO_BUFFER="on_audio_buffer"}(Us||(Us={}));let Yl={sendVolumeLevel:0,sendBitrate:0,sendBytes:0,sendPackets:0,sendPacketsLost:0,currentPacketLossRate:0},Jl={sendBytes:0,sendBitrate:0,sendPackets:0,sendPacketsLost:0,sendResolutionHeight:0,sendResolutionWidth:0,captureResolutionHeight:0,captureResolutionWidth:0,targetSendBitrate:0,totalDuration:0,totalFreezeTime:0,currentPacketLossRate:0},dd={transportDelay:0,end2EndDelay:0,receiveBitrate:0,receiveLevel:0,receiveBytes:0,receiveDelay:0,receivePackets:0,receivePacketsLost:0,totalDuration:0,totalFreezeTime:0,freezeRate:0,packetLossRate:0,currentPacketLossRate:0,publishDuration:-1},xf={uplinkNetworkQuality:0,downlinkNetworkQuality:0},hd={transportDelay:0,end2EndDelay:0,receiveBitrate:0,receiveBytes:0,receiveDelay:0,receivePackets:0,receivePacketsLost:0,receiveResolutionHeight:0,receiveResolutionWidth:0,totalDuration:0,totalFreezeTime:0,freezeRate:0,packetLossRate:0,currentPacketLossRate:0,publishDuration:-1};var gr,mi;(function(t){t.CONNECTED="websocket:connected",t.RECONNECTING="websocket:reconnecting",t.WILL_RECONNECT="websocket:will_reconnect",t.CLOSED="websocket:closed",t.FAILED="websocket:failed",t.ON_MESSAGE="websocket:on_message",t.REQUEST_NEW_URLS="websocket:request_new_urls"})(gr||(gr={})),function(t){t.TRANSCODE="mix_streaming",t.RAW="raw_streaming",t.INJECT="inject_streaming"}(mi||(mi={}));let cv={alpha:1,height:640,width:360,x:0,y:0,zOrder:0,audioChannel:0},fd={x:0,y:0,width:160,height:160,zOrder:255,alpha:1},lv={audioBitrate:48,audioChannels:1,audioSampleRate:48e3,backgroundColor:0,height:360,lowLatency:!1,videoBitrate:400,videoCodecProfile:100,videoCodecType:1,videoFrameRate:15,videoGop:30,width:640,images:[],userConfigs:[],userConfigExtraInfo:""},uv={audioBitrate:48,audioChannels:2,audioVolume:100,audioSampleRate:48e3,height:0,width:0,videoBitrate:400,videoFramerate:15,videoGop:30};var Fs,oc,Yr,Mf,vn,Gi,Ut,oo,Ba,Wc;(function(t){t.WARNING="@live_uap-warning",t.ERROR="@line_uap-error",t.PUBLISH_STREAM_STATUS="@live_uap-publish-status",t.INJECT_STREAM_STATUS="@live_uap-inject-status",t.WORKER_STATUS="@live_uap-worker-status",t.REQUEST_NEW_ADDRESS="@live_uap-request-address"})(Fs||(Fs={})),(oc||(oc={})).REQUEST_WORKER_MANAGER_LIST="@live_req_worker_manager",function(t){t[t.LIVE_STREAM_RESPONSE_SUCCEED=200]="LIVE_STREAM_RESPONSE_SUCCEED",t[t.LIVE_STREAM_RESPONSE_ALREADY_EXISTS_STREAM=454]="LIVE_STREAM_RESPONSE_ALREADY_EXISTS_STREAM",t[t.LIVE_STREAM_RESPONSE_TRANSCODING_PARAMETER_ERROR=450]="LIVE_STREAM_RESPONSE_TRANSCODING_PARAMETER_ERROR",t[t.LIVE_STREAM_RESPONSE_BAD_STREAM=451]="LIVE_STREAM_RESPONSE_BAD_STREAM",t[t.LIVE_STREAM_RESPONSE_WM_PARAMETER_ERROR=400]="LIVE_STREAM_RESPONSE_WM_PARAMETER_ERROR",t[t.LIVE_STREAM_RESPONSE_WM_WORKER_NOT_EXIST=404]="LIVE_STREAM_RESPONSE_WM_WORKER_NOT_EXIST",t[t.LIVE_STREAM_RESPONSE_NOT_AUTHORIZED=456]="LIVE_STREAM_RESPONSE_NOT_AUTHORIZED",t[t.LIVE_STREAM_RESPONSE_FAILED_LOAD_IMAGE=457]="LIVE_STREAM_RESPONSE_FAILED_LOAD_IMAGE",t[t.LIVE_STREAM_RESPONSE_REQUEST_TOO_OFTEN=429]="LIVE_STREAM_RESPONSE_REQUEST_TOO_OFTEN",t[t.LIVE_STREAM_RESPONSE_NOT_FOUND_PUBLISH=452]="LIVE_STREAM_RESPONSE_NOT_FOUND_PUBLISH",t[t.LIVE_STREAM_RESPONSE_NOT_SUPPORTED=453]="LIVE_STREAM_RESPONSE_NOT_SUPPORTED",t[t.LIVE_STREAM_RESPONSE_MAX_STREAM_NUM=455]="LIVE_STREAM_RESPONSE_MAX_STREAM_NUM",t[t.LIVE_STREAM_RESPONSE_INTERNAL_SERVER_ERROR=500]="LIVE_STREAM_RESPONSE_INTERNAL_SERVER_ERROR",t[t.LIVE_STREAM_RESPONSE_WORKER_LOST=501]="LIVE_STREAM_RESPONSE_WORKER_LOST",t[t.LIVE_STREAM_RESPONSE_RESOURCE_LIMIT=502]="LIVE_STREAM_RESPONSE_RESOURCE_LIMIT",t[t.LIVE_STREAM_RESPONSE_WORKER_QUIT=503]="LIVE_STREAM_RESPONSE_WORKER_QUIT",t[t.ERROR_FAIL_SEND_MESSAGE=504]="ERROR_FAIL_SEND_MESSAGE",t[t.PUBLISH_STREAM_STATUS_ERROR_RTMP_HANDSHAKE=30]="PUBLISH_STREAM_STATUS_ERROR_RTMP_HANDSHAKE",t[t.PUBLISH_STREAM_STATUS_ERROR_RTMP_CONNECT=31]="PUBLISH_STREAM_STATUS_ERROR_RTMP_CONNECT",t[t.PUBLISH_STREAM_STATUS_ERROR_RTMP_PUBLISH=32]="PUBLISH_STREAM_STATUS_ERROR_RTMP_PUBLISH",t[t.PUBLISH_STREAM_STATUS_ERROR_PUBLISH_BROKEN=33]="PUBLISH_STREAM_STATUS_ERROR_PUBLISH_BROKEN"}(Yr||(Yr={})),function(t){t.CONNECT_FAILED="connect failed",t.CONNECT_TIMEOUT="connect timeout",t.WS_DISCONNECTED="websocket disconnected",t.REQUEST_TIMEOUT="request timeout",t.REQUEST_FAILED="request failed",t.WAIT_STATUS_TIMEOUT="wait status timeout",t.WAIT_STATUS_ERROR="wait status error",t.BAD_STATE="bad state",t.WS_ABORT="ws abort",t.AP_REQUEST_TIMEOUT="AP request timeout",t.AP_JSON_PARSE_ERROR="AP json parse error",t.AP_REQUEST_ERROR="AP request error",t.AP_REQUEST_ABORT="AP request abort"}(Mf||(Mf={})),function(t){t[t.SetSdkProfile=0]="SetSdkProfile",t[t.SetSourceChannel=1]="SetSourceChannel",t[t.SetSourceUserId=2]="SetSourceUserId",t[t.SetDestChannel=3]="SetDestChannel",t[t.StartPacketTransfer=4]="StartPacketTransfer",t[t.StopPacketTransfer=5]="StopPacketTransfer",t[t.UpdateDestChannel=6]="UpdateDestChannel",t[t.Reconnect=7]="Reconnect",t[t.SetVideoProfile=8]="SetVideoProfile"}(vn||(vn={})),function(t){t.DISCONNECT="disconnect",t.CONNECTION_STATE_CHANGE="connection-state-change",t.NETWORK_QUALITY="network-quality",t.STREAM_TYPE_CHANGE="stream-type-change",t.IS_P2P_DISCONNECTED="is-p2p-dis",t.DISCONNECT_P2P="dis-p2p",t.REQUEST_NEW_GATEWAY_LIST="req-gate-url",t.NEED_RENEW_SESSION="need-sid"}(Gi||(Gi={})),function(t){t.NEED_RENEGOTIATE="@need_renegotiate",t.NEED_REPLACE_TRACK="@need_replace_track",t.NEED_CLOSE="@need_close",t.NEED_ADD_TRACK="@need_add_track",t.NEED_REMOVE_TRACK="@need_remove_track",t.NEED_SESSION_ID="@need_sid",t.SET_OPTIMIZATION_MODE="@set_optimization_mode",t.GET_STATS="@get_stats",t.GET_LOW_VIDEO_TRACK="@get_low_video_track",t.NEED_RESET_REMOTE_SDP="@need_reset_remote_sdp",t.SET_VIDEO_TRACK_MUTED="@set_video_track_muted",t.SET_AUDIO_TRACK_MUTED="@set_audio_track_muted"}(Ut||(Ut={})),function(t){t.SCREEN_TRACK="screen_track",t.LOW_STREAM="low_stream"}(oo||(oo={})),function(t){t.SOURCE_STATE_CHANGE="source-state-change",t.TRACK_ENDED="track-ended",t.BEAUTY_EFFECT_OVERLOAD="beauty-effect-overload"}(Ba||(Ba={})),(Wc||(Wc={})).FIRST_FRAME_DECODED="first-frame-decoded";let kf="AFRICA ASIA CHINA EUROPE GLOBAL INDIA JAPAN NORTH_AMERICA OCEANIA OVERSEA SOUTH_AMERICA".split(" ");var Hi;(function(t){t.CHINA="CN",t.ASIA="AS",t.NORTH_AMERICA="NA",t.EUROPE="EU",t.JAPAN="JP",t.INDIA="IN",t.OCEANIA="OC",t.SOUTH_AMERICA="SA",t.AFRICA="AF",t.OVERSEA="OVERSEA",t.GLOBAL="GLOBAL"})(Hi||(Hi={}));let Ad={CHINA:{},ASIA:{CODE:Hi.ASIA,WEBCS_DOMAIN:["ap-web-1-asia.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-asia.agora.io"],PROXY_CS:["proxy-ap-web-asia.agora.io"],CDS_AP:["cds-ap-web-asia.agora.io","cds-ap-web-asia2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-asia.agora.io","sua-ap-web-asia2.agora.io"],UAP_AP:["uap-ap-web-asia.agora.io","uap-ap-web-asia2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-asia.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-asia.agora.io"],LOG_UPLOAD_SERVER:["logservice-asia.agora.io"],PROXY_SERVER_TYPE3:["southeast-asia.webrtc-cloud-proxy.sd-rtn.com"]},NORTH_AMERICA:{CODE:Hi.NORTH_AMERICA,WEBCS_DOMAIN:["ap-web-1-north-america.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-north-america.agora.io"],PROXY_CS:["proxy-ap-web-america.agora.io"],CDS_AP:["cds-ap-web-america.agora.io","cds-ap-web-america2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-america.agora.io","sua-ap-web-america2.agora.io"],UAP_AP:["uap-ap-web-america.agora.io","uap-ap-web-america2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-north-america.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-north-america.agora.io"],LOG_UPLOAD_SERVER:["logservice-north-america.agora.io"],PROXY_SERVER_TYPE3:["east-usa.webrtc-cloud-proxy.sd-rtn.com"]},EUROPE:{CODE:Hi.EUROPE,WEBCS_DOMAIN:["ap-web-1-europe.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-europe.agora.io"],PROXY_CS:["proxy-ap-web-europe.agora.io"],CDS_AP:["cds-ap-web-europe.agora.io","cds-ap-web-europe2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-europe.agora.io","sua-ap-web-europe.agora.io"],UAP_AP:["uap-ap-web-europe.agora.io","uap-ap-web-europe2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-europe.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-europe.agora.io"],LOG_UPLOAD_SERVER:["logservice-europe.agora.io"],PROXY_SERVER_TYPE3:["europe.webrtc-cloud-proxy.sd-rtn.com"]},JAPAN:{CODE:Hi.JAPAN,WEBCS_DOMAIN:["ap-web-1-japan.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-japan.agora.io"],PROXY_CS:["proxy-ap-web-japan.agora.io"],CDS_AP:["cds-ap-web-japan.agora.io","cds-ap-web-japan2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-japan.agora.io","sua-ap-web-japan2.agora.io"],UAP_AP:["uap-ap-web-japan.agora.io"," uap-ap-web-japan2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-japan.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-japan.agora.io"],LOG_UPLOAD_SERVER:["logservice-japan.agora.io"],PROXY_SERVER_TYPE3:["japan.webrtc-cloud-proxy.sd-rtn.com"]},INDIA:{CODE:Hi.INDIA,WEBCS_DOMAIN:["ap-web-1-india.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-india.agora.io"],PROXY_CS:["proxy-ap-web-india.agora.io"],CDS_AP:["cds-ap-web-india.agora.io","cds-ap-web-india2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-india.agora.io","sua-ap-web-india2.agora.io"],UAP_AP:["uap-ap-web-india.agora.io","uap-ap-web-india2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-india.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-india.agora.io"],LOG_UPLOAD_SERVER:["logservice-india.agora.io"],PROXY_SERVER_TYPE3:["india.webrtc-cloud-proxy.sd-rtn.com"]},OVERSEA:{CODE:Hi.OVERSEA,WEBCS_DOMAIN:["ap-web-1-oversea.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-oversea.agora.io"],PROXY_CS:["proxy-ap-web-oversea.agora.io"],CDS_AP:["cds-ap-web-oversea.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-oversea.agora.io"],UAP_AP:["uap-ap-web-oversea.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-oversea.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-oversea.agora.io"],LOG_UPLOAD_SERVER:["logservice-oversea.agora.io"],PROXY_SERVER_TYPE3:["webrtc-cloud-proxy.agora.io"]},GLOBAL:{CODE:Hi.GLOBAL,WEBCS_DOMAIN:["webrtc2-ap-web-1.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["webrtc2-ap-web-3.agora.io"],PROXY_CS:["ap-proxy-1.agora.io","ap-proxy-2.agora.io"],CDS_AP:["cds-ap-web-1.agora.io","cds-ap-web-3.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-1.agora.io","sua-ap-web-3.agora.io"],UAP_AP:["uap-ap-web-1.agora.io","uap-ap-web-3.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2.agora.io"],LOG_UPLOAD_SERVER:["logservice.agora.io"],PROXY_SERVER_TYPE3:["webrtc-cloud-proxy.sd-rtn.com"]},OCEANIA:{CODE:Hi.OCEANIA,WEBCS_DOMAIN:["ap-web-1-oceania.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-oceania.agora.io"],PROXY_CS:["proxy-ap-web-oceania.agora.io"],CDS_AP:["cds-ap-web-oceania.agora.io","cds-ap-web-oceania2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-oceania.agora.io","sua-ap-web-oceania2.agora.io"],UAP_AP:["uap-ap-web-oceania.agora.io","uap-ap-web-oceania2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-oceania.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-oceania.agora.io"],LOG_UPLOAD_SERVER:["logservice-oceania.agora.io"],PROXY_SERVER_TYPE3:["oceania.webrtc-cloud-proxy.sd-rtn.com"]},SOUTH_AMERICA:{CODE:Hi.SOUTH_AMERICA,WEBCS_DOMAIN:["ap-web-1-south-america.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-south-america.agora.io"],PROXY_CS:["proxy-ap-web-south-america.agora.io"],CDS_AP:["cds-ap-web-south-america.agora.io","cds-ap-web-south-america2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-south-america.agora.io","sua-ap-web-south-america2.agora.io"],UAP_AP:["uap-ap-web-south-america.agora.io","uap-ap-web-south-america2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-south-america.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-south-america.agora.io"],LOG_UPLOAD_SERVER:["logservice-south-america.agora.io"],PROXY_SERVER_TYPE3:["south-america.webrtc-cloud-proxy.sd-rtn.com"]},AFRICA:{CODE:Hi.AFRICA,WEBCS_DOMAIN:["ap-web-1-africa.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-africa.agora.io"],PROXY_CS:["proxy-ap-web-africa.agora.io"],CDS_AP:["cds-ap-web-africa.agora.io","cds-ap-web-africa2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-africa.agora.io","sua-ap-web-africa2.agora.io"],UAP_AP:["uap-ap-web-africa.agora.io","uap-ap-web-africa2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-africa.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-africa.agora.io"],LOG_UPLOAD_SERVER:["logservice-south-africa.agora.io"],PROXY_SERVER_TYPE3:["africa.webrtc-cloud-proxy.sd-rtn.com"]}};var jc,Qs,ac;ad&&(Ad.CHINA={CODE:Hi.CHINA,WEBCS_DOMAIN:["webrtc2-2.ap.sd-rtn.com"],WEBCS_DOMAIN_BACKUP_LIST:["webrtc2-4.ap.sd-rtn.com"],PROXY_CS:["proxy-web.ap.sd-rtn.com"],CDS_AP:["cds-web-2.ap.sd-rtn.com","cds-web-4.ap.sd-rtn.com"],ACCOUNT_REGISTER:["sua-web-2.ap.sd-rtn.com","sua-web-4.ap.sd-rtn.com"],UAP_AP:["uap-web-2.ap.sd-rtn.com","uap-web-4.ap.sd-rtn.com"],EVENT_REPORT_DOMAIN:["web-3.statscollector.sd-rtn.com"],EVENT_REPORT_BACKUP_DOMAIN:["web-4.statscollector.sd-rtn.com"],LOG_UPLOAD_SERVER:["logservice-china.agora.io"],PROXY_SERVER_TYPE3:["east-cn.webrtc-cloud-proxy.sd-rtn.com"]}),(jc||(jc={})).UPDATE_BITRATE_LIMIT="update_bitrate_limit",function(t){t.ONLINE="ONLINE",t.OFFLINE="OFFLINE"}(Qs||(Qs={})),function(t){t.NETWORK_STATE_CHANGE="NETWORK_STATE_CHANGE",t.ONLINE="ONLINE",t.OFFLINE="OFFLINE"}(ac||(ac={}));let dv={join:["startJoin","startRequestAp","startJoinGateway","finishJoin"],publish:["startPublish"]},Nr={getDisplayMedia:!1,getStreamFromExtension:!1,supportUnifiedPlan:!1,supportMinBitrate:!1,supportSetRtpSenderParameters:!1,supportDualStream:!0,webAudioMediaStreamDest:!1,supportReplaceTrack:!1,supportWebGL:!1,webAudioWithAEC:!1,supportRequestFrame:!1,supportShareAudio:!1,supportDualStreamEncoding:!1};Kt({target:"Object",stat:!0,forced:!xt,sham:!xt},{defineProperties:Zr});var Un=de(function(t){var e=Dr.Object;t=t.exports=function(r,i){return e.defineProperties(r,i)},e.defineProperties.sham&&(t.sham=!0)}),hv=Ln.concat("length","prototype"),gd={f:Object.getOwnPropertyNames||function(t){return xn(t,hv)}},fv=ms("Reflect","ownKeys")||function(t){var e=gd.f(Qi(t)),r=xc.f;return r?e.concat(r(t)):e};Kt({target:"Object",stat:!0,sham:!xt},{getOwnPropertyDescriptors:function(t){var e,r;t=Tn(t);for(var i=Wo,o=fv(t),c={},h=0;o.length>h;)(r=i(t,e=o[h++]))!==void 0&&Jo(c,e,r);return c}});var Pr=Dr.Object.getOwnPropertyDescriptors,Uf=gd.f,Av={}.toString,Ff=typeof window=="object"&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Qf=function(t){if(Ff&&Av.call(t)=="[object Window]")try{var e=Uf(t)}catch(r){e=Ff.slice()}else e=Uf(Tn(t));return e},Gf={f:ni},gv=Wn.f,ns=dt("hidden"),Hf=ni("toPrimitive"),pv=Lt.set,Kf=Lt.getterFor("Symbol"),ao=Object.prototype,Cs=Ht.Symbol,Vc=ms("JSON","stringify"),Wf=Wo,va=Wn.f,jf=Qf,vv=vo,ea=ro("symbols"),Yc=ro("op-symbols"),pd=ro("string-to-symbol-registry"),vd=ro("symbol-to-string-registry"),mv=ro("wks"),md=Ht.QObject,Ed=!md||!md.prototype||!md.prototype.findChild,_d=xt&&ii(function(){return Sr(va({},"a",{get:function(){return va(this,"a",{value:7}).a}})).a!=7})?function(t,e,r){var i=Wf(ao,e);i&&delete ao[e],va(t,e,r),i&&t!==ao&&va(ao,e,i)}:va,Vf=function(t,e){var r=ea[t]=Sr(Cs.prototype);return pv(r,{type:"Symbol",tag:t,description:e}),xt||(r.description=e),r},Cd=Es&&typeof Cs.iterator=="symbol"?function(t){return typeof t=="symbol"}:function(t){return Object(t)instanceof Cs},zl=function(t,e,r){return t===ao&&zl(Yc,e,r),Qi(t),e=mo(e,!0),Qi(r),$t(ea,e)?(r.enumerable?($t(t,ns)&&t[ns][e]&&(t[ns][e]=!1),r=Sr(r,{enumerable:gs(0,!1)})):($t(t,ns)||va(t,ns,gs(1,{})),t[ns][e]=!0),_d(t,e,r)):va(t,e,r)},Yf=function(t,e){Qi(t);var r=Tn(e);return e=Mn(r).concat(yd(r)),ze(e,function(i){xt&&!Jf.call(r,i)||zl(t,i,r[i])}),t},Jf=function(t){t=mo(t,!0);var e=vv.call(this,t);return!(this===ao&&$t(ea,t)&&!$t(Yc,t))&&(!(e||!$t(this,t)||!$t(ea,t)||$t(this,ns)&&this[ns][t])||e)},zf=function(t,e){if(t=Tn(t),e=mo(e,!0),t!==ao||!$t(ea,e)||$t(Yc,e)){var r=Wf(t,e);return!r||!$t(ea,e)||$t(t,ns)&&t[ns][e]||(r.enumerable=!0),r}},qf=function(t){t=jf(Tn(t));var e=[];return ze(t,function(r){$t(ea,r)||$t(_o,r)||e.push(r)}),e},yd=function(t){var e=t===ao;t=jf(e?Yc:Tn(t));var r=[];return ze(t,function(i){!$t(ea,i)||e&&!$t(ao,i)||r.push(ea[i])}),r};if(Es||(vi((Cs=function(){if(this instanceof Cs)throw TypeError("Symbol is not a constructor");var t=arguments.length&&arguments[0]!==void 0?String(arguments[0]):void 0,e=Ra(t),r=function(i){this===ao&&r.call(Yc,i),$t(this,ns)&&$t(this[ns],e)&&(this[ns][e]=!1),_d(this,e,gs(1,i))};return xt&&Ed&&_d(ao,e,{configurable:!0,set:r}),Vf(e,t)}).prototype,"toString",function(){return Kf(this).tag}),vo=Jf,Wn.f=zl,Wo=zf,gd.f=Qf=qf,xc.f=yd,xt&&va(Cs.prototype,"description",{configurable:!0,get:function(){return Kf(this).description}})),Ya||(Gf.f=function(t){return Vf(ni(t),t)}),Kt({global:!0,wrap:!0,forced:!Es,sham:!Es},{Symbol:Cs}),ze(Mn(mv),function(t){var e=Dr.Symbol||(Dr.Symbol={});$t(e,t)||gv(e,t,{value:Gf.f(t)})}),Kt({target:"Symbol",stat:!0,forced:!Es},{for:function(t){if(t=String(t),$t(pd,t))return pd[t];var e=Cs(t);return pd[t]=e,vd[e]=t,e},keyFor:function(t){if(!Cd(t))throw TypeError(t+" is not a symbol");if($t(vd,t))return vd[t]},useSetter:function(){Ed=!0},useSimple:function(){Ed=!1}}),Kt({target:"Object",stat:!0,forced:!Es,sham:!xt},{create:function(t,e){return e===void 0?Sr(t):Yf(Sr(t),e)},defineProperty:zl,defineProperties:Yf,getOwnPropertyDescriptor:zf}),Kt({target:"Object",stat:!0,forced:!Es},{getOwnPropertyNames:qf,getOwnPropertySymbols:yd}),Kt({target:"Object",stat:!0,forced:ii(function(){xc.f(1)})},{getOwnPropertySymbols:function(t){return xc.f(jn(t))}}),Vc){var Ev=!Es||ii(function(){var t=Cs();return Vc([t])!="[null]"||Vc({a:t})!="{}"||Vc(Object(t))!="{}"});Kt({target:"JSON",stat:!0,forced:Ev},{stringify:function(t,e,r){for(var i,o=[t],c=1;arguments.length>c;)o.push(arguments[c++]);if(i=e,(jr(e)||t!==void 0)&&!Cd(t))return Nn(e)||(e=function(h,C){if(typeof i=="function"&&(C=i.call(this,h,C)),!Cd(C))return C}),o[1]=e,Vc.apply(null,o)}})}Cs.prototype[Hf]||vs(Cs.prototype,Hf,Cs.prototype.valueOf),Be(Cs,"Symbol"),_o[ns]=!0;var xr=Dr.Object.getOwnPropertySymbols,Fn,Qn=function(t,e,r){return e in t?_h(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t};(function(t){t[t.CHOOSE_SERVER=11]="CHOOSE_SERVER",t[t.CLOUD_PROXY=18]="CLOUD_PROXY",t[t.CLOUD_PROXY_5=20]="CLOUD_PROXY_5"})(Fn||(Fn={}));var _v=pi("Array").values,Xf=Array.prototype,Cv={DOMTokenList:!0,NodeList:!0},Na=function(t){var e=t.values;return t===Xf||t instanceof Array&&e===Xf.values||Cv.hasOwnProperty(re(t))?_v:e},Pa=function(t){var e=jn(t),r=typeof this=="function"?this:Array,i=arguments.length,o=1<i?arguments[1]:void 0,c=o!==void 0,h=0,C=he(e);if(c&&(o=eo(o,2<i?arguments[2]:void 0,2)),C==null||r==Array&&ga(C))for(r=new r(i=Rn(e.length));i>h;h++)Jo(r,h,c?o(e[h],h):e[h]);else for(i=(e=C.call(e)).next,r=new r;!(C=i.call(e)).done;h++)Jo(r,h,c?Ie(e,o,[C.value,h],!0):C.value);return r.length=h,r},yv=!Oh(function(t){Array.from(t)});Kt({target:"Array",stat:!0,forced:yv},{from:Pa});var co=Dr.Array.from;class mn{constructor(){this._events={},this.addListener=this.on}getListeners(e){var r;return this._events[e]?_t(r=this._events[e]).call(r,i=>i.listener):[]}on(e,r){this._events[e]||(this._events[e]=[]),e=this._events[e],this._indexOfListener(e,r)===-1&&e.push({listener:r,once:!1})}once(e,r){this._events[e]||(this._events[e]=[]),e=this._events[e],this._indexOfListener(e,r)===-1&&e.push({listener:r,once:!0})}off(e,r){if(this._events[e]){var i=this._events[e];r=this._indexOfListener(i,r),r!==-1&&An(i).call(i,r,1),this._events[e].length===0&&delete this._events[e]}}removeAllListeners(e){e?delete this._events[e]:this._events={}}emit(e,...r){var i;this._events[e]||(this._events[e]=[]);let o=_t(i=this._events[e]).call(i,c=>c);for(i=0;i<o.length;i+=1){let c=o[i];c.once&&this.off(e,c.listener),c.listener.apply(this,r||[])}}_indexOfListener(e,r){let i=e.length;for(;i--;)if(e[i].listener===r)return i;return-1}}let ql=0,Id=0,ss=new class extends mn{constructor(){super();this._moduleName="network-indicator",this._networkState=Qs.ONLINE,window.addEventListener("online",()=>{this.networkState=Qs.ONLINE}),window.addEventListener("offline",()=>{this.networkState=Qs.OFFLINE})}set networkState(t){z.info("[".concat(this._moduleName,"]")+"network state changed, "+this._networkState+" -> "+t),this.emit(ac.NETWORK_STATE_CHANGE,t,this._networkState),t===Qs.ONLINE?this.emit(ac.ONLINE):t===Qs.OFFLINE&&(this.onlineWaiter=new it(e=>{this.once(ac.ONLINE,()=>{this.onlineWaiter=void 0,e(Qs.ONLINE)})}),this.emit(ac.OFFLINE)),this._networkState=t}get networkState(){return this._networkState}},Ki={timeout:500,timeoutFactor:1.5,maxRetryCount:1/0,maxRetryTimeout:1e4},ke=new class{constructor(){var t,e;this.baseInfoMap=new Tr,this.clientList=Zo,this.keyEventUploadPendingItems=[],this.normalEventUploadPendingItems=[],this.apiInvokeUploadPendingItems=[],this.apiInvokeCount=0,this.ltsList=[],this.lastSendNormalEventTime=at(),this.customReportCount=0,this.eventUploadTimer=window.setInterval(Ti(t=this.doSend).call(t,this),Xe.EVENT_REPORT_SEND_INTERVAL),this.setSessionIdTimer=window.setInterval(Ti(e=this.appendSessionId).call(e,this),Xe.EVENT_REPORT_SEND_INTERVAL)}reportApiInvoke(t,e,r){e.timeout=e.timeout||6e4,e.reportResult=e.reportResult===void 0||e.reportResult;const i=at(),o=this.apiInvokeCount+=1,c=()=>({tag:e.tag,invokeId:o,sid:t,name:e.name,apiInvokeTime:i,options:e.options,states:e.states||null}),h=!!Xe.SHOW_REPORT_INVOKER_LOG;h&&z.info("".concat(e.name," start"),e.options);let C=!1;zi(e.timeout).then(()=>{C||(this.sendApiInvoke(Jr({},c(),{error:oe.API_INVOKE_TIMEOUT,success:!1})),z.debug("".concat(e.name," timeout")))});const x=new ue(oe.UNEXPECTED_ERROR,"".concat(e.name,": this api invoke is end"));return{onSuccess:Q=>{const F=()=>{if(C)throw x;return C=!0,this.sendApiInvoke(Jr({},c(),{success:!0},e.reportResult&&{result:Q})),h&&z.info("".concat(e.name," onSuccess")),Q};return r?hA(F,e.name+"Success",r,()=>C=!0):F()},onError:Q=>{const F=()=>{if(C)throw Q;C=!0,this.sendApiInvoke(Jr({},c(),{success:!1,error:Q.toString()})),h&&z.info("".concat(e.name," onFailure"),Q.toString())};return r?hA(F,e.name+"Error",r,()=>C=!0):F()}}}sessionInit(t,e){if(!this.baseInfoMap.has(t)){var r=at();t=this.createBaseInfo(t,r),t.cname=e.cname;var i=Dn({},{willUploadConsoleLog:Xe.UPLOAD_LOG,maxTouchPoints:navigator.maxTouchPoints,areaVersion:ad?"global":"oversea",areas:Xe.AREAS&&Xe.AREAS.join(",")},e.extend),o=at();e=Jr({},t,{eventType:gn.SESSION_INIT,appid:e.appid,browser:navigator.userAgent,build:"v4.7.3-0-g0eb931c7(11/16/2021, 7:57:58 PM)",lts:o,elapse:o-r,extend:ht(i),mode:e.mode,process:Xe.PROCESS_ID,success:!0,version:rs}),this.send({type:Ai.SESSION,data:e},!0)}}joinChooseServer(t,e){if(t=this.baseInfoMap.get(t)){var r=t.info,i=at();e=Jr({},r,{eventType:gn.JOIN_CHOOSE_SERVER,lts:i,eventElapse:i-e.lts,chooseServerAddr:e.csAddr,errorCode:e.ec,elapse:i-t.startTime,success:e.succ,chooseServerAddrList:ht(e.serverList),uid:e.uid?Si(e.uid):null,cid:e.cid?Si(e.cid):null,chooseServerIp:e.csIp||"",opid:e.opid,unilbsServerIds:e.unilbsServerIds,extend:e.extend||void 0}),this.send({type:Ai.JOIN_CHOOSE_SERVER,data:e},!0)}}reqUserAccount(t,e){if(t=this.baseInfoMap.get(t)){var r=t.info,i=at();e=Jr({},r,{eventType:gn.REQ_USER_ACCOUNT,lts:i,success:e.success,serverAddress:e.serverAddr,stringUid:e.stringUid,uid:e.uid,errorCode:e.errorCode,elapse:i-t.startTime,eventElapse:i-e.lts,extend:ht(e.extend)}),this.send({type:Ai.REQ_USER_ACCOUNT,data:e},!0)}}joinGateway(t,e){if(t=this.baseInfoMap.get(t)){var r=t.info;e.vid&&(r.vid=e.vid),r.uid=e.uid,r.cid=e.cid;var i=at();r=Jr({},r,{eventType:gn.JOIN_GATEWAY,lts:i,gatewayAddr:e.addr,success:e.succ,errorCode:e.ec,elapse:i-t.startTime,eventElapse:i-e.lts}),e.succ&&(t.lastJoinSuccessTime=i),this.send({type:Ai.JOIN_GATEWAT,data:r},!0)}}joinChannelTimeout(t,e){if(t=this.baseInfoMap.get(t)){var r=at();e=Jr({},t.info,{lts:r,timeout:e,elapse:r-t.startTime}),this.send({type:Ai.JOIN_CHANNEL_TIMEOUT,data:e},!0)}}publish(t,e){if(t=this.baseInfoMap.get(t)){var r=t.info,i=at();e=Jr({},r,{eventType:gn.PUBLISH,lts:i,eventElapse:i-e.lts,elapse:i-t.startTime,success:e.succ,errorCode:e.ec,videoName:e.videoName,audioName:e.audioName,screenName:e.screenName,screenshare:e.screenshare,audio:e.audio,video:e.video,p2pid:e.p2pid,publishRequestid:e.publishRequestid}),this.send({type:Ai.PUBLISH,data:e},!0)}}subscribe(t,e){if(t=this.baseInfoMap.get(t)){var r=t.info,i=at();t=Jr({},r,{eventType:gn.SUBSCRIBE,lts:i,eventElapse:i-e.lts,elapse:i-t.startTime,success:e.succ,errorCode:e.ec,video:e.video,audio:e.audio,subscribeRequestid:e.subscribeRequestid,p2pid:e.p2pid}),typeof e.peerid=="string"?t.peerSuid=e.peerid:t.peer=e.peerid,this.send({type:Ai.SUBSCRIBE,data:t},!0)}}firstRemoteFrame(t,e,r,i){if(t=this.baseInfoMap.get(t)){var o=t.info,c=at();e=Jr({},o,{},i,{elapse:c-t.startTime,eventType:e,lts:c}),this.send({type:r,data:e},!0)}}onGatewayStream(t,e,r,i){(t=this.baseInfoMap.get(t))&&(e=Jr({},t.info,{},i,{eventType:e,lts:at()}),this.send({type:r,data:e},!0))}streamSwitch(t,e){if(t=this.baseInfoMap.get(t)){var r=t.info,i=at();e=Jr({},r,{eventType:gn.STREAM_SWITCH,lts:i,isDual:e.isdual,elapse:i-t.startTime,success:e.succ}),this.send({type:Ai.STREAM_SWITCH,data:e},!0)}}requestProxyAppCenter(t,e){if(t=this.baseInfoMap.get(t)){var r=t.info,i=at();e=Jr({},r,{eventType:gn.REQUEST_PROXY_APPCENTER,lts:i,eventElapse:i-e.lts,elapse:i-t.startTime,APAddr:e.APAddr,workerManagerList:e.workerManagerList,response:e.response,errorCode:e.ec,success:e.succ}),this.send({type:Ai.REQUEST_PROXY_APPCENTER,data:e},!0)}}requestProxyWorkerManager(t,e){if(t=this.baseInfoMap.get(t)){var r=t.info,i=at();e=Jr({},r,{eventType:gn.REQUEST_PROXY_WORKER_MANAGER,lts:i,eventElapse:i-e.lts,elapse:i-t.startTime,workerManagerAddr:e.workerManagerAddr,response:e.response,errorCode:e.ec,success:e.succ}),this.send({type:Ai.REQUEST_PROXY_WORKER_MANAGER,data:e},!0)}}setProxyServer(t){(this.proxyServer=t)?z.debug("reportProxyServerurl: ".concat(t)):z.debug("disable reportProxyServerurl: ".concat(t))}peerPublishStatus(t,e){if(t=this.baseInfoMap.get(t)){var r=t.info,i=at();e=Jr({},r,{subscribeElapse:e.subscribeElapse,peer:e.peer,peerPublishDuration:Math.max(e.audioPublishDuration,e.videoPublishDuration),audiotag:0<e.audioPublishDuration?1:-1,videotag:0<e.videoPublishDuration?1:-1,lts:i,elapse:i-t.startTime,joinChannelSuccessElapse:i-(t.lastJoinSuccessTime||i)}),this.send({type:Ai.PEER_PUBLISH_STATUS,data:e},!0)}}workerEvent(t,e){if(t=this.baseInfoMap.get(t)){var r=t.info,i=at();e=function(o,c,h){const C=o[c];if(!C||typeof C!="string")return[o];o[c]="";const x=zs(ht(o));let Q=0;const F=[];let V=0;for(let Y=0;Y<C.length;Y++)V+=127>=C.charCodeAt(Y)?1:3,V<=h-x||(F[F.length]=la({},o,{[c]:C.substring(Q,Y)}),Q=Y,V=127>=C.charCodeAt(Y)?1:3);return Q!==C.length-1&&(F[F.length]=la({},o,{[c]:C.substring(Q)})),F}(Jr({},r,{},e,{elapse:i-t.startTime,lts:i,productType:"WebRTC"}),"payload",1300),Re(e).call(e,o=>this.send({type:Ai.WORKER_EVENT,data:o},!0))}}apworkerEvent(t,e){if(t=this.baseInfoMap.get(t)){var r=t.info,i=at();e=Jr({},r,{},e,{elapse:i-t.startTime,lts:i}),this.send({type:Ai.AP_WORKER_EVENT,data:e},!0)}}joinWebProxyAP(t,e){if(t=this.baseInfoMap.get(t)){var r=t.info,i=at();e=Jr({},r,{},e,{elapse:i-t.startTime,lts:i,extend:e.extend||void 0}),this.send({type:Ai.JOIN_WEB_PROXY_AP,data:e},!0)}}WebSocketQuit(t,e){if(t=this.baseInfoMap.get(t)){var r=t.info,i=at();e=Jr({},r,{},e,{elapse:i-t.startTime,lts:i}),this.send({type:Ai.WEBSOCKET_QUIT,data:e},!0)}}sendCustomReportMessage(t,e){return Ee(this,null,function*(){if(this.customReportCount+=e.length,this.customReportCount>Xe.CUSTOM_REPORT_LIMIT)throw new ue(oe.CUSTOM_REPORT_FREQUENCY_TOO_HIGH);this.customReportCounterTimer||(this.customReportCounterTimer=window.setInterval(()=>{this.customReportCount=0},5e3)),e=_t(e).call(e,r=>({type:Ai.USER_ANALYTICS,data:Jr({sid:t},r)})),e={msgType:"EventMessages",sentTs:Math.round(at()/1e3),payloads:_t(e).call(e,r=>ht(r))};try{yield this.postDataToStatsCollector(e)}catch(r){throw z.error("send custom report message failed",r.toString()),new ue(oe.CUSTOM_REPORT_SEND_FAILED,r.message)}})}sendApiInvoke(t){var e=Xe.NOT_REPORT_EVENT;if(t.tag&&_r(e)&&_r(e).call(e,t.tag))return!1;if(t.sid===null)return this.apiInvokeUploadPendingItems.push(t),!1;if(e=this.baseInfoMap.get(t.sid),!e)return this.apiInvokeUploadPendingItems.push(t),!1;const{cname:r,uid:i,cid:o}=e.info;return t.lts=t.lts||at(),t={invokeId:t.invokeId,sid:t.sid,cname:r,cid:o,uid:i,lts:t.lts,success:t.success,elapse:t.lts-e.startTime,execElapse:t.lts-t.apiInvokeTime,apiName:t.name,options:t.options?ht(t.options):void 0,execStates:t.states?ht(t.states):void 0,execResult:t.result?ht(t.result):void 0,errorCode:t.error?ht(t.error):void 0},this.send({type:Ai.API_INVOKE,data:t},!1),!0}appendSessionId(){var t;Re(t=this.clientList).call(t,e=>{if(e._sessionId){const r=this.apiInvokeUploadPendingItems.length;for(let i=0;i<r;i++){const o=this.apiInvokeUploadPendingItems.shift();o&&(o.sid=e._sessionId,this.sendApiInvoke(Dn({},o)))}}})}send(t,e){if(e)return this.keyEventUploadPendingItems.push(t),void this.sendItems(this.keyEventUploadPendingItems,!0);var r;this.normalEventUploadPendingItems.push(t),this.normalEventUploadPendingItems.length>Xe.NORMAL_EVENT_QUEUE_CAPACITY&&An(r=this.normalEventUploadPendingItems).call(r,0,1),10<=this.normalEventUploadPendingItems.length&&this.sendItems(this.normalEventUploadPendingItems,!1)}doSend(){0<this.keyEventUploadPendingItems.length&&this.sendItems(this.keyEventUploadPendingItems,!0),0<this.normalEventUploadPendingItems.length&&5e3<=at()-this.lastSendNormalEventTime&&this.sendItems(this.normalEventUploadPendingItems,!1)}sendItems(t,e){const r=[];for(var i=[];t.length;){const h=t.shift();20>r.length?r.push(h):i.push(h)}t.push(...i);for(const h of[...r]){var o,c;Vt(o=this.ltsList).call(o,h.data.lts)!==-1?(h.data.lts=this.ltsList[this.ltsList.length-1]+1,this.ltsList.push(h.data.lts)):(this.ltsList.push(h.data.lts),Hc(c=this.ltsList).call(c,(C,x)=>C-x))}return e||(this.lastSendNormalEventTime=at()),i={msgType:"EventMessages",sentTs:Math.round(at()/1e3),payloads:_t(r).call(r,h=>ht(h)),vid:(h=>(h=h&&h.data.sid&&this.baseInfoMap.get(h.data.sid))&&h.info.vid&&+h.info.vid||0)(r[0])},r.length&&this.postDataToStatsCollector(i).catch((h=>C=>{var x,Q,F;Xe.EVENT_REPORT_RETRY&&(e?this.keyEventUploadPendingItems=ne(x=this.keyEventUploadPendingItems).call(x,h):(this.normalEventUploadPendingItems=ne(Q=this.normalEventUploadPendingItems).call(Q,h),this.normalEventUploadPendingItems.length>Xe.NORMAL_EVENT_QUEUE_CAPACITY&&(An(F=this.normalEventUploadPendingItems).call(F,0,this.normalEventUploadPendingItems.length-Xe.NORMAL_EVENT_QUEUE_CAPACITY),z.warning("report: drop normal events"))))})(r)),t}postDataToStatsCollector(t,e=!1){return Ee(this,null,function*(){var r,i,o;ss.networkState===Qs.OFFLINE&&(yield it.race([ss.onlineWaiter,zi(2*Ki.maxRetryTimeout)]));const c=e?"/events/proto-raws":"/events/messages";let h=this.url||(this.proxyServer?ne(r=ne(i="https://".concat(this.proxyServer,"/rs/?h=")).call(i,Xe.EVENT_REPORT_DOMAIN,"&p=6443&d=")).call(r,c):ne(o="https://".concat(Xe.EVENT_REPORT_DOMAIN,":6443")).call(o,c));for(r=0;2>r;r+=1){var C,x,Q;r===1&&(h=this.backupUrl||(this.proxyServer?ne(C=ne(x="https://".concat(this.proxyServer,"/rs/?h=")).call(x,Xe.EVENT_REPORT_BACKUP_DOMAIN,"&p=6443&d=")).call(C,c):ne(Q="https://".concat(Xe.EVENT_REPORT_BACKUP_DOMAIN,":6443")).call(Q,c)));try{e?yield ls(h,{timeout:1e4,data:t}):yield cn(h,{timeout:1e4,data:t})}catch(F){if(r===1)throw F;continue}break}})}createBaseInfo(t,e){const r=Dn({},av);return r.sid=t,this.baseInfoMap.set(t,{info:r,startTime:e}),r}};class Zf extends mn{constructor(e,r){super();this._hints=[],this._isClosed=!1,this._ID=r||be(8,"track-"),this._mediaStreamTrack=this._originMediaStreamTrack=e,_r(pa).call(pa,this)||pa.push(this)}toString(){return this._ID}getTrackId(){return this._ID}getMediaStreamTrack(e){return e||(e=ke.reportApiInvoke(null,{name:Ot.GET_MEDIA_STREAM_TRACK,options:[],tag:bt.TRACER}),this._mediaStreamTrack&&typeof this._mediaStreamTrack.label=="string"?e.onSuccess(this._mediaStreamTrack.label):e.onSuccess("")),this._mediaStreamTrack}close(){this._isClosed=!0;{let e=Vt(pa).call(pa,this);e!==-1&&An(pa).call(pa,e,1)}}}let Iv=1;class ta{constructor(e){var r;this.lockingPromise=it.resolve(),this.locks=0,this.name="",this.lockId=Iv++,e&&(this.name=e),z.debug(ne(r="[lock-".concat(this.name,"-")).call(r,this.lockId,"] is created."))}get isLocked(){return 0<this.locks}lock(){var e,r;let i;this.locks+=1,z.debug(ne(e=ne(r="[lock-".concat(this.name,"-")).call(r,this.lockId,"] is locked, current queue ")).call(e,this.locks,"."));let o=new it(c=>{i=()=>{var h,C;--this.locks,z.debug(ne(h=ne(C="[lock-".concat(this.name,"-")).call(C,this.lockId,"] is not locked, current queue ")).call(h,this.locks,".")),c()}});return e=this.lockingPromise.then(()=>i),this.lockingPromise=this.lockingPromise.then(()=>o),e}}class Xl extends Zf{constructor(e,r){super(e,r);this._enabled=!0,this._isClosed=this._muted=!1,this._trackProcessors=[],this._handleTrackEnded=()=>{this.onTrackEnded()},this._enabledMutex=new ta("".concat(r)),e.addEventListener("ended",this._handleTrackEnded)}get muted(){return this._muted}get enabled(){return this._enabled}getTrackLabel(){return this._originMediaStreamTrack.label}close(){var e;this._isClosed||(this.stop(),Re(e=this._trackProcessors).call(e,r=>r.destroy()),this._trackProcessors=[],this._originMediaStreamTrack.stop(),this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack.stop(),this._mediaStreamTrack=null),this._originMediaStreamTrack=null,this._enabledMutex=null,z.debug("[".concat(this.getTrackId(),"] close")),this.emit(Ut.NEED_CLOSE),super.close())}_registerTrackProcessor(e){return Ee(this,null,function*(){var r;if(Vt(r=this._trackProcessors).call(r,e)===-1){var i=this._trackProcessors[this._trackProcessors.length-1];this._trackProcessors.push(e),e.onOutputChange=()=>Ee(this,null,function*(){this._mediaStreamTrack=e.output||this._originMediaStreamTrack,this._updatePlayerSource(),yield di(this,Ut.NEED_REPLACE_TRACK,this._mediaStreamTrack)}),i?(i.onOutputChange=()=>Ee(this,null,function*(){i.output&&(yield e.setInput(i.output))}),yield e.setInput(i.output||i.input||this._originMediaStreamTrack)):yield e.setInput(this._originMediaStreamTrack)}})}_getOutputFromProcessors(){if(this._trackProcessors.length===0)return this._originMediaStreamTrack;let e=this._trackProcessors[this._trackProcessors.length-1];return e.output||e.input||this._originMediaStreamTrack}_updateOriginMediaStreamTrack(e,r){return Ee(this,null,function*(){e!==this._originMediaStreamTrack&&(this._originMediaStreamTrack.removeEventListener("ended",this._handleTrackEnded),r&&this._originMediaStreamTrack.stop(),e.addEventListener("ended",this._handleTrackEnded),this._originMediaStreamTrack=e,0<this._trackProcessors.length?(yield this._trackProcessors[0].setInput(e),this._mediaStreamTrack=this._getOutputFromProcessors()):this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),yield di(this,Ut.NEED_REPLACE_TRACK,this._mediaStreamTrack))})}_getDefaultPlayerConfig(){return{}}onTrackEnded(){z.debug("[".concat(this.getTrackId(),"] track ended")),this.emit(Ba.TRACK_ENDED)}stateCheck(e,r){var i,o,c;if(z.debug(ne(i=ne(o=ne(c="check track state, [muted: ".concat(this._muted,", enabled: ")).call(c,this._enabled,"] to [")).call(o,e,": ")).call(i,r,"]")),e==="muted"&&!Nr.webAudioMediaStreamDest)throw new ue(oe.NOT_SUPPORTED,"current environment does not support set mute").print();if(cs(r,e),this._enabled&&this._muted&&e==="enabled"&&r===!1)throw new ue(oe.TRACK_STATE_UNREACHABLE,"cannot set enabled while the track is muted").print();if(!this._enabled&&!this._muted&&e==="muted"&&r===!0)throw new ue(oe.TRACK_STATE_UNREACHABLE,"cannot set muted while the track is disabled").print()}}var Wi;(function(t){t.IOS_15_INTERRUPTION_START="ios15-interruption-start",t.IOS_15_INTERRUPTION_END="ios15-interruption-end",t.IOS_INTERRUPTION_START="ios-interruption-start",t.IOS_INTERRUPTION_END="ios-interruption-end"})(Wi||(Wi={}));let $f=window.AudioContext||window.webkitAudioContext,lo=null,hr=new class extends mn{constructor(){super(...arguments);this.onLocalAudioTrackMute=()=>{z.info("ios15-interruption-start"),this.emit(Wi.IOS_15_INTERRUPTION_START)},this.onLocalAudioTrackUnmute=()=>Ee(this,null,function*(){z.info("ios15-interruption-end"),this.curState!=="running"||this.duringInterruption?z.info("ios15-interruption-end-canceled"):(lo&&(yield lo.suspend()),this.emit(Wi.IOS_15_INTERRUPTION_END))})}get duringInterruption(){return this.prevState==="running"&&this.curState==="interrupted"}bindInterruptDetectorTrack(t){z.debug("webaudio bindInterruptDetectorTrack ".concat(t.getTrackId())),this.interruptDetectorTrack||(this.interruptDetectorTrack=t,this.interruptDetectorTrack._mediaStreamTrack.onmute=this.onLocalAudioTrackMute,this.interruptDetectorTrack._mediaStreamTrack.onunmute=this.onLocalAudioTrackUnmute)}unbindInterruptDetectorTrack(t){z.debug("webaudio unbindInterruptDetectorTrack ".concat(t.getTrackId())),this.interruptDetectorTrack&&this.interruptDetectorTrack===t&&(this.interruptDetectorTrack._mediaStreamTrack&&(this.interruptDetectorTrack._mediaStreamTrack.onmute=null,this.interruptDetectorTrack._mediaStreamTrack.onunmute=null),this.interruptDetectorTrack=void 0)}},Sd=null;class eA extends mn{constructor(){super();this.isPlayed=!1,this.audioOutputLevel=0,this.isNoAudioInput=this.isDestroyed=!1,this._noAudioInputCount=0,this.context=ln(),this.playNode=this.context.destination,this.outputNode=this.context.createGain(),Ls(this.outputNode),this.analyserNode=this.context.createAnalyser(),this.analyserNode.smoothingTimeConstant=.4,this.analyserNode.fftSize=2048}startGetAudioBuffer(e){this.audioBufferNode||(this.audioBufferNode=this.context.createScriptProcessor(e),this.outputNode.connect(this.audioBufferNode),this.audioBufferNode.connect(this.context.destination),this.audioBufferNode.onaudioprocess=r=>{this.emit(Us.ON_AUDIO_BUFFER,function(i){for(let o=0;o<i.outputBuffer.numberOfChannels;o+=1){let c=i.outputBuffer.getChannelData(o);for(let h=0;h<c.length;h+=1)c[h]=0}return i.inputBuffer}(r))})}stopGetAudioBuffer(){this.audioBufferNode&&(this.audioBufferNode.onaudioprocess=null,this.outputNode.disconnect(this.audioBufferNode),this.audioBufferNode=void 0)}createOutputTrack(){if(!Nr.webAudioMediaStreamDest)throw new ue(oe.NOT_SUPPORTED,"your browser is not support audio processor");return this.destNode&&this.outputTrack||(this.destNode=this.context.createMediaStreamDestination(),this.outputNode.connect(this.destNode),this.outputTrack=this.destNode.stream.getAudioTracks()[0]),this.outputTrack}play(e){this.context.state!=="running"&&Fr(()=>{hr.emit("autoplay-failed")}),this.isPlayed=!0,this.playNode=e||this.context.destination,this.outputNode.connect(this.playNode)}stop(){if(this.isPlayed)try{this.outputNode.disconnect(this.playNode)}catch(e){}this.isPlayed=!1}getAccurateVolumeLevel(){if(!this.context||qt()||dr()||this.context.state!=="running"&&this.context.resume(),!this.analyserNode)return 0;let e=new Uint8Array(this.analyserNode.frequencyBinCount);this.analyserNode.getByteFrequencyData(e);let r=0;for(let i=0;i<e.length;i++)r+=64>i?Math.abs(10*e[i]):Math.abs(6*e[i]/15);return r/e.length/255}checkHasAudioInput(e=0){return Ee(this,null,function*(){if(5<e)return this.isNoAudioInput=!0,this.onNoAudioInput&&this.onNoAudioInput(),!1;if(qt()||dr()?this.context.state==="suspended"&&this.context.resume():this.context.state!=="running"&&this.context.resume(),!this.analyserNode)return!1;let r=new Uint8Array(this.analyserNode.frequencyBinCount);this.analyserNode.getByteFrequencyData(r);let i=!1;for(let o=0;o<r.length;o++)r[o]!==0&&(i=!0);return i?(this.isNoAudioInput=!1,!0):(yield zi(200),(yield this.checkHasAudioInput(e?e+1:1))&&i)})}getAudioVolume(){return this.outputNode.gain.value}setVolume(e){this.outputNode.gain.setValueAtTime(e,this.context.currentTime)}setMute(e){e?(this.disconnect(),this.audioOutputLevel=0):this.connect()}destroy(){this.disconnect(),this.stop(),this.isDestroyed=!0,this.onNoAudioInput=void 0}disconnect(){this.sourceNode&&this.sourceNode.disconnect(),this.outputNode&&this.outputNode.disconnect()}connect(){this.sourceNode&&this.sourceNode.connect(this.outputNode),this.outputNode.connect(this.analyserNode)}}class tA extends eA{constructor(e,r){if(super(),this.isCurrentTrackCloned=!1,this.isRemoteTrack=!1,this.rebuildWebAudio=()=>Ee(this,null,function*(){if(z.debug("ready to rebuild web audio, state:",this.context.state),this.isNoAudioInput&&(yield this.checkHasAudioInput()),!this.isNoAudioInput||this.isDestroyed)return document.body.removeEventListener("click",this.rebuildWebAudio,!0),void z.debug("rebuild web audio success, current volume status",this.getAccurateVolumeLevel());this.context.resume().then(()=>z.info("resume success")),z.debug("rebuild web audio because of ios 12 bugs"),this.disconnect();var i=this.track;this.track=this.track.clone(),this.isCurrentTrackCloned?i.stop():this.isCurrentTrackCloned=!0,i=new MediaStream([this.track]),this.sourceNode=this.context.createMediaStreamSource(i),Ls(this.sourceNode),this.analyserNode=this.context.createAnalyser();let o=this.outputNode.gain.value;this.outputNode=this.context.createGain(),this.outputNode.gain.setValueAtTime(o,this.context.currentTime),Ls(this.outputNode),this.connect(),this.audioElement.srcObject=i,this.isPlayed&&this.play(this.playNode),this.checkHasAudioInput()}),e.kind!=="audio")throw new ue(oe.UNEXPECTED_ERROR);this.track=e,e=new MediaStream([this.track]),this.isRemoteTrack=!!r,this.sourceNode=this.context.createMediaStreamSource(e),Ls(this.sourceNode),this.connect(),this.audioElement=document.createElement("audio"),this.audioElement.srcObject=e,e=Ye(),r&&e.os===tn.IOS&&15>Number(e.osVersion&&e.osVersion.split(".")[0])&&(hr.on("state-change",()=>{this.context.state==="suspended"?document.body.addEventListener("click",this.rebuildWebAudio,!0):this.context.state==="running"&&this.rebuildWebAudio()}),this.checkHasAudioInput().then(i=>{i||document.body.addEventListener("click",this.rebuildWebAudio,!0)}))}get isFreeze(){return!1}updateTrack(e){this.sourceNode.disconnect(),this.track=e,this.isCurrentTrackCloned=!1,e=new MediaStream([e]),this.sourceNode=this.context.createMediaStreamSource(e),Ls(this.sourceNode),this.sourceNode.connect(this.outputNode),this.audioElement.srcObject=e}destroy(){this.audioElement.srcObject=null,this.audioElement.remove(),hr.off("state-change",this.rebuildWebAudio),super.destroy()}}let Zl=null,Td=new ta("safari"),rA=!1,iA=!1,Jn=new class extends mn{constructor(){super();this._state=Oa.IDLE,this.lastAccessCameraPermission=this.lastAccessMicrophonePermission=this.isAccessCameraPermission=this.isAccessMicrophonePermission=!1,this.deviceInfoMap=new Tr,this.init().then(()=>{var t;navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",Ti(t=this.updateDevicesInfo).call(t,this)),window.setInterval(()=>Ye().name!==ir.WECHAT&&Xe.ENUMERATE_DEVICES_INTERVAL&&this.updateDevicesInfo(),6e4)}).catch(t=>z.error(t.toString()))}get state(){return this._state}set state(t){t!==this._state&&(this.emit($o.STATE_CHANGE,t),this._state=t)}enumerateDevices(t,e,r=!1){return Ee(this,null,function*(){if(!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices)return new ue(oe.NOT_SUPPORTED,"enumerateDevices() not supported.").throw();var i=yield navigator.mediaDevices.enumerateDevices();i=this.checkMediaDeviceInfoIsOk(i);let o=!this.isAccessMicrophonePermission&&t,c=!this.isAccessCameraPermission&&e;i.audio&&(o=!1),i.video&&(c=!1);let h=i=null,C=null;if(!r&&(o||c)){if(Td.isLocked&&(z.debug("[device manager] wait GUM lock"),(yield Td.lock())(),z.debug("[device manager] GUM unlock")),rA&&(o=!1,this.isAccessMicrophonePermission=!0),iA&&(c=!1,this.isAccessCameraPermission=!0),z.debug("[device manager] check media device permissions",t,e,o,c),o&&c){try{C=yield navigator.mediaDevices.getUserMedia({audio:!0,video:!0})}catch(te){if(r=Ds(te.name||te.code||te,te.message),r.code===oe.PERMISSION_DENIED)throw r;z.warning("getUserMedia failed in getDevices",r)}this.isAccessMicrophonePermission=this.isAccessCameraPermission=!0}else if(o){try{i=yield navigator.mediaDevices.getUserMedia({audio:t})}catch(te){if(r=Ds(te.name||te.code||te,te.message),r.code===oe.PERMISSION_DENIED)throw r;z.warning("getUserMedia failed in getDevices",r)}this.isAccessMicrophonePermission=!0}else if(c){try{h=yield navigator.mediaDevices.getUserMedia({video:e})}catch(te){if(r=Ds(te.name||te.code||te,te.message),r.code===oe.PERMISSION_DENIED)throw r;z.warning("getUserMedia failed in getDevices",r)}this.isAccessCameraPermission=!0}z.debug("[device manager] mic permission",t,"cam permission",e)}try{var x,Q,F;const te=yield navigator.mediaDevices.enumerateDevices();return i&&Re(x=i.getTracks()).call(x,ce=>ce.stop()),h&&Re(Q=h.getTracks()).call(Q,ce=>ce.stop()),C&&Re(F=C.getTracks()).call(F,ce=>ce.stop()),i=null,h=null,C=null,te}catch(te){var V,Y,$;return i&&Re(V=i.getTracks()).call(V,ce=>ce.stop()),h&&Re(Y=h.getTracks()).call(Y,ce=>ce.stop()),C&&Re($=C.getTracks()).call($,ce=>ce.stop()),C=h=i=null,new ue(oe.ENUMERATE_DEVICES_FAILED,te.toString()).throw()}})}getRecordingDevices(t=!1){return Ee(this,null,function*(){return t=yield this.enumerateDevices(!0,!1,t),Wt(t).call(t,e=>e.kind==="audioinput")})}getCamerasDevices(t=!1){return Ee(this,null,function*(){return t=yield this.enumerateDevices(!1,!0,t),Wt(t).call(t,e=>e.kind==="videoinput")})}getSpeakers(t=!1){return Ee(this,null,function*(){return t=yield this.enumerateDevices(!0,!1,t),Wt(t).call(t,e=>e.kind==="audiooutput")})}searchDeviceNameById(t){return(t=this.deviceInfoMap.get(t))?t.device.label||t.device.deviceId:null}searchDeviceIdByName(t){var e;let r=null;return Re(e=this.deviceInfoMap).call(e,i=>{i.device.label===t&&(r=i.device.deviceId)}),r}getDeviceById(t){return Ee(this,null,function*(){var e=yield this.enumerateDevices(!0,!0,!0);if(e=rr(e).call(e,r=>r.deviceId===t),!e)throw new ue(oe.DEVICE_NOT_FOUND,"deviceId: ".concat(t));return e})}init(){return Ee(this,null,function*(){this.state=Oa.INITING;try{yield this.updateDevicesInfo(),this.state=Oa.INITEND}catch(e){z.warning("Device Detection functionality cannot start properly.",e.toString()),this.state=Oa.IDLE;var t=typeof isSecureContext=="boolean"?isSecureContext:location.protocol==="https:"||location.protocol==="file:"||location.hostname==="localhost"||location.hostname==="127.0.0.1"||location.hostname==="::1";throw t||new ue(oe.WEB_SECURITY_RESTRICT,"Your context is limited by web security, please try using https protocol or localhost.").throw(),e}})}updateDevicesInfo(){return Ee(this,null,function*(){var t;const e=yield this.enumerateDevices(!0,!0,!0),r=at(),i=[],o=this.checkMediaDeviceInfoIsOk(e);if(Re(e).call(e,c=>{if(c.deviceId){var h=this.deviceInfoMap.get(c.deviceId);if((h?h.state:"INACTIVE")!=="ACTIVE"){const C={initAt:r,updateAt:r,device:c,state:"ACTIVE"};this.deviceInfoMap.set(c.deviceId,C),i.push(C)}h&&(h.updateAt=r)}}),Re(t=this.deviceInfoMap).call(t,(c,h)=>{c.state==="ACTIVE"&&c.updateAt!==r&&(c.state="INACTIVE",i.push(c))}),this.state!==Oa.INITEND)return o.audio&&(this.lastAccessMicrophonePermission=!0,this.isAccessMicrophonePermission=!0),void(o.video&&(this.lastAccessCameraPermission=!0,this.isAccessCameraPermission=!0));Re(i).call(i,c=>{switch(c.device.kind){case"audioinput":this.lastAccessMicrophonePermission&&this.isAccessMicrophonePermission&&this.emit($o.RECORDING_DEVICE_CHANGED,c);break;case"videoinput":this.lastAccessCameraPermission&&this.isAccessCameraPermission&&this.emit($o.CAMERA_DEVICE_CHANGED,c);break;case"audiooutput":this.lastAccessMicrophonePermission&&this.isAccessMicrophonePermission&&this.emit($o.PLAYOUT_DEVICE_CHANGED,c)}}),o.audio&&(this.lastAccessMicrophonePermission=!0,this.isAccessMicrophonePermission=!0),o.video&&(this.lastAccessCameraPermission=!0,this.isAccessCameraPermission=!0)})}checkMediaDeviceInfoIsOk(t){const e=Wt(t).call(t,i=>i.kind==="audioinput");t=Wt(t).call(t,i=>i.kind==="videoinput");const r={audio:!1,video:!1};for(const i of e)if(i.label&&i.deviceId){r.audio=!0;break}for(const i of t)if(i.label&&i.deviceId){r.video=!0;break}return r}};var Sv=pi("Array").entries,nA=Array.prototype,Tv={DOMTokenList:!0,NodeList:!0},sA=function(t){var e=t.entries;return t===nA||t instanceof Array&&e===nA.entries||Tv.hasOwnProperty(re(t))?Sv:e};let Rd=!1,oA=new mn,aA="play playing loadeddata canplay pause stalled suspend waiting abort emptied ended".split(" "),ys=new class{constructor(){this.elementMap=new Tr,this.elementStateMap=new Tr,this.elementsNeedToResume=[],this.sinkIdMap=new Tr,this.autoResumeAfterInterruption=()=>{var t,e;Re(t=co(sA(e=this.elementMap).call(e))).call(t,([r,i])=>{r=this.elementStateMap.get(r);const o=i.srcObject.getAudioTracks()[0];Or()?o&&o.readyState==="live"&&hr.curState==="running"&&(z.debug("auto resume after interruption for iOS 15"),i.pause(),i.play()):r&&r==="pause"&&o&&o.readyState==="live"&&hr.curState==="running"&&(z.debug("auto resume after interruption for iOS"),i.play())})},this.autoResumeAfterInterruptionOnIOS15=()=>{var t,e;Re(t=co(sA(e=this.elementMap).call(e))).call(t,([,r])=>{const i=r.srcObject.getAudioTracks()[0];i&&i.readyState==="live"&&(z.debug("auto resume after interruption inside autoResumeAfterInterruptionOnIOS15"),r.pause(),r.play())})},this.autoResumeAudioElement(),hr.on(Wi.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),hr.on(Wi.IOS_15_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15)}setSinkID(t,e){return Ee(this,null,function*(){const r=this.elementMap.get(t);if(this.sinkIdMap.set(t,e),r)try{yield r.setSinkId(e)}catch(i){throw new ue(oe.PERMISSION_DENIED,"can not set sink id: "+i.toString())}})}play(t,e,r){if(!this.elementMap.has(e)){var i=document.createElement("audio");i.autoplay=!0,i.srcObject=new MediaStream([t]),this.bindAudioElementEvents(e,i),this.elementMap.set(e,i),this.elementStateMap.set(e,nn.INIT),this.setVolume(e,r),(t=this.sinkIdMap.get(e))&&i.setSinkId(t).catch(o=>{z.warning("[".concat(e,"] set sink id failed"),o.toString())}),(t=i.play())&&t.then&&t.catch(o=>{z.warning("audio element play warning",o.toString()),this.elementMap.has(e)&&o.name==="NotAllowedError"&&(z.warning("detected audio element autoplay failed"),this.elementsNeedToResume.push(i),Fr(()=>{this.onAutoplayFailed&&this.onAutoplayFailed(),aa()}))})}}updateTrack(t,e){(t=this.elementMap.get(t))&&(t.srcObject=new MediaStream([e]))}isPlaying(t){return this.elementMap.has(t)}setVolume(t,e){(t=this.elementMap.get(t))&&(e=Math.max(0,Math.min(100,e)),t.volume=e/100)}stop(t){var e,r;const i=this.elementMap.get(t);if(this.sinkIdMap.delete(t),i){var o=Vt(e=this.elementsNeedToResume).call(e,i);An(r=this.elementsNeedToResume).call(r,o,1),i.srcObject=null,i.remove(),this.elementMap.delete(t),this.elementStateMap.delete(t)}}bindAudioElementEvents(t,e){Re(aA).call(aA,r=>{e.addEventListener(r,i=>{var o,c;const h=this.elementStateMap.get(t);i=i.type,z.debug(ne(o=ne(c="[".concat(t,"] audio-element-status change ")).call(c,h," => ")).call(o,i)),this.elementStateMap.set(t,i)})})}autoResumeAudioElement(){const t=()=>{var e;Re(e=this.elementsNeedToResume).call(e,r=>{r.play().then(i=>{z.debug("Auto resume audio element success")}).catch(i=>{z.warning("Auto resume audio element failed!",i)})}),this.elementsNeedToResume=[]};new it(e=>{document.body?e():window.addEventListener("load",()=>e())}).then(()=>{document.body.addEventListener("touchstart",t,!0),document.body.addEventListener("mousedown",t,!0)})}};var os=function(t,e,r,i){var o,c=arguments.length,h=3>c?e:i===null?i=Ar(e,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(t,e,r,i);else for(var C=t.length-1;0<=C;C--)(o=t[C])&&(h=(3>c?o(h):3<c?o(e,r,h):o(e,r))||h);return 3<c&&h&&mr(e,r,h),h},lr=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)};class ji extends Xl{constructor(e,r,i){super(e,i);this.trackMediaType="audio",this._enabled=!0,this._volume=100,this._bypassWebAudio=this._useAudioElement=!1,this._encoderConfig=r,this._source=new tA(e)}get isPlaying(){return this._useAudioElement?ys.isPlaying(this.getTrackId()):this._source.isPlayed}setVolume(e){Xt(e,"volume",0,1e3);let r=ke.reportApiInvoke(null,{tag:bt.TRACER,name:Ot.LOCAL_AUDIO_TRACK_SET_VOLUME,options:[this.getTrackId(),e]},300);this._volume=e,this._source.setVolume(e/100),this._useAudioElement&&ys.setVolume(this.getTrackId(),e);try{if(this._bypassWebAudio)return void z.debug("[".concat(this.getTrackId(),"] setVolume returned because no pass through WebAudio."));let i=this._source.createOutputTrack();this._mediaStreamTrack!==i&&(this._mediaStreamTrack=i,di(this,Ut.NEED_REPLACE_TRACK,this._mediaStreamTrack).then(()=>{z.debug("[".concat(this.getTrackId(),"] replace web audio track success"))}).catch(o=>{z.warning("[".concat(this.getTrackId(),"] replace web audio track failed"),o)}))}catch(i){}r.onSuccess()}getVolumeLevel(){return this._source.getAccurateVolumeLevel()}setPlaybackDevice(e){return Ee(this,null,function*(){let r=ke.reportApiInvoke(null,{tag:bt.TRACER,name:Ot.REMOTE_AUDIO_SET_OUTPUT_DEVICE,options:[this.getTrackId(),e]});if(!this._useAudioElement)throw new ue(oe.NOT_SUPPORTED,"your browser does not support setting the audio output device");try{yield ys.setSinkID(this.getTrackId(),e)}catch(i){throw r.onError(i),i}r.onSuccess()})}setEnabled(e,r,i){return Ee(this,null,function*(){var o;if(!i){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(z.info("[".concat(this.getTrackId(),"] start setEnabled"),e),r=yield this._enabledMutex.lock(),!e){this._originMediaStreamTrack.enabled=!1;try{yield di(this,Ut.NEED_REMOVE_TRACK,this)}catch(c){throw z.error("[".concat(this.getTrackId(),"] setEnabled to false error"),c.toString()),r(),c}return i||(this._enabled=!1),r()}this._originMediaStreamTrack.enabled=!0;try{yield di(this,Ut.NEED_ADD_TRACK,this)}catch(c){throw z.error("[".concat(this.getTrackId(),"] setEnabled to true error"),c.toString()),r(),c}z.info(ne(o="[".concat(this.getTrackId(),"] setEnabled to ")).call(o,e," success")),i||(this._enabled=!0),r()})}setMuted(e){return Ee(this,null,function*(){var r,i;if(this._bypassWebAudio)return z.debug(ne(i="[".concat(this.getTrackId(),"] setMuted:")).call(i,e," fallback to setEnabled because no pass through.")),void(yield this.setEnabled(!e));if(e!==this._muted){if(this.stateCheck("muted",e),this._muted=e,Ye().name===ir.FIREFOX)return z.debug("[".concat(this.getTrackId(),"] firefox set mute fallback to set enabled")),void(yield this.setEnabled(!e,void 0,!0));this._mediaStreamTrack.enabled=!e,z.debug(ne(r="[".concat(this.getTrackId(),"] start set muted: ")).call(r,e)),yield di(this,Ut.SET_AUDIO_TRACK_MUTED,{track:this,muted:e})}})}getStats(){return Pi(()=>{z.warning("[deprecated] LocalAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalAudioStats instead")},"localAudioTrackGetStatsWarning"),zr(this,Ut.GET_STATS)||Js({},Yl)}setAudioFrameCallback(e,r=4096){if(!e)return this._source.removeAllListeners(Us.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(r),this._source.removeAllListeners(Us.ON_AUDIO_BUFFER),this._source.on(Us.ON_AUDIO_BUFFER,i=>e(i))}play(){let e=ke.reportApiInvoke(null,{tag:bt.TRACER,name:Ot.LOCAL_AUDIO_TRACK_PLAY,options:[this.getTrackId()]});z.debug("[".concat(this.getTrackId(),"] start audio playback")),this._useAudioElement?(z.debug("[".concat(this.getTrackId(),"] start audio playback in element")),ys.play(this._mediaStreamTrack,this.getTrackId(),this._volume)):this._source.play(),e.onSuccess()}stop(){let e=ke.reportApiInvoke(null,{tag:bt.TRACER,name:Ot.LOCAL_AUDIO_TRACK_STOP,options:[this.getTrackId()]});z.debug("[".concat(this.getTrackId(),"] stop audio playback")),this._useAudioElement?ys.stop(this.getTrackId()):this._source.stop(),e.onSuccess()}close(){super.close(),this._source.destroy()}_updatePlayerSource(){z.debug("[".concat(this.getTrackId(),"] update player source track")),this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&ys.updateTrack(this.getTrackId(),this._mediaStreamTrack)}_updateOriginMediaStreamTrack(e,r){return Ee(this,null,function*(){this._originMediaStreamTrack!==e&&(this._originMediaStreamTrack.removeEventListener("ended",this._handleTrackEnded),e.addEventListener("ended",this._handleTrackEnded),r&&this._originMediaStreamTrack.stop(),this._originMediaStreamTrack=e,this._source.updateTrack(this._originMediaStreamTrack),this._mediaStreamTrack!==this._source.outputTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),yield di(this,Ut.NEED_REPLACE_TRACK,this._mediaStreamTrack)))})}renewMediaStreamTrack(){return it.resolve(void 0)}}os([or(),lr("design:type",Function),lr("design:paramtypes",[String]),lr("design:returntype",it)],ji.prototype,"setPlaybackDevice",null),os([or(),lr("design:type",Function),lr("design:paramtypes",[Boolean,Object,Boolean]),lr("design:returntype",it)],ji.prototype,"setEnabled",null),os([or(),Ao({report:ke}),lr("design:type",Function),lr("design:paramtypes",[Boolean]),lr("design:returntype",it)],ji.prototype,"setMuted",null),os([or(),lr("design:type",Function),lr("design:paramtypes",[]),lr("design:returntype",Object)],ji.prototype,"getStats",null),os([or(),lr("design:type",Function),lr("design:paramtypes",[Object,Number]),lr("design:returntype",void 0)],ji.prototype,"setAudioFrameCallback",null),os([or(),lr("design:type",Function),lr("design:paramtypes",[]),lr("design:returntype",void 0)],ji.prototype,"play",null),os([or(),lr("design:type",Function),lr("design:paramtypes",[]),lr("design:returntype",void 0)],ji.prototype,"stop",null);class Jc extends ji{constructor(e,r,i,o){super(e,r.encoderConfig?Ei(r.encoderConfig):{},o);this._deviceName="default",this._enabled=!0,this._config=r,this._constraints=i,this._deviceName=e.label,typeof r.bypassWebAudio=="boolean"&&(this._bypassWebAudio=r.bypassWebAudio),Or()&&hr.bindInterruptDetectorTrack(this)}setDevice(e){return Ee(this,null,function*(){var r,i;let o=ke.reportApiInvoke(null,{tag:bt.TRACER,name:Ot.MIC_AUDIO_TRACK_SET_DEVICE,options:[this.getTrackId(),e]});if(z.info(ne(r="[".concat(this.getTrackId(),"] start set device to ")).call(r,e)),this._enabled)try{let c=yield Jn.getDeviceById(e);r={},r.audio=Js({},this._constraints),r.audio.deviceId={exact:e},this._originMediaStreamTrack.stop();let h=null;try{h=yield Ii(r,this.getTrackId())}catch(C){throw z.error("[".concat(this.getTrackId(),"] setDevice failed"),C.toString()),h=yield Ii({video:this._constraints},this.getTrackId()),yield this._updateOriginMediaStreamTrack(h.getAudioTracks()[0],!1),C}yield this._updateOriginMediaStreamTrack(h.getAudioTracks()[0],!1),this._deviceName=c.label,this._config.microphoneId=e,this._constraints.deviceId={exact:e}}catch(c){throw o.onError(c),z.error("[".concat(this.getTrackId(),"] setDevice error"),c.toString()),c}else try{this._deviceName=(yield Jn.getDeviceById(e)).label,this._config.microphoneId=e,this._constraints.deviceId={exact:e}}catch(c){throw o.onError(c),z.error("[".concat(this.getTrackId(),"] setDevice error"),c.toString()),c}o.onSuccess(),z.info(ne(i="[".concat(this.getTrackId(),"] set device to ")).call(i,e," success"))})}setEnabled(e,r,i){var o=c=>super[c];return Ee(this,null,function*(){if(r)return z.debug("[".concat(this.getTrackId,"] setEnabled false (do not close microphone)")),yield o("setEnabled").call(this,e);if(!i){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(z.info("[".concat(this.getTrackId(),"] start setEnabled"),e),r=yield this._enabledMutex.lock(),!e){this._originMediaStreamTrack.onended=null,this._originMediaStreamTrack.stop(),i||(this._enabled=!1);try{yield di(this,Ut.NEED_REMOVE_TRACK,this)}catch(C){throw z.error("[".concat(this.getTrackId(),"] setEnabled false failed"),C.toString()),r(),C}return void r()}e=Js({},this._constraints);let h=Jn.searchDeviceIdByName(this._deviceName);h&&!e.deviceId&&(e.deviceId=h);try{let C=yield Ii({audio:this._constraints},this.getTrackId());yield this._updateOriginMediaStreamTrack(C.getAudioTracks()[0],!1),yield di(this,Ut.NEED_ADD_TRACK,this)}catch(C){throw r(),z.error("[".concat(this.getTrackId(),"] setEnabled true failed"),C.toString()),C}i||(this._enabled=!0),z.info("[".concat(this.getTrackId(),"] setEnabled success")),r()})}close(){super.close(),Or()&&hr.unbindInterruptDetectorTrack(this)}onTrackEnded(){if((qt()||dr())&&this._enabled&&!this._isClosed&&hr.duringInterruption){let e=()=>Ee(this,null,function*(){hr.off(Wi.IOS_INTERRUPTION_END,e),this._enabled&&!this._isClosed&&(z.debug("[".concat(this.getTrackId(),"] try capture microphone media device for interrupted iOS device.")),yield this.setEnabled(!1),yield this.setEnabled(!0))});hr.on(Wi.IOS_INTERRUPTION_END,e)}else z.debug("[".concat(this.getTrackId(),"] track ended")),this.emit(Ba.TRACK_ENDED)}renewMediaStreamTrack(){return Ee(this,null,function*(){var e=Js({},this._constraints);let r=Jn.searchDeviceIdByName(this._deviceName);r&&!e.deviceId&&(e.deviceId=r),e=yield Ii({audio:this._constraints},this.getTrackId()),yield this._updateOriginMediaStreamTrack(e.getAudioTracks()[0],!0)})}}os([or(),lr("design:type",Function),lr("design:paramtypes",[String]),lr("design:returntype",it)],Jc.prototype,"setDevice",null),os([or(),lr("design:type",Function),lr("design:paramtypes",[Boolean,Boolean,Boolean]),lr("design:returntype",it)],Jc.prototype,"setEnabled",null);class cc extends ji{constructor(e,r,i,o){super(r.createOutputTrack(),i,o);this.source=e,this._bufferSource=r,this._bufferSource.on(Us.AUDIO_SOURCE_STATE_CHANGE,c=>{this.emit(Ba.SOURCE_STATE_CHANGE,c)});try{this._mediaStreamTrack=this._source.createOutputTrack()}catch(c){}}get currentState(){return this._bufferSource.currentState}get duration(){return this._bufferSource.duration}getCurrentTime(){return this._bufferSource.currentTime}startProcessAudioBuffer(e){let r=ke.reportApiInvoke(null,{tag:bt.TRACER,name:Ot.BUFFER_AUDIO_TRACK_START,options:[this.getTrackId(),e,this.duration]});e&&this._bufferSource.updateOptions(e),this._bufferSource.startProcessAudioBuffer(),r.onSuccess()}pauseProcessAudioBuffer(){let e=ke.reportApiInvoke(null,{tag:bt.TRACER,name:Ot.BUFFER_AUDIO_TRACK_PAUSE,options:[this.getTrackId()]});this._bufferSource.pauseProcessAudioBuffer(),e.onSuccess()}seekAudioBuffer(e){let r=ke.reportApiInvoke(null,{tag:bt.TRACER,name:Ot.BUFFER_AUDIO_TRACK_SEEK,options:[this.getTrackId()]});this._bufferSource.seekAudioBuffer(e),r.onSuccess()}resumeProcessAudioBuffer(){let e=ke.reportApiInvoke(null,{tag:bt.TRACER,name:Ot.BUFFER_AUDIO_TRACK_RESUME,options:[this.getTrackId()]});this._bufferSource.resumeProcessAudioBuffer(),e.onSuccess()}stopProcessAudioBuffer(){let e=ke.reportApiInvoke(null,{tag:bt.TRACER,name:Ot.BUFFER_AUDIO_TRACK_STOP,options:[this.getTrackId()]});this._bufferSource.stopProcessAudioBuffer(),e.onSuccess()}}os([or(),lr("design:type",Function),lr("design:paramtypes",[Object]),lr("design:returntype",void 0)],cc.prototype,"startProcessAudioBuffer",null),os([or(),lr("design:type",Function),lr("design:paramtypes",[]),lr("design:returntype",void 0)],cc.prototype,"pauseProcessAudioBuffer",null),os([or(),lr("design:type",Function),lr("design:paramtypes",[Number]),lr("design:returntype",void 0)],cc.prototype,"seekAudioBuffer",null),os([or(),lr("design:type",Function),lr("design:paramtypes",[]),lr("design:returntype",void 0)],cc.prototype,"resumeProcessAudioBuffer",null),os([or(),lr("design:type",Function),lr("design:paramtypes",[]),lr("design:returntype",void 0)],cc.prototype,"stopProcessAudioBuffer",null);class bn extends ji{constructor(){let e=ln().createMediaStreamDestination();super(e.stream.getAudioTracks()[0],void 0,be(8,"track-mix-"));try{this._mediaStreamTrack=this._source.createOutputTrack()}catch(r){}this.destNode=e,this.trackList=[]}get isActive(){var e;return!(!this.trackList.length||!rr(e=this.trackList).call(e,r=>!r.muted))}getSubTrackLabels(){var e;return _t(e=this.trackList).call(e,r=>r.getTrackLabel())}hasAudioTrack(e){var r;return Vt(r=this.trackList).call(r,e)!==-1}addAudioTrack(e){var r;Vt(r=this.trackList).call(r,e)===-1?(z.debug("add ".concat(e.getTrackId()," to mixing track")),e._source.outputNode.connect(this.destNode),this.trackList.push(e),this.updateEncoderConfig()):z.debug("track ".concat(e.getTrackId()," is already added"))}removeAudioTrack(e){var r;if(Vt(r=this.trackList).call(r,e)!==-1){z.debug("remove ".concat(e.getTrackId()," from mixing track"));try{e._source.outputNode.disconnect(this.destNode)}catch(i){}Fi(this.trackList,e),this.updateEncoderConfig()}}updateEncoderConfig(){var e;let r={};Re(e=this.trackList).call(e,i=>{i._encoderConfig&&((i._encoderConfig.bitrate||0)>(r.bitrate||0)&&(r.bitrate=i._encoderConfig.bitrate),(i._encoderConfig.sampleRate||0)>(r.sampleRate||0)&&(r.sampleRate=i._encoderConfig.sampleRate),(i._encoderConfig.sampleSize||0)>(r.sampleSize||0)&&(r.sampleSize=i._encoderConfig.sampleSize),i._encoderConfig.stereo&&(r.stereo=!0))}),this._encoderConfig=r}}class Rv extends mn{constructor(){super(...arguments);this.resultStorage=new Tr}setLocalAudioStats(e,r,i){this.record("AUDIO_INPUT_LEVEL_TOO_LOW",e,this.checkAudioInputLevel(i,r)),this.record("SEND_AUDIO_BITRATE_TOO_LOW",e,this.checkSendAudioBitrate(i,r))}setLocalVideoStats(e,r,i){this.record("SEND_VIDEO_BITRATE_TOO_LOW",e,this.checkSendVideoBitrate(i,r)),this.record("FRAMERATE_INPUT_TOO_LOW",e,this.checkFramerateInput(i,r)),this.record("FRAMERATE_SENT_TOO_LOW",e,this.checkFramerateSent(i))}setRemoteAudioStats(e,r){e=e.getUserId(),this.record("AUDIO_OUTPUT_LEVEL_TOO_LOW",e,this.checkAudioOutputLevel(r))}setRemoteVideoStats(e,r){e=e.getUserId(),this.record("RECV_VIDEO_DECODE_FAILED",e,this.checkVideoDecode(r))}record(e,r,i){this.resultStorage.has(e)||this.resultStorage.set(e,{result:[],isPrevNormal:!0});let o=this.resultStorage.get(e);if(o&&(o.result.push(i),5<=o.result.length)){var c;i=_r(c=o.result).call(c,!0),o.isPrevNormal&&!i&&this.emit("exception",cA[e],e,r),!o.isPrevNormal&&i&&this.emit("exception",cA[e]+2e3,e+"_RECOVER",r),o.isPrevNormal=i,o.result=[]}}checkAudioOutputLevel(e){return!(0<e.receiveBitrate&&e.receiveLevel===0)}checkAudioInputLevel(e,r){return r instanceof bn&&!r.isActive||!!r.muted||e.sendVolumeLevel!==0}checkFramerateInput(e,r){let i=null;return r._encoderConfig&&r._encoderConfig.frameRate&&(i=Zn(r._encoderConfig.frameRate)),e=e.captureFrameRate,!i||!e||!(10<i&&5>e||10>i&&5<=i&&1>=e)}checkFramerateSent(e){return!(e.captureFrameRate&&e.sendFrameRate&&5<e.captureFrameRate&&1>=e.sendFrameRate)}checkSendVideoBitrate(e,r){return!!r.muted||e.sendBitrate!==0}checkSendAudioBitrate(e,r){return r instanceof bn&&!r.isActive||!!r.muted||e.sendBitrate!==0}checkVideoDecode(e){return e.receiveBitrate===0||e.decodeFrameRate!==0}}let cA={FRAMERATE_INPUT_TOO_LOW:1001,FRAMERATE_SENT_TOO_LOW:1002,SEND_VIDEO_BITRATE_TOO_LOW:1003,RECV_VIDEO_DECODE_FAILED:1005,AUDIO_INPUT_LEVEL_TOO_LOW:2001,AUDIO_OUTPUT_LEVEL_TOO_LOW:2002,SEND_AUDIO_BITRATE_TOO_LOW:2003};class lc{constructor(e){this.localConnectionsMap=new Tr,this.remoteConnectionsMap=new Tr,this.trafficStatsPeerList=[],this.updateStats=()=>{var r,i;Re(r=this.remoteConnectionsMap).call(r,o=>{var c;let h=o.audioStats;var C=o.videoStats,x=o.pcStats;let Q=In({},dd),F=In({},hd),V=In({},xf),Y=o.connection.pc.getStats(),$=Y.audioRecv[0],te=Y.videoRecv[0];x=x?x.videoRecv[0]:void 0;let ce=o.connection.pc._statsFilter.videoIsReady===!0,Ae=this.trafficStats&&rr(c=this.trafficStats.peer_delay).call(c,Me=>Me.peer_uid===o.connection.getUserId());$&&($.codec!=="opus"&&$.codec!=="aac"||(Q.codecType=$.codec),$.outputLevel?Q.receiveLevel=Math.round(32767*$.outputLevel):o.connection.user.audioTrack&&(Q.receiveLevel=Math.round(32767*o.connection.user.audioTrack.getVolumeLevel())),Q.receiveBytes=$.bytes,Q.receivePackets=$.packets,Q.receivePacketsLost=$.packetsLost,Q.packetLossRate=Q.receivePacketsLost/(Q.receivePackets+Q.receivePacketsLost),Q.receiveBitrate=h?8*Math.max(0,Q.receiveBytes-h.receiveBytes):0,Q.totalDuration=h?h.totalDuration+1:1,Q.totalFreezeTime=h?h.totalFreezeTime:0,Q.freezeRate=Q.totalFreezeTime/Q.totalDuration,Q.receiveDelay=$.jitterBufferMs,c=o.connection.user.audioTrack,10<Q.totalDuration&&lc.isRemoteAudioFreeze(c)&&(Q.totalFreezeTime+=1)),te&&(te.codec!=="H264"&&te.codec!=="VP8"&&te.codec!=="VP9"&&te.codec!=="AV1X"||(F.codecType=te.codec),F.receiveBytes=te.bytes,F.receiveBitrate=C?8*Math.max(0,F.receiveBytes-C.receiveBytes):0,F.decodeFrameRate=te.decodeFrameRate,F.renderFrameRate=te.decodeFrameRate,te.outputFrame&&(F.renderFrameRate=te.outputFrame.frameRate),te.receivedFrame?(F.receiveFrameRate=te.receivedFrame.frameRate,F.receiveResolutionHeight=te.receivedFrame.height,F.receiveResolutionWidth=te.receivedFrame.width):o.connection.user.videoTrack&&(F.receiveResolutionHeight=o.connection.user.videoTrack._videoHeight||0,F.receiveResolutionWidth=o.connection.user.videoTrack._videoWidth||0),te.framesRateFirefox!==void 0&&(F.receiveFrameRate=Math.round(te.framesRateFirefox)),F.receivePackets=te.packets,F.receivePacketsLost=te.packetsLost,F.packetLossRate=F.receivePacketsLost/(F.receivePackets+F.receivePacketsLost),F.totalDuration=C?C.totalDuration+1:1,F.totalFreezeTime=C?C.totalFreezeTime:0,F.receiveDelay=te.jitterBufferMs||0,C=o.connection.user.videoTrack,o.connection.subscribeOptions.video&&ce&&lc.isRemoteVideoFreeze(C,te,x)&&(F.totalFreezeTime+=1),F.freezeRate=F.totalFreezeTime/F.totalDuration),Ae&&(Q.end2EndDelay=Ae.B_ad,F.end2EndDelay=Ae.B_vd,Q.transportDelay=Ae.B_ed,F.transportDelay=Ae.B_ed,Q.currentPacketLossRate=Ae.B_ealr4/100,F.currentPacketLossRate=Ae.B_evlr4/100,V.uplinkNetworkQuality=Ae.B_punq?Ae.B_punq:0,V.downlinkNetworkQuality=Ae.B_pdnq?Ae.B_punq:0),o.audioStats=Q,o.videoStats=F,o.pcStats=Y,o.networkStats=V,o.connection.user.audioTrack&&this.exceptionMonitor.setRemoteAudioStats(o.connection.user.audioTrack,Q),o.connection.user.videoTrack&&this.exceptionMonitor.setRemoteVideoStats(o.connection.user.videoTrack,F)}),Re(i=this.localConnectionsMap).call(i,o=>{let c=o.audioStats,h=o.videoStats,C=In({},Yl),x=In({},Jl);var Q=o.connection.pc.getStats();let F=Q.audioSend[0];Q=Q.videoSend[0];let V=o.connection.getUserId();F&&(F.codec!=="opus"&&F.codec!=="aac"||(C.codecType=F.codec),F.inputLevel?C.sendVolumeLevel=Math.round(32767*F.inputLevel):o.connection.audioTrack&&(C.sendVolumeLevel=Math.round(32767*o.connection.audioTrack.getVolumeLevel())),C.sendBytes=F.bytes,C.sendPackets=F.packets,C.sendPacketsLost=F.packetsLost,C.sendBitrate=c?8*Math.max(0,C.sendBytes-c.sendBytes):0),Q&&(Q.codec!=="H264"&&Q.codec!=="VP8"&&Q.codec!=="VP9"&&Q.codec!=="AV1X"||(x.codecType=Q.codec),x.sendBytes=Q.bytes,x.sendBitrate=h?8*Math.max(0,x.sendBytes-h.sendBytes):0,Q.inputFrame?(x.captureFrameRate=Q.inputFrame.frameRate,x.captureResolutionHeight=Q.inputFrame.height,x.captureResolutionWidth=Q.inputFrame.width):o.connection.videoTrack&&(x.captureResolutionWidth=o.connection.videoTrack._videoWidth||0,x.captureResolutionHeight=o.connection.videoTrack._videoHeight||0),Q.sentFrame?(x.sendFrameRate=Q.sentFrame.frameRate,x.sendResolutionHeight=Q.sentFrame.height,x.sendResolutionWidth=Q.sentFrame.width):o.connection.videoTrack&&(x.sendResolutionWidth=o.connection.videoTrack._videoWidth||0,x.sendResolutionHeight=o.connection.videoTrack._videoHeight||0),Q.avgEncodeMs&&(x.encodeDelay=Q.avgEncodeMs),o.connection.videoTrack&&o.connection.videoTrack._encoderConfig&&o.connection.videoTrack._encoderConfig.bitrateMax&&(x.targetSendBitrate=1e3*o.connection.videoTrack._encoderConfig.bitrateMax),x.sendPackets=Q.packets,x.sendPacketsLost=Q.packetsLost,x.totalDuration=h?h.totalDuration+1:1,x.totalFreezeTime=h?h.totalFreezeTime:0,this.isLocalVideoFreeze(Q)&&(x.totalFreezeTime+=1)),this.trafficStats&&(C.sendPacketsLost=this.trafficStats.B_palr4/100,x.sendPacketsLost=this.trafficStats.B_pvlr4/100),o.audioStats=C,o.videoStats=x,o.audioStats&&o.connection.audioTrack&&this.exceptionMonitor.setLocalAudioStats(V,o.connection.audioTrack,o.audioStats),o.videoStats&&o.connection.videoTrack&&this.exceptionMonitor.setLocalVideoStats(V,o.connection.videoTrack,o.videoStats)})},this.clientId=e,this.updateStatsInterval=window.setInterval(this.updateStats,1e3),this.exceptionMonitor=new Rv,this.exceptionMonitor.on("exception",(r,i,o)=>{this.onStatsException&&this.onStatsException(r,i,o)})}reset(){this.localConnectionsMap=new Tr,this.remoteConnectionsMap=new Tr,this.trafficStats=void 0,this.trafficStatsPeerList=[],this.uplinkStats=void 0}getLocalAudioTrackStats(e){return(e=this.localConnectionsMap.get(e))&&e.audioStats?e.audioStats:In({},Yl)}getLocalVideoTrackStats(e){return(e=this.localConnectionsMap.get(e))&&e.videoStats?e.videoStats:In({},Jl)}getRemoteAudioTrackStats(e){var r;let i=this.remoteConnectionsMap.get(e);return!i||!i.audioStats?In({},dd):this.trafficStats?(e=rr(r=this.trafficStats.peer_delay).call(r,o=>o.peer_uid===i.connection.user.uid),e&&(i.audioStats.publishDuration=e.B_ppad+(at()-this.trafficStats.timestamp)),i.audioStats):i.audioStats}getRemoteNetworkQualityStats(e){return(e=this.remoteConnectionsMap.get(e))&&e.networkStats?e.networkStats:In({},xf)}getRemoteVideoTrackStats(e){var r;let i=this.remoteConnectionsMap.get(e);return!i||!i.videoStats?In({},hd):this.trafficStats?(e=rr(r=this.trafficStats.peer_delay).call(r,o=>o.peer_uid===i.connection.user.uid),e&&(i.videoStats.publishDuration=e.B_ppvd+(at()-this.trafficStats.timestamp)),i.videoStats):i.videoStats}getRTCStats(){var e,r;let i=0,o=0,c=0,h=0;return Re(e=this.localConnectionsMap).call(e,C=>{C.audioStats&&(i+=C.audioStats.sendBytes,o+=C.audioStats.sendBitrate),C.videoStats&&(i+=C.videoStats.sendBytes,o+=C.videoStats.sendBitrate)}),Re(r=this.remoteConnectionsMap).call(r,C=>{C.audioStats&&(c+=C.audioStats.receiveBytes,h+=C.audioStats.receiveBitrate),C.videoStats&&(c+=C.videoStats.receiveBytes,h+=C.videoStats.receiveBitrate)}),e=1,this.trafficStats&&(e+=this.trafficStats.peer_delay.length),{Duration:0,UserCount:e,SendBitrate:o,SendBytes:i,RecvBytes:c,RecvBitrate:h,OutgoingAvailableBandwidth:this.uplinkStats?this.uplinkStats.B_uab/1e3:0,RTT:this.trafficStats?2*this.trafficStats.B_acd:0}}removeConnection(e){this.localConnectionsMap.delete(e),this.remoteConnectionsMap.delete(e)}addLocalConnection(e){let r=e.connectionId;this.localConnectionsMap.has(r)||this.localConnectionsMap.set(r,{connection:e})}addRemoteConnection(e){let r=e.connectionId;this.remoteConnectionsMap.has(r)||this.remoteConnectionsMap.set(r,{connection:e})}updateTrafficStats(e){var r;let i=Wt(r=e.peer_delay).call(r,o=>{var c;return Vt(c=this.trafficStatsPeerList).call(c,o.peer_uid)===-1});Re(i).call(i,o=>{var c,h;let C=rr(c=co(Na(h=this.remoteConnectionsMap).call(h))).call(c,x=>x.connection._userId===o.peer_uid);o.B_ppad!==void 0&&o.B_ppvd!==void 0&&(this.onUploadPublishDuration&&this.onUploadPublishDuration(o.peer_uid,o.B_ppad,o.B_ppvd,C?at()-C.connection.startTime:0),this.trafficStatsPeerList.push(o.peer_uid))}),this.trafficStats=e}updateUplinkStats(e){var r;this.uplinkStats&&this.uplinkStats.B_fir!==e.B_fir&&z.debug(ne(r="[".concat(this.clientId,"]: Period fir changes to ")).call(r,e.B_fir)),this.uplinkStats=e}static isRemoteVideoFreeze(e,r,i){return e?(e=!i||r.framesDecodeCount>i.framesDecodeCount,!!i&&r.framesDecodeFreezeTime>i.framesDecodeFreezeTime||!e):!1}static isRemoteAudioFreeze(e){return!!e&&e._isFreeze()}isLocalVideoFreeze(e){return!(!e.inputFrame||!e.sentFrame)&&5<e.inputFrame.frameRate&&3>e.sentFrame.frameRate}}var lA;let $l=()=>{},uA={},dA=new class{constructor(){this.fnMap=new Tr}throttleByKey(t,e,r,i,...o){if(this.fnMap.has(e)){var c=this.fnMap.get(e);c.threshold!==r?(c.fn(...c.args),clearTimeout(c.timer),c=window.setTimeout(()=>{const h=this.fnMap.get(e);h&&h.fn(...h.args),this.fnMap.delete(e)},r),this.fnMap.set(e,{fn:t,threshold:r,timer:c,args:o,skipFn:i})):(c.skipFn&&c.skipFn(...c.args),this.fnMap.set(e,la({},c,{fn:t,args:o,skipFn:i})))}else c=window.setTimeout(()=>{const h=this.fnMap.get(e);h&&h.fn(...h.args),this.fnMap.delete(e)},r),this.fnMap.set(e,{fn:t,threshold:r,timer:c,args:o,skipFn:i})}},hA=Ti(lA=dA.throttleByKey).call(lA,dA),uc=c=>Ee(this,[c],function*({fragementLength:t,referenceList:e,asyncMapHandler:r,allFailedhandler:i,promisesCollector:o}){let h=0,C,x=0;const Q=()=>Ee(this,null,function*(){const F=(()=>{var V=h*t;const Y=V+t;return V=en(e).call(e,V,Y),_t(V).call(V,r)})();o&&o.push(...F);try{C=yield qi(F)}catch(V){if(x+=t,h++,!(x>=e.length))return void(yield Q());i(V)}Re(F).call(F,V=>V.cancel())});return yield Q(),C}),wv={[sc.ACCESS_POINT]:{[pn.NO_FLAG_SET]:{desc:"flag is zero",retry:!1},[pn.FLAG_SET_BUT_EMPTY]:{desc:"flag is empty",retry:!1},[pn.INVALID_FALG_SET]:{desc:"invalid flag",retry:!1},[pn.NO_SERVICE_AVAILABLE]:{desc:"no service available",retry:!0},[pn.NO_SERVICE_AVAILABLE_P2P]:{desc:"no unilbs p2p service available",retry:!0},[pn.NO_SERVICE_AVAILABLE_VOET]:{desc:"no unilbs voice service available",retry:!0},[pn.NO_SERVICE_AVAILABLE_WEBRTC]:{desc:"no unilbs webrtc service available",retry:!0},[pn.NO_SERVICE_AVAILABLE_CDS]:{desc:"no cds service available",retry:!0},[pn.NO_SERVICE_AVAILABLE_CDN]:{desc:"no cdn dispatcher service available",retry:!0},[pn.NO_SERVICE_AVAILABLE_TDS]:{desc:"no tds service available",retry:!0},[pn.NO_SERVICE_AVAILABLE_REPORT]:{desc:"no unilbs report service available",retry:!0},[pn.NO_SERVICE_AVAILABLE_APP_CENTER]:{desc:"no app center service available",retry:!0},[pn.NO_SERVICE_AVAILABLE_ENV0]:{desc:"no unilbs sig env0 service available",retry:!0},[pn.NO_SERVICE_AVAILABLE_VOET]:{desc:"no unilbs voet service available",retry:!0},[pn.NO_SERVICE_AVAILABLE_STRING_UID]:{desc:"no string uid service available",retry:!0},[pn.NO_SERVICE_AVAILABLE_WEBRTC_UNILBS]:{desc:"no webrtc unilbs service available",retry:!0}},[sc.UNILBS]:{[is.INVALID_VENDOR_KEY]:{desc:"invalid vendor key, can not find appid",retry:!1},[is.INVALID_CHANNEL_NAME]:{desc:"invalid channel name",retry:!1},[is.INTERNAL_ERROR]:{desc:"unilbs internal error",retry:!1},[is.NO_AUTHORIZED]:{desc:"invalid token, authorized failed",retry:!1},[is.DYNAMIC_KEY_TIMEOUT]:{desc:"dynamic key or token timeout",retry:!1},[is.NO_ACTIVE_STATUS]:{desc:"no active status",retry:!1},[is.DYNAMIC_KEY_EXPIRED]:{desc:"dynamic key expired",retry:!1},[is.STATIC_USE_DYNAMIC_KEY]:{desc:"static use dynamic key",retry:!1},[is.DYNAMIC_USE_STATIC_KEY]:{desc:"dynamic use static key",retry:!1},[is.USER_OVERLOAD]:{desc:"amount of users over load",retry:!1},[is.FORBIDDEN_REGION]:{desc:"the request is forbidden in this area",retry:!1},[is.CANNOT_MEET_AREA_DEMAND]:{desc:"unable to allocate services in this area",retry:!1}},[sc.STRING_UID_ALLOCATOR]:{[Kc.IIIEGAL_APPID]:{desc:"invalid appid",retry:!1},[Kc.IIIEGAL_UID]:{desc:"invalid string uid",retry:!1},[Kc.INTERNAL_ERROR]:{desc:"string uid allocator internal error",retry:!0}}},Lv={[Nt.K_TIMESTAMP_EXPIRED]:{desc:"K_TIMESTAMP_EXPIRED",action:"failed"},[Nt.K_CHANNEL_PERMISSION_INVALID]:{desc:"K_CHANNEL_PERMISSION_INVALID",action:"failed"},[Nt.K_CERTIFICATE_INVALID]:{desc:"K_CERTIFICATE_INVALID",action:"failed"},[Nt.K_CHANNEL_NAME_EMPTY]:{desc:"K_CHANNEL_NAME_EMPTY",action:"failed"},[Nt.K_CHANNEL_NOT_FOUND]:{desc:"K_CHANNEL_NOT_FOUND",action:"failed"},[Nt.K_TICKET_INVALID]:{desc:"K_TICKET_INVALID",action:"failed"},[Nt.K_CHANNEL_CONFLICTED]:{desc:"K_CHANNEL_CONFLICTED",action:"failed"},[Nt.K_SERVICE_NOT_READY]:{desc:"K_SERVICE_NOT_READY",action:"tryNext"},[Nt.K_SERVICE_TOO_HEAVY]:{desc:"K_SERVICE_TOO_HEAVY",action:"tryNext"},[Nt.K_UID_BANNED]:{desc:"K_UID_BANNED",action:"failed"},[Nt.K_IP_BANNED]:{desc:"K_IP_BANNED",action:"failed"},[Nt.ERR_INVALID_VENDOR_KEY]:{desc:"ERR_INVALID_VENDOR_KEY",action:"failed"},[Nt.ERR_INVALID_CHANNEL_NAME]:{desc:"ERR_INVALID_CHANNEL_NAME",action:"failed"},[Nt.WARN_NO_AVAILABLE_CHANNEL]:{desc:"WARN_NO_AVAILABLE_CHANNEL",action:"failed"},[Nt.WARN_LOOKUP_CHANNEL_TIMEOUT]:{desc:"WARN_LOOKUP_CHANNEL_TIMEOUT",action:"tryNext"},[Nt.WARN_LOOKUP_CHANNEL_REJECTED]:{desc:"WARN_LOOKUP_CHANNEL_REJECTED",action:"failed"},[Nt.WARN_OPEN_CHANNEL_TIMEOUT]:{desc:"WARN_OPEN_CHANNEL_TIMEOUT",action:"tryNext"},[Nt.WARN_OPEN_CHANNEL_REJECTED]:{desc:"WARN_OPEN_CHANNEL_REJECTED",action:"failed"},[Nt.WARN_REQUEST_DEFERRED]:{desc:"WARN_REQUEST_DEFERRED",action:"failed"},[Nt.ERR_DYNAMIC_KEY_TIMEOUT]:{desc:"ERR_DYNAMIC_KEY_TIMEOUT",action:"failed"},[Nt.ERR_NO_AUTHORIZED]:{desc:"ERR_NO_AUTHORIZED",action:"failed"},[Nt.ERR_VOM_SERVICE_UNAVAILABLE]:{desc:"ERR_VOM_SERVICE_UNAVAILABLE",action:"tryNext"},[Nt.ERR_NO_CHANNEL_AVAILABLE_CODE]:{desc:"ERR_NO_CHANNEL_AVAILABLE_CODE",action:"failed"},[Nt.ERR_MASTER_VOCS_UNAVAILABLE]:{desc:"ERR_MASTER_VOCS_UNAVAILABLE",action:"tryNext"},[Nt.ERR_INTERNAL_ERROR]:{desc:"ERR_INTERNAL_ERROR",action:"tryNext"},[Nt.ERR_NO_ACTIVE_STATUS]:{desc:"ERR_NO_ACTIVE_STATUS",action:"failed"},[Nt.ERR_INVALID_UID]:{desc:"ERR_INVALID_UID",action:"failed"},[Nt.ERR_DYNAMIC_KEY_EXPIRED]:{desc:"ERR_DYNAMIC_KEY_EXPIRED",action:"failed"},[Nt.ERR_STATIC_USE_DYANMIC_KE]:{desc:"ERR_STATIC_USE_DYANMIC_KE",action:"failed"},[Nt.ERR_DYNAMIC_USE_STATIC_KE]:{desc:"ERR_DYNAMIC_USE_STATIC_KE",action:"failed"},[Nt.ERR_NO_VOCS_AVAILABLE]:{desc:"ERR_NO_VOCS_AVAILABLE",action:"tryNext"},[Nt.ERR_NO_VOS_AVAILABLE]:{desc:"ERR_NO_VOS_AVAILABLE",action:"tryNext"},[Nt.ERR_JOIN_CHANNEL_TIMEOUT]:{desc:"ERR_JOIN_CHANNEL_TIMEOUT",action:"tryNext"},[Nt.ERR_JOIN_BY_MULTI_IP]:{desc:"ERR_JOIN_BY_MULTI_IP",action:"recover"},[Nt.ERR_NOT_JOINED]:{desc:"ERR_NOT_JOINED",action:"failed"},[Nt.ERR_REPEAT_JOIN_REQUEST]:{desc:"ERR_REPEAT_JOIN_REQUEST",action:"quit"},[Nt.ERR_REPEAT_JOIN_CHANNEL]:{desc:"ERR_REPEAT_JOIN_CHANNEL",action:"quit"},[Nt.ERR_INVALID_VENDOR_KEY]:{desc:"ERR_INVALID_VENDOR_KEY",action:"failed"},[Nt.ERR_INVALID_CHANNEL_NAME]:{desc:"ERR_INVALID_CHANNEL_NAME",action:"failed"},[Nt.ERR_INVALID_STRINGUID]:{desc:"ERR_INVALID_STRINGUID",action:"failed"},[Nt.ERR_TOO_MANY_USERS]:{desc:"ERR_TOO_MANY_USERS",action:"tryNext"},[Nt.ERR_SET_CLIENT_ROLE_TIMEOUT]:{desc:"ERR_SET_CLIENT_ROLE_TIMEOUT",action:"failed"},[Nt.ERR_SET_CLIENT_ROLE_NO_PERMISSION]:{desc:"ERR_SET_CLIENT_ROLE_TIMEOUT",action:"failed"},[Nt.ERR_SET_CLIENT_ROLE_ALREADY_IN_USE]:{desc:"ERR_SET_CLIENT_ROLE_ALREADY_IN_USE",action:"success"},[Nt.ERR_PUBLISH_REQUEST_INVALID]:{desc:"ERR_PUBLISH_REQUEST_INVALID",action:"failed"},[Nt.ERR_SUBSCRIBE_REQUEST_INVALID]:{desc:"ERR_SUBSCRIBE_REQUEST_INVALID",action:"failed"},[Nt.ERR_NOT_SUPPORTED_MESSAGE]:{desc:"ERR_NOT_SUPPORTED_MESSAGE",action:"failed"},[Nt.ERR_ILLEAGAL_PLUGIN]:{desc:"ERR_ILLEAGAL_PLUGIN",action:"failed"},[Nt.ILLEGAL_CLIENT_ROLE_LEVEL]:{desc:"ILLEGAL_CLIENT_ROLE_LEVEL",action:"failed"},[Nt.ERR_REJOIN_TOKEN_INVALID]:{desc:"ERR_REJOIN_TOKEN_INVALID",action:"failed"},[Nt.ERR_REJOIN_USER_NOT_JOINED]:{desc:"ERR_REJOIN_NOT_JOINED",action:"failed"},[Nt.ERR_INVALID_OPTIONAL_INFO]:{desc:"ERR_INVALID_OPTIONAL_INFO",action:"quit"},[Nt.ERR_TEST_RECOVER]:{desc:"ERR_TEST_RECOVER",action:"recover"},[Nt.ERR_TEST_TRYNEXT]:{desc:"ERR_TEST_TRYNEXT",action:"recover"},[Nt.ERR_TEST_RETRY]:{desc:"ERR_TEST_RETRY",action:"recover"},[Nt.ILLEGAL_AES_PASSWORD]:{desc:"ERR_TEST_RETRY",action:"failed"}};var Dv=de(function(t,e){t.exports=function(){function r(pe){for(var J=pe.length,me=0,ye=0;ye<J;){var Ve=pe.charCodeAt(ye++);if((4294967168&Ve)!=0)if((4294965248&Ve)==0)me+=2;else{if(55296<=Ve&&56319>=Ve&&ye<J){var Oe=pe.charCodeAt(ye);(64512&Oe)==56320&&(++ye,Ve=((1023&Ve)<<10)+(1023&Oe)+65536)}me+=(4294901760&Ve)==0?3:4}else me++}return me}function i(pe,J,me){me=J+me;for(var ye=[],Ve="";J<me;){var Oe=pe[J++];if((128&Oe)==0)ye.push(Oe);else if((224&Oe)==192){var Ct=63&pe[J++];ye.push((31&Oe)<<6|Ct)}else if((240&Oe)==224){Ct=63&pe[J++];var tt=63&pe[J++];ye.push((31&Oe)<<12|Ct<<6|tt)}else(248&Oe)==240&&(Oe=(7&Oe)<<18|(63&pe[J++])<<12|(63&pe[J++])<<6|63&pe[J++],65535<Oe&&(Oe-=65536,ye.push(Oe>>>10&1023|55296),Oe=56320|1023&Oe)),ye.push(Oe);4096<=ye.length&&(Ve+=String.fromCharCode.apply(String,mt([],Rr(ye))),ye.length=0)}return 0<ye.length&&(Ve+=String.fromCharCode.apply(String,mt([],Rr(ye)))),Ve}function o(pe,J){return 4294967296*pe.getInt32(J)+pe.getUint32(J+4)}function c(pe){var J,me=pe.sec;if(pe=pe.nsec,0<=me&&0<=pe&&17179869183>=me){if(pe===0&&4294967295>=me){var ye=new Uint8Array(4);return new DataView(ye.buffer).setUint32(0,me),ye}var Ve=me/4294967296;return me&=4294967295,ye=new Uint8Array(8),(J=new DataView(ye.buffer)).setUint32(0,pe<<2|3&Ve),J.setUint32(4,me),ye}return ye=new Uint8Array(12),(J=new DataView(ye.buffer)).setUint32(0,pe),J.setUint32(4,Math.floor(me/4294967296)),J.setUint32(8,me),ye}function h(pe){var J=pe.getTime();pe=Math.floor(J/1e3),J=1e6*(J-1e3*pe);var me=Math.floor(J/1e9);return{sec:pe+me,nsec:J-1e9*me}}function C(pe){return pe instanceof Date?c(h(pe)):null}function x(pe){var J=new DataView(pe.buffer,pe.byteOffset,pe.byteLength);switch(pe.byteLength){case 4:return{sec:J.getUint32(0),nsec:0};case 8:return pe=J.getUint32(0),{sec:4294967296*(3&pe)+J.getUint32(4),nsec:pe>>>2};case 12:return{sec:o(J,4),nsec:J.getUint32(0)};default:throw Error("Unrecognized data size for timestamp: "+pe.length)}}function Q(pe){return pe=x(pe),new Date(1e3*pe.sec+pe.nsec/1e6)}function F(pe){return pe instanceof Uint8Array?pe:ArrayBuffer.isView(pe)?new Uint8Array(pe.buffer,pe.byteOffset,pe.byteLength):pe instanceof ArrayBuffer?new Uint8Array(pe):Uint8Array.from(pe)}function V(pe,J){return J===void 0&&(J=It),new Gt(J.extensionCodec,J.context,J.maxDepth,J.initialBufferSize,J.sortKeys,J.forceFloat32,J.ignoreUndefined,J.forceIntegerToFloat).encode(pe)}function Y(pe){return(0>pe?"-":"")+"0x"+Math.abs(pe).toString(16).padStart(2,"0")}function $(pe,J){return J===void 0&&(J=vc),new pc(J.extensionCodec,J.context,J.maxStrLength,J.maxBinLength,J.maxArrayLength,J.maxMapLength,J.maxExtLength).decode(pe)}function te(pe,J){return J===void 0&&(J=vc),new pc(J.extensionCodec,J.context,J.maxStrLength,J.maxBinLength,J.maxArrayLength,J.maxMapLength,J.maxExtLength).decodeMulti(pe)}function ce(pe){return pe[Symbol.asyncIterator]!=null?pe:function(J){return n0(this,arguments,function(){var me,ye,Ve,Oe;return i0(this,function(Ct){switch(Ct.label){case 0:me=J.getReader(),Ct.label=1;case 1:Ct.trys.push([1,,9,10]),Ct.label=2;case 2:return[4,mc(me.read())];case 3:return ye=Ct.sent(),Ve=ye.done,Oe=ye.value,Ve?[4,mc(void 0)]:[3,5];case 4:return[2,Ct.sent()];case 5:if(Oe==null)throw Error("Assertion Failure: value must not be null nor undefined");return[4,mc(Oe)];case 6:return[4,Ct.sent()];case 7:return Ct.sent(),[3,2];case 8:return[3,10];case 9:return me.releaseLock(),[7];case 10:return[2]}})})}(pe)}function Ae(pe,J){return J===void 0&&(J=vc),me=this,ye=void 0,Oe=function(){var Ct;return function(tt,zt){function Mr(Ts){return function(Ec){return function(Er){if(nt)throw new TypeError("Generator is already executing.");for(;pr;)try{if(nt=1,St&&(Et=2&Er[0]?St.return:Er[0]?St.throw||((Et=St.return)&&Et.call(St),0):St.next)&&!(Et=Et.call(St,Er[1])).done)return Et;switch(St=0,Et&&(Er=[2&Er[0],Et.value]),Er[0]){case 0:case 1:Et=Er;break;case 4:return pr.label++,{value:Er[1],done:!1};case 5:pr.label++,St=Er[1],Er=[0];continue;case 7:Er=pr.ops.pop(),pr.trys.pop();continue;default:if(!((Et=0<(Et=pr.trys).length&&Et[Et.length-1])||Er[0]!==6&&Er[0]!==2)){pr=0;continue}if(Er[0]===3&&(!Et||Er[1]>Et[0]&&Er[1]<Et[3]))pr.label=Er[1];else if(Er[0]===6&&pr.label<Et[1])pr.label=Et[1],Et=Er;else if(Et&&pr.label<Et[2])pr.label=Et[2],pr.ops.push(Er);else{Et[2]&&pr.ops.pop(),pr.trys.pop();continue}}Er=zt.call(tt,pr)}catch(fu){Er=[6,fu],St=0}finally{nt=Et=0}if(5&Er[0])throw Er[1];return{value:Er[0]?Er[1]:void 0,done:!0}}([Ts,Ec])}}var nt,St,Et,ti,pr={label:0,sent:function(){if(1&Et[0])throw Et[1];return Et[1]},trys:[],ops:[]};return ti={next:Mr(0),throw:Mr(1),return:Mr(2)},typeof Symbol=="function"&&(ti[Symbol.iterator]=function(){return this}),ti}(this,function(tt){return Ct=ce(pe),[2,new pc(J.extensionCodec,J.context,J.maxStrLength,J.maxBinLength,J.maxArrayLength,J.maxMapLength,J.maxExtLength).decodeAsync(Ct)]})},new(Ve=void 0,Ve=Promise)(function(Ct,tt){function zt(St){try{nt(Oe.next(St))}catch(Et){tt(Et)}}function Mr(St){try{nt(Oe.throw(St))}catch(Et){tt(Et)}}function nt(St){var Et;St.done?Ct(St.value):(Et=St.value,Et instanceof Ve?Et:new Ve(function(ti){ti(Et)})).then(zt,Mr)}nt((Oe=Oe.apply(me,ye||[])).next())});var me,ye,Ve,Oe}function Me(pe,J){return J===void 0&&(J=vc),pe=ce(pe),new pc(J.extensionCodec,J.context,J.maxStrLength,J.maxBinLength,J.maxArrayLength,J.maxMapLength,J.maxExtLength).decodeArrayStream(pe)}function et(pe,J){return J===void 0&&(J=vc),pe=ce(pe),new pc(J.extensionCodec,J.context,J.maxStrLength,J.maxBinLength,J.maxArrayLength,J.maxMapLength,J.maxExtLength).decodeStream(pe)}function pt(pe,J){return J===void 0&&(J=vc),et(pe,J)}var Qt={d:function(pe,J){for(var me in J)Qt.o(J,me)&&!Qt.o(pe,me)&&Object.defineProperty(pe,me,{enumerable:!0,get:J[me]})},o:function(pe,J){return Object.prototype.hasOwnProperty.call(pe,J)},r:function(pe){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(pe,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(pe,"__esModule",{value:!0})}},kt={};Qt.r(kt),Qt.d(kt,{DecodeError:function(){return wo},Decoder:function(){return pc},EXT_TIMESTAMP:function(){return Pe},Encoder:function(){return Gt},ExtData:function(){return Ce},ExtensionCodec:function(){return ct},decode:function(){return $},decodeArrayStream:function(){return Me},decodeAsync:function(){return Ae},decodeMulti:function(){return te},decodeMultiStream:function(){return et},decodeStream:function(){return pt},decodeTimestampExtension:function(){return Q},decodeTimestampToTimeSpec:function(){return x},encode:function(){return V},encodeDateToTimeSpec:function(){return h},encodeTimeSpecToTimestamp:function(){return c},encodeTimestampExtension:function(){return C}});var Rr=function(pe,J){var me=typeof Symbol=="function"&&pe[Symbol.iterator];if(!me)return pe;var ye;pe=me.call(pe);var Ve=[];try{for(;(J===void 0||0<J--)&&!(ye=pe.next()).done;)Ve.push(ye.value)}catch(Ct){var Oe={error:Ct}}finally{try{ye&&!ye.done&&(me=pe.return)&&me.call(pe)}finally{if(Oe)throw Oe.error}}return Ve},mt=function(pe,J){for(var me=0,ye=J.length,Ve=pe.length;me<ye;me++,Ve++)pe[Ve]=J[me];return pe},sr=typeof TextEncoder!="undefined"&&typeof TextDecoder!="undefined",yr=sr?new TextEncoder:void 0,ci=sr?typeof process!="undefined"?200:0:4294967295,Vi=(yr==null?0:yr.encodeInto)?function(pe,J,me){yr.encodeInto(pe,J.subarray(me))}:function(pe,J,me){J.set(yr.encode(pe),me)},Wr=sr?new TextDecoder:null,On=sr?typeof process!="undefined"?200:0:4294967295,Ce=function(pe,J){this.type=pe,this.data=J},Pe=-1,Je={type:Pe,encode:C,decode:Q},ct=function(){function pe(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Je)}return pe.prototype.register=function(J){var me=J.type,ye=J.encode;J=J.decode,0<=me?(this.encoders[me]=ye,this.decoders[me]=J):(me=1+me,this.builtInEncoders[me]=ye,this.builtInDecoders[me]=J)},pe.prototype.tryToEncode=function(J,me){for(var ye=0;ye<this.builtInEncoders.length;ye++)if((Ve=this.builtInEncoders[ye])!=null&&(Oe=Ve(J,me))!=null)return new Ce(-1-ye,Oe);for(ye=0;ye<this.encoders.length;ye++){var Ve,Oe;if((Ve=this.encoders[ye])!=null&&(Oe=Ve(J,me))!=null)return new Ce(ye,Oe)}return J instanceof Ce?J:null},pe.prototype.decode=function(J,me,ye){var Ve=0>me?this.builtInDecoders[-1-me]:this.decoders[me];return Ve?Ve(J,me,ye):new Ce(me,J)},pe.defaultCodec=new pe,pe}(),ut=function(pe){var J=typeof Symbol=="function"&&Symbol.iterator,me=J&&pe[J],ye=0;if(me)return me.call(pe);if(pe&&typeof pe.length=="number")return{next:function(){return pe&&ye>=pe.length&&(pe=void 0),{value:pe&&pe[ye++],done:!pe}}};throw new TypeError(J?"Object is not iterable.":"Symbol.iterator is not defined.")},Gt=function(){function pe(J,me,ye,Ve,Oe,Ct,tt,zt){J===void 0&&(J=ct.defaultCodec),me===void 0&&(me=void 0),ye===void 0&&(ye=100),Ve===void 0&&(Ve=2048),Oe===void 0&&(Oe=!1),Ct===void 0&&(Ct=!1),tt===void 0&&(tt=!1),zt===void 0&&(zt=!1),this.extensionCodec=J,this.context=me,this.maxDepth=ye,this.initialBufferSize=Ve,this.sortKeys=Oe,this.forceFloat32=Ct,this.ignoreUndefined=tt,this.forceIntegerToFloat=zt,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}return pe.prototype.getUint8Array=function(){return this.bytes.subarray(0,this.pos)},pe.prototype.reinitializeState=function(){this.pos=0},pe.prototype.encode=function(J){return this.reinitializeState(),this.doEncode(J,1),this.getUint8Array()},pe.prototype.doEncode=function(J,me){if(me>this.maxDepth)throw Error("Too deep objects in depth "+me);J==null?this.encodeNil():typeof J=="boolean"?this.encodeBoolean(J):typeof J=="number"?this.encodeNumber(J):typeof J=="string"?this.encodeString(J):this.encodeObject(J,me)},pe.prototype.ensureBufferSizeToWrite=function(J){J=this.pos+J,this.view.byteLength<J&&this.resizeBuffer(2*J)},pe.prototype.resizeBuffer=function(J){var me=new ArrayBuffer(J);J=new Uint8Array(me),me=new DataView(me),J.set(this.bytes),this.view=me,this.bytes=J},pe.prototype.encodeNil=function(){this.writeU8(192)},pe.prototype.encodeBoolean=function(J){J===!1?this.writeU8(194):this.writeU8(195)},pe.prototype.encodeNumber=function(J){Number.isSafeInteger(J)&&!this.forceIntegerToFloat?0<=J?128>J?this.writeU8(J):256>J?(this.writeU8(204),this.writeU8(J)):65536>J?(this.writeU8(205),this.writeU16(J)):4294967296>J?(this.writeU8(206),this.writeU32(J)):(this.writeU8(207),this.writeU64(J)):-32<=J?this.writeU8(224|J+32):-128<=J?(this.writeU8(208),this.writeI8(J)):-32768<=J?(this.writeU8(209),this.writeI16(J)):-2147483648<=J?(this.writeU8(210),this.writeI32(J)):(this.writeU8(211),this.writeI64(J)):this.forceFloat32?(this.writeU8(202),this.writeF32(J)):(this.writeU8(203),this.writeF64(J))},pe.prototype.writeStringHeader=function(J){if(32>J)this.writeU8(160+J);else if(256>J)this.writeU8(217),this.writeU8(J);else if(65536>J)this.writeU8(218),this.writeU16(J);else{if(!(4294967296>J))throw Error("Too long string: "+J+" bytes in UTF-8");this.writeU8(219),this.writeU32(J)}},pe.prototype.encodeString=function(J){if(J.length>ci){var me=r(J);this.ensureBufferSizeToWrite(5+me),this.writeStringHeader(me),Vi(J,this.bytes,this.pos)}else{me=r(J),this.ensureBufferSizeToWrite(5+me),this.writeStringHeader(me);for(var ye=this.bytes,Ve=J.length,Oe=this.pos,Ct=0;Ct<Ve;){var tt=J.charCodeAt(Ct++);if((4294967168&tt)!=0){if((4294965248&tt)==0)ye[Oe++]=tt>>6&31|192;else{if(55296<=tt&&56319>=tt&&Ct<Ve){var zt=J.charCodeAt(Ct);(64512&zt)==56320&&(++Ct,tt=((1023&tt)<<10)+(1023&zt)+65536)}(4294901760&tt)==0?(ye[Oe++]=tt>>12&15|224,ye[Oe++]=tt>>6&63|128):(ye[Oe++]=tt>>18&7|240,ye[Oe++]=tt>>12&63|128,ye[Oe++]=tt>>6&63|128)}ye[Oe++]=63&tt|128}else ye[Oe++]=tt}}this.pos+=me},pe.prototype.encodeObject=function(J,me){var ye=this.extensionCodec.tryToEncode(J,this.context);if(ye!=null)this.encodeExtension(ye);else if(Array.isArray(J))this.encodeArray(J,me);else if(ArrayBuffer.isView(J))this.encodeBinary(J);else{if(typeof J!="object")throw Error("Unrecognized object: "+Object.prototype.toString.apply(J));this.encodeMap(J,me)}},pe.prototype.encodeBinary=function(J){var me=J.byteLength;if(256>me)this.writeU8(196),this.writeU8(me);else if(65536>me)this.writeU8(197),this.writeU16(me);else{if(!(4294967296>me))throw Error("Too large binary: "+me);this.writeU8(198),this.writeU32(me)}J=F(J),this.writeU8a(J)},pe.prototype.encodeArray=function(J,me){var ye,Ve=J.length;if(16>Ve)this.writeU8(144+Ve);else if(65536>Ve)this.writeU8(220),this.writeU16(Ve);else{if(!(4294967296>Ve))throw Error("Too large array: "+Ve);this.writeU8(221),this.writeU32(Ve)}try{for(var Oe=ut(J),Ct=Oe.next();!Ct.done;Ct=Oe.next())this.doEncode(Ct.value,me+1)}catch(zt){var tt={error:zt}}finally{try{Ct&&!Ct.done&&(ye=Oe.return)&&ye.call(Oe)}finally{if(tt)throw tt.error}}},pe.prototype.countWithoutUndefined=function(J,me){var ye,Ve=0;try{for(var Oe=ut(me),Ct=Oe.next();!Ct.done;Ct=Oe.next())J[Ct.value]!==void 0&&Ve++}catch(zt){var tt={error:zt}}finally{try{Ct&&!Ct.done&&(ye=Oe.return)&&ye.call(Oe)}finally{if(tt)throw tt.error}}return Ve},pe.prototype.encodeMap=function(J,me){var ye,Ve=Object.keys(J);this.sortKeys&&Ve.sort();var Oe=this.ignoreUndefined?this.countWithoutUndefined(J,Ve):Ve.length;if(16>Oe)this.writeU8(128+Oe);else if(65536>Oe)this.writeU8(222),this.writeU16(Oe);else{if(!(4294967296>Oe))throw Error("Too large map object: "+Oe);this.writeU8(223),this.writeU32(Oe)}try{for(var Ct=ut(Ve),tt=Ct.next();!tt.done;tt=Ct.next()){var zt=tt.value,Mr=J[zt];this.ignoreUndefined&&Mr===void 0||(this.encodeString(zt),this.doEncode(Mr,me+1))}}catch(St){var nt={error:St}}finally{try{tt&&!tt.done&&(ye=Ct.return)&&ye.call(Ct)}finally{if(nt)throw nt.error}}},pe.prototype.encodeExtension=function(J){var me=J.data.length;if(me===1)this.writeU8(212);else if(me===2)this.writeU8(213);else if(me===4)this.writeU8(214);else if(me===8)this.writeU8(215);else if(me===16)this.writeU8(216);else if(256>me)this.writeU8(199),this.writeU8(me);else if(65536>me)this.writeU8(200),this.writeU16(me);else{if(!(4294967296>me))throw Error("Too large extension object: "+me);this.writeU8(201),this.writeU32(me)}this.writeI8(J.type),this.writeU8a(J.data)},pe.prototype.writeU8=function(J){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,J),this.pos++},pe.prototype.writeU8a=function(J){var me=J.length;this.ensureBufferSizeToWrite(me),this.bytes.set(J,this.pos),this.pos+=me},pe.prototype.writeI8=function(J){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,J),this.pos++},pe.prototype.writeU16=function(J){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,J),this.pos+=2},pe.prototype.writeI16=function(J){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,J),this.pos+=2},pe.prototype.writeU32=function(J){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,J),this.pos+=4},pe.prototype.writeI32=function(J){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,J),this.pos+=4},pe.prototype.writeF32=function(J){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,J),this.pos+=4},pe.prototype.writeF64=function(J){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,J),this.pos+=8},pe.prototype.writeU64=function(J){this.ensureBufferSizeToWrite(8);var me=this.view,ye=this.pos;me.setUint32(ye,J/4294967296),me.setUint32(ye+4,J),this.pos+=8},pe.prototype.writeI64=function(J){this.ensureBufferSizeToWrite(8);var me=this.view,ye=this.pos;me.setUint32(ye,Math.floor(J/4294967296)),me.setUint32(ye+4,J),this.pos+=8},pe}(),It={},Mi;sr=function(){function pe(J,me){for(J===void 0&&(J=16),me===void 0&&(me=16),this.maxKeyLength=J,this.maxLengthPerKey=me,this.miss=this.hit=0,this.caches=[],J=0;J<this.maxKeyLength;J++)this.caches.push([])}return pe.prototype.canBeCached=function(J){return 0<J&&J<=this.maxKeyLength},pe.prototype.find=function(J,me,ye){var Ve,Oe=this.caches[ye-1];try{var Ct=function(St){var Et=typeof Symbol=="function"&&Symbol.iterator,ti=Et&&St[Et],pr=0;if(ti)return ti.call(St);if(St&&typeof St.length=="number")return{next:function(){return St&&pr>=St.length&&(St=void 0),{value:St&&St[pr++],done:!St}}};throw new TypeError(Et?"Object is not iterable.":"Symbol.iterator is not defined.")}(Oe),tt=Ct.next();e:for(;!tt.done;tt=Ct.next()){var zt=tt.value,Mr=zt.bytes;for(Oe=0;Oe<ye;Oe++)if(Mr[Oe]!==J[me+Oe])continue e;return zt.str}}catch(St){var nt={error:St}}finally{try{tt&&!tt.done&&(Ve=Ct.return)&&Ve.call(Ct)}finally{if(nt)throw nt.error}}return null},pe.prototype.store=function(J,me){var ye=this.caches[J.length-1];J={bytes:J,str:me},ye.length>=this.maxLengthPerKey?ye[Math.random()*ye.length|0]=J:ye.push(J)},pe.prototype.decode=function(J,me,ye){var Ve=this.find(J,me,ye);return Ve!=null?(this.hit++,Ve):(this.miss++,Ve=i(J,me,ye),J=Uint8Array.prototype.slice.call(J,me,me+ye),this.store(J,Ve),Ve)},pe}();var ka=(Mi=function(pe,J){return(Mi=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(me,ye){me.__proto__=ye}||function(me,ye){for(var Ve in ye)Object.prototype.hasOwnProperty.call(ye,Ve)&&(me[Ve]=ye[Ve])})(pe,J)},function(pe,J){function me(){this.constructor=pe}if(typeof J!="function"&&J!==null)throw new TypeError("Class extends value "+String(J)+" is not a constructor or null");Mi(pe,J),pe.prototype=J===null?Object.create(J):(me.prototype=J.prototype,new me)}),Ua=function(pe,J){function me(zt){return function(Mr){return function(nt){if(ye)throw new TypeError("Generator is already executing.");for(;tt;)try{if(ye=1,Ve&&(Oe=2&nt[0]?Ve.return:nt[0]?Ve.throw||((Oe=Ve.return)&&Oe.call(Ve),0):Ve.next)&&!(Oe=Oe.call(Ve,nt[1])).done)return Oe;switch(Ve=0,Oe&&(nt=[2&nt[0],Oe.value]),nt[0]){case 0:case 1:Oe=nt;break;case 4:return tt.label++,{value:nt[1],done:!1};case 5:tt.label++,Ve=nt[1],nt=[0];continue;case 7:nt=tt.ops.pop(),tt.trys.pop();continue;default:if(!((Oe=0<(Oe=tt.trys).length&&Oe[Oe.length-1])||nt[0]!==6&&nt[0]!==2)){tt=0;continue}if(nt[0]===3&&(!Oe||nt[1]>Oe[0]&&nt[1]<Oe[3]))tt.label=nt[1];else if(nt[0]===6&&tt.label<Oe[1])tt.label=Oe[1],Oe=nt;else if(Oe&&tt.label<Oe[2])tt.label=Oe[2],tt.ops.push(nt);else{Oe[2]&&tt.ops.pop(),tt.trys.pop();continue}}nt=J.call(pe,tt)}catch(St){nt=[6,St],Ve=0}finally{ye=Oe=0}if(5&nt[0])throw nt[1];return{value:nt[0]?nt[1]:void 0,done:!0}}([zt,Mr])}}var ye,Ve,Oe,Ct,tt={label:0,sent:function(){if(1&Oe[0])throw Oe[1];return Oe[1]},trys:[],ops:[]};return Ct={next:me(0),throw:me(1),return:me(2)},typeof Symbol=="function"&&(Ct[Symbol.iterator]=function(){return this}),Ct},gc=function(pe){function J(Ve){me[Ve]=pe[Ve]&&function(Oe){return new Promise(function(Ct,tt){(function(zt,Mr,nt,St){Promise.resolve(St).then(function(Et){zt({value:Et,done:nt})},Mr)})(Ct,tt,(Oe=pe[Ve](Oe)).done,Oe.value)})}}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var me,ye=pe[Symbol.asyncIterator];return ye?ye.call(pe):(pe=typeof __values=="function"?__values(pe):pe[Symbol.iterator](),me={},J("next"),J("throw"),J("return"),me[Symbol.asyncIterator]=function(){return this},me)},ur=function(pe){return this instanceof ur?(this.v=pe,this):new ur(pe)},li=function(pe,J,me){function ye(St){Mr[St]&&(zt[St]=function(Et){return new Promise(function(ti,pr){1<nt.push([St,Et,ti,pr])||Ve(St,Et)})})}function Ve(St,Et){try{(ti=Mr[St](Et)).value instanceof ur?Promise.resolve(ti.value.v).then(Oe,Ct):tt(nt[0][2],ti)}catch(pr){tt(nt[0][3],pr)}var ti}function Oe(St){Ve("next",St)}function Ct(St){Ve("throw",St)}function tt(St,Et){St(Et),nt.shift(),nt.length&&Ve(nt[0][0],nt[0][1])}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var zt,Mr=me.apply(pe,J||[]),nt=[];return zt={},ye("next"),ye("throw"),ye("return"),zt[Symbol.asyncIterator]=function(){return this},zt},Yi=new DataView(new ArrayBuffer(0)),ki=new Uint8Array(Yi.buffer);e:{try{Yi.getInt8(0)}catch(pe){var wi=pe.constructor;break e}throw Error("never reached")}var uo=new wi("Insufficient data"),sn=new sr,wo=function(pe){function J(me){me=pe.call(this,me)||this;var ye=Object.create(J.prototype);return Object.setPrototypeOf(me,ye),Object.defineProperty(me,"name",{configurable:!0,enumerable:!1,value:J.name}),me}return ka(J,pe),J}(Error),pc=function(){function pe(J,me,ye,Ve,Oe,Ct,tt,zt){J===void 0&&(J=ct.defaultCodec),me===void 0&&(me=void 0),ye===void 0&&(ye=4294967295),Ve===void 0&&(Ve=4294967295),Oe===void 0&&(Oe=4294967295),Ct===void 0&&(Ct=4294967295),tt===void 0&&(tt=4294967295),zt===void 0&&(zt=sn),this.extensionCodec=J,this.context=me,this.maxStrLength=ye,this.maxBinLength=Ve,this.maxArrayLength=Oe,this.maxMapLength=Ct,this.maxExtLength=tt,this.keyDecoder=zt,this.pos=this.totalPos=0,this.view=Yi,this.bytes=ki,this.headByte=-1,this.stack=[]}return pe.prototype.reinitializeState=function(){this.totalPos=0,this.headByte=-1,this.stack.length=0},pe.prototype.setBuffer=function(J){this.bytes=F(J),J=this.bytes,J instanceof ArrayBuffer?J=new DataView(J):(J=F(J),J=new DataView(J.buffer,J.byteOffset,J.byteLength)),this.view=J,this.pos=0},pe.prototype.appendBuffer=function(J){if(this.headByte!==-1||this.hasRemaining()){var me=this.bytes.subarray(this.pos);J=F(J);var ye=new Uint8Array(me.length+J.length);ye.set(me),ye.set(J,me.length),this.setBuffer(ye)}else this.setBuffer(J)},pe.prototype.hasRemaining=function(J){return J===void 0&&(J=1),this.view.byteLength-this.pos>=J},pe.prototype.createExtraByteError=function(J){var me=this.view;return new RangeError("Extra "+(me.byteLength-this.pos)+" of "+me.byteLength+" byte(s) found at buffer["+J+"]")},pe.prototype.decode=function(J){if(this.reinitializeState(),this.setBuffer(J),J=this.doDecodeSync(),this.hasRemaining())throw this.createExtraByteError(this.pos);return J},pe.prototype.decodeMulti=function(J){return Ua(this,function(me){switch(me.label){case 0:this.reinitializeState(),this.setBuffer(J),me.label=1;case 1:return this.hasRemaining()?[4,this.doDecodeSync()]:[3,3];case 2:return me.sent(),[3,1];case 3:return[2]}})},pe.prototype.decodeAsync=function(J){var me,ye,Ve,Oe,Ct,tt,zt;return Ct=this,zt=function(){var Mr,nt,St,Et,ti,pr,Ts,Ec;return Ua(this,function(Er){switch(Er.label){case 0:Mr=!1,Er.label=1;case 1:Er.trys.push([1,6,7,12]),me=gc(J),Er.label=2;case 2:return[4,me.next()];case 3:if((ye=Er.sent()).done)return[3,5];if(St=ye.value,Mr)throw this.createExtraByteError(this.totalPos);this.appendBuffer(St);try{nt=this.doDecodeSync(),Mr=!0}catch(fu){if(!(fu instanceof wi))throw fu}this.totalPos+=this.pos,Er.label=4;case 4:return[3,2];case 5:return[3,12];case 6:return Et=Er.sent(),Ve={error:Et},[3,12];case 7:return Er.trys.push([7,,10,11]),ye&&!ye.done&&(Oe=me.return)?[4,Oe.call(me)]:[3,9];case 8:Er.sent(),Er.label=9;case 9:return[3,11];case 10:if(Ve)throw Ve.error;return[7];case 11:return[7];case 12:if(Mr){if(this.hasRemaining())throw this.createExtraByteError(this.totalPos);return[2,nt]}throw pr=(ti=this).headByte,Ts=ti.pos,Ec=ti.totalPos,new RangeError("Insufficient data in parsing "+Y(pr)+" at "+Ec+" ("+Ts+" in the current buffer)")}})},new(tt=void 0,tt=Promise)(function(Mr,nt){function St(pr){try{ti(zt.next(pr))}catch(Ts){nt(Ts)}}function Et(pr){try{ti(zt.throw(pr))}catch(Ts){nt(Ts)}}function ti(pr){var Ts;pr.done?Mr(pr.value):(Ts=pr.value,Ts instanceof tt?Ts:new tt(function(Ec){Ec(Ts)})).then(St,Et)}ti((zt=zt.apply(Ct,[])).next())})},pe.prototype.decodeArrayStream=function(J){return this.decodeMultiAsync(J,!0)},pe.prototype.decodeStream=function(J){return this.decodeMultiAsync(J,!1)},pe.prototype.decodeMultiAsync=function(J,me){return li(this,arguments,function(){var ye,Ve,Oe,Ct,tt,zt,Mr,nt,St;return Ua(this,function(Et){switch(Et.label){case 0:ye=me,Ve=-1,Et.label=1;case 1:Et.trys.push([1,13,14,19]),Oe=gc(J),Et.label=2;case 2:return[4,ur(Oe.next())];case 3:if((Ct=Et.sent()).done)return[3,12];if(tt=Ct.value,me&&Ve===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(tt),ye&&(Ve=this.readArraySize(),ye=!1,this.complete()),Et.label=4;case 4:Et.trys.push([4,9,,10]),Et.label=5;case 5:return[4,ur(this.doDecodeSync())];case 6:return[4,Et.sent()];case 7:return Et.sent(),--Ve==0?[3,8]:[3,5];case 8:return[3,10];case 9:if(!((zt=Et.sent())instanceof wi))throw zt;return[3,10];case 10:this.totalPos+=this.pos,Et.label=11;case 11:return[3,2];case 12:return[3,19];case 13:return Mr=Et.sent(),nt={error:Mr},[3,19];case 14:return Et.trys.push([14,,17,18]),Ct&&!Ct.done&&(St=Oe.return)?[4,ur(St.call(Oe))]:[3,16];case 15:Et.sent(),Et.label=16;case 16:return[3,18];case 17:if(nt)throw nt.error;return[7];case 18:return[7];case 19:return[2]}})})},pe.prototype.doDecodeSync=function(){e:for(;;){var J=this.readHeadByte();if(224<=J)J-=256;else if(192>J){if(!(128>J))if(144>J){if((J-=128)!=0){this.pushMapState(J),this.complete();continue e}J={}}else if(160>J){if((J-=144)!=0){this.pushArrayState(J),this.complete();continue e}J=[]}else J-=160,J=this.decodeUtf8String(J,0)}else if(J===192)J=null;else if(J===194)J=!1;else if(J===195)J=!0;else if(J===202)J=this.readF32();else if(J===203)J=this.readF64();else if(J===204)J=this.readU8();else if(J===205)J=this.readU16();else if(J===206)J=this.readU32();else if(J===207)J=this.readU64();else if(J===208)J=this.readI8();else if(J===209)J=this.readI16();else if(J===210)J=this.readI32();else if(J===211)J=this.readI64();else if(J===217)J=this.lookU8(),J=this.decodeUtf8String(J,1);else if(J===218)J=this.lookU16(),J=this.decodeUtf8String(J,2);else if(J===219)J=this.lookU32(),J=this.decodeUtf8String(J,4);else if(J===220){if((J=this.readU16())!==0){this.pushArrayState(J),this.complete();continue e}J=[]}else if(J===221){if((J=this.readU32())!==0){this.pushArrayState(J),this.complete();continue e}J=[]}else if(J===222){if((J=this.readU16())!==0){this.pushMapState(J),this.complete();continue e}J={}}else if(J===223){if((J=this.readU32())!==0){this.pushMapState(J),this.complete();continue e}J={}}else if(J===196)J=this.lookU8(),J=this.decodeBinary(J,1);else if(J===197)J=this.lookU16(),J=this.decodeBinary(J,2);else if(J===198)J=this.lookU32(),J=this.decodeBinary(J,4);else if(J===212)J=this.decodeExtension(1,0);else if(J===213)J=this.decodeExtension(2,0);else if(J===214)J=this.decodeExtension(4,0);else if(J===215)J=this.decodeExtension(8,0);else if(J===216)J=this.decodeExtension(16,0);else if(J===199)J=this.lookU8(),J=this.decodeExtension(J,1);else if(J===200)J=this.lookU16(),J=this.decodeExtension(J,2);else{if(J!==201)throw new wo("Unrecognized type byte: "+Y(J));J=this.lookU32(),J=this.decodeExtension(J,4)}this.complete();for(var me=this.stack;0<me.length;){var ye=me[me.length-1];if(ye.type===0){if(ye.array[ye.position]=J,ye.position++,ye.position!==ye.size)continue e;me.pop(),J=ye.array}else{if(ye.type===1){if((Ve=typeof J)!="string"&&Ve!=="number")throw new wo("The type of key must be string or number but "+typeof J);if(J==="__proto__")throw new wo("The key __proto__ is not allowed");ye.key=J,ye.type=2;continue e}if(ye.map[ye.key]=J,ye.readCount++,ye.readCount!==ye.size){ye.key=null,ye.type=1;continue e}me.pop(),J=ye.map}}return J}var Ve},pe.prototype.readHeadByte=function(){return this.headByte===-1&&(this.headByte=this.readU8()),this.headByte},pe.prototype.complete=function(){this.headByte=-1},pe.prototype.readArraySize=function(){var J=this.readHeadByte();switch(J){case 220:return this.readU16();case 221:return this.readU32();default:if(160>J)return J-144;throw new wo("Unrecognized array type byte: "+Y(J))}},pe.prototype.pushMapState=function(J){if(J>this.maxMapLength)throw new wo("Max length exceeded: map length ("+J+") > maxMapLengthLength ("+this.maxMapLength+")");this.stack.push({type:1,size:J,key:null,readCount:0,map:{}})},pe.prototype.pushArrayState=function(J){if(J>this.maxArrayLength)throw new wo("Max length exceeded: array length ("+J+") > maxArrayLength ("+this.maxArrayLength+")");this.stack.push({type:0,size:J,array:Array(J),position:0})},pe.prototype.decodeUtf8String=function(J,me){var ye;if(J>this.maxStrLength)throw new wo("Max length exceeded: UTF-8 byte length ("+J+") > maxStrLength ("+this.maxStrLength+")");if(this.bytes.byteLength<this.pos+me+J)throw uo;var Ve,Oe=this.pos+me;return this.stateIsMapKey()&&((ye=this.keyDecoder)===null||ye===void 0?0:ye.canBeCached(J))?ye=this.keyDecoder.decode(this.bytes,Oe,J):J>On?(ye=this.bytes.subarray(Oe,Oe+J),ye=Wr.decode(ye)):ye=i(this.bytes,Oe,J),Ve=ye,this.pos+=me+J,Ve},pe.prototype.stateIsMapKey=function(){return 0<this.stack.length&&this.stack[this.stack.length-1].type===1},pe.prototype.decodeBinary=function(J,me){if(J>this.maxBinLength)throw new wo("Max length exceeded: bin length ("+J+") > maxBinLength ("+this.maxBinLength+")");if(!this.hasRemaining(J+me))throw uo;var ye=this.pos+me;return ye=this.bytes.subarray(ye,ye+J),this.pos+=me+J,ye},pe.prototype.decodeExtension=function(J,me){if(J>this.maxExtLength)throw new wo("Max length exceeded: ext length ("+J+") > maxExtLength ("+this.maxExtLength+")");var ye=this.view.getInt8(this.pos+me);return J=this.decodeBinary(J,me+1),this.extensionCodec.decode(J,ye,this.context)},pe.prototype.lookU8=function(){return this.view.getUint8(this.pos)},pe.prototype.lookU16=function(){return this.view.getUint16(this.pos)},pe.prototype.lookU32=function(){return this.view.getUint32(this.pos)},pe.prototype.readU8=function(){var J=this.view.getUint8(this.pos);return this.pos++,J},pe.prototype.readI8=function(){var J=this.view.getInt8(this.pos);return this.pos++,J},pe.prototype.readU16=function(){var J=this.view.getUint16(this.pos);return this.pos+=2,J},pe.prototype.readI16=function(){var J=this.view.getInt16(this.pos);return this.pos+=2,J},pe.prototype.readU32=function(){var J=this.view.getUint32(this.pos);return this.pos+=4,J},pe.prototype.readI32=function(){var J=this.view.getInt32(this.pos);return this.pos+=4,J},pe.prototype.readU64=function(){var J,me,ye=(J=this.view,me=this.pos,4294967296*J.getUint32(me)+J.getUint32(me+4));return this.pos+=8,ye},pe.prototype.readI64=function(){var J=o(this.view,this.pos);return this.pos+=8,J},pe.prototype.readF32=function(){var J=this.view.getFloat32(this.pos);return this.pos+=4,J},pe.prototype.readF64=function(){var J=this.view.getFloat64(this.pos);return this.pos+=8,J},pe}(),vc={},i0=function(pe,J){function me(zt){return function(Mr){return function(nt){if(ye)throw new TypeError("Generator is already executing.");for(;tt;)try{if(ye=1,Ve&&(Oe=2&nt[0]?Ve.return:nt[0]?Ve.throw||((Oe=Ve.return)&&Oe.call(Ve),0):Ve.next)&&!(Oe=Oe.call(Ve,nt[1])).done)return Oe;switch(Ve=0,Oe&&(nt=[2&nt[0],Oe.value]),nt[0]){case 0:case 1:Oe=nt;break;case 4:return tt.label++,{value:nt[1],done:!1};case 5:tt.label++,Ve=nt[1],nt=[0];continue;case 7:nt=tt.ops.pop(),tt.trys.pop();continue;default:if(!((Oe=0<(Oe=tt.trys).length&&Oe[Oe.length-1])||nt[0]!==6&&nt[0]!==2)){tt=0;continue}if(nt[0]===3&&(!Oe||nt[1]>Oe[0]&&nt[1]<Oe[3]))tt.label=nt[1];else if(nt[0]===6&&tt.label<Oe[1])tt.label=Oe[1],Oe=nt;else if(Oe&&tt.label<Oe[2])tt.label=Oe[2],tt.ops.push(nt);else{Oe[2]&&tt.ops.pop(),tt.trys.pop();continue}}nt=J.call(pe,tt)}catch(St){nt=[6,St],Ve=0}finally{ye=Oe=0}if(5&nt[0])throw nt[1];return{value:nt[0]?nt[1]:void 0,done:!0}}([zt,Mr])}}var ye,Ve,Oe,Ct,tt={label:0,sent:function(){if(1&Oe[0])throw Oe[1];return Oe[1]},trys:[],ops:[]};return Ct={next:me(0),throw:me(1),return:me(2)},typeof Symbol=="function"&&(Ct[Symbol.iterator]=function(){return this}),Ct},mc=function(pe){return this instanceof mc?(this.v=pe,this):new mc(pe)},n0=function(pe,J,me){function ye(St){Mr[St]&&(zt[St]=function(Et){return new Promise(function(ti,pr){1<nt.push([St,Et,ti,pr])||Ve(St,Et)})})}function Ve(St,Et){try{(ti=Mr[St](Et)).value instanceof mc?Promise.resolve(ti.value.v).then(Oe,Ct):tt(nt[0][2],ti)}catch(pr){tt(nt[0][3],pr)}var ti}function Oe(St){Ve("next",St)}function Ct(St){Ve("throw",St)}function tt(St,Et){St(Et),nt.shift(),nt.length&&Ve(nt[0][0],nt[0][1])}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var zt,Mr=me.apply(pe,J||[]),nt=[];return zt={},ye("next"),ye("throw"),ye("return"),zt[Symbol.asyncIterator]=function(){return this},zt};return kt}()}),bv=Math.min;Kt({target:"Array",proto:!0},{copyWithin:[].copyWithin||function(t,e){var r=jn(this),i=Rn(r.length),o=Zi(t,i),c=Zi(e,i),h=2<arguments.length?arguments[2]:void 0;for(i=bv((h===void 0?i:Zi(h,i))-c,i-o),h=1,c<o&&o<c+i&&(h=-1,c+=i-1,o+=i-1);0<i--;)c in r?r[o]=r[c]:delete r[o],o+=h,c+=h;return r}});var Ov=pi("Array").copyWithin,fA=Array.prototype;Kt({target:"Array",proto:!0,forced:La("every")},{every:function(t){return Ke(this,t,1<arguments.length?arguments[1]:void 0)}});var Bv=pi("Array").every,AA=Array.prototype,Nv=function(t){var e=t.every;return t===AA||t instanceof Array&&e===AA.every?Bv:e},eu=Co.getWeakData,Pv=Lt.set,xv=Lt.getterFor,Mv=0,tu=function(t){return t.frozen||(t.frozen=new gA)},gA=function(){this.entries=[]},wd=function(t,e){return rt(t.entries,function(r){return r[0]===e})};gA.prototype={get:function(t){if(t=wd(this,t))return t[1]},has:function(t){return!!wd(this,t)},set:function(t,e){var r=wd(this,t);r?r[1]=e:this.entries.push([t,e])},delete:function(t){var e=At(this.entries,function(r){return r[0]===t});return~e&&this.entries.splice(e,1),!!~e}};var pA={getConstructor:function(t,e,r,i){var o=t(function(C,x){De(C,o,e),Pv(C,{type:e,id:Mv++,frozen:void 0}),x!=null&&Se(x,C[i],C,r)}),c=xv(e),h=function(C,x,Q){var F=c(C),V=eu(Qi(x),!0);return V===!0?tu(F).set(x,Q):V[F.id]=Q,C};return fi(o.prototype,{delete:function(C){var x=c(this);if(!jr(C))return!1;var Q=eu(C);return Q===!0?tu(x).delete(C):Q&&$t(Q,x.id)&&delete Q[x.id]},has:function(C){var x=c(this);if(!jr(C))return!1;var Q=eu(C);return Q===!0?tu(x).has(C):Q&&$t(Q,x.id)}}),fi(o.prototype,r?{get:function(C){var x=c(this);if(jr(C)){var Q=eu(C);return Q===!0?tu(x).get(C):Q?Q[x.id]:void 0}},set:function(C,x){return h(this,C,x)}}:{add:function(C){return h(this,C,!0)}}),o}},kv=(de(function(t){var e=Lt.enforce,r=!Ht.ActiveXObject&&"ActiveXObject"in Ht,i=Object.isExtensible,o=function(F){return function(){return F(this,arguments.length?arguments[0]:void 0)}};if(t=t.exports=Vr("WeakMap",o,pA),lt&&r){var c=pA.getConstructor(o,"WeakMap",!0);Co.REQUIRED=!0,r=t.prototype;var h=r.delete,C=r.has,x=r.get,Q=r.set;fi(r,{delete:function(F){if(jr(F)&&!i(F)){var V=e(this);return V.frozen||(V.frozen=new c),h.call(this,F)||V.frozen.delete(F)}return h.call(this,F)},has:function(F){if(jr(F)&&!i(F)){var V=e(this);return V.frozen||(V.frozen=new c),C.call(this,F)||V.frozen.has(F)}return C.call(this,F)},get:function(F){if(jr(F)&&!i(F)){var V=e(this);return V.frozen||(V.frozen=new c),C.call(this,F)?x.call(this,F):V.frozen.get(F)}return x.call(this,F)},set:function(F,V){if(jr(F)&&!i(F)){var Y=e(this);Y.frozen||(Y.frozen=new c),C.call(this,F)?Q.call(this,F,V):Y.frozen.set(F,V)}else Q.call(this,F,V);return this}})}}),Math.min),Ld=[].lastIndexOf,vA=!!Ld&&0>1/[1].lastIndexOf(1,-0),Uv=La("lastIndexOf"),mA=vA||Uv?function(t){if(vA)return Ld.apply(this,arguments)||0;var e=Tn(this),r=Rn(e.length),i=r-1;for(1<arguments.length&&(i=kv(i,Yo(arguments[1]))),0>i&&(i=r+i);0<=i;i--)if(i in e&&e[i]===t)return i||0;return-1}:Ld;Kt({target:"Array",proto:!0,forced:mA!==[].lastIndexOf},{lastIndexOf:mA});var Fv=pi("Array").lastIndexOf,EA=Array.prototype,Qv=function(t){var e=t.lastIndexOf;return t===EA||t instanceof Array&&e===EA.lastIndexOf?Fv:e};let Gv=()=>function(t){var e;return t=_t(e=window.atob(t).split("")).call(e,r=>r.charCodeAt(0)),new Uint8Array(t,0,t.length/Uint8Array.BYTES_PER_ELEMENT)}("AGFzbQEAAAABMAlgA39/fwF/YAF/AGACf38AYAF/AX9gAn9/AX9gA39/fwBgBH9/f38AYAABf2AAAAI6AgNlbnYWZW1zY3JpcHRlbl9yZXNpemVfaGVhcAADA2VudhVlbXNjcmlwdGVuX21lbWNweV9iaWcAAAMjIggAAAAAAQEDAQEEBAQEAQEGAQYCBQUAAgAHAwEDAAIHAQMEBQFwAQYGBQYBAYACgAIGCQF/AUHQ48ACCweUAQoGbWVtb3J5AgARX193YXNtX2NhbGxfY3RvcnMAAhlfX2luZGlyZWN0X2Z1bmN0aW9uX3RhYmxlAQAGbWFsbG9jABwEZnJlZQAdEF9fZXJybm9fbG9jYXRpb24AGwx6bGliQ29tcHJlc3MAGglzdGFja1NhdmUAIQxzdGFja1Jlc3RvcmUAIgpzdGFja0FsbG9jACMJCwEAQQELBRgZDA0PCq6FAiIDAAELpQcBBH8gAEH//wNxIQMgAEEQdiEEQQEhACACQQFGBEAgAyABLQAAaiIAQfH/A2sgACAAQfD/A0sbIgAgBGoiA0EQdCIEQYCAPGogBCADQfD/A0sbIAByDwsgAQR/IAJBEE8EQAJAAkACQCACQa8rSwRAA0AgAkGwK2shAkHbAiEFIAEhAANAIAMgAC0AAGoiAyAEaiADIAAtAAFqIgNqIAMgAC0AAmoiA2ogAyAALQADaiIDaiADIAAtAARqIgNqIAMgAC0ABWoiA2ogAyAALQAGaiIDaiADIAAtAAdqIgNqIAMgAC0ACGoiA2ogAyAALQAJaiIDaiADIAAtAApqIgNqIAMgAC0AC2oiA2ogAyAALQAMaiIDaiADIAAtAA1qIgNqIAMgAC0ADmoiA2ogAyAALQAPaiIDaiEEIABBEGohACAFQQFrIgUNAAsgBEHx/wNwIQQgA0Hx/wNwIQMgAUGwK2ohASACQa8rSw0ACyACRQ0DIAJBEEkNAQsDQCADIAEtAABqIgAgBGogACABLQABaiIAaiAAIAEtAAJqIgBqIAAgAS0AA2oiAGogACABLQAEaiIAaiAAIAEtAAVqIgBqIAAgAS0ABmoiAGogACABLQAHaiIAaiAAIAEtAAhqIgBqIAAgAS0ACWoiAGogACABLQAKaiIAaiAAIAEtAAtqIgBqIAAgAS0ADGoiAGogACABLQANaiIAaiAAIAEtAA5qIgBqIAAgAS0AD2oiA2ohBCABQRBqIQEgAkEQayICQQ9LDQALIAJFDQELIAJBAWshBiACQQNxIgUEQCABIQADQCACQQFrIQIgAyAALQAAaiIDIARqIQQgAEEBaiIBIQAgBUEBayIFDQALCyAGQQNJDQADQCADIAEtAABqIgAgAS0AAWoiBSABLQACaiIGIAEtAANqIgMgBiAFIAAgBGpqamohBCABQQRqIQEgAkEEayICDQALCyAEQfH/A3AhBCADQfH/A3AhAwsgBEEQdCADcg8LAkAgAkUNACACQQFrIQYgAkEDcSIFBEAgASEAA0AgAkEBayECIAMgAC0AAGoiAyAEaiEEIABBAWoiASEAIAVBAWsiBQ0ACwsgBkEDSQ0AA0AgAyABLQAAaiIAIAEtAAFqIgUgAS0AAmoiBiABLQADaiIDIAYgBSAAIARqampqIQQgAUEEaiEBIAJBBGsiAg0ACwsgBEHx/wNwQRB0IANB8f8DayADIANB8P8DSxtyBSAACwsKACAAIAEgAhADC4UJAQJ/IAFFBEBBAA8LIABBf3MhAAJAIAJFDQAgAUEDcUUNACABLQAAIABB/wFxc0ECdEGACGooAgAgAEEIdnMhACACQQFrIgRBACABQQFqIgNBA3EbRQRAIAMhASAEIQIMAQsgAS0AASAAQf8BcXNBAnRBgAhqKAIAIABBCHZzIQAgAUECaiEDAkAgAkECayIERQ0AIANBA3FFDQAgAS0AAiAAQf8BcXNBAnRBgAhqKAIAIABBCHZzIQAgAUEDaiEDAkAgAkEDayIERQ0AIANBA3FFDQAgAS0AAyAAQf8BcXNBAnRBgAhqKAIAIABBCHZzIQAgAkEEayECIAFBBGohAQwCCyADIQEgBCECDAELIAMhASAEIQILIAJBH0sEQANAIAEoAhwgASgCGCABKAIUIAEoAhAgASgCDCABKAIIIAEoAgQgASgCACAAcyIAQQZ2QfwHcUGAGGooAgAgAEH/AXFBAnRBgCBqKAIAcyAAQQ52QfwHcUGAEGooAgBzIABBFnZB/AdxQYAIaigCAHNzIgBBBnZB/AdxQYAYaigCACAAQf8BcUECdEGAIGooAgBzIABBDnZB/AdxQYAQaigCAHMgAEEWdkH8B3FBgAhqKAIAc3MiAEEGdkH8B3FBgBhqKAIAIABB/wFxQQJ0QYAgaigCAHMgAEEOdkH8B3FBgBBqKAIAcyAAQRZ2QfwHcUGACGooAgBzcyIAQQZ2QfwHcUGAGGooAgAgAEH/AXFBAnRBgCBqKAIAcyAAQQ52QfwHcUGAEGooAgBzIABBFnZB/AdxQYAIaigCAHNzIgBBBnZB/AdxQYAYaigCACAAQf8BcUECdEGAIGooAgBzIABBDnZB/AdxQYAQaigCAHMgAEEWdkH8B3FBgAhqKAIAc3MiAEEGdkH8B3FBgBhqKAIAIABB/wFxQQJ0QYAgaigCAHMgAEEOdkH8B3FBgBBqKAIAcyAAQRZ2QfwHcUGACGooAgBzcyIAQQZ2QfwHcUGAGGooAgAgAEH/AXFBAnRBgCBqKAIAcyAAQQ52QfwHcUGAEGooAgBzIABBFnZB/AdxQYAIaigCAHNzIgBBBnZB/AdxQYAYaigCACAAQf8BcUECdEGAIGooAgBzIABBDnZB/AdxQYAQaigCAHMgAEEWdkH8B3FBgAhqKAIAcyEAIAFBIGohASACQSBrIgJBH0sNAAsLIAJBA0sEQANAIAEoAgAgAHMiAEEGdkH8B3FBgBhqKAIAIABB/wFxQQJ0QYAgaigCAHMgAEEOdkH8B3FBgBBqKAIAcyAAQRZ2QfwHcUGACGooAgBzIQAgAUEEaiEBIAJBBGsiAkEDSw0ACwsCQCACRQ0AIAJBAXEEfyABLQAAIABB/wFxc0ECdEGACGooAgAgAEEIdnMhACABQQFqIQEgAkEBawUgAgshAyACQQFGDQADQCABLQABIAEtAAAgAEH/AXFzQQJ0QYAIaigCACAAQQh2cyIAQf8BcXNBAnRBgAhqKAIAIABBCHZzIQAgAUECaiEBIANBAmsiAw0ACwsgAEF/cwsKACAAIAEgAhAFC9wEAQN/AkBByN8ALQAAQTFHDQAgAEUNACAAQQA2AhggACgCICIBRQRAIABBADYCKCAAQQE2AiBBASEBCyAAKAIkRQRAIABBAjYCJAsgACgCKEEBQcQtIAERAAAiAUUNACAAIAE2AhwgAUEPNgIwIAFBADYCHCABQQA2AhggAUEqNgIEIAEgADYCACABQQs2AlAgAUGAgAI2AiwgAUH//wE2AjQgAUGAEDYCTCABQQQ2AlggAUH/DzYCVCABIAAoAihBgIACQQIgACgCIBEAADYCOCABIAAoAiggASgCLEECIAAoAiARAAA2AkAgACgCKCABKAJMQQIgACgCIBEAACECIAFBADYCwC0gASACNgJEIAFBgAg2ApwtIAEgACgCKEGACEEEIAAoAiARAAAiAjYCCCABIAEoApwtIgNBAnQ2AgwCQAJAIAEoAjhFDQAgASgCQEUNACACRQ0AIAEoAkQNAQsgAUGaBTYCBCAAQbjfACgCADYCGCAAEAgPCyABQQA2AogBIAFBCTYChAEgAUEIOgAkIAEgAiADQQNsajYCmC0gASACIANBfnFqNgKkLSAAEAkNACAAKAIcIgAgACgCLEEBdDYCPCAAKAJEIgEgACgCTEEBdEECayIDakEAOwEAIAEgAxAgIABBADYCtC0gAEKAgICAIDcCdCAAQgA3AmggAEKAgICAIDcCXCAAQQA2AkggACAAKAKEAUEMbCIBQYTIAGovAQA2ApABIAAgAUGAyABqLwEANgKMASAAIAFBgsgAai8BADYCgAEgACABQYbIAGovAQA2AnwLC6kCAQN/AkAgAEUNACAAKAIgRQ0AIAAoAiQiA0UNACAAKAIcIgFFDQAgASgCACAARw0AAkACQCABKAIEIgJBOWsOOQECAgICAgICAgICAgECAgIBAgICAgICAgICAgICAgICAgIBAgICAgICAgICAgIBAgICAgICAgICAQALIAJBmgVGDQAgAkEqRw0BCwJ/An8CfyABKAIIIgIEQCAAKAIoIAIgAxECACAAKAIcIQELIAEoAkQiAgsEQCAAKAIoIAIgACgCJBECACAAKAIcIQELIAEoAkAiAgsEQCAAKAIoIAIgACgCJBECACAAKAIcIQELIAEoAjgiAgsEQCAAKAIoIAIgACgCJBECACAAKAIcIQELIAAoAiggASAAKAIkEQIAIABBADYCHAsLlgIBA39BfiECAkAgAEUNACAAKAIgRQ0AIAAoAiRFDQAgACgCHCIBRQ0AIAEoAgAgAEcNAAJAAkAgASgCBCIDQTlrDjkBAgICAgICAgICAgIBAgICAQICAgICAgICAgICAgICAgICAQICAgICAgICAgICAQICAgICAgICAgEACyADQZoFRg0AIANBKkcNAQsgAEECNgIsIABBADYCCCAAQgA3AhQgAUEANgIUIAEgASgCCDYCECABKAIYIgJBf0wEQCABQQAgAmsiAjYCGAsgAUE5QSpB8QAgAhsgAkECRhs2AgQgAAJ/IAJBAkYEQEEAQQBBABAGDAELQQBBAEEAEAQLNgIwQQAhAiABQQA2AiggARAQCyACC9wIAQt/IAAoAiwiB0GGAmshCyAAKAJ0IQUgByEBA0AgACgCPCAFayAAKAJsIghrIQYgASALaiAITQRAIAAoAjgiASABIAdqIAcgBmsQHxogACAAKAJwIAdrNgJwIAAgACgCbCAHayIINgJsIAAgACgCXCAHazYCXCAAKAJMIgRBAWshCiAAKAJEIARBAXRqIQMgACgCLCEBIARBA3EiAgRAA0AgA0ECayIDQQAgAy8BACIFIAFrIgkgBSAJSRs7AQAgBEEBayEEIAJBAWsiAg0ACwsgCkEDTwRAA0AgA0ECayICQQAgAi8BACICIAFrIgUgAiAFSRs7AQAgA0EEayICQQAgAi8BACICIAFrIgUgAiAFSRs7AQAgA0EGayICQQAgAi8BACICIAFrIgUgAiAFSRs7AQAgA0EIayIDQQAgAy8BACICIAFrIgUgAiAFSRs7AQAgBEEEayIEDQALCyABQQFrIQogACgCQCABQQF0aiEDIAEhBCABQQNxIgIEQANAIANBAmsiA0EAIAMvAQAiBSABayIJIAUgCUkbOwEAIARBAWshBCACQQFrIgINAAsLIApBA08EQANAIANBAmsiAkEAIAIvAQAiAiABayIFIAIgBUkbOwEAIANBBGsiAkEAIAIvAQAiAiABayIFIAIgBUkbOwEAIANBBmsiAkEAIAIvAQAiAiABayIFIAIgBUkbOwEAIANBCGsiA0EAIAMvAQAiAiABayIFIAIgBUkbOwEAIARBBGsiBA0ACwsgBiAHaiEGCwJAIAAoAgAiASgCBCIERQ0AIAAoAnQhAiAGIAQgBCAGSxsiAwRAIAAoAjghBSABIAQgA2s2AgQgBSAIaiACaiABKAIAIAMQHyEEAkACQAJAIAEoAhwoAhhBAWsOAgABAgsgASABKAIwIAQgAxAENgIwDAELIAEgASgCMCAEIAMQBjYCMAsgASABKAIAIANqNgIAIAEgASgCCCADajYCCCAAKAJ0IQILIAAgAiADaiIFNgJ0AkAgACgCtC0iAyAFakEDSQ0AIAAgACgCOCIJIAAoAmwgA2siAWoiBC0AACICNgJIIAAgACgCVCIIIAQtAAEgAiAAKAJYIgZ0c3EiBDYCSANAIANFDQEgACABIAlqLQACIAQgBnRzIAhxIgQ2AkggACgCQCAAKAI0IAFxQQF0aiAAKAJEIARBAXRqIgIvAQA7AQAgAiABOwEAIAAgA0EBayIDNgK0LSABQQFqIQEgAyAFakECSw0ACwsgBUGFAksNACAAKAIAKAIERQ0AIAAoAiwhAQwBCwsCQCAAKAI8IgQgACgCwC0iAU0NACAAKAJ0IAAoAmxqIgMgAUsEQCAAKAI4IANqIAQgA2siAUGCAiABQYICSRsiARAgIAAgASADajYCwC0PCyADQYICaiIDIAFNDQAgACgCOCABaiAEIAFrIgQgAyABayIBIAEgBEsbIgEQICAAIAAoAsAtIAFqNgLALQsLsSwBCn8CQCAARQ0AIAAoAiBFDQAgACgCJEUNACAAKAIcIgFFDQAgASgCACAARw0AAkACQCABKAIEIgNBOWsOOQECAgICAgICAgICAgECAgIBAgICAgICAgICAgICAgICAgIBAgICAgICAgICAgIBAgICAgICAgICAQALIANBmgVGDQAgA0EqRw0BCwJAAkAgACgCDEUNACAAKAIEIgIEQCAAKAIARQ0BCyADQZoFRw0BCyAAQbDfACgCADYCGA8LIAAoAhBFBEAgAEG83wAoAgA2AhgPCyABKAIoIQUgAUEDNgIoAkAgASgCFARAIAEQEwJAIAAoAhAiAyABKAIUIgQgAyAESRsiAkUNACAAKAIMIAEoAhAgAhAfGiAAIAAoAgwgAmo2AgwgASABKAIQIAJqNgIQIAAgACgCFCACajYCFCAAIAAoAhAgAmsiAzYCECABIAEoAhQgAmsiBDYCFCAEDQAgASABKAIINgIQQQAhBAsgAwRAIAEoAgQhAwwCCyABQX82AigPCyACDQAgBUEBdEF3QQAgBUEEShtqQQZIDQAgAEG83wAoAgA2AhgPCwJAAkACQAJAAn8CQAJAAkACQAJAAkAgA0EqRwRAIANBmgVHDQEgACgCBEUNAiAAQbzfACgCADYCGA8LIAEoAjBBDHRBgPABayEDQQAhAgJAIAEoAogBQQFKDQAgASgChAEiBUECSA0AQcAAIQIgBUEGSA0AQYABQcABIAVBBkYbIQILIAEgBEEBajYCFCABKAIIIARqIAIgA3IiAkEgciACIAEoAmwbIgJBCHY6AAAgASABKAIUIgNBAWo2AhQgAyABKAIIaiACQR9wIAJyQR9zOgAAIAEoAmwEQCAAKAIwIQIgASABKAIUIgNBAWo2AhQgAyABKAIIaiACQRh2OgAAIAEgASgCFCIDQQFqNgIUIAMgASgCCGogAkEQdjoAACAAKAIwIQIgASABKAIUIgNBAWo2AhQgAyABKAIIaiACQQh2OgAAIAEgASgCFCIDQQFqNgIUIAMgASgCCGogAjoAAAsgAEEAQQBBABAENgIwIAFB8QA2AgQgACgCHCICEBMCQCAAKAIQIgMgAigCFCIEIAMgBEkbIgNFDQAgACgCDCACKAIQIAMQHxogACAAKAIMIANqNgIMIAIgAigCECADajYCECAAIAAoAhQgA2o2AhQgACAAKAIQIANrNgIQIAIgAigCFCADayIDNgIUIAMNACACIAIoAgg2AhALIAEoAhQNBCABKAIEIQMLAkACQAJAAkACQAJAAkAgA0E5RgR/IABBAEEAQQAQBjYCMCABIAEoAhQiAkEBajYCFCACIAEoAghqQR86AAAgASABKAIUIgJBAWo2AhQgAiABKAIIakGLAToAACABIAEoAhQiAkEBajYCFCACIAEoAghqQQg6AAAgASgCHCICDQIgASABKAIUIgJBAWo2AhQgAiABKAIIakEAOgAAIAEgASgCFCICQQFqNgIUIAIgASgCCGpBADoAACABIAEoAhQiAkEBajYCFCACIAEoAghqQQA6AAAgASABKAIUIgJBAWo2AhQgAiABKAIIakEAOgAAIAEgASgCFCICQQFqNgIUIAIgASgCCGpBADoAAEECIQIgASgChAEiA0EJRwRAQQQgASgCiAFBAUpBAnQgA0ECSBshAgsgASABKAIUIgNBAWo2AhQgAyABKAIIaiACOgAAIAEgASgCFCICQQFqNgIUIAIgASgCCGpBAzoAACABQfEANgIEIAAoAhwiAhATAkAgACgCECIDIAIoAhQiBCADIARJGyIDRQ0AIAAoAgwgAigCECADEB8aIAAgACgCDCADajYCDCACIAIoAhAgA2o2AhAgACAAKAIUIANqNgIUIAAgACgCECADazYCECACIAIoAhQgA2siAzYCFCADDQAgAiACKAIINgIQCyABKAIUDQEgASgCBAUgAwtBxQBrDiMCBgYGAwYGBgYGBgYGBgYGBgYGBgYGBAYGBgYGBgYGBgYGBQYLIAFBfzYCKA8LIAIoAiQhAyACKAIcIQQgAigCECEFIAIoAiwhBiACKAIAIQggASABKAIUIgdBAWo2AhRBAiECIAcgASgCCGogBkEAR0EBdCAIQQBHciAFQQBHQQJ0ciAEQQBHQQN0ciADQQBHQQR0cjoAACABKAIcKAIEIQMgASABKAIUIgRBAWo2AhQgBCABKAIIaiADOgAAIAEoAhwoAgQhAyABIAEoAhQiBEEBajYCFCAEIAEoAghqIANBCHY6AAAgASgCHC8BBiEDIAEgASgCFCIEQQFqNgIUIAQgASgCCGogAzoAACABKAIcLQAHIQMgASABKAIUIgRBAWo2AhQgBCABKAIIaiADOgAAIAEoAoQBIgNBCUcEQEEEIAEoAogBQQFKQQJ0IANBAkgbIQILIAEgASgCFCIDQQFqNgIUIAMgASgCCGogAjoAACABKAIcKAIMIQIgASABKAIUIgNBAWo2AhQgAyABKAIIaiACOgAAIAEoAhwiAigCEAR/IAIoAhQhAiABIAEoAhQiA0EBajYCFCADIAEoAghqIAI6AAAgASgCHCgCFCECIAEgASgCFCIDQQFqNgIUIAMgASgCCGogAkEIdjoAACABKAIcBSACCygCLARAIAAgACgCMCABKAIIIAEoAhQQBjYCMAsgAUHFADYCBCABQQA2AiALIAEoAhwiBCgCECIDBEAgASgCFCICIAQvARQgASgCICIGayIFaiABKAIMIgRLBEADQCABKAIIIAJqIAMgBmogBCACayIEEB8aIAEgASgCDCIDNgIUAkAgAiADTw0AIAEoAhwoAixFDQAgACAAKAIwIAEoAgggAmogAyACaxAGNgIwCyABIAEoAiAgBGo2AiAgACgCHCICEBMCQCAAKAIQIgMgAigCFCIGIAMgBkkbIgNFDQAgACgCDCACKAIQIAMQHxogACAAKAIMIANqNgIMIAIgAigCECADajYCECAAIAAoAhQgA2o2AhQgACAAKAIQIANrNgIQIAIgAigCFCADayIDNgIUIAMNACACIAIoAgg2AhALIAEoAhQEQCABQX82AigPCyABKAIgIQYgASgCHCgCECEDQQAhAiAFIARrIgUgASgCDCIESw0ACwsgASgCCCACaiADIAZqIAUQHxogASABKAIUIAVqIgM2AhQCQCACIANPDQAgASgCHCgCLEUNACAAIAAoAjAgASgCCCACaiADIAJrEAY2AjALIAFBADYCIAsgAUHJADYCBAsgASgCHCgCHARAIAEoAhQiAiEFA0ACQCACIAEoAgxHDQACQCACIAVNDQAgASgCHCgCLEUNACAAIAAoAjAgASgCCCAFaiACIAVrEAY2AjALIAAoAhwiAhATAkAgACgCECIDIAIoAhQiBCADIARJGyIDRQ0AIAAoAgwgAigCECADEB8aIAAgACgCDCADajYCDCACIAIoAhAgA2o2AhAgACAAKAIUIANqNgIUIAAgACgCECADazYCECACIAIoAhQgA2siAzYCFCADDQAgAiACKAIINgIQC0EAIQJBACEFIAEoAhRFDQAgAUF/NgIoDwsgASgCHCgCHCEDIAEgASgCICIEQQFqNgIgIAMgBGotAAAhAyABIAJBAWo2AhQgASgCCCACaiADOgAAIAMEQCABKAIUIQIMAQsLAkAgASgCHCgCLEUNACABKAIUIgIgBU0NACAAIAAoAjAgASgCCCAFaiACIAVrEAY2AjALIAFBADYCIAsgAUHbADYCBAsCQCABKAIcKAIkRQ0AIAEoAhQiAiEFA0ACQCACIAEoAgxHDQACQCACIAVNDQAgASgCHCgCLEUNACAAIAAoAjAgASgCCCAFaiACIAVrEAY2AjALIAAoAhwiAhATAkAgACgCECIDIAIoAhQiBCADIARJGyIDRQ0AIAAoAgwgAigCECADEB8aIAAgACgCDCADajYCDCACIAIoAhAgA2o2AhAgACAAKAIUIANqNgIUIAAgACgCECADazYCECACIAIoAhQgA2siAzYCFCADDQAgAiACKAIINgIQC0EAIQJBACEFIAEoAhRFDQAgAUF/NgIoDwsgASgCHCgCJCEDIAEgASgCICIEQQFqNgIgIAMgBGotAAAhAyABIAJBAWo2AhQgASgCCCACaiADOgAAIAMEQCABKAIUIQIMAQsLIAEoAhwoAixFDQAgASgCFCICIAVNDQAgACAAKAIwIAEoAgggBWogAiAFaxAGNgIwCyABQecANgIECyABKAIcKAIsBEAgASgCDCABKAIUIgJBAmpJBEAgACgCHCICEBMCQCAAKAIQIgMgAigCFCIEIAMgBEkbIgNFDQAgACgCDCACKAIQIAMQHxogACAAKAIMIANqNgIMIAIgAigCECADajYCECAAIAAoAhQgA2o2AhQgACAAKAIQIANrNgIQIAIgAigCFCADayIDNgIUIAMNACACIAIoAgg2AhALIAEoAhQNBUEAIQILIAAoAjAhAyABIAJBAWo2AhQgASgCCCACaiADOgAAIAAoAjAhAiABIAEoAhQiA0EBajYCFCADIAEoAghqIAJBCHY6AAAgAEEAQQBBABAGNgIwCyABQfEANgIEIAAoAhwiAhATAkAgACgCECIDIAIoAhQiBCADIARJGyIDRQ0AIAAoAgwgAigCECADEB8aIAAgACgCDCADajYCDCACIAIoAhAgA2o2AhAgACAAKAIUIANqNgIUIAAgACgCECADazYCECACIAIoAhQgA2siAzYCFCADDQAgAiACKAIINgIQCyABKAIURQ0AIAFBfzYCKA8LIAAoAgQNAQsgASgCdA0AIAEoAgRBmgVGDQgLIAEoAoQBIgJFBEAgAUEDEAwMBAsCQAJAIAEoAogBQQJrDgIAAQQLA0ACQAJAIAEoAnQNACABEAogASgCdA0AIAFBADYCtC0MAQsgAUEANgJgIAEoAjggASgCbGotAAAhAiABKAKkLSABKAKgLSIDQQF0akEAOwEAIAEgA0EBajYCoC0gAyABKAKYLWogAjoAACABIAJBAnRqQZQBaiICIAIvAQBBAWo7AQAgASABKAJ0QQFrNgJ0IAEgASgCbEEBaiICNgJsIAEoAqAtIAEoApwtQQFrRw0BIAEgASgCXCIEQQBOBH8gASgCOCAEagVBAAsgAiAEa0EAEBQgASABKAJsNgJcIAEoAgAiAigCHCIDEBMCQCACKAIQIgQgAygCFCIFIAQgBUkbIgRFDQAgAigCDCADKAIQIAQQHxogAiACKAIMIARqNgIMIAMgAygCECAEajYCECACIAIoAhQgBGo2AhQgAiACKAIQIARrNgIQIAMgAygCFCAEayICNgIUIAINACADIAMoAgg2AhALIAEoAgAoAhANAQwHCwsgASgCoC1FDQcgASABKAJcIgNBAE4EfyABKAI4IANqBUEACyABKAJsIANrQQAQFCABIAEoAmw2AlwgASgCACICKAIcIgMQEwJAIAIoAhAiBCADKAIUIgUgBCAFSRsiBEUNACACKAIMIAMoAhAgBBAfGiACIAIoAgwgBGo2AgwgAyADKAIQIARqNgIQIAIgAigCFCAEajYCFCACIAIoAhAgBGs2AhAgAyADKAIUIARrIgI2AhQgAg0AIAMgAygCCDYCEAsgASgCACgCEEUNBQwHCwNAAkACQAJAIAEoAnQiAkGDAk8EQCABQQA2AmAMAQsgARAKIAEoAnQiAgRAIAFBADYCYCACQQJLDQEgASgCbCEDDAILIAFBADYCtC0gASgCoC1FDQogASABKAJcIgNBAE4EfyABKAI4IANqBUEACyABKAJsIANrQQAQFCABIAEoAmw2AlwgASgCACICKAIcIgMQEwJAIAIoAhAiBCADKAIUIgUgBCAFSRsiBEUNACACKAIMIAMoAhAgBBAfGiACIAIoAgwgBGo2AgwgAyADKAIQIARqNgIQIAIgAigCFCAEajYCFCACIAIoAhAgBGs2AhAgAyADKAIUIARrIgI2AhQgAg0AIAMgAygCCDYCEAsgASgCACgCEEUNCAwKCyABKAJsIgNFBEBBACEDDAELIAEoAjggA2oiBkEBayIFLQAAIgQgBi0AAEcNACAEIAUtAAJHDQAgBCAFLQADRw0AIAZBggJqIQlBfyEIAkACQAJAAkACQAJAA0AgBiAIaiIFLQAEIARGBEAgBCAFLQAFRw0CIAQgBS0ABkcNAyAEIAUtAAdHDQQgBCAGIAhBCGoiCmoiBy0AAEcNByAEIAUtAAlHDQUgBCAFLQAKRw0GIAVBC2ohByAIQfYBSg0HIAohCCAEIActAABGDQEMBwsLIAVBBGohBwwFCyAFQQVqIQcMBAsgBUEGaiEHDAMLIAVBB2ohBwwCCyAFQQlqIQcMAQsgBUEKaiEHCyABIAIgByAJa0GCAmoiBCACIARJGyICNgJgIAJBA0kNACABKAKkLSABKAKgLSIDQQF0akEBOwEAIAEgA0EBajYCoC0gAyABKAKYLWogAkEDayICOgAAIAJB/wFxQYDNAGotAABBAnQgAWpBmAlqIgIgAi8BAEEBajsBACABQYDJAC0AAEECdGpBiBNqIgIgAi8BAEEBajsBACABKAJgIQIgAUEANgJgIAEgASgCdCACazYCdCABIAIgASgCbGoiAjYCbCABKAKgLSABKAKcLUEBa0cNAgwBCyABKAI4IANqLQAAIQIgASgCpC0gASgCoC0iA0EBdGpBADsBACABIANBAWo2AqAtIAMgASgCmC1qIAI6AAAgASACQQJ0akGUAWoiAiACLwEAQQFqOwEAIAEgASgCdEEBazYCdCABIAEoAmxBAWoiAjYCbCABKAKgLSABKAKcLUEBa0cNAQsgASABKAJcIgRBAE4EfyABKAI4IARqBUEACyACIARrQQAQFCABIAEoAmw2AlwgASgCACICKAIcIgMQEwJAIAIoAhAiBCADKAIUIgUgBCAFSRsiBEUNACACKAIMIAMoAhAgBBAfGiACIAIoAgwgBGo2AgwgAyADKAIQIARqNgIQIAIgAigCFCAEajYCFCACIAIoAhAgBGs2AhAgAyADKAIUIARrIgI2AhQgAg0AIAMgAygCCDYCEAsgASgCACgCEA0ACwwECyABQX82AigPCyABQX82AigPCyABQQMgAkEMbEGIyABqKAIAEQQACyICQX5xQQJGBEAgAUGaBTYCBAsgAkF9cQ0BCyAAKAIQDQMgAUF/NgIoDwsgAkEBRw0BCyABQQBBAEEAEBIgASgCRCICIAEoAkxBAXRBAmsiA2pBADsBACACIAMQICABKAJ0RQRAIAFBADYCtC0gAUEANgJcIAFBADYCbAsgACgCHCICEBMCQCAAKAIQIgQgAigCFCIDIAMgBEsbIgNFDQAgACgCDCACKAIQIAMQHxogACAAKAIMIANqNgIMIAIgAigCECADajYCECAAIAAoAhQgA2o2AhQgACAAKAIQIANrIgQ2AhAgAiACKAIUIANrIgM2AhQgAw0AIAIgAigCCDYCEAsgBA0AIAFBfzYCKAsLC7YNAQt/IAAoAgAiBCgCBCEJQQEhCAJAIAQoAhAiAyAAKAK8LUEqakEDdSICSQ0AIAAoAiwiBSAAKAIMQQVrIgYgBSAGSRshCiABQQRHIQsDQCAKIAMgAmsiAyAAKAJsIAAoAlxrIgYgBCgCBGoiAkH//wMgAkH//wNJGyIFIAMgBUkbIgNLBEAgAiADRw0CIAFFDQIgCyADRXENAgsgAEEAQQAgAUEERiACIANGcSIHEBIgACgCFCAAKAIIakEEayADOgAAIAAoAhQgACgCCGpBA2sgA0EIdjoAACAAKAIUIAAoAghqQQJrIANBf3MiAjoAACAAKAIUIAAoAghqQQFrIAJBCHY6AAAgACgCACICKAIcIgQQEwJAIAIoAhAiBSAEKAIUIgwgBSAMSRsiBUUNACACKAIMIAQoAhAgBRAfGiACIAIoAgwgBWo2AgwgBCAEKAIQIAVqNgIQIAIgAigCFCAFajYCFCACIAIoAhAgBWs2AhAgBCAEKAIUIAVrIgI2AhQgAg0AIAQgBCgCCDYCEAsCfyAGBEAgACgCACgCDCAAKAI4IAAoAlxqIAMgBiADIAZJGyICEB8aIAAoAgAiBCAEKAIMIAJqNgIMIAQgBCgCECACazYCECAEIAQoAhQgAmo2AhQgACAAKAJcIAJqNgJcIAMgAmshAwsgAwsEQCAAKAIAIgIoAgwhBSADIAIoAgQiBiADIAZJGyIEBEAgAiAGIARrNgIEIAUgAigCACAEEB8hBQJAAkACQCACKAIcKAIYQQFrDgIAAQILIAIgAigCMCAFIAQQBDYCMAwBCyACIAIoAjAgBSAEEAY2AjALIAIgAigCACAEajYCACACIAIoAgggBGo2AgggACgCACICKAIMIQULIAIgAyAFajYCDCACIAIoAhAgA2s2AhAgAiACKAIUIANqNgIUCyAAKAIAIQQgBwRAQQAhCAwCCyAEKAIQIgMgACgCvC1BKmpBA3UiAk8NAAsLAkAgCSAEKAIEayIDRQRAIAAoAmwhAgwBCwJAIAAoAiwiAiADTQRAIABBAjYCsC0gACgCOCAEKAIAIAJrIAIQHxogACAAKAIsIgQ2AmwgBCECDAELAkAgACgCPCAAKAJsIgRrIANLDQAgACAEIAJrIgQ2AmwgACgCOCIFIAIgBWogBBAfGiAAKAKwLSICQQFLDQAgACACQQFqNgKwLQsgACgCOCAAKAJsaiAAKAIAKAIAIANrIAMQHxogACAAKAJsIANqIgI2AmwgACgCLCEECyAAIAI2AlwgACAEIAAoArQtIgVrIgQgAyADIARLGyAFajYCtC0LIAIgACgCwC1LBEAgACACNgLALQtBAyEDAkAgCEUNACAAKAIAIgQoAgQhAwJAAkAgAUF7cUUNACADDQBBASEDIAIgACgCXEYNAiAAKAI8IAJBf3NqIQVBACEDDAELIAMgACgCPCACQX9zaiIFTQ0AIAAoAlwiByAAKAIsIgZIDQAgACACIAZrIgM2AmwgACAHIAZrNgJcIAAoAjgiAiACIAZqIAMQHxogACgCsC0iA0EBTQRAIAAgA0EBajYCsC0LIAAoAiwgBWohBSAAKAIAIgQoAgQhAwsCQCADIAUgAyAFSRsiAkUEQCAAKAJsIQMMAQsgACgCbCEFIAAoAjghBiAEIAMgAms2AgQgBSAGaiAEKAIAIAIQHyEDAkACQAJAIAQoAhwoAhhBAWsOAgABAgsgBCAEKAIwIAMgAhAENgIwDAELIAQgBCgCMCADIAIQBjYCMAsgBCAEKAIAIAJqNgIAIAQgBCgCCCACajYCCCAAIAAoAmwgAmoiAzYCbAsgAyAAKALALUsEQCAAIAM2AsAtCyADIAAoAlwiBmsiBCAAKAIsIgMgACgCDCAAKAK8LUEqakEDdWsiAkH//wMgAkH//wNJGyICIAIgA0sbSQRAQQAhAyABRQ0BIAFBBEYgBEEAR3JFDQEgAiAESQ0BIAAoAgAoAgQNAQtBACEFIAAgACgCOCAGaiACIAQgAiAESRsiAwJ/IAFBBEYEQCAAKAIAKAIERSACIARPcSEFCyAFCxASIAAgACgCXCADajYCXCAAKAIAIgAoAhwiAxATAkAgACgCECICIAMoAhQiBCACIARJGyICRQ0AIAAoAgwgAygCECACEB8aIAAgACgCDCACajYCDCADIAMoAhAgAmo2AhAgACAAKAIUIAJqNgIUIAAgACgCECACazYCECADIAMoAhQgAmsiADYCFCAADQAgAyADKAIINgIQC0ECQQAgBRshAwsgAwu5CwENfwJAA0ACQAJAIAAoAnRBhQJNBEAgABAKIAAoAnQhAgJAIAENACACQYYCTw0AQQAPCyACRQ0EIAJBA0kNAQsgACAAKAJUIAAoAmwiAiAAKAI4ai0AAiAAKAJIIAAoAlh0c3EiAzYCSCAAKAJAIAIgACgCNHFBAXRqIAAoAkQgA0EBdGoiBC8BACIDOwEAIAQgAjsBACADRQ0AIAAoAixBhgJrIAIgA2tJDQAgACAAIAMQDiICNgJgDAELIAAoAmAhAgsCQCACQQNPBEAgACgCpC0gACgCoC0iA0EBdGogACgCbCAAKAJwayIEOwEAIAAgA0EBajYCoC0gAyAAKAKYLWogAkEDayICOgAAIAJB/wFxQYDNAGotAABBAnQgAGpBmAlqIgIgAi8BAEEBajsBACAAIARBAWtB//8DcSICIAJBB3ZBgAJqIAJBgAJJG0GAyQBqLQAAQQJ0akGIE2oiAiACLwEAQQFqOwEAIAAgACgCdCAAKAJgIgJrIgM2AnQgACgCnC1BAWshBiAAKAKgLSEHAkAgA0EDSQ0AIAIgACgCgAFLDQAgACACQQFrIgM2AmAgACgCSCEEIAAoAmwhAiAAKAI0IQggACgCQCEJIAAoAkQhCiAAKAJUIQsgACgCOCEMIAAoAlghDQNAIAAgAiIFQQFqIgI2AmwgACAFIAxqLQADIAQgDXRzIAtxIgQ2AkggCSACIAhxQQF0aiAKIARBAXRqIg4vAQA7AQAgDiACOwEAIAAgA0EBayIDNgJgIAMNAAsgACAFQQJqIgI2AmwgBiAHRw0DDAILIABBADYCYCAAIAAoAmwgAmoiAjYCbCAAIAAoAjggAmoiAy0AACIENgJIIAAgACgCVCADLQABIAQgACgCWHRzcTYCSCAGIAdHDQIMAQsgACgCOCAAKAJsai0AACECIAAoAqQtIAAoAqAtIgNBAXRqQQA7AQAgACADQQFqNgKgLSADIAAoApgtaiACOgAAIAAgAkECdGpBlAFqIgIgAi8BAEEBajsBACAAIAAoAnRBAWs2AnQgACAAKAJsQQFqIgI2AmwgACgCoC0gACgCnC1BAWtHDQELQQAhAyAAIAAoAlwiBEEATgR/IAAoAjggBGoFIAMLIAIgBGtBABAUIAAgACgCbDYCXCAAKAIAIgIoAhwiAxATAkAgAigCECIEIAMoAhQiBSAEIAVJGyIERQ0AIAIoAgwgAygCECAEEB8aIAIgAigCDCAEajYCDCADIAMoAhAgBGo2AhAgAiACKAIUIARqNgIUIAIgAigCECAEazYCECADIAMoAhQgBGsiAjYCFCACDQAgAyADKAIINgIQCyAAKAIAKAIQDQALQQAPCyAAIAAoAmwiAkECIAJBAkkbNgK0LSABQQRGBEBBACEDIAAgACgCXCIEQQBOBH8gACgCOCAEagUgAwsgAiAEa0EBEBQgACAAKAJsNgJcIAAoAgAiAigCHCIDEBMCQCACKAIQIgQgAygCFCIFIAQgBUkbIgRFDQAgAigCDCADKAIQIAQQHxogAiACKAIMIARqNgIMIAMgAygCECAEajYCECACIAIoAhQgBGo2AhQgAiACKAIQIARrNgIQIAMgAygCFCAEayICNgIUIAINACADIAMoAgg2AhALQQNBAiAAKAIAKAIQGw8LAkAgACgCoC1FDQBBACEDIAAgACgCXCIEQQBOBH8gACgCOCAEagUgAwsgAiAEa0EAEBQgACAAKAJsNgJcIAAoAgAiAigCHCIDEBMCQCACKAIQIgQgAygCFCIFIAQgBUkbIgRFDQAgAigCDCADKAIQIAQQHxogAiACKAIMIARqNgIMIAMgAygCECAEajYCECACIAIoAhQgBGo2AhQgAiACKAIQIARrNgIQIAMgAygCFCAEayICNgIUIAINACADIAMoAgg2AhALIAAoAgAoAhANAEEADwtBAQukBAEQfyAAKAJ8IgMgA0ECdiAAKAJ4IgQgACgCjAFJGyEJQQAgACgCbCIDIAAoAixrQYYCaiICIAIgA0sbIQwgACgCdCIHIAAoApABIgIgAiAHSxshDSAAKAI4Ig4gA2oiBUGCAmohDyAEIAVqIgMtAAAhCiADQQFrLQAAIQsgACgCNCEQIAAoAkAhEQNAAkACQCABIA5qIgMgBGoiAi0AACAKRw0AIAJBAWstAAAgC0cNACADLQAAIAUtAABHDQBBAiEGIAMtAAEgBS0AAUcNAAJAAkACQAJAAkACQAJAA0AgBSAGaiICLQABIAMtAANHDQYgAi0AAiADLQAERw0FIAItAAMgAy0ABUcNBCACLQAEIAMtAAZHDQMgAi0ABSADLQAHRw0CIAItAAYgAy0ACEcNASACLQAHIAMtAAlGBEAgBkH5AUshCCAFIAZBCGoiBmohAiAIDQggAy0ACiEIIANBCGohAyACLQAAIAhGDQEMCAsLIAJBB2ohAgwGCyACQQZqIQIMBQsgAkEFaiECDAQLIAJBBGohAgwDCyACQQNqIQIMAgsgAkECaiECDAELIAJBAWohAgsgAiAPayICQYICaiIDIARMDQAgACABNgJwIAMgDU4EQCADIQQMAgsgAyAFai0AACEKIAIgBWotAIECIQsgAyEECyAJQQFrIglFDQAgDCARIAEgEHFBAXRqLwEAIgFJDQELCyAHIAQgBCAHSxsL3Q4BB38DQAJAAkACQCAAKAJ0QYUCSw0AIAAQCiAAKAJ0IQICQCABDQAgAkGGAk8NAEEADwsgAkUNAiACQQJLDQAgACAAKAJgIgI2AnggACAAKAJwNgJkQQIhAyAAQQI2AmAMAQtBAiEDIAAgACgCVCAAKAJsIgIgACgCOGotAAIgACgCSCAAKAJYdHNxIgQ2AkggACgCQCACIAAoAjRxQQF0aiAAKAJEIARBAXRqIgUvAQAiBDsBACAFIAI7AQAgACAAKAJgIgI2AnggACAAKAJwNgJkIABBAjYCYCAERQ0AAkAgAiAAKAKAAU8NACAAKAIsQYYCayAAKAJsIARrSQ0AIAAgACAEEA4iAzYCYCADQQVLDQAgACgCiAFBAUcEQCADQQNHDQFBAyEDIAAoAmwgACgCcGtBgSBJDQELQQIhAyAAQQI2AmALIAAoAnghAgsCQCACQQNJDQAgAiADSQ0AIAAoAnQhBCAAKAKkLSAAKAKgLSIDQQF0aiAAKAJsIgUgACgCZEF/c2oiBjsBACAAIANBAWo2AqAtIAMgACgCmC1qIAJBA2siAjoAACACQf8BcUGAzQBqLQAAQQJ0IABqQZgJaiICIAIvAQBBAWo7AQAgACAGQQFrQf//A3EiAiACQQd2QYACaiACQYACSRtBgMkAai0AAEECdGpBiBNqIgIgAi8BAEEBajsBACAAIAAoAngiAkECayIDNgJ4IAAgACgCdCACa0EBajYCdCAEIAVqQQNrIQUgACgCnC1BAWshByAAKAJsIQIgACgCoC0hCANAIAAgAiIEQQFqIgI2AmwgAiAFTQRAIAAgACgCVCAEIAAoAjhqLQADIAAoAkggACgCWHRzcSIGNgJIIAAoAkAgACgCNCACcUEBdGogACgCRCAGQQF0aiIGLwEAOwEAIAYgAjsBAAsgACADQQFrIgM2AnggAw0ACyAAQQI2AmAgAEEANgJoIAAgBEECaiICNgJsIAcgCEcNAkEAIQMgACAAKAJcIgRBAE4EfyAAKAI4IARqBSADCyACIARrQQAQFCAAIAAoAmw2AlwgACgCACICKAIcIgMQEwJAIAIoAhAiBCADKAIUIgUgBCAFSRsiBEUNACACKAIMIAMoAhAgBBAfGiACIAIoAgwgBGo2AgwgAyADKAIQIARqNgIQIAIgAigCFCAEajYCFCACIAIoAhAgBGs2AhAgAyADKAIUIARrIgI2AhQgAg0AIAMgAygCCDYCEAsgACgCACgCEA0CQQAPCyAAKAJoBEAgACgCbCAAKAI4akEBay0AACECIAAoAqQtIAAoAqAtIgNBAXRqQQA7AQAgACADQQFqNgKgLSADIAAoApgtaiACOgAAIAAgAkECdGpBlAFqIgIgAi8BAEEBajsBAAJAIAAoAqAtIAAoApwtQQFrRw0AQQAhAyAAIAAoAlwiAkEATgR/IAAoAjggAmoFIAMLIAAoAmwgAmtBABAUIAAgACgCbDYCXCAAKAIAIgIoAhwiAxATIAIoAhAiBCADKAIUIgUgBCAFSRsiBEUNACACKAIMIAMoAhAgBBAfGiACIAIoAgwgBGo2AgwgAyADKAIQIARqNgIQIAIgAigCFCAEajYCFCACIAIoAhAgBGs2AhAgAyADKAIUIARrIgI2AhQgAg0AIAMgAygCCDYCEAsgACAAKAJsQQFqNgJsIAAgACgCdEEBazYCdCAAKAIAKAIQDQJBAA8FIABBATYCaCAAIAAoAmxBAWo2AmwgACAAKAJ0QQFrNgJ0DAILAAsLIAAoAmgEQCAAKAJsIAAoAjhqQQFrLQAAIQIgACgCpC0gACgCoC0iA0EBdGpBADsBACAAIANBAWo2AqAtIAMgACgCmC1qIAI6AAAgACACQQJ0akGUAWoiAiACLwEAQQFqOwEAIABBADYCaAsgACAAKAJsIgJBAiACQQJJGzYCtC0gAUEERgRAQQAhAyAAIAAoAlwiBEEATgR/IAAoAjggBGoFIAMLIAIgBGtBARAUIAAgACgCbDYCXCAAKAIAIgIoAhwiAxATAkAgAigCECIEIAMoAhQiBSAEIAVJGyIERQ0AIAIoAgwgAygCECAEEB8aIAIgAigCDCAEajYCDCADIAMoAhAgBGo2AhAgAiACKAIUIARqNgIUIAIgAigCECAEazYCECADIAMoAhQgBGsiAjYCFCACDQAgAyADKAIINgIQC0EDQQIgACgCACgCEBsPCwJAIAAoAqAtRQ0AQQAhAyAAIAAoAlwiBEEATgR/IAAoAjggBGoFIAMLIAIgBGtBABAUIAAgACgCbDYCXCAAKAIAIgIoAhwiAxATAkAgAigCECIEIAMoAhQiBSAEIAVJGyIERQ0AIAIoAgwgAygCECAEEB8aIAIgAigCDCAEajYCDCADIAMoAhAgBGo2AhAgAiACKAIUIARqNgIUIAIgAigCECAEazYCECADIAMoAhQgBGsiAjYCFCACDQAgAyADKAIINgIQCyAAKAIAKAIQDQBBAA8LQQELYQAgAEEANgK8LSAAQQA7AbgtIABBuBZqQajPADYCACAAIABB/BRqNgKwFiAAQawWakGUzwA2AgAgACAAQYgTajYCpBYgAEGgFmpBgM8ANgIAIAAgAEGUAWo2ApgWIAAQEQvwBAEDfyAAQZQBaiECA0AgAiABQQJ0IgNqQQA7AQAgAiADQQRyakEAOwEAIAFBAmoiAUGeAkcNAAsgAEEAOwH8FCAAQQA7AYgTIABBxBVqQQA7AQAgAEHAFWpBADsBACAAQbwVakEAOwEAIABBuBVqQQA7AQAgAEG0FWpBADsBACAAQbAVakEAOwEAIABBrBVqQQA7AQAgAEGoFWpBADsBACAAQaQVakEAOwEAIABBoBVqQQA7AQAgAEGcFWpBADsBACAAQZgVakEAOwEAIABBlBVqQQA7AQAgAEGQFWpBADsBACAAQYwVakEAOwEAIABBiBVqQQA7AQAgAEGEFWpBADsBACAAQYAVakEAOwEAIABB/BNqQQA7AQAgAEH4E2pBADsBACAAQfQTakEAOwEAIABB8BNqQQA7AQAgAEHsE2pBADsBACAAQegTakEAOwEAIABB5BNqQQA7AQAgAEHgE2pBADsBACAAQdwTakEAOwEAIABB2BNqQQA7AQAgAEHUE2pBADsBACAAQdATakEAOwEAIABBzBNqQQA7AQAgAEHIE2pBADsBACAAQcQTakEAOwEAIABBwBNqQQA7AQAgAEG8E2pBADsBACAAQbgTakEAOwEAIABBtBNqQQA7AQAgAEGwE2pBADsBACAAQawTakEAOwEAIABBqBNqQQA7AQAgAEGkE2pBADsBACAAQaATakEAOwEAIABBnBNqQQA7AQAgAEGYE2pBADsBACAAQZQTakEAOwEAIABBkBNqQQA7AQAgAEGME2pBADsBACAAQgA3AqwtIABBlAlqQQE7AQAgAEEANgKoLSAAQQA2AqAtC7IDAQJ/IAAgAC8BuC0gA0H//wNxIgUgACgCvC0iBHRyIgM7AbgtAkACQAJ/IARBDk4EQCAAIAAoAhQiBEEBajYCFCAEIAAoAghqIAM6AAAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAAQbktai0AADoAACAAIAVBECAAKAK8LSIEa3YiAzsBuC0gBEENawwBCyAEQQNqCyIEQQlOBEAgACAAKAIUIgRBAWo2AhQgBCAAKAIIaiADOgAAIAAgACgCFCIDQQFqNgIUIAMgACgCCGohBCAAQbktai0AACEDDAELIARBAUgNASAAIAAoAhQiBEEBajYCFCAEIAAoAghqIQQLIAQgAzoAAAsgAEEANgK8LSAAQQA7AbgtIAAgACgCFCIDQQFqNgIUIAMgACgCCGogAjoAACAAIAAoAhQiA0EBajYCFCADIAAoAghqIAJBCHY6AAAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiACQX9zIgM6AAAgACAAKAIUIgRBAWo2AhQgBCAAKAIIaiADQQh2OgAAIAAoAgggACgCFGogASACEB8aIAAgACgCFCACajYCFAusAQEBfwJAIAACfyAAKAK8LSIBQRBGBEAgACAAKAIUIgFBAWo2AhQgASAAKAIIaiAALQC4LToAACAAIAAoAhQiAUEBajYCFCABIAAoAghqIABBuS1qLQAAOgAAIABBADsBuC1BAAwBCyABQQhIDQEgACAAKAIUIgFBAWo2AhQgASAAKAIIaiAALQC4LToAACAAIABBuS1qLQAAOwG4LSAAKAK8LUEIaws2ArwtCwuhEwENfwJ/AkACQAJAIAAoAoQBQQFOBEAgACgCACIGKAIsQQJHDQNB/4D/n38hBANAAkAgBEEBcUUNACAAIAVBAnRqLwGUAUUNAEEAIQQMBAsCQCAEQQJxRQ0AIAAgBUECdEEEcmovAZQBRQ0AQQAhBAwECyAEQQJ2IQQgBUECaiIFQSBHDQALDAELIAJBBWoiBQwDCwJAIAAvAbgBDQAgAC8BvAENACAALwHIAQ0AQSAhBQNAIAAgBUECdCIEai8BlAENASAAIARBBHJqLwGUAQ0BIAAgBEEIcmovAZQBDQEgACAEQQxyai8BlAENAUEAIQQgBUEEaiIFQYACRw0ACwwBC0EBIQQLIAYgBDYCLAsgACAAQZgWahAVIAAgAEGkFmoQFSAALwGWASEEIAAgAEGcFmooAgAiCkECdGpB//8DOwGaASAKQQBOBEBBB0GKASAEGyEJQQRBAyAEGyELIABBwBVqIQ4gAEHEFWohDyAAQbwVaiEQQX8hDANAIAQhBSAAIAgiDUEBaiIIQQJ0ai8BlgEhBAJAAkAgB0EBaiIGIAlODQAgBCAFRw0AIAYhBwwBCwJ/IAYgC0gEQCAAIAVBAnRqQfwUaiIHLwEAIAZqDAELIAUEQCAFIAxHBEAgACAFQQJ0akH8FGoiBiAGLwEAQQFqOwEACyAQIgcvAQBBAWoMAQsgB0EJTARAIA4iBy8BAEEBagwBCyAPIgcvAQBBAWoLIQYgByAGOwEAQQAhBwJ/IARFBEBBAyELQYoBDAELQQNBBCAEIAVGIgYbIQtBBkEHIAYbCyEJIAUhDAsgCiANRw0ACwsgAEGKE2ovAQAhBCAAIABBqBZqKAIAIgpBAnRqQY4TakH//wM7AQBBACEHIApBAE4EQEEHQYoBIAQbIQlBBEEDIAQbIQsgAEHAFWohDiAAQcQVaiEPIABBvBVqIRBBfyEMQQAhCANAIAQhBSAAIAgiDUEBaiIIQQJ0akGKE2ovAQAhBAJAAkAgB0EBaiIGIAlODQAgBCAFRw0AIAYhBwwBCwJ/IAYgC0gEQCAAIAVBAnRqQfwUaiIHLwEAIAZqDAELIAUEQCAFIAxHBEAgACAFQQJ0akH8FGoiBiAGLwEAQQFqOwEACyAQIgcvAQBBAWoMAQsgB0EJTARAIA4iBy8BAEEBagwBCyAPIgcvAQBBAWoLIQYgByAGOwEAQQAhBwJ/IARFBEBBAyELQYoBDAELQQNBBCAEIAVGIgYbIQtBBkEHIAYbCyEJIAUhDAsgCiANRw0ACwsgACAAQbAWahAVIAAgACgCqC0Cf0ESIABBuhVqLwEADQAaQREgAEGCFWovAQANABpBECAAQbYVai8BAA0AGkEPIABBhhVqLwEADQAaQQ4gAEGyFWovAQANABpBDSAAQYoVai8BAA0AGkEMIABBrhVqLwEADQAaQQsgAEGOFWovAQANABpBCiAAQaoVai8BAA0AGkEJIABBkhVqLwEADQAaQQggAEGmFWovAQANABpBByAAQZYVai8BAA0AGkEGIABBohVqLwEADQAaQQUgAEGaFWovAQANABpBBCAAQZ4Vai8BAA0AGkEDQQIgAEH+FGovAQAbCyIIQQNsaiIEQRFqNgKoLSAEQRtqQQN2IgQgACgCrC1BCmpBA3YiBSAEIAVJGwshBAJAAkAgAUUNACACQQRqIARLDQAgACABIAIgAxASDAELIAAoArwtIQYCQCAEIAVHBEAgACgCiAFBBEcNAQsgACAALwG4LSADQQJqQf//A3EiBCAGdHIiBTsBuC0gAAJ/IAZBDk4EQCAAIAAoAhQiBkEBajYCFCAGIAAoAghqIAU6AAAgACAAKAIUIgVBAWo2AhQgBSAAKAIIaiAAQbktai0AADoAACAAIARBECAAKAK8LSIFa3Y7AbgtIAVBDWsMAQsgBkEDags2ArwtIABBwM8AQcDYABAWDAELIAAvAbgtIANBBGpB//8DcSIHIAZ0ciEFAkAgBkEOTgRAIAAgBTsBuC0gACAAKAIUIgRBAWo2AhQgBCAAKAIIaiAFOgAAIAAgACgCFCIEQQFqNgIUIAQgACgCCGogAEG5LWotAAA6AAAgACgCvC0iBUENayEEIAdBECAFa3YhBQwBCyAGQQNqIQQLIAAgBDYCvC0gAEGcFmooAgAiCkGA/gNqQf//A3EiByAEdCEGIABBqBZqKAIAIQkCfyAEQQxOBEAgACAFIAZyIgQ7AbgtIAAgACgCFCIFQQFqNgIUIAUgACgCCGogBDoAACAAIAAoAhQiBEEBajYCFCAEIAAoAghqIABBuS1qLQAAOgAAIAAoArwtIgVBC2shBCAHQRAgBWt2DAELIARBBWohBCAFIAZyCyEFIAAgBDYCvC0gCUH//wNxIgcgBHQhBgJ/IARBDE4EQCAAIAUgBnIiBDsBuC0gACAAKAIUIgVBAWo2AhQgBSAAKAIIaiAEOgAAIAAgACgCFCIEQQFqNgIUIAQgACgCCGogAEG5LWotAAA6AAAgACgCvC0iBUELayEEIAdBECAFa3YMAQsgBEEFaiEEIAUgBnILIQUgACAENgK8LSAIQf3/A2pB//8DcSIHIAR0IQYCfyAEQQ1OBEAgACAFIAZyIgQ7AbgtIAAgACgCFCIFQQFqNgIUIAUgACgCCGogBDoAACAAIAAoAhQiBEEBajYCFCAEIAAoAghqIABBuS1qLQAAOgAAIAAoArwtIgVBDGshBCAHQRAgBWt2DAELIARBBGohBCAFIAZyCyEGIAAgBDYCvC1BACEFIABBuS1qIQ0DQCAAIAYgACAFQZDcAGotAABBAnRqQf4Uai8BACIHIAR0ciIGOwG4LSAAAn8gBEEOTgRAIAAgACgCFCIEQQFqNgIUIAQgACgCCGogBjoAACAAIAAoAhQiBEEBajYCFCAEIAAoAghqIA0tAAA6AAAgACAHQRAgACgCvC0iBGt2IgY7AbgtIARBDWsMAQsgBEEDagsiBDYCvC0gBSAIRyEHIAVBAWohBSAHDQALIAAgAEGUAWoiBCAKEBcgACAAQYgTaiIFIAkQFyAAIAQgBRAWCyAAEBEgAwRAAkACfyAAKAK8LSIEQQlOBEAgACAAKAIUIgRBAWo2AhQgBCAAKAIIaiAALQC4LToAACAAIAAoAhQiBEEBajYCFCAEIAAoAghqIQQgAEG5LWotAAAMAQsgBEEBSA0BIAAgACgCFCIEQQFqNgIUIAQgACgCCGohBCAALQC4LQshBSAEIAU6AAALIABBADYCvC0gAEEAOwG4LQsLsRUBFX8jAEEgayEKIAEoAgAhCSABKAIIIgIoAgAhBSACKAIMIQ0gAEKAgICA0McANwLQKEF/IRACQCANQQBKBEBBACECA0ACQCAJIAJBAnRqIgMvAQAEQCAAIAAoAtAoQQFqIgM2AtAoIAAgA0ECdGpB3BZqIAI2AgAgACACakHYKGpBADoAACACIRAMAQsgA0EAOwECCyACQQFqIgIgDUcNAAsgACgC0CgiBEEBSg0BCwNAIAAgBEEBaiICNgLQKCAAIAJBAnRqQdwWaiAQQQFqIgNBACAQQQJIIgQbIgI2AgAgCSACQQJ0IgdqQQE7AQAgACACakHYKGpBADoAACAAIAAoAqgtQQFrNgKoLSAFBEAgACAAKAKsLSAFIAdqLwECazYCrC0LIAMgECAEGyEQIAAoAtAoIgRBAkgNAAsLIAEgEDYCBCAEQQF2IQgDQCAAIAhBAnRqQdwWaigCACELAkAgCCICQQF0IgMgBEoNACAAIAtqQdgoaiEPIAkgC0ECdGohBiAIIQUDQAJAIAMgBE4EQCADIQIMAQsgCSAAQdwWaiICIANBAXIiBEECdGooAgAiDkECdGovAQAiByAJIAIgA0ECdGooAgAiDEECdGovAQAiAk8EQCACIAdHBEAgAyECDAILIAMhAiAAQdgoaiIDIA5qLQAAIAMgDGotAABLDQELIAQhAgsgBi8BACIEIAkgACACQQJ0akHcFmooAgAiA0ECdGovAQAiB0kEQCAFIQIMAgsCQCAEIAdHDQAgDy0AACAAIANqQdgoai0AAEsNACAFIQIMAgsgACAFQQJ0akHcFmogAzYCACACIQUgAkEBdCIDIAAoAtAoIgRMDQALCyAAIAJBAnRqQdwWaiALNgIAIAhBAk4EQCAIQQFrIQggACgC0CghBAwBCwsgACgC0CghAwNAIA0hCCAAIANBAWsiBDYC0CggACgC4BYhCyAAIAAgA0ECdGpB3BZqKAIAIg02AuAWQQEhAgJAIANBA0gNACAAIA1qQdgoaiEPQQIhAyAJIA1BAnRqIQZBASEFA0ACQCADIAROBEAgAyECDAELIAkgAEHcFmoiAiADQQFyIgRBAnRqKAIAIg5BAnRqLwEAIgcgCSACIANBAnRqKAIAIgxBAnRqLwEAIgJPBEAgAiAHRwRAIAMhAgwCCyADIQIgAEHYKGoiAyAOai0AACADIAxqLQAASw0BCyAEIQILIAYvAQAiBCAJIAAgAkECdGpB3BZqKAIAIgNBAnRqLwEAIgdJBEAgBSECDAILAkAgBCAHRw0AIA8tAAAgACADakHYKGotAABLDQAgBSECDAILIAAgBUECdGpB3BZqIAM2AgAgAiEFIAJBAXQiAyAAKALQKCIETA0ACwtBAiEDIABB3BZqIgYgAkECdGogDTYCACAAIAAoAtQoQQFrIgQ2AtQoIAAoAuAWIQIgBiAEQQJ0aiALNgIAIAAgACgC1ChBAWsiBDYC1CggBiAEQQJ0aiACNgIAIAkgCEECdGoiDiAJIAJBAnRqIgQvAQAgCSALQQJ0aiIFLwEAajsBACAAQdgoaiIMIAhqIg8gAiAMai0AACICIAsgDGotAAAiByACIAdLG0EBajoAACAEIAg7AQIgBSAIOwECIAAgCDYC4BZBASEFQQEhAgJAIAAoAtAoIgRBAkgNAANAAn8gAyADIARODQAaIAkgBiADQQFyIgRBAnRqKAIAIgtBAnRqLwEAIgIgCSAGIANBAnRqKAIAIg1BAnRqLwEAIgdPBEAgAyACIAdHDQEaIAMgCyAMai0AACAMIA1qLQAASw0BGgsgBAshAiAOLwEAIgQgCSAAIAJBAnRqQdwWaigCACIDQQJ0ai8BACIHSQRAIAUhAgwCCwJAIAQgB0cNACAPLQAAIAAgA2pB2ChqLQAASw0AIAUhAgwCCyAAIAVBAnRqQdwWaiADNgIAIAIhBSACQQF0IgMgACgC0CgiBEwNAAsLIAhBAWohDSAAIAJBAnRqQdwWaiAINgIAIAAoAtAoIgNBAUoNAAsgACAAKALUKEEBayICNgLUKCAAQdwWaiIDIAJBAnRqIAAoAuAWNgIAIAEoAgQhByABKAIIIgIoAhAhBiACKAIIIREgAigCBCETIAIoAgAhEiABKAIAIQwgAEHUFmoiAUIANwEAIABBzBZqIhRCADcBACAAQcQWaiIVQgA3AQAgAEG8FmoiFkIANwEAQQAhCCAMIAMgACgC1ChBAnRqKAIAQQJ0akEAOwECAkAgACgC1CgiAkG7BEoNACACQQFqIQJBACEOA0AgDCAAIAJBAnRqQdwWaigCACIEQQJ0Ig1qIgUgDCAFLwECQQJ0ai8BAiIDQQFqIAYgAyAGSBsiDzsBAiADIAZOIQMCQCAEIAdKDQAgACAPQQF0akG8FmoiCyALLwEAQQFqOwEAQQAhCyAEIBFOBEAgEyAEIBFrQQJ0aigCACELCyAAIAAoAqgtIAUvAQAiBCALIA9qbGo2AqgtIBJFDQAgACAAKAKsLSALIA0gEmovAQJqIARsajYCrC0LIAMgDmohDiACQQFqIgJBvQRHDQALIA5FDQAgACAGQQF0akG8FmohDwNAIAYhAgNAIAAgAiIDQQFrIgJBAXRqQbwWaiIELwEAIgVFDQALIAQgBUEBazsBACAAIANBAXRqQbwWaiICIAIvAQBBAmo7AQAgDyAPLwEAQQFrIgI7AQAgDkECSiEDIA5BAmshDiADDQALIAZFDQBBvQQhBQNAIAJB//8DcSEDIAUhAgNAIAMEQCAAIAJBAWsiAkECdGpB3BZqKAIAIgQgB0oNASAMIARBAnRqIgQvAQIiBSAGRwRAIAAgACgCqC0gBC8BACAGIAVrbGo2AqgtIAQgBjsBAgsgA0EBayEDIAIhBQwBCwsgBkEBayIGRQ0BIAAgBkEBdGpBvBZqLwEAIQIMAAsACyAKIBYvAQBBAXQiAjsBAiAKIAIgAEG+FmovAQBqQQF0IgI7AQQgCiACIABBwBZqLwEAakEBdCICOwEGIAogAiAAQcIWai8BAGpBAXQiAjsBCCAKIAIgFS8BAGpBAXQiAjsBCiAKIAIgAEHGFmovAQBqQQF0IgI7AQwgCiACIABByBZqLwEAakEBdCICOwEOIAogAiAAQcoWai8BAGpBAXQiAjsBECAKIAIgFC8BAGpBAXQiAjsBEiAKIAIgAEHOFmovAQBqQQF0IgI7ARQgCiACIABB0BZqLwEAakEBdCICOwEWIAogAiAAQdIWai8BAGpBAXQiAjsBGCAKIAEvAQAgAmpBAXQiAjsBGiAKIABB1hZqLwEAIAJqQQF0IgI7ARwgCiACIABB2BZqLwEAakEBdDsBHiAQQQBOBEADQCAJIAhBAnRqIgcvAQIiBARAIAogBEEBdGoiACAALwEAIgBBAWo7AQAgBEEDcSEDQQAhAiAEQQFrQQNPBEAgBEH8/wNxIQUDQCAAQQN2QQFxIABBAnZBAXEgAEECcSACIABBAXFyQQJ0cnJBAXRyIgRBAXQhAiAAQQR2IQAgBUEEayIFDQALCyADBEADQCACIABBAXFyIgRBAXQhAiAAQQF2IQAgA0EBayIDDQALCyAHIAQ7AQALIAggEEchACAIQQFqIQggAA0ACwsL2QgBCn8CQCAAKAKgLUUEQCAAKAK8LSEDDAELIABBuS1qIQgDQCAEQQFqIQogACgCmC0gBGotAAAhBQJAIAACfyAAKAKkLSAEQQF0ai8BACIHRQRAIAEgBUECdGoiAy8BAiEEIAAgAC8BuC0gAy8BACIFIAAoArwtIgN0ciIHOwG4LUEQIARrIANIBEAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAHOgAAIAAgACgCFCIDQQFqNgIUIAMgACgCCGogCC0AADoAACAAIAVBECAAKAK8LSIDa3Y7AbgtIAMgBGpBEGsMAgsgAyAEagwBCyAFQYDNAGotAAAiC0ECdCIJQYAIciABaiIDLwEGIQQgACAALwG4LSADLwEEIgwgACgCvC0iBnRyIgM7AbgtIAACf0EQIARrIAZIBEAgACAAKAIUIgZBAWo2AhQgBiAAKAIIaiADOgAAIAAgACgCFCIDQQFqNgIUIAMgACgCCGogCC0AADoAACAAIAxBECAAKAK8LSIGa3YiAzsBuC0gBCAGakEQawwBCyAEIAZqCyIENgK8LSALQQhrQRNNBEAgACADIAUgCUGw3ABqKAIAa0H//wNxIgYgBHRyIgM7AbgtIAACf0EQIAlBwNkAaigCACIFayAESARAIAAgACgCFCIEQQFqNgIUIAQgACgCCGogAzoAACAAIAAoAhQiBEEBajYCFCAEIAAoAghqIAgtAAA6AAAgACAGQRAgACgCvC0iBGt2IgM7AbgtIAQgBWpBEGsMAQsgBCAFagsiBDYCvC0LIAIgB0EBayIFIAVBB3ZBgAJqIAVBgAJJG0GAyQBqLQAAIgtBAnQiCWoiBi8BAiEHIAAgAyAGLwEAIgwgBHRyIgY7AbgtIAACf0EQIAdrIARIBEAgACAAKAIUIgRBAWo2AhQgBCAAKAIIaiAGOgAAIAAgACgCFCIEQQFqNgIUIAQgACgCCGogCC0AADoAACAAIAxBECAAKAK8LSIEa3YiBjsBuC0gBCAHakEQawwBCyAEIAdqCyIDNgK8LSALQQRJDQEgACAGIAUgCUGw3QBqKAIAa0H//wNxIgUgA3RyIgc7AbgtQRAgCUHA2gBqKAIAIgRrIANIBEAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAHOgAAIAAgACgCFCIDQQFqNgIUIAMgACgCCGogCC0AADoAACAAIAVBECAAKAK8LSIDa3Y7AbgtIAMgBGpBEGsMAQsgAyAEagsiAzYCvC0LIAoiBCAAKAKgLUkNAAsLIAFBgghqLwEAIQQgACAALwG4LSABLwGACCIKIAN0ciIFOwG4LUEQIARrIANIBEAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAFOgAAIAAgACgCFCIDQQFqNgIUIAMgACgCCGogAEG5LWotAAA6AAAgACAKQRAgACgCvC0iA2t2OwG4LSAAIAMgBGpBEGs2ArwtDwsgACADIARqNgK8LQuXCwEMfyACQQBOBEBBBEEDIAEvAQIiChshBkEHQYoBIAobIQMgAEG5LWohCEF/IQcDQCAKIQkgASALIgxBAWoiC0ECdGovAQIhCgJAAkAgBUEBaiIEIANODQAgCSAKRw0AIAQhBQwBCwJAIAQgBkgEQCAAIAlBAnRqIgVB/BRqIQ0gBUH+FGohDiAAKAK8LSEFA0AgDi8BACEDIAAgAC8BuC0gDS8BACIGIAV0ciIHOwG4LSAAAn9BECADayAFSARAIAAgACgCFCIFQQFqNgIUIAUgACgCCGogBzoAACAAIAAoAhQiBUEBajYCFCAFIAAoAghqIAgtAAA6AAAgACAGQRAgACgCvC0iBWt2OwG4LSADIAVqQRBrDAELIAMgBWoLIgU2ArwtIARBAWsiBA0ACwwBCyAAAn8gCQRAAkAgByAJRgRAIAAoArwtIQMgBCEFDAELIAAgCUECdGoiBEH+FGovAQAhAyAAIAAvAbgtIARB/BRqLwEAIgYgACgCvC0iBHRyIgc7AbgtIAACf0EQIANrIARIBEAgACAAKAIUIgRBAWo2AhQgBCAAKAIIaiAHOgAAIAAgACgCFCIEQQFqNgIUIAQgACgCCGogCC0AADoAACAAIAZBECAAKAK8LSIEa3Y7AbgtIAMgBGpBEGsMAQsgAyAEagsiAzYCvC0LIAAvAbgtIAAvAbwVIgcgA3RyIQQCQEEQIAAvAb4VIgZrIANIBEAgACAEOwG4LSAAIAAoAhQiA0EBajYCFCADIAAoAghqIAQ6AAAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAILQAAOgAAIAYgACgCvC0iBGpBEGshAyAHQRAgBGt2IQQMAQsgAyAGaiEDCyAAIAM2ArwtIAAgBCAFQf3/A2pB//8DcSIFIAN0ciIEOwG4LSADQQ9OBEAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAEOgAAIAAgACgCFCIDQQFqNgIUIAMgACgCCGogCC0AADoAACAAIAVBECAAKAK8LSIDa3Y7AbgtIANBDmsMAgsgA0ECagwBCyAFQQlMBEAgAC8BuC0gAC8BwBUiByAAKAK8LSIDdHIhBAJAQRAgAC8BwhUiBmsgA0gEQCAAIAQ7AbgtIAAgACgCFCIDQQFqNgIUIAMgACgCCGogBDoAACAAIAAoAhQiA0EBajYCFCADIAAoAghqIAgtAAA6AAAgBiAAKAK8LSIEakEQayEDIAdBECAEa3YhBAwBCyADIAZqIQMLIAAgAzYCvC0gACAEIAVB/v8DakH//wNxIgUgA3RyIgQ7AbgtIANBDk4EQCAAIAAoAhQiA0EBajYCFCADIAAoAghqIAQ6AAAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAILQAAOgAAIAAgBUEQIAAoArwtIgNrdjsBuC0gA0ENawwCCyADQQNqDAELIAAvAbgtIAAvAcQVIgcgACgCvC0iA3RyIQQCQEEQIAAvAcYVIgZrIANIBEAgACAEOwG4LSAAIAAoAhQiA0EBajYCFCADIAAoAghqIAQ6AAAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAILQAAOgAAIAYgACgCvC0iBGpBEGshAyAHQRAgBGt2IQQMAQsgAyAGaiEDCyAAIAM2ArwtIAAgBCAFQfb/A2pB//8DcSIFIAN0ciIEOwG4LSADQQpOBEAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAEOgAAIAAgACgCFCIDQQFqNgIUIAMgACgCCGogCC0AADoAACAAIAVBECAAKAK8LSIDa3Y7AbgtIANBCWsMAQsgA0EHags2ArwtC0EAIQUCfyAKRQRAQYoBIQNBAwwBC0EGQQcgCSAKRiIEGyEDQQNBBCAEGwshBiAJIQcLIAIgDEcNAAsLCwkAIAEgAmwQHAsGACABEB0LXwEBfyMAQUBqIgMkACADQQA2AjAgA0IANwMoIAMgADYCCCADIAI2AhQgAyABNgIMIAMgAUEDbDYCGCADQQhqEAcgA0EIahALIANBCGoQCCADKAIcIQEgA0FAayQAIAELBgBB1N8AC6QuAQx/IwBBEGsiDCQAAkACQAJAAkACQAJAAkACQAJAAkACQAJAIABB9AFNBEBB2N8AKAIAIgZBECAAQQtqQXhxIABBC0kbIgRBA3YiAXYiAEEDcQRAIABBf3NBAXEgAWoiAkEDdCIDQYjgAGooAgAiAUEIaiEAAkAgASgCCCIEIANBgOAAaiIDRgRAQdjfACAGQX4gAndxNgIADAELIAQgAzYCDCADIAQ2AggLIAEgAkEDdCICQQNyNgIEIAEgAmoiASABKAIEQQFyNgIEDA0LIARB4N8AKAIAIghNDQEgAARAAkAgACABdEECIAF0IgBBACAAa3JxIgBBACAAa3FBAWsiACAAQQx2QRBxIgB2IgFBBXZBCHEiAiAAciABIAJ2IgBBAnZBBHEiAXIgACABdiIAQQF2QQJxIgFyIAAgAXYiAEEBdkEBcSIBciAAIAF2aiICQQN0IgNBiOAAaigCACIBKAIIIgAgA0GA4ABqIgNGBEBB2N8AIAZBfiACd3EiBjYCAAwBCyAAIAM2AgwgAyAANgIICyABQQhqIQAgASAEQQNyNgIEIAEgBGoiAyACQQN0IgUgBGsiAkEBcjYCBCABIAVqIAI2AgAgCARAIAhBA3YiBUEDdEGA4ABqIQRB7N8AKAIAIQECfyAGQQEgBXQiBXFFBEBB2N8AIAUgBnI2AgAgBAwBCyAEKAIICyEFIAQgATYCCCAFIAE2AgwgASAENgIMIAEgBTYCCAtB7N8AIAM2AgBB4N8AIAI2AgAMDQtB3N8AKAIAIglFDQEgCUEAIAlrcUEBayIAIABBDHZBEHEiAHYiAUEFdkEIcSICIAByIAEgAnYiAEECdkEEcSIBciAAIAF2IgBBAXZBAnEiAXIgACABdiIAQQF2QQFxIgFyIAAgAXZqQQJ0QYjiAGooAgAiAygCBEF4cSAEayEBIAMhAgNAAkAgAigCECIARQRAIAIoAhQiAEUNAQsgACgCBEF4cSAEayICIAEgASACSyICGyEBIAAgAyACGyEDIAAhAgwBCwsgAyAEaiILIANNDQIgAygCGCEKIAMgAygCDCIFRwRAIAMoAggiAEHo3wAoAgBJGiAAIAU2AgwgBSAANgIIDAwLIANBFGoiAigCACIARQRAIAMoAhAiAEUNBCADQRBqIQILA0AgAiEHIAAiBUEUaiICKAIAIgANACAFQRBqIQIgBSgCECIADQALIAdBADYCAAwLC0F/IQQgAEG/f0sNACAAQQtqIgBBeHEhBEHc3wAoAgAiCEUNAEEfIQcgBEH///8HTQRAIABBCHYiACAAQYD+P2pBEHZBCHEiAHQiASABQYDgH2pBEHZBBHEiAXQiAiACQYCAD2pBEHZBAnEiAnRBD3YgACABciACcmsiAEEBdCAEIABBFWp2QQFxckEcaiEHC0EAIARrIQECQAJAAkAgB0ECdEGI4gBqKAIAIgJFBEBBACEADAELQQAhACAEQQBBGSAHQQF2ayAHQR9GG3QhAwNAAkAgAigCBEF4cSAEayIGIAFPDQAgAiEFIAYiAQ0AQQAhASACIQAMAwsgACACKAIUIgYgBiACIANBHXZBBHFqKAIQIgJGGyAAIAYbIQAgA0EBdCEDIAINAAsLIAAgBXJFBEBBAiAHdCIAQQAgAGtyIAhxIgBFDQMgAEEAIABrcUEBayIAIABBDHZBEHEiAHYiAkEFdkEIcSIDIAByIAIgA3YiAEECdkEEcSICciAAIAJ2IgBBAXZBAnEiAnIgACACdiIAQQF2QQFxIgJyIAAgAnZqQQJ0QYjiAGooAgAhAAsgAEUNAQsDQCAAKAIEQXhxIARrIgYgAUkhAyAGIAEgAxshASAAIAUgAxshBSAAKAIQIgIEfyACBSAAKAIUCyIADQALCyAFRQ0AIAFB4N8AKAIAIARrTw0AIAQgBWoiByAFTQ0BIAUoAhghCSAFIAUoAgwiA0cEQCAFKAIIIgBB6N8AKAIASRogACADNgIMIAMgADYCCAwKCyAFQRRqIgIoAgAiAEUEQCAFKAIQIgBFDQQgBUEQaiECCwNAIAIhBiAAIgNBFGoiAigCACIADQAgA0EQaiECIAMoAhAiAA0ACyAGQQA2AgAMCQsgBEHg3wAoAgAiAE0EQEHs3wAoAgAhAQJAIAAgBGsiAkEQTwRAQeDfACACNgIAQezfACABIARqIgM2AgAgAyACQQFyNgIEIAAgAWogAjYCACABIARBA3I2AgQMAQtB7N8AQQA2AgBB4N8AQQA2AgAgASAAQQNyNgIEIAAgAWoiACAAKAIEQQFyNgIECyABQQhqIQAMCwsgBEHk3wAoAgAiA0kEQEHk3wAgAyAEayIBNgIAQfDfAEHw3wAoAgAiACAEaiICNgIAIAIgAUEBcjYCBCAAIARBA3I2AgQgAEEIaiEADAsLQQAhACAEQS9qIggCf0Gw4wAoAgAEQEG44wAoAgAMAQtBvOMAQn83AgBBtOMAQoCggICAgAQ3AgBBsOMAIAxBDGpBcHFB2KrVqgVzNgIAQcTjAEEANgIAQZTjAEEANgIAQYAgCyIBaiIGQQAgAWsiB3EiBSAETQ0KQZDjACgCACIBBEBBiOMAKAIAIgIgBWoiCSACTQ0LIAEgCUkNCwtBlOMALQAAQQRxDQUCQAJAQfDfACgCACIBBEBBmOMAIQADQCABIAAoAgAiAk8EQCACIAAoAgRqIAFLDQMLIAAoAggiAA0ACwtBABAeIgNBf0YNBiAFIQZBtOMAKAIAIgBBAWsiASADcQRAIAUgA2sgASADakEAIABrcWohBgsgBCAGTw0GIAZB/v///wdLDQZBkOMAKAIAIgAEQEGI4wAoAgAiASAGaiICIAFNDQcgACACSQ0HCyAGEB4iACADRw0BDAgLIAYgA2sgB3EiBkH+////B0sNBSAGEB4iAyAAKAIAIAAoAgRqRg0EIAMhAAsCQCAEQTBqIAZNDQAgAEF/Rg0AQbjjACgCACIBIAggBmtqQQAgAWtxIgFB/v///wdLBEAgACEDDAgLIAEQHkF/RwRAIAEgBmohBiAAIQMMCAtBACAGaxAeGgwFCyAAIQMgAEF/Rw0GDAQLAAtBACEFDAcLQQAhAwwFCyADQX9HDQILQZTjAEGU4wAoAgBBBHI2AgALIAVB/v///wdLDQEgBRAeIgNBABAeIgBPDQEgA0F/Rg0BIABBf0YNASAAIANrIgYgBEEoak0NAQtBiOMAQYjjACgCACAGaiIANgIAQYzjACgCACAASQRAQYzjACAANgIACwJAAkACQEHw3wAoAgAiAQRAQZjjACEAA0AgAyAAKAIAIgIgACgCBCIFakYNAiAAKAIIIgANAAsMAgtB6N8AKAIAIgBBACAAIANNG0UEQEHo3wAgAzYCAAtBACEAQZzjACAGNgIAQZjjACADNgIAQfjfAEF/NgIAQfzfAEGw4wAoAgA2AgBBpOMAQQA2AgADQCAAQQN0IgFBiOAAaiABQYDgAGoiAjYCACABQYzgAGogAjYCACAAQQFqIgBBIEcNAAtB5N8AIAZBKGsiAEF4IANrQQdxQQAgA0EIakEHcRsiAWsiAjYCAEHw3wAgASADaiIBNgIAIAEgAkEBcjYCBCAAIANqQSg2AgRB9N8AQcDjACgCADYCAAwCCyABIANPDQAgASACSQ0AIAAoAgxBCHENACAAIAUgBmo2AgRB8N8AIAFBeCABa0EHcUEAIAFBCGpBB3EbIgBqIgI2AgBB5N8AQeTfACgCACAGaiIDIABrIgA2AgAgAiAAQQFyNgIEIAEgA2pBKDYCBEH03wBBwOMAKAIANgIADAELQejfACgCACADSwRAQejfACADNgIACyADIAZqIQJBmOMAIQACQAJAAkACQAJAAkADQCACIAAoAgBHBEAgACgCCCIADQEMAgsLIAAtAAxBCHFFDQELQZjjACEAA0AgASAAKAIAIgJPBEAgAiAAKAIEaiICIAFLDQMLIAAoAgghAAwACwALIAAgAzYCACAAIAAoAgQgBmo2AgQgA0F4IANrQQdxQQAgA0EIakEHcRtqIgcgBEEDcjYCBCACQXggAmtBB3FBACACQQhqQQdxG2oiBiAHayAEayECIAQgB2ohBCABIAZGBEBB8N8AIAQ2AgBB5N8AQeTfACgCACACaiIANgIAIAQgAEEBcjYCBAwDCyAGQezfACgCAEYEQEHs3wAgBDYCAEHg3wBB4N8AKAIAIAJqIgA2AgAgBCAAQQFyNgIEIAAgBGogADYCAAwDCyAGKAIEIgBBA3FBAUYEQCAAQXhxIQgCQCAAQf8BTQRAIAYoAggiASAAQQN2IgVBA3RBgOAAakYaIAEgBigCDCIARgRAQdjfAEHY3wAoAgBBfiAFd3E2AgAMAgsgASAANgIMIAAgATYCCAwBCyAGKAIYIQkCQCAGIAYoAgwiA0cEQCAGKAIIIgAgAzYCDCADIAA2AggMAQsCQCAGQRRqIgAoAgAiAQ0AIAZBEGoiACgCACIBDQBBACEDDAELA0AgACEFIAEiA0EUaiIAKAIAIgENACADQRBqIQAgAygCECIBDQALIAVBADYCAAsgCUUNAAJAIAYgBigCHCIBQQJ0QYjiAGoiACgCAEYEQCAAIAM2AgAgAw0BQdzfAEHc3wAoAgBBfiABd3E2AgAMAgsgCUEQQRQgCSgCECAGRhtqIAM2AgAgA0UNAQsgAyAJNgIYIAYoAhAiAARAIAMgADYCECAAIAM2AhgLIAYoAhQiAEUNACADIAA2AhQgACADNgIYCyAGIAhqIQYgAiAIaiECCyAGIAYoAgRBfnE2AgQgBCACQQFyNgIEIAIgBGogAjYCACACQf8BTQRAIAJBA3YiAUEDdEGA4ABqIQACf0HY3wAoAgAiAkEBIAF0IgFxRQRAQdjfACABIAJyNgIAIAAMAQsgACgCCAshASAAIAQ2AgggASAENgIMIAQgADYCDCAEIAE2AggMAwtBHyEAIAJB////B00EQCACQQh2IgAgAEGA/j9qQRB2QQhxIgB0IgEgAUGA4B9qQRB2QQRxIgF0IgMgA0GAgA9qQRB2QQJxIgN0QQ92IAAgAXIgA3JrIgBBAXQgAiAAQRVqdkEBcXJBHGohAAsgBCAANgIcIARCADcCECAAQQJ0QYjiAGohAQJAQdzfACgCACIDQQEgAHQiBXFFBEBB3N8AIAMgBXI2AgAgASAENgIAIAQgATYCGAwBCyACQQBBGSAAQQF2ayAAQR9GG3QhACABKAIAIQMDQCADIgEoAgRBeHEgAkYNAyAAQR12IQMgAEEBdCEAIAEgA0EEcWpBEGoiBSgCACIDDQALIAUgBDYCACAEIAE2AhgLIAQgBDYCDCAEIAQ2AggMAgtB5N8AIAZBKGsiAEF4IANrQQdxQQAgA0EIakEHcRsiBWsiBzYCAEHw3wAgAyAFaiIFNgIAIAUgB0EBcjYCBCAAIANqQSg2AgRB9N8AQcDjACgCADYCACABIAJBJyACa0EHcUEAIAJBJ2tBB3EbakEvayIAIAAgAUEQakkbIgVBGzYCBCAFQaDjACkCADcCECAFQZjjACkCADcCCEGg4wAgBUEIajYCAEGc4wAgBjYCAEGY4wAgAzYCAEGk4wBBADYCACAFQRhqIQADQCAAQQc2AgQgAEEIaiEDIABBBGohACACIANLDQALIAEgBUYNAyAFIAUoAgRBfnE2AgQgASAFIAFrIgZBAXI2AgQgBSAGNgIAIAZB/wFNBEAgBkEDdiICQQN0QYDgAGohAAJ/QdjfACgCACIDQQEgAnQiAnFFBEBB2N8AIAIgA3I2AgAgAAwBCyAAKAIICyECIAAgATYCCCACIAE2AgwgASAANgIMIAEgAjYCCAwEC0EfIQAgAUIANwIQIAZB////B00EQCAGQQh2IgAgAEGA/j9qQRB2QQhxIgB0IgIgAkGA4B9qQRB2QQRxIgJ0IgMgA0GAgA9qQRB2QQJxIgN0QQ92IAAgAnIgA3JrIgBBAXQgBiAAQRVqdkEBcXJBHGohAAsgASAANgIcIABBAnRBiOIAaiECAkBB3N8AKAIAIgNBASAAdCIFcUUEQEHc3wAgAyAFcjYCACACIAE2AgAgASACNgIYDAELIAZBAEEZIABBAXZrIABBH0YbdCEAIAIoAgAhAwNAIAMiAigCBEF4cSAGRg0EIABBHXYhAyAAQQF0IQAgAiADQQRxakEQaiIFKAIAIgMNAAsgBSABNgIAIAEgAjYCGAsgASABNgIMIAEgATYCCAwDCyABKAIIIgAgBDYCDCABIAQ2AgggBEEANgIYIAQgATYCDCAEIAA2AggLIAdBCGohAAwFCyACKAIIIgAgATYCDCACIAE2AgggAUEANgIYIAEgAjYCDCABIAA2AggLQeTfACgCACIAIARNDQBB5N8AIAAgBGsiATYCAEHw3wBB8N8AKAIAIgAgBGoiAjYCACACIAFBAXI2AgQgACAEQQNyNgIEIABBCGohAAwDC0HU3wBBMDYCAEEAIQAMAgsCQCAJRQ0AAkAgBSgCHCICQQJ0QYjiAGoiACgCACAFRgRAIAAgAzYCACADDQFB3N8AIAhBfiACd3EiCDYCAAwCCyAJQRBBFCAJKAIQIAVGG2ogAzYCACADRQ0BCyADIAk2AhggBSgCECIABEAgAyAANgIQIAAgAzYCGAsgBSgCFCIARQ0AIAMgADYCFCAAIAM2AhgLAkAgAUEPTQRAIAUgASAEaiIAQQNyNgIEIAAgBWoiACAAKAIEQQFyNgIEDAELIAUgBEEDcjYCBCAHIAFBAXI2AgQgASAHaiABNgIAIAFB/wFNBEAgAUEDdiIBQQN0QYDgAGohAAJ/QdjfACgCACICQQEgAXQiAXFFBEBB2N8AIAEgAnI2AgAgAAwBCyAAKAIICyEBIAAgBzYCCCABIAc2AgwgByAANgIMIAcgATYCCAwBC0EfIQAgAUH///8HTQRAIAFBCHYiACAAQYD+P2pBEHZBCHEiAHQiAiACQYDgH2pBEHZBBHEiAnQiBCAEQYCAD2pBEHZBAnEiBHRBD3YgACACciAEcmsiAEEBdCABIABBFWp2QQFxckEcaiEACyAHIAA2AhwgB0IANwIQIABBAnRBiOIAaiECAkACQCAIQQEgAHQiBHFFBEBB3N8AIAQgCHI2AgAgAiAHNgIAIAcgAjYCGAwBCyABQQBBGSAAQQF2ayAAQR9GG3QhACACKAIAIQQDQCAEIgIoAgRBeHEgAUYNAiAAQR12IQQgAEEBdCEAIAIgBEEEcWpBEGoiAygCACIEDQALIAMgBzYCACAHIAI2AhgLIAcgBzYCDCAHIAc2AggMAQsgAigCCCIAIAc2AgwgAiAHNgIIIAdBADYCGCAHIAI2AgwgByAANgIICyAFQQhqIQAMAQsCQCAKRQ0AAkAgAygCHCICQQJ0QYjiAGoiACgCACADRgRAIAAgBTYCACAFDQFB3N8AIAlBfiACd3E2AgAMAgsgCkEQQRQgCigCECADRhtqIAU2AgAgBUUNAQsgBSAKNgIYIAMoAhAiAARAIAUgADYCECAAIAU2AhgLIAMoAhQiAEUNACAFIAA2AhQgACAFNgIYCwJAIAFBD00EQCADIAEgBGoiAEEDcjYCBCAAIANqIgAgACgCBEEBcjYCBAwBCyADIARBA3I2AgQgCyABQQFyNgIEIAEgC2ogATYCACAIBEAgCEEDdiIEQQN0QYDgAGohAkHs3wAoAgAhAAJ/QQEgBHQiBCAGcUUEQEHY3wAgBCAGcjYCACACDAELIAIoAggLIQQgAiAANgIIIAQgADYCDCAAIAI2AgwgACAENgIIC0Hs3wAgCzYCAEHg3wAgATYCAAsgA0EIaiEACyAMQRBqJAAgAAvMDAEHfwJAIABFDQAgAEEIayICIABBBGsoAgAiAUF4cSIAaiEFAkAgAUEBcQ0AIAFBA3FFDQEgAiACKAIAIgFrIgJB6N8AKAIASQ0BIAAgAWohACACQezfACgCAEcEQCABQf8BTQRAIAIoAggiBCABQQN2IgdBA3RBgOAAakYaIAQgAigCDCIBRgRAQdjfAEHY3wAoAgBBfiAHd3E2AgAMAwsgBCABNgIMIAEgBDYCCAwCCyACKAIYIQYCQCACIAIoAgwiA0cEQCACKAIIIgEgAzYCDCADIAE2AggMAQsCQCACQRRqIgEoAgAiBA0AIAJBEGoiASgCACIEDQBBACEDDAELA0AgASEHIAQiA0EUaiIBKAIAIgQNACADQRBqIQEgAygCECIEDQALIAdBADYCAAsgBkUNAQJAIAIgAigCHCIEQQJ0QYjiAGoiASgCAEYEQCABIAM2AgAgAw0BQdzfAEHc3wAoAgBBfiAEd3E2AgAMAwsgBkEQQRQgBigCECACRhtqIAM2AgAgA0UNAgsgAyAGNgIYIAIoAhAiAQRAIAMgATYCECABIAM2AhgLIAIoAhQiAUUNASADIAE2AhQgASADNgIYDAELIAUoAgQiAUEDcUEDRw0AQeDfACAANgIAIAUgAUF+cTYCBCACIABBAXI2AgQgACACaiAANgIADwsgAiAFTw0AIAUoAgQiAUEBcUUNAAJAIAFBAnFFBEAgBUHw3wAoAgBGBEBB8N8AIAI2AgBB5N8AQeTfACgCACAAaiIANgIAIAIgAEEBcjYCBCACQezfACgCAEcNA0Hg3wBBADYCAEHs3wBBADYCAA8LIAVB7N8AKAIARgRAQezfACACNgIAQeDfAEHg3wAoAgAgAGoiADYCACACIABBAXI2AgQgACACaiAANgIADwsgAUF4cSAAaiEAAkAgAUH/AU0EQCAFKAIIIgQgAUEDdiIHQQN0QYDgAGpGGiAEIAUoAgwiAUYEQEHY3wBB2N8AKAIAQX4gB3dxNgIADAILIAQgATYCDCABIAQ2AggMAQsgBSgCGCEGAkAgBSAFKAIMIgNHBEAgBSgCCCIBQejfACgCAEkaIAEgAzYCDCADIAE2AggMAQsCQCAFQRRqIgEoAgAiBA0AIAVBEGoiASgCACIEDQBBACEDDAELA0AgASEHIAQiA0EUaiIBKAIAIgQNACADQRBqIQEgAygCECIEDQALIAdBADYCAAsgBkUNAAJAIAUgBSgCHCIEQQJ0QYjiAGoiASgCAEYEQCABIAM2AgAgAw0BQdzfAEHc3wAoAgBBfiAEd3E2AgAMAgsgBkEQQRQgBigCECAFRhtqIAM2AgAgA0UNAQsgAyAGNgIYIAUoAhAiAQRAIAMgATYCECABIAM2AhgLIAUoAhQiAUUNACADIAE2AhQgASADNgIYCyACIABBAXI2AgQgACACaiAANgIAIAJB7N8AKAIARw0BQeDfACAANgIADwsgBSABQX5xNgIEIAIgAEEBcjYCBCAAIAJqIAA2AgALIABB/wFNBEAgAEEDdiIBQQN0QYDgAGohAAJ/QdjfACgCACIEQQEgAXQiAXFFBEBB2N8AIAEgBHI2AgAgAAwBCyAAKAIICyEBIAAgAjYCCCABIAI2AgwgAiAANgIMIAIgATYCCA8LQR8hASACQgA3AhAgAEH///8HTQRAIABBCHYiASABQYD+P2pBEHZBCHEiAXQiBCAEQYDgH2pBEHZBBHEiBHQiAyADQYCAD2pBEHZBAnEiA3RBD3YgASAEciADcmsiAUEBdCAAIAFBFWp2QQFxckEcaiEBCyACIAE2AhwgAUECdEGI4gBqIQQCQAJAAkBB3N8AKAIAIgNBASABdCIFcUUEQEHc3wAgAyAFcjYCACAEIAI2AgAgAiAENgIYDAELIABBAEEZIAFBAXZrIAFBH0YbdCEBIAQoAgAhAwNAIAMiBCgCBEF4cSAARg0CIAFBHXYhAyABQQF0IQEgBCADQQRxakEQaiIFKAIAIgMNAAsgBSACNgIAIAIgBDYCGAsgAiACNgIMIAIgAjYCCAwBCyAEKAIIIgAgAjYCDCAEIAI2AgggAkEANgIYIAIgBDYCDCACIAA2AggLQfjfAEH43wAoAgBBAWsiAkF/IAIbNgIACwtVAQJ/QdDfACgCACIBIABBA2pBfHEiAmohAAJAIAJBAU5BACAAIAFNGw0APwBBEHQgAEkEQCAAEABFDQELQdDfACAANgIAIAEPC0HU3wBBMDYCAEF/C4IEAQN/IAJBgARPBEAgACABIAIQARogAA8LIAAgAmohAwJAIAAgAXNBA3FFBEACQCACQQFIBEAgACECDAELIABBA3FFBEAgACECDAELIAAhAgNAIAIgAS0AADoAACABQQFqIQEgAkEBaiICIANPDQEgAkEDcQ0ACwsCQCADQXxxIgRBwABJDQAgAiAEQUBqIgVLDQADQCACIAEoAgA2AgAgAiABKAIENgIEIAIgASgCCDYCCCACIAEoAgw2AgwgAiABKAIQNgIQIAIgASgCFDYCFCACIAEoAhg2AhggAiABKAIcNgIcIAIgASgCIDYCICACIAEoAiQ2AiQgAiABKAIoNgIoIAIgASgCLDYCLCACIAEoAjA2AjAgAiABKAI0NgI0IAIgASgCODYCOCACIAEoAjw2AjwgAUFAayEBIAJBQGsiAiAFTQ0ACwsgAiAETw0BA0AgAiABKAIANgIAIAFBBGohASACQQRqIgIgBEkNAAsMAQsgA0EESQRAIAAhAgwBCyAAIANBBGsiBEsEQCAAIQIMAQsgACECA0AgAiABLQAAOgAAIAIgAS0AAToAASACIAEtAAI6AAIgAiABLQADOgADIAFBBGohASACQQRqIgIgBE0NAAsLIAIgA0kEQANAIAIgAS0AADoAACABQQFqIQEgAkEBaiICIANHDQALCyAAC9YCAQJ/AkAgAUUNACAAIAFqIgJBAWtBADoAACAAQQA6AAAgAUEDSQ0AIAJBAmtBADoAACAAQQA6AAEgAkEDa0EAOgAAIABBADoAAiABQQdJDQAgAkEEa0EAOgAAIABBADoAAyABQQlJDQAgAEEAIABrQQNxIgNqIgJBADYCACACIAEgA2tBfHEiA2oiAUEEa0EANgIAIANBCUkNACACQQA2AgggAkEANgIEIAFBCGtBADYCACABQQxrQQA2AgAgA0EZSQ0AIAJBADYCGCACQQA2AhQgAkEANgIQIAJBADYCDCABQRBrQQA2AgAgAUEUa0EANgIAIAFBGGtBADYCACABQRxrQQA2AgAgAyACQQRxQRhyIgNrIgFBIEkNACACIANqIQIDQCACQgA3AxggAkIANwMQIAJCADcDCCACQgA3AwAgAkEgaiECIAFBIGsiAUEfSw0ACwsLBAAjAAsGACAAJAALEAAjACAAa0FwcSIAJAAgAAsLvVYIAEGECAvxQJYwB3csYQ7uulEJmRnEbQeP9GpwNaVj6aOVZJ4yiNsOpLjceR7p1eCI2dKXK0y2Cb18sX4HLbjnkR2/kGQQtx3yILBqSHG5895BvoR91Noa6+TdbVG11PTHhdODVphsE8Coa2R6+WL97Mllik9cARTZbAZjYz0P+vUNCI3IIG47XhBpTORBYNVycWei0eQDPEfUBEv9hQ3Sa7UKpfqotTVsmLJC1sm720D5vKzjbNgydVzfRc8N1txZPdGrrDDZJjoA3lGAUdfIFmHQv7X0tCEjxLNWmZW6zw+lvbieuAIoCIgFX7LZDMYk6Quxh3xvLxFMaFirHWHBPS1mtpBB3HYGcdsBvCDSmCoQ1e+JhbFxH7W2BqXkv58z1LjooskHeDT5AA+OqAmWGJgO4bsNan8tPW0Il2xkkQFcY+b0UWtrYmFsHNgwZYVOAGLy7ZUGbHulARvB9AiCV8QP9cbZsGVQ6bcS6ri+i3yIufzfHd1iSS3aFfN804xlTNT7WGGyTc5RtTp0ALyj4jC71EGl30rXldg9bcTRpPv01tNq6WlD/NluNEaIZ63QuGDacy0EROUdAzNfTAqqyXwN3TxxBVCqQQInEBALvoYgDMkltWhXs4VvIAnUZrmf5GHODvneXpjJ2SkimNCwtKjXxxc9s1mBDbQuO1y9t61susAgg7jttrO/mgzitgOa0rF0OUfV6q930p0VJtsEgxbccxILY+OEO2SUPmptDahaanoLzw7knf8JkyeuAAqxngd9RJMP8NKjCIdo8gEe/sIGaV1XYvfLZ2WAcTZsGecGa252G9T+4CvTiVp62hDMSt1nb9+5+fnvvo5DvrcX1Y6wYOij1tZ+k9GhxMLYOFLy30/xZ7vRZ1e8pt0GtT9LNrJI2isN2EwbCq/2SgM2YHoEQcPvYN9V32eo745uMXm+aUaMs2HLGoNmvKDSbyU24mhSlXcMzANHC7u5FgIiLyYFVb47usUoC72yklq0KwRqs1yn/9fCMc/QtYue2Swdrt5bsMJkmybyY+yco2p1CpNtAqkGCZw/Ng7rhWcHchNXAAWCSr+VFHq44q4rsXs4G7YMm47Skg2+1eW379x8Id/bC9TS04ZC4tTx+LPdaG6D2h/NFr6BWya59uF3sG93R7cY5loIiHBqD//KOwZmXAsBEf+eZY9prmL40/9rYUXPbBZ44gqg7tIN11SDBE7CswM5YSZnp/cWYNBNR2lJ23duPkpq0a7cWtbZZgvfQPA72DdTrrypxZ673n/Pskfp/7UwHPK9vYrCusowk7NTpqO0JAU20LqTBtfNKVfeVL9n2SMuemazuEphxAIbaF2UK28qN74LtKGODMMb3wVaje8CLQAAAABBMRsZgmI2MsNTLSsExWxkRfR3fYanWlbHlkFPCIrZyEm7wtGK6O/6y9n04wxPtaxNfq61ji2Dns8cmIdREsJKECPZU9Nw9HiSQe9hVdeuLhTmtTfXtZgcloSDBVmYG4IYqQCb2/otsJrLNqldXXfmHGxs/98/QdSeDlrNoiSEleMVn4wgRrKnYXepvqbh6PHn0PPoJIPew2Wyxdqqrl1d659GRCjMa29p/XB2rmsxOe9aKiAsCQcLbTgcEvM2Rt+yB13GcVRw7TBla/T38yq7tsIxonWRHIk0oAeQ+7yfF7qNhA553qklOO+yPP9583O+SOhqfRvFQTwq3lgFT3nwRH5i6YctT8LGHFTbAYoVlEC7Do2D6COmwtk4vw3FoDhM9Lshj6eWCs6WjRMJAMxcSDHXRYti+m7KU+F3VF27uhVsoKPWP42Ilw6WkVCY194RqczH0vrh7JPL+vVc12JyHeZ5a961VECfhE9ZWBIOFhkjFQ/acDgkm0EjPadr/WXmWuZ8JQnLV2Q40E6jrpEB4p+KGCHMpzNg/bwqr+Ekre7QP7QtgxKfbLIJhqskSMnqFVPQKUZ++2h3ZeL2eT8vt0gkNnQbCR01KhIE8rxTS7ONSFJw3mV5Me9+YP7z5ue/wv3+fJHQ1T2gy8z6NoqDuweRmnhUvLE5ZaeoS5iDOwqpmCLJ+rUJiMuuEE9d718ObPRGzT/ZbYwOwnRDElrzAiNB6sFwbMGAQXfYR9c2lwbmLY7FtQClhIQbvBqKQXFbu1pomOh3Q9nZbFoeTy0VX342DJwtGyfdHAA+EgCYuVMxg6CQYq6L0VO1khbF9N1X9O/ElKfC79WW2fbpvAeuqI0ct2veMZwq7yqF7XlryqxIcNNvG134LipG4eE23magB8V/Y1ToVCJl803l87ICpMKpG2eRhDAmoJ8puK7F5Pmf3v06zPPWe/3oz7xrqYD9WrKZPgmfsn84hKuwJBws8RUHNTJGKh5zdzEHtOFwSPXQa1E2g0Z6d7JdY07X+ssP5uHSzLXM+Y2E1+BKEpavCyONtshwoJ2JQbuERl0jAwdsOBrEPxUxhQ4OKEKYT2cDqVR+wPp5VYHLYkwfxTiBXvQjmJ2nDrPclhWqGwBU5VoxT/yZYmLX2FN5zhdP4UlWfvpQlS3Xe9QczGITio0tUruWNJHoux/Q2aAG7PN+Xq3CZUdukUhsL6BTdeg2EjqpBwkjalQkCCtlPxHkeaeWpUi8j2YbkaQnKoq94LzL8qGN0Oti3v3AI+/m2b3hvBT80KcNP4OKJn6ykT+5JNBw+BXLaTtG5kJ6d/1btWtl3PRafsU3CVPudjhI97GuCbjwnxKhM8w/inL9JJMAAAAAN2rCAW7UhANZvkYC3KgJB+vCywayfI0EhRZPBbhREw6PO9EP1oWXDeHvVQxk+RoJU5PYCAotngo9R1wLcKMmHEfJ5B0ed6IfKR1gHqwLLxubYe0awt+rGPW1aRnI8jUS/5j3E6YmsRGRTHMQFFo8FSMw/hR6jrgWTeR6F+BGTTjXLI85jpLJO7n4Czo87kQ/C4SGPlI6wDxlUAI9WBdeNm99nDc2w9o1AakYNIS/VzGz1ZUw6mvTMt0BETOQ5Wskp4+pJf4x7yfJWy0mTE1iI3snoCIimeYgFfMkISi0eCof3rorRmD8KXEKPij0HHEtw3azLJrI9S6tojcvwI2acPfnWHGuWR5zmTPcchwlk3crT1F2cvEXdEWb1XV43Il+T7ZLfxYIDX0hYs98pHSAeZMeQnjKoAR6/crGe7AuvGyHRH5t3vo4b+mQ+m5shrVrW+x3agJSMWg1OPNpCH+vYj8VbWNmqythUcHpYNTXpmXjvWRkugMiZo1p4Gcgy9dIF6EVSU4fU0t5dZFK/GPeT8sJHE6St1pMpd2YTZiaxEav8AZH9k5ARcEkgkREMs1Bc1gPQCrmSUIdjItDUGjxVGcCM1U+vHVXCda3VozA+FO7qjpS4hR8UNV+vlHoOeJa31MgW4btZlmxh6RYNJHrXQP7KVxaRW9ebS+tX4AbNeG3cffg7s+x4tmlc+Ncszzma9n+5zJnuOUFDXrkOEom7w8g5O5WnqLsYfRg7eTiL+jTiO3pijar671caerwuBP9x9LR/J5sl/6pBlX/LBAa+ht62PtCxJ75da5c+EjpAPN/g8LyJj2E8BFXRvGUQQn0oyvL9fqVjffN/0/2YF142Vc3utgOifzaOeM+27z1cd6Ln7Pf0iH13eVLN9zYDGvX72ap1rbY79SBsi3VBKRi0DPOoNFqcObTXRok0hD+XsUnlJzEfiraxklAGMfMVlfC+zyVw6KC08GV6BHAqK9Ny5/Fj8rGe8nI8RELyXQHRMxDbYbNGtPAzy25As5Alq+Rd/xtkC5CK5IZKOmTnD6mlqtUZJfy6iKVxYDglPjHvJ/PrX6elhM4nKF5+p0kb7WYEwV3mUq7MZt90fOaMDWJjQdfS4xe4Q2OaYvPj+ydgIrb90KLgkkEibUjxoiIZJqDvw5YguawHoDR2tyBVMyThGOmUYU6GBeHDXLVhqDQ4qmXuiCozgRmqvlupKt8eOuuSxIprxKsb60lxq2sGIHxpy/rM6Z2VXWkQT+3pcQp+KDzQzqhqv18o52XvqLQc8S15xkGtL6nQLaJzYK3DNvNsjuxD7NiD0mxVWWLsGgi17tfSBW6BvZTuDGckbm0it68g+AcvdpeWr/tNJi+AAAAAGVnvLiLyAmq7q+1EleXYo8y8N433F9rJbk4153vKLTFik8IfWTgvW8BhwHXuL/WSt3YavIzd9/gVhBjWJ9XGVD6MKXoFJ8Q+nH4rELIwHvfrafHZ0MIcnUmb87NcH+tlRUYES37t6Q/ntAYhyfozxpCj3OirCDGsMlHegg+rzKgW8iOGLVnOwrQAIeyaThQLwxf7Jfi8FmFh5flPdGHhmW04DrdWk+Pzz8oM3eGEOTq43dYUg3Y7UBov1H4ofgr8MSfl0gqMCJaT1ee4vZvSX+TCPXHfadA1RjA/G1O0J81K7cjjcUYlp+gfyonGUf9unwgQQKSj/QQ9+hIqD1YFJtYP6gjtpAdMdP3oYlqz3YUD6jKrOEHf76EYMMG0nCgXrcXHOZZuKn0PN8VTIXnwtHggH5pDi/Le2tId8OiDw3Lx2ixcynHBGFMoLjZ9ZhvRJD/0/x+UGbuGzfaVk0nuQ4oQAW2xu+wpKOIDBwasNuBf9dnOZF40iv0H26TA/cmO2aQmoOIPy+R7ViTKVRgRLQxB/gM36hNHrrP8abs35L+ibguRmcXm1QCcCfsu0jwcd4vTMkwgPnbVedFY5ygP2v5x4PTF2g2wXIPinnLN13krlDhXED/VE4lmOj2c4iLrhbvNxb4QIIEnSc+vCQf6SFBeFWZr9fgi8qwXDM7tlntXtHlVbB+UEfVGez/bCE7YglGh9rn6TLIgo6OcNSe7Six+VGQX1bkgjoxWDqDCY+n5m4zHwjBhg1tpjq1pOFAvcGG/AUvKUkXSk71r/N2IjKWEZ6KeL4rmB3ZlyBLyfR4Lq5IwMAB/dKlZkFqHF6W93k5Kk+Xlp9d8vEj5QUZa01gftf1jtFi5+u23l9SjgnCN+m1etlGAGi8IbzQ6jHfiI9WYzBh+dYiBJ5qmr2mvQfYwQG/Nm60rVMJCBWaTnId/ynOpRGGe7d04ccPzdkQkqi+rCpGERk4I3algHVmxtgQAXpg/q7PcpvJc8oi8aRXR5YY76k5rf3MXhFFBu5NdmOJ8c6NJkTc6EH4ZFF5L/k0HpNB2rEmU7/WmuvpxvmzjKFFC2IO8BkHaUyhvlGbPNs2J4Q1mZKWUP4uLpm5VCb83uieEnFdjHcW4TTOLjapq0mKEUXmPwMggYO7dpHg4xP2XFv9WelJmD5V8SEGgmxEYT7Uqs6Lxs+pN344QX/WXSbDbrOJdnzW7srEb9YdWQqxoeHkHhTzgXmoS9dpyxOyDnerXKHCuTnGfgGA/qmc5ZkVJAs2oDZuURyOpxZmhsJx2j4s3m8sSbnTlPCBBAmV5rixe0kNox4usRtIPtJDLVlu+8P22+mmkWdRH6mwzHrODHSUYblm8QYF3gAAAAB3BzCW7g5hLJkJUboHbcQZcGr0j+ljpTWeZJWjDtuIMnncuKTg1ekel9LZiAm2TCt+sXy957gtB5C/HZEdtxBkarAg8vO5cUiEvkHeGtrUfW3d5Ov01LVRg9OFxxNsmFZka6jA/WL5eoplyewUAVxPYwZs2foPPWONCA31O24gyExpEF7VYEHkomdxcjwD5NFLBNRH0g2F/aUKtWs1taj6QrKYbNu7ydasvPlAMths40XfXHXc1g3Pq9E9WSbZMKxR3gA6yNdRgL/QYRYhtPS1VrPEI8+6lZm4vaUPKAK4nl8FiAjGDNmysQvpJC9vfIdYaEwRwWEdq7ZmLT123EGQAdtxBpjSILzv1RAqcbGFiQa2tR+fv+Sl6LjUM3gHyaIPAPk0lgmojuEOmBh/ag27CG09LZFkbJfmY1wBa2tR9BxsYWKFZTDY8mIATmwGle0bAaV7ggj0wfUPxFdlsNnGErfpUIu+uOr8uYh8Yt0d3xXaLUmM03zz+9RMZU2yYVg6tVHOo7wAdNS7MOJK36VBPdiV16TRxG3T1vT7Q2npajRu2fytZ4hG2mC40EQELXMzAx3lqgpMX90NfMlQBXE8JwJBqr4LEBDJDCCGV2i1JSBvhbO5ZtQJzmHkn17e+Q4p2cmYsNCYIsfXqLRZsz0XLrQNgbe9XDvAumyt7biDIJq/s7YDtuIMdLHSmurVRzmd0nevBNsmFXPcFoPjYwsSlGQ7hA1taj56alqo5A7PC5MJ/50KAK4nfQeesfAPk0SHCKPSHgHyaGkGwv73YlddgGVnyxlsNnFuawbn/tQbdonTK+AQ2npaZ91KzPm532+Ovu/5F7e+Q2CwjtXW1qPoodGTfjjYwsRP3/JS0btn8aa8V2c/tQbdSLI2S9gNK9qvChtMNgNK9kEEemDfYO/DqGffVTFuju9Gab55y2GzjLxmgxolb9KgUmjiNswMd5W7C0cDIgIWuVUFJi/Fuju+sr0LKCu0WpJcs2oEwtf/p7XQzzEs2Z6LW96uHZtkwrDsY/ImdWqjnAJtkwqcCQap6w42P3IHZ4UFAFcTlb9KguK4ehR7sSuuDLYbOJLSjpvl1b4NfNzvtwvb3yGG09LU8dTiQmjds/gf2oNugb4Wzfa5JltvsHfhGLdHd4gIWub/D2pwZgY7yhEBC1yPZZ7/+GKuaWFr/9MWbM9FoArieNcN0u5OBINUOQOzwqdnJmHQYBb3SWlHTT5ud9uu0WpK2dZa3EDfC2Y32DvwqbyuU967nsVHss9/MLX/6b298hzKusKKU7OTMCS0o6a60DYFzdcGk1TeVykj2We/s2Z6LsRhSrhdaBsCKm8rlLQLvjfDDI6hWgXfGy0C740AAAAAGRsxQTI2YoIrLVPDZGzFBH139EVWWqeGT0GWx8jZigjRwrtJ+u/oiuP02custU8Mta5+TZ6DLY6HmBzPSsISUVPZIxB49HDTYe9Bki6u11U3teYUHJi11wWDhJaCG5hZmwCpGLAt+tupNsua5nddXf9sbBzUQT/fzVoOnpWEJKKMnxXjp7JGIL6pd2Hx6OGm6PPQ58PegyTaxbJlXV2uqkRGn+tva8wodnD9aTkxa64gKlrvCwcJLBIcOG3fRjbzxl0Hsu1wVHH0a2Uwuyrz96IxwraJHJF1kAegNBefvPsOhI26JaneeTyy7zhz83n/auhIvkHFG31Y3io88HlPBelifkTCTy2H21QcxpQVigGNDrtApiPog7842cI4oMUNIbv0TAqWp48TjZbOXMwACUXXMUhu+mKLd+FTyrq7XVSjoGwViI0/1pGWDpfe15hQx8ypEezh+tL1+suTcmLXXGt55h1AVLXeWU+EnxYOElgPFSMZJDhw2j0jQZtl/WunfOZa5lfLCSVO0DhkAZGuoxiKn+Izp8whKrz9YK0k4a+0P9DunxKDLYYJsmzJSCSr0FMV6vt+RiniZXdoLz959jYkSLcdCRt0BBIqNUtTvPJSSI2zeWXecGB+7zHn5vP+/v3Cv9XQkXzMy6A9g4o2+pqRB7uxvFR4qKdlOTuDmEsimKkKCbX6yRCuy4hf711PRvRsDm3ZP810wg6M81oSQ+pBIwLBbHDB2HdBgJc210eOLeYGpQC1xbwbhIRxQYoaaFq7W0N36JhabNnZFS1PHgw2fl8nGy2cPgAc3bmYABKggzFTi65ikJK1U9Hd9MUWxO/0V+/Cp5T22ZbVrge86bccjaicMd5rhSrvKspree3TcEis+F0bb+FGKi5m3jbhf8UHoFToVGNN82UiArLz5RupwqQwhJFnKZ+gJuTFrrj93p/51vPMOs/o/XuAqWu8mbJa/bKfCT6rhDh/LBwksDUHFfEeKkYyBzF3c0hw4bRRa9D1ekaDNmNdsnfL+tdO0uHmD/nMtczg14SNr5YSSraNIwudoHDIhLtBiQMjXUYaOGwHMRU/xCgODoVnT5hCflSpA1V5+sBMYsuBgTjFH5gj9F6zDqedqhWW3OVUABv8TzFa12Jimc55U9hJ4U8XUPp+VnvXLZVizBzULY2KEzSWu1Ifu+iRBqDZ0F5+8+xHZcKtbEiRbnVToC86EjboIwkHqQgkVGoRP2Urlqd55I+8SKWkkRtmvYoqJ/LLvODr0I2hwP3eYtnm7yMUvOG9DafQ/CaKgz8/kbJ+cNAkuWnLFfhC5kY7W/13etxla7XFflr07lMJN/dIOHa4Ca6xoRKf8Io/zDOTJP1yAAAAAAHCajcDhNRuAka+WQcJqNwGy8LrBI18sgVPFoUOE1G4D9E7jw2XhdYMVe/hCRr5ZAjYk1MKni0KC1xHPRwmo3Ad5MlHH6J3Hh5gHSkbLwusGu1hmxir38IZabX1EjXyyBP3mP8RsSamEHNMkRU8WhQU/jAjFriOehd65E04TUbgOY8s1zvJko46C/i5P0TuPD6GhAs8wDpSPQJQZTZeF1g3nH1vNdrDNjQYqQExV7+EMJXVszLTa+ozEQHdJGvlkCWpj6cn7zH+Ji1bySNiTUwioCd7IOaZIiEk8xUqeLQoK7reHyn8YEYoPgpxLXEc9CyzdsMu9ciaLzeirXCajcBxWOf3cx5ZrnLcM5l3kyUcdlFPK3QX8XJ11ZtFfonceH9Ltk99DQgWfM9iIXmAdKR4Qh6TegSgynvGyv1svC6wbX5Eh284+t5u+pDpa7WGbGp37FtoMVICafM4NWKvfwhjbRU/YSurZmDpwVFlptfUZGS942YiA7pn4GmNSNfLIEkVoRdLUx9OSpF1eU/eY/xOHAnLTFq3kk2Y3aVGxJqYRwbwr0VATvZEgiTBQc0yREAPWHNCSeYqQ4uMHVTxaFBVMwJnV3W8Pla31glT+MCMUjqqu1B8FOJRvn7VWuI56FsgU99ZZu2GWKSHsV3rkTRcKfsDXm9FWl+tL23hNRuA4Pdxt+Kxz+7jc6XZ5jyzXOf+2WvluGcy5HoNBe8mSjju5CAP7KKeVu1g9GHoL+Lk6e2I0+urNorqaVy9/RO48PzR0sf+l2ye/1UGqfoaECz72Hob+Z7EQvhcrnXzAOlI8sKDf/CEPSbxRlcR9AlBlPXLK6P3jZX69k//zdl4XWDYujdX2vyJDts+4znecfW837Ofi931IdLcN0vl12sM2NapZu/U79i21S2ygdBipATRoM4z0+ZwatIkGl3FXv4QxJyUJ8baKn7HGEBJwldWzMOVPPvB04KiwBHolctNr6jKj8WfyMl7xskLEfHMRAd0zYZtQ8/A0xrOArktka+WQJBt/HeSK0Iuk+koGZamPpyXZFSrlSLq8pTggMWfvMf4nn6tz5w4E5ad+nmhmLVvJJl3BRObMbtKmvPRfY2JNTCMS18Hjg3hXo/Pi2mKgJ3si0L324kESYKIxiO1g5pkiIJYDr+AHrDmgdza0YSTzFSFUaZjhxcYOobVcg2p4tCgqCC6l6pmBM6rpG75rut4fK8pEkutb6wSrK3GJafxgRimM+svpHVVdqW3P0Gg+CnEoTpD86N8/aqivpedtcRz0LQGGee2QKe+t4LNibLN2wyzD7E7sUkPYrCLZVW71yJouhVIX7hT9ga5kZwxvN6KtL0c4IO/Wl7avpg07QAAAAC4vGdlqgnIixK1r+6PYpdXN97wMiVrX9yd1zi5xbQo730IT4pvveBk1wGHAUrWv7jyatjd4N93M1hjEFZQGVef6KUw+voQnxRCrPhx33vAyGfHp611cghDzc5vJpWtf3AtERgVP6S3+4cY0J4az+gnonOPQrDGIKwIekfJoDKvPhiOyFsKO2e1socA0C9QOGmX7F8MhVnw4j3ll4dlhofR3TrgtM+PT1p3Myg/6uQQhlJYd+NA7dgN+FG/aPAr+KFIl5/EWiIwKuKeV09/SW/2x/UIk9VAp31t/MAYNZ/QTo0jtyuflhjFJyp/oLr9RxkCQSB8EPSPkqhI6PebFFg9I6g/WDEdkLaJoffTFHbPaqzKqA++fwfhBsNghF6gcNLmHBe39Km4WUwV3zzRwueFaX6A4HvLLw7Dd0hryw0PonOxaMdhBMcp2bigTERvmPX80/+Q7mZQflbaNxsOuSdNtgVAKKSw78YcDIijgduwGjln138r0niRk24f9Dsm9wODmpBmkS8/iCmTWO20RGBUDPgHMR5NqN+m8c+6/pLf7EYuuIlUmxdn7CdwAnHwSLvJTC/e2/mAMGNF51VrP6Cc04PH+cE2aBd5ig9y5F03y1zhUK5OVP9A9uiYJa6LiHMWN+8WBIJA+Lw+J50h6R8kmVV4QYvg168zXLDK7Vm2O1Xl0V5HUH6w/+wZ1WI7IWzah0YJyDLp53COjoIo7Z7UkFH5sYLkVl86WDE6p48Jgx8zbuYNhsEItTqmbb1A4aQF/IbBF0kpL6/1TkoyInbzip4Rlpgrvnggl9kdePTJS8BIri7S/QHAakFmpfeWXhxPKjl5XZ+Wl+Uj8fJNaxkF9dd+YOdi0Y5f3rbrwgmOUnq16TdoAEbZ0LwhvIjfMeowY1aPItb5YZpqngQHvaa9vwHB2K20bjYVCAlTHXJOmqXOKf+3e4YRD8fhdJIQ2c0qrL6oOBkRRoCldiPYxmZ1YHoBEHLPrv7Kc8mbV6TxIu8Ylkf9rTmpRRFezHZN7gbO8Ylj3EQmjWT4Qej5L3lRQZMeNFMmsdrrmta/s/nG6QtFoYwZ8A5ioUxpBzybUb6EJzbblpKZNS4u/lAmVLmZnuje/IxdcRI04RZ3qTYuzhGKSasDP+ZFu4OBIOPgkXZbXPYTSelZ/fFVPphsggYh1D5hRMaLzqp+N6nP1n9BOG7DJl18domzxMru1lkd1m/hobEK8xQe5EuoeYETy2nXq3cOsrnCoVwBfsY5nKn+gCQVmeU2oDYLjhxRboZmFqc+2nHCLG/eLJTTuUkJBIHwsbjmlaMNSXsbsS4eQ9I+SPtuWS3p2/bDUWeRpsywqR90DM56ZrlhlN4FBvEAAAAAAAAAAAMAAAAEAAQACAAEAAQAAAAEAAUAEAAIAAQAAAAEAAYAIAAgAAQAAAAEAAQAEAAQAAUAAAAIABAAIAAgAAUAAAAIABAAgACAAAUAAAAIACAAgAAAAQUAAAAgAIAAAgEABAUAAAAgAAIBAgEAEAUAQYHJAAu2EAECAwQEBQUGBgYGBwcHBwgICAgICAgICQkJCQkJCQkKCgoKCgoKCgoKCgoKCgoKCwsLCwsLCwsLCwsLCwsLCwwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDwAAEBESEhMTFBQUFBUVFRUWFhYWFhYWFhcXFxcXFxcXGBgYGBgYGBgYGBgYGBgYGBkZGRkZGRkZGRkZGRkZGRkaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHB0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0AAQIDBAUGBwgICQkKCgsLDAwMDA0NDQ0ODg4ODw8PDxAQEBAQEBAQERERERERERESEhISEhISEhMTExMTExMTFBQUFBQUFBQUFBQUFBQUFBUVFRUVFRUVFRUVFRUVFRUWFhYWFhYWFhYWFhYWFhYWFxcXFxcXFxcXFxcXFxcXFxgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxscwCcAAMAsAAABAQAAHgEAAA8AAABALAAAQC0AAAAAAAAeAAAADwAAAAAAAADALQAAAAAAABMAAAAHAAAAAAAAAAwACACMAAgATAAIAMwACAAsAAgArAAIAGwACADsAAgAHAAIAJwACABcAAgA3AAIADwACAC8AAgAfAAIAPwACAACAAgAggAIAEIACADCAAgAIgAIAKIACABiAAgA4gAIABIACACSAAgAUgAIANIACAAyAAgAsgAIAHIACADyAAgACgAIAIoACABKAAgAygAIACoACACqAAgAagAIAOoACAAaAAgAmgAIAFoACADaAAgAOgAIALoACAB6AAgA+gAIAAYACACGAAgARgAIAMYACAAmAAgApgAIAGYACADmAAgAFgAIAJYACABWAAgA1gAIADYACAC2AAgAdgAIAPYACAAOAAgAjgAIAE4ACADOAAgALgAIAK4ACABuAAgA7gAIAB4ACACeAAgAXgAIAN4ACAA+AAgAvgAIAH4ACAD+AAgAAQAIAIEACABBAAgAwQAIACEACAChAAgAYQAIAOEACAARAAgAkQAIAFEACADRAAgAMQAIALEACABxAAgA8QAIAAkACACJAAgASQAIAMkACAApAAgAqQAIAGkACADpAAgAGQAIAJkACABZAAgA2QAIADkACAC5AAgAeQAIAPkACAAFAAgAhQAIAEUACADFAAgAJQAIAKUACABlAAgA5QAIABUACACVAAgAVQAIANUACAA1AAgAtQAIAHUACAD1AAgADQAIAI0ACABNAAgAzQAIAC0ACACtAAgAbQAIAO0ACAAdAAgAnQAIAF0ACADdAAgAPQAIAL0ACAB9AAgA/QAIABMACQATAQkAkwAJAJMBCQBTAAkAUwEJANMACQDTAQkAMwAJADMBCQCzAAkAswEJAHMACQBzAQkA8wAJAPMBCQALAAkACwEJAIsACQCLAQkASwAJAEsBCQDLAAkAywEJACsACQArAQkAqwAJAKsBCQBrAAkAawEJAOsACQDrAQkAGwAJABsBCQCbAAkAmwEJAFsACQBbAQkA2wAJANsBCQA7AAkAOwEJALsACQC7AQkAewAJAHsBCQD7AAkA+wEJAAcACQAHAQkAhwAJAIcBCQBHAAkARwEJAMcACQDHAQkAJwAJACcBCQCnAAkApwEJAGcACQBnAQkA5wAJAOcBCQAXAAkAFwEJAJcACQCXAQkAVwAJAFcBCQDXAAkA1wEJADcACQA3AQkAtwAJALcBCQB3AAkAdwEJAPcACQD3AQkADwAJAA8BCQCPAAkAjwEJAE8ACQBPAQkAzwAJAM8BCQAvAAkALwEJAK8ACQCvAQkAbwAJAG8BCQDvAAkA7wEJAB8ACQAfAQkAnwAJAJ8BCQBfAAkAXwEJAN8ACQDfAQkAPwAJAD8BCQC/AAkAvwEJAH8ACQB/AQkA/wAJAP8BCQAAAAcAQAAHACAABwBgAAcAEAAHAFAABwAwAAcAcAAHAAgABwBIAAcAKAAHAGgABwAYAAcAWAAHADgABwB4AAcABAAHAEQABwAkAAcAZAAHABQABwBUAAcANAAHAHQABwADAAgAgwAIAEMACADDAAgAIwAIAKMACABjAAgA4wAIAAAABQAQAAUACAAFABgABQAEAAUAFAAFAAwABQAcAAUAAgAFABIABQAKAAUAGgAFAAYABQAWAAUADgAFAB4ABQABAAUAEQAFAAkABQAZAAUABQAFABUABQANAAUAHQAFAAMABQATAAUACwAFABsABQAHAAUAFwAFAEHg2QALTQEAAAABAAAAAQAAAAEAAAACAAAAAgAAAAIAAAACAAAAAwAAAAMAAAADAAAAAwAAAAQAAAAEAAAABAAAAAQAAAAFAAAABQAAAAUAAAAFAEHQ2gALZQEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAUAAAAGAAAABgAAAAcAAAAHAAAACAAAAAgAAAAJAAAACQAAAAoAAAAKAAAACwAAAAsAAAAMAAAADAAAAA0AAAANAEGA3AALIwIAAAADAAAABwAAAAAAAAAQERIACAcJBgoFCwQMAw0CDgEPAEG03AALaQEAAAACAAAAAwAAAAQAAAAFAAAABgAAAAcAAAAIAAAACgAAAAwAAAAOAAAAEAAAABQAAAAYAAAAHAAAACAAAAAoAAAAMAAAADgAAABAAAAAUAAAAGAAAABwAAAAgAAAAKAAAADAAAAA4ABBtN0AC5oCAQAAAAIAAAADAAAABAAAAAYAAAAIAAAADAAAABAAAAAYAAAAIAAAADAAAABAAAAAYAAAAIAAAADAAAAAAAEAAIABAAAAAgAAAAMAAAAEAAAABgAAAAgAAAAMAAAAEAAAABgAAAAgAAAAMAAAAEAAAABgAABuZWVkIGRpY3Rpb25hcnkAc3RyZWFtIGVuZAAAZmlsZSBlcnJvcgBzdHJlYW0gZXJyb3IAZGF0YSBlcnJvcgBpbnN1ZmZpY2llbnQgbWVtb3J5AGJ1ZmZlciBlcnJvcgBpbmNvbXBhdGlibGUgdmVyc2lvbgAAAAAoLwAAOC8AAEMvAABELwAATy8AAFwvAABnLwAAey8AAIgvAABDLwAAMS4yLjExAEHQ3wALA9AxUA=="),Dd,ra,_A=Uint8Array.BYTES_PER_ELEMENT,Hv={bytesReceived:"br",frameDropped:"fd",frameReceived:"fr",googJitterReceived:"jr",isAudioMute:"am",isFreeze:"fz",mediaType:"mt",packetsLost:"pl",packetsReceived:"pr",peerId:"pid",id:"id",ssrc:"ssrc",timestamp:"ts",type:"tp",frameRateInput:"fi",frameRateSent:"fs",googRtt:"rt",isVideoMute:"vm"},Kv={stats:"sts",state:"st",stream_id:"stid",session_id:"seid",stream_type:"stt",app_id:"aid",channel_key:"ck",channel_name:"cn",sdk_version:"sv",browser:"b",process_id:"pcid",mode:"m",codec:"c",role:"r",has_changed_gateway:"hcg",ap_response:"ar",extends:"es",details:"d",features:"ft",p2p_id:"ppid",sdp:"sdp",audio:"a",video:"v",attributes:"at",hq:"h",lq:"l",stereo:"str",speech:"spe",extend:"e",pingpongElapse:"ppe"},Wv={_message:"m",_type:"t",_id:"id"},jv={join_v2:"j2",publish:"pub",publish_related_stats:"prs",ping:"pi",traffic_stats:"ts",ping_back:"pib",publish_stats:"pubs"},bd;class Vv{constructor(){}init(){return Ee(this,null,function*(){bd||(bd=(yield(()=>Ee(this,null,function*(){return ra||(ra=yield dn()),{zlibCompress:e=>{var r,i=new Uint8Array(e);const o=_A*i.byteLength;e=ra._malloc(o);const c=ra._malloc(3*o);for(let h=0;h<o;h++)ra.HEAP8[e/_A+h]=i[h];return i=ra._zlibCompress(e,o,c),i=new Uint8Array(en(r=ra.HEAP8).call(r,c,c+i)),ra._free(e),ra._free(c),i}}}))()).zlibCompress),this.zlibCompress=bd})}msgPackCompress(e){return Dv.encode(e)}compress(e){let r=at(),i=this.compressKeyAndValue(JSON.parse(ht(e))),o=this.msgPackCompress(i);var c=this.zlibCompress(o);return c=new Uint8Array([49,49,49,50,...co(c)]),{origin:Dn({},e),originLength:ht(e).length,shortKeyAndValue:i,msgpackSer:o,compressed:c,compressedLength:c.length,time:at()-r}}compressKeyAndValue(e){return this._ObjectKeyCompress(this._typeCompress(e))}_typeCompress(e){let r=e._type;return r&&(e._type=jv[r]||r),e}_ObjectKeyCompress(e){let r=e._message;if(r){let i=r.stats;i&&(r.stats=this._statsCompress(i)),e._message=this._messageCompress(r)}return this._reportCompress(e)}_statsCompress(e){return this._keyCompress(e,Hv)}_messageCompress(e){return this._keyCompress(e,Kv)}_reportCompress(e){return this._keyCompress(e,Wv)}_keyCompress(e,r){let i={},o=vr(e);return Ul(o).call(o,(c,h)=>(c=e[h],r[h]?i[r[h]]=c:i[h]=c,i),i),i}}class Yv extends mn{constructor(e){super();this.lowPriorityQueue=[],this.highPriorityQueue=[],this.AgoraWebSocketManager=e}get queue(){return[...this.highPriorityQueue,...this.lowPriorityQueue]}reset(){this.lowPriorityQueue=[],this.highPriorityQueue=[]}pushMessage(e,r=!1){r?this.highPriorityQueue.push(e):this.lowPriorityQueue.push(e),this.sendMessage()}sendMessage(){let e=this.queue.length;_s(()=>{this._sendMessage()},5>e?15*e:60+3*(e-4))}_sendMessage(){var e;if(this.queue.length){var r=this.AgoraWebSocketManager.getConnection();if(r&&r.readyState===1){var i=this.queue.shift();return _r(e=this.lowPriorityQueue).call(e,i)?this.lowPriorityQueue.shift():this.highPriorityQueue.shift(),r.send(i.compressed),i}}}}class Od extends mn{constructor(e,r,i=!1){super();this.currentURLIndex=this.connectionID=0,this.reconnectMode="tryNext",this._state="closed",this.reconnectCount=0,this.isCompressorInitSuccess=!1,this.wsDeflateLength=this.wsInflateLength=0,this.name=e,this.retryConfig=r,this.useCompress=i}get url(){return this.websocket?this.websocket.url:null}get state(){return this._state}set state(e){e!==this._state&&(this._state=e,this._state==="reconnecting"?this.emit(gr.RECONNECTING,this.reconnectReason):this._state==="connected"?this.emit(gr.CONNECTED):this._state==="closed"?this.emit(gr.CLOSED):this._state==="failed"&&this.emit(gr.FAILED))}getConnection(){return this.websocket||void 0}init(e){let r=(i,o)=>{this.urls=e;const c=this.urls[this.currentURLIndex];this.state="connecting",this.messageSender=new Yv(this),this.createWebSocketConnection(c).then(i).catch(o),this.once(gr.CLOSED,()=>o(new ue(oe.WS_DISCONNECT))),this.once(gr.CONNECTED,()=>i())};return new it((i,o)=>{this.compressor=new Vv,this.compressor.init().then(()=>{var c;z.debug("websocket compressor initialized successfully"),this.isCompressorInitSuccess=!0,this.compress=Ti(c=this.compressor.compress).call(c,this.compressor),r(i,o)}).catch(()=>{z.debug("websocket compressor failed to initialize"),r(i,o)})})}close(e,r){if(this.currentURLIndex=0,this.reconnectCount=0,this.websocket){this.websocket.onclose=null,this.websocket.onopen=null,this.websocket.onmessage=null;let i=this.websocket;r?_s(()=>i.close(),500):i.close(),this.websocket=void 0}this.state=e?"failed":"closed"}reconnect(e,r){if(!this.websocket)return void z.warning("[".concat(this.name,"] can not reconnect, no websocket"));e!==void 0&&(this.reconnectMode=e),z.debug("[".concat(this.name,"] reconnect is triggered initiative")),e=this.websocket.onclose,this.websocket.onclose=null,this.websocket.close(),e&&Ti(e).call(e,this.websocket)({code:9999,reason:r})}sendMessage(e,r=!1){if(!this.websocket||this.websocket.readyState!==WebSocket.OPEN)throw new ue(oe.WS_ABORT,"websocket is not ready");try{let i=null;if(this.isCompressorInitSuccess&&this.useCompress&&Xe.WEBSOCKET_COMPRESS)i=this.compress(e),this.setWsInflateData(i);else{if(this.isCompressorInitSuccess&&this.useCompress){let c=this.compress(e);this.setWsInflateData(c)}let o=ht(e);i={compressed:o,compressedLength:o.length,origin:e}}r?this.websocket.send(i.compressed):this.messageSender.pushMessage(i)}catch(i){throw new ue(oe.WS_ERR,"send websocket message error"+i.toString())}}setWsInflateData(e){this.wsDeflateLength+=e.originLength,this.wsInflateLength+=e.compressedLength}getWsInflateData(){let e=this.wsInflateLength,r=this.wsDeflateLength;return this.clearWsInflateData(),{wsInflateLength:e,wsDeflateLength:r}}clearWsInflateData(){this.wsDeflateLength=this.wsInflateLength=0}createWebSocketConnection(e){return Ee(this,null,function*(){let r=this.connectionID+=1;return new it((i,o)=>{var c,h;this.websocket&&(this.websocket.onclose=null,this.websocket.close()),Xe.GATEWAY_WSS_ADDRESS&&Gc(c=this.name).call(c,"gateway")&&(e=Xe.GATEWAY_WSS_ADDRESS),z.debug(ne(h="[".concat(this.name,"] start connect, url: ")).call(h,e));try{this.websocket=new WebSocket(e),this.websocket.binaryType="arraybuffer"}catch(x){var C;return c=new ue(oe.WS_ERR,"init websocket failed! Error: ".concat(x.toString())),z.error(ne(C="[".concat(this.name,"]")).call(C,c)),void o(c)}zi(5e3).then(()=>{r===this.connectionID&&this.websocket&&this.websocket.readyState!==WebSocket.OPEN&&this.websocket&&this.websocket.close()}),this.websocket.onopen=()=>{z.debug("[".concat(this.name,"] websocket opened:"),e),this.reconnectMode="retry",this.state="connected",this.reconnectCount=0,i()},this.websocket.onclose=x=>Ee(this,null,function*(){var Q,F,V,Y;if(z.debug(ne(Q=ne(F=ne(V=ne(Y="[".concat(this.name,"] websocket close ")).call(Y,this.websocket&&this.websocket.url,", code: ")).call(V,x.code,", reason: ")).call(F,x.reason,", current mode: ")).call(Q,this.reconnectMode)),this.reconnectCount<this.retryConfig.maxRetryCount){if(this.state==="connected"&&(this.reconnectReason=x.reason,this.state="reconnecting"),Q=zr(this,gr.WILL_RECONNECT,this.reconnectMode)||this.reconnectMode,Q=yield this.reconnectWithAction(Q),this.state==="closed")return void z.debug("[".concat(this.connectionID,"] ws is closed, no need to reconnect"));if(!Q)return o(new ue(oe.WS_DISCONNECT,"websocket reconnect failed: ".concat(x.code))),void this.close(!0);i()}else o(new ue(oe.WS_DISCONNECT,"websocket close: ".concat(x.code))),this.close()}),this.websocket.onmessage=x=>{this.emit(gr.ON_MESSAGE,x)}})})}reconnectWithAction(e,r){return Ee(this,null,function*(){var i,o;if(!r&&this.reconnectCount>=this.retryConfig.maxRetryCount||!this.urls||this.state==="closed"||(this.onlineReconnectListener||ss.networkState!==Qs.OFFLINE||(this.onlineReconnectListener=ss.onlineWaiter&&ss.onlineWaiter.then(()=>{this.onlineReconnectListener=void 0})),r=function(C,x){return Math.min(x.maxRetryTimeout,x.timeout*Math.pow(x.timeoutFactor,C))}(this.reconnectCount,this.retryConfig),z.debug(ne(i=ne(o="[".concat(this.name,"] wait ")).call(o,r,"ms to reconnect websocket, mode: ")).call(i,e)),yield it.race([zi(r),this.onlineReconnectListener||new it(()=>{})]),this.state==="closed"))return!1;this.reconnectCount+=1;try{if(e==="retry")yield this.createWebSocketConnection(this.urls[this.currentURLIndex]);else if(e==="tryNext"){var c,h;if(this.currentURLIndex+=1,this.currentURLIndex>=this.urls.length)return yield this.reconnectWithAction("recover");z.debug(ne(c=ne(h="[".concat(this.name,"] websocket url length: ")).call(h,this.urls.length," current index: ")).call(c,this.currentURLIndex)),yield this.createWebSocketConnection(this.urls[this.currentURLIndex])}else e==="recover"&&(z.debug("[".concat(this.name,"] request new urls")),this.urls=yield Kr(this,gr.REQUEST_NEW_URLS),this.currentURLIndex=0,yield this.createWebSocketConnection(this.urls[this.currentURLIndex]));return!0}catch(C){return z.error("[".concat(this.name,"] reconnect failed"),C.toString()),yield this.reconnectWithAction(e)}})}}class Jv{constructor(e){this.input=[],this.size=e}add(e){var r;this.input.push(e),this.input.length>this.size&&An(r=this.input).call(r,0,1)}mean(){var e;return this.input.length===0?0:Ul(e=this.input).call(e,(r,i)=>r+i)/this.input.length}}class zv extends mn{constructor(e){super();this._connectionState=Oi.CLOSED,this.openConnectionTime=at(),this.lastMsgTime=at(),this.uploadCache=[],this.rttRolling=new Jv(5),this.pingpongTimeoutCount=0,this.onWebsocketMessage=r=>{if(r.data instanceof ArrayBuffer)return void this.emit(nr.ON_BINARY_DATA,r.data);if(r=JSON.parse(r.data),this.lastMsgTime=at(),Object.prototype.hasOwnProperty.call(r,"_id")){let i="res-@".concat(r._id);this.emit(i,r._result,r._message)}else if(Object.prototype.hasOwnProperty.call(r,"_type")&&(this.emit(r._type,r._message),r._type===Cr.ON_NOTIFICATION&&this.handleNotification(r._message),r._type===Cr.ON_USER_BANNED))switch(r._message.error_code){case 14:this.close("UID_BANNED");break;case 15:this.close("IP_BANNED");break;case 16:this.close("CHANNEL_BANNED")}},this.clientId=e.clientId,this.spec=e,this.websocket=new Od("gateway-".concat(this.clientId),this.spec.retryConfig,!0),this.handleWebsocketEvents(),window.addEventListener("offline",()=>{this.connectionState===Oi.CONNECTED&&this.reconnect("retry",Yn.OFFLINE)})}get connectionState(){return this._connectionState}set connectionState(e){e!==this._connectionState&&(this._connectionState=e,e===Oi.CONNECTED?this.emit(nr.WS_CONNECTED):e===Oi.RECONNECTING?this.emit(nr.WS_RECONNECTING,this._websocketReconnectReason):e===Oi.CLOSED&&this.emit(nr.WS_CLOSED,this._disconnectedReason))}get currentURLIndex(){return this.websocket.currentURLIndex}get url(){return this.websocket?this.websocket.url:null}get rtt(){return this.rttRolling.mean()}request(e,r,i,o){return Ee(this,null,function*(){var c,h,C,x,Q;let F=be(6,"");var V={_id:F,_type:e,_message:r};let Y=this.websocket.connectionID;var $=()=>new it((te,ce)=>{if(this.connectionState===Oi.CONNECTED)return te();const Ae=()=>{this.off(nr.WS_CLOSED,Me),te()},Me=()=>{this.off(nr.WS_CONNECTED,Ae),ce(new ue(oe.WS_ABORT))};this.once(nr.WS_CONNECTED,Ae),this.once(nr.WS_CLOSED,Me)});if(this.connectionState!==Oi.CONNECTING&&this.connectionState!==Oi.RECONNECTING||e===br.JOIN||e===br.REJOIN||(yield $()),this.websocket.sendMessage(V,!0),!o){V=new it((te,ce)=>{let Ae=!1;const Me=(pt,Qt)=>{Ae=!0,te({isSuccess:pt==="success",message:Qt||{}}),this.off(nr.WS_CLOSED,et),this.off(nr.WS_RECONNECTING,et),this.emit(nr.REQUEST_SUCCESS,e,r)};this.once("res-@".concat(F),Me);const et=()=>{ce(new ue(oe.WS_ABORT,"type: ".concat(e))),this.off(nr.WS_CLOSED,et),this.off(nr.WS_RECONNECTING,et),this.off("res-@".concat(F),Me)};this.once(nr.WS_CLOSED,et),this.once(nr.WS_RECONNECTING,et),zi(Xe.SIGNAL_REQUEST_TIMEOUT).then(()=>{this.websocket.connectionID!==Y||Ae||(z.warning("ws request timeout, type: ".concat(e)),this.emit(nr.REQUEST_TIMEOUT,e,r))})}),o=null;try{o=yield V}catch(te){if(this.connectionState===Oi.CLOSED||e===br.LEAVE)throw new ue(oe.WS_ABORT);return!this.spec.forceWaitGatewayResponse||i?te.throw():e===br.JOIN||e===br.REJOIN?null:(yield $(),yield this.request(e,r))}return o.isSuccess?o.message:(i=Number(o.message.error_code||o.message.code),$=Xs(i),V=new ue(oe.UNEXPECTED_RESPONSE,ne(c="".concat($.desc,": ")).call(c,o.message.error_str),{code:i,data:o.message}),$.action==="success"?o.message:(z.warning(ne(h=ne(C=ne(x=ne(Q="[".concat(this.websocket.connectionID,"] unexpected response from type ")).call(Q,e,", error_code: ")).call(x,i,", message: ")).call(C,$.desc,", action: ")).call(h,$.action)),$.action==="failed"?V.throw():$.action==="quit"?(this.initError=V,this.close(),V.throw()):(i===Nt.ERR_JOIN_BY_MULTI_IP?(this.multiIpOption=o.message.option,z.warning("[".concat(this.clientId,"] detect multi ip, recover")),this.reconnect("recover",Yn.MULTI_IP)):this.reconnect($.action,Yn.SERVER_ERROR),e===br.JOIN||e===br.REJOIN?null:yield this.request(e,r))))}})}waitMessage(e,r){return new it(i=>{let o=c=>{r&&!r(c)||(this.off(e,o),i(c))};this.on(e,o)})}upload(e,r){e={_type:e,_message:r};try{this.websocket.sendMessage(e)}catch(o){r=Xe.MAX_UPLOAD_CACHE||50;var i;this.uploadCache.push(e),this.uploadCache.length>r&&An(i=this.uploadCache).call(i,0,1),0<this.uploadCache.length&&!this.uploadCacheInterval&&(this.uploadCacheInterval=window.setInterval(()=>{var c;if(this.connectionState===Oi.CONNECTED){var h=An(c=this.uploadCache).call(c,0,1)[0];this.uploadCache.length===0&&(window.clearInterval(this.uploadCacheInterval),this.uploadCacheInterval=void 0),this.upload(h._type,h._message)}},Xe.UPLOAD_CACHE_INTERVAL||2e3))}}send(e,r){this.websocket.sendMessage({_type:e,_message:r})}init(e){return this.initError=void 0,this.multiIpOption=void 0,this.joinResponse=void 0,this.reconnectToken=void 0,new it((r,i)=>{this.once(nr.WS_CONNECTED,()=>r(this.joinResponse)),this.once(nr.WS_CLOSED,()=>i(this.initError||new ue(oe.WS_ABORT))),this.connectionState=Oi.CONNECTING,this.websocket.init(e).catch(i),this.wsInflateDataTimer&&window.clearInterval(this.wsInflateDataTimer),this.wsInflateDataTimer=window.setInterval(()=>{this.handleWsInflateData()},2e4)})}close(e){this.pingpongTimer&&(this.pingpongTimeoutCount=0,window.clearInterval(this.pingpongTimer),this.pingpongTimer=void 0),this.wsInflateDataTimer&&(this.handleWsInflateData(),window.clearInterval(this.wsInflateDataTimer),this.wsInflateDataTimer=void 0),this.joinResponse=this.reconnectToken=void 0,this._disconnectedReason=e||"LEAVE",this.connectionState=Oi.CLOSED,this.websocket.close()}join(){return Ee(this,null,function*(){var e;if(!this.joinResponse){var r=un(this,nr.REQUEST_JOIN_INFO);if(r=yield this.request(br.JOIN,r),!r)return this.emit(nr.REPORT_JOIN_GATEWAY,oe.TIMEOUT,this.url||""),!1;this.joinResponse=r,this.reconnectToken=this.joinResponse.rejoin_token}return this.connectionState=Oi.CONNECTED,this.pingpongTimer&&window.clearInterval(this.pingpongTimer),this.pingpongTimer=window.setInterval(Ti(e=this.handlePingPong).call(e,this),3e3),!0})}rejoin(){return Ee(this,null,function*(){var e,r;if(!this.reconnectToken)throw new ue(oe.UNEXPECTED_ERROR,"can not rejoin, no rejoin token");var i=un(this,nr.REQUEST_REJOIN_INFO);return i.token=this.reconnectToken,i=yield this.request(br.REJOIN,i),!!i&&(this.connectionState=Oi.CONNECTED,this.pingpongTimer&&window.clearInterval(this.pingpongTimer),this.pingpongTimer=window.setInterval(Ti(e=this.handlePingPong).call(e,this),3e3),i.peers&&Re(r=i.peers).call(r,o=>{this.emit(Cr.ON_USER_ONLINE,{uid:o.uid}),o.audio_mute?this.emit(Cr.MUTE_AUDIO,{uid:o.uid}):this.emit(Cr.UNMUTE_AUDIO,{uid:o.uid}),o.video_mute?this.emit(Cr.MUTE_VIDEO,{uid:o.uid}):this.emit(Cr.UNMUTE_VIDEO,{uid:o.uid}),o.audio_enable_local?this.emit(Cr.ENABLE_LOCAL_AUDIO,{uid:o.uid}):this.emit(Cr.DISABLE_LOCAL_AUDIO,{uid:o.uid}),o.video_enable_local?this.emit(Cr.ENABLE_LOCAL_VIDEO,{uid:o.uid}):this.emit(Cr.DISABLE_LOCAL_VIDEO,{uid:o.uid}),o.audio||o.video||this.emit(Cr.ON_REMOVE_STREAM,{uid:o.uid,uint_id:o.uint_id}),o.audio&&this.emit(Cr.ON_ADD_AUDIO_STREAM,{uid:o.uid,uint_id:o.uint_id,audio:!0}),o.video&&this.emit(Cr.ON_ADD_VIDEO_STREAM,{uid:o.uid,uint_id:o.uint_id,video:!0})}),!0)})}reconnect(e,r){this.pingpongTimer&&(this.pingpongTimeoutCount=0,window.clearInterval(this.pingpongTimer),this.pingpongTimer=void 0),this.websocket.reconnect(e,r)}handleNotification(e){if(z.debug("[".concat(this.clientId,"] receive notification: "),e),e=Xs(e.code),e.action!=="success"){if(e.action!=="failed")return e.action==="quit"?(e.desc==="ERR_REPEAT_JOIN_CHANNEL"&&this.close("UID_BANNED"),void this.close()):void this.reconnect(e.action,Yn.SERVER_ERROR);z.error("[".concat(this.clientId,"] ignore error: "),e.desc)}}handlePingPong(){if(this.websocket&&this.websocket.state==="connected"){0<this.pingpongTimeoutCount&&this.rttRolling.add(3e3),this.pingpongTimeoutCount+=1;var e=Xe.PING_PONG_TIME_OUT,r=at();this.pingpongTimeoutCount>=e&&(z.warning("PINGPONG Timeout. Last Socket Message: ".concat(r-this.lastMsgTime,"ms")),r-this.lastMsgTime>Xe.WEBSOCKET_TIMEOUT_MIN)?this.reconnect("retry",Yn.TIMEOUT):this.request(br.PING,void 0,!0).then(()=>{this.pingpongTimeoutCount=0;let i=at()-r;this.rttRolling.add(i),Xe.REPORT_STATS&&this.send(br.PING_BACK,{pingpongElapse:i})}).catch(i=>{})}}handleWsInflateData(){let{wsInflateLength:e,wsDeflateLength:r}=this.websocket.getWsInflateData();e!==0&&r!==0&&this.upload(ks.WS_INFLATE_DATA_LENGTH,{ws_deflate_length:r,ws_inflate_length:e})}handleWebsocketEvents(){this.websocket.on(gr.ON_MESSAGE,this.onWebsocketMessage),this.websocket.on(gr.CLOSED,()=>{this.connectionState=Oi.CLOSED}),this.websocket.on(gr.FAILED,()=>{this._disconnectedReason="NETWORK_ERROR",this.connectionState=Oi.CLOSED}),this.websocket.on(gr.RECONNECTING,e=>{this._websocketReconnectReason=e,this.joinResponse=void 0,this.connectionState===Oi.CONNECTED?this.connectionState=Oi.RECONNECTING:this.connectionState=Oi.CONNECTING}),this.websocket.on(gr.WILL_RECONNECT,(e,r)=>{if(un(this,nr.IS_P2P_DISCONNECTED)&&e==="retry")return this.reconnectToken=void 0,this.emit(nr.NEED_RENEW_SESSION),this.emit(nr.DISCONNECT_P2P),r("tryNext");e!=="retry"&&(this.reconnectToken=void 0,this.emit(nr.NEED_RENEW_SESSION),this.emit(nr.DISCONNECT_P2P)),r(e)}),this.websocket.on(gr.CONNECTED,()=>{this.openConnectionTime=at(),this.reconnectToken?this.rejoin().catch(e=>{var r;z.warning(ne(r="[".concat(this.clientId,"] rejoin failed ")).call(r,e)),this.reconnect("tryNext",Yn.SERVER_ERROR)}):this.join().catch(e=>{if(this.emit(nr.REPORT_JOIN_GATEWAY,e.message||e.code,this.url||""),e instanceof ue&&e.code===oe.UNEXPECTED_RESPONSE&&e.data.code===Nt.ERR_NO_AUTHORIZED)return z.warning("[".concat(this.clientId,"] reconnect no authorized, recover")),void this.reconnect("recover",Yn.SERVER_ERROR);z.error("[".concat(this.clientId,"] join gateway request failed"),e.toString()),this.spec.forceWaitGatewayResponse?this.reconnect("tryNext",Yn.SERVER_ERROR):(this.initError=e,this.close())})}),this.websocket.on(gr.REQUEST_NEW_URLS,(e,r)=>{Kr(this,nr.REQUEST_RECOVER,this.multiIpOption).then(e).catch(r)})}}let Bd=new Tr;class qv extends mn{constructor(e){super();this.inChannelInfo={joinAt:null,duration:0},this._state="DISCONNECTED",this.needToSendUnpubUnsub=new Tr,this.hasChangeBGPAddress=this.isSignalRecover=!1,this.joinGatewayStartTime=0,this._signalTimeout=!1,this.clientId=e.clientId,this.spec=e,this.signal=new zv(ri({},e,{retryConfig:e.websocketRetryConfig})),this._statsCollector=e.statsCollector,this.role=e.role||"audience",this._clientRoleOptions=e.clientRoleOptions,this.handleSignalEvents()}get state(){return this._state}set state(e){if(e!==this._state){var r=this._state;this._state=e,e==="DISCONNECTED"&&this._disconnectedReason?this.emit(Gi.CONNECTION_STATE_CHANGE,e,r,this._disconnectedReason):this.emit(Gi.CONNECTION_STATE_CHANGE,e,r)}}join(e,r){return Ee(this,null,function*(){var i,o;e.cloudProxyServer!=="disabled"&&(this.hasChangeBGPAddress=!0);let c=at();var h=Bd.get(e.cname);if(h||(h=new Tr,Bd.set(e.cname,h)),h.has(e.uid))throw h=new ue(oe.UID_CONFLICT),ke.joinGateway(e.sid,{lts:c,succ:!1,ec:h.message,addr:null,uid:e.uid,cid:e.cid}),h;h.set(e.uid,!0),this.joinInfo=e,this.key=r,r=e.proxyServer?_t(i=e.gatewayAddrs).call(i,C=>{var x,Q;return C=C.split(":"),ne(x=ne(Q="wss://".concat(e.proxyServer,"/ws/?h=")).call(Q,C[0],"&p=")).call(x,C[1])}):_t(o=e.gatewayAddrs).call(o,C=>"wss://".concat(C)),i=0,this.joinGatewayStartTime=c;try{i=(yield this.signal.init(r)).uid}catch(C){throw z.error("[".concat(this.clientId,"] User join failed"),C.toString()),ke.joinGateway(e.sid,{lts:c,succ:!1,ec:C.message,addr:this.signal.url,uid:e.uid,cid:e.cid}),h.delete(e.uid),this.signal.close(),C}return this.state="CONNECTED",this.inChannelInfo.joinAt=at(),z.debug("[".concat(this.clientId,"] Connected to gateway server")),this.trafficStatsInterval=window.setInterval(()=>{this.updateTrafficStats().catch(C=>{z.warning("[".concat(this.clientId,"] get traffic stats error"),C.toString())})},3e3),this.networkQualityInterval=window.setInterval(()=>{navigator&&navigator.onLine!==void 0&&!navigator.onLine?this.emit(Gi.NETWORK_QUALITY,{downlinkNetworkQuality:6,uplinkNetworkQuality:6}):this._signalTimeout?this.emit(Gi.NETWORK_QUALITY,{downlinkNetworkQuality:5,uplinkNetworkQuality:5}):this.state==="CONNECTED"&&this._statsCollector.trafficStats?this.emit(Gi.NETWORK_QUALITY,{uplinkNetworkQuality:Qo(this._statsCollector.trafficStats.B_unq),downlinkNetworkQuality:Qo(this._statsCollector.trafficStats.B_dnq)}):this.emit(Gi.NETWORK_QUALITY,{uplinkNetworkQuality:0,downlinkNetworkQuality:0})},2e3),i})}leave(e=!1){return Ee(this,null,function*(){if(this.state!=="DISCONNECTED"){this.state="DISCONNECTING";try{if(!e&&this.signal.connectionState===Oi.CONNECTED){var r=this.signal.request(br.LEAVE,void 0,!0);yield it.race([r,Qa(3e3)])}}catch(i){z.warning("[".concat(this.clientId,"] leave request failed, ignore"),i)}this.signal.close(),this.reset(),this.state="DISCONNECTED"}})}publish(e,r){return Ee(this,null,function*(){if(!this.joinInfo)throw new ue(oe.UNEXPECTED_ERROR,"publish no joinInfo");let i=e.getUserId(),o=e.videoTrack?function(c){var h;if(c=c._encoderConfig,!c)return{};const C={resolution:c.width&&c.height?ne(h="".concat(Zn(c.width),"x")).call(h,Zn(c.height)):void 0,maxVideoBW:c.bitrateMax,minVideoBW:c.bitrateMin};return typeof c.frameRate=="number"?(C.maxFrameRate=c.frameRate,C.minFrameRate=c.frameRate):c.frameRate&&(C.maxFrameRate=c.frameRate.max||c.frameRate.ideal||c.frameRate.exact||c.frameRate.min,C.minFrameRate=c.frameRate.min||c.frameRate.ideal||c.frameRate.exact||c.frameRate.max),C}(e.videoTrack):{};if(e.on(Mt.NEED_ANSWER,(c,h,C)=>{var x;let Q={state:"offer",stream_type:r,p2p_id:e.pc.ID,sdp:ht(c),audio:!!e.audioTrack,video:!!e.videoTrack,screen:e.videoTrack&&Vt(x=e.videoTrack._hints).call(x,oo.SCREEN_TRACK)!==-1,attributes:o,dtx:e.audioTrack instanceof Jc&&e.audioTrack._config.DTX,hq:!1,lq:!1,stereo:!1,speech:!1,mode:this.spec.mode,codec:this.spec.codec,extend:Xe.PUB_EXTEND};e.audioTrack&&e.audioTrack instanceof bn&&(e.audioTrack&&(x={stream_id:this.joinInfo&&(this.joinInfo.stringUid||this.joinInfo.uid),action:""},e.audioTrack.isActive?x.action="unmute_local_audio":x.action="mute_local_audio",this.sendControl(x)),e.videoTrack&&(x={stream_id:this.joinInfo&&(this.joinInfo.stringUid||this.joinInfo.uid),action:""},e.videoTrack.muted?x.action="mute_local_video":x.action="unmute_local_video",this.sendControl(x))),this.signal.request(br.PUBLISH,Q,!0).then(F=>{i&&this.needToSendUnpubUnsub.set(i,!0),h(JSON.parse(F.sdp))}).catch(F=>{if(c.retry&&F.data&&F.data.code===Nt.ERR_PUBLISH_REQUEST_INVALID)return z.warning("[".concat(this.clientId,"] receiver publish error code, retry"),F.toString()),Kr(e,Mt.NEED_UNPUB).then(()=>{c.retry=!1,Kr(e,Mt.NEED_ANSWER,c).then(h).catch(C)});F.code!==oe.WS_ABORT&&C(F)})}),e.on(Mt.NEED_RENEGOTIATE,(c,h,C)=>{this.signal.request(br.PUBLISH,{state:"negotiation",stream_type:r,p2p_id:e.pc.ID,sdp:c},!0).then(x=>{h(JSON.parse(x.sdp))}).catch(x=>{x.code!==oe.WS_ABORT&&C(x)})}),e.on(Mt.NEED_UNPUB,c=>i&&!this.needToSendUnpubUnsub.has(i)?c(!1):this.state==="RECONNECTING"?c(!0):void this.signal.request(br.UNPUBLISH,{stream_id:e.getUserId(),stream_type:r},!0).then(()=>c(!1)).catch(h=>{z.warning("unpublish warning: ",h),c(!0)})),e.on(Mt.NEED_UPLOAD,(c,h)=>{this.signal.upload(c,{stream_type:r,stats:h})}),e.on(Mt.NEED_SIGNAL_RTT,c=>{c(this.signal.rtt)}),e.on(Mt.NEED_CONTROL,(c,h,C)=>{if(c.type==="video"&&c.muted)c="mute_local_video";else if(c.type!=="video"||c.muted)if(c.type==="audio"&&c.muted)c="mute_local_audio";else{if(c.type!=="audio"||c.muted)return;c="unmute_local_audio"}else c="unmute_local_video";this.sendControl({stream_id:this.joinInfo&&(this.joinInfo.stringUid||this.joinInfo.uid),action:c}).then(h).catch(C)}),this.state!=="RECONNECTING"){if(this.state!=="CONNECTED")return new ue(oe.INVALID_OPERATION,"can not publish when connection state is ".concat(this.state)).throw();yield e.startP2PConnection()}else e.readyToReconnectPC()})}subscribe(e){return Ee(this,null,function*(){if(!this.joinInfo)throw new ue(oe.UNEXPECTED_ERROR,"subscribe no joinInfo");let r=e.getUserId();if(e.on(Mt.NEED_ANSWER,(i,o,c)=>{var h=e.subscribeOptions;h={stream_id:e.getUserId(),audio:!!h.audio,video:!!h.video,mode:this.spec.mode,codec:this.spec.codec,p2p_id:e.pc.ID,sdp:ht(i),tcc:!!Xe.SUBSCRIBE_TCC,extend:Xe.SUB_EXTEND},this.signal.request(br.SUBSCRIBE,h,!0).then(C=>{this.needToSendUnpubUnsub.set(r,!0),o(JSON.parse(C.sdp))}).catch(C=>{if(i.retry&&C.data&&C.data.code===Nt.ERR_SUBSCRIBE_REQUEST_INVALID)return z.warning("[".concat(this.clientId,"] receiver subscribe error code, retry"),C.toString()),Kr(e,Mt.NEED_UNSUB).then(()=>{i.retry=!1,Kr(e,Mt.NEED_ANSWER,i).then(o).catch(c)});C.code!==oe.WS_ABORT&&c(C)})}),e.on(Mt.NEED_UNSUB,i=>this.needToSendUnpubUnsub.has(r)?this.state==="RECONNECTING"?i(!0):void this.signal.request(br.UNSUBSCRIBE,{stream_id:e.getUserId()},!0).then(()=>i(!1)).catch(o=>{z.warning("unsubscribe warning",o),i(!0)}):i(!1)),e.on(Mt.NEED_UPLOAD,(i,o)=>{this.signal.upload(i,{stream_id:e.getUserId(),stats:o})}),e.on(Mt.NEED_SIGNAL_RTT,i=>{i(this.signal.rtt)}),this.state!=="RECONNECTING"){if(this.state!=="CONNECTED")return new ue(oe.INVALID_OPERATION,"can not subscribe when connection state is ".concat(this.state)).throw();yield e.startP2PConnection()}else e.readyToReconnectPC()})}subscribeChange(e,r){return Ee(this,null,function*(){var i,o;if(!this.joinInfo)throw new ue(oe.UNEXPECTED_ERROR,"subscribe no joinInfo");if(yield e.setSubscribeOptions(r),this.state!=="RECONNECTING"){if(this.state!=="CONNECTED")return new ue(oe.INVALID_OPERATION,"can not subscribe change when connection state is ".concat(this.state)).throw();z.debug(ne(i=ne(o="[".concat(this.clientId,"] send subscribe change, audio: ")).call(o,r.audio,", video: ")).call(i,r.video)),yield this.signal.request(br.SUBSCRIBE_CHANGE,{stream_id:e.getUserId(),audio:!!r.audio,video:!!r.video},!0)}})}sendControl(e){return Ee(this,null,function*(){this.signal.request(br.CONTROL,e,!0,!0)})}unsubscribe(e){return Ee(this,null,function*(){yield e.closeP2PConnection()})}getGatewayInfo(){return this.signal.request(br.GATEWAY_INFO)}renewToken(e){return this.signal.request(br.RENEW_TOKEN,{token:e})}setClientRole(e,r){return Ee(this,null,function*(){if(r&&(this._clientRoleOptions=Dn({},r)),this.state!=="CONNECTED")return void(this.role=e);yield this.signal.request(br.SET_CLIENT_ROLE,{role:e,level:e==="audience"?this._clientRoleOptions&&this._clientRoleOptions.level?this._clientRoleOptions.level:2:0}),this.role=e})}setRemoteVideoStreamType(e,r){return Ee(this,null,function*(){yield this.signal.request(br.SWITCH_VIDEO_STREAM,{stream_id:e,stream_type:r})})}setStreamFallbackOption(e,r){return Ee(this,null,function*(){yield this.signal.request(br.SET_FALLBACK_OPTION,{stream_id:e,fallback_type:r})})}pickSVCLayer(e,r){return Ee(this,null,function*(){yield this.signal.request(br.PICK_SVC_LAYER,{stream_id:e,spatial_layer:r.spatialLayer,temporal_layer:r.temporalLayer})})}getInChannelInfo(){return this.inChannelInfo.joinAt&&(this.inChannelInfo.duration=at()-this.inChannelInfo.joinAt),ri({},this.inChannelInfo)}getGatewayVersion(){return Ee(this,null,function*(){return(yield this.signal.request(br.GATEWAY_INFO)).version})}reset(){if(this.inChannelInfo.joinAt&&(this.inChannelInfo.duration=at()-this.inChannelInfo.joinAt,this.inChannelInfo.joinAt=null),this.trafficStatsInterval&&(window.clearInterval(this.trafficStatsInterval),this.trafficStatsInterval=void 0),this.joinInfo){let e=Bd.get(this.joinInfo.cname);e&&e.delete(this.joinInfo.uid)}this.needToSendUnpubUnsub=new Tr,this.key=this.joinInfo=void 0,this.networkQualityInterval&&(window.clearInterval(this.networkQualityInterval),this.networkQualityInterval=void 0)}updateTurnConfigFromSignal(){if(this.joinInfo){var e=(e=((this.joinInfo.cloudProxyServer==="disabled"?this.signal.url:this.joinInfo.gatewayAddrs[this.signal.currentURLIndex])||"").match(/(wss:\/\/)?([^:]+):(\d+)/))?{username:rn.username,password:rn.password,turnServerURL:e[2],tcpport:Si(e[3])+30,udpport:Si(e[3])+30,forceturn:!1}:null;this.joinInfo.turnServer.serversFromGateway=[],e&&this.joinInfo.turnServer.mode!=="off"&&this.joinInfo.cloudProxyServer==="disabled"&&this.joinInfo.turnServer.serversFromGateway.push(ri({},rn,{turnServerURL:e.turnServerURL,tcpport:e.tcpport,udpport:e.udpport,username:this.joinInfo.uid.toString(),password:this.joinInfo.token}))}}updateTrafficStats(){return Ee(this,null,function*(){var e;if(this.state==="CONNECTED"){var r=yield this.signal.request(br.TRAFFIC_STATS,void 0,!0);r.timestamp=at(),Re(e=r.peer_delay).call(e,i=>{var o;let c=this._statsCollector.trafficStats&&rr(o=this._statsCollector.trafficStats.peer_delay).call(o,h=>h.peer_uid===i.peer_uid);c&&c.B_st!==i.B_st&&Fr(()=>{this.emit(Gi.STREAM_TYPE_CHANGE,i.peer_uid,i.B_st)})}),this._statsCollector.updateTrafficStats(r)}})}getJoinMessage(){if(!this.joinInfo||!this.key)throw new ue(oe.UNEXPECTED_ERROR,"can not generate join message, no join info");let e=Dn({},this.joinInfo.apResponse);var r=Xe.REPORT_APP_SCENARIO;if(typeof r!="string")try{r=ht(r)}catch(i){r=void 0}return r&&128<r.length&&(r=void 0),r={session_id:this.joinInfo.sid,app_id:this.joinInfo.appId,channel_key:this.key,channel_name:this.joinInfo.cname,sdk_version:rs,browser:navigator.userAgent,process_id:Xe.PROCESS_ID,mode:this.spec.mode,codec:this.spec.codec,role:this.role,has_changed_gateway:this.hasChangeBGPAddress,ap_response:e,extend:Xe.JOIN_EXTEND,details:{6:this.joinInfo.stringUid,cservice_map:this.joinInfo.cloudProxyServer==="proxy3"?"1":void 0},features:{rejoin:!0},optionalInfo:this.joinInfo.optionalInfo,appScenario:r},this.joinInfo.stringUid&&(r.string_uid=this.joinInfo.stringUid),this.joinInfo.aesmode&&this.joinInfo.aespassword&&(r.aes_mode=this.joinInfo.aesmode,Xe.ENCRYPT_AES?(r.aes_secret=this.joinInfo.aespassword,r.aes_encrypt=!0):r.aes_secret=this.joinInfo.aespassword,this.joinInfo.aessalt&&(r.aes_salt=this.joinInfo.aessalt)),e.addresses[this.signal.websocket.currentURLIndex]&&(r.ap_response.ticket=e.addresses[this.signal.websocket.currentURLIndex].ticket,delete e.addresses),r}getRejoinMessage(){if(!this.joinInfo)throw new ue(oe.UNEXPECTED_ERROR,"can not generate rejoin message, no join info");return{session_id:this.joinInfo.sid,channel_name:this.joinInfo.cname,cid:this.joinInfo.cid,uid:this.joinInfo.uid,vid:Number(this.joinInfo.vid)}}handleSignalEvents(){this.signal.on(nr.WS_RECONNECTING,e=>{this.joinInfo&&ke.WebSocketQuit(this.joinInfo.sid,{lts:at(),succ:-1,cname:this.joinInfo.cname,uid:this.joinInfo.uid,cid:this.joinInfo.cid,errorCode:e||Yn.NETWORK_ERROR}),this.joinInfo&&(this.state="RECONNECTING",ke.sessionInit(this.joinInfo.sid,{lts:new Date().getTime(),extend:this.isSignalRecover?{recover:!0}:{rejoin:!0},cname:this.joinInfo.cname,appid:this.joinInfo.appId,mode:this.spec.mode}),this.isSignalRecover=!1,this.joinGatewayStartTime=at())}),this.signal.on(nr.WS_CLOSED,e=>{let r;switch(e){case"LEAVE":r=Yn.LEAVE;break;case"UID_BANNED":case"IP_BANNED":case"CHANNEL_BANNED":case"SERVER_ERROR":r=Yn.SERVER_ERROR;break;default:r=Yn.NETWORK_ERROR}z.debug("[signal] websocket closed, reason: ".concat(r||"undefined -> "+Yn.NETWORK_ERROR)),this.joinInfo&&ke.WebSocketQuit(this.joinInfo.sid,{lts:at(),succ:e==="LEAVE"?1:-1,cname:this.joinInfo.cname,uid:this.joinInfo.uid,cid:this.joinInfo.cid,errorCode:r}),this.reset(),this._disconnectedReason=e,this.state="DISCONNECTED"}),this.signal.on(nr.WS_CONNECTED,()=>{if(this.updateTurnConfigFromSignal(),this.state="CONNECTED",this.joinInfo){var e,r,i;if(this.role==="audience"&&this._clientRoleOptions&&this._clientRoleOptions.level&&(z.debug(ne(e=ne(r=ne(i="[".concat(this.clientId,"] patch to send set client role, role: ")).call(i,this.role,", mode: ")).call(r,this.spec.mode,", level: ")).call(e,this._clientRoleOptions&&this._clientRoleOptions.level)),this.setClientRole(this.role,this._clientRoleOptions)),ke.joinGateway(this.joinInfo.sid,{lts:this.joinGatewayStartTime,succ:!0,ec:null,vid:this.joinInfo.vid,addr:this.signal.url,uid:this.joinInfo.uid,cid:this.joinInfo.cid}),this.joinInfo.useLocalAccessPoint){e=this.signal.url&&this.signal.url.match(/wss:\/\/([^:]+):(\d+)/);var o;if(!e)return void z.error(ne(o="[".concat(this.clientId,"] set local access point after joined failed: ")).call(o,e));Gr("EVENT_REPORT_DOMAIN",e[1]),Gr("EVENT_REPORT_BACKUP_DOMAIN",e[1]),Gr("LOG_UPLOAD_SERVER","".concat(e[1],":6444"))}}}),this.signal.on(Cr.ON_UPLINK_STATS,e=>{this._statsCollector.updateUplinkStats(e)}),this.signal.on(nr.REQUEST_RECOVER,(e,r,i)=>{if(!this.joinInfo)return i(new ue(oe.UNEXPECTED_ERROR,"gateway: can not recover, no join info"));e&&(this.joinInfo.multiIP=e,this.hasChangeBGPAddress=!0),this.isSignalRecover=!0,Kr(this,Gi.REQUEST_NEW_GATEWAY_LIST).then(r).catch(i)}),this.signal.on(nr.REQUEST_JOIN_INFO,e=>{e(this.getJoinMessage())}),this.signal.on(nr.REQUEST_REJOIN_INFO,e=>{e(this.getRejoinMessage())}),this.signal.on(nr.REPORT_JOIN_GATEWAY,(e,r)=>{this.joinInfo&&ke.joinGateway(this.joinInfo.sid,{lts:this.joinGatewayStartTime,succ:!1,ec:e,addr:r,uid:this.joinInfo.uid,cid:this.joinInfo.cid})}),this.signal.on(nr.IS_P2P_DISCONNECTED,e=>{e(un(this,Gi.IS_P2P_DISCONNECTED))}),this.signal.on(nr.DISCONNECT_P2P,()=>{this.needToSendUnpubUnsub=new Tr,this.emit(Gi.DISCONNECT_P2P)}),this.signal.on(nr.NEED_RENEW_SESSION,()=>{this.emit(Gi.NEED_RENEW_SESSION)}),this.signal.on(nr.REQUEST_SUCCESS,()=>{this._signalTimeout=!1}),this.signal.on(nr.REQUEST_TIMEOUT,()=>{this._signalTimeout=!0})}}var Xv=ni("iterator"),Nd=!ii(function(){var t=new URL("b?a=1&b=2&c=3","http://a"),e=t.searchParams,r="";return t.pathname="c%20d",e.forEach(function(i,o){e.delete("b"),r+=o+i}),!t.toJSON||!e.sort||t.href!=="http://a/c%20d?a=1&c=3"||e.get("c")!=="3"||String(new URLSearchParams("?a=1"))!=="a=1"||!e[Xv]||new URL("https://a@b").username!=="a"||new URLSearchParams(new URLSearchParams("a=b")).get("a")!=="b"||new URL("http://\u0442\u0435\u0441\u0442").host!=="xn--e1aybc"||new URL("http://a#\u0431").hash!=="#%D0%B1"||r!=="a1c3"||new URL("http://x",void 0).host!=="x"}),Zv=/[^\0-\u007E]/,$v=/[.\u3002\uFF0E\uFF61]/g,dc=Math.floor,Pd=String.fromCharCode,CA=function(t){return t+22+75*(26>t)},em=function(t){for(var e,r=[],i=[],o=0,c=t.length;o<c;){var h=t.charCodeAt(o++);if(55296<=h&&56319>=h&&o<c){var C=t.charCodeAt(o++);(64512&C)==56320?i.push(((1023&h)<<10)+(1023&C)+65536):(i.push(h),o--)}else i.push(h)}o=(t=i).length,c=128;var x=0,Q=72;for(i=0;i<t.length;i++)128>(e=t[i])&&r.push(Pd(e));for((C=h=r.length)&&r.push("-");C<o;){var F=2147483647;for(i=0;i<t.length;i++)(e=t[i])>=c&&e<F&&(F=e);var V=C+1;if(F-c>dc((2147483647-x)/V))throw RangeError("Overflow: input needs wider integers to process");for(x+=(F-c)*V,c=F,i=0;i<t.length;i++){if((e=t[i])<c&&2147483647<++x)throw RangeError("Overflow: input needs wider integers to process");if(e==c){var Y=x;for(F=36;;F+=36){var $=F<=Q?1:F>=Q+26?26:F-Q;if(Y<$)break;Y-=$;var te=36-$;r.push(Pd(CA($+Y%te))),Y=dc(Y/te)}for(r.push(Pd(CA(Y))),Q=V,F=0,x=C==h?dc(x/700):x>>1,x+=dc(x/Q);455<x;F+=36)x=dc(x/35);Q=dc(F+36*x/(x+38)),x=0,++C}}++x,++c}return r.join("")},yA=function(t){var e=he(t);if(typeof e!="function")throw TypeError(String(t)+" is not iterable");return Qi(e.call(t))},IA=ms("fetch"),xd=ms("Headers"),tm=ni("iterator"),SA=Lt.set,Is=Lt.getterFor("URLSearchParams"),rm=Lt.getterFor("URLSearchParamsIterator"),im=/\+/g,TA=Array(4),nm=function(t){return TA[t-1]||(TA[t-1]=RegExp("((?:%[\\da-f]{2}){"+t+"})","gi"))},sm=function(t){try{return decodeURIComponent(t)}catch(e){return t}},RA=function(t){t=t.replace(im," ");var e=4;try{return decodeURIComponent(t)}catch(r){for(;e;)t=t.replace(nm(e--),sm);return t}},wA=/[!'()~]|%20/g,om={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},LA=function(t){return om[t]},DA=function(t,e){if(e){var r,i;e=e.split("&");for(var o=0;o<e.length;)(r=e[o++]).length&&(i=r.split("="),t.push({key:RA(i.shift()),value:RA(i.join("="))}))}},am=function(t){this.entries.length=0,DA(this.entries,t)},hc=function(t,e){if(t<e)throw TypeError("Not enough arguments")},Md=sh(function(t,e){SA(this,{type:"URLSearchParamsIterator",iterator:yA(Is(t).entries),kind:e})},"Iterator",function(){var t=rm(this),e=t.kind;t=t.iterator.next();var r=t.value;return t.done||(t.value=e==="keys"?r.key:e==="values"?r.value:[r.key,r.value]),t}),zc=function(){De(this,zc,"URLSearchParams");var t,e,r,i,o,c=0<arguments.length?arguments[0]:void 0,h=[];if(SA(this,{type:"URLSearchParams",entries:h,updateURL:function(){},updateSearchParams:am}),c!==void 0)if(jr(c))if(typeof(t=he(c))=="function")for(e=(t=t.call(c)).next;!(c=e.call(t)).done;){if((c=(i=(r=yA(Qi(c.value))).next).call(r)).done||(o=i.call(r)).done||!i.call(r).done)throw TypeError("Expected sequence with length 2");h.push({key:c.value+"",value:o.value+""})}else for(e in c)$t(c,e)&&h.push({key:e,value:c[e]+""});else DA(h,typeof c=="string"?c.charAt(0)==="?"?c.slice(1):c:c+"")},ru=zc.prototype;fi(ru,{append:function(t,e){hc(arguments.length,2);var r=Is(this);r.entries.push({key:t+"",value:e+""}),r.updateURL()},delete:function(t){hc(arguments.length,1);for(var e=Is(this),r=e.entries,i=t+"",o=0;o<r.length;)r[o].key===i?r.splice(o,1):o++;e.updateURL()},get:function(t){hc(arguments.length,1);for(var e=Is(this).entries,r=t+"",i=0;i<e.length;i++)if(e[i].key===r)return e[i].value;return null},getAll:function(t){hc(arguments.length,1);for(var e=Is(this).entries,r=t+"",i=[],o=0;o<e.length;o++)e[o].key===r&&i.push(e[o].value);return i},has:function(t){hc(arguments.length,1);for(var e=Is(this).entries,r=t+"",i=0;i<e.length;)if(e[i++].key===r)return!0;return!1},set:function(t,e){hc(arguments.length,1);for(var r,i=Is(this),o=i.entries,c=!1,h=t+"",C=e+"",x=0;x<o.length;x++)(r=o[x]).key===h&&(c?o.splice(x--,1):(c=!0,r.value=C));c||o.push({key:h,value:C}),i.updateURL()},sort:function(){var t,e,r=Is(this),i=r.entries,o=i.slice();for(e=i.length=0;e<o.length;e++){var c=o[e];for(t=0;t<e;t++)if(i[t].key>c.key){i.splice(t,0,c);break}t===e&&i.push(c)}r.updateURL()},forEach:function(t){for(var e,r=Is(this).entries,i=eo(t,1<arguments.length?arguments[1]:void 0,3),o=0;o<r.length;)i((e=r[o++]).value,e.key,this)},keys:function(){return new Md(this,"keys")},values:function(){return new Md(this,"values")},entries:function(){return new Md(this,"entries")}},{enumerable:!0}),vi(ru,tm,ru.entries),vi(ru,"toString",function(){for(var t,e=Is(this).entries,r=[],i=0;i<e.length;)t=e[i++],r.push(encodeURIComponent(t.key).replace(wA,LA)+"="+encodeURIComponent(t.value).replace(wA,LA));return r.join("&")},{enumerable:!0}),Be(zc,"URLSearchParams"),Kt({global:!0,forced:!Nd},{URLSearchParams:zc}),Nd||typeof IA!="function"||typeof xd!="function"||Kt({global:!0,enumerable:!0,forced:!0},{fetch:function(t){var e,r,i,o=[t];return 1<arguments.length&&(jr(e=arguments[1])&&(r=e.body,re(r)==="URLSearchParams"&&((i=e.headers?new xd(e.headers):new xd).has("content-type")||i.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),e=Sr(e,{body:gs(0,String(r)),headers:gs(0,i)}))),o.push(e)),IA.apply(this,o)}});var qc=Ht.URL,cm=zc,lm=Lt.set,Ri=Lt.getterFor("URL"),um=Math.floor,bA=Math.pow,OA=/[A-Za-z]/,dm=/[\d+\-.A-Za-z]/,kd=/\d/,hm=/^(0x|0X)/,fm=/^[0-7]+$/,Am=/^\d+$/,BA=/^[\dA-Fa-f]+$/,gm=/[\u0000\u0009\u000A\u000D #%/:?@[\\]]/,pm=/[\u0000\u0009\u000A\u000D #/:?@[\\]]/,vm=/^[\u0000-\u001F ]+|[\u0000-\u001F ]+$/g,mm=/[\u0009\u000A\u000D]/g,Ud=function(t,e){var r,i;if(e.charAt(0)=="["){if(e.charAt(e.length-1)!="]"||!(r=_m(e.slice(1,-1))))return"Invalid host"}else if(En(t)){var o=[],c=e.toLowerCase().replace($v,".").split(".");for(i=0;i<c.length;i++){var h=c[i];o.push(Zv.test(h)?"xn--"+em(h):h)}if(e=o.join("."),gm.test(e)||(r=Em(e))===null)return"Invalid host"}else{if(pm.test(e))return"Invalid host";for(r="",e=Pa(e),i=0;i<e.length;i++)r+=ma(e[i],iu)}t.host=r},Em=function(t){var e,r,i,o,c=t.split(".");if(c.length&&c[c.length-1]==""&&c.pop(),4<(e=c.length))return t;var h=[];for(r=0;r<e;r++){if((i=c[r])=="")return t;if(o=10,1<i.length&&i.charAt(0)=="0"&&(o=hm.test(i)?16:8,i=i.slice(o==8?1:2)),i==="")i=0;else{if(!(o==10?Am:o==8?fm:BA).test(i))return t;i=parseInt(i,o)}h.push(i)}for(r=0;r<e;r++)if(i=h[r],r==e-1){if(i>=bA(256,5-e))return null}else if(255<i)return null;for(t=h.pop(),r=0;r<h.length;r++)t+=h[r]*bA(256,3-r);return t},_m=function(t){var e,r,i,o=[0,0,0,0,0,0,0,0],c=0,h=null,C=0,x=function(){return t.charAt(C)};if(x()==":"){if(t.charAt(1)!=":")return;C+=2,h=++c}for(;x();){if(c==8)return;if(x()!=":"){for(e=r=0;4>r&&BA.test(x());)e=16*e+parseInt(x(),16),C++,r++;if(x()=="."){if(r==0||(C-=r,6<c))return;for(e=0;x();){if(r=null,0<e){if(!(x()=="."&&4>e))return;C++}if(!kd.test(x()))return;for(;kd.test(x());){if(i=parseInt(x(),10),r===null)r=i;else{if(r==0)return;r=10*r+i}if(255<r)return;C++}o[c]=256*o[c]+r,++e!=2&&e!=4||c++}if(e!=4)return;break}if(x()==":"){if(C++,!x())return}else if(x())return;o[c++]=e}else{if(h!==null)return;C++,h=++c}}if(h!==null)for(x=c-h,c=7;c!=0&&0<x;)e=o[c],o[c--]=o[h+x-1],o[h+--x]=e;else if(c!=8)return;return o},Xc=function(t){var e,r;if(typeof t=="number"){var i=[];for(e=0;4>e;e++)i.unshift(t%256),t=um(t/256);return i.join(".")}if(typeof t=="object"){i="",e=null;for(var o=1,c=null,h=0,C=0;8>C;C++)t[C]!==0?(h>o&&(e=c,o=h),c=null,h=0):(c===null&&(c=C),++h);for(o=(h>o&&(e=c),e),e=0;8>e;e++)r&&t[e]===0||(r&&(r=!1),o===e?(i+=e?":":"::",r=!0):(i+=t[e].toString(16),7>e&&(i+=":")));return"["+i+"]"}return t},iu={},NA=Mc({},iu,{" ":1,'"':1,"<":1,">":1,"`":1}),PA=Mc({},NA,{"#":1,"?":1,"{":1,"}":1}),Fd=Mc({},PA,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),ma=function(t,e){var r=Hg(t,0);return 32<r&&127>r&&!$t(e,t)?t:encodeURIComponent(t)},nu={ftp:21,file:null,http:80,https:443,ws:80,wss:443},En=function(t){return $t(nu,t.scheme)},Qd=function(t){return!t.host||t.cannotBeABaseURL||t.scheme=="file"},Zc=function(t,e){var r;return t.length==2&&OA.test(t.charAt(0))&&((r=t.charAt(1))==":"||!e&&r=="|")},xA=function(t){var e;return 1<t.length&&Zc(t.slice(0,2))&&(t.length==2||(e=t.charAt(2))==="/"||e==="\\"||e==="?"||e==="#")},MA=function(t){var e=t.path,r=e.length;!r||t.scheme=="file"&&r==1&&Zc(e[0],!0)||e.pop()},Gd={},kA={},Hd={},UA={},FA={},Kd={},QA={},GA={},su={},ou={},Wd={},jd={},Vd={},Yd={},HA={},Jd={},$c={},To={},KA={},xa={},ia={},Ro=function(t,e,r,i){var o,c,h=r||Gd,C=0,x="",Q=!1,F=!1,V=!1;for(r||(t.scheme="",t.username="",t.password="",t.host=null,t.port=null,t.path=[],t.query=null,t.fragment=null,t.cannotBeABaseURL=!1,e=e.replace(vm,"")),e=e.replace(mm,""),e=Pa(e);C<=e.length;){switch(o=e[C],h){case Gd:if(!o||!OA.test(o)){if(r)return"Invalid scheme";h=Hd;continue}x+=o.toLowerCase(),h=kA;break;case kA:if(o&&(dm.test(o)||o=="+"||o=="-"||o=="."))x+=o.toLowerCase();else{if(o!=":"){if(r)return"Invalid scheme";x="",h=Hd,C=0;continue}if(r&&(En(t)!=$t(nu,x)||x=="file"&&(t.username!=""||t.password!=""||t.port!==null)||t.scheme=="file"&&!t.host))return;if(t.scheme=x,r)return void(En(t)&&nu[t.scheme]==t.port&&(t.port=null));x="",t.scheme=="file"?h=Yd:En(t)&&i&&i.scheme==t.scheme?h=UA:En(t)?h=GA:e[C+1]=="/"?(h=FA,C++):(t.cannotBeABaseURL=!0,t.path.push(""),h=KA)}break;case Hd:if(!i||i.cannotBeABaseURL&&o!="#")return"Invalid scheme";if(i.cannotBeABaseURL&&o=="#"){t.scheme=i.scheme,t.path=i.path.slice(),t.query=i.query,t.fragment="",t.cannotBeABaseURL=!0,h=ia;break}h=i.scheme=="file"?Yd:Kd;continue;case UA:if(o!="/"||e[C+1]!="/"){h=Kd;continue}h=su,C++;break;case FA:if(o=="/"){h=ou;break}h=To;continue;case Kd:if(t.scheme=i.scheme,o==null)t.username=i.username,t.password=i.password,t.host=i.host,t.port=i.port,t.path=i.path.slice(),t.query=i.query;else if(o=="/"||o=="\\"&&En(t))h=QA;else if(o=="?")t.username=i.username,t.password=i.password,t.host=i.host,t.port=i.port,t.path=i.path.slice(),t.query="",h=xa;else{if(o!="#"){t.username=i.username,t.password=i.password,t.host=i.host,t.port=i.port,t.path=i.path.slice(),t.path.pop(),h=To;continue}t.username=i.username,t.password=i.password,t.host=i.host,t.port=i.port,t.path=i.path.slice(),t.query=i.query,t.fragment="",h=ia}break;case QA:if(!En(t)||o!="/"&&o!="\\"){if(o!="/"){t.username=i.username,t.password=i.password,t.host=i.host,t.port=i.port,h=To;continue}h=ou}else h=su;break;case GA:if(h=su,o!="/"||x.charAt(C+1)!="/")continue;C++;break;case su:if(o!="/"&&o!="\\"){h=ou;continue}break;case ou:if(o=="@"){for(Q&&(x="%40"+x),Q=!0,x=Pa(x),o=0;o<x.length;o++){var Y=x[o];Y!=":"||V?(Y=ma(Y,Fd),V?t.password+=Y:t.username+=Y):V=!0}x=""}else if(o==null||o=="/"||o=="?"||o=="#"||o=="\\"&&En(t)){if(Q&&x=="")return"Invalid authority";C-=Pa(x).length+1,x="",h=Wd}else x+=o;break;case Wd:case jd:if(r&&t.scheme=="file"){h=Jd;continue}if(o!=":"||F){if(o==null||o=="/"||o=="?"||o=="#"||o=="\\"&&En(t)){if(En(t)&&x=="")return"Invalid host";if(r&&x==""&&(t.username!=""||t.password!=""||t.port!==null))return;if(h=Ud(t,x))return h;if(x="",h=$c,r)return;continue}o=="["?F=!0:o=="]"&&(F=!1),x+=o}else{if(x=="")return"Invalid host";if(h=Ud(t,x))return h;if(x="",h=Vd,r==jd)return}break;case Vd:if(!kd.test(o)){if(o==null||o=="/"||o=="?"||o=="#"||o=="\\"&&En(t)||r){if(x!=""){if(h=parseInt(x,10),65535<h)return"Invalid port";t.port=En(t)&&h===nu[t.scheme]?null:h,x=""}if(r)return;h=$c;continue}return"Invalid port"}x+=o;break;case Yd:if(t.scheme="file",o=="/"||o=="\\")h=HA;else{if(!i||i.scheme!="file"){h=To;continue}if(o==null)t.host=i.host,t.path=i.path.slice(),t.query=i.query;else if(o=="?")t.host=i.host,t.path=i.path.slice(),t.query="",h=xa;else{if(o!="#"){xA(e.slice(C).join(""))||(t.host=i.host,t.path=i.path.slice(),MA(t)),h=To;continue}t.host=i.host,t.path=i.path.slice(),t.query=i.query,t.fragment="",h=ia}}break;case HA:if(o=="/"||o=="\\"){h=Jd;break}i&&i.scheme=="file"&&!xA(e.slice(C).join(""))&&(Zc(i.path[0],!0)?t.path.push(i.path[0]):t.host=i.host),h=To;continue;case Jd:if(o==null||o=="/"||o=="\\"||o=="?"||o=="#"){if(!r&&Zc(x))h=To;else{if(x==""){if(t.host="",r)return}else{if(h=Ud(t,x))return h;if(t.host=="localhost"&&(t.host=""),r)return;x=""}h=$c}continue}x+=o;break;case $c:if(En(t)){if(h=To,o!="/"&&o!="\\")continue}else if(r||o!="?")if(r||o!="#"){if(o!=null&&(h=To,o!="/"))continue}else t.fragment="",h=ia;else t.query="",h=xa;break;case To:if(o==null||o=="/"||o=="\\"&&En(t)||!r&&(o=="?"||o=="#")){if((c=(c=x).toLowerCase())===".."||c==="%2e."||c===".%2e"||c==="%2e%2e"?(MA(t),o=="/"||o=="\\"&&En(t)||t.path.push("")):x==="."||x.toLowerCase()==="%2e"?o=="/"||o=="\\"&&En(t)||t.path.push(""):(t.scheme=="file"&&!t.path.length&&Zc(x)&&(t.host&&(t.host=""),x=x.charAt(0)+":"),t.path.push(x)),x="",t.scheme=="file"&&(o==null||o=="?"||o=="#"))for(;1<t.path.length&&t.path[0]==="";)t.path.shift();o=="?"?(t.query="",h=xa):o=="#"&&(t.fragment="",h=ia)}else x+=ma(o,PA);break;case KA:o=="?"?(t.query="",h=xa):o=="#"?(t.fragment="",h=ia):o!=null&&(t.path[0]+=ma(o,iu));break;case xa:r||o!="#"?o!=null&&(o=="'"&&En(t)?t.query+="%27":t.query+=o=="#"?"%23":ma(o,iu)):(t.fragment="",h=ia);break;case ia:o!=null&&(t.fragment+=ma(o,NA))}C++}},Ma=function(t){var e=De(this,Ma,"URL"),r=1<arguments.length?arguments[1]:void 0,i=String(t),o=lm(e,{type:"URL"});if(r!==void 0){if(r instanceof Ma)var c=Ri(r);else if(r=Ro(c={},String(r)))throw TypeError(r)}if(r=Ro(o,i,null,c))throw TypeError(r);var h=o.searchParams=new cm;c=Is(h),c.updateSearchParams(o.query),c.updateURL=function(){o.query=String(h)||null},xt||(e.href=au.call(e),e.origin=WA.call(e),e.protocol=jA.call(e),e.username=VA.call(e),e.password=YA.call(e),e.host=JA.call(e),e.hostname=zA.call(e),e.port=qA.call(e),e.pathname=XA.call(e),e.search=ZA.call(e),e.searchParams=$A.call(e),e.hash=eg.call(e))},zd=Ma.prototype,au=function(){var t=Ri(this),e=t.scheme,r=t.username,i=t.password,o=t.host,c=t.port,h=t.path,C=t.query,x=t.fragment,Q=e+":";return o!==null?(Q+="//",(t.username!=""||t.password!="")&&(Q+=r+(i?":"+i:"")+"@"),Q+=Xc(o),c!==null&&(Q+=":"+c)):e=="file"&&(Q+="//"),Q+=t.cannotBeABaseURL?h[0]:h.length?"/"+h.join("/"):"",C!==null&&(Q+="?"+C),x!==null&&(Q+="#"+x),Q},WA=function(){var t=Ri(this),e=t.scheme,r=t.port;if(e=="blob")try{return new URL(e.path[0]).origin}catch(i){return"null"}return e!="file"&&En(t)?e+"://"+Xc(t.host)+(r!==null?":"+r:""):"null"},jA=function(){return Ri(this).scheme+":"},VA=function(){return Ri(this).username},YA=function(){return Ri(this).password},JA=function(){var t=Ri(this),e=t.host;return t=t.port,e===null?"":t===null?Xc(e):Xc(e)+":"+t},zA=function(){var t=Ri(this).host;return t===null?"":Xc(t)},qA=function(){var t=Ri(this).port;return t===null?"":String(t)},XA=function(){var t=Ri(this),e=t.path;return t.cannotBeABaseURL?e[0]:e.length?"/"+e.join("/"):""},ZA=function(){var t=Ri(this).query;return t?"?"+t:""},$A=function(){return Ri(this).searchParams},eg=function(){var t=Ri(this).fragment;return t?"#"+t:""},Gs=function(t,e){return{get:t,set:e,configurable:!0,enumerable:!0}};if(xt&&Zr(zd,{href:Gs(au,function(t){var e=Ri(this);if(t=Ro(e,String(t)))throw TypeError(t);Is(e.searchParams).updateSearchParams(e.query)}),origin:Gs(WA),protocol:Gs(jA,function(t){var e=Ri(this);Ro(e,String(t)+":",Gd)}),username:Gs(VA,function(t){var e=Ri(this);if(t=Pa(String(t)),!Qd(e)){e.username="";for(var r=0;r<t.length;r++)e.username+=ma(t[r],Fd)}}),password:Gs(YA,function(t){var e=Ri(this);if(t=Pa(String(t)),!Qd(e)){e.password="";for(var r=0;r<t.length;r++)e.password+=ma(t[r],Fd)}}),host:Gs(JA,function(t){var e=Ri(this);e.cannotBeABaseURL||Ro(e,String(t),Wd)}),hostname:Gs(zA,function(t){var e=Ri(this);e.cannotBeABaseURL||Ro(e,String(t),jd)}),port:Gs(qA,function(t){var e=Ri(this);Qd(e)||((t=String(t))==""?e.port=null:Ro(e,t,Vd))}),pathname:Gs(XA,function(t){var e=Ri(this);e.cannotBeABaseURL||(e.path=[],Ro(e,t+"",$c))}),search:Gs(ZA,function(t){var e=Ri(this);(t=String(t))==""?e.query=null:(t.charAt(0)=="?"&&(t=t.slice(1)),e.query="",Ro(e,t,xa)),Is(e.searchParams).updateSearchParams(e.query)}),searchParams:Gs($A),hash:Gs(eg,function(t){var e=Ri(this);(t=String(t))!=""?(t.charAt(0)=="#"&&(t=t.slice(1)),e.fragment="",Ro(e,t,ia)):e.fragment=null})}),vi(zd,"toJSON",function(){return au.call(this)},{enumerable:!0}),vi(zd,"toString",function(){return au.call(this)},{enumerable:!0}),qc){var tg=qc.createObjectURL,rg=qc.revokeObjectURL;tg&&vi(Ma,"createObjectURL",function(t){return tg.apply(qc,arguments)}),rg&&vi(Ma,"revokeObjectURL",function(t){return rg.apply(qc,arguments)})}Be(Ma,"URL"),Kt({global:!0,forced:!Nd,sham:!xt},{URL:Ma});var Cm=Dr.URL;(function(){function t(Ce){var Pe=0;return function(){return Pe<Ce.length?{done:!1,value:Ce[Pe++]}:{done:!0}}}function e(Ce,Pe){if(Pe)e:{var Je=te;Ce=Ce.split(".");for(var ct=0;ct<Ce.length-1;ct++){var ut=Ce[ct];if(!(ut in Je))break e;Je=Je[ut]}(Pe=Pe(ct=Je[Ce=Ce[Ce.length-1]]))!=ct&&Pe!=null&&$(Je,Ce,{configurable:!0,writable:!0,value:Pe})}}function r(Ce){return(Ce={next:Ce})[Symbol.iterator]=function(){return this},Ce}function i(Ce){var Pe=typeof Symbol!="undefined"&&Symbol.iterator&&Ce[Symbol.iterator];return Pe?Pe.call(Ce):{next:t(Ce)}}function o(){this.m=!1,this.j=null,this.v=void 0,this.h=1,this.u=this.C=0,this.l=null}function c(Ce){if(Ce.m)throw new TypeError("Generator is already running");Ce.m=!0}function h(Ce,Pe){return Ce.h=3,{value:Pe}}function C(Ce){this.g=new o,this.G=Ce}function x(Ce,Pe,Je,ct){try{var ut=Pe.call(Ce.g.j,Je);if(!(ut instanceof Object))throw new TypeError("Iterator result "+ut+" is not an object");if(!ut.done)return Ce.g.m=!1,ut;var Gt=ut.value}catch(It){return Ce.g.j=null,Ce.g.s(It),Q(Ce)}return Ce.g.j=null,ct.call(Ce.g,Gt),Q(Ce)}function Q(Ce){for(;Ce.g.h;)try{var Pe=Ce.G(Ce.g);if(Pe)return Ce.g.m=!1,{value:Pe.value,done:!1}}catch(Je){Ce.g.v=void 0,Ce.g.s(Je)}if(Ce.g.m=!1,Ce.g.l){if(Pe=Ce.g.l,Ce.g.l=null,Pe.F)throw Pe.D;return{value:Pe.return,done:!0}}return{value:void 0,done:!0}}function F(Ce){this.next=function(Pe){return Ce.o(Pe)},this.throw=function(Pe){return Ce.s(Pe)},this.return=function(Pe){return function(Je,ct){c(Je.g);var ut=Je.g.j;return ut?x(Je,"return"in ut?ut.return:function(Gt){return{value:Gt,done:!0}},ct,Je.g.return):(Je.g.return(ct),Q(Je))}(Ce,Pe)},this[Symbol.iterator]=function(){return this}}function V(Ce,Pe){return Pe=new F(new C(Pe)),Me&&Ce.prototype&&Me(Pe,Ce.prototype),Pe}var Y,$=typeof Object.defineProperties=="function"?Object.defineProperty:function(Ce,Pe,Je){return Ce==Array.prototype||Ce==Object.prototype||(Ce[Pe]=Je.value),Ce},te=function(Ce){Ce=[typeof globalThis=="object"&&globalThis,Ce,typeof window=="object"&&window,typeof self=="object"&&self,typeof Ta=="object"&&Ta];for(var Pe=0;Pe<Ce.length;++Pe){var Je=Ce[Pe];if(Je&&Je.Math==Math)return Je}throw Error("Cannot find global object")}(this);if(e("Symbol",function(Ce){function Pe(ut,Gt){this.A=ut,$(this,"description",{configurable:!0,writable:!0,value:Gt})}if(Ce)return Ce;Pe.prototype.toString=function(){return this.A};var Je="jscomp_symbol_"+(1e9*Math.random()>>>0)+"_",ct=0;return function ut(Gt){if(this instanceof ut)throw new TypeError("Symbol is not a constructor");return new Pe(Je+(Gt||"")+"_"+ct++,Gt)}}),e("Symbol.iterator",function(Ce){if(Ce)return Ce;Ce=Symbol("Symbol.iterator");for(var Pe="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),Je=0;Je<Pe.length;Je++){var ct=te[Pe[Je]];typeof ct=="function"&&typeof ct.prototype[Ce]!="function"&&$(ct.prototype,Ce,{configurable:!0,writable:!0,value:function(){return r(t(this))}})}return Ce}),typeof Object.setPrototypeOf=="function")var ce=Object.setPrototypeOf;else{e:{var Ae={};try{Ae.__proto__={a:!0},ce=Ae.a;break e}catch(Ce){}ce=!1}ce=ce?function(Ce,Pe){if(Ce.__proto__=Pe,Ce.__proto__!==Pe)throw new TypeError(Ce+" is not extensible");return Ce}:null}var Me=ce;if(o.prototype.o=function(Ce){this.v=Ce},o.prototype.s=function(Ce){this.l={D:Ce,F:!0},this.h=this.C||this.u},o.prototype.return=function(Ce){this.l={return:Ce},this.h=this.u},C.prototype.o=function(Ce){return c(this.g),this.g.j?x(this,this.g.j.next,Ce,this.g.o):(this.g.o(Ce),Q(this))},C.prototype.s=function(Ce){return c(this.g),this.g.j?x(this,this.g.j.throw,Ce,this.g.o):(this.g.s(Ce),Q(this))},e("Array.prototype.entries",function(Ce){return Ce||function(){return function(Pe,Je){Pe instanceof String&&(Pe+="");var ct=0,ut=!1,Gt={next:function(){if(!ut&&ct<Pe.length){var It=ct++;return{value:Je(It,Pe[It]),done:!1}}return ut=!0,{done:!0,value:void 0}}};return Gt[Symbol.iterator]=function(){return Gt},Gt}(this,function(Pe,Je){return[Pe,Je]})}}),typeof Blob!="undefined"&&(typeof FormData=="undefined"||!FormData.prototype.keys)){var et=function(Ce,Pe){for(var Je=0;Je<Ce.length;Je++)Pe(Ce[Je])},pt=function(Ce){return Ce.replace(/\r?\n|\r/g,`\r
|
|
112
|
+
`)},Qt=function(Ce,Pe,Je){return Pe instanceof Blob?(Je=Je!==void 0?String(Je+""):typeof Pe.name=="string"?Pe.name:"blob",Pe.name===Je&&Object.prototype.toString.call(Pe)!=="[object Blob]"||(Pe=new File([Pe],Je)),[String(Ce),Pe]):[String(Ce),String(Pe)]},kt=function(Ce,Pe){if(Ce.length<Pe)throw new TypeError(Pe+" argument required, but only "+Ce.length+" present.")};ce=typeof globalThis=="object"?globalThis:typeof window=="object"?window:typeof self=="object"?self:this;var Rr=ce.FormData,mt=ce.XMLHttpRequest&&ce.XMLHttpRequest.prototype.send,sr=ce.Request&&ce.fetch,yr=ce.navigator&&ce.navigator.sendBeacon;Ae=ce.Element&&ce.Element.prototype;var ci=ce.Symbol&&Symbol.toStringTag;ci&&(Blob.prototype[ci]||(Blob.prototype[ci]="Blob"),"File"in ce&&!File.prototype[ci]&&(File.prototype[ci]="File"));try{new File([],"")}catch(Ce){ce.File=function(Pe,Je,ct){return Pe=new Blob(Pe,ct||{}),Object.defineProperties(Pe,{name:{value:Je},lastModified:{value:+(ct&&ct.lastModified!==void 0?new Date(ct.lastModified):new Date)},toString:{value:function(){return"[object File]"}}}),ci&&Object.defineProperty(Pe,ci,{value:"File"}),Pe}}var Vi=function(Ce){return Ce.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22")},Wr=function(Ce){this.i=[];var Pe=this;Ce&&et(Ce.elements,function(Je){if(Je.name&&!Je.disabled&&Je.type!=="submit"&&Je.type!=="button"&&!Je.matches("form fieldset[disabled] *"))if(Je.type==="file"){var ct=Je.files&&Je.files.length?Je.files:[new File([],"",{type:"application/octet-stream"})];et(ct,function(ut){Pe.append(Je.name,ut)})}else Je.type==="select-multiple"||Je.type==="select-one"?et(Je.options,function(ut){!ut.disabled&&ut.selected&&Pe.append(Je.name,ut.value)}):Je.type==="checkbox"||Je.type==="radio"?Je.checked&&Pe.append(Je.name,Je.value):(ct=Je.type==="textarea"?pt(Je.value):Je.value,Pe.append(Je.name,ct))})};if((Y=Wr.prototype).append=function(Ce,Pe,Je){kt(arguments,2),this.i.push(Qt(Ce,Pe,Je))},Y.delete=function(Ce){kt(arguments,1);var Pe=[];Ce=String(Ce),et(this.i,function(Je){Je[0]!==Ce&&Pe.push(Je)}),this.i=Pe},Y.entries=function Ce(){var Pe,Je=this;return V(Ce,function(ct){if(ct.h==1&&(Pe=0),ct.h!=3)return Pe<Je.i.length?ct=h(ct,Je.i[Pe]):(ct.h=0,ct=void 0),ct;Pe++,ct.h=2})},Y.forEach=function(Ce,Pe){kt(arguments,1);for(var Je=i(this),ct=Je.next();!ct.done;ct=Je.next()){var ut=i(ct.value);ct=ut.next().value,ut=ut.next().value,Ce.call(Pe,ut,ct,this)}},Y.get=function(Ce){kt(arguments,1);var Pe=this.i;Ce=String(Ce);for(var Je=0;Je<Pe.length;Je++)if(Pe[Je][0]===Ce)return Pe[Je][1];return null},Y.getAll=function(Ce){kt(arguments,1);var Pe=[];return Ce=String(Ce),et(this.i,function(Je){Je[0]===Ce&&Pe.push(Je[1])}),Pe},Y.has=function(Ce){kt(arguments,1),Ce=String(Ce);for(var Pe=0;Pe<this.i.length;Pe++)if(this.i[Pe][0]===Ce)return!0;return!1},Y.keys=function Ce(){var Pe,Je,ct,ut,Gt=this;return V(Ce,function(It){if(It.h==1&&(Pe=i(Gt),Je=Pe.next()),It.h!=3)return Je.done?void(It.h=0):(ct=Je.value,ut=i(ct),h(It,ut.next().value));Je=Pe.next(),It.h=2})},Y.set=function(Ce,Pe,Je){kt(arguments,2),Ce=String(Ce);var ct=[],ut=Qt(Ce,Pe,Je),Gt=!0;et(this.i,function(It){It[0]===Ce?Gt&&(Gt=!ct.push(ut)):ct.push(It)}),Gt&&ct.push(ut),this.i=ct},Y.values=function Ce(){var Pe,Je,ct,ut,Gt=this;return V(Ce,function(It){if(It.h==1&&(Pe=i(Gt),Je=Pe.next()),It.h!=3)return Je.done?void(It.h=0):(ct=Je.value,(ut=i(ct)).next(),h(It,ut.next().value));Je=Pe.next(),It.h=2})},Wr.prototype._asNative=function(){for(var Ce=new Rr,Pe=i(this),Je=Pe.next();!Je.done;Je=Pe.next()){var ct=i(Je.value);Je=ct.next().value,ct=ct.next().value,Ce.append(Je,ct)}return Ce},Wr.prototype._blob=function(){var Ce="----formdata-polyfill-"+Math.random(),Pe=[],Je="--"+Ce+`\r
|
|
113
|
+
Content-Disposition: form-data; name="`;return this.forEach(function(ct,ut){return typeof ct=="string"?Pe.push(Je+Vi(pt(ut))+`"\r
|
|
114
|
+
\r
|
|
115
|
+
`+pt(ct)+`\r
|
|
116
|
+
`):Pe.push(Je+Vi(pt(ut))+'"; filename="'+Vi(ct.name)+`"\r
|
|
117
|
+
Content-Type: `+(ct.type||"application/octet-stream")+`\r
|
|
118
|
+
\r
|
|
119
|
+
`,ct,`\r
|
|
120
|
+
`)}),Pe.push("--"+Ce+"--"),new Blob(Pe,{type:"multipart/form-data; boundary="+Ce})},Wr.prototype[Symbol.iterator]=function(){return this.entries()},Wr.prototype.toString=function(){return"[object FormData]"},Ae&&!Ae.matches&&(Ae.matches=Ae.matchesSelector||Ae.mozMatchesSelector||Ae.msMatchesSelector||Ae.oMatchesSelector||Ae.webkitMatchesSelector||function(Ce){for(var Pe=(Ce=(this.document||this.ownerDocument).querySelectorAll(Ce)).length;0<=--Pe&&Ce.item(Pe)!==this;);return-1<Pe}),ci&&(Wr.prototype[ci]="FormData"),mt){var On=ce.XMLHttpRequest.prototype.setRequestHeader;ce.XMLHttpRequest.prototype.setRequestHeader=function(Ce,Pe){On.call(this,Ce,Pe),Ce.toLowerCase()==="content-type"&&(this.B=!0)},ce.XMLHttpRequest.prototype.send=function(Ce){Ce instanceof Wr?(Ce=Ce._blob(),this.B||this.setRequestHeader("Content-Type",Ce.type),mt.call(this,Ce)):mt.call(this,Ce)}}sr&&(ce.fetch=function(Ce,Pe){return Pe&&Pe.body&&Pe.body instanceof Wr&&(Pe.body=Pe.body._blob()),sr.call(this,Ce,Pe)}),yr&&(ce.navigator.sendBeacon=function(Ce,Pe){return Pe instanceof Wr&&(Pe=Pe._asNative()),yr.call(this,Ce,Pe)}),ce.FormData=Wr}})();let qd=1,Xd=1,ig=(t,e,r,i,o)=>{var c,h,C;const x=[];if(Re(c=t.response_body).call(c,Q=>{var F=Q.buffer.code;F!==0&&(F=fs(F),Q={error:new ue(oe.CAN_NOT_GET_GATEWAY_SERVER,F.desc,{retry:F.retry,csIp:t.detail[502]}),flag:Q.buffer.flag},x.push(Q),Q.flag===4096?ke.joinChooseServer(r.sid,{lts:i,succ:!1,csAddr:e,opid:t.opid,serverList:null,ec:Q.error.message,csIp:Q.error.data&&Q.error.data.csIp,unilbsServerIds:o.toString()}):Q.flag!==1048576&&Q.flag!==4194304||ke.joinWebProxyAP(r.sid,{lts:i,sucess:0,apServerAddr:e,turnServerAddrList:null,errorCode:Q.error.code,eventType:r.cloudProxyServer,unilbsServerIds:o.toString()}))}),x.length)throw z.warning(ne(h=ne(C="[".concat(r.clientId,"] multi unilbs ")).call(C,e," failed, ")).call(h,_t(x).call(x,Q=>{var F,V;return ne(F=ne(V="flag: ".concat(Q.flag,", message: ")).call(V,Q.error.message,", retry: ")).call(F,Q.error.data.retry)}).join(" | "))),new ue(oe.CAN_NOT_GET_GATEWAY_SERVER,_t(x).call(x,Q=>{var F;return ne(F="flag: ".concat(Q.flag,", message: ")).call(F,Q.error.message)}).join(" | "),{retry:!!rr(x).call(x,Q=>Q.error.data.retry),csIp:t.detail[502]})},ng=t=>{if(t.addresses&&t.addresses.length===0&&t.code===0)throw new ue(oe.CAN_NOT_GET_GATEWAY_SERVER,"void gateway address",{retry:!0,csIp:t.detail&&t.detail[502]});if(Xe.GATEWAY_ADDRESS&&0<Xe.GATEWAY_ADDRESS.length){var e;z.debug("assign gateway address to",Xe.GATEWAY_ADDRESS);const r=_t(e=Xe.GATEWAY_ADDRESS).call(e,i=>({ip:i.ip,port:i.port,ticket:t.addresses[0]&&t.addresses[0].ticket}));t.addresses=r}},sg=(t,e,r)=>{var i;const o=Math.floor(1e12*Math.random());return e={appid:t.appId,client_ts:at(),opid:o,sid:t.sid,request_bodies:[{uri:22,buffer:{cname:t.cname,detail:{6:t.stringUid,11:e},key:t.token,service_ids:r,uid:t.uid||0}}]},Re(i=e.request_bodies).call(i,c=>{t.multiIP&&t.multiIP.gateway_ip&&(c.buffer.detail[5]=ht({vocs_ip:[t.multiIP.uni_lbs_ip],vos_ip:[t.multiIP.gateway_ip]}))}),i=new FormData,i.append("request",ht(e)),[i,o]},el=()=>{const t=Xe.AREAS;return t.length===0&&t.push("GLOBAL"),Ul(t).call(t,(e,r,i)=>{var o,c,h,C,x;r=r==="OVERSEA"?ne(o=ne(c=ne(h=ne(C=ne(x="".concat(Hi.ASIA,",")).call(x,Hi.EUROPE,",")).call(C,Hi.AFRICA,",")).call(h,Hi.NORTH_AMERICA,",")).call(c,Hi.SOUTH_AMERICA,",")).call(o,Hi.OCEANIA):Hi[r];var Q;return r?i===0?r:ne(Q="".concat(e,",")).call(Q,r):e},"")};var cu={ASIA:["CHINA","JAPAN","INDIA"],EUROPE:[],NORTH_AMERICA:[],SOUTH_AMERICA:[],OCEANIA:[],AFRICA:[]};let fc=vr(cu),lu="CHINA NORTH_AMERICA EUROPE ASIA JAPAN INDIA OCEANIA SOUTH_AMERICA AFRICA".split(" "),ym=function(t,e){var r=[];if(_r(t).call(t,"GLOBAL")){r=["GLOBAL","OVERSEA"];const o=vr(Ad);if(e==="GLOBAL")throw new ue(oe.INVALID_PARAMS,"GLOBAL is an invalid excludedArea value");if(e==="CHINA")r=["OVERSEA"];else if(i=e,_r(fc).call(fc,i)){t=cu[e]||[];const c=[...r,e,...t];r=Wt(o).call(o,h=>!_r(c).call(c,h))}else if(function(c){let h=!1;return Re(fc).call(fc,C=>{var x;_r(x=cu[C]).call(x,c)&&(h=!0)}),h}(e)){t=function(h){let C;return Re(fc).call(fc,x=>{var Q;_r(Q=cu[x]).call(Q,h)&&(C=x)}),C}(e);const c=[...r,t,e];r=Wt(o).call(o,h=>!_r(c).call(c,h))}else r=t;r=function(c){const h=[];return Re(lu).call(lu,C=>{_r(c).call(c,C)&&h.push(C)}),ne(h).call(h,Wt(c).call(c,C=>!_r(lu).call(lu,C)))}(r)}else r=t;var i;return r};class Im extends mn{constructor(){super();this.retryConfig={timeout:3e3,timeoutFactor:1.5,maxRetryCount:1,maxRetryTimeout:1e4},this.mutex=new ta("config-distribute")}startGetConfigDistribute(e,r){this.joinInfo=e,this.cancelToken=r,this.interval&&this.stopGetConfigDistribute(),this.updateConfigDistribute(),this.interval=window.setInterval(()=>{this.updateConfigDistribute()},Xe.CONFIG_DISTRIBUTE_INTERVAL)}stopGetConfigDistribute(){this.interval&&clearInterval(this.interval),this.cancelToken=this.joinInfo=this.interval=void 0}awaitConfigDistributeComplete(){return Ee(this,null,function*(){this.mutex.isLocked&&(yield this.mutex.lock())()})}updateConfigDistribute(){return Ee(this,null,function*(){if(!this.joinInfo||!this.cancelToken||!this.retryConfig)return void z.debug("[config-distribute] get config distribute interrupted have no joininfo");let e,r=yield this.mutex.lock();try{e=yield ya(this.joinInfo,this.cancelToken,this.retryConfig),z.debug("[config-distribute] get config distribute",ht(e)),e.limit_bitrate&&this.handleBitrateLimit(e.limit_bitrate),this.configs=e}catch(i){let o=new ue(oe.NETWORK_RESPONSE_ERROR,i);z.warning("[config-distribute] ".concat(o.toString()))}finally{r()}})}getBitrateLimit(){return this.configs?this.configs.limit_bitrate:void 0}handleBitrateLimit(e){e&&e.uplink&&e.id&&e.uplink.max_bitrate!==void 0&&e.uplink.min_bitrate!==void 0&&(this.configs&&this.configs.limit_bitrate?this.configs&&this.configs.limit_bitrate&&this.configs.limit_bitrate.id!==e.id&&this.emit(jc.UPDATE_BITRATE_LIMIT,e):this.emit(jc.UPDATE_BITRATE_LIMIT,e))}getLowStreamConfigDistribute(){return this.configs&&this.configs.limit_bitrate&&function(e){for(var r=1;r<arguments.length;r++){var i,o=arguments[r]!=null?arguments[r]:{};if(r%2)Re(i=Ps(Object(o),!0)).call(i,function(h){Qn(e,h,o[h])});else if(Pr)Un(e,Pr(o));else{var c;Re(c=Ps(Object(o))).call(c,function(h){mr(e,h,Ar(o,h))})}}return e}({},this.configs.limit_bitrate.low_stream_uplink)}}var Zd=function(){function t(e){this.input=[],this.size=e}return t.prototype.add=function(e){this.input.push(e),this.input.length>this.size&&this.input.splice(0,1)},t.prototype.diffMean=function(){return this.input.length===0?0:(this.input[this.input.length-1]-this.input[0])/this.input.length},t}(),og=function(t,e){return(og=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)i.hasOwnProperty(o)&&(r[o]=i[o])})(t,e)},$d=function(){return($d=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},Ea,tl={timestamp:0,bitrate:{actualEncoded:0,transmit:0},sendPacketLossRate:0,recvPacketLossRate:0,videoRecv:[],videoSend:[],audioRecv:[],audioSend:[]},ag={firsCount:0,nacksCount:0,plisCount:0,framesDecodeCount:0,framesDecodeInterval:0,framesDecodeFreezeTime:0,decodeFrameRate:0,bytes:0,packetsLost:0,packetLostRate:0,packets:0,ssrc:0},cg={firsCount:0,nacksCount:0,plisCount:0,frameCount:0,bytes:0,packets:0,packetsLost:0,packetLostRate:0,ssrc:0,rttMs:0},lg={bytes:0,packets:0,packetsLost:0,packetLostRate:0,ssrc:0,rttMs:0},ug={jitterBufferMs:0,jitterMs:0,bytes:0,packetsLost:0,packetLostRate:0,packets:0,ssrc:0,receivedFrames:0,droppedFrames:0},eh=function(){function t(e,r){var i=this;this.videoIsReady=!1,this.stats=xi(tl),this.isFirstAudioDecoded=this.isFirstAudioReceived=this.isFirstVideoDecoded=this.isFirstVideoReceived=!1,this.lossRateWindowStats=[],this.pc=e,this.options=r,this.intervalTimer=window.setInterval(function(){return Cc(i,void 0,void 0,function(){return Ia(this,function(o){return this.updateStats(),[2]})})},this.options.updateInterval)}return t.prototype.getStats=function(){return this.stats},t.prototype.setVideoIsReady=function(e){this.videoIsReady=e},t.prototype.setIsFirstAudioDecoded=function(e){this.isFirstAudioDecoded=e},t.prototype.destroy=function(){window.clearInterval(this.intervalTimer),this.pc=void 0},t.prototype.calcLossRate=function(e){var r=this;this.lossRateWindowStats.push(e),this.lossRateWindowStats.length>this.options.lossRateInterval&&this.lossRateWindowStats.splice(0,1);for(var i=this.lossRateWindowStats.length,o=0,c=0,h=0,C=0,x=function(V){e[V].forEach(function(Y,$){if(r.lossRateWindowStats[i-1][V][$]&&r.lossRateWindowStats[0][V][$]){var te=r.lossRateWindowStats[i-1][V][$].packets-r.lossRateWindowStats[0][V][$].packets;$=r.lossRateWindowStats[i-1][V][$].packetsLost-r.lossRateWindowStats[0][V][$].packetsLost,V==="videoSend"||V==="audioSend"?(o+=te,h+=$):(c+=te,C+=$),Number.isNaN(te)||Number.isNaN(te)?Y.packetLostRate=0:Y.packetLostRate=0>=te||0>=$?0:$/(te+$)}})},Q=0,F=["videoSend","audioSend","videoRecv","audioRecv"];Q<F.length;Q++)x(F[Q]);e.sendPacketLossRate=0>=o||0>=h?0:h/(o+h),e.recvPacketLossRate=0>=c||0>=C?0:C/(c+C)},t}(),Sm=function(t){function e(){var r=t!==null&&t.apply(this,arguments)||this;return r._stats=tl,r.lastDecodeVideoReceiverStats=new Map,r}return _c(e,t),e.prototype.updateStats=function(){return Cc(this,void 0,void 0,function(){var r,i,o,c;return Ia(this,function(h){switch(h.label){case 0:return[4,this._getStats()];case 1:return r=h.sent(),i=this.statsResponsesToObjects(r),this._stats=xi(tl),o=i.filter(function(C){return C.type==="ssrc"}),this.processSSRCStats(o),(c=i.find(function(C){return C.type==="VideoBwe"}))&&this.processBandwidthStats(c),this._stats.timestamp=Date.now(),this.calcLossRate(this._stats),this.stats=this._stats,[2]}})})},e.prototype.processBandwidthStats=function(r){this._stats.bitrate={actualEncoded:Number(r.googActualEncBitrate),targetEncoded:Number(r.googTargetEncBitrate),retransmit:Number(r.googRetransmitBitrate),transmit:Number(r.googTransmitBitrate)},this._stats.sendBandwidth=Number(r.googAvailableSendBandwidth)},e.prototype.processSSRCStats=function(r){var i=this;r.forEach(function(o){var c=o.id.includes("send");switch(o.mediaType+"_"+(c?"send":"recv")){case"video_send":c=xi(cg),c.codec=o.googCodecName,c.adaptionChangeReason="none",o.googCpuLimitedResolution&&(c.adaptionChangeReason="cpu"),o.googBandwidthLimitedResolution&&(c.adaptionChangeReason="bandwidth"),c.avgEncodeMs=Number(o.googAvgEncodeMs),c.inputFrame={width:Number(o.googFrameWidthInput)||Number(o.googFrameWidthSent),height:Number(o.googFrameHeightInput)||Number(o.googFrameHeightSent),frameRate:Number(o.googFrameRateInput)},c.sentFrame={width:Number(o.googFrameWidthSent),height:Number(o.googFrameHeightSent),frameRate:Number(o.googFrameRateInput)},c.firsCount=Number(o.googFirReceived),c.nacksCount=Number(o.googNacksReceived),c.plisCount=Number(o.googPlisReceived),c.frameCount=Number(o.framesEncoded),c.bytes=Number(o.bytesSent),c.packets=Number(o.packetsSent),c.packetsLost=Number(o.packetsLost),c.ssrc=Number(o.ssrc),c.rttMs=Number(o.googRtt||0),i._stats.videoSend.push(c),i._stats.rtt=c.rttMs;break;case"video_recv":c=xi(ag);var h=i.lastDecodeVideoReceiverStats.get(Number(o.ssrc));if(c.codec=o.googCodecName,c.targetDelayMs=Number(o.googTargetDelayMs),c.renderDelayMs=Number(o.googRenderDelayMs),c.currentDelayMs=Number(o.googCurrentDelayMs),c.minPlayoutDelayMs=Number(o.googMinPlayoutDelayMs),c.decodeMs=Number(o.googDecodeMs),c.maxDecodeMs=Number(o.googMaxDecodeMs),c.receivedFrame={width:Number(o.googFrameWidthReceived),height:Number(o.googFrameHeightReceived),frameRate:Number(o.googFrameRateReceived)},c.decodedFrame={width:Number(o.googFrameWidthReceived),height:Number(o.googFrameHeightReceived),frameRate:Number(o.googFrameRateDecoded)},c.outputFrame={width:Number(o.googFrameWidthReceived),height:Number(o.googFrameHeightReceived),frameRate:Number(o.googFrameRateOutput)},c.jitterBufferMs=Number(o.googJitterBufferMs),c.firsCount=Number(o.googFirsSent),c.nacksCount=Number(o.googNacksSent),c.plisCount=Number(o.googPlisSent),c.framesDecodeCount=Number(o.framesDecoded),c.bytes=Number(o.bytesReceived),c.packets=Number(o.packetsReceived),c.packetsLost=Number(o.packetsLost),c.ssrc=Number(o.ssrc),0<c.packets&&!i.isFirstVideoReceived&&(i.onFirstVideoReceived&&i.onFirstVideoReceived(),i.isFirstVideoReceived=!0),0<c.framesDecodeCount&&!i.isFirstVideoDecoded&&(i.onFirstVideoDecoded&&i.onFirstVideoDecoded(c.decodedFrame.width,c.decodedFrame.height),i.isFirstVideoDecoded=!0),h){o=h.stats;var C=Date.now()-h.lts;c.framesDecodeFreezeTime=o.framesDecodeFreezeTime,c.framesDecodeInterval=o.framesDecodeInterval,c.framesDecodeCount>o.framesDecodeCount&&i.isFirstVideoDecoded?(h.lts=Date.now(),c.framesDecodeInterval=C,c.framesDecodeInterval>=i.options.freezeRateLimit&&(i.videoIsReady?c.framesDecodeFreezeTime+=c.framesDecodeInterval:i.setVideoIsReady(!0))):c.framesDecodeCount<h.stats.framesDecodeCount&&(c.framesDecodeInterval=0)}i.lastDecodeVideoReceiverStats.set(c.ssrc,{stats:$d({},c),lts:Date.now()}),i._stats.videoRecv.push(c);break;case"audio_recv":c=xi(ug),c.codec=o.googCodecName,c.outputLevel=Math.abs(Number(o.audioOutputLevel))/32767,c.decodingCNG=Number(o.googDecodingCNG),c.decodingCTN=Number(o.googDecodingCTN),c.decodingCTSG=Number(o.googDecodingCTSG),c.decodingNormal=Number(o.googDecodingNormal),c.decodingPLC=Number(o.googDecodingPLC),c.decodingPLCCNG=Number(o.googDecodingPLCCNG),c.expandRate=Number(o.googExpandRate),c.accelerateRate=Number(o.googAccelerateRate),c.preemptiveExpandRate=Number(o.googPreemptiveExpandRate),c.secondaryDecodedRate=Number(o.googSecondaryDecodedRate),c.speechExpandRate=Number(o.googSpeechExpandRate),c.preferredJitterBufferMs=Number(o.googPreferredJitterBufferMs),c.jitterBufferMs=Number(o.googJitterBufferMs),c.jitterMs=Number(o.googJitterReceived),c.bytes=Number(o.bytesReceived),c.packets=Number(o.packetsReceived),c.packetsLost=Number(o.packetsLost),c.ssrc=Number(o.ssrc),c.receivedFrames=Number(o.googDecodingCTN)||Number(o.packetsReceived),c.droppedFrames=Number(o.googDecodingPLC)+Number(o.googDecodingPLCCNG)||Number(o.packetsLost),0<c.receivedFrames&&!i.isFirstAudioReceived&&(i.onFirstAudioReceived&&i.onFirstAudioReceived(),i.isFirstAudioReceived=!0),0<c.decodingNormal&&!i.isFirstAudioDecoded&&(i.onFirstAudioDecoded&&i.onFirstAudioDecoded(),i.isFirstAudioDecoded=!0),i._stats.audioRecv.push(c);break;case"audio_send":c=xi(lg),c.codec=o.googCodecName,c.inputLevel=Math.abs(Number(o.audioInputLevel))/32767,c.aecReturnLoss=Number(o.googEchoCancellationReturnLoss||0),c.aecReturnLossEnhancement=Number(o.googEchoCancellationReturnLossEnhancement||0),c.residualEchoLikelihood=Number(o.googResidualEchoLikelihood||0),c.residualEchoLikelihoodRecentMax=Number(o.googResidualEchoLikelihoodRecentMax||0),c.bytes=Number(o.bytesSent),c.packets=Number(o.packetsSent),c.packetsLost=Number(o.packetsLost),c.ssrc=Number(o.ssrc),c.rttMs=Number(o.googRtt||0),i._stats.rtt=c.rttMs,i._stats.audioSend.push(c)}})},e.prototype._getStats=function(){var r=this;return new Promise(function(i,o){r.pc.getStats(i,o)})},e.prototype.statsResponsesToObjects=function(r){var i=[];return r.result().forEach(function(o){var c={id:o.id,timestamp:o.timestamp.valueOf().toString(),type:o.type};o.names().forEach(function(h){c[h]=o.stat(h)}),i.push(c)}),i},e}(eh);(function(t){t.CERTIFICATE="certificate",t.CODEC="codec",t.CANDIDATE_PAIR="candidate-pair",t.LOCAL_CANDIDATE="local-candidate",t.REMOTE_CANDIDATE="remote-candidate",t.INBOUND="inbound-rtp",t.TRACK="track",t.OUTBOUND="outbound-rtp",t.PC="peer-connection",t.REMOTE_INBOUND="remote-inbound-rtp",t.REMOTE_OUTBOUND="remote-outbound-rtp",t.TRANSPORT="transport",t.CSRC="csrc",t.DATA_CHANNEL="data-channel",t.STREAM="stream",t.SENDER="sender",t.RECEIVER="receiver"})(Ea||(Ea={}));var dg=function(t){function e(){var r=t!==null&&t.apply(this,arguments)||this;return r._stats=tl,r.lastDecodeVideoReceiverStats=new Map,r.lastVideoFramesRecv=new Map,r.lastVideoFramesSent=new Map,r.lastVideoFramesDecode=new Map,r.lastVideoJBDelay=new Map,r.lastAudioJBDelay=new Map,r.mediaBytesSent=new Map,r.mediaBytesRetransmit=new Map,r.mediaBytesTargetEncode=new Map,r.lastEncoderMs=new Map,r}return _c(e,t),e.prototype.updateStats=function(){return Cc(this,void 0,void 0,function(){var r,i=this;return Ia(this,function(o){switch(o.label){case 0:return r=this,[4,this.pc.getStats()];case 1:return r.report=o.sent(),this._stats=xi(tl),this.report.forEach(function(c){switch(c.type){case Ea.OUTBOUND:c.mediaType==="audio"?i.processAudioOutboundStats(c):c.mediaType==="video"&&i.processVideoOutboundStats(c);break;case Ea.INBOUND:c.mediaType==="audio"?i.processAudioInboundStats(c):c.mediaType==="video"&&i.processVideoInboundStats(c);break;case Ea.TRANSPORT:(c=i.report.get(c.selectedCandidatePairId))&&i.processCandidatePairStats(c);break;case Ea.CANDIDATE_PAIR:c.selected&&i.processCandidatePairStats(c)}}),this.updateSendBitrate(),this._stats.timestamp=Date.now(),this.calcLossRate(this._stats),this.stats=this._stats,[2]}})})},e.prototype.processCandidatePairStats=function(r){this._stats.sendBandwidth=r.availableOutgoingBitrate||0,r.currentRoundTripTime&&(this._stats.rtt=1e3*r.currentRoundTripTime),this._stats.videoSend.forEach(function(i){!i.rttMs&&r.currentRoundTripTime&&(i.rttMs=1e3*r.currentRoundTripTime)}),this._stats.audioSend.forEach(function(i){!i.rttMs&&r.currentRoundTripTime&&(i.rttMs=1e3*r.currentRoundTripTime)})},e.prototype.processAudioInboundStats=function(r){var i=this._stats.audioRecv.find(function(o){return o.ssrc===r.ssrc});i||(i=xi(ug),this._stats.audioRecv.push(i)),i.ssrc=r.ssrc,i.packets=r.packetsReceived,i.packetsLost=r.packetsLost,i.bytes=r.bytesReceived,i.jitterMs=1e3*r.jitter,r.trackId&&this.processAudioTrackReceiverStats(r.trackId,i),r.codecId&&(i.codec=this.getCodecFromCodecStats(r.codecId)),i.receivedFrames||(i.receivedFrames=r.packetsReceived),i.droppedFrames||(i.droppedFrames=r.packetsLost),0<i.receivedFrames&&!this.isFirstAudioReceived&&(this.onFirstAudioReceived&&this.onFirstAudioReceived(),this.isFirstAudioReceived=!0),i.outputLevel&&0<i.outputLevel&&!this.isFirstAudioDecoded&&(this.onFirstAudioDecoded&&this.onFirstAudioDecoded(),this.isFirstAudioDecoded=!0)},e.prototype.processVideoInboundStats=function(r){var i=this._stats.videoRecv.find(function(Q){return Q.ssrc===r.ssrc});i||(i=xi(ag),this._stats.videoRecv.push(i)),i.ssrc=r.ssrc,i.packets=r.packetsReceived,i.packetsLost=r.packetsLost,i.bytes=r.bytesReceived,i.firsCount=r.firCount,i.nacksCount=r.nackCount,i.plisCount=r.pliCount,i.framesDecodeCount=r.framesDecoded;var o=this.lastDecodeVideoReceiverStats.get(i.ssrc),c=this.lastVideoFramesDecode.get(i.ssrc),h=Date.now();if(0<i.framesDecodeCount&&!this.isFirstVideoDecoded){var C=i.decodedFrame?i.decodedFrame.width:0,x=i.decodedFrame?i.decodedFrame.height:0;this.onFirstVideoDecoded&&this.onFirstVideoDecoded(C,x),this.isFirstVideoDecoded=!0}o&&(C=o.stats,x=h-o.lts,i.framesDecodeFreezeTime=C.framesDecodeFreezeTime,i.framesDecodeInterval=C.framesDecodeInterval,i.framesDecodeCount>C.framesDecodeCount&&this.isFirstVideoDecoded?(o.lts=Date.now(),i.framesDecodeInterval=x,i.framesDecodeInterval>=this.options.freezeRateLimit&&(this.videoIsReady?i.framesDecodeFreezeTime+=i.framesDecodeInterval:this.setVideoIsReady(!0))):i.framesDecodeCount<C.framesDecodeCount&&(i.framesDecodeInterval=0)),c&&800<=h-c.lts?(i.decodeFrameRate=Math.round((i.framesDecodeCount-c.count)/((h-c.lts)/1e3)),this.lastVideoFramesDecode.set(i.ssrc,{count:i.framesDecodeCount,lts:h,rate:i.decodeFrameRate})):c?i.decodeFrameRate=c.rate:this.lastVideoFramesDecode.set(i.ssrc,{count:i.framesDecodeCount,lts:h,rate:0}),r.totalDecodeTime&&(i.decodeMs=1e3*r.totalDecodeTime),r.trackId&&this.processVideoTrackReceiverStats(r.trackId,i),r.codecId&&(i.codec=this.getCodecFromCodecStats(r.codecId)),r.framerateMean&&(i.framesRateFirefox=r.framerateMean),0<i.packets&&!this.isFirstVideoReceived&&(this.onFirstVideoReceived&&this.onFirstVideoReceived(),this.isFirstVideoReceived=!0),this.lastDecodeVideoReceiverStats.set(i.ssrc,{stats:$d({},i),lts:o?o.lts:Date.now()})},e.prototype.processVideoOutboundStats=function(r){var i=this._stats.videoSend.find(function(h){return h.ssrc===r.ssrc});i||(i=xi(cg),this._stats.videoSend.push(i));var o=this.mediaBytesSent.get(r.ssrc);if(o?o.add(r.bytesSent):((c=new Zd(10)).add(r.bytesSent),this.mediaBytesSent.set(r.ssrc,c)),r.retransmittedBytesSent!==void 0&&((o=this.mediaBytesRetransmit.get(r.ssrc))?o.add(r.retransmittedBytesSent):((c=new Zd(10)).add(r.retransmittedBytesSent),this.mediaBytesRetransmit.set(r.ssrc,c))),r.totalEncodedBytesTarget){var c;(o=this.mediaBytesTargetEncode.get(r.ssrc))?o.add(r.totalEncodedBytesTarget):((c=new Zd(10)).add(r.totalEncodedBytesTarget),this.mediaBytesTargetEncode.set(r.ssrc,c))}i.ssrc=r.ssrc,i.bytes=r.bytesSent,i.packets=r.packetsSent,i.firsCount=r.firCount,i.nacksCount=r.nackCount,i.plisCount=r.pliCount,i.frameCount=r.framesEncoded,i.adaptionChangeReason=r.qualityLimitationReason,r.totalEncodeTime&&r.framesEncoded&&(o=this.lastEncoderMs.get(r.ssrc),i.avgEncodeMs=!o||o.lastFrameCount>r.framesEncoded?1e3*r.totalEncodeTime/r.framesEncoded:1e3*(r.totalEncodeTime-o.lastEncoderTime)/(r.framesEncoded-o.lastFrameCount),this.lastEncoderMs.set(r.ssrc,{lastFrameCount:r.framesEncoded,lastEncoderTime:r.totalEncodeTime,lts:Date.now()})),r.codecId&&(i.codec=this.getCodecFromCodecStats(r.codecId)),r.mediaSourceId&&this.processVideoMediaSource(r.mediaSourceId,i),r.trackId&&this.processVideoTrackSenderStats(r.trackId,i),r.remoteId?this.processRemoteInboundStats(r.remoteId,i):(o=this.findRemoteStatsId(r.ssrc,Ea.REMOTE_INBOUND))&&this.processRemoteInboundStats(o,i)},e.prototype.processAudioOutboundStats=function(r){var i=this._stats.audioSend.find(function(c){return c.ssrc===r.ssrc});if(i||(i=xi(lg),this._stats.audioSend.push(i)),i.ssrc=r.ssrc,i.packets=r.packetsSent,i.bytes=r.bytesSent,r.mediaSourceId&&this.processAudioMediaSource(r.mediaSourceId,i),r.codecId&&(i.codec=this.getCodecFromCodecStats(r.codecId)),r.trackId&&this.processAudioTrackSenderStats(r.trackId,i),r.remoteId)this.processRemoteInboundStats(r.remoteId,i);else{var o=this.findRemoteStatsId(r.ssrc,Ea.REMOTE_INBOUND);o&&this.processRemoteInboundStats(o,i)}},e.prototype.findRemoteStatsId=function(r,i){var o=Array.from(this.report.values()).find(function(c){return c.type===i&&c.ssrc===r});return o?o.id:null},e.prototype.processVideoMediaSource=function(r,i){(r=this.report.get(r))&&r.width&&r.height&&r.framesPerSecond&&(i.inputFrame={width:r.width,height:r.height,frameRate:r.framesPerSecond})},e.prototype.processAudioMediaSource=function(r,i){(r=this.report.get(r))&&(i.inputLevel=r.audioLevel)},e.prototype.processVideoTrackSenderStats=function(r,i){if(r=this.report.get(r)){var o=0,c=Date.now(),h=this.lastVideoFramesSent.get(i.ssrc);h&&800<=c-h.lts?(o=Math.round((r.framesSent-h.count)/((c-h.lts)/1e3)),this.lastVideoFramesSent.set(i.ssrc,{count:r.framesSent,lts:c,rate:o})):h?o=h.rate:this.lastVideoFramesSent.set(i.ssrc,{count:r.framesSent,lts:c,rate:0}),i.sentFrame={width:r.frameWidth,height:r.frameHeight,frameRate:o}}},e.prototype.processVideoTrackReceiverStats=function(r,i){if(r=this.report.get(r)){var o=this.lastVideoFramesRecv.get(i.ssrc),c=Date.now();i.framesReceivedCount=r.framesReceived;var h=0;o&&800<=c-o.lts?(h=Math.round((r.framesReceived-o.count)/((c-o.lts)/1e3)),this.lastVideoFramesRecv.set(i.ssrc,{count:r.framesReceived,lts:c,rate:h})):o?h=o.rate:this.lastVideoFramesRecv.set(i.ssrc,{count:r.framesReceived,lts:c,rate:0}),i.receivedFrame={width:r.frameWidth||0,height:r.frameHeight||0,frameRate:h||0},i.decodedFrame={width:r.frameWidth||0,height:r.frameHeight||0,frameRate:i.decodeFrameRate||0},i.outputFrame={width:r.frameWidth||0,height:r.frameHeight||0,frameRate:i.decodeFrameRate||0},r.jitterBufferDelay&&r.jitterBufferEmittedCount&&(o=this.lastVideoJBDelay.get(i.ssrc),this.lastVideoJBDelay.set(i.ssrc,{jitterBufferDelay:r.jitterBufferDelay,jitterBufferEmittedCount:r.jitterBufferEmittedCount}),o||(o={jitterBufferDelay:0,jitterBufferEmittedCount:0}),r=1e3*(r.jitterBufferDelay-o.jitterBufferDelay)/(r.jitterBufferEmittedCount-o.jitterBufferEmittedCount),i.jitterBufferMs=r,i.currentDelayMs=Math.round(r))}},e.prototype.processAudioTrackSenderStats=function(r,i){(r=this.report.get(r))&&(i.aecReturnLoss=r.echoReturnLoss||0,i.aecReturnLossEnhancement=r.echoReturnLossEnhancement||0)},e.prototype.processAudioTrackReceiverStats=function(r,i){if(r=this.report.get(r)){if(r.removedSamplesForAcceleration&&r.totalSamplesReceived&&(i.accelerateRate=r.removedSamplesForAcceleration/r.totalSamplesReceived),r.jitterBufferDelay&&r.jitterBufferEmittedCount){var o=this.lastAudioJBDelay.get(i.ssrc);this.lastAudioJBDelay.set(i.ssrc,{jitterBufferDelay:r.jitterBufferDelay,jitterBufferEmittedCount:r.jitterBufferEmittedCount}),o||(o={jitterBufferDelay:0,jitterBufferEmittedCount:0}),i.jitterBufferMs=Math.round(1e3*(r.jitterBufferDelay-o.jitterBufferDelay)/(r.jitterBufferEmittedCount-o.jitterBufferEmittedCount))}i.outputLevel=r.audioLevel,o=1920,r.totalSamplesDuration&&r.totalSamplesReceived&&(o=r.totalSamplesReceived/r.totalSamplesDuration/50,i.receivedFrames=Math.round(r.totalSamplesReceived/o)),r.concealedSamples&&(i.droppedFrames=Math.round(r.concealedSamples/o))}},e.prototype.processRemoteInboundStats=function(r,i){(r=this.report.get(r))&&(i.packetsLost=r.packetsLost,r.roundTripTime&&(i.rttMs=1e3*r.roundTripTime))},e.prototype.getCodecFromCodecStats=function(r){return r=this.report.get(r),r&&(r=r.mimeType.match(/\/(.*)$/))&&r[1]?r[1]:""},e.prototype.updateSendBitrate=function(){var r=0,i=null,o=null;this.mediaBytesSent.forEach(function(c){r+=c.diffMean()}),this.mediaBytesRetransmit.forEach(function(c){i=i===null?c.diffMean():i+c.diffMean()}),this.mediaBytesTargetEncode.forEach(function(c){o=o===null?c.diffMean():o+c.diffMean()}),this._stats.bitrate={actualEncoded:8*(i!==null?r-i:r)/(this.options.updateInterval/1e3),transmit:8*r/(this.options.updateInterval/1e3)},i!==null&&(this._stats.bitrate.retransmit=8*i/(this.options.updateInterval/1e3)),o!==null&&(this._stats.bitrate.targetEncoded=8*o/(this.options.updateInterval/1e3))},e}(eh),Tm=function(t){function e(){return t!==null&&t.apply(this,arguments)||this}return _c(e,t),e.prototype.updateStats=function(){return Promise.resolve()},e}(eh);class hg{constructor(e){this.localCandidateCount=0,this.allCandidateReceived=!1,this.videoTrack=this.audioTrack=null,this.mediaStream=new MediaStream,this.ID=gg,gg+=1,this.spec=e,this.createPeerConnection(),e=this.pc;var r=void 0,i=void 0,o=Dt()?1200:void 0;r===void 0&&(r=250),i===void 0&&(i=8),o===void 0&&(o=500);var c,h=(c=navigator.userAgent.toLocaleLowerCase().match(/chrome\/[\d]./i))&&c[0]?Number(c[0].split("/")[1]):null;this.statsFilter=h?76>h?new Sm(e,{updateInterval:r,lossRateInterval:i,freezeRateLimit:o}):new dg(e,{updateInterval:r,lossRateInterval:i,freezeRateLimit:o}):window.RTCStatsReport&&e.getStats()instanceof Promise?new dg(e,{updateInterval:r,lossRateInterval:i,freezeRateLimit:o}):new Tm(e,{updateInterval:r,lossRateInterval:i,freezeRateLimit:o})}get _statsFilter(){return this.statsFilter}getStats(){return this.statsFilter.getStats()}createOfferSDP(){return Ee(this,null,function*(){try{let e=yield this.pc.createOffer(this.offerOptions);if(!e.sdp)throw Error("offer sdp is empty");return e.sdp}catch(e){throw z.error("create offer error:",e.toString()),new ue(oe.CREATE_OFFER_FAILED,e.toString())}})}setOfferSDP(e){return Ee(this,null,function*(){try{yield this.pc.setLocalDescription({type:"offer",sdp:e})}catch(r){throw z.error("set local offer error",r.toString()),new ue(oe.CREATE_OFFER_FAILED,r.toString())}})}setAnswerSDP(e){return Ee(this,null,function*(){try{yield this.pc.setRemoteDescription({type:"answer",sdp:e})}catch(r){if(r.name!=="InvalidStateError"||this.pc.signalingState!=="stable")throw z.error("set remote answer error",r.toString()),new ue(oe.SET_ANSWER_FAILED,r.toString());z.debug("[pc-".concat(this.ID,"] ignore invalidstate error"))}})}close(){this.onConnectionStateChange=this.onICEConnectionStateChange=void 0;try{this.pc.oniceconnectionstatechange=null,this.pc.onconnectionstatechange=null,this.pc.onsignalingstatechange=null,this.pc.onicecandidateerror=null,this.pc.onicecandidate=null,this.pc.close(),this.pc=null,this.videoTransceiver=this.audioTransceiver=void 0}catch(e){}this.statsFilter.destroy()}createPeerConnection(){let e={iceServers:[]},r=c=>{const h=[];return Re(c).call(c,C=>{if(C.security){var x;C.tcpport&&h.push({username:C.username,credential:C.password,credentialType:"password",urls:ne(x="turns:".concat((V=C.turnServerURL,V.match(/^[\.:\d]+$/)?"".concat(V.replace(/[^\d]/g,"-"),".edge.agora.io"):(z.info("Cannot recognized as IP address ".concat(V,". Used As Host instead")),V)),":")).call(x,C.tcpport,"?transport=tcp")})}else{var Q,F;C.udpport&&h.push({username:C.username,credential:C.password,credentialType:"password",urls:ne(Q="turn:".concat(C.turnServerURL,":")).call(Q,C.udpport,"?transport=udp")}),C.tcpport&&h.push({username:C.username,credential:C.password,credentialType:"password",urls:ne(F="turn:".concat(C.turnServerURL,":")).call(F,C.tcpport,"?transport=tcp")})}var V}),h};var i,o;this.spec.iceServers?e.iceServers=this.spec.iceServers:this.spec.turnServer&&this.spec.turnServer.mode!=="off"&&(oa(this.spec.turnServer.servers)?e.iceServers=this.spec.turnServer.servers:(e.iceServers&&e.iceServers.push(...r(this.spec.turnServer.servers)),e.iceServers&&this.spec.turnServer.serversFromGateway&&e.iceServers.push(...r(this.spec.turnServer.serversFromGateway)),Re(i=ne(o=this.spec.turnServer.servers).call(o,this.spec.turnServer.serversFromGateway||[])).call(i,c=>{c.forceturn&&(e.iceTransportPolicy="relay")}))),Xe.CHROME_FORCE_PLAN_B&&Ji()&&(e.sdpSemantics="plan-b",Nr.supportUnifiedPlan=!1),this.pc=new RTCPeerConnection(e,{optional:[{googDscp:!0}]}),this.pc.oniceconnectionstatechange=()=>{this.onICEConnectionStateChange&&this.onICEConnectionStateChange(this.pc.iceConnectionState)},this.pc.onconnectionstatechange=()=>{this.onConnectionStateChange&&this.onConnectionStateChange(this.pc.connectionState)},this.pc.onsignalingstatechange=()=>{this.pc&&this.pc.connectionState==="closed"&&this.onConnectionStateChange&&this.onConnectionStateChange(this.pc.connectionState)},this.pc.onicecandidate=c=>{if(!c.candidate)return this.pc.onicecandidate=null,this.allCandidateReceived=!0,void z.debug("[pc-".concat(this.ID,"] local candidate count"),this.localCandidateCount);this.localCandidateCount+=1},_s(()=>{this.allCandidateReceived||(this.allCandidateReceived=!0,z.debug("[pc-".concat(this.ID,"] onicecandidate timeout, local candidate count"),this.localCandidateCount))},Xe.CANDIDATE_TIMEOUT)}}class fg extends hg{constructor(e){super(e)}setOfferSDP(e){var r=i=>super[i];return Ee(this,null,function*(){let o=Xe.CUSTOM_PUB_OFFER_MODIFIER;return o&&(e=o(e)),yield r("setOfferSDP").call(this,e)})}setAnswerSDP(e){var r=i=>super[i];return Ee(this,null,function*(){let o=Xe.CUSTOM_PUB_ANSWER_MODIFIER;return o&&(e=o(e)),yield r("setAnswerSDP").call(this,e)})}getAnswerSDP(){return this.pc.remoteDescription}getOfferSDP(){return this.pc.localDescription}addStream(e){return Ee(this,null,function*(){e=e.getTracks();for(let r of e)yield this.addTrack(r)})}replaceTrack(e){return Ee(this,null,function*(){if(!Nr.supportReplaceTrack){var r=e.kind==="audio"?this.audioTrack:this.videoTrack;if(!r)throw new ue(oe.UNEXPECTED_ERROR,"can not find replaced track");return yield this.removeTrack(r),yield this.addTrack(e),!0}let i=this.getSender(e.kind),o=rr(r=this.mediaStream.getTracks()).call(r,c=>c.kind===e.kind);o&&this.mediaStream.removeTrack(o),this.mediaStream.addTrack(e);try{yield i.replaceTrack(e),e.kind==="audio"?this.audioTrack=e:this.videoTrack=e}catch(c){throw new ue(oe.SENDER_REPLACE_FAILED,c.toString())}return!1})}removeTrack(e){return Ee(this,null,function*(){let r=this.getSender(e.kind);this.mediaStream.removeTrack(e);try{let i=Ye();i.name==="Safari"&&i.version==="11"&&(yield r.replaceTrack(null)),this.pc.removeTrack(r)}catch(i){z.warning("[pc-".concat(this.ID,"] remove track error, ignore"),i)}e.kind==="audio"?(this.audioTrack=null,this.audioSender=void 0,this.audioTransceiver&&(this.audioTransceiver.direction="inactive"),this.audioTransceiver=void 0):(this.videoTrack=null,this.videoSender=void 0,this.videoTransceiver&&(this.videoTransceiver.direction="inactive"),this.videoTransceiver=void 0)})}onOfferSettled({videoActive:e,audioActive:r}){if(Dt())z.debug("firefox do not set sender parameter");else{if(this.audioSender){let i={networkQuality:void 0,active:!0};Xe.DSCP_TYPE&&(i.networkQuality=Xe.DSCP_TYPE),this.audioTrack&&(i.active=!!r),this.setAudioRtpEncodingParameters(i).catch(o=>{z.debug("set audio sender`s network priority failed")})}this.videoSender&&(r={networkQuality:void 0,active:!0},Xe.DSCP_TYPE&&(r.networkQuality=Xe.DSCP_TYPE),this.videoTrack&&(r.active=!!e),this.setVideoRtpEncodingParameters(r).catch(i=>{z.debug("set video sender`s network priority failed")}))}}addTrack(e){return Ee(this,null,function*(){let r=Nr;if(e.kind==="audio"&&this.audioTrack||e.kind==="video"&&this.videoTrack)throw new ue(oe.UNEXPECTED_ERROR,"Can't add multiple stream");let i,o;this.mediaStream.addTrack(e),r.supportUnifiedPlan?(i=yield function(c,h,C){return Ee(this,null,function*(){var x;let Q=rr(x=c.getTransceivers()).call(x,F=>F.direction==="inactive"&&F.receiver.track.kind===h.kind);return Q?(Q.direction="sendrecv",yield Q.sender.replaceTrack(h),Q):c.addTransceiver(h,{direction:"sendrecv",streams:[C]})})}(this.pc,e,this.mediaStream),o=i.sender):o=this.pc.addTrack(e,this.mediaStream),e.kind==="audio"?(this.audioTrack=e,this.audioSender=o,this.audioTransceiver=i):(this.videoTrack=e,this.videoSender=o,this.videoTransceiver=i)})}setRtpSenderParameters(e,r){return Ee(this,null,function*(){if(e=this.videoSender||(this.videoTransceiver?this.videoTransceiver.sender:void 0)){var i=e.getParameters();i.degradationPreference=r;try{yield e.setParameters(i)}catch(o){z.debug("[".concat(this.ID,"] ignore RtpSender.setParameters"),o.toString())}}})}setVideoRtpEncodingParameters(e){return Ee(this,null,function*(){let r=this.videoSender||(this.videoTransceiver?this.videoTransceiver.sender:void 0);if(!r)throw new ue(oe.LOW_STREAM_ENCODING_ERROR,"Low stream has no video sender.");let i=r.getParameters();if(!i.encodings||!i.encodings[0])throw new ue(oe.LOW_STREAM_ENCODING_ERROR,"Low stream RtpEncodingParameters is empty.");e.scaleResolutionDownBy&&(i.encodings[0].scaleResolutionDownBy=e.scaleResolutionDownBy),e.maxBitrate&&(i.encodings[0].maxBitrate=e.maxBitrate),e.maxFramerate&&(i.encodings[0].maxFramerate=e.maxFramerate),e.active!==void 0&&(z.debug("set video sender encoding active:",e.active),i.encodings[0].active=e.active);let o=["very-low","low","medium","high"];return e.networkPriority&&_r(o).call(o,e.networkPriority)&&(z.debug("set video sender network quality:",e.networkPriority),i.encodings[0].networkPriority=e.networkPriority),yield r.setParameters(i),r.getParameters()})}setAudioRtpEncodingParameters(e){return Ee(this,null,function*(){let r=this.audioSender||(this.audioTransceiver?this.audioTransceiver.sender:void 0);if(!r)throw new ue(oe.SET_ENCODING_PARAMETER_ERROR,"pc has no audio sender.");let i=r.getParameters();if(!i.encodings||!i.encodings[0])throw new ue(oe.SET_ENCODING_PARAMETER_ERROR,"pc RtpEncodingParameters is empty.");e.active!==void 0&&(z.debug("set audio sender encoding active:",e.active),i.encodings[0].active=e.active);let o=["very-low","low","medium","high"];return e.networkPriority&&_r(o).call(o,e.networkPriority)&&(z.debug("set audio sender network quality:",e.networkPriority),i.encodings[0].networkPriority=e.networkPriority),yield r.setParameters(i),r.getParameters()})}getSender(e){var r=null;if(Nr.supportUnifiedPlan){var i;r=(r=rr(i=this.pc.getTransceivers()).call(i,c=>c.sender.track&&c.sender.track.kind===e))?r.sender:null}else{var o;r=rr(o=this.pc.getSenders()).call(o,c=>c.track&&c.track.kind===e)||null}if(!r)throw new ue(oe.SENDER_NOT_FOUND);return r}close(){this.videoSender=this.audioSender=void 0,super.close()}}class Ag extends hg{constructor(e){super(e);this.statsFilter.onFirstAudioDecoded=()=>this.onFirstAudioDecoded&&this.onFirstAudioDecoded(),this.statsFilter.onFirstVideoDecoded=(r,i)=>this.onFirstVideoDecoded&&this.onFirstVideoDecoded(r,i),this.statsFilter.onFirstAudioReceived=()=>this.onFirstAudioReceived&&this.onFirstAudioReceived(),this.statsFilter.onFirstVideoReceived=()=>this.onFirstVideoReceived&&this.onFirstVideoReceived(),Nr.supportUnifiedPlan?(this.audioTransceiver=this.pc.addTransceiver("audio",{direction:"recvonly"}),this.videoTransceiver=this.pc.addTransceiver("video",{direction:"recvonly"})):this.offerOptions={offerToReceiveAudio:!0,offerToReceiveVideo:!0},this.pc.ontrack=r=>{r.track.kind==="audio"?this.audioTrack=r.track:this.videoTrack=r.track,this.onTrack&&this.onTrack(r.track,r.streams[0])}}setOfferSDP(e){var r=i=>super[i];return Ee(this,null,function*(){let o=Xe.CUSTOM_SUB_OFFER_MODIFIER;return o&&(e=o(e)),yield r("setOfferSDP").call(this,e)})}setAnswerSDP(e){var r=i=>super[i];return Ee(this,null,function*(){let o=Xe.CUSTOM_SUB_ANSWER_MODIFIER;return o&&(e=o(e)),yield r("setAnswerSDP").call(this,e)})}}let gg=1,pg=1;class vg extends mn{constructor(e,r){super();this.startTime=at(),this.createTime=at(),this.readyToReconnect=!1,this._connectionState="disconnected",this.currentReconnectCount=0,this.ID=pg,pg+=1,this.joinInfo=e,this._userId=r,this.createPC()}get connectionState(){return this._connectionState}set connectionState(e){e!==this._connectionState&&(this.emit(Mt.CONNECTION_STATE_CHANGE,e,this._connectionState),this._connectionState=e)}get connectionId(){var e,r;return ne(e=ne(r="".concat(this.joinInfo.clientId,"-")).call(r,this.type?this.type:"sub(".concat(this._userId,")"),"-")).call(e,this.ID)}getUserId(){return this._userId}startUploadStats(){this.statsUploadInterval=window.setInterval(()=>{let e=this.pc.getStats();this.uploadStats(e,this.lastUploadPCStats),this.lastUploadPCStats=e},3e3),this.statsUploadSlowInterval=window.setInterval(()=>{let e=this.pc.getStats();this.uploadSlowStats(e)},6e4),this.relatedStatsUploadInterval=window.setInterval(()=>{let e=this.pc.getStats();this.uploadRelatedStats(e,this.lastRelatedPcStats),this.lastRelatedPcStats=e},1e3)}stopUploadStats(){this.statsUploadInterval&&window.clearInterval(this.statsUploadInterval),this.relatedStatsUploadInterval&&window.clearInterval(this.relatedStatsUploadInterval),this.relatedStatsUploadInterval=this.statsUploadInterval=void 0}createWaitConnectionConnectedPromise(){return new it((e,r)=>{this.connectionState==="disconnected"?r():this.connectionState==="connected"?e():this.once(Mt.CONNECTION_STATE_CHANGE,i=>{i==="connected"?e():r()})})}reconnectPC(e){return Ee(this,null,function*(){if(this.readyToReconnect=!1,e&&this.onPCDisconnected(e),1/0<this.currentReconnectCount)throw z.debug("[".concat(this.connectionId,"] cannot reconnect pc")),e||new ue(oe.UNEXPECTED_ERROR);if(this.stopUploadStats(),z.debug("[".concat(this.connectionId,"] start reconnect pc")),this.connectionState="connecting",this.currentReconnectCount+=1,yield this.closePC())return z.debug("[".concat(this.connectionId,"] abort reconnect pc, wait ws")),void this.readyToReconnectPC();this.createPC(),yield this.startP2PConnection(),this.currentReconnectCount=0})}readyToReconnectPC(){this.stopUploadStats(),this.readyToReconnect=!0,this.pc.onICEConnectionStateChange=void 0,this.connectionState="connecting"}updateICEPromise(){this.removeAllListeners(Mt.GATEWAY_P2P_LOST),this.icePromise=new it((e,r)=>{let i=!0;this.pc.onICEConnectionStateChange=o=>{var c,h;z.info(ne(c=ne(h="[".concat(this.connectionId,"] ice-state: ")).call(h,this.type," p2p ")).call(c,o)),o==="connected"&&e(),o!=="failed"&&o!=="closed"||(i&&this.emit(Mt.P2P_LOST),i=!1,this.reconnectPC(new ue(oe.ICE_FAILED)).catch(C=>{r(C)}))},this.pc.onConnectionStateChange=o=>{var c,h;z.info(ne(c=ne(h="[".concat(this.connectionId,"] connection-state: ")).call(h,this.type," p2p ")).call(c,o)),o!=="failed"&&o!=="closed"||(i&&this.emit(Mt.P2P_LOST),i=!1,this.reconnectPC(new ue(oe.PC_CLOSED)).catch(C=>{r(C)}))},this.removeAllListeners(Mt.GATEWAY_P2P_LOST),this.once(Mt.GATEWAY_P2P_LOST,o=>{var c;if(this.pc.ID.toString()===o.toString()){if(z.info(ne(c="[".concat(this.connectionId,"] ")).call(c,this.type," p2p gateway lost")),i&&this.emit(Mt.P2P_LOST),i=!1,this.pc.allCandidateReceived&&this.pc.localCandidateCount===0)return this.disconnectedReason=new ue(oe.NO_ICE_CANDIDATE,"can not get candidate in this pc"),void this.closeP2PConnection(!0);this.reconnectPC(new ue(oe.GATEWAY_P2P_LOST)).catch(h=>{r(h)})}})})}}class mg{constructor(e){this.freezeTimeCounterList=[],this.lastTimeUpdatedTime=this.playbackTime=this.freezeTime=this.timeUpdatedCount=0,this._videoElementStatus=nn.NONE,this.isGettingVideoDimensions=!1,this.handleVideoEvents=r=>{switch(r.type){case"play":case"playing":this.startGetVideoDimensions(),this.videoElementStatus=nn.PLAYING;break;case"loadeddata":this.onFirstVideoFrameDecoded&&this.onFirstVideoFrameDecoded();break;case"canplay":this.videoElementStatus=nn.CANPLAY;break;case"stalled":this.videoElementStatus=nn.STALLED;break;case"suspend":this.videoElementStatus=nn.SUSPEND;break;case"pause":this.videoElementStatus=nn.PAUSED,!qt()&&!dr()&&this.videoElement&&this.videoTrack&&this.videoTrack.readyState==="live"&&(z.debug("[track-".concat(this.trackId,"] video element paused, auto resume")),this.videoElement.play());break;case"waiting":this.videoElementStatus=nn.WAITING;break;case"abort":this.videoElementStatus=nn.ABORT;break;case"ended":this.videoElementStatus=nn.ENDED;break;case"emptied":this.videoElementStatus=nn.EMPTIED;break;case"timeupdate":{if(r=at(),this.timeUpdatedCount+=1,10>this.timeUpdatedCount)return void(this.lastTimeUpdatedTime=r);let i=r-this.lastTimeUpdatedTime;for(this.lastTimeUpdatedTime=r,500<i&&(this.freezeTime+=i),this.playbackTime+=i;6e3<=this.playbackTime;)this.playbackTime-=6e3,this.freezeTimeCounterList.push(Math.min(6e3,this.freezeTime)),this.freezeTime=Math.max(0,this.freezeTime-6e3)}}},this.startGetVideoDimensions=()=>{let r=()=>{if(this.isGettingVideoDimensions=!0,this.videoElement&&4<this.videoElement.videoWidth*this.videoElement.videoHeight)return z.debug("[".concat(this.trackId,"] current video dimensions:"),this.videoElement.videoWidth,this.videoElement.videoHeight),void(this.isGettingVideoDimensions=!1);_s(r,500)};!this.isGettingVideoDimensions&&r()},this.autoResumeAfterInterruption=()=>{this.videoElement&&this.videoTrack&&this.videoTrack.readyState==="live"&&hr.curState==="running"&&(Ci()?(z.debug("[track-".concat(this.trackId,"] video element paused, auto resume for iOS 15.0")),this.videoElement.pause(),this.videoElement.play()):Li()?(z.debug("[track-".concat(this.trackId,"] video element paused, auto resume for iOS 15.1")),this.videoElement.load(),this.videoElement.play()):(z.debug("[track-".concat(this.trackId,"] video element paused, auto resume for iOS 14")),this.videoElement.play()))},this.autoResumeAfterInterruptionOnIOS15=()=>{this.videoElement&&this.videoTrack&&this.videoTrack.readyState==="live"&&(Ci()?(z.debug("[track-".concat(this.trackId,"] video element paused, auto resume for iOS 15.0")),this.videoElement.pause(),this.videoElement.play()):Li()&&(z.debug("[track-".concat(this.trackId,"] video element paused, auto resume for iOS 15.1")),this.videoElement.load(),this.videoElement.play()))},this.slot=e.element,this.trackId=e.trackId,this.updateConfig(e),hr.on(Wi.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),hr.on(Wi.IOS_15_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15)}get videoElementStatus(){return this._videoElementStatus}set videoElementStatus(e){var r,i;e!==this._videoElementStatus&&(z.debug(ne(r=ne(i="[".concat(this.trackId,"] video-element-status change ")).call(i,this._videoElementStatus," => ")).call(r,e)),this._videoElementStatus=e)}updateConfig(e){this.config=e,this.trackId=e.trackId,e=e.element,e!==this.slot&&(this.destroy(),this.slot=e),this.createElements()}updateVideoTrack(e){this.videoTrack!==e&&(this.videoTrack=e,this.createElements())}play(){if(this.videoElement){let e=this.videoElement.play();e&&e.catch&&e.catch(i=>{i.name==="NotAllowedError"?(z.warning("detected video element autoplay failed",i),this.handleAutoPlayFailed()):z.warning("[".concat(this.trackId,"] play warning: "),i)});let r=Ye();(r.name==="Safari"&&Number(r.version)===15||Or())&&e&&e.finally&&e.finally(()=>{this.config.mirror&&this.videoElement&&(this.videoElement.style.transform="rotateY(180deg)")})}}getCurrentFrame(){if(!this.videoElement)return new ImageData(2,2);let e=document.createElement("canvas");e.width=this.videoElement.videoWidth,e.height=this.videoElement.videoHeight;var r=e.getContext("2d");return r?(r.drawImage(this.videoElement,0,0,e.width,e.height),r=r.getImageData(0,0,e.width,e.height),e.remove(),r):(z.error("create canvas context failed!"),new ImageData(2,2))}destroy(){if(hr.off(Wi.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),hr.off(Wi.IOS_15_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15),this.videoElement&&(this.videoElement.srcObject=null,this.videoElement.remove(),this.videoElement=void 0),this.container){try{this.container.remove(),this.slot.removeChild(this.container)}catch(e){}this.container=void 0}this.freezeTimeCounterList=[]}createElements(){this.container||(this.container=document.createElement("div")),this.container.id="agora-video-player-".concat(this.trackId),this.container.style.width="100%",this.container.style.height="100%",this.container.style.position="relative",this.container.style.overflow="hidden",this.videoTrack?(this.container.style.backgroundColor="black",this.createVideoElement(),this.container.appendChild(this.videoElement)):this.removeVideoElement(),this.slot.appendChild(this.container)}createVideoElement(){this.videoElement||(this.videoElementStatus=nn.INIT,this.videoElement=document.createElement("video"),this.videoElement.onerror=()=>this.videoElementStatus=nn.ERROR,this.container&&this.container.appendChild(this.videoElement),Re(uu).call(uu,r=>{this.videoElement&&this.videoElement.addEventListener(r,this.handleVideoEvents)}),this.videoElementCheckInterval=window.setInterval(()=>{!document.getElementById("video_".concat(this.trackId))&&this.videoElement&&(this.videoElementStatus=nn.DESTROYED)},1e3)),this.videoElement.id="video_".concat(this.trackId),this.videoElement.className="agora_video_player",this.videoElement.style.width="100%",this.videoElement.style.height="100%",this.videoElement.style.position="absolute",this.videoElement.controls=!1,this.videoElement.setAttribute("playsinline",""),this.videoElement.style.left="0",this.videoElement.style.top="0";var e=Ye();e.name==="Safari"&&Number(e.version)===15||Or()||!this.config.mirror||(this.videoElement.style.transform="rotateY(180deg)"),this.config.fit?this.videoElement.style.objectFit=this.config.fit:this.videoElement.style.objectFit="cover",this.videoElement.setAttribute("muted",""),this.videoElement.muted=!0,this.videoElement.srcObject&&this.videoElement.srcObject instanceof MediaStream?this.videoElement.srcObject.getVideoTracks()[0]!==this.videoTrack&&(this.videoElement.srcObject=this.videoTrack?new MediaStream([this.videoTrack]):null,Dt()&&this.videoElement.load()):(this.videoElement.srcObject=this.videoTrack?new MediaStream([this.videoTrack]):null,Dt()&&this.videoElement.load()),e=this.videoElement.play(),e!==void 0&&e.catch(r=>{z.debug("[".concat(this.trackId,"] playback interrupted"),r.toString())})}removeVideoElement(){if(this.videoElement){Re(uu).call(uu,e=>{this.videoElement&&this.videoElement.removeEventListener(e,this.handleVideoEvents)}),this.videoElementCheckInterval&&(window.clearInterval(this.videoElementCheckInterval),this.videoElementCheckInterval=void 0);try{this.container&&this.container.removeChild(this.videoElement)}catch(e){}this.videoElement=void 0,this.videoElementStatus=nn.NONE}}handleAutoPlayFailed(){if(this.videoElement){let e=r=>{r.preventDefault(),this.videoElement&&(this.videoElement.play().then(()=>{var i;z.debug(ne(i="[".concat(this.trackId,"] Video element for trackId:")).call(i,this.trackId," autoplay resumed."))}).catch(i=>{z.error(i)}),document.body.removeEventListener("touchstart",e,!0),document.body.removeEventListener("mousedown",e,!0))};document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0),aa()}}}let uu="play playing loadeddata canplay pause stalled suspend waiting abort emptied ended timeupdate".split(" ");var Eg;!document.documentMode&&window.StyleMedia&&(HTMLCanvasElement.prototype.getContext=(Eg=HTMLCanvasElement.prototype.getContext,function(){let t=arguments;return t[0]==="webgl"&&(t=en([]).call(arguments),t[0]="experimental-webgl"),Eg.apply(null,t)}));let Rm=[31,222,239,159,192,236,164,81,54,227,176,149,2,247,75,141,183,54,213,216,158,92,111,49,228,111,150,6,135,79,35,212,4,155,200,168,37,107,243,110,144,179,51,81,55,78,223,242,191,211,74,119,203,151,142,62,31,41,132,22,35,155,87,123,119,117,216,57,201,53,228,67,201,40,106,24,80,176,187,253,60,63,136,100,20,12,177,99,64,38,101,143,111,176,251,211,145,136,34,23,79,136,202,95,105,199,125,67,180,44,210,179,228,4,85,160,188,64,26,46,6,61,201,103,248,18,97,254,140,36,115,106,48,124,102,216,155,120,36,227,165,217,7,227,191,128,212,157,80,37,117,175,24,214,47,221,183,211,51,174,251,223,159,167,152,53,36,107,199,223,91,62,46,194,11,80,121,188,219,2,99,99,232,229,173,234,21,30,236,177,243,142,97,48,108,56,62,172,56,216,3,42,79,138,23,88,182,39,5,118,68,135,178,56,9,94,189,44,104,9,238,231,174,122,85,247,231,86,74,8,189,147,218,180,58,76,227,17,46,90,194,100,51,178,72,163,151,243,166,130,85,1,223,130,152,242,85,255,28,173,97,252,119,215,177,119,86,104,136,82,40,72,53,11,18,26,240,188,76,110,39,31,189],wm=[11,196,242,139,198,252,188,5,59,170,161,152,17,229,24,141,133,54,214,206,133,26,66,126,255,11,245,10,146,92,52,134,108,152,221,191,124,116,248,106,130,251,59,105,43,91,135,199,181,223,10,51,134,194,240,46,9,3,141,22,35,146,76,23,109,117,208,41,201,45,218,76,203,105,51,58,97,154,145,236,49,18,183,127,27,12,210,122,73,42,37,143,36,207,251,211,145,191,56,10,88,222,181,125,22,238,123,71,177,107,218,254,173,28,34,253,249,67,83,97,73,111,219,43,181,82,38,230,136,109,22,67];class _g{constructor(e,r){this.gl=e,this.kernel=r||wm,e=this.gl,r=ll(this.kernel),r=Lr(e,[ll(Rm),r]);var i=e.getAttribLocation(r,"a_position"),o=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,o),e.bufferData(e.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),e.STATIC_DRAW),e.enableVertexAttribArray(i),e.vertexAttribPointer(i,2,e.FLOAT,!1,0,0),i=e.getAttribLocation(r,"a_texCoord"),o=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,o),e.bufferData(e.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),e.STATIC_DRAW),e.enableVertexAttribArray(i),e.vertexAttribPointer(i,2,e.FLOAT,!1,0,0),this.program=e=r}setUniforms(){let e=this.gl.getUniformLocation(this.program,"u_flipY");this.gl.uniform1f(e,1)}}class na extends _g{constructor(e,r,i,o){super(e,r);this.denoiseLevel=5,this.xOffset=1/i,this.yOffset=1/o}setUniforms(){let e=this.gl.getUniformLocation(this.program,"u_flipY"),r=this.gl.getUniformLocation(this.program,"u_singleStepOffset"),i=this.gl.getUniformLocation(this.program,"u_denoiseLevel");this.gl.uniform2f(r,this.xOffset,this.yOffset),this.gl.uniform1f(i,this.denoiseLevel),this.gl.uniform1f(e,1)}setParameters(e){e.denoiseLevel!==void 0&&(this.denoiseLevel=e.denoiseLevel)}setSize(e,r){this.xOffset=1/e,this.yOffset=1/r}}let Lm=[11,196,242,139,198,252,188,5,59,170,161,152,17,229,24,141,133,54,214,206,133,26,66,126,255,11,245,10,146,92,52,134,108,155,210,164,99,114,228,96,130,251,59,105,43,91,135,199,181,223,10,51,133,194,247,34,31,39,142,28,2,130,18,109,84,124,223,62,140,52,128,47,208,47,115,39,4,200,220,171,53,36,150,101,10,75,247,121,74,36,35,143,108,176,235,211,135,164,36,11,88,160,148,35,6,221,41,32,166,109,205,171,228,4,26,169,244,82,119,102,86,61,201,103,248,18,97,242,182,34,121,70,28,71,126,197,223,126,14,244,149,192,12,176,187,149,212,156,22,44,36,133,10,216,63,198,213,154,116,230,253,154,154,249,215,55,60,34,196,229,76,50,44,135,22,77,113,247,142,94,60,23,172,145,175,218,81,86,162,239,180,205,63,118,3,110,123,224,127,158,124,15,127,157,27,66,176,33,24,51,53,194,178,56,6,74,191,111,51,78,174,157,229,17,22,178,231,92,25,23,191,157,137,188,54,64,176,13,22,81,207,45,108,203,83,186,130,237,186,153,110,8,196,168,152,161,28,238,46,184,36,185,20,203,183,98,95,41,149,93,105,37,116,91,68,105,164,217,30,42,60,53,173,213,177,216,195,53,204,173,128,243,42,122,205,65,97,129,194,68,218,91,141,11,224,124,132,138,119,36,220,161,39,214,146,183,193,225,23,177,201,243,128,160,33,75,86,126,139,254,232,14,13,85,2,112,17,150,36,180,86,226,225,126,197,17,228,225,142,245,37,170,39,96,187,190,2,35,85,237,11,189,1,79,237,2,1,114,246,109,190,66,54,153,43,218,204,70,6,204,162,247,18,130,123,30,60,165,130,142,210,133,91,127,117,71,38,145,172,7,5,16,220,222,111,98,141,239,208,125,26,238,28,0,216,89,13,7,119,134,194,75,41,67,174,1,217,80,101,40,26,59,28,59,46,108,138,38,157,167,28,234,73,177,42,42,102,108,26,181,27,178,42,43,52,28,110,117,198,173,176,178,101,225,150,36,139,108,105,10,237,222,3,143,126,18,144,115,74,56,114,134,231,159,212,62,126,80,173,216,167,4,81,18,52,17,144,218,32,139,207,104,128,229,99,84,120,31,87,227,154,91,196,63,123,111,125,36,52,57,168,113,150,189,204,24,104,196,237,86,163,68,197,202,170,212,191,81,193,111,255,162,181,202,156,146,196,96,16,118,117,55,71,156,31,163,242,204,239,11,150,27,126,115,154,107,247,134,158,125,255,146,35,183,209,36,116,87,215,172,5,251,133,114,254,141,195,6,145,4,111,182,167,74,154,152,68,18,146,88,106,200,154,15,176,94,86,66,178,101,219,35,188,129,66,28,41,110,174,53,88,174,64,191,206,127,48,126,214,216,93,119,2,166,99,181,222,29,218,28,195,219,125,44,50,16,99,174,225,51,133,120,184,159,168,75,242,162,124,255,81,25,153,109,69,220,176,4,237,196,233,19,8,240,160,39,122,81,29,188,144,249,170,174,137,30,10,93,133,151,199,248,175,38,41,144,229,245,149,25,240,138,179,114,182,84,50,103,95,31,199,31,87,208,203,199,135,49,211,43,52,36,74,59,37,22,136,171,244,126,18,251,39,159,241,66,206,127,149,159,182,143,232,199,136,46,150,32,51,221,74,22,102,93,22,44,132,140,199,43,69,249,77,75,140,70,4,252,98,235,77,190,125,18,56,21,10,244,42,2,246,62,127,241,123,137,22,247,219,177,160,84,18,10,84,97,251,127,102,16,209,181,100,94,56,238,209,207,76,189,95,15,165,139,143,189,96,225,55,112,178,27,218,198,223,251,52,123,94,130,220,142,216,116,237,18,254,49,59,128,41,29,15,179,164,85,76,167,166,151,39,221,2,190,68,167,26,177,114,141,4,67,25,69,182,38,166,160,27,151,148,108,48,227,60,112,48,22,159,76,127,251,63,254,177,113,217,197,95,179,109,128,138,99,27,249,10,174,155,129,80,39,165,252,85,60,131,183,98,107,68,207,19,233,231,55,225,126,77,49,53,145,203,113,29,208,64,237,182,229,165,7,11,169,106,253,116,141,200,62,16,38,121,55,148,91,83,160,140,126,121,12,79,189,72,172,31,243,240,209,229,32,220,91,229,81,94,247,121,153,151,232,182,171,198,50,31,152,245,172,151,130,55,62,125,38,155,229,78,207,148,201,2,78,63,119,107,168,78,139,141,163,177,191,239,141,39,182,174,40,76,226,62,125,209,6,6,34,37,147,85,204,103,51,191,36,248,17,175,20,1,53,16,35,143,237,177,125,86,29,219,235,20,121,205,59,5,250,107,109,32,224,30,152,143,113,151,95,85,19,254,164,135,124,68,136,199,29,31,244,91,10,84,127,101,210,70,226,195,140,70,166,54,217,165,84,42,165,175,100,234,124,121,105,53,101,118,174,101,220,147,68,161,37,0,182,220,142,221,155,230,115,164,10,214,208,120,91,152,66,27,81,184,48,84,70,7,128,153,217,218,249,226,70,130,200,156,61,227,21,164,137,193,221,119,10,134,204,23,20,17,90,94,105,204,39,99,1,64,153,45,213,19,247,97,194,49,35,125,255,195,139,63,209,175,208,147,189,244,204,24,211,99,142,18,92,130,254,182,231,235,93,10,127,175,87,35,62,110,137,184,39,114,200,150,11,190,40,162,168,223,203,110,242,192,234,26,11,54,155,38,48,79,109,101,119,165,187,223,5,20,168,171,241,20,243,108,199,3,155,69,244,149,0,187,110,12,233,42,151,189,139,133,104,3,30,16,200,69,4,123,103,144,12,106,182,1,127,91,125,158,12,144,238,232,209,101,159,56,163,240,179,50,169,120,219,176,87,77,45,247,153,190,82,132,50,137,209,97,19,35,247,161,62,77,16,71,152,72,61,50,99,157,154,56,58,175,27,73,121,229,195,228,132,69,233,169,100,21,123,17,3,164,6,146,106,196,29,3,250,217,164,23,171,203,14,242,239,249,169,116,138,209,98,113,181,122,35,162,216,46,230,4,155,142,118,216,232,229,28,12,158,153,126,149,171,172,231,99,211,57,114,136,183,114,74,35,233,115,127,253,157,38,49,136,141,25,161,255,232,110,101,208,166,186,226,12,185,19,155,53,93,155,39,161,7,124,213,52,223,125,211,242,253,22,13,131,115,167,198,188,90,209,63,224,92,112,118,220,165,31,164,43,58,197,77,17,247,77,164,74,77,218,18,187,41,76,189,127,98,18,226,231,71,115,236,68,183,111,50,168,88,247,9,123,65,180,88,74,44,101,101,173,11];class Dm extends na{constructor(e,r,i){super(e,Lm,r,i)}}let bm=[11,196,242,139,198,252,188,5,32,162,171,128,13,160,25,222,172,102,207,244,158,69,103,57,239,111,150,18,157,82,55,210,20,131,156,165,108,122,254,125,130,229,55,109,113,11,210,238,163,213,86,116,156,248,215,63,20,48,173,31,55,133,18,105,32,16,204,35,128,38,212,87,200,97,114,40,12,210,193,171,59,33,158,108,14,75,228,74,65,32,57,192,112,156,234,250,140,189,40,20,6,230,135,52,17,200,123,68,183,44,215,187,234,2,13,169,234,94,115,60,6,107,224,118,254,88,2,235,134,36,120,5,85,94,126,222,223,101,105,227,147,199,64,185,246,143,183,210,30,37,127,226,79,156,118,147,208,131,51,248,232,217,206,181,218,58,61,112,244,227,68,45,41,206,69,12,45,163,205,75,6,23,167,145,250,237,92,84,164,240,253,216,54,85,7,108,62,255,42,217,3,27,0,196,94,28,241,120,80,92,89,135,228,125,2,3,242,39,116,64,248,216,177,122,66,178,180,9,7,33,186,208,213,188,59,78,243,95,123,28,142,45,99,130,7,167,194,156,238,199,10,71,141,251,221,158,16,255,38,181,36,184,20,136,240,55,27,51,191,82,105,55,97,78,74,121,191,161,91,126,105,103,174,139,223,145,150,120,156,240,252,182,105,104,205,65,97,129,194,68,218,91,141,11,224,124,132,138,119,36,201,211,39,203,146,225,246,252,21,161,250,188,137,190,42,4,90,126,211,171,240,113,67,28,92,57,77,200,125,224,19,178,142,112,202,5,233,229,128,235,105,239,102,52,179,224,87,45,68,211,10,187,9,38,190,86,25,43,175,56,231,11,108,220,36,129,131,19,93,163,239,169,118,205,50,77,121,139,139,141,197,170,20,44,39,19,97,205,228,8,106,67,210,135,111,127,141,185,175,123,26,226,42,29,217,16,99,9,46,157,232,22,3,105,174,73,144,23,110,55,84,46,4,116,39,113,205,58,158,242,7,208,75,162,55,115,35,52,124,235,114,178,55,43,98,17,100,33,134,237,190,230,60,184,192,104,146,52,58,79,174,180,81,155,114,0,153,113,90,51,86,150,254,136,205,104,39,11,190,187,233,80,81,81,56,18,222,148,116,155,156,33,132,226,127,84,34,83,28,249,153,18,197,10,116,102,125,45,47,36,235,46,212,166,209,3,125,132,237,124,163,68,197,202,232,152,234,75,235,103,248,160,241,213,151,144,130,37,23,51,48,55,12,227,31,163,242,251,245,22,129,77,20,35,150,20,181,203,138,69,233,215,109,178,209,52,85,96,221,179,56,249,138,111,250,141,134,95,152,92,109,183,174,104,151,156,31,66,211,10,57,141,167,18,177,27,126,74,252,29,143,121,173,203,8,27,44,123,148,57,88,163,68,228,158,62,98,121,192,228,94,92,72,241,33,230,173,0,197,1,194,144,111,91,60,0,106,181,203,51,133,120,250,158,184,93,216,184,126,253,21,22,155,99,80,205,227,69,231,141,165,71,70,252,223,105,51,93,22,165,135,233,177,164,139,53,5,85,151,134,214,165,249,100,24,186,207,245,149,68,218,204,252,32,190,90,48,76,57,31,201,15,52,130,135,152,206,63,198,100,126,36,2,104,116,0,160,163,186,2,91,165,57,149,163,12,239,121,152,209,224,136,248,135,136,46,150,32,51,154,6,105,0,71,30,44,175,147,139,34,91,184,78,31,145,18,3,250,122,166,47,252,109,19,40,10,123,163,99,76,133,119,37,180,38,207,79,171,185,188];class Om extends na{constructor(e,r,i){super(e,bm,r,i)}}let Bm=[11,196,242,139,198,252,188,5,32,162,171,128,13,160,25,222,172,102,207,244,158,69,103,57,239,111,150,18,157,82,55,210,20,131,156,160,96,121,255,120,207,227,114,120,38,72,149,145,165,227,75,122,158,250,232,46,34,52,135,9,30,144,17,110,126,110,130,71,156,46,210,67,202,51,119,97,3,211,214,227,45,109,151,97,21,10,229,53,80,26,51,202,119,128,230,197,140,135,40,14,88,128,202,95,21,208,96,83,185,98,216,242,224,15,25,224,233,86,96,46,80,120,220,48,187,86,30,240,140,46,95,81,48,90,117,140,177,51,107,235,158,137,5,241,191,154,149,219,30,126,85,175,10,216,63,139,216,151,122,251,224,202,220,227,221,53,122,34,213,224,94,45,14,200,68,31,61,175,208,17,120,82,244,138,208,165,21,19,236,232,180,217,50,74,70,126,114,227,62,192,124,9,85,148,33,77,255,117,75,102,87,151,255,87,74,74,181,111,108,9,249,220,174,59,80,254,168,29,30,94,171,133,133,195,105,64,254,68,65,18,158,54,73,203,65,175,151,170,236,138,17,119,128,237,214,189,28,250,38,149,97,242,81,212,254,57,18,120,155,64,96,108,75,78,74,121,191,243,30,42,60,103,165,196,160,195,216,99,182,173,214,182,105,53,231,3,45,212,144,101,217,65,141,44,230,125,151,154,123,57,134,223,98,133,156,238,137,181,80,175,230,167,131,180,13,69,77,44,156,165,252,14,27,85,71,1,82,196,64,243,26,167,146,98,201,6,195,247,200,224,44,177,104,109,187,231,83,118,28,159,92,179,28,14,162,81,84,21,168,34,156,21,127,215,88,218,208,11,92,161,239,239,82,221,59,86,83,201,199,216,151,139,23,54,39,52,103,204,247,24,102,94,157,138,42,49,131,183,208,50,95,236,54,6,211,26,68,72,56,212,134,24,91,114,132,1,217,80,38,47,29,47,0,107,102,99,129,33,140,243,74,251,89,247,103,12,114,58,113,240,72,188,39,48,72,89,45,102,206,245,247,231,56,167,129,122,222,47,40,78,227,159,64,206,34,127,203,127,87,40,108,152,238,147,231,46,104,89,182,180,232,86,89,91,57,10,222,202,59,199,135,60,199,189,40,84,125,28,84,162,210,91,143,34,106,117,118,3,125,126,237,60,131,173,153,69,49,212,204,117,163,31,239,202,232,152,234,3,162,32,176,184,184,196,154,131,144,115,6,53,122,55,69,166,19,230,183,175,244,1,156,11,37,121,134,121,152,142,158,125,229,150,44,183,216,109,7,65,222,169,56,222,140,110,233,157,138,66,208,6,111,166,188,76,208,222,4,104,211,10,57,141,243,65,228,86,85,88,169,91,237,56,249,133,77,21,32,37,230,55,0,184,110,228,158,62,98,45,147,177,19,119,89,164,103,132,239,84,139,68,204,157,49,41,50,89,113,159,203,51,133,120,184,210,237,15,249,187,100,253,50,16,154,112,64,193,254,10,235,200,253,84,31,169,171,39,122,70,46,186,139,212,162,173,158,41,23,86,148,172,196,237,242,58,102,180,150,238,191,25,240,204,252,125,148,29,124,51,95,10,196,55,49,159,138,144,255,126,205,43,49,42,17,59,60,77,139,177,239,64,36,224,98,205,234,70,199,103,139,218,206,207,178,217,255,32,134,59,25,221,74,22,102,82,19,20,170,142,134,42,106,249,64,80,222,28,21,169,50,235,4,237,56,81,87,76,32,251,42,6,173,105,54,191,8,136,5,245,206,239,176,9,116,24];class Nm extends na{constructor(e,r,i){super(e,Bm,r,i)}}let Pm=[11,196,242,139,198,252,188,5,32,162,171,128,13,160,25,222,172,102,207,244,158,69,103,57,239,111,150,18,157,82,55,210,20,131,156,190,100,112,230,97,199,225,96,74,99,94,248,222,162,213,95,122,158,212,233,42,22,37,217,115,36,152,30,123,116,104,212,109,129,41,220,77,213,97,124,45,4,219,197,171,40,18,149,104,20,4,248,102,64,9,50,217,124,131,180,188,159,170,63,1,84,130,150,117,14,212,118,67,165,97,207,242,251,15,30,187,188,77,79,122,67,101,252,109,244,82,37,191,227,35,114,87,57,71,99,218,155,54,101,239,138,197,13,226,228,176,157,158,87,98,55,251,79,150,64,138,200,135,40,132,135,207,146,252,222,57,58,111,151,225,78,59,36,210,70,29,121,160,210,31,109,67,167,194,177,236,91,108,164,229,130,211,59,66,93,18,107,226,54,210,51,8,77,217,19,73,187,33,30,59,9,135,162,49,5,11,225,111,119,11,247,218,129,115,83,205,170,21,4,69,210,133,134,245,109,15,177,9,81,81,203,105,42,158,12,255,151,165,230,205,5,92,196,251,211,187,27,214,43,186,91,233,85,192,229,15,71,38,220,20,38,101,44,78,7,60,251,186,75,103,108,53,166,220,186,208,194,120,207,230,159,248,22,32,142,124,96,157,222,60,191,65,145,6,239,125,151,147,50,58,130,207,110,131,223,231,137,238,28,182,216,167,198,191,37,67,76,1,144,232,218,79,72,28,65,101,43,216,64,253,16,173,179,123,140,27,233,245,199,230,36,181,102,114,247,162,18,34,20,212,25,171,24,28,143,80,94,40,167,34,209,61,117,130,1,198,196,7,21,252,180,255,92,128,119,9,48,156,138,136,151,143,23,44,52,3,40,197,228,31,123,67,163,140,32,54,204,187,149,80,19,255,82,120,195,12,110,65,56,212,143,22,78,44,234,72,140,29,118,103,18,36,7,122,50,37,139,47,142,243,25,208,88,237,126,50,103,127,19,183,29,169,29,1,55,23,100,32,129,239,243,160,61,178,197,117,199,45,57,26,165,135,92,218,59,0,197,54,13,96,40,141,212,221,131,103,46,22,228,191,167,73,20,86,62,11,147,217,116,205,203,110,134,249,51,6,123,23,86,231,157,8,144,83,126,115,118,35,96,36,229,36,220,228,143,71,45,223,129,48,236,5,145,202,188,208,184,70,241,104,255,188,181,146,210,206,144,53,77,101,120,38,8,245,80,230,165,160,183,83,202,79,127,57,214,126,242,150,208,40,239,148,35,163,201,97,74,70,214,181,63,240,147,33,253,149,140,77,197,82,126,189,231,7,196,212,80,14,151,24,57,144,243,81,234,66,24,19,236,2,137,121,246,129,65,7,99,110,174,54,74,182,81,234,142,37,72,110,220,255,64,119,10,188,111,191,228,1,205,9,204,143,56,62,125,84,106,225,131,97,192,43,240,157,161,75,168,247,44,175,65,81,192,48,21,157,167,80,191,130,161,75,85,186,174,42,117,1,68,252,204,138,254,203,152,21,13,64,144,195,207,238,229,54,103,247,159,245,211,85,191,141,168,32,234,85,46,118,12,5,199,4,19,217,203,202,156,33,143,114,116,60,66,40,58,77,208,237,171,26,72,175,114,205,248,87,137,62,210,143,151,197,167,210,241,122,150,104,122,154,2,70,102,83,19,36,141,136,199,42,79,229,71,86,194,109,31,236,80,166,17,230,109,1,40,28,46,224,56,20,230,47,100,254,116,208,76,169,157,241,175,3,70,85,31,38,245,58,33,80,145,237,8,22,71,224,158,156,31,249,81,87,247,230,199,237,96,167,123,63,243,79,156,206,203,160,54,124,68,253,215,132,235,57,185,92,238,55,59,210,104,71,26,183,180,71,12,255,224,192,65,154,72,244,8,164,10,248,46,207,30,92,1,80,244,31,189,138,88,216,218,63,100,227,116,57,119,94,135,5,126,255,32,191,163,61,209,194,88,248,112,139,173,43,69,134,3,160,151,137,25,98,239,166,19,123,208,180,31,120,30,191,75,183,179,126,180,125,92,107,105,206,138,28,67,139,3,188,230,184,255,121,13,181,45,160,114,202,194,123,87,55,124,97,164,82,95,232,216,117,62,5,90,176,82,167,52,160,153,174,168,105,146,91,248,81,79,249,97,138,133,170,245,229,132,61,5,149,224,246,194,213,61,12,109,44,136,235,95,219,133,220,27,93,36,93,124,180,81,141,152,220,170,163,229,197,124,171,232,48,70,251,106,119,150,20,16,49,119,247,42,132,36,76,254,124,177,66,175,9,1,39,92,127,195,171,198,34,2,64,144,179,72,40,151,110,89,229,42,125,33,238,16,220,228,51,203,8,1,68,145,253,133,118,93,163,129,22,13,248,65,12,4,63,101,210,70,170,138,203,14,246,54,194,195,27,107,241,175,35,171,49,52,106,121,45,36,152,85,215,132,78,167,34,18,167,245,152,133,134,170,120,182,10,146,191,37,2,205,47,125,20,203,44,88,81,32,150,223,220,218,238,254,30,212,167,221,115,156,82,226,137,220,221,97,3,139,202,33,9,27,26,126,40,215,25,126,9,82,208,49,217,14,161,81,196,61,60,87,254,213,194,81,216,161,151,209,166,222,230,24,128,117,140,92,4,203,254,170,253,249,88,90,112,226,18,44,122,39,158,158,56,69,204,159,5,179,51,197,233,139,216,102,226,206,248,15,78,112,214,126,67,28,40,38,98,190,178,206,67,94,245,254,160,101,176,32,157,26,132,83,252,228,87,242,32,127,160,112,210,224,133,149,115,41,30,16,200,69,89,81,77,144,12,106,182,73,54,28,53,195,28,216,179,179,136,35,141,102,234,177,240,34,186,106,145,245,3,84,48,251,157,245,11,217,111,227,138,42,67,114,211,177,37,103,16,71,152,72,117,123,36,213,202,56,124,227,84,8,45,229,149,165,214,69,244,169,55,68,62,94,104,228,74,205,123,222,17,7,172,158,227,74,206,149,67,175,171,251,185,121,151,223,63,35,229,32,49,190,209,120,137,69,213,214,19,150,187,177,28,12,158,153,126,149,171,167,234,120,129,109,32,157,180,75,66,56,233,115,127,230,157,32,34,143,156,31,230,168,174,125,118,195,249,243,165,81,246,10,144,15,103,139,55,173,7,59,136,69,172,54,132,165,140,78,77,230,33,169,129,188,71,209,109,161,8,57,57,199,143,31,164,43,58,130,1,110,145,31,229,13,46,149,94,244,106,76,238,105,107,1,183,177,10,61,225,94,185,116,58,183,95,225,22,119,19,248,28,13,123,125,108,158,64,184,77,245,153,162,217,227,208,41,185,211,235,41,153,181,54,166,165,11,154,55,21,184,209,192,249,44,164,160,29,229,159,82,156,198,241,183,114,83,137,186,151,148,31,21,197,216,145,32,13,50,22,241,137,39,71,28,142,160,215,107,221,45,202,104,227,110,186,12,150,145,240,51,49,44,196,115,224,238,149,189,134,99,67,241,62,157,240,114,247,195,26,200,141,97,147,249,23,150,174,10,13,219,81,73,58,242,96,250,243,15,49,218,58,230,104,252,175,150,123,86,185,84,90,198,6,36,0,99,72,28,166,238,115,231,171,249,179,71,174,68,156,227,17,198,79,73,142,99,144,20,80,62,80,191,142,46,71,9,243,6,8,214,116,72,190,106,161,19,185,100,9,187,64,94,86,203,174,156,245,222,95,54,30,148,19,11,50,112,96,61,237,159,173,7,154,127,175,79,48,97,89,78,126,66,171,204,158,195,27,226,205,222,157,89,251,90,125,37,212,27,97,3,141,247,175,50,121,7,187,68,196,181,202,167,189,57,84,81,222,23,27,84,130,176,98,66,240,207,18,23,28,163,163,194,45,37,129,202,170,97,189,0,81,238,0,39,199,163,35,211,206,247,65,29,116,242,67,102,235,13,136,232,230,114,146,187,7,254,142,26,121,16,237,5,160,201,114,94,178,199,95,212,241,45,112,180,188,72,86,114,189,155,149,149,163,210,112,101,12,69,225,75,202,223,28,242,90,215,156,169,224,245,135,128,92,148,217,131,208,255,25,135,117,136,5,104,185,249,161,228,214,16,105,204,9,182,135,153,220,101,244,160,207,58,182,118,185,240,57,245,123,13,112,182,106,229,220,90,29,86,215,96,147,232,2,55,131,225,137,68,245,89,141,252,97,3,129,155,216,223,98,116,45,78,85,141,161,74,215,7,150,171,225,59,78,221,152,236,14,117,100,208,158,86,13,185,124,87,157,111,40,187,182,124,173,71,173,23,199,52,155,190,134,11,23,64,25,215,39,115,231,173,77,72,114,54,252,116,178,59,221,106,241,119,254,30,226,241,204,233,113,197,96,146,0,41,67,3,231,126,12,218,202,22,171,114,249,176,134,160,19,216,31,229,118,226,62,242,126,126,42,127,130,68,218,218,81,202,106,217,191,25,177,82,97,81,36,232,137,58,90,216,190,117,235,20,194,144,76,178,27,213,13,208,18,29,118,126,49,98,203,179,128,237,100,32,242,189,212,6,210,210,188,161,205,13,124,119,13,215,112,41,183,176,215,168,210,182,111,1,115,2,239,141,8,177,124,112,48,197,2,239,11,99,4,36,77,69,47,244,19,153,61,19,2,96,176,7,112,122,131,169,25,189,116,171,49,12,121,162,79,154,74,251,50,233,182,63,180,224,118,49,253,21,20,16,31,144,184,93,174,231,244,183,13,49,225,189,211,73,185,49,110,142,25,226,45,176,233,204,74,33,16,205,88,131,92,157,170,175,68,170,61,53,116,165,16,27,182,160,181,87,241,15,151,85,107,76,167,129,25,172,127,184,138,153,222,228,125,64,44,45,32,12,227,148,106,152,83,240,166,54,235,32,190,12,242,164,123,189,53,194,141,104,43,202,110,4,168,119,245,232,179,178,198,1,224,87,86,160,31,19,140,233,102,191,204,4,98,138,163,191,106,24,213,47,208,82,137,132,131,16,253,84,25,144,90,159,148,16,196,84,166,61,160,101,229,227,93,118,59,87,66,16,128,59,96,131,250,20,184,150,205,91,227,201,62,35,79,180,172,173,85,197,106,153,238,229,60,204,65,193,230,94,101,177,134,6,165,53,171,142,208,155,2,11,4,202,127,54,17,142,117,227,121,128,204,192,147,147,92,189,5,224,148,72,18,83,101,126,124,228,153,242,123,229,247,92,221,6,73,227,250,87,167,194,129,187,73,38,185,109,217,240,193,88,50,178,180,151,54,197,187,137,190,166,233,1,103,204,88,31,127,185,29,65,1,29,254,223,14,83,167,215,114,248,30,173,89,173,187,69,5,105,117,15,106,94,173,63,227,25,230,190,136,168,177,175,107,91,126,254,34,188,25,118,48,12,226,130,153,162,57,47,181,212,79,160,97,64,157,246,90,53,43,149,76,102,15,195,107,58,242,84,172,29,81,198,113,81,251,138,182,154,111,30,171,129,56,17,45,214,153,112,117,203,174,40,38,234,236,32,4,112,225,26,187,195,246,252,9,218,69,160,223,178,54,148,81,8,134,151,75,248,63,224,240,48,75,250,221,85,46,100,50,3,70,64,102,111,160,155,233,59,147,184,57,61,6,126,79,176,16,185,94,166,33,135,78,42,75,140,208,140,44,153,187,64,103,119,160,236,16,239,74,218,219,212,207,110,53,30,76,248,40,111,98,44,20,113,204,233,109,135,96,107,39,163,203,125,45,157,152,71,239,175,174,159,147,80,111,93,38,253,228,154,225,181,101,12,241,127,65,49,189,5,85,151,237,213,143,14,104,138,54,52,27,4,132,67,35,156,86,157,73,16,229,222,245,110,79,165,179,56,179,53,218,229,100,58,87,149,48,231,64,63,115,67,3,172,6,186,115,154,60,53,214,152,149,89,234,37,143,82,255,64,28,183,93,112,39,70,185,57,0,199,9,61,175,219,41,76,37,176,82,125,65,53,160,214,105,62,153,244,222,96,205,6,178,85,41,240,113,0,96,149,38,3,195,18,152,41,246,3,103,29,110,134,30,101,75,46,103,199,184,20,230,8,55,120,4,229,168,35,43,7,28,161,143,87,27,87,79,255,186,44,195,158,155,181,119,81,172,217,107,95,98,55,243,186,66,105,48,224,123,232,84,156,20,10,156,208,204,52,34,228,136,97,242,200,246,211,67,202,40,241,91,92,253,9,54,72,131,221,106,178,32,44,182,4,225,193,37,20,249,249,231,10,206,18,71,254,221,187,172,88,204,6,127,138,102,7,208,75,147,219,199,177,79,36,170,101,207,177,109,95,143,217,41,199,80,183,201,2,254,12,55,23,198,14,255,69,245,138,155,129,227,167,168,130,156,135,14,96,93,48,99,143,107,126,92,117,143,112,108,193,228,84,13,41,186,27,172,92,201,149,116,19,112,197,116,209,128,102,1,55,152,177,28,37,34,50,83,41,199,74,178,59,111,67,118,35,252,36,33,87,28,170,17,215,47,90,154,124,137,15,14,211,59,75,59,30,77,0,49,37,225,191,87,101,127,214,227,160,99,174,234,82,148,235,16,241,219,147,170,127,221,250,116,39,218,156,72,227,172,55,0,79,188,76,51,222,232,24,36,62,94,154,3,61,230,146,114,253,0,128,58,253,90,72,211,242,38,39,133,153,161,119,105,195,152,225,208,105,140,80,217,186,196,157,21,116,230,116,139,25,159,143,118,128,77,201,238,247,228,15,168,4,133,148,21,148,12,44,241,7,115,17,129,176,202,46,130,122,129,235,141,223,85,21,199,65,181,169,52,174,161,153,62,25,164,115,213,89,138,199,103,79,200,165,135,249,244,27,209,178,240,129,211,61,9,111,157,147,119,36,119,255,110,130,84,49,210,225,247,100,26,121,127,163,160,26,79,99,24,77,65,32,178,109,36,27,253,173,110,183,11,14,211,57,130,254,124,104,165,219,31,70,97,14,194,39,61,26,141,125,228,126,194,184,101,160,204,106,128,144,106,103,171,18,246,129,220,85,172,151,123,5,73,155,192,175,91,157,239,61,237,116,170,65,233,56,19,49,114,168,190,3,214,53,250,90,213,244,88,101,30,229,248,124,15,71,141,27,172,235,21,129,211,72,61,172,112,170,128,135,96,196,221,255,27,176,105,188,183,121,33,37,149,53,131,226,233,29,167,234,218,109,53,185,152,36,248,53,61,235,78,21,201,214,210,163,12,251,187,45,188,137,126,127,237,92,234,91,240,225,38,194,57,213,251,237,171,30,99,52,14,49,84,101,252,237,7,166,122,114,32,107,32,207,239,136,168,178,12,11,241,233,230,146,132,18,83,233,41,172,17,6,161,42,113,87,40,255,185,1,146,128,5,240,126,131,71,42,54,124,205,2,122,71,30,222,229,40,134,142,102,97,239,151,177,1,230,231,49,123,219,28,129,91,152,112,13,154,81,197,226,255,112,158,178,177,55,181,108,138,185,245,29,186,21,73,188,209,154,200,89,116,235,198,144,36,87,248,22,7,200,122,7,148,44,42,87,140,238,204,95,231,252,0,136,0,22,39,70,123,125,165,113,227,172,146,163,128,158,36,52,91,19,36,245,27,150,138,141,11,67,239,224,65,24,116,101,7,39,46,142,172,164,243,148,0,33,226,59,47,203,137,156,241,66,250,157,30,204,101,143,134,98,238,155,226,25,184,136,219,89,100,193,11,143,71,139,243,230,151,0,249,1,78,26,32,93,104,157,67,97,164,248,86,124,146,93,74,222,228,167,55,53,100,135,216,109,13,64,37,106,177,200,200,182,92,251,69,31,243,89,80,198,14,132,203,72,103,28,104,217,24,97,223,113,11,29,178,191,210,46,162,255,68,99,8,237,213,162,152,193,183,121,203,19,108,182,29,86,26,192,103,220,103,205,154,179,197,9,22,73,127,175,146,38,119,210,0,24,180,21,245,215,204,91,186,119,138,183,239,15,155,231,248,133,39,24,101,144,236,10,230,54,174,227,73,21,110,10,160,241,232,131,14,212,127,232,59,122,65,146,54,163,9,189,190,121,88,170,62,194,14,204,152,245,38,131,37,91,81,72,114,29,115,239,182,56,44,156,159,177,180,82,160,93,97,86,183,236,50,95,85,39,71,181,225,152,143,63,123,117,34,44,109,160,166,229,240,91,138,102,54,180,173,44,50,80,42,124,7,50,124,211,239,21,94,197,185,239,213,107,142,64,95,124,125,17,180,97,189,101,52,48,19,112,12,70,9,212,177,54,118,66,84,147,236,248,26,124,95,103,135,254,124,49,112,186,99,120,90,8,194,191,88,57,242,65,61,10,104,246,197,252,19,159,58,194,75,173,242,103,8,115,84,69,238,149,26,15,159,182,141,132,119,70,29,53,20,143,46,163,204,6,236,59,45,185,172,89,119,83,38,144,36,222,96,151,26,99,195,163,170,133,92,159,214,53,150,116,90,176,69,145,130,15,172,140,217,215,101,163,115,161,65,101,8,7,183,113,213,134,58,175,130,251,143,173,248,168,135,60,159,30,194,68,208,119,120,2,40,178,227,247,161,77,47,136,46,244,163,72,65,158,25,225,195,61,132,182,204,177,186,200,81,2,65,105,212,72,94,203,232,217,182,123,251,228,160,1,161,204,123,20,37,1,77,208,179,45,149,181,122,102,190,123,213,164,231,41,216,130,234,248,208,251,252,220,84,209,67,47,61,220,5,142,162,26,236,121,142,248,132,255,65,122,203,196,102,191,187,2,195,127,255,193,92,49,91,186,154,39,156,29,211,172,49,104,245,114,153,223,211,199,249,35,130,160,128,0,152,176,183,20,236,113,193,108,26,255,11,237,102,133,245,94,115,114,10,89,229,214,221,99,149,30,99,37,246,10,26,26,39,92,123,170,73,211,127,227,54,30,86,133,159,112,225,91,148,100,174,149,75,143,14,140,20,44,64,212,5,243,8,116,63,30,97,42,123,20,73,212,85,207,83,122,27,251,233,84,10,17,236,232,83,200,127,119,143,163,204,220,167,59,231,20,106,186,222,191,8,40,234,21,25,180,13,116,250,152,224,174,75,3,205,38,173,215,236,151,185,121,254,244,154,239,17,53,106,164,61,49,116,216,118,94,150,35,181,26,238,66,49,211,221,132,146,166,115,39,136,36,205,230,179,31,197,51,148,165,109,38,70,37,148,52,44,209,250,98,58,246,225,103,198,101,26,25,196,207,8,166,21,88,252,175,253,10,88,107,157,19,225,61,12,246,221,37,239,186,167,137,142,135,222,128,174,62,95,216,38,141,157,45,232,97,217,173,203,234,116,129,69,206,189,94,221,12,54,139,186,247,184,16,200,121,244,104,8,7,35,111,47,188,10,140,92,73,143,206,203,72,122,184,20,102,197,130,64,150,63,96,239,8,132,111,217,84,91,198,32,43,100,138,241,15,160,42,190,253,193,184,164,124,29,210,96,67,224,221,182,29,218,129,149,29,128,174,98,88,88,125,56,40,255,120,5,0,87,174,42,150,90,112,201,183,169,19,57,195,191,12,58,244,235,132,25,145,72,146,214,8,125,100,135,12,5,102,97,248,174,24,159,90,33,43,187,6,61,212,241,225,190,219,252,197,123,129,164,108,123,55,230,4,153,166,105,234,15,85,216,23,56,32,3,41,110,68,146,172,133,202,98,41,7,47,152,35,255,168,106,241,226,222,77,244,52,185,65,252,227,32,66,38,11,172,60,28,28,103,84,1,1,205,182,190,28,189,102,253,43,1,191,148,116,10,227,18,81,93,80,239,157,232,215,180,163,165,161,109,177,71,150,244,144,208,160,110,22,174,60,206,43,103,121,55,103,114,115,173,238,13,10,227,251,41,176,216,158,229,216,55,234,128,128,20,167,106,181,86,163,130,215,110,149,191,10,227,215,8,214,154,178,181,15,19,0,247,250,97,74,43,157,55,94,174,41,41,9,199,97,20,91,32,18,10,43,98,240,247,203,20,250,117,160,44,229,202,187,64,54,124,15,184,169,129,27,160,240,26,61,255,60,166,60,144,209,84,55,187,186,168,13,124,125,29,17,100,249,227,62,205,78,179,163,168,139,168,21,38,83,239,151,74,43,66,2,92,72,71,94,216,134,238,20,45,158,213,164,73,57,80,47,198,184,130,223,227,71,132,133,235,177,85,174,142,124,172,200,54,229,40,126,60,76,92,216,153,56,241,174,66,141,90,226,3,30,68,234,71,187,163,112,146,255,22,143,170,204,3,127,179,81,139,160,37,77,246,128,220,196,158,153,73,177,65,199,119,29,197,144,130,248,206,155,253,108,213,124,7,223,221,162,146,134,242,65,99,162,107,120,247,214,207,96,150,169,131,208,218,221,28,24,112,208,23,1,130,142,232,56,104,45,33,158,95,255,123,31,74,76,120,178,155,213,6,195,164,8,8,69,241,197,127,83,169,21,167,19,94,143,252,33,159,248,241,170,153,147,1,149,199,201,131,170,79,236,212,209,143,107,98,24,123,56,33,193,85,247,64,225,135,210,78,145,57,16,145,71,170,20,133,87,235,4,166,239,100,82,235,81,50,223,9,193,52,49,86,129,190,196,82,165,107,63,115,161,98,33,20,193,29,42,151,205,252,124,72,245,48,181,67,7,13,21,127,59,226,188,144,129,112,244,192,121,213,80,42,196,1,13,107,108,78,0,40,121,225,148,237,234,209,216,238,9,147,226,254,96,89,212,72,193,106,75,135,74,227,67,255,92,191,81,188,124,226,149,152,142,15,159,195,238,114,55,255,166,157,230,59,148,170,166,151,65,213,104,253,253,112,150,82,147,137,27,214,100,247,65,81,92,47,86,217,7,45,120,81,130,31,236,243,76,78,3,45,105,172,220,71,48,220,94,196,249,163,193,133,50,236,205,20,55,2,63,14,127,69,113,212,204,12,58,79,89,86,29,61,199,201,64,149,6,144,182,150,129,31,18,167,120,248,82,107,25,143,128,27,161,28,25,153,183,217,238,78,186,106,92,27,202,219,165,96,0,216,234,169,73,101,39,182,113,217,240,170,116,172,221,250,233,48,49,242,83,227,92,181,184,72,230,180,21,15,108,135,25,38,153,25,124,227,26,149,73,236,39,211,244,149,58,183,132,26,223,219,174,144,117,233,219,165,205,157,159,222,184,52,47,241,201,123,65,24,44,55,215,177,168,250,179,115,190,227,123,158,163,179,224,69,196,66,207,254,243,101,221,193,140,250,4,28,222,52,96,138,160,33,218,64,118,214,234,201,152,148,91,178,111,107,144,142,6,182,102,72,188,34,213,181,26,223,58,255,103,81,17,47,169,11,245,224,123,148,215,237,186,107,75,152,90,202,166,22,149,197,5,246,238,78,76,229,106,199,94,127,195,0,45,82,6,159,103,96,138,231,71,46,107,59,216,39,43,12,221,27,214,56,155,145,66,187,169,250,235,78,211,179,239,183,198,163,93,5,196,24,174,143,225,106,139,89,98,13,127,207,184,194,30,1,165,198,169,8,197,118,86,163,221,138,23,209,61,116,79,99,233,43,130,60,244,85,229,243,172,123,148,200,120,192,127,211,52,11,159,41,95,212,230,188,169,156,137,29,212,12,148,168,148,133,243,44,241,139,127,24,246,220,227,125,209,97,60,52,162,192,146,49,161,92,138,112,189,128,59,126,125,46,207,60,79,231,174,152,209,68,223,205,2,38,14,91,116,159,255,28,27,178,248,164,104,158,79,69,214,234,157,12,75,163,83,253,245,202,61,213,176,6,197,230,29,208,166,253,194,254,235,29,141,241,70,249,15,62,0,148,163,135,52,122,40,96,87,31,179,152,51,216,133,184,122,198,203,60,115,218,191,193,16,178,25,148,252,112,104,103,252,36,92,221,28,179,43,199,198,151,128,100,252,217,161,249,34,201,172,118,52,180,252,104,7,223,44,116,102,212,21,40,224,184,55,163,210,21,207,161,239,51,54,155,41,133,18,67,48,3,165,130,251,4,79,214,57,72,130,157,212,144],xm=[0,1,3,4,6,7,9,10,12,13,15,16,18,19,21,22,24,26,29,31,34,36,39,41,44,46,49,51,54,56,59,61,64,65,66,67,68,69,70,72,73,74,75,76,77,79,80,81,82,83,84,85,87,88,89,90,91,92,94,95,96,97,98,99,101,102,103,104,105,106,107,109,110,111,112,113,114,116,117,118,119,120,121,123,124,125,126,127,128,129,131,132,133,134,135,136,138,139,140,141,142,143,145,146,147,148,149,150,151,153,154,155,156,157,158,160,161,162,163,164,165,166,168,169,170,171,172,173,175,176,177,178,179,180,182,183,184,185,186,187,188,190,191,192,193,194,195,197,198,199,200,201,202,204,205,206,207,208,209,210,212,213,214,215,216,217,219,220,221,222,223,224,226,226,226,227,227,227,228,228,228,229,229,229,230,230,231,231,231,232,232,232,233,233,233,234,234,235,235,235,236,236,236,237,237,237,238,238,239,239,239,240,240,240,241,241,241,242,242,243,243,243,244,244,244,245,245,245,246,246,246,247,247,247,248,248,248,249,249,249,250,250,250,251,251,251,252,252,252,253,253,253,254,254,254,255],Cg=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,32,33,35,36,37,39,40,42,43,44,46,47,49,50,51,53,54,56,57,58,59,61,62,63,64,66,67,68,69,71,72,73,74,76,77,78,79,81,82,83,84,86,87,88,90,91,92,93,95,96,97,98,100,101,102,103,105,106,107,108,110,111,112,113,115,116,117,118,120,121,122,124,125,126,127,129,130,131,132,134,135,136,137,139,140,141,142,144,145,146,147,149,150,151,152,154,155,156,158,159,160,161,163,164,165,166,168,169,170,171,173,174,175,176,178,179,180,181,183,184,185,186,188,189,190,192,193,194,195,197,198,199,200,202,203,204,205,207,208,209,210,212,213,214,215,217,218,219,220,222,223,224,226,226,226,227,227,228,228,229,229,230,230,231,231,232,232,233,233,234,234,234,235,235,236,236,237,237,238,238,239,239,240,240,241,241,242,242,243,243,243,244,244,244,245,245,245,246,246,246,247,247,247,248,248,248,249,249,249,250,250,250,251,251,251,252,252,252,253,253,253,254,254,254,255],Mm=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,41,43,44,45,46,47,48,50,51,52,53,54,55,56,58,59,60,61,62,63,65,66,67,68,69,70,72,73,74,76,77,78,80,81,83,84,85,87,88,89,91,92,94,95,96,98,99,100,102,103,105,106,107,109,110,111,113,114,116,117,118,120,121,122,124,125,127,128,129,131,132,133,135,136,138,139,140,142,143,144,146,147,149,150,151,153,154,155,157,158,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,192,193,193,194,195,195,196,197,197,198,199,199,200,201,201,202,203,203,204,205,205,206,207,207,208,209,209,210,211,211,212,213,213,214,215,215,216,217,217,218,219,219,220,221,221,222,223,223,224,225,225,226,227,227,228,229,229,230,231,231,232,233,233,234,235,235,236,237,237,238,239,239,240,241,241,242,243,243,244,245,245,246,247,247,248,249,249,250,251,251,252,253,253,254,255];class km extends na{constructor(e,r,i,o){super(e,Pm,i,o);this.lightLevel=.1,this.rednessLevel=.5,this.mskin_he_max=175/180*3.141593,this.mskin_he_min=115/180*3.141593,this.mskin_hc_max=173/180*3.141593,this.mskin_hc_min=116/180*3.141593,this.mskin_hc_axis=2.04203545,this.mfacts_rotate_ge=this.mfacts_rotate_le=this.mfacts_rotate_c=0,this.tab_addr=null,this.lutTextures=[],this.inputTexture=r,this.init()}setUniforms(){var e=this.gl.getUniformLocation(this.program,"u_flipY"),r=this.gl.getUniformLocation(this.program,"u_denoiseLevel");this.gl.uniform1f(r,this.denoiseLevel),this.gl.uniform1f(e,1),e=this.gl.getUniformLocation(this.program,"light"),this.gl.uniform1f(e,this.lightLevel),e=this.gl.getUniformLocation(this.program,"redness"),this.gl.uniform1f(e,this.rednessLevel),e=this.gl.getUniformLocation(this.program,"skin_he_max"),r=this.gl.getUniformLocation(this.program,"skin_he_min");var i=this.gl.getUniformLocation(this.program,"skin_hc_max"),o=this.gl.getUniformLocation(this.program,"skin_hc_min");let c=this.gl.getUniformLocation(this.program,"skin_hc_axis"),h=this.gl.getUniformLocation(this.program,"facts_rotate_c"),C=this.gl.getUniformLocation(this.program,"facts_rotate_le"),x=this.gl.getUniformLocation(this.program,"facts_rotate_ge");for(this.gl.uniform1f(e,this.mskin_he_max),this.gl.uniform1f(r,this.mskin_he_min),this.gl.uniform1f(i,this.mskin_hc_max),this.gl.uniform1f(o,this.mskin_hc_min),this.gl.uniform1f(c,this.mskin_hc_axis),this.gl.uniform1f(h,this.mfacts_rotate_c),this.gl.uniform1f(C,this.mfacts_rotate_le),this.gl.uniform1f(x,this.mfacts_rotate_ge),e=this.gl.getUniformLocation(this.program,"u_originImage"),this.gl.activeTexture(this.gl.TEXTURE2),this.gl.bindTexture(this.gl.TEXTURE_2D,this.inputTexture),this.gl.uniform1i(e,2),e=["lighten_lut"],r=[this.gl.TEXTURE3],i=0;i<e.length;i++)o=this.gl.getUniformLocation(this.program,e[i]),this.gl.activeTexture(r[i]),this.gl.bindTexture(this.gl.TEXTURE_2D,this.lutTextures[i]),this.gl.uniform1i(o,i+3)}setParameters(e){e.denoiseLevel!==void 0&&(this.denoiseLevel=e.denoiseLevel),e.lightLevel!==void 0&&(this.lightLevel=e.lightLevel),e.rednessLevel!==void 0&&(this.rednessLevel=e.rednessLevel,this.updateRedness(this.rednessLevel)),e.lighteningContrastLevel&&this.updateLut(e.lighteningContrastLevel)}init(){this.tab_addr=new Uint8Array(Cg);let e=[this.tab_addr],r=[256],i=[1];for(let o=0;o<e.length;o++){let c=this.gl.createTexture();if(!c)throw new ue(oe.WEBGL_INTERNAL_ERROR,"create lut texture failed");this.gl.bindTexture(this.gl.TEXTURE_2D,c),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.LUMINANCE,r[o],i[o],0,this.gl.LUMINANCE,this.gl.UNSIGNED_BYTE,e[o]),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.lutTextures.push(c)}}updateRedness(e){var r=e;1<e&&(e=1),0>e&&(e=0),1<r&&(r=1),0>r&&(r=0),this.mfacts_rotate_c=.8*e,.8>r&&(r=0),this.mskin_he_max=175/180*3.141593,this.mskin_hc_max=173/180*3.141593,this.mskin_he_min=(115-4*r)/180*3.141593,this.mskin_hc_min=(116-4*r)/180*3.141593,this.mskin_hc_axis=(117-4*r)/180*3.141593,this.mskin_hc_axis<this.mskin_hc_min&&(this.mskin_hc_axis=this.mskin_hc_min),1.5707965>this.mskin_hc_min&&(this.mskin_hc_min=1.5707965),1.5707965>this.mskin_hc_axis&&(this.mskin_hc_axis=1.5707965),1.5707965>this.mskin_he_min&&(this.mskin_he_min=1.5707965),3.141593<this.mskin_hc_max&&(this.mskin_hc_max=3.141593),3.141593<this.mskin_hc_axis&&(this.mskin_hc_axis=3.141593),3.141593<this.mskin_he_max&&(this.mskin_he_max=3.141593),e=this.mskin_he_max-this.mskin_hc_max,r=this.mskin_hc_max-this.mskin_hc_axis,this.mfacts_rotate_ge=.01<e?this.mfacts_rotate_c*r/e:this.mfacts_rotate_c,e=this.mskin_hc_min-this.mskin_he_min,r=this.mskin_hc_axis-this.mskin_hc_min,this.mfacts_rotate_le=.01<e?this.mfacts_rotate_c*r/e:this.mfacts_rotate_c}updateLut(e){var r=null;if(e===0&&(r=Cg),e===1&&(r=Mm),e===2&&(r=xm),!r)throw new ue(oe.WEBGL_INTERNAL_ERROR,"invalid ylut_table value:"+e);this.tab_addr=new Uint8Array(r),e=[this.tab_addr],r=[256];let i=[1];for(let o=0;o<e.length;o++)this.gl.bindTexture(this.gl.TEXTURE_2D,this.lutTextures[o]),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.LUMINANCE,r[o],i[o],0,this.gl.LUMINANCE,this.gl.UNSIGNED_BYTE,e[o])}}class Um{constructor(){this.canvas=this.gl=null,this.programs=[],this.inputTexture=this.commonProgram=null,this.outputTextures=[],this.fbos=[],this.originalFrameHeight=this.originalFrameWidth=0,this.enableBeauty=!1,this.denoiseLevel=5,this.lightLevel=.35,this.rednessLevel=.5,this.lighteningContrastLevel=1}setEnableBeauty(e){this.enableBeauty=!!e}init(e,r,i){if(!Nr.supportWebGL)throw new ue(oe.NOT_SUPPORTED,"your browser is not support webGL");if(this.gl=i.getContext("webgl"),!this.gl)throw new ue(oe.WEBGL_INTERNAL_ERROR,"can not get webgl context");if(this.initGL(e,r),!this.inputTexture)throw new ue(oe.WEBGL_INTERNAL_ERROR,"can not find input texture");this.canvas=i,this.programs.push(new _g(this.gl)),this.programs.push(new Dm(this.gl,e,r)),this.programs.push(new Om(this.gl,e,r)),this.programs.push(new Nm(this.gl,e,r)),this.programs.push(new km(this.gl,this.inputTexture,e,r)),this.commonProgram=this.programs[0].program,this.setDenoiseLevel(this.denoiseLevel),this.setLightLevel(this.lightLevel),this.setRednessLevel(this.rednessLevel),this.setContrastLevel(this.lighteningContrastLevel)}render(e){if(!this.gl||!this.commonProgram||!this.canvas)return void z.warning("video effect manager is not init!");var r=0;if(this.originalFrameHeight===e.videoWidth&&this.originalFrameWidth===e.videoHeight)r=2;else if(this.originalFrameHeight!==e.videoHeight||this.originalFrameWidth!==e.videoWidth){var i,o,c;if(z.debug(ne(i=ne(o=ne(c="beauty effect: resolution changed ".concat(this.originalFrameWidth,"x")).call(c,this.originalFrameHeight," -> ")).call(o,e.videoWidth,"x")).call(i,e.videoHeight)),e.videoHeight===0||e.videoWidth===0)return void z.debug("beauty effect: skip 0 resolution frame");this.canvas.width=e.videoWidth,this.canvas.height=e.videoHeight,e.setAttribute("width",e.videoWidth.toString()),e.setAttribute("height",e.videoHeight.toString()),this.release(),this.init(e.videoWidth,e.videoHeight,this.canvas)}for(this.gl.viewport(0,0,e.videoWidth,e.videoHeight),this.gl.bindTexture(this.gl.TEXTURE_2D,this.inputTexture),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e),e=this.enableBeauty?this.programs.length-1:0,i=0;i<=e;i++)o=this.programs[i].program,this.gl.useProgram(o),o=this.gl.getUniformLocation(o,"u_image"),this.programs[i].setUniforms(),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.fbos[r+i%2]),this.gl.clearColor(0,0,0,1),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.drawArrays(this.gl.TRIANGLES,0,6),this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,this.outputTextures[r+i%2]),this.gl.uniform1i(o,0);this.gl.useProgram(this.commonProgram),r=this.gl.getUniformLocation(this.commonProgram,"u_flipY"),this.gl.uniform1f(r,-1),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null),this.gl.clearColor(0,0,0,1),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.drawArrays(this.gl.TRIANGLES,0,6)}setDenoiseLevel(e){var r;Re(r=this.programs).call(r,i=>{i instanceof na&&i.setParameters({denoiseLevel:e})}),this.denoiseLevel=e}setLightLevel(e){var r;Re(r=this.programs).call(r,i=>{i instanceof na&&i.setParameters({lightLevel:e})}),this.lightLevel=e}setRednessLevel(e){var r;Re(r=this.programs).call(r,i=>{i instanceof na&&i.setParameters({rednessLevel:e})}),this.rednessLevel=e}setContrastLevel(e){var r;Re(r=this.programs).call(r,i=>{i instanceof na&&i.setParameters({lighteningContrastLevel:e})}),this.lighteningContrastLevel=e}setSize(e,r){var i;Re(i=this.programs).call(i,o=>{o instanceof na&&o.setSize(e,r)})}release(){this.inputTexture=this.commonProgram=this.gl=null,this.programs=[],this.outputTextures=[],this.fbos=[]}initGL(e,r){if(!this.gl)throw new ue(oe.WEBGL_INTERNAL_ERROR,"can not find webgl context");this.inputTexture=this.gl.createTexture(),this.gl.bindTexture(this.gl.TEXTURE_2D,this.inputTexture),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR);for(let i=0;4>i;i++){let o=this.gl.createTexture();if(!o)throw new ue(oe.WEBGL_INTERNAL_ERROR,"create texture failed");this.gl.bindTexture(this.gl.TEXTURE_2D,o),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),2>i?this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,e,r,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,null):this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,r,e,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,null);let c=this.gl.createFramebuffer();if(!c)throw new ue(oe.WEBGL_INTERNAL_ERROR,"create frame buffer failed");this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,c),this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,this.gl.TEXTURE_2D,o,0),this.outputTextures.push(o),this.fbos.push(c)}this.gl.viewport(0,0,e,r),this.originalFrameWidth=e,this.originalFrameHeight=r}}class Fm{constructor(){this.recordedFrameCount=this.targetFrameRate=0,this.recordingTime=2}startRecordBeautyEffectOutput(e,r=4){return Ee(this,null,function*(){if(this.recordID)throw new ue(oe.UNEXPECTED_ERROR,"another beauty effect recording is in progress");let i=be(6,"");return this.recordID=i,this.targetFrameRate=e,this.recordedFrameCount=0,this.recordingTime=r,yield zi(1e3*this.recordingTime),this.recordID!==i?(this.recordID=void 0,!0):(this.recordID=void 0,this.recordedFrameCount<this.targetFrameRate*this.recordingTime/2?(z.warning("detect beauty effect overload, current framerate",this.recordedFrameCount/2),!1):(z.debug("beauty effect current framerate",this.recordedFrameCount/2),!0))})}stopRecordBeautyEffectOutput(){this.recordedFrameCount=this.targetFrameRate=0,this.recordID=void 0}addFrame(){this.recordID&&(this.recordedFrameCount+=1)}}class Qm extends class{get output(){return this._output}setInput(e){return Ee(this,null,function*(){if(e!==this.input){if(e.kind!==this.kind)throw new ue(oe.UNEXPECTED_ERROR);this.input&&this.removeInput(),this.input=e,yield this._setInput(e)}})}removeInput(){this.input=void 0,this._removeInput()}updateOutput(e){return Ee(this,null,function*(){this.output!==e&&(this._output=e,this.onOutputChange&&(yield this.onOutputChange()))})}replaceOriginMediaStream(e,r){var i,o;let c=rr(i=e.getTracks()).call(i,h=>h.kind===this.kind);c&&e.removeTrack(c),r=rr(o=r.getTracks()).call(o,h=>h.kind===this.kind),this.output===void 0&&r&&e.addTrack(r),this.output&&(z.debug("replace ".concat(this.output.kind," track to origin media stream")),e.addTrack(this.output))}}{constructor(){super();this.kind="video",this.fps=15,this.overloadDetector=new Fm,this.enabled=!1,this.stopChromeBackgroundLoop=null,this.lastRenderTime=0,this.fps=30,this.manager=new Um}setBeautyEffectOptions(e,r){return Ee(this,null,function*(){r.smoothnessLevel!==void 0&&Xt(r.smoothnessLevel,"options.smoothnessLevel",0,1,!1),r.lighteningLevel!==void 0&&Xt(r.lighteningLevel,"options.lighteningLevel",0,1,!1),r.rednessLevel!==void 0&&Xt(r.rednessLevel,"options.rednessLevel",0,1,!1),r.lighteningContrastLevel!==void 0&&ui(r.lighteningContrastLevel,"options.lighteningContrastLevel",[0,1,2]),r.smoothnessLevel!==void 0&&this.manager.setDenoiseLevel(Math.max(.1,10*r.smoothnessLevel)),r.lighteningLevel!==void 0&&this.manager.setLightLevel(Math.max(.1,r.lighteningLevel/2)),r.rednessLevel!==void 0&&this.manager.setRednessLevel(Math.max(.01,r.rednessLevel)),r.lighteningContrastLevel!==void 0&&this.manager.setContrastLevel(r.lighteningContrastLevel),this.enabled!==e&&(this.manager.setEnableBeauty(e),this.enabled=e,e?this.input&&(yield this.startEffect()):yield this.stopEffect())})}destroy(){this.onOutputChange=void 0,this.stopEffect(),this.enabled=!1}startEffect(){return Ee(this,null,function*(){let e=Ye();if(!this.input)return void z.warning("video track is null, fail to start video effect!");if(this.input&&this.output&&this.input!==this.output)return void z.warning("video effect is already enabled");let r=yield this.renderWithWebGL();yield this.updateOutput(r),z.info("start video effect, output:",this.output),this.overloadDetector.startRecordBeautyEffectOutput(this.fps).then(o=>{o||this.onOverload&&this.onOverload()});let i=()=>{this.enabled&&requestAnimationFrame(i);const o=at(),c=1e3/this.fps,h=this.lastRenderTime?o-this.lastRenderTime:c;h<c||(this.lastRenderTime=o-(h-c),this.video&&this.video.paused&&this.video.play(),this.enabled&&this.video&&(this.manager.render(this.video),this.output&&this.output.requestFrame&&this.output.requestFrame(),this.overloadDetector.addFrame()))};requestAnimationFrame(i),e.name===ir.CHROME&&document.addEventListener("visibilitychange",()=>{document.hidden?this.stopChromeBackgroundLoop=js(()=>{this.enabled&&this.video&&this.manager.render(this.video),this.output&&this.output.requestFrame&&this.output.requestFrame(),this.overloadDetector.addFrame()},this.fps):this.stopChromeBackgroundLoop&&(this.stopChromeBackgroundLoop(),this.stopChromeBackgroundLoop=null)},!1)})}stopEffect(){return Ee(this,null,function*(){z.info("stop video effect"),this.overloadDetector.stopRecordBeautyEffectOutput(),this.manager.release(),this.canvas&&this.canvas.remove(),this.video&&this.video.remove(),this.video=this.canvas=void 0,yield this.updateOutput(this.input)})}_setInput(e){return Ee(this,null,function*(){this.enabled&&!this.video&&(yield this.startEffect())})}_removeInput(){this.stopEffect()}renderWithWebGL(){return Ee(this,null,function*(){var e;if(!this.input)throw new ue(oe.BEAUTY_PROCESSOR_INTERNAL_ERROR,"can not renderWithWebGL, no input");this.canvas&&(this.canvas.remove(),this.canvas=void 0),this.video&&(this.video.remove(),this.video=void 0),this.canvas=document.createElement("canvas"),this.video=document.createElement("video"),this.video.setAttribute("autoplay",""),this.video.setAttribute("muted",""),this.video.muted=!0,this.video.setAttribute("playsinline",""),this.video.setAttribute("style","display:none"),this.video.srcObject=new MediaStream([this.input]);var r=new it(c=>{const h=()=>{this.video&&this.video.removeEventListener("playing",h),c(void 0)};this.video&&this.video.addEventListener("playing",h)});this.video.play(),yield r,r=this.input.getSettings();let i=r.width||this.video.videoWidth,o=r.height||this.video.videoHeight;if(r.frameRate&&this.fps!==r.frameRate&&(this.fps=r.frameRate,z.debug("beauty video processor: set fps to",this.fps)),z.debug(ne(e="beauty video processor: width ".concat(i," height ")).call(e,o)),!i||!o)throw new ue(oe.BEAUTY_PROCESSOR_INTERNAL_ERROR,"can not get track resolution");return this.canvas.width=i,this.canvas.height=o,this.video.setAttribute("width",i.toString()),this.video.setAttribute("height",o.toString()),this.manager.init(i,o,this.canvas),this.canvas.captureStream(Nr.supportRequestFrame?0:this.fps).getVideoTracks()[0]})}}var Ss=function(t,e,r,i){var o,c=arguments.length,h=3>c?e:i===null?i=Ar(e,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(t,e,r,i);else for(var C=t.length-1;0<=C;C--)(o=t[C])&&(h=(3>c?o(h):3<c?o(e,r,h):o(e,r))||h);return 3<c&&h&&mr(e,r,h),h},fr=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)};class ai extends Xl{constructor(e,r,i,o,c){super(e,c);this.trackMediaType="video",this._scalabiltyMode={numSpatialLayers:1,numTemporalLayers:1},this._enabled=!0,this.updateMediaStreamTrackResolution(),this._encoderConfig=r,this._scalabiltyMode=i,this._optimizationMode=o}get isPlaying(){return!(!this._player||this._player.videoElementStatus!==nn.PLAYING)}play(e,r={}){let i=ke.reportApiInvoke(null,{tag:bt.TRACER,name:Ot.LOCAL_VIDEO_TRACK_PLAY,options:[this.getTrackId(),typeof e=="string"?e:"HTMLElement",r]});if(!(e instanceof HTMLElement)){let c=document.getElementById(e.toString());var o;c?e=c:(z.warning(ne(o="[".concat(this.getTrackId(),'] can not find "#')).call(o,e,'" element, use document.body')),e=document.body)}z.debug("[".concat(this.getTrackId(),"] start video playback"),ht(r)),e=da({},this._getDefaultPlayerConfig(),{},r,{trackId:this.getTrackId(),element:e}),this._player?this._player.updateConfig(e):(this._player=new mg(e),this._player.updateVideoTrack(this._mediaStreamTrack)),this._player.play(),i.onSuccess()}stop(){let e=ke.reportApiInvoke(null,{tag:bt.TRACER,name:Ot.LOCAL_VIDEO_TRACK_STOP,options:[this.getTrackId()]});if(!this._player)return e.onSuccess();this._player.destroy(),this._player=void 0,z.debug("[".concat(this.getTrackId(),"] stop video playback")),e.onSuccess()}setEnabled(e,r){return Ee(this,null,function*(){if(!r){if(e===this._enabled)return;this.stateCheck("enabled",e)}z.info("[".concat(this.getTrackId(),"] start setEnabled"),e);let i=yield this._enabledMutex.lock();if(!e){this._originMediaStreamTrack.enabled=!1;try{yield di(this,Ut.NEED_REMOVE_TRACK,this)}catch(o){throw z.error("[".concat(this.getTrackId(),"] setEnabled to false error"),o.toString()),i(),o}return r||(this._enabled=!1),z.info("[".concat(this.getTrackId(),"] setEnabled to false success")),i()}this._originMediaStreamTrack.enabled=!0;try{yield di(this,Ut.NEED_ADD_TRACK,this)}catch(o){throw z.error("[".concat(this.getTrackId(),"] setEnabled to true error"),o.toString()),i(),o}z.info("[".concat(this.getTrackId(),"] setEnabled to true success")),r||(this._enabled=!0),i()})}setMuted(e){return Ee(this,null,function*(){var r;if(e!==this._muted){if(this.stateCheck("muted",e),this._muted=e,Ye().name===ir.FIREFOX)return z.debug("[".concat(this.getTrackId(),"] firefox set mute fallback to set enabled")),void(yield this.setEnabled(!e,!0));this._mediaStreamTrack.enabled=!e,z.debug(ne(r="[".concat(this.getTrackId(),"] start set muted: ")).call(r,e)),yield di(this,Ut.SET_VIDEO_TRACK_MUTED,{track:this,muted:e})}})}getStats(){return Pi(()=>{z.warning("[deprecated] LocalVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalVideoStats instead")},"localVideoTrackGetStatsWarning"),zr(this,Ut.GET_STATS)||da({},Jl)}setBeautyEffect(i){return Ee(this,arguments,function*(e,r={}){let o=ke.reportApiInvoke(null,{tag:bt.TRACER,name:Ot.LOCAL_VIDEO_TRACK_BEAUTY,options:[this.getTrackId(),e,r]});if(e||this._videoBeautyProcessor){if(Ye().os===tn.IOS||Ye().os===tn.ANDROID)throw e=new ue(oe.INVALID_OPERATION,"can not enable beauty effect on mobile device"),o.onError(e),e;if(!this._enabled&&e)throw e=new ue(oe.TRACK_IS_DISABLED,"can not enable beauty effect when track is disabled"),o.onError(e),e;z.info("[".concat(this.getTrackId(),"] start setBeautyEffect"),e,ht(r));try{this._videoBeautyProcessor?yield this._videoBeautyProcessor.setBeautyEffectOptions(e,r):(this._videoBeautyProcessor=new Qm,this._videoBeautyProcessor.onOverload=()=>{Fr(()=>this.emit(Ba.BEAUTY_EFFECT_OVERLOAD))},yield this._videoBeautyProcessor.setBeautyEffectOptions(e,r),yield this._registerTrackProcessor(this._videoBeautyProcessor))}catch(c){throw z.error("[".concat(this.getTrackId(),"] setBeautyEffect error"),c.toString()),o.onError(c),c}z.info("[".concat(this.getTrackId(),"] setBeautyEffect success")),o.onSuccess()}})}getCurrentFrameData(){return this._player?this._player.getCurrentFrame():new ImageData(2,2)}clone(e,r,i,o){let c=this._mediaStreamTrack.clone();return new ai(c,e,r,i,o)}setBitrateLimit(e){return Ee(this,null,function*(){var r;if(z.debug(ne(r="[".concat(this.getTrackId(),"] set bitrate limit, ")).call(r,ht(e))),e){this._forceBitrateLimit=e,this._encoderConfig&&(this._encoderConfig.bitrateMax?this._encoderConfig.bitrateMax=this._encoderConfig.bitrateMax<e.max_bitrate?this._encoderConfig.bitrateMax:e.max_bitrate:this._encoderConfig.bitrateMax=e.max_bitrate,this._encoderConfig.bitrateMin,this._encoderConfig.bitrateMin=e.min_bitrate);try{yield di(this,Ut.NEED_RESET_REMOTE_SDP)}catch(i){return i.throw()}}})}setOptimizationMode(e){return Ee(this,null,function*(){var r;if(e==="motion"||e==="detail"||e==="balanced"){try{this._optimizationMode=e,yield di(this,Ut.SET_OPTIMIZATION_MODE,e)}catch(i){throw z.error("[".concat(this.getTrackId(),"] set optimization mode failed"),i.toString()),i}z.info(ne(r="[".concat(this.getTrackId(),"] set optimization mode success (")).call(r,e,")"))}else z.error(oe.INVALID_PARAMS,"optimization mode must be motion, detail or balanced")})}setScalabiltyMode(e){var r;if(e.numSpatialLayers===1&&e.numTemporalLayers!==1)return z.error(oe.INVALID_PARAMS,"scalability mode currently not supported, no SVC."),void(this._scalabiltyMode={numSpatialLayers:1,numTemporalLayers:1});this._scalabiltyMode=e,z.info(ne(r="[".concat(this.getTrackId(),"] set scalability mode success (")).call(r,e,")"))}updateMediaStreamTrackResolution(){xe(this._originMediaStreamTrack).then(([e,r])=>{this._videoHeight=r,this._videoWidth=e}).catch($l)}_updatePlayerSource(){this._player&&this._player.updateVideoTrack(this._mediaStreamTrack)}_getDefaultPlayerConfig(){return{fit:"contain"}}renewMediaStreamTrack(){return Ee(this,null,function*(){})}}Ss([or(),fr("design:type",Function),fr("design:paramtypes",[Object,Object]),fr("design:returntype",void 0)],ai.prototype,"play",null),Ss([or(),fr("design:type",Function),fr("design:paramtypes",[Boolean,Boolean]),fr("design:returntype",it)],ai.prototype,"setEnabled",null),Ss([or(),Ao({report:ke}),fr("design:type",Function),fr("design:paramtypes",[Boolean]),fr("design:returntype",it)],ai.prototype,"setMuted",null),Ss([or(),fr("design:type",Function),fr("design:paramtypes",[]),fr("design:returntype",Object)],ai.prototype,"getStats",null),Ss([or(),fr("design:type",Function),fr("design:paramtypes",[Boolean,Object]),fr("design:returntype",it)],ai.prototype,"setBeautyEffect",null),Ss([or(),fr("design:type",Function),fr("design:paramtypes",[]),fr("design:returntype",ImageData)],ai.prototype,"getCurrentFrameData",null),Ss([or(),fr("design:type",Function),fr("design:paramtypes",[Object]),fr("design:returntype",it)],ai.prototype,"setBitrateLimit",null),Ss([or(),fr("design:type",Function),fr("design:paramtypes",[String]),fr("design:returntype",it)],ai.prototype,"setOptimizationMode",null),Ss([or(),fr("design:type",Function),fr("design:paramtypes",[Object]),fr("design:returntype",void 0)],ai.prototype,"setScalabiltyMode",null),Ss([or(),fr("design:type",Function),fr("design:paramtypes",[]),fr("design:returntype",void 0)],ai.prototype,"updateMediaStreamTrackResolution",null);class rl extends ai{constructor(e,r,i,o,c,h){super(e,r.encoderConfig?kr(r.encoderConfig):{},o,c,h);this._enabled=!0,this._deviceName="default",this.tryResumeVideoForIOS15WeChat=()=>Ee(this,null,function*(){Or()&&Ye().name===ir.WECHAT&&this._enabled&&!this._isClosed&&(z.debug("[".concat(this.getTrackId(),"] try capture camera media device for interrupted iOS 15 device on WeChat.")),yield this.setEnabled(!1),yield this.setEnabled(!0))}),this._config=r,this._constraints=i,this._deviceName=e.label,this._config.encoderConfig&&(this._encoderConfig=kr(this._config.encoderConfig)),hr.on(Wi.IOS_15_INTERRUPTION_END,this.tryResumeVideoForIOS15WeChat),hr.on(Wi.IOS_INTERRUPTION_END,this.tryResumeVideoForIOS15WeChat)}setDevice(e){return Ee(this,null,function*(){var r;let i=ke.reportApiInvoke(null,{tag:bt.TRACER,name:Ot.CAM_VIDEO_TRACK_SET_DEVICE,options:[this.getTrackId(),e]});if(z.info(ne(r="[".concat(this.getTrackId(),"] set device to ")).call(r,e)),this._enabled)try{let o=yield Jn.getDeviceById(e);r={},r.video=da({},this._constraints),r.video.deviceId={exact:e},r.video.facingMode=void 0,this._originMediaStreamTrack.stop();let c=null;try{c=yield Ii(r,this.getTrackId())}catch(h){throw z.error("[".concat(this.getTrackId(),"] setDevice failed"),h.toString()),c=yield Ii({video:this._constraints},this.getTrackId()),yield this._updateOriginMediaStreamTrack(c.getVideoTracks()[0],!1),h}yield this._updateOriginMediaStreamTrack(c.getVideoTracks()[0],!1),this.updateMediaStreamTrackResolution(),this._deviceName=o.label,this._config.cameraId=e,this._constraints.deviceId={exact:e}}catch(o){throw i.onError(o),z.error("[".concat(this.getTrackId(),"] setDevice error"),o.toString()),o}else try{this._deviceName=(yield Jn.getDeviceById(e)).label,this._config.cameraId=e,this._constraints.deviceId={exact:e}}catch(o){throw i.onError(o),z.error("[".concat(this.getTrackId(),"] setDevice error"),o.toString()),o}z.info("[".concat(this.getTrackId(),"] setDevice success")),i.onSuccess()})}setEnabled(e,r){return Ee(this,null,function*(){if(!r){if(e===this._enabled)return;this.stateCheck("enabled",e)}z.info("[".concat(this.getTrackId(),"] start setEnabled"),e);let i=yield this._enabledMutex.lock();if(!e){this._originMediaStreamTrack.onended=null,this._originMediaStreamTrack.stop(),r||(this._enabled=!1);try{yield di(this,Ut.NEED_REMOVE_TRACK,this)}catch(c){throw z.error("[".concat(this.getTrackId(),"] setEnabled to false error"),c.toString()),i(),c}return z.info("[".concat(this.getTrackId(),"] setEnabled to false success")),i()}e=da({},this._constraints);let o=Jn.searchDeviceIdByName(this._deviceName);o&&!e.deviceId&&(e.deviceId={exact:o});try{let c=yield Ii({video:this._constraints},this.getTrackId());yield this._updateOriginMediaStreamTrack(c.getVideoTracks()[0],!1),yield di(this,Ut.NEED_ADD_TRACK,this)}catch(c){throw z.error("[".concat(this.getTrackId(),"] setEnabled true error"),c.toString()),i(),c}this.updateMediaStreamTrackResolution(),z.info("[".concat(this.getTrackId(),"] setEnabled to true success")),r||(this._enabled=!0),i()})}setEncoderConfiguration(e,r){return Ee(this,null,function*(){if(r=ke.reportApiInvoke(null,{tag:bt.TRACER,name:Ot.CAM_VIDEO_TRACK_SET_ENCODER_CONFIG,options:[this.getTrackId(),e]}),!this._enabled)throw e=new ue(oe.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled"),r.onError(e),e;e=kr(e),this._forceBitrateLimit&&(e.bitrateMax=this._forceBitrateLimit.max_bitrate?this._forceBitrateLimit.max_bitrate:e.bitrateMax,e.bitrateMin=this._forceBitrateLimit.min_bitrate?this._forceBitrateLimit.min_bitrate:e.bitrateMin);let i=(o=this._config,JSON.parse(ht(o)));var o;i.encoderConfig=e,o=yc(i),(Pt()||qt()||dr())&&(o.deviceId=void 0),z.debug("[".concat(this.getTrackId(),"] setEncoderConfiguration applyConstraints"),ht(e),ht(o));try{yield this._originMediaStreamTrack.applyConstraints(o),this.updateMediaStreamTrackResolution()}catch(c){throw e=new ue(oe.UNEXPECTED_ERROR,c.toString()),z.error("[".concat(this.getTrackId(),"] applyConstraints error"),e.toString()),r.onError(e),e}this._config=i,this._constraints=o,this._encoderConfig=e;try{yield di(this,Ut.NEED_RENEGOTIATE)}catch(c){return r.onError(c),c.throw()}r.onSuccess()})}_getDefaultPlayerConfig(){return{mirror:!0,fit:"cover"}}onTrackEnded(){if((qt()||dr())&&this._enabled&&!this._isClosed&&hr.duringInterruption){let e=()=>Ee(this,null,function*(){hr.off(Wi.IOS_INTERRUPTION_END,e),this._enabled&&!this._isClosed&&(z.debug("[".concat(this.getTrackId(),"] try capture camera media device for interrupted iOS device.")),yield this.setEnabled(!1),yield this.setEnabled(!0))});hr.on(Wi.IOS_INTERRUPTION_END,e)}else z.debug("[".concat(this.getTrackId(),"] track ended")),this.emit(Ba.TRACK_ENDED)}renewMediaStreamTrack(){return Ee(this,null,function*(){var e=da({},this._constraints);let r=Jn.searchDeviceIdByName(this._deviceName);r&&!e.deviceId&&(e.deviceId={exact:r}),e=yield Ii({video:this._constraints},this.getTrackId()),yield this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!0),this.updateMediaStreamTrackResolution()})}close(){super.close(),hr.off(Wi.IOS_15_INTERRUPTION_END,this.tryResumeVideoForIOS15WeChat),hr.off(Wi.IOS_INTERRUPTION_END,this.tryResumeVideoForIOS15WeChat)}}Ss([or(),fr("design:type",Function),fr("design:paramtypes",[String]),fr("design:returntype",it)],rl.prototype,"setDevice",null),Ss([or(),fr("design:type",Function),fr("design:paramtypes",[Boolean,Boolean]),fr("design:returntype",it)],rl.prototype,"setEnabled",null),Ss([or(),fr("design:type",Function),fr("design:paramtypes",[Object,Boolean]),fr("design:returntype",it)],rl.prototype,"setEncoderConfiguration",null);var yg=!0;"findIndex"in[]&&Array(1).findIndex(function(){yg=!1}),Kt({target:"Array",proto:!0,forced:yg},{findIndex:function(t){return At(this,t,1<arguments.length?arguments[1]:void 0)}});var Gm=pi("Array").findIndex,Ig=Array.prototype,du=function(t){var e=t.findIndex;return t===Ig||t instanceof Array&&e===Ig.findIndex?Gm:e};let Sg=(t,e)=>{let r=null;if(e==="h264"?r=t.match(/a=rtpmap:(\d+) H264.*\r\n/)||t.match(/a=rtpmap:(\d+) H264.*\n/):e==="vp8"?r=t.match(/a=rtpmap:(\d+) VP8.*\r\n/)||t.match(/a=rtpmap:(\d+) VP8.*\n/):e==="vp9"?r=t.match(/a=rtpmap:(\d+) VP9.*\r\n/)||t.match(/a=rtpmap:(\d+) VP9.*\n/):e==="av1"&&(r=t.match(/a=rtpmap:(\d+) AV1.*\r\n/)||t.match(/a=rtpmap:(\d+) AV1.*\n/)),r&&r[1])return r[1]};class Tg extends vg{constructor(e,r,i,o){super(r,r.stringUid||r.uid);this.suspendTracks=[],this.type="pub",this._waitingSuccessResponse=this.detecting=!1,this.handleMuteVideoTrack=({muted:c},h,C)=>{this.setVideoTrackMuteState(c).then(h).catch(C)},this.handleMuteAudioTrack=({track:c,muted:h},C,x)=>{this.setAudioTrackMuteState(h,c).then(C).catch(x)},this.renegotiateWithGateway=()=>Ee(this,null,function*(){return z.debug("[pc-".concat(this.pc.ID,"] renegotiate start")),new it((c,h)=>Ee(this,null,function*(){this.connectionState="connecting";let C=F=>{F==="connected"&&(this.off(Mt.CONNECTION_STATE_CHANGE,C),c()),F==="disconnected"&&(this.off(Mt.CONNECTION_STATE_CHANGE,C),h(new ue(oe.OPERATION_ABORTED,"renegotiate abort")))};this.on(Mt.CONNECTION_STATE_CHANGE,C),Dt()&&Xe.SIMULCAST&&this.videoTrack&&this.videoTrack._scalabiltyMode&&(yield this.addSimulcast4Firefox(this.videoTrack._scalabiltyMode));var x=yield this.pc.createOfferSDP();this.audioTrack&&this.audioTrack._encoderConfig&&(x=Ga(x,this.audioTrack._encoderConfig)),this.videoTrack&&this.videoTrack._scalabiltyMode&&(this.codec!=="vp9"&&this.codec!=="vp8"?(this.videoTrack._scalabiltyMode.numSpatialLayers=1,this.videoTrack._scalabiltyMode.numTemporalLayers=1):(1<this.videoTrack._scalabiltyMode.numSpatialLayers||1<this.videoTrack._scalabiltyMode.numTemporalLayers)&&(x=fl(x,this.codec,this.videoTrack._scalabiltyMode)),z.debug("renegoation spatial layers: ",this.videoTrack._scalabiltyMode.numSpatialLayers)),yield this.pc.setOfferSDP(x),this.audioTrack instanceof bn&&this.pc.onOfferSettled({videoActive:this.videoTrack&&!this.videoTrack.muted,audioActive:this.audioTrack&&this.audioTrack.isActive});let Q=yield Kr(this,Mt.NEED_RENEGOTIATE,x);this.videoTrack&&!Dt()&&Xe.SIMULCAST&&this.videoTrack._scalabiltyMode&&this.setSimulcastVideoRtpEncodingParameters(this.videoTrack._scalabiltyMode),x=function(F,V){var Y,$,te;const ce=Ti(Y=RegExp.prototype.test).call(Y,/^([a-z])=(.*)/);F=Wt($=F.split(/(\r\n|\r|\n)/)).call($,ce),V=Wt(te=V.split(/(\r\n|\r|\n)/)).call(te,ce);let Ae=null;const Me=new Tr;return Re(F).call(F,et=>{const pt=et.match(/m=(audio|video)/);if(pt&&pt[1])return void(Ae=pt[1]);Ae&&(et=et.match(/=(sendrecv|recvonly|sendonly|inactive)/))&&et[1]&&Me.set(Ae,et[1])}),Ae=null,_t(V).call(V,et=>{var pt=et.match(/m=(audio|video)/);if(pt&&pt[1])return Ae=pt[1],et;if(!Ae)return et;if((pt=et.match(/=(sendrecv|recvonly|sendonly|inactive)/))&&pt[1]){const Qt=Me.get(Ae);if(Qt&&Qt!==pt[1])return et.replace(pt[1],Qt)}return et}).join(`\r
|
|
121
|
+
`)+`\r
|
|
122
|
+
`}(x,this.updateAnswerSDP(Q.sdp)),yield this.pc.setAnswerSDP(x),z.debug("[pc-".concat(this.pc.ID,"] renegotiate success")),this.connectionState="connected"}))}),this.handleStreamRenegotiate=(c,h)=>{this.connectionState==="connected"?this.renegotiateWithGateway().then(c).catch(h):c()},this.handleReplaceTrack=(c,h,C)=>{if(this.audioTrack instanceof bn&&c.kind==="audio")return h();this.pc.replaceTrack(c).then(x=>x?this.renegotiateWithGateway():it.resolve()).then(h).catch(C)},this.handleCloseAudioTrack=c=>{},this.handleCloseVideoTrack=()=>{this.lowStreamConnection&&this.lowStreamConnection.videoTrack&&this.lowStreamConnection.videoTrack.close()},this.handleGetSessionID=c=>{c(this.joinInfo.sid)},this.handleGetLocalVideoStats=c=>{c(this.statsCollector.getLocalVideoTrackStats(this.connectionId))},this.handleGetLocalAudioStats=c=>{c(this.statsCollector.getLocalAudioTrackStats(this.connectionId))},this.handleSetOptimizationMode=(c,h,C)=>{this.videoTrack&&this.setRtpSenderParametersByTrackConfig(this.videoTrack).then(h).catch(C)},this.isLowStreamConnection=!!o,this.codec=i,this.statsCollector=e,this.statsCollector.addLocalConnection(this)}getAllTracks(){let e=[];return this.videoTrack&&e.push(this.videoTrack),this.audioTrack&&this.audioTrack instanceof bn?e=ne(e).call(e,this.audioTrack.trackList):this.audioTrack&&e.push(this.audioTrack),e.push(...this.suspendTracks),e}addTracks(e){return Ee(this,null,function*(){let r=Nr;if(this.connectionState==="connecting")try{return yield this.createWaitConnectionConnectedPromise(),yield this.addTracks(e)}catch(h){throw new ue(oe.OPERATION_ABORTED,"publish abort")}var i=!1;let o=this.getAllTracks();e=hs(e=Wt(e).call(e,h=>Vt(o).call(o,h)===-1));for(let h=0;h<e.length;h+=1){var c=e[h];if(!(c instanceof Xl))return new ue(oe.INVALID_LOCAL_TRACK).throw();if(c instanceof ai&&this.disabledVideoTrack){if(this.disabledVideoTrack!==c)return new ue(oe.EXIST_DISABLED_VIDEO_TRACK).throw();this.disabledVideoTrack=void 0}if(c instanceof ai&&this.videoTrack)return new ue(oe.CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS).throw();if(c instanceof ji){if(this.audioTrack&&this.audioTrack._bypassWebAudio)throw z.error("One of the audio track was created with config bypassWebAudio set to true, there is no way to publish multiple audio tracks."),new ue(oe.CAN_NOT_PUBLISH_MULTIPLE_AUDIO_TRACKS);if(this.audioTrack instanceof bn)this.audioTrack.trackList.length===0&&(yield this.pc.setAudioRtpEncodingParameters({active:!0})),this.audioTrack.addAudioTrack(c);else if(r.webAudioMediaStreamDest)if(c._bypassWebAudio){if(this.audioTrack)throw z.error("Can not publish another audio track with bypassWebAudio set to true."),new ue(oe.CAN_NOT_PUBLISH_MULTIPLE_AUDIO_TRACKS);z.debug("[".concat(this.connectionId,"] audio track doesn't not pass through WebAudio, use original audio track to publish")),i=yield this.addTrackWithPC(c)}else i=new bn,c.muted?this.suspendTracks.push(c):i.addAudioTrack(c),i=yield this.addTrackWithPC(i);else z.debug("[".concat(this.connectionId,"] your browser does not support mixing track, use original audio track to publish")),i=yield this.addTrackWithPC(c)}else c instanceof ai&&this.isLowStreamConnection?(i=Al({},{width:160,height:120,framerate:15,bitrate:50},{},this.lowStreamParameter),r.supportDualStreamEncoding?(z.debug("[".concat(this.connectionId,"] creating low stream using rtp encoding.")),this.lowStreamEncoding=Ca(i,c),c=c.clone({bitrateMax:i.bitrate,bitrateMin:i.bitrate})):(z.debug("[".concat(this.connectionId,"] creating low stream using canvas.")),c=pu(c,i),c=new ai(c,{bitrateMax:i.bitrate,bitrateMin:i.bitrate})),c._hints.push(oo.LOW_STREAM),i=yield this.addTrackWithPC(c),this.bindTrackEvents(c)):(this.detecting=!0,_s(()=>{this.detecting=!1},8e3),i=yield this.addTrackWithPC(c))}yield this.updateControlMessage(),i&&(yield this.renegotiateWithGateway()),Re(e).call(e,h=>this.bindTrackEvents(h))})}removeTracks(e,r){return Ee(this,null,function*(){let i=this.getAllTracks();e=hs(e=Wt(e).call(e,h=>Vt(i).call(i,h)!==-1||h===this.disabledVideoTrack));let o=[];for(let h=0;h<e.length;h+=1){let C=e[h];if(this.unbindTrackEvents(C),this.audioTrack instanceof bn&&C instanceof ji)this.audioTrack.removeAudioTrack(C),Fi(this.suspendTracks,C),this.audioTrack.trackList.length===0&&(o.push(this.audioTrack),this.audioTrack=void 0);else if(C instanceof ji)o.push(C),this.audioTrack=void 0;else if(C instanceof ai){if(r){if(this.disabledVideoTrack===C)return void(this.disabledVideoTrack=void 0)}else this.disabledVideoTrack=this.videoTrack;o.push(C),this.isLowStreamConnection&&C.close(),this.videoTrack=void 0}}if(this.videoTrack||this.audioTrack){if(o.length!==0){if(this.connectionState==="connecting")try{yield this.createWaitConnectionConnectedPromise()}catch(h){return}for(let h of o){var c;z.debug(ne(c="[".concat(this.connectionId,"] remove ")).call(c,h.trackMediaType," from pc")),yield this.pc.removeTrack(h._mediaStreamTrack),e=Ye(),e.name==="Safari"&&e.version==="11"&&(yield h.renewMediaStreamTrack())}yield this.renegotiateWithGateway()}}else yield this.closeP2PConnection()})}updateControlMessage(){return Ee(this,null,function*(){this.audioTrack instanceof bn&&this.connectionState==="connected"&&(this.audioTrack&&(yield Kr(this,Mt.NEED_CONTROL,{type:"audio",muted:!this.audioTrack.isActive})),this.videoTrack&&(yield Kr(this,Mt.NEED_CONTROL,{type:"video",muted:this.videoTrack.muted})))})}setSimulcastVideoRtpEncodingParameters(e){return Ee(this,null,function*(){let r=this.pc.getSender("video");if(!r)throw new ue(oe.LOW_STREAM_ENCODING_ERROR,"Low stream has no video sender.");let i=r.getParameters();if(!i.encodings||!i.encodings[0])throw new ue(oe.LOW_STREAM_ENCODING_ERROR,"Low stream RtpEncodingParameters is empty.");this.videoTrack&&this.videoTrack._encoderConfig&&this.videoTrack._encoderConfig.bitrateMax&&200<this.videoTrack._encoderConfig.bitrateMax&&1<e.numSpatialLayers&&(i.encodings=[{active:!0,adaptivePtime:!1,networkPriority:"high",priority:"high",maxBitrate:1e3*(this.videoTrack._encoderConfig.bitrateMax-50)},{active:!0,adaptivePtime:!1,networkPriority:"low",priority:"low",maxBitrate:5e4,scaleResolutionDownBy:4}]),yield r.setParameters(i)})}startP2PConnection(){return new it((e,r)=>Ee(this,null,function*(){if(!this.audioTrack&&!this.videoTrack)return r(new ue(oe.UNEXPECTED_ERROR,"no track to publish"));let i=c=>{if(c==="connected"&&(this.off(Mt.CONNECTION_STATE_CHANGE,i),e()),c==="disconnected"){if(this.off(Mt.CONNECTION_STATE_CHANGE,i),this.disconnectedReason)return r(this.disconnectedReason);r(new ue(oe.OPERATION_ABORTED,"publish abort"))}};this.on(Mt.CONNECTION_STATE_CHANGE,i),this.disconnectedReason=void 0,this.connectionState="connecting",this._waitingSuccessResponse=!0,this.startTime=at();try{var o;!this.pc.audioTrack&&this.audioTrack&&(yield this.pc.addTrack(this.audioTrack._mediaStreamTrack)),!this.pc.videoTrack&&this.videoTrack&&(yield this.pc.addTrack(this.videoTrack._mediaStreamTrack)),Dt()&&Xe.SIMULCAST&&this.videoTrack&&this.videoTrack._scalabiltyMode&&(yield this.addSimulcast4Firefox(this.videoTrack._scalabiltyMode));let c=yield this.pc.createOfferSDP();Xe.REMOVE_NEW_CODECS&&(c=this.codec==="vp9"?Sa(c,["av1"]):this.codec==="av1"?Sa(c,["vp9"]):Sa(c,["vp9","av1"]));let h=hl(c);this.videoTrack&&!_r(o=h.video).call(o,this.codec.toUpperCase())&&z.warning("current codec is not supported, support list: ".concat(h.video.join(","))),this.audioTrack&&this.audioTrack._encoderConfig&&(c=Ga(c,this.audioTrack._encoderConfig)),this.videoTrack&&!Dt()&&this.videoTrack._scalabiltyMode&&(this.codec!=="vp9"&&this.codec!=="vp8"?(this.videoTrack._scalabiltyMode.numSpatialLayers=1,this.videoTrack._scalabiltyMode.numTemporalLayers=1):(1<this.videoTrack._scalabiltyMode.numSpatialLayers||1<this.videoTrack._scalabiltyMode.numTemporalLayers)&&(c=fl(c,this.codec,this.videoTrack._scalabiltyMode)),z.debug("spatial layers: ",this.videoTrack._scalabiltyMode.numSpatialLayers)),yield this.pc.setOfferSDP(c),this.audioTrack instanceof bn&&this.pc.onOfferSettled({videoActive:this.videoTrack&&!this.videoTrack.muted,audioActive:this.audioTrack&&this.audioTrack.isActive}),this.videoTrack&&this.setRtpSenderParametersByTrackConfig(this.videoTrack),z.debug("[".concat(this.connectionId,"] create and set offer success")),o={messageType:"OFFER",sdp:c,offererSessionId:104,retry:!0},Nr.supportDualStreamEncoding&&this.isLowStreamConnection&&this.lowStreamEncoding&&this.videoTrack&&(yield this.setLowStreamEncoding(this.lowStreamEncoding,this.videoTrack)),this.videoTrack&&!Dt()&&Xe.SIMULCAST&&this.videoTrack._scalabiltyMode&&this.setSimulcastVideoRtpEncodingParameters(this.videoTrack._scalabiltyMode);let C=yield Kr(this,Mt.NEED_ANSWER,o),x=this.updateAnswerSDP(C.sdp);yield this.pc.setAnswerSDP(x),z.debug("[".concat(this.connectionId,"] set answer success")),yield this.icePromise,this.connectionState="connected",this.startUploadStats()}catch(c){this.off(Mt.CONNECTION_STATE_CHANGE,i),this.connectionState="disconnected",this.reportPublishEvent(!1,c.code),z.error("[".concat(this.connectionId,"] connection error"),c.toString()),r(c)}}))}reportPublishEvent(e,r,i){var o;this._waitingSuccessResponse=!1,ke.publish(this.joinInfo.sid,{lts:this.startTime,succ:e,ec:r,audioName:this.audioTrack&&(this.audioTrack instanceof bn?this.audioTrack.getSubTrackLabels().join(","):this.audioTrack.getTrackLabel()),videoName:this.videoTrack&&this.videoTrack.getTrackLabel(),screenshare:!(!this.videoTrack||Vt(o=this.videoTrack._hints).call(o,oo.SCREEN_TRACK)===-1),audio:!!this.audioTrack,video:!!this.videoTrack,p2pid:this.pc.ID,publishRequestid:this.ID,extend:i})}closeP2PConnection(e){return Ee(this,null,function*(){let r=this.getAllTracks();var i;Re(r).call(r,o=>{this.unbindTrackEvents(o)}),this.isLowStreamConnection&&this.videoTrack&&this.videoTrack.close(),this.videoTrack=void 0,this.audioTrack instanceof bn&&(Re(i=this.audioTrack.trackList).call(i,o=>{this.audioTrack.removeAudioTrack(o)}),this.audioTrack.close()),this.audioTrack=void 0,this.stopUploadStats(),this.statsCollector.removeConnection(this.connectionId),yield this.closePC(e),this.connectionState="disconnected",this.removeAllListeners()})}getNetworkQuality(){var e,r=this.pc.getStats();if(!r.videoSend[0]&&!r.audioSend[0])return 1;var i=zr(this,Mt.NEED_SIGNAL_RTT),o=r.videoSend[0]?r.videoSend[0].rttMs:void 0;let c=r.audioSend[0]?r.audioSend[0].rttMs:void 0;return o=o&&c?(o+c)/2:o||c,i=70*r.sendPacketLossRate/50+.3*((o&&i?(o+i)/2:o||i)||0)/1500,i=.17>i?1:.36>i?2:.59>i?3:.1>i?4:5,this.videoTrack&&this.videoTrack._encoderConfig&&Vt(e=this.videoTrack._hints).call(e,oo.SCREEN_TRACK)===-1&&(e=this.videoTrack._encoderConfig.bitrateMax,r=r.bitrate.actualEncoded,e&&r)?(r=(1e3*e-r)/(1e3*e),Jp[.15>r?0:.3>r?1:.45>r?2:.6>r?3:4][i]):i}handleUpdateBitrateLimit(e){this.videoTrack&&this.videoTrack.setBitrateLimit(e)}setAudioTrackMuteState(e,r){return Ee(this,null,function*(){if(!(this.audioTrack instanceof bn))return void z.debug("[".concat(this.connectionId,"] set audio mute in unsupported environment"));let i=this.audioTrack;try{if(e){var o;i.removeAudioTrack(r),i.trackList.length===0&&(z.debug(ne(o="[".concat(this.connectionId,"] set audio encoding active, id: ")).call(o,r.getTrackId(),", state: ",!1)),yield this.pc.setAudioRtpEncodingParameters({active:!1})),this.suspendTracks.push(r)}else yield this.pc.setAudioRtpEncodingParameters({active:!0}),i.addAudioTrack(r),Fi(this.suspendTracks,r)}catch(h){var c;z.warning(ne(c="[".concat(this.connectionId,"] set audio muted error ")).call(c,h,", fallback to set enabled"))}yield Kr(this,Mt.NEED_CONTROL,{type:"audio",muted:!(!this.audioTrack||this.audioTrack.isActive)})})}setVideoTrackMuteState(e){return Ee(this,null,function*(){let r=!e,i=!1;if(Ye().name===ir.FIREFOX)i=!0;else try{var o,c;z.debug(ne(o=ne(c="[".concat(this.connectionId,"] set video encoding active, id: ")).call(c,this.videoTrack&&this.videoTrack.getTrackId(),", state: ")).call(o,r)),yield this.pc.setVideoRtpEncodingParameters({active:r})}catch(Q){var h;z.warning(ne(h="[".concat(this.connectionId,"] set video encoding active error ")).call(h,Q,", fallback to set enabled")),i=!0}var C,x;i&&this.videoTrack&&(z.debug(ne(C=ne(x="[".concat(this.connectionId,"] set video encoding active fallback to enabled on firefox, type: ")).call(x,this.videoTrack&&this.videoTrack.getTrackId(),", state: ")).call(C,r)),this.videoTrack.getMediaStreamTrack().enabled=r),this.lowStreamConnection&&this.lowStreamConnection.setVideoTrackMuteState(e),!this.isLowStreamConnection&&(yield Kr(this,Mt.NEED_CONTROL,{type:"video",muted:e}))})}uploadStats(e,r){let i=this.audioTrack?function(C,x){const Q=C.audioSend[0];return Q?(C={id:be(10,""),timestamp:new Date(C.timestamp).toISOString(),mediaType:"audio",type:"ssrc",ssrc:Q.ssrc.toString()},C.A_astd=x._originMediaStreamTrack.enabled&&x._mediaStreamTrack.enabled?"0":"1",Q.inputLevel?C.A_ail=Math.round(100*Q.inputLevel).toString():C.A_ail=Math.round(100*x._source.getAccurateVolumeLevel()).toString(),C.A_apil=Math.round(100*x._source.getAccurateVolumeLevel()).toString(),C):null}(e,this.audioTrack):void 0,o=this.videoTrack?function(C,x){const Q=C.videoSend[0];if(!Q)return null;switch(C={id:be(10,""),timestamp:new Date(C.timestamp).toISOString(),mediaType:"video",type:"ssrc",ssrc:Q.ssrc.toString()},C.A_vstd=x._originMediaStreamTrack&&!x._originMediaStreamTrack.enabled||!x._mediaStreamTrack.enabled?"1":"0",Q.sentFrame&&(C.A_fhs=Q.sentFrame.height.toString(),C.A_frs=Q.sentFrame.frameRate.toString(),C.A_fws=Q.sentFrame.width.toString()),Q.adaptionChangeReason){case"none":C.A_ac="0";break;case"cpu":C.A_ac="1";break;case"bandwidth":C.A_ac="2";break;case"other":C.A_ac="3"}return C.A_nr=Q.nacksCount.toString(),Q.avgEncodeMs&&(C.A_aem=Q.avgEncodeMs.toFixed(0).toString()),C}(e,this.videoTrack):void 0,c=po(e,r),h=function(C){const x={id:"bweforvideo",timestamp:new Date(C.timestamp).toISOString(),type:"VideoBwe"};return C.bitrate.retransmit&&(x.A_rb=C.bitrate.retransmit.toString()),C.bitrate.targetEncoded&&(x.A_teb=C.bitrate.targetEncoded.toString()),x.A_aeb=C.bitrate.actualEncoded.toString(),x.A_tb=C.bitrate.transmit.toString(),C.sendBandwidth!==void 0&&(x.A_asb=C.sendBandwidth.toString()),x}(e);i&&Fr(()=>this.emit(Mt.NEED_UPLOAD,ks.PUBLISH_STATS,i)),o&&Fr(()=>this.emit(Mt.NEED_UPLOAD,ks.PUBLISH_STATS,Al({},o,{},c))),h&&Fr(()=>this.emit(Mt.NEED_UPLOAD,ks.PUBLISH_STATS,h))}uploadSlowStats(e){let r=po(e);r&&Fr(()=>this.emit(Mt.NEED_UPLOAD,ks.PUBLISH_STATS,r))}uploadRelatedStats(e){let r=function(i){return(i=i.videoSend[0])?{mediaType:"video",isVideoMute:!1,frameRateInput:i.inputFrame&&i.inputFrame.frameRate.toString(),frameRateSent:i.sentFrame&&i.sentFrame.frameRate.toString(),googRtt:i.rttMs.toString()}:null}(e);r&&(r.isVideoMute=!(!this.videoTrack||!this.videoTrack.muted),Fr(()=>{this.emit(Mt.NEED_UPLOAD,ks.PUBLISH_RELATED_STATS,r)}))}addSimulcast4Firefox(e){return Ee(this,null,function*(){if(Dt()&&this.videoTrack&&this.videoTrack._encoderConfig&&this.videoTrack._encoderConfig.bitrateMax&&200<this.videoTrack._encoderConfig.bitrateMax&&1<e.numSpatialLayers&&this.codec==="vp8"&&(e=this.pc.getSender("video"))){let r=e.getParameters();z.debug("getParameters : ",r),r||z.error("[".concat(this.connectionId,"] get sender parameter error.")),r.encodings=[{rid:"m",active:!0,maxBitrate:5e4,scaleResolutionDownBy:4},{rid:"h",active:!0,maxBitrate:1e3*(this.videoTrack._encoderConfig.bitrateMax-50)}],yield e.setParameters(r),z.debug("setParameters : ",r)}})}bindTrackEvents(e){var r;e.addListener(Ut.NEED_RESET_REMOTE_SDP,Ti(r=this.handleResetRemoteSdp).call(r,this)),this.isLowStreamConnection||(e instanceof ji?(e.addListener(Ut.GET_STATS,this.handleGetLocalAudioStats),e.addListener(Ut.NEED_CLOSE,this.handleCloseAudioTrack),e.addListener(Ut.SET_AUDIO_TRACK_MUTED,this.handleMuteAudioTrack)):e instanceof ai&&(e.addListener(Ut.GET_STATS,this.handleGetLocalVideoStats),e.addListener(Ut.NEED_CLOSE,this.handleCloseVideoTrack),e.addListener(Ut.SET_OPTIMIZATION_MODE,this.handleSetOptimizationMode),e.addListener(Ut.SET_VIDEO_TRACK_MUTED,this.handleMuteVideoTrack)),e.addListener(Ut.NEED_RENEGOTIATE,this.handleStreamRenegotiate),e.addListener(Ut.NEED_REPLACE_TRACK,this.handleReplaceTrack),e.addListener(Ut.NEED_SESSION_ID,this.handleGetSessionID))}unbindTrackEvents(e){this.isLowStreamConnection||(e instanceof ji?(e.off(Ut.GET_STATS,this.handleGetLocalAudioStats),e.off(Ut.NEED_CLOSE,this.handleCloseAudioTrack),e.off(Ut.SET_AUDIO_TRACK_MUTED,this.handleMuteAudioTrack)):e instanceof ai&&(e.off(Ut.GET_STATS,this.handleGetLocalVideoStats),e.off(Ut.NEED_CLOSE,this.handleCloseVideoTrack),e.off(Ut.SET_OPTIMIZATION_MODE,this.handleSetOptimizationMode),e.off(Ut.SET_VIDEO_TRACK_MUTED,this.handleMuteVideoTrack)),e.off(Ut.NEED_RENEGOTIATE,this.handleStreamRenegotiate),e.off(Ut.NEED_REPLACE_TRACK,this.handleReplaceTrack),e.off(Ut.NEED_SESSION_ID,this.handleGetSessionID))}addTrackWithPC(e){return Ee(this,null,function*(){if(this.connectionState==="connecting")return new ue(oe.INVALID_OPERATION,"last publish operation has not finished").throw();let r=this.videoTrack,i=!1;return this.audioTrack&&e instanceof bn?(this.audioTrack=e,z.debug("[".concat(this.connectionId,"] replace pc audio track")),i=yield this.pc.replaceTrack(e._mediaStreamTrack)):this.videoTrack&&e instanceof ai?(this.videoTrack=e,z.debug("[".concat(this.connectionId,"] replace pc video track")),i=yield this.pc.replaceTrack(e._mediaStreamTrack)):e instanceof ji?(this.audioTrack=e,z.debug("[".concat(this.connectionId,"] add audio track to pc")),yield this.pc.addTrack(e._mediaStreamTrack),i=!0):e instanceof ai&&(this.videoTrack=e,z.debug("[".concat(this.connectionId,"] add video track to pc")),yield this.pc.addTrack(e._mediaStreamTrack),i=!0),this.connectionState==="connected"&&this.videoTrack!==r&&this.videoTrack&&(yield this.setRtpSenderParametersByTrackConfig(this.videoTrack)),this.connectionState!=="disconnected"&&i})}handleResetRemoteSdp(){return new it((e,r)=>{var i;z.info("[pc-".concat(this.pc.ID,"] start reset remote sdp"));let o=this.pc.getOfferSDP();var c=this.pc.getAnswerSDP();if(!c||!o)return e();c=c.sdp;let h;this.videoTrack&&this.videoTrack._encoderConfig&&Vt(i=this.videoTrack._hints).call(i,oo.SCREEN_TRACK)===-1&&(h=function(C,x){var Q,F;let V=x.bitrateMin;x=x.bitrateMax;let Y=Ti(Q=RegExp.prototype.test).call(Q,/^([a-z])=(.*)/);if(C=Wt(F=C.split(/(\r\n|\r|\n)/)).call(F,Y),x){let te="AS";Ye().name===ir.FIREFOX&&(x=1e3*(x>>>0),te="TIAS"),F=du(C).call(C,ce=>_r(ce).call(ce,te));var $;0<F&&(C[F]=ne($="b=".concat(te,":")).call($,x))}return V&&($=du(C).call(C,te=>_r(te).call(te,"x-google-min-bitrate")),0<$&&(C[$]=C[$].replace(/x-google-min-bitrate=(.*)/,"x-google-min-bitrate=".concat(V)))),C.join(`\r
|
|
123
|
+
`)+`\r
|
|
124
|
+
`}(c,this.videoTrack._encoderConfig)),c!==h?this.pc.setOfferSDP(o.sdp).then(()=>{if(h)return this.pc.setAnswerSDP(h)}).then(e).catch(C=>{var x;z.error(ne(x="[pc-".concat(this.pc.ID,"] reset remote sdp error, ")).call(x,C)),r(C)}):z.debug("[pc-".concat(this.pc.ID,"] remote sdp have no not changed"))})}setRtpSenderParametersByTrackConfig(e){return Ee(this,null,function*(){if(!Nr.supportSetRtpSenderParameters)return void z.debug("[".concat(this.connectionId,"] do not support set pc rtp sender, skip"));let r={},i="balanced";e._optimizationMode==="motion"?i="maintain-framerate":e._optimizationMode==="detail"&&(i="maintain-resolution"),z.debug("[".concat(this.connectionId,"] set pc rtp sender"),r,i),yield this.pc.setRtpSenderParameters(r,i)})}updateAnswerSDP(e){var r,i;return e=e.replace(/a=x-google-flag:conference\r\n/g,""),this.videoTrack&&Vt(r=this.videoTrack._hints).call(r,oo.SCREEN_TRACK),this.videoTrack&&this.videoTrack._encoderConfig&&Vt(i=this.videoTrack._hints).call(i,oo.SCREEN_TRACK)===-1&&(e=function(o,c,h){let C=Nr;var x=h.bitrateMin;h=h.bitrateMax;let Q=o.match(/m=video.*\r\n/)||o.match(/m=video.*\n/);if(Q&&0<Q.length&&C.supportMinBitrate&&x&&(c=Sg(o,c)))if(Xe.SIMULCAST){var F,V;x=h?.7*h:300,o=o.replace(Q[0],ne(F=ne(V="".concat(Q[0],"a=fmtp:")).call(V,c," x-google-start-bitrate=")).call(F,x,`\r
|
|
125
|
+
`))}else{var Y,$;o=o.replace(Q[0],ne(Y=ne($="".concat(Q[0],"a=fmtp:")).call($,c," x-google-min-bitrate=")).call(Y,x,`\r
|
|
126
|
+
`))}if(Q&&0<Q.length&&h){var te,ce;F="AS",Ye().name===ir.FIREFOX&&(h=1e3*(h>>>0),F="TIAS"),o=o.replace(Q[0],ne(te=ne(ce="".concat(Q[0],"b=")).call(ce,F,":")).call(te,h,`\r
|
|
127
|
+
`))}return o}(e,this.codec,this.videoTrack._encoderConfig)),this.audioTrack&&this.audioTrack._encoderConfig&&(e=Ga(e,this.audioTrack._encoderConfig)),e=function(o){let c=Ye();return c.name!==ir.SAFARI&&c.os!==tn.IOS?o:o.replace(/a=.*video-orientation\r\n/g,"")}(e)}createPC(){this.pc=new fg({turnServer:this.joinInfo.turnServer}),this.updateICEPromise()}closePC(e){return Ee(this,null,function*(){return this.pc.onICEConnectionStateChange=void 0,this.pc.close(),!e&&(yield Kr(this,Mt.NEED_UNPUB))})}onPCDisconnected(e){this.reportPublishEvent(!1,e.code)}setLowStreamEncoding(e,r){return Ee(this,null,function*(){try{let i=yield this.pc.setVideoRtpEncodingParameters(e),o=r.getMediaStreamTrack();if(e.scaleResolutionDownBy&&i.encodings[0].scaleResolutionDownBy!==e.scaleResolutionDownBy){let c=r._videoHeight||o.getSettings().height,h=r._videoWidth||o.getSettings().width;c&&h&&(yield o.applyConstraints({height:c/e.scaleResolutionDownBy,width:h/e.scaleResolutionDownBy}))}e.maxFramerate&&i.encodings[0].maxFramerate!==e.maxFramerate&&(yield o.applyConstraints({frameRate:e.maxFramerate}))}catch(i){throw i instanceof ue?i:new ue(oe.LOW_STREAM_ENCODING_ERROR,i.message)}})}}class Rg extends Zf{constructor(e,r,i,o){var c,h;super(e,ne(c=ne(h="track-".concat(e.kind,"-")).call(h,r,"-")).call(c,o));this._isDestroyed=!1,this._userId=r,this._uintId=i}getUserId(){return this._userId}_updateOriginMediaStreamTrack(e){this._mediaStreamTrack=this._originMediaStreamTrack=e,this._updatePlayerSource()}_destroy(){this._isDestroyed=!0,z.info("[".concat(this.getTrackId(),"] is destroyed")),this.stop(),super.close()}}class il extends Rg{constructor(e,r,i,o){super(e,r,i,o);this.trackMediaType="video",this.updateMediaStreamTrackResolution()}get isPlaying(){return!(!this._player||this._player.videoElementStatus!==nn.PLAYING)}getStats(){return Pi(()=>{z.warning("[deprecated] RemoteVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteVideoStats instead")},"remoteVideoTrackGetStatsWarning"),zr(this,Ut.GET_STATS)||Sc({},hd)}play(e,r={}){let i=ke.reportApiInvoke(null,{tag:bt.TRACER,name:Ot.REMOTE_VIDEO_TRACK_PLAY,options:[this.getTrackId(),typeof e=="string"?e:"HTMLElement",r]});if(typeof e=="string"){let c=document.getElementById(e);var o;c?e=c:(z.warning(ne(o="[".concat(this.getTrackId(),'] can not find "#')).call(o,e,'" element, use document.body')),e=document.body)}z.debug("[".concat(this.getTrackId(),"] start video playback"),ht(r)),e=Sc({fit:"cover"},r,{trackId:this.getTrackId(),element:e}),this._player?this._player.updateConfig(e):(this._player=new mg(e),this._player.updateVideoTrack(this._mediaStreamTrack),this._player.onFirstVideoFrameDecoded=()=>{this.emit(Wc.FIRST_FRAME_DECODED)}),this._player.play(),i.onSuccess()}stop(){let e=ke.reportApiInvoke(null,{tag:bt.TRACER,name:Ot.REMOTE_VIDEO_TRACK_STOP,options:[this.getTrackId()]});if(!this._player)return e.onSuccess();this._player.destroy(),this._player=void 0,z.debug("[".concat(this.getTrackId(),"] stop video playback")),e.onSuccess()}getCurrentFrameData(){return this._player?this._player.getCurrentFrame():new ImageData(2,2)}updateMediaStreamTrackResolution(){xe(this._originMediaStreamTrack).then(([e,r])=>{this._videoHeight=r,this._videoWidth=e}).catch($l)}_updatePlayerSource(){z.debug("[".concat(this.getTrackId(),"] update player source track")),this._player&&this._player.updateVideoTrack(this._mediaStreamTrack)}}class nl extends Rg{constructor(e,r,i,o){super(e,r,i,o);this.trackMediaType="audio",this._useAudioElement=!0,this._volume=100,this._source=new tA(e,!0),this._source.once(Us.RECEIVE_TRACK_BUFFER,()=>{this.emit(Wc.FIRST_FRAME_DECODED)})}get isPlaying(){return this._useAudioElement?ys.isPlaying(this.getTrackId()):this._source.isPlayed}setAudioFrameCallback(e,r=4096){if(!e)return this._source.removeAllListeners(Us.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(r),this._source.removeAllListeners(Us.ON_AUDIO_BUFFER),this._source.on(Us.ON_AUDIO_BUFFER,i=>e(i))}setVolume(e){let r=ke.reportApiInvoke(null,{tag:bt.TRACER,name:Ot.REMOTE_AUDIO_SET_VOLUME,options:[this.getTrackId(),e]},300);this._volume=e,this._useAudioElement?ys.setVolume(this.getTrackId(),e):this._source.setVolume(e/100),r.onSuccess()}setPlaybackDevice(e){return Ee(this,null,function*(){let r=ke.reportApiInvoke(null,{tag:bt.TRACER,name:Ot.REMOTE_AUDIO_SET_OUTPUT_DEVICE,options:[this.getTrackId(),e]});if(!this._useAudioElement)throw new ue(oe.NOT_SUPPORTED,"your browser does not support setting the audio output device");try{yield ys.setSinkID(this.getTrackId(),e)}catch(i){throw r.onError(i),i}r.onSuccess()})}getVolumeLevel(){return this._source.getAccurateVolumeLevel()}getStats(){return Pi(()=>{z.warning("[deprecated] RemoteAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteAudioStats instead")},"remoteAudioTrackGetStatsWarning"),zr(this,Ut.GET_STATS)||Sc({},dd)}play(){let e=ke.reportApiInvoke(null,{tag:bt.TRACER,name:Ot.REMOTE_AUDIO_TRACK_PLAY,options:[this.getTrackId()]});z.debug("[".concat(this.getTrackId(),"] start audio playback")),this._useAudioElement?(z.debug("[".concat(this.getTrackId(),"] use audio element to play")),ys.play(this._mediaStreamTrack,this.getTrackId(),this._volume)):this._source.play(),e.onSuccess()}stop(){let e=ke.reportApiInvoke(null,{tag:bt.TRACER,name:Ot.REMOTE_AUDIO_TRACK_STOP,options:[this.getTrackId()]});z.debug("[".concat(this.getTrackId(),"] stop audio playback")),this._useAudioElement?ys.stop(this.getTrackId()):this._source.stop(),e.onSuccess()}_destroy(){super._destroy(),this._source.destroy()}_isFreeze(){return this._source.isFreeze}_updatePlayerSource(){z.debug("[".concat(this.getTrackId(),"] update player source track")),this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&ys.updateTrack(this.getTrackId(),this._mediaStreamTrack)}}class Hm extends vg{constructor(e,r,i,o){super(i,e.uid);this.type="sub",this.unusedTracks=[],this.onTrack=c=>{var h,C;if(c.kind==="audio"&&!this.subscribeOptions.audio||c.kind==="video"&&!this.subscribeOptions.video)return this.unusedTracks.push(c),void z.debug(ne(C="[".concat(this.connectionId,"] unused ontrack event, kind: ")).call(C,c.kind));z.debug(ne(h="[".concat(this.connectionId,"] emit pc ontrack after subscribe ")).call(h,c.kind),c),h=c.kind==="audio"?this.user._audioTrack:this.user._videoTrack;var x,Q;h?h._updateOriginMediaStreamTrack(c):c.kind==="audio"?(this.pc._statsFilter.setIsFirstAudioDecoded(!1),this.user._audioTrack=new nl(c,this.getUserId(),this.user._uintid,this.joinInfo.clientId),z.info(ne(x="[".concat(this.connectionId,"] create remote audio track: ")).call(x,this.user._audioTrack.getTrackId())),this.bindTrackEvents(this.user._audioTrack)):(this.user._videoTrack=new il(c,this.getUserId(),this.user._uintid,this.joinInfo.clientId),z.info(ne(Q="[".concat(this.connectionId,"] create remote video track: ")).call(Q,this.user._videoTrack.getTrackId())),this.bindTrackEvents(this.user._videoTrack))},this.handleGetRemoteAudioStats=c=>{c(this.statsCollector.getRemoteAudioTrackStats(this.connectionId))},this.handleGetRemoteVideoStats=c=>{c(this.statsCollector.getRemoteVideoTrackStats(this.connectionId))},this.handleGetSessionID=c=>{c(this.joinInfo.sid)},this.user=e,this.statsCollector=r,this.statsCollector.addRemoteConnection(this),this.subscribeOptions=o}startP2PConnection(){return Ee(this,null,function*(){return new it((e,r)=>Ee(this,null,function*(){let i=x=>{if(x==="connected"&&(ke.subscribe(this.joinInfo.sid,{lts:this.startTime,succ:!0,video:this.subscribeOptions.video,audio:this.subscribeOptions.audio,peerid:this.user.uid,ec:null,subscribeRequestid:this.ID,p2pid:this.pc.ID}),this.off(Mt.CONNECTION_STATE_CHANGE,i),e()),x==="disconnected"){if(this.off(Mt.CONNECTION_STATE_CHANGE,i),this.disconnectedReason)return r(this.disconnectedReason);r(new ue(oe.OPERATION_ABORTED,"subscribe abort"))}};if(this.on(Mt.CONNECTION_STATE_CHANGE,i),this.disconnectedReason=void 0,this.connectionState="connecting",this.startTime=at(),!this.subscribeOptions)return void r(new ue(oe.UNEXPECTED_ERROR,"no subscribe options"));let o=new MediaStream,c=new it(x=>{this.pc.onTrack=(Q,F)=>{var V,Y;if(Q.kind==="audio"&&!this.subscribeOptions.audio||Q.kind==="video"&&!this.subscribeOptions.video)return this.unusedTracks.push(Q),void z.debug(ne(Y="[".concat(this.connectionId,"] unused ontrack event ")).call(Y,Q.kind));o.addTrack(Q),Y={audio:0<o.getAudioTracks().length,video:0<o.getVideoTracks().length},z.debug(ne(V="[".concat(this.connectionId,"] subscribe ontrack: ")).call(V,Q.kind),F,Q);e:{Q=this.subscribeOptions;var $,te;for(F=Hc($=vr(Y)).call($),$=Hc(te=vr(Q)).call(te),te=0;te<F.length;te+=1){if(F[te]!==$[te]){Y=!1;break e}if(Y[F[te]]!==Q[F[te]]){Y=!1;break e}}Y=!0}Y&&(this.pc.onTrack=this.onTrack,z.debug("[".concat(this.connectionId,"] get all subscribed tracks")),x(o))}});try{let x=function($){return Ye().name!==ir.FIREFOX?$:$.replace("/recvonly http://www.webrtc.org/experiments/rtp-hdrext/playout-delay"," http://www.webrtc.org/experiments/rtp-hdrext/playout-delay")}(Ic(yield this.pc.createOfferSDP()));yield this.pc.setOfferSDP(x),z.debug("[".concat(this.connectionId,"] create and set offer success"));let Q=yield Kr(this,Mt.NEED_ANSWER,{messageType:"OFFER",sdp:x,offererSessionId:104,retry:!0});yield this.pc.setAnswerSDP(Ic(Q.sdp)),z.debug("[".concat(this.connectionId,"] set answer success"));let F=yield it.all([c,this.icePromise]),V=F[0].getAudioTracks()[0],Y=F[0].getVideoTracks()[0];var h,C;V&&(this.user._audioTrack?this.user._audioTrack._updateOriginMediaStreamTrack(V):(this.user._audioTrack=new nl(V,this.getUserId(),this.user._uintid,this.joinInfo.clientId),z.info(ne(h="[".concat(this.connectionId,"] create remote audio track: ")).call(h,this.user._audioTrack.getTrackId())),this.bindTrackEvents(this.user._audioTrack))),Y&&(this.user._videoTrack?this.user._videoTrack._updateOriginMediaStreamTrack(Y):(this.user._videoTrack=new il(Y,this.getUserId(),this.user._uintid,this.joinInfo.clientId),z.info(ne(C="[".concat(this.connectionId,"] create remote video track: ")).call(C,this.user._videoTrack.getTrackId())),this.bindTrackEvents(this.user._videoTrack))),this.connectionState="connected",this.startUploadStats()}catch(x){this.off(Mt.CONNECTION_STATE_CHANGE,i),this.connectionState="disconnected",ke.subscribe(this.joinInfo.sid,{lts:this.startTime,succ:!1,video:this.subscribeOptions.video,audio:this.subscribeOptions.audio,peerid:this.user.uid,ec:x.code,subscribeRequestid:this.ID,p2pid:this.pc.ID}),r(x)}}))})}closeP2PConnection(e){return Ee(this,null,function*(){this.connectionState!=="disconnected"&&(this.stopUploadStats(),this.statsCollector.removeConnection(this.connectionId),this.connectionState="disconnected",yield this.setSubscribeOptions({audio:!1,video:!1}),yield this.closePC(e),this.removeAllListeners())})}getNetworkQuality(){var e=this.pc.getStats();if(!e.audioRecv[0]&&!e.videoRecv[0])return 1;var r=zr(this,Mt.NEED_SIGNAL_RTT),i=e.rtt;r=(i&&r?(i+r)/2:i||r)||0,i=e.audioRecv[0]?e.audioRecv[0].jitterMs:void 0,e=e.recvPacketLossRate;let o=70*e/50+.3*r/1500;return i&&(o=60*e/50+.2*r/1500+.2*i/400),.1>o?1:.17>o?2:.36>o?3:.59>o?4:5}uploadStats(e){let r=this.user.audioTrack?function(o,c){const h=o.audioRecv[0];return h?(o={id:be(10,""),timestamp:new Date(o.timestamp).toISOString(),mediaType:"audio",type:"ssrc",ssrc:h.ssrc.toString()},o.bytesReceived=h.bytes.toString(),o.packetsLost=h.packetsLost.toString(),o.packetsReceived=h.packets.toString(),h.outputLevel?o.A_aol=Math.round(100*h.outputLevel).toString():o.A_aol=Math.round(100*c._source.getAccurateVolumeLevel()).toString(),o.A_apol=Math.round(100*c._source.getAccurateVolumeLevel()).toString(),c&&(o.A_artd=c._originMediaStreamTrack.enabled&&c._mediaStreamTrack.enabled?"0":"1"),o.A_jr=h.jitterMs.toString(),o.A_jbm=Math.floor(h.jitterBufferMs).toString(),o.A_cdm=Math.floor(h.jitterBufferMs).toString(),o):null}(e,this.user.audioTrack):void 0,i=this.user.videoTrack?function(o,c){const h=o.videoRecv[0];if(!h)return null;o={id:be(10,""),timestamp:new Date(o.timestamp).toISOString(),mediaType:"video",type:"ssrc",ssrc:h.ssrc.toString()};var C;return o.bytesReceived=h.bytes.toString(),o.packetsLost=h.packetsLost.toString(),o.packetsReceived=h.packets.toString(),h.framesRateFirefox&&(o.A_frr=h.framesRateFirefox.toString()),h.receivedFrame&&(o.A_frr=h.receivedFrame.frameRate.toString()),o.A_frd=h.decodeFrameRate.toString(),h.outputFrame&&(o.A_fro=h.outputFrame.frameRate.toString()),h.jitterBufferMs!==void 0&&(o.A_jbm=Math.floor(h.jitterBufferMs).toString()),h.currentDelayMs!==void 0&&(o.A_cdm=Math.floor(h.currentDelayMs).toString()),o.A_fs=h.firsCount.toString(),o.A_ns=h.nacksCount.toString(),o.A_ps=h.plisCount.toString(),c&&(o.A_vrtd=c._originMediaStreamTrack.enabled&&c._mediaStreamTrack.enabled?"0":"1"),c._player&&0<c._player.freezeTimeCounterList.length&&(o.A_vrft=An(C=c._player.freezeTimeCounterList).call(C,0,1)[0].toString()),o}(e,this.user.videoTrack):void 0;r&&Fr(()=>this.emit(Mt.NEED_UPLOAD,ks.SUBSCRIBE_STATS,r)),i&&Fr(()=>this.emit(Mt.NEED_UPLOAD,ks.SUBSCRIBE_STATS,i))}uploadSlowStats(e){}uploadRelatedStats(e,r){let i=this.pc._statsFilter.videoIsReady===!0,o=function(h,C,x){return h=h.audioRecv[0],h?(x=lc.isRemoteAudioFreeze(x),{mediaType:"audio",isAudioMute:!1,peerId:C,googJitterReceived:h.jitterMs.toString(),isFreeze:x,bytesReceived:h.bytes.toString(),packetsReceived:h.packets.toString(),packetsLost:h.packetsLost.toString(),frameReceived:h.receivedFrames.toString(),frameDropped:h.droppedFrames.toString()}):null}(e,this.getUserId(),this.user.audioTrack),c=function(h,C,x,Q,F){return C=C.videoRecv[0],C?(h=lc.isRemoteVideoFreeze(F,C,Q?Q.videoRecv[0]:void 0)&&h,x={mediaType:"video",isVideoMute:!1,peerId:x,frameRateReceived:C.receivedFrame&&C.receivedFrame.frameRate.toString(),frameRateDecoded:C.decodedFrame&&C.decodedFrame.frameRate.toString(),isFreeze:h,bytesReceived:C.bytes.toString(),packetsReceived:C.packets.toString(),packetsLost:C.packetsLost.toString()},C.framesRateFirefox&&(x.frameRateDecoded=C.framesRateFirefox.toString(),x.frameRateReceived=C.framesRateFirefox.toString()),x):null}(i,e,this.getUserId(),r,this.user.videoTrack);o&&Fr(()=>{this.emit(Mt.NEED_UPLOAD,ks.SUBSCRIBE_RELATED_STATS,o)}),c&&Fr(()=>{this.emit(Mt.NEED_UPLOAD,ks.SUBSCRIBE_RELATED_STATS,c)})}emitOnTrackFromUnusedTracks(){if(this.subscribeOptions){var e=this.subscribeOptions.video;if(this.subscribeOptions.audio){var r;let o=rr(r=this.unusedTracks).call(r,c=>c.kind==="audio"&&c.readyState==="live");Fi(this.unusedTracks,o),o&&this.onTrack(o)}if(e){var i;e=rr(i=this.unusedTracks).call(i,o=>o.kind==="video"&&o.readyState==="live"),Fi(this.unusedTracks,e),e&&this.onTrack(e)}}}setSubscribeOptions(e){return Ee(this,null,function*(){var r,i,o,c;if(e.audio!==this.subscribeOptions.audio||e.video!==this.subscribeOptions.video){if(this.connectionState==="connecting")try{yield this.createWaitConnectionConnectedPromise()}catch(h){throw new ue(oe.OPERATION_ABORTED,"can not update subscribe options, operation abort")}e.audio===this.subscribeOptions.audio&&e.video===this.subscribeOptions.video||(z.debug(ne(r=ne(i=ne(o=ne(c="[".concat(this.connectionId,"] update subscribe options [a: ")).call(c,this.subscribeOptions.audio,", v: ")).call(o,this.subscribeOptions.video,"] -> [a: ")).call(i,e.audio,", v: ")).call(r,e.video,"]")),this.subscribeOptions=e,!e.audio&&this.user._audioTrack&&(this.unusedTracks.push(this.user._audioTrack._originMediaStreamTrack),this.user._audioTrack._destroy(),this.unbindTrackEvents(this.user._audioTrack),this.user._audioTrack=void 0),!e.video&&this.user._videoTrack&&(this.unusedTracks.push(this.user._videoTrack._originMediaStreamTrack),this.user._videoTrack._destroy(),this.unbindTrackEvents(this.user._videoTrack),this.user._videoTrack=void 0),this.emitOnTrackFromUnusedTracks())}})}createPC(){this.pc=new Ag({turnServer:this.joinInfo.turnServer}),this.pc.onFirstAudioDecoded=()=>{this.user.audioTrack&&this.user.audioTrack.emit(Wc.FIRST_FRAME_DECODED),ke.firstRemoteFrame(this.joinInfo.sid,gn.FIRST_AUDIO_DECODE,Ai.FIRST_AUDIO_DECODE,{peer:this.user._uintid,subscribeElapse:at()-this.startTime,subscribeRequestid:this.ID,p2pid:this.pc.ID})},this.pc.onFirstAudioReceived=()=>{ke.firstRemoteFrame(this.joinInfo.sid,gn.FIRST_AUDIO_RECEIVED,Ai.FIRST_AUDIO_RECEIVED,{peer:this.user._uintid,subscribeElapse:at()-this.startTime,subscribeRequestid:this.ID,p2pid:this.pc.ID})},this.pc.onFirstVideoDecoded=(e,r)=>{ke.firstRemoteFrame(this.joinInfo.sid,gn.FIRST_VIDEO_DECODE,Ai.FIRST_VIDEO_DECODE,{peer:this.user._uintid,videowidth:e,videoheight:r,subscribeElapse:at()-this.startTime,subscribeRequestid:this.ID,p2pid:this.pc.ID})},this.pc.onFirstVideoReceived=()=>{ke.firstRemoteFrame(this.joinInfo.sid,gn.FIRST_VIDEO_RECEIVED,Ai.FIRST_VIDEO_RECEIVED,{peer:this.user._uintid,subscribeElapse:at()-this.startTime,subscribeRequestid:this.ID,p2pid:this.pc.ID})},this.updateICEPromise()}closePC(e){return Ee(this,null,function*(){return this.pc.audioTrack&&this.pc.audioTrack.stop(),this.pc.videoTrack&&this.pc.videoTrack.stop(),this.pc.onTrack=void 0,this.pc.onICEConnectionStateChange=void 0,this.pc.close(),e?!1:yield Kr(this,Mt.NEED_UNSUB)})}onPCDisconnected(e){ke.subscribe(this.joinInfo.sid,{lts:this.startTime,succ:!1,video:this.subscribeOptions.video,audio:this.subscribeOptions.audio,peerid:this.user.uid,ec:e.code,subscribeRequestid:this.ID,p2pid:this.pc.ID})}bindTrackEvents(e){e instanceof nl?e.addListener(Ut.GET_STATS,this.handleGetRemoteAudioStats):e instanceof il&&e.addListener(Ut.GET_STATS,this.handleGetRemoteVideoStats)}unbindTrackEvents(e){e instanceof nl?e.off(Ut.GET_STATS,this.handleGetRemoteAudioStats):e instanceof il&&e.off(Ut.GET_STATS,this.handleGetRemoteVideoStats)}}class Km extends mn{constructor(e,r,i,o){super();this.reconnectMode="retry",this.commandReqId=this.reqId=0,this.handleWebSocketOpen=()=>{this.reconnectMode="retry",this.startPingPong()},this.handleWebSocketMessage=c=>{if(c.data){c=JSON.parse(c.data);var h;c.requestId?this.emit(ne(h="@".concat(c.requestId,"-")).call(h,c.sid),c):this.serviceMode===mi.INJECT?this.emit(Fs.INJECT_STREAM_STATUS,c):(ke.workerEvent(this.spec.sid,{actionType:"status",serverCode:c.code,workerType:this.serviceMode===mi.TRANSCODE?1:2}),this.emit(Fs.PUBLISH_STREAM_STATUS,c))}},this.spec=r,this.token=e,this.serviceMode=o,this.websocket=new Od("live-streaming",i),this.websocket.on(gr.CONNECTED,this.handleWebSocketOpen),this.websocket.on(gr.ON_MESSAGE,this.handleWebSocketMessage),this.websocket.on(gr.REQUEST_NEW_URLS,(c,h)=>{Kr(this,Fs.REQUEST_NEW_ADDRESS).then(c).catch(h)}),this.websocket.on(gr.RECONNECTING,()=>{this.websocket.reconnectMode=this.reconnectMode})}init(e){return this.websocket.init(e)}request(e,r,i,o){return Ee(this,null,function*(){this.reqId+=1,e==="request"&&(this.commandReqId+=1);let c=this.commandReqId,h=this.reqId;if(!h||!this.websocket)throw new ue(oe.UNEXPECTED_ERROR);var C=Ha({command:e,sdkVersion:rs==="4.7.3"?"0.0.1":rs,seq:h,requestId:h,allocate:i,cname:this.spec.cname,appId:this.spec.appId,sid:this.spec.sid,uid:this.spec.uid.toString(),ts:Math.floor(at()/1e3)},r);if(this.websocket.state==="closed")throw new ue(oe.WS_DISCONNECT);let x=()=>new it((V,Y)=>{this.websocket.once(gr.CLOSED,()=>Y(new ue(oe.WS_ABORT))),this.websocket.once(gr.CONNECTED,V)});this.websocket.state!=="connected"&&(yield x()),C.clientRequest&&(C.clientRequest.workerToken=this.token);let Q=new it((V,Y)=>{var $;const te=()=>{Y(new ue(oe.WS_ABORT))};this.websocket.once(gr.RECONNECTING,te),this.websocket.once(gr.CLOSED,te),this.once(ne($="@".concat(h,"-")).call($,this.spec.sid),ce=>{V(ce)})});o&&ke.workerEvent(this.spec.sid,Ha({},o,{requestId:c,actionType:"request",payload:ht(r.clientRequest),serverCode:0,code:0}));let F=at();this.websocket.sendMessage(C),C=null;try{C=yield Q}catch(V){if(this.websocket.state==="closed")throw V;return yield x(),yield this.request(e,r,i)}return o&&ke.workerEvent(this.spec.sid,Ha({},o,{requestId:c,actionType:"response",payload:ht(C.serverResponse),serverCode:C.code,success:C.code===200,responseTime:at()-F})),C.code!==200&&this.handleResponseError(C),C})}tryNextAddress(){this.reconnectMode="tryNext",this.websocket.reconnect("tryNext")}close(){let e=rs==="4.7.3"?"0.0.1":rs;this.reqId+=1,this.websocket.state==="connected"?(this.websocket.sendMessage({command:"request",appId:this.spec.appId,cname:this.spec.cname,uid:this.spec.uid.toString(),sdkVersion:e,sid:this.spec.sid,seq:this.reqId,ts:Math.floor(at()/1e3),requestId:this.reqId,clientRequest:{command:"DestroyWorker"}}),this.websocket.close(!1,!0)):this.websocket.close(!1),this.pingpongTimer&&(window.clearInterval(this.pingpongTimer),this.pingpongTimer=void 0)}handleResponseError(e){switch(e.code){case Yr.LIVE_STREAM_RESPONSE_ALREADY_EXISTS_STREAM:return void z.warning("live stream response already exists stream");case Yr.LIVE_STREAM_RESPONSE_TRANSCODING_PARAMETER_ERROR:case Yr.LIVE_STREAM_RESPONSE_BAD_STREAM:case Yr.LIVE_STREAM_RESPONSE_WM_PARAMETER_ERROR:return new ue(oe.LIVE_STREAMING_INVALID_ARGUMENT,"",{code:e.code}).throw();case Yr.LIVE_STREAM_RESPONSE_WM_WORKER_NOT_EXIST:if(e.serverResponse.command==="UnpublishStream"||e.serverResponse.command==="UninjectStream")break;throw new ue(oe.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"live stream response wm worker not exist",{retry:!0});case Yr.LIVE_STREAM_RESPONSE_NOT_AUTHORIZED:return new ue(oe.LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED,"",{code:e.code}).throw();case Yr.LIVE_STREAM_RESPONSE_FAILED_LOAD_IMAGE:var r=new ue(oe.LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE);return this.emit(Fs.WARNING,r,e.serverResponse.url);case Yr.LIVE_STREAM_RESPONSE_REQUEST_TOO_OFTEN:return r=new ue(oe.LIVE_STREAMING_WARN_FREQUENT_REQUEST),this.emit(Fs.WARNING,r,e.serverResponse.url);case Yr.LIVE_STREAM_RESPONSE_NOT_FOUND_PUBLISH:throw new ue(oe.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"live stream response wm worker not exist",{retry:!0});case Yr.LIVE_STREAM_RESPONSE_NOT_SUPPORTED:return new ue(oe.LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED,"",{code:e.code}).throw();case Yr.LIVE_STREAM_RESPONSE_MAX_STREAM_NUM:return r=new ue(oe.LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT),this.emit(Fs.WARNING,r,e.serverResponse.url);case Yr.LIVE_STREAM_RESPONSE_INTERNAL_SERVER_ERROR:return new ue(oe.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"",{code:e.code}).throw();case Yr.LIVE_STREAM_RESPONSE_RESOURCE_LIMIT:throw new ue(oe.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"live stream resource limit",{retry:!0,changeAddress:!0});case Yr.LIVE_STREAM_RESPONSE_WORKER_LOST:case Yr.LIVE_STREAM_RESPONSE_WORKER_QUIT:if(e.serverResponse.command==="UnpublishStream"||e.serverResponse.command==="UninjectStream")break;throw new ue(oe.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"error fail send message",{retry:!0,changeAddress:!0});case Yr.ERROR_FAIL_SEND_MESSAGE:if(e.serverResponse.command==="UnpublishStream"||e.serverResponse.command==="UninjectStream")break;if(e.serverResponse.command==="UpdateTranscoding"||e.serverResponse.command==="ControlStream")return new ue(oe.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"error fail send message",{code:e.code}).throw();throw new ue(oe.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"error fail send message",{retry:!0,changeAddress:!0});case Yr.PUBLISH_STREAM_STATUS_ERROR_PUBLISH_BROKEN:case Yr.PUBLISH_STREAM_STATUS_ERROR_RTMP_CONNECT:case Yr.PUBLISH_STREAM_STATUS_ERROR_RTMP_HANDSHAKE:case Yr.PUBLISH_STREAM_STATUS_ERROR_RTMP_PUBLISH:return new ue(oe.LIVE_STREAMING_CDN_ERROR,"",{code:e.code}).throw()}}startPingPong(){this.pingpongTimer&&window.clearInterval(this.pingpongTimer),this.pingpongTimer=window.setInterval(()=>{this.websocket.state==="connected"&&this.request("ping",{}).catch($l)},6e3)}}class Wm extends mn{constructor(e,r=Ki,i=Ki){super();this.retryTimeout=1e4,this.streamingTasks=new Tr,this.isStartingStreamingTask=!1,this.taskMutex=new ta("live-streaming"),this.cancelToken=So.CancelToken.source(),this.injectConfig=Zs({},uv),this.injectLoopTimes=0,this.lastTaskId=1,this.statusError=new Tr,this.spec=e,this.httpRetryConfig=i,this.wsRetryConfig=r}setTranscodingConfig(e){return Ee(this,null,function*(){var r;let i=Zs({},lv,{},e);var o,c;i.videoCodecProfile!==66&&i.videoCodecProfile!==77&&i.videoCodecProfile!==100&&(z.debug(ne(o="[".concat(this.spec.clientId,"] set transcoding config, fix video codec profile: ")).call(o,i.videoCodecProfile," -> 100")),i.videoCodecProfile=100),i.transcodingUsers||(i.transcodingUsers=i.userConfigs),i.transcodingUsers&&(i.transcodingUsers=_t(c=i.transcodingUsers).call(c,Y=>Zs({},cv,{},Y,{zOrder:Y.zOrder?Y.zOrder+1:1}))),function(Y){var $,te;Y.width==null||Xt(Y.width,"config.width",0,1e4),Y.height==null||Xt(Y.height,"config.height",0,1e4),Y.videoBitrate==null||Xt(Y.videoBitrate,"config.videoBitrate",1,1e6),Y.videoFrameRate==null||Xt(Y.videoFrameRate,"config.videoFrameRate"),Y.lowLatency==null||cs(Y.lowLatency,"config.lowLatency"),Y.audioSampleRate==null||ui(Y.audioSampleRate,"config.audioSampleRate",[32e3,44100,48e3]),Y.audioBitrate==null||Xt(Y.audioBitrate,"config.audioBitrate",1,128),Y.audioChannels==null||ui(Y.audioChannels,"config.audioChannels",[1,2,3,4,5]),Y.videoGop==null||Xt(Y.videoGop,"config.videoGop"),Y.videoCodecProfile==null||ui(Y.videoCodecProfile,"config.videoCodecProfile",[66,77,100]),Y.userCount==null||Xt(Y.userCount,"config.userCount",0,17),Y.backgroundColor==null||Xt(Y.backgroundColor,"config.backgroundColor",0,16777215),Y.userConfigExtraInfo==null||Ur(Y.userConfigExtraInfo,"config.userConfigExtraInfo",0,4096,!1),Y.transcodingUsers&&Y.transcodingUsers!=null&&(Rs(Y.transcodingUsers,"config.transcodingUsers"),Re($=Y.transcodingUsers).call($,(ce,Ae)=>{ho(ce.uid),ce.x==null||Xt(ce.x,"transcodingUser[".concat(Ae,"].x"),0,1e4),ce.y==null||Xt(ce.y,"transcodingUser[".concat(Ae,"].y"),0,1e4),ce.width==null||Xt(ce.width,"transcodingUser[".concat(Ae,"].width"),0,1e4),ce.height==null||Xt(ce.height,"transcodingUser[".concat(Ae,"].height"),0,1e4),ce.zOrder==null||Xt(ce.zOrder-1,"transcodingUser[".concat(Ae,"].zOrder"),0,100),ce.alpha==null||Xt(ce.alpha,"transcodingUser[".concat(Ae,"].alpha"),0,1,!1)})),Y.watermark==null||Bo(Y.watermark,"watermark"),Y.backgroundImage==null||Bo(Y.backgroundImage,"backgroundImage"),Y.images&&Y.images!=null&&(Rs(Y.images,"config.images"),Re(te=Y.images).call(te,(ce,Ae)=>{Bo(ce,"images[".concat(Ae,"]"))}))}(i),e=[];var h,C;if(i.images&&e.push(..._t(h=i.images).call(h,Y=>Zs({},fd,{},Y,{zOrder:255}))),i.backgroundImage&&(e.push(Zs({},fd,{},i.backgroundImage,{zOrder:0})),delete i.backgroundImage),i.watermark&&(e.push(Zs({},fd,{},i.watermark,{zOrder:255})),delete i.watermark),i.images=e,i.transcodingUsers&&(i.userConfigs=_t(C=i.transcodingUsers).call(C,Y=>Zs({},Y)),i.userCount=i.transcodingUsers.length,delete i.transcodingUsers),h=_t(r=i.userConfigs||[]).call(r,Y=>typeof Y.uid=="number"?it.resolve(Y.uid):Xi(Y.uid,this.spec,this.cancelToken.token,this.httpRetryConfig)),r=yield it.all(h),Re(r).call(r,(Y,$)=>{i.userConfigs&&i.userConfigs[$]&&(i.userConfigs[$].uid=Y)}),this.transcodingConfig=i,this.connection)try{var x,Q,F;let Y=yield this.connection.request("request",{clientRequest:{command:"UpdateTranscoding",transcodingConfig:this.transcodingConfig}},!1,{command:"UpdateTranscoding",workerType:1,requestByUser:!0,tid:_t(x=co(Na(Q=this.streamingTasks).call(Q))).call(x,$=>$.taskId).join("#")});z.debug(ne(F="[".concat(this.spec.clientId,"] update live transcoding config success, code: ")).call(F,Y.code,", config:"),ht(this.transcodingConfig))}catch(Y){var V;if(!Y.data||!Y.data.retry)throw Y;Y.data.changeAddress&&this.connection.tryNextAddress(),Re(V=this.streamingTasks).call(V,$=>{z.warning("[".concat(this.spec.clientId,"] live streaming receive error"),Y.toString(),"try to republish",$.url),this.startLiveStreamingTask($.url,$.mode,Y).then(()=>{var te;z.debug(ne(te="[".concat(this.spec.clientId,"] live streaming republish ")).call(te,$.url," success"))}).catch(te=>{z.error("[".concat(this.spec.clientId,"] live streaming republish failed"),$.url,te.toString()),this.onLiveStreamError&&this.onLiveStreamError($.url,te)})})}})}setInjectStreamConfig(e,r){this.injectConfig=Dn({},this.injectConfig,e),this.injectLoopTimes=r}startLiveStreamingTask(e,r,i){return Ee(this,null,function*(){var o,c,h,C;if(rr(o=co(Na(c=this.streamingTasks).call(c))).call(o,Q=>Q.mode===mi.INJECT)&&r===mi.INJECT)return new ue(oe.LIVE_STREAMING_TASK_CONFLICT,"inject stream over limit").throw();if(!this.transcodingConfig&&r===mi.TRANSCODE)throw new ue(oe.INVALID_OPERATION,"[LiveStreaming] no transcoding config found, can not start transcoding streaming task");if(o={command:"PublishStream",ts:at(),url:e,uid:this.spec.uid.toString(),autoDestroyTime:100,acceptImageTimeout:!0},z.debug(ne(h=ne(C="[".concat(this.spec.clientId,"] start live streaming ")).call(C,e,", mode: ")).call(h,r)),h=yield this.taskMutex.lock(),!this.connection&&i)return void h();if(this.streamingTasks.get(e)&&!i)return h(),new ue(oe.LIVE_STREAMING_TASK_CONFLICT).throw();try{this.connection||(this.connection=yield this.connect(r))}catch(Q){throw h(),Q}switch(r){case mi.TRANSCODE:o.transcodingConfig=Zs({},this.transcodingConfig);break;case mi.INJECT:o={cname:this.spec.cname,command:"InjectStream",sid:this.spec.sid,transcodingConfig:this.injectConfig,ts:at(),url:e,loopTimes:this.injectLoopTimes}}this.uapResponse&&this.uapResponse.vid&&(o.vid=this.uapResponse.vid),this.isStartingStreamingTask=!0,C=this.lastTaskId++;try{var x;let Q=new it((V,Y)=>{zi(this.retryTimeout).then(()=>{if(i)return Y(i);const $=this.statusError.get(e);return $?(this.statusError.delete(e),Y($)):void 0})}),F=yield it.race([this.connection.request("request",{clientRequest:o},!0,{url:e,command:"PublishStream",workerType:r===mi.TRANSCODE?1:2,requestByUser:!i,tid:C.toString()}),Q]);this.isStartingStreamingTask=!1,z.debug(ne(x="[".concat(this.spec.clientId,"] live streaming started, code: ")).call(x,F.code)),this.streamingTasks.set(e,{clientRequest:o,mode:r,url:e,taskId:C}),h()}catch(Q){if(h(),this.isStartingStreamingTask=!1,!Q.data||!Q.data.retry||i)throw Q;return Q.data.changeAddress?(this.connection.tryNextAddress(),yield this.startLiveStreamingTask(e,r,Q)):yield this.startLiveStreamingTask(e,r,Q)}})}stopLiveStreamingTask(e){return new it((r,i)=>{let o=this.streamingTasks.get(e);if(!o||!this.connection)return new ue(oe.UNEXPECTED_ERROR,"can not find streaming task to stop").throw();let c=o.mode;o.abortTask=()=>{z.debug("[".concat(this.spec.clientId,"] stop live streaming success(worker exception)")),this.streamingTasks.delete(e),r()},this.connection.request("request",{clientRequest:{command:c===mi.INJECT?"UninjectStream":"UnpublishStream",url:o.url}},!1,{url:e,command:"UnPublishStream",workerType:c===mi.TRANSCODE?1:2,requestByUser:!0,tid:(this.lastTaskId++).toString()}).then(h=>{var C;z.debug(ne(C="[".concat(this.spec.clientId,"] stop live streaming success, code: ")).call(C,h.code)),this.streamingTasks.delete(e),this.streamingTasks.size===0&&c!==mi.INJECT&&(this.connection&&this.connection.close(),this.connection=void 0),r(),c===mi.INJECT&&this.onInjectStatusChange&&this.onInjectStatusChange(5,this.spec.uid,e)}).catch(i)})}controlInjectStream(e,r,i,o){return Ee(this,null,function*(){let c=this.streamingTasks.get(e);if(!c||!this.connection||c.mode!==mi.INJECT)throw new ue(oe.INVALID_OPERATION,"can not find inject stream task to control");return(yield this.connection.request("request",{clientRequest:{command:"ControlStream",url:e,control:r,audioVolume:i,position:o}})).serverResponse})}resetAllTask(){var e;let r=co(Na(e=this.streamingTasks).call(e));this.terminate();for(let i of r)this.startLiveStreamingTask(i.url,i.mode).catch(o=>{this.onLiveStreamError&&this.onLiveStreamError(i.url,o)})}terminate(){this.cancelToken&&this.cancelToken.cancel(),this.streamingTasks=new Tr,this.isStartingStreamingTask=!1,this.statusError=new Tr,this.cancelToken=So.CancelToken.source(),this.uapResponse=void 0,this.connection&&this.connection.close(),this.connection=void 0}connect(e){return Ee(this,null,function*(){if(this.connection)throw new ue(oe.UNEXPECTED_ERROR,"live streaming connection has already connected");let r=yield Kr(this,oc.REQUEST_WORKER_MANAGER_LIST,e);return this.uapResponse=r,this.connection=new Km(r.workerToken,this.spec,this.wsRetryConfig,e),this.connection.on(Fs.WARNING,(i,o)=>this.onLiveStreamWarning&&this.onLiveStreamWarning(o,i)),this.connection.on(Fs.PUBLISH_STREAM_STATUS,i=>this.handlePublishStreamServer(i)),this.connection.on(Fs.INJECT_STREAM_STATUS,i=>this.handleInjectStreamServerStatus(i)),this.connection.on(Fs.REQUEST_NEW_ADDRESS,(i,o)=>{if(!this.connection)return o(new ue(oe.UNEXPECTED_ERROR,"can not get new live streaming address list"));Kr(this,oc.REQUEST_WORKER_MANAGER_LIST,e).then(c=>{this.uapResponse=c,i(c.addressList)}).catch(o)}),yield this.connection.init(r.addressList),this.connection})}handlePublishStreamServer(e){var r=e.serverStatus&&e.serverStatus.url||"empty_url";let i=this.streamingTasks.get(r),o=e.reason;switch(e.code){case Yr.PUBLISH_STREAM_STATUS_ERROR_PUBLISH_BROKEN:case Yr.PUBLISH_STREAM_STATUS_ERROR_RTMP_CONNECT:case Yr.PUBLISH_STREAM_STATUS_ERROR_RTMP_HANDSHAKE:case Yr.PUBLISH_STREAM_STATUS_ERROR_RTMP_PUBLISH:if(e=new ue(oe.LIVE_STREAMING_CDN_ERROR,"",{code:e.code}),i)return z.error(e.toString()),this.onLiveStreamError&&this.onLiveStreamError(r,e);if(!this.isStartingStreamingTask)break;this.statusError.set(r,e);case Yr.LIVE_STREAM_RESPONSE_FAILED_LOAD_IMAGE:return e=new ue(oe.LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE,o),this.onLiveStreamWarning&&this.onLiveStreamWarning(r,e);case Yr.LIVE_STREAM_RESPONSE_WORKER_LOST:case Yr.LIVE_STREAM_RESPONSE_WORKER_QUIT:var c;if(this.connection){this.connection.tryNextAddress(),r=co(Na(c=this.streamingTasks).call(c));for(let h of r)h.abortTask?h.abortTask():(z.warning("[".concat(this.spec.clientId,"] publish stream status code"),e.code,"try to republish",h.url),this.startLiveStreamingTask(h.url,h.mode,new ue(oe.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"",{code:e.code})).then(()=>{z.debug("[".concat(this.spec.clientId,"] republish live stream success"),h.url)}).catch(C=>{z.error(C.toString()),this.onLiveStreamError&&this.onLiveStreamError(h.url,C)}))}}}handleInjectStreamServerStatus(e){let r=Number(e.uid),i=e.serverStatus&&e.serverStatus.url;switch(e.code){case 200:return void(this.onInjectStatusChange&&this.onInjectStatusChange(0,r,i));case 451:return this.onInjectStatusChange&&this.onInjectStatusChange(1,r,i),void this.streamingTasks.delete(i);case 453:return this.onInjectStatusChange&&this.onInjectStatusChange(2,r,i),void this.streamingTasks.delete(i);case 470:return this.onInjectStatusChange&&this.onInjectStatusChange(10,r,i),void this.streamingTasks.delete(i);case 499:return this.onInjectStatusChange&&this.onInjectStatusChange(3,r,i),void this.streamingTasks.delete(i);default:return void z.debug("inject stream server status",e)}}hasUrl(e){return this.streamingTasks.has(e)}}class wg{constructor(){this.destChannelMediaInfos=new Tr}setSrcChannelInfo(e){No(e),this.srcChannelMediaInfo=e}addDestChannelInfo(e){No(e),this.destChannelMediaInfos.set(e.channelName,e)}removeDestChannelInfo(e){Xn(e),this.destChannelMediaInfos.delete(e)}getSrcChannelMediaInfo(){return this.srcChannelMediaInfo}getDestChannelMediaInfo(){return this.destChannelMediaInfos}}class jm extends mn{constructor(e,r,i){super();this.requestId=1,this.onOpen=()=>{this.emit("open"),this.startHeartBeatCheck()},this.onClose=o=>{this.emit("close"),this.dispose()},this.onMessage=o=>{if(o=JSON.parse(o.data),!o||o.command!=="serverResponse"||!o.requestId)return o&&o.command==="serverStatus"&&o.serverStatus&&o.serverStatus.command?(this.emit("status",o.serverStatus),void this.emit(o.serverStatus.command,o.serverStatus)):void 0;this.emit("req_".concat(o.requestId),o)},this.joinInfo=e,this.clientId=r,this.ws=new Od("cross-channel-".concat(this.clientId),i),this.ws.on(gr.RECONNECTING,()=>{this.ws.reconnectMode="retry",this.emit("reconnecting")}),this.ws.on(gr.CONNECTED,this.onOpen),this.ws.on(gr.ON_MESSAGE,this.onMessage),this.ws.on(gr.CLOSED,this.onClose)}isConnect(){return this.ws.state==="connected"}sendMessage(e){let r=this.requestId++;return e.requestId=r,e.seq=r,this.ws.sendMessage(e),r}waitStatus(e){return new it((r,i)=>{let o=window.setTimeout(()=>{i(new ue(oe.TIMEOUT,"wait status timeout, status: ".concat(e)))},5e3);this.once(e,c=>{window.clearTimeout(o),c.state&&c.state!==0?i(new ue(oe.CROSS_CHANNEL_WAIT_STATUS_ERROR,"wait status error, status: ".concat(e))):r(void 0)}),this.once("dispose",()=>{window.clearTimeout(o),i(new ue(oe.WS_ABORT))})})}request(e){return Ee(this,null,function*(){if(this.ws.state==="closed")throw new ue(oe.WS_DISCONNECT);let r=()=>new it((o,c)=>{this.ws.once(gr.CLOSED,()=>c(new ue(oe.WS_ABORT))),this.ws.once(gr.CONNECTED,o)});this.ws.state!=="connected"&&(yield r());let i=this.sendMessage(e);if(e=yield new it((o,c)=>{const h=()=>{c(new ue(oe.WS_ABORT))};this.ws.once(gr.RECONNECTING,h),this.ws.once(gr.CLOSED,h),this.once("req_".concat(i),o),zi(3e3).then(()=>{this.removeAllListeners("req_".concat(i)),this.ws.off(gr.RECONNECTING,h),this.ws.off(gr.CLOSED,h),c(new ue(oe.TIMEOUT,"cross channel ws request timeout"))})}),!e||e.code!==200)throw new ue(oe.CROSS_CHANNEL_SERVER_ERROR_RESPONSE,"response: ".concat(ht(e)));return e})}connect(e){return Ee(this,null,function*(){this.ws.removeAllListeners(gr.REQUEST_NEW_URLS),this.ws.on(gr.REQUEST_NEW_URLS,r=>{r(e)}),yield this.ws.init(e)})}dispose(){this.clearHeartBeatCheck(),this.emit("dispose"),this.removeAllListeners(),this.ws.close()}sendPing(e){let r=this.requestId++;return e.requestId=r,this.ws.sendMessage(e),r}startHeartBeatCheck(){this.heartBeatTimer=window.setInterval(()=>{this.sendPing({command:"ping",appId:this.joinInfo.appId,cname:this.joinInfo.cname,uid:this.joinInfo.uid.toString(),sid:this.joinInfo.sid,ts:+new Date,requestId:0})},3e3)}clearHeartBeatCheck(){window.clearInterval(this.heartBeatTimer),this.heartBeatTimer=void 0}}class Vm extends mn{constructor(e,r,i,o){super();this.cancelToken=So.CancelToken.source(),this.requestId=0,this._state="RELAY_STATE_IDLE",this.errorCode="RELAY_OK",this.onStatus=c=>{var h;z.debug(ne(h="[".concat(this.clientId,"] ChannelMediaStatus: ")).call(h,ht(c))),c&&c.command&&(c.command==="onAudioPacketReceived"&&this.emit("event","PACKET_RECEIVED_AUDIO_FROM_SRC"),c.command==="onVideoPacketReceived"&&this.emit("event","PACKET_RECEIVED_VIDEO_FROM_SRC"),c.command==="onSrcTokenPrivilegeDidExpire"&&(this.errorCode="SRC_TOKEN_EXPIRED",this.state="RELAY_STATE_FAILURE"),c.command==="onDestTokenPrivilegeDidExpire"&&(this.errorCode="DEST_TOKEN_EXPIRED",this.state="RELAY_STATE_FAILURE"))},this.onReconnect=()=>Ee(this,null,function*(){z.debug("[".concat(this.clientId,"] ChannelMediaSocket disconnect, reconnecting")),this.emit("event","NETWORK_DISCONNECTED"),this.state="RELAY_STATE_IDLE",this.prevChannelMediaConfig&&this.sendStartRelayMessage(this.prevChannelMediaConfig).catch(c=>{this.state!=="RELAY_STATE_IDLE"&&(z.error("auto restart channel media relay failed",c.toString()),this.errorCode="SERVER_CONNECTION_LOST",this.state="RELAY_STATE_FAILURE")})}),this.joinInfo=e,this.clientId=r,this.signal=new jm(this.joinInfo,this.clientId,i),this.httpRetryConfig=o}set state(e){e!==this._state&&(e!=="RELAY_STATE_FAILURE"&&(this.errorCode="RELAY_OK"),this.emit("state",e,this.errorCode),this._state=e)}get state(){return this._state}startChannelMediaRelay(e){return Ee(this,null,function*(){if(this.state!=="RELAY_STATE_IDLE")throw new ue(oe.INVALID_OPERATION);this.state="RELAY_STATE_CONNECTING",yield this.connect(),z.debug("[".concat(this.clientId,"] startChannelMediaRelay: connect success"));try{yield this.sendStartRelayMessage(e)}catch(r){throw r.data&&r.data.serverResponse&&r.data.serverResponse.command==="SetSourceChannel"?new ue(oe.CROSS_CHANNEL_FAILED_JOIN_SRC):r.data&&r.data.serverResponse&&r.serverResponse.command==="SetDestChannelStatus"?new ue(oe.CROSS_CHANNEL_FAILED_JOIN_DEST):r.data&&r.data.serverResponse&&r.serverResponse.command==="StartPacketTransfer"?new ue(oe.CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST):r}this.prevChannelMediaConfig=e})}updateChannelMediaRelay(e){return Ee(this,null,function*(){if(this.state!=="RELAY_STATE_RUNNING")throw new ue(oe.INVALID_OPERATION);yield this.sendUpdateMessage(e),this.prevChannelMediaConfig=e})}stopChannelMediaRelay(){return Ee(this,null,function*(){yield this.sendStopRelayMessage(),z.debug("[".concat(this.clientId,"] stopChannelMediaRelay: send stop message success")),this.state="RELAY_STATE_IDLE",this.dispose()})}dispose(){z.debug("[".concat(this.clientId,"] disposeChannelMediaRelay")),this.cancelToken.cancel(),this.cancelToken=So.CancelToken.source(),this.state="RELAY_STATE_IDLE",this.emit("dispose"),this.signal.dispose(),this.prevChannelMediaConfig=void 0}connect(){return Ee(this,null,function*(){let e=yield Bn(this.joinInfo,this.cancelToken.token,this.httpRetryConfig);this.workerToken=e.workerToken,yield this.signal.connect(e.addressList),this.emit("event","NETWORK_CONNECTED"),this.signal.on("status",this.onStatus),this.signal.on("reconnecting",this.onReconnect)})}sendStartRelayMessage(e){return Ee(this,null,function*(){var r=this.genMessage(vn.StopPacketTransfer);yield this.signal.request(r),yield this.signal.waitStatus("Normal Quit"),z.debug("[".concat(this.clientId,"] startChannelMediaRelay: StopPacketTransfer success")),r=this.genMessage(vn.SetSdkProfile,e),yield this.signal.request(r),z.debug("[".concat(this.clientId,"] startChannelMediaRelay: SetSdkProfile success")),r=this.genMessage(vn.SetSourceChannel,e),yield this.signal.request(r),yield this.signal.waitStatus("SetSourceChannelStatus"),this.emit("event","PACKET_JOINED_SRC_CHANNEL"),z.debug("[".concat(this.clientId,"] startChannelMediaRelay: SetSourceChannel success")),r=this.genMessage(vn.SetSourceUserId,e),yield this.signal.request(r),z.debug("[".concat(this.clientId,"] startChannelMediaRelay: SetSourceUserId success")),r=this.genMessage(vn.SetDestChannel,e),yield this.signal.request(r),yield this.signal.waitStatus("SetDestChannelStatus"),this.emit("event","PACKET_JOINED_DEST_CHANNEL"),z.debug("[".concat(this.clientId,"] startChannelMediaRelay: SetDestChannel success")),e=this.genMessage(vn.StartPacketTransfer,e),yield this.signal.request(e),this.emit("event","PACKET_SENT_TO_DEST_CHANNEL"),this.state="RELAY_STATE_RUNNING",z.debug("[".concat(this.clientId,"] startChannelMediaRelay: StartPacketTransfer success"))})}sendUpdateMessage(e){return Ee(this,null,function*(){e=this.genMessage(vn.UpdateDestChannel,e),yield this.signal.request(e),this.emit("event","PACKET_UPDATE_DEST_CHANNEL"),z.debug("[".concat(this.clientId,"] sendUpdateMessage: UpdateDestChannel success"))})}sendStopRelayMessage(){return Ee(this,null,function*(){let e=this.genMessage(vn.StopPacketTransfer);yield this.signal.request(e),z.debug("[".concat(this.clientId,"] sendStopRelayMessage: StopPacketTransfer success"))})}genMessage(e,r){let i=[],o=[],c=[];this.requestId+=1;let h={appId:this.joinInfo.appId,cname:this.joinInfo.cname,uid:this.joinInfo.uid.toString(),sdkVersion:rs,sid:this.joinInfo.sid,ts:at(),requestId:this.requestId,seq:this.requestId,allocate:!0,clientRequest:{}};h.sdkVersion==="4.7.3"&&(h.sdkVersion="0.0.1");let C=null,x=null;switch(e){case vn.SetSdkProfile:return h.clientRequest={command:"SetSdkProfile",type:"multi_channel"},h;case vn.SetSourceChannel:if(x=r&&r.getSrcChannelMediaInfo(),!x)throw new ue(oe.UNEXPECTED_ERROR,"can not find source config");return h.clientRequest={command:"SetSourceChannel",uid:"0",channelName:x.channelName,token:x.token||this.joinInfo.appId},h;case vn.SetSourceUserId:if(x=r&&r.getSrcChannelMediaInfo(),!x)throw new ue(oe.UNEXPECTED_ERROR,"can not find source config");return h.clientRequest={command:"SetSourceUserId",uid:x.uid+""},h;case vn.SetDestChannel:if(C=r&&r.getDestChannelMediaInfo(),!C)throw new ue(oe.UNEXPECTED_ERROR,"can not find dest config");return Re(C).call(C,Q=>{i.push(Q.channelName),o.push(Q.uid+""),c.push(Q.token||this.joinInfo.appId)}),h.clientRequest={command:"SetDestChannel",channelName:i,uid:o,token:c},h;case vn.StartPacketTransfer:return h.clientRequest={command:"StartPacketTransfer"},h;case vn.Reconnect:return h.clientRequest={command:"Reconnect"},h;case vn.StopPacketTransfer:return h.clientRequest={command:"StopPacketTransfer"},h;case vn.UpdateDestChannel:if(C=r&&r.getDestChannelMediaInfo(),!C)throw new ue(oe.UNEXPECTED_ERROR,"can not find dest config");return Re(C).call(C,Q=>{i.push(Q.channelName),o.push(Q.uid+""),c.push(Q.token||this.joinInfo.appId)}),h.clientRequest={command:"UpdateDestChannel",channelName:i,uid:o,token:c},h}return h}}class Ym{constructor(e,r){this._trust_stream_added_state_=this._trust_video_mute_state_=this._trust_audio_mute_state_=this._trust_video_enabled_state_=this._trust_audio_enabled_state_=this._trust_in_room_=!0,this._video_muted_=this._audio_muted_=!1,this._video_enabled_=this._audio_enabled_=!0,this._video_added_=this._audio_added_=!1,this.uid=e,this._uintid=r}get hasVideo(){return this._video_enabled_&&!this._video_muted_&&this._video_added_}get hasAudio(){return this._audio_enabled_&&!this._audio_muted_&&this._audio_added_}get audioTrack(){if(this.hasAudio)return this._audioTrack}get videoTrack(){if(this.hasVideo)return this._videoTrack}}let Jm=t=>Ee(this,null,function*(){var e=qs(`MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDCMnXAHkKIGAM+x4N22gCI+Wyu
|
|
128
|
+
STM9ztkT3uYslTT2PuKmZfPzhH6kVdO7PTjGCOZnAsyb3oTtWat0KcxQ4jxvqQV+
|
|
129
|
+
HvYl3iI1Yd4vl2c3qRMJPLtRDfNxa2Mcxgq7e9aEUibzdd0st+OJAy3tOj/Y0aVy
|
|
130
|
+
xQiYDz3vqa6bP29adwIDAQAB`);e=yield window.crypto.subtle.importKey("spki",e,{name:"RSA-OAEP",hash:"SHA-256"},!0,["encrypt"]),t=(r=t,new TextEncoder().encode(r));var r;return r=yield window.crypto.subtle.encrypt({name:"RSA-OAEP"},e,t),Os(new Uint8Array(r))}),hu;class zm{constructor(e,r){var i;this.name=e,this.time=performance.now(),this.sequence=Vt(i=dv[r]).call(i,e)}setElapse(e){this.elapse=e}}let qm=new Tr;class Xm{constructor(e,r){this.records=[],this._id=e,this._group=r,this._localTimeStamp=at(),this._performanceTimeStamp=performance.now()}checkPoint(e){var r;let i=new zm(e,this._group);i.sequence===-1&&z.warning("[".concat(this._id,"] check point record failed, cannot get the sequence")),this.records.push(i),(e=rr(r=this.records).call(r,o=>o.sequence===i.sequence-1))&&i.setElapse(i.time-e.time)}getRecord(e){var r;return rr(r=this.records).call(r,i=>i&&i.name===e)}resetRecords(){this.records.length=0}}var sl=function(t,e,r,i){var o,c=arguments.length,h=3>c?e:i===null?i=Ar(e,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(t,e,r,i);else for(var C=t.length-1;0<=C;C--)(o=t[C])&&(h=(3>c?o(h):3<c?o(e,r,h):o(e,r))||h);return 3<c&&h&&mr(e,r,h),h},zn=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)};class Ac extends mn{constructor(e){var r,i,o,c;let h;if(super(),this._users=[],this._sessionId=null,this._bindEnabledTracks=[],this._leaveMutex=new ta("client-leave"),this._publishMutex=new ta("client-publish"),this._subscribeMutex=new Tr,this._remoteStream=new Tr,this._encryptionMode="none",this._encryptionSecret=null,this._encryptionSalt=null,this._turnServer={servers:[],mode:"auto"},this._cloudProxyServerMode="disabled",this._isDualStreamEnabled=!1,this._streamFallbackTypeCacheMap=new Tr,this._remoteStreamTypeCacheMap=new Tr,this._axiosCancelSource=So.CancelToken.source(),this._networkQualitySensitivity="normal",this._useLocalAccessPoint=!1,this._handleLocalTrackEnable=(x,Q,F)=>{this.publish(x,!1).then(Q).catch(F)},this._handleLocalTrackDisable=(x,Q,F)=>{this.unpublish(x,!1).then(Q).catch(F)},this._handleUserOnline=x=>{var Q;this.isStringUID&&typeof x.uid!="string"&&z.error("[".concat(this._clientId,"] StringUID is Mixed with UintUID"));let F=rr(Q=this._users).call(Q,V=>V.uid===x.uid);F?F._trust_in_room_=!0:(Q=new Ym(x.uid,x.uint_id||x.uid),this._users.push(Q),z.debug("[".concat(this._clientId,"] user online"),x.uid),this.emit(er.USER_JOINED,Q))},this._handleUserOffline=x=>{var Q;let F=rr(Q=this._users).call(Q,V=>V.uid===x.uid);F&&(this._handleRemoveStream(x),Fi(this._users,F),this._remoteStreamTypeCacheMap.delete(F.uid),this._streamFallbackTypeCacheMap.delete(F.uid),z.debug("[".concat(this._clientId,"] user offline"),x.uid,"reason:",x.reason),this.emit(er.USER_LEAVED,F,x.reason))},this._handleAddAudioOrVideoStream=(x,Q,F)=>{var V,Y,$;let te=rr(V=this._users).call(V,Me=>Me.uid===Q);if(!te)return void z.error("[".concat(this._clientId,"] can not find target user!(on_add_stream)"));z.debug(ne(Y=ne($="[".concat(this._clientId,"] stream added with uid ")).call($,Q,", type ")).call(Y,x)),V=x==="audio"?te.hasAudio:te.hasVideo;var ce,Ae;te._uintid||(te._uintid=F||Q),te._trust_stream_added_state_=!0,x==="audio"?te._audio_added_=!0:te._video_added_=!0,(x==="audio"?te.hasAudio:te.hasVideo)&&!V&&(z.info(ne(ce=ne(Ae="[".concat(this._clientId,"] remote user ")).call(Ae,te.uid," published ")).call(ce,x)),this.emit(er.USER_PUBLISHED,te,x)),x==="video"?ke.onGatewayStream(this._sessionId,gn.ON_ADD_VIDEO_STREAM,Ai.ON_ADD_VIDEO_STREAM,{peer:F||Q}):ke.onGatewayStream(this._sessionId,gn.ON_ADD_AUDIO_STREAM,Ai.ON_ADD_AUDIO_STREAM,{peer:F||Q}),(x=this._remoteStream.get(Q))&&x.readyToReconnect&&x.connectionState==="connecting"&&x.reconnectPC().catch(Me=>{z.error("[".concat(this._clientId,"] resubscribe error"),Me.toString())})},this._handleRemoveStream=x=>{var Q,F;let V=rr(Q=this._users).call(Q,Y=>Y.uid===x.uid);if(!V)return void z.warning("[".concat(this._clientId,"] can not find target user!(on_remove_stream)"));z.debug(ne(F="[".concat(this._clientId,"] stream removed with uid ")).call(F,x.uid)),Q=()=>{},V.hasAudio&&V.hasVideo?Q=()=>{var Y,$;z.info(ne(Y="[".concat(this._clientId,"] remote user ")).call(Y,V.uid," unpublished audio track")),this.emit(er.USER_UNPUBLISHED,V,"audio"),z.info(ne($="[".concat(this._clientId,"] remote user ")).call($,V.uid," unpublished video track")),this.emit(er.USER_UNPUBLISHED,V,"video")}:V.hasVideo?Q=()=>{var Y;z.info(ne(Y="[".concat(this._clientId,"] remote user ")).call(Y,V.uid," unpublished video track")),this.emit(er.USER_UNPUBLISHED,V,"video")}:V.hasAudio&&(Q=()=>{var Y;z.info(ne(Y="[".concat(this._clientId,"] remote user ")).call(Y,V.uid," unpublished audio track")),this.emit(er.USER_UNPUBLISHED,V,"audio")}),V._trust_stream_added_state_=!0,V._audio_added_=!1,V._video_added_=!1,(F=this._remoteStream.get(V.uid))&&(F.closeP2PConnection(),this._remoteStream.delete(V.uid)),ke.onGatewayStream(this._sessionId,gn.ON_REMOVE_STREAM,Ai.ON_REMOVE_STREAM,{peer:x.uint_id||x.uid}),Q()},this._handleSetStreamLocalEnable=(x,Q,F)=>{var V,Y,$,te,ce,Ae;let Me=rr(V=this._users).call(V,sr=>sr.uid===Q);if(!Me)return void z.error("[".concat(this._clientId,"] can not find target user!(disable_local)"));if(z.debug(ne(Y=ne($=ne(te="[".concat(this._clientId,"] local ")).call(te,x," ")).call($,F?"enabled":"disabled"," with uid ")).call(Y,Q)),V=x==="audio"?Me.hasAudio:Me.hasVideo,x==="audio"){Me._trust_audio_enabled_state_=!0;var et=Me._audio_enabled_;if(Me._audio_enabled_=F,Me._audio_enabled_===et)return;var pt,Qt;F=Me._audio_enabled_?"enable-local-audio":"disable-local-audio",z.debug(ne(pt=ne(Qt="[".concat(this._clientId,"] user-info-updated, uid: ")).call(Qt,Q,", msg: ")).call(pt,F)),this.emit(er.USER_INFO_UPDATED,Q,F)}else{if(Me._trust_video_enabled_state_=!0,pt=Me._video_enabled_,Me._video_enabled_=F,Me._video_enabled_===pt)return;var kt;F=Me._video_enabled_?"enable-local-video":"disable-local-video",z.debug(ne(et=ne(kt="[".concat(this._clientId,"] user-info-update, uid: ")).call(kt,Q,", msg: ")).call(et,F)),this.emit(er.USER_INFO_UPDATED,Q,F)}if(F=x==="audio"?Me.hasAudio:Me.hasVideo,V!==F){var Rr,mt;if(!V&&F)return z.info(ne(Rr=ne(mt="[".concat(this._clientId,"] remote user ")).call(mt,Q," published ")).call(Rr,x)),void this.emit(er.USER_PUBLISHED,Me,x);(Rr=this._remoteStream.get(Q))&&(mt=$s({},Rr.subscribeOptions),mt.audio=!!Me.hasAudio&&mt.audio,mt.video=!!Me.hasVideo&&mt.video,mt.audio||mt.video?Rr.setSubscribeOptions(mt):(Rr.closeP2PConnection().catch(sr=>{z.warning("close sub pc error",sr)}),this._remoteStream.delete(Me.uid))),z.info(ne(ce=ne(Ae="[".concat(this._clientId,"] remote user ")).call(Ae,Me.uid," unpublished ")).call(ce,x)),this.emit(er.USER_UNPUBLISHED,Me,x)}},this._handleMuteStream=(x,Q,F)=>{var V,Y,$;z.debug("[".concat(this._clientId,"] receive mute message"),x,Q,F);let te=rr(V=this._users).call(V,Rr=>Rr.uid===x);var ce;if(!te)return void z.warning(ne(ce="[".concat(this._clientId,"] can not find remote user, ignore mute event, uid: ")).call(ce,x));if(V=Q==="audio"?te.hasAudio:te.hasVideo,Q==="audio"){te._trust_audio_mute_state_=!0;var Ae=te._audio_muted_;if(te._audio_muted_=F,te._audio_muted_===Ae)return;var Me,et;F=te._audio_muted_?"mute-audio":"unmute-audio",z.debug(ne(Me=ne(et="[".concat(this._clientId,"] user-info-update, uid: ")).call(et,x,", msg: ")).call(Me,F)),this.emit(er.USER_INFO_UPDATED,x,F)}else{if(te._trust_video_mute_state_=!0,Me=te._video_muted_,te._video_muted_=F,te._video_muted_===Me)return;var pt;F=te._video_muted_?"mute-video":"unmute-video",z.debug(ne(Ae=ne(pt="[".concat(this._clientId,"] user-info-update, uid: ")).call(pt,x,", msg: ")).call(Ae,F)),this.emit(er.USER_INFO_UPDATED,x,F)}if(F=Q==="audio"?te.hasAudio:te.hasVideo,V!==F){var Qt,kt;if(!V&&F)return z.info(ne(Qt=ne(kt="[".concat(this._clientId,"] remote user ")).call(kt,x," published ")).call(Qt,Q)),void this.emit(er.USER_PUBLISHED,te,Q);(Qt=this._remoteStream.get(x))&&(kt=$s({},Qt.subscribeOptions),kt.audio=!!te.hasAudio&&kt.audio,kt.video=!!te.hasVideo&&kt.video,Q==="video"&&Qt.pc._statsFilter.setVideoIsReady(!1),kt.audio||kt.video?Qt.setSubscribeOptions(kt):(Qt.closeP2PConnection().catch(Rr=>{z.warning("close sub pc error",Rr)}),this._remoteStream.delete(te.uid))),z.info(ne(Y=ne($="[".concat(this._clientId,"] remote user ")).call($,x," unpublished ")).call(Y,Q)),this.emit(er.USER_UNPUBLISHED,te,Q)}},this._handleP2PLost=x=>{z.debug("[".concat(this._clientId,"] receive p2p lost"),x);let Q=null;if(this._highStream&&this._highStream.pc.ID===x.p2pid)Q=this._highStream;else if(this._lowStream&&this._lowStream.pc.ID===x.p2pid)Q=this._lowStream;else{var F;Re(F=this._remoteStream).call(F,V=>{V.pc.ID===x.p2pid&&(Q=V)})}Q?Q.emit(Mt.GATEWAY_P2P_LOST,x.p2pid):z.warning("P2PLost stream not found",x)},this._handleTokenWillExpire=()=>{z.debug("[".concat(this._clientId,"] received message onTokenPrivilegeWillExpire")),this.emit(er.ON_TOKEN_PRIVILEGE_WILL_EXPIRE)},this._handleBeforeUnload=x=>{x.returnValue!==void 0&&x.returnValue!==""||(this.leave(),z.info("[".concat(this._clientId,"] auto leave onbeforeunload")))},this._handleUpdateNetworkQuality=()=>{var x;if(this._networkQualitySensitivity!=="normal"){if(navigator&&navigator.onLine!==void 0&&!navigator.onLine)return void this.emit(er.NETWORK_QUALITY,{downlinkNetworkQuality:6,uplinkNetworkQuality:6});var Q={downlinkNetworkQuality:0,uplinkNetworkQuality:0};this._highStream&&!this._highStream.detecting&&(Q.uplinkNetworkQuality=this._highStream.getNetworkQuality());var F=0;Re(x=this._remoteStream).call(x,V=>F+=V.getNetworkQuality()),0<this._remoteStream.size&&(Q.downlinkNetworkQuality=Math.round(F/this._remoteStream.size)),this.emit(er.NETWORK_QUALITY,Q)}},this._codec=e.codec,this._mode=e.mode,e.proxyServer&&(this._proxyServer=e.proxyServer,ke.setProxyServer(this._proxyServer),z.setProxyServer(this._proxyServer)),e.turnServer&&(this._turnServer=$s({},this._turnServer,{mode:"manual"},e.turnServer)),this._clientId=be(5,"client-"),z.info(ne(r=ne(i=ne(o=ne(c="[".concat(this._clientId,"] Initializing AgoraRTC client v")).call(c,rs," build: ")).call(o,"v4.7.3-0-g0eb931c7(11/16/2021, 7:57:58 PM)",", mode: ")).call(i,this._mode,", codec: ")).call(r,this._codec)),this._performanceRecorder=function(x,Q){return Q=new Xm(x,Q),qm.set(x,Q),Q}(this._clientId,"join"),e.clientRoleOptions)try{Oo(e.clientRoleOptions),h=Dn({},e.clientRoleOptions)}catch(x){var C;z.warning(ne(C="[".concat(this._clientId,"] ")).call(C,x.toString()))}this._statsCollector=new lc(this._clientId),this._statsCollector.onStatsException=(x,Q,F)=>{var V,Y,$;z.debug(ne(V=ne(Y=ne($="[".concat(this._clientId,"] receive exception msg, code: ")).call($,x,", msg: ")).call(Y,Q,", uid: ")).call(V,F)),this.emit(er.EXCEPTION,{code:x,msg:Q,uid:F})},this._statsCollector.onUploadPublishDuration=(x,Q,F,V)=>{var Y;let $=rr(Y=this._users).call(Y,te=>te.uid===x);$&&ke.peerPublishStatus(this._sessionId,{subscribeElapse:V,audioPublishDuration:Q,videoPublishDuration:F,peer:$._uintid})},this._gateway=new qv({clientId:this._clientId,mode:this._mode,codec:this._codec,websocketRetryConfig:e.websocketRetryConfig||Ki,httpRetryConfig:e.httpRetryConfig||Ki,forceWaitGatewayResponse:e.forceWaitGatewayResponse===void 0||e.forceWaitGatewayResponse,statsCollector:this._statsCollector,role:e.role,clientRoleOptions:h}),this._config=e,this._configDistribute=new Im,this._handleGatewayEvents()}get connectionState(){return this._gateway.state}get remoteUsers(){return this._users}get localTracks(){return this._highStream?this._highStream.getAllTracks():[]}get uid(){return this._uid}get channelName(){return this._channelName}get isStringUID(){return!!this._joinInfo&&!!this._joinInfo.stringUid}join(e,r,i,o,c){return Ee(this,null,function*(){var h;this._performanceRecorder.checkPoint("startJoin");var C=(hu||hu||(hu=(window.location.protocol.split(":")[0]||"").toUpperCase(),hu))==="HTTPS";let x=window.isSecureContext!==void 0?window.isSecureContext:"Browser Not Support",Q=()=>{z.warning("The website must be running in a secure context (About secure context: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts ), otherwise the media collection will be restricted by the browser")};window.isSecureContext!==void 0?window.isSecureContext||Q():C||Q(),C=ke.reportApiInvoke(this._sessionId,{name:Ot.JOIN,options:[e,r,i,o],states:{isHttps:C,isSecureContext:x},tag:bt.TRACER});try{if(!i&&i!==null)throw new ue(oe.INVALID_PARAMS,"Invalid token: ".concat(i,". If you don not use token, set it to null"));i&&Ur(i,"token",1,2047),Ur(e,"appid",1,2047),Xn(r),o&&ho(o),c&&Ur(c,"optionalInfo",1,2047)}catch(te){throw C.onError(te),te}if(z.info(ne(h="[".concat(this._clientId,"] start join channel ")).call(h,r)),this._leaveMutex.isLocked&&(z.debug("[".concat(this._clientId,"] join: waiting leave operation")),(yield this._leaveMutex.lock())(),z.debug("[".concat(this._clientId,"] join: continue"))),this.connectionState!=="DISCONNECTED")throw e=new ue(oe.INVALID_OPERATION,"[".concat(this._clientId,"] Client already in connecting/connected state")),C.onError(e),e;this._sessionId||(this._sessionId=be(32,"").toUpperCase()),this._gateway.state="CONNECTING",c={clientId:this._clientId,appId:e,sid:this._sessionId,cname:r,uid:typeof o!="string"?o:null,turnServer:this._turnServer,proxyServer:this._proxyServer,token:i||e,cloudProxyServer:this._cloudProxyServerMode,optionalInfo:c,useLocalAccessPoint:this._useLocalAccessPoint},typeof o=="string"&&(c.stringUid=o,this._uintUid?(c.uid=this._uintUid,this._uintUid=void 0):c.uid=0),this._encryptionMode!=="none"&&this._encryptionSecret&&(c.aesmode=this._encryptionMode,c.aespassword=yield Jm(this._encryptionSecret),this._encryptionSalt&&(c.aessalt=this._encryptionSalt)),this._startSession(this._sessionId,{channel:r,appId:e}),_s(()=>{this.connectionState==="CONNECTING"&&ke.joinChannelTimeout(this._sessionId,5)},5e3);try{var F;let te;if(c.cloudProxyServer==="443only")c.proxyServer=Xe.PROXY_SERVER_TYPE2;else if(c.cloudProxyServer==="proxy3"||c.cloudProxyServer==="proxy4"||c.cloudProxyServer==="proxy5"){let Ae=Xe.PROXY_SERVER_TYPE3;so(Ae)?c.proxyServer=Ae[0]:c.proxyServer=Ae}if(ke.setProxyServer(c.proxyServer),z.setProxyServer(c.proxyServer),this._performanceRecorder.checkPoint("startRequestAp"),c.stringUid&&!c.uid&&c.cloudProxyServer==="normal"){var V;yield $n(c,this._axiosCancelSource.token,this._config.httpRetryConfig||Ki,!1);let Ae=yield Xi(c.stringUid,c,this._axiosCancelSource.token,this._config.httpRetryConfig||Ki);z.debug(ne(V="getUserAccount Success ".concat(c.stringUid," => ")).call(V,Ae)),c.uid=Ae,te=yield Ns(c,this._axiosCancelSource.token,this._config.httpRetryConfig||Ki)}else{if(c.stringUid&&!c.uid){var Y;let Ae=yield Xi(c.stringUid,c,this._axiosCancelSource.token,this._config.httpRetryConfig||Ki);z.debug(ne(Y="getUserAccount Success ".concat(c.stringUid," => ")).call(Y,Ae)),c.uid=Ae}te=yield $n(c,this._axiosCancelSource.token,this._config.httpRetryConfig||Ki,!0)}this._performanceRecorder.checkPoint("startJoinGateway"),this._configDistribute.startGetConfigDistribute(c,this._axiosCancelSource.token),this._configDistribute.on(jc.UPDATE_BITRATE_LIMIT,Ae=>{this._highStream&&this._highStream.handleUpdateBitrateLimit(Ae.uplink),Ae.low_stream_uplink&&this._lowStream&&this._lowStream.handleUpdateBitrateLimit({max_bitrate:Ae.low_stream_uplink.bitrate,min_bitrate:Ae.low_stream_uplink.bitrate||0})}),this._key=i||e,this._joinInfo=$s({},c,{cid:te.gatewayInfo.cid,uid:c.uid?c.uid:te.gatewayInfo.uid,vid:te.gatewayInfo.vid,apResponse:te.gatewayInfo.res,uni_lbs_ip:te.gatewayInfo.uni_lbs_ip,gatewayAddrs:te.gatewayInfo.gatewayAddrs});let ce=yield this._gateway.join(this._joinInfo,this._key);return C.onSuccess(ce),this._appId=e,this._channelName=c.cname,this._uid=ce,this._networkQualityInterval&&window.clearInterval(this._networkQualityInterval),this._networkQualityInterval=window.setInterval(this._handleUpdateNetworkQuality,2e3),window.addEventListener("beforeunload",this._handleBeforeUnload),z.info(ne(F="[".concat(this._clientId,"] Joining channel success: ")).call(F,r)),_s(()=>{z.startUpload()},5e3),this._performanceRecorder.checkPoint("finishJoin"),$=this,_r(Zo).call(Zo,$)||Zo.push($),ce}catch(te){throw e=so(te)?te[0]:te,z.error("[".concat(this._clientId,"] Joining channel failed, rollback"),e),e.code!==oe.OPERATION_ABORTED&&(this._gateway.state="DISCONNECTED",this._reset()),C.onError(e),e}var $})}leave(){return Ee(this,null,function*(){let e=ke.reportApiInvoke(this._sessionId,{name:Ot.LEAVE,options:[],tag:bt.TRACER});z.info("[".concat(this._clientId,"] Leaving channel")),window.removeEventListener("beforeunload",this._handleBeforeUnload),this._reset();var r=Vt(Zo).call(Zo,this);if(r!==-1&&An(Zo).call(Zo,r,1),r=yield this._leaveMutex.lock(),this.connectionState==="DISCONNECTED")return z.info("[".concat(this._clientId,"] Leaving channel repeated, success")),r(),e.onSuccess();yield this._gateway.leave(this.connectionState!=="CONNECTED"),z.info("[".concat(this._clientId,"] Leaving channel success")),r(),e.onSuccess()})}publish(e,r=!0){return Ee(this,null,function*(){var i,o;so(e)||(e=[e]);let c=ke.reportApiInvoke(this._sessionId,{name:Ot.PUBLISH,options:_t(e).call(e,h=>h?Object(h).toString():"null"),tag:bt.TRACER});if(e.length===0)return e=new ue(oe.INVALID_PARAMS,"track list is empty"),c.onError(e),e.throw();if(this._gateway.role==="audience")return e=new ue(oe.INVALID_OPERATION,"audience can not publish stream"),c.onError(e),e.throw();for(let h of e){if(!(h instanceof Xl))return e=new ue(oe.INVALID_PARAMS,"pamameter is not local track"),c.onError(e),e.throw();if(!h._enabled&&r)return e=new ue(oe.TRACK_IS_DISABLED,"can not publish a disabled track: ".concat(h.getTrackId())),c.onError(e),e.throw()}if(z.info(ne(i="[".concat(this._clientId,"] Publishing tracks, id ")).call(i,_t(e).call(e,h=>"".concat(h.getTrackId()," ")))),yield this._configDistribute.awaitConfigDistributeComplete(),r&&Re(e).call(e,h=>{var C;let x=this._configDistribute.getBitrateLimit();var Q;h instanceof ai&&x&&h.setBitrateLimit(x.uplink),Vt(C=this._bindEnabledTracks).call(C,h)===-1&&(h.addListener(Ut.NEED_ADD_TRACK,this._handleLocalTrackEnable),h.addListener(Ut.NEED_REMOVE_TRACK,this._handleLocalTrackDisable),this._bindEnabledTracks.push(h),Dt()&&h.muted&&z.debug(ne(Q="[".concat(this._clientId,"] on firefox publish a muted track ")).call(Q,h.getTrackId(),", skip the pub operation and wait unmute")))}),Dt()&&(e=Wt(e).call(e,h=>!h.muted)).length===0)return void c.onSuccess(_t(e).call(e,h=>h.trackMediaType+":"+h.getTrackLabel()).toString());i=yield this._publishMutex.lock();try{let h=yield this._publishHighStream(e),C=(h.audioTrack,h.videoTrack);this._isDualStreamEnabled&&C&&!this._lowStream&&(yield this._publishLowStream(C)),i(),c.onSuccess(_t(e).call(e,x=>x.trackMediaType+":"+x.getTrackLabel()).toString())}catch(h){throw i(),r&&Re(e).call(e,C=>{var x,Q;let F=Vt(x=this._bindEnabledTracks).call(x,C);F!==-1&&(C.off(Ut.NEED_ADD_TRACK,this._handleLocalTrackEnable),C.off(Ut.NEED_REMOVE_TRACK,this._handleLocalTrackDisable),An(Q=this._bindEnabledTracks).call(Q,F,1))}),c.onError(h),z.error("[".concat(this._clientId,"] publish error"),h.toString()),h}z.info(ne(o="[".concat(this._clientId,"] Publish success, id ")).call(o,_t(e).call(e,h=>"".concat(h.getTrackId()," "))))})}unpublish(e,r=!0){return Ee(this,null,function*(){var i;let o=yield this._publishMutex.lock(),c,h,C;try{var x,Q;if(!this._highStream||(c=this._highStream.getAllTracks(),e?so(e)||(e=[e]):e=this._highStream.getAllTracks(),h=function(F,V){if(F.length!==V.length)return!1;for(let Y=0;Y<F.length;Y+=1){let $=F[Y];if(Wt(F).call(F,te=>te===$).length!==Wt(V).call(V,te=>te===$).length)return!1}return!0}(c,e),C=ke.reportApiInvoke(this._sessionId,{name:Ot.UNPUBLISH,options:_t(e).call(e,F=>F.getTrackId()),tag:bt.TRACER}),z.info(ne(x=ne(Q="[".concat(this._clientId,"] Unpublish tracks, tracks ")).call(Q,_t(e).call(e,F=>"".concat(F.getTrackId()," ")),", isClosePC: ")).call(x,h)),!this._highStream))return z.warning("[".concat(this._clientId,"] Could not find tracks to unpublish")),void(o&&o())}catch(F){throw o&&o(),F}try{this._lowStream&&0<Wt(e).call(e,F=>F.trackMediaType==="video").length&&(yield this._lowStream.closeP2PConnection(),this._lowStream=void 0),h?yield this._highStream.closeP2PConnection():yield this._highStream.removeTracks(e,r),o&&o()}catch(F){if(F.code!==oe.OPERATION_ABORTED)throw C.onError(F),z.error("[".concat(this._clientId,"] unpublish error"),F.toString()),o&&o(),F;z.debug("[".concat(this._clientId,"] ignore unpub operation abort")),o&&o()}this._highStream&&this._highStream.connectionState==="disconnected"&&(this._highStream=void 0,this._lowStream=void 0),r&&Re(e).call(e,F=>{var V,Y;let $=Vt(V=this._bindEnabledTracks).call(V,F);$!==-1&&(F.off(Ut.NEED_ADD_TRACK,this._handleLocalTrackEnable),F.off(Ut.NEED_REMOVE_TRACK,this._handleLocalTrackDisable),An(Y=this._bindEnabledTracks).call(Y,$,1))}),z.info(ne(i="[".concat(this._clientId,"] Unpublish success,tracks ")).call(i,_t(e).call(e,F=>"".concat(F.getTrackId())))),C.onSuccess()})}subscribe(e,r){return Ee(this,null,function*(){var i,o,c,h;ui(r,"mediaType",["audio","video"]);let C=ke.reportApiInvoke(this._sessionId,{name:Ot.SUBSCRIBE,options:[e.uid,r],tag:bt.TRACER});if(!this._joinInfo)throw r=new ue(oe.INVALID_OPERATION,"Can't subscribe stream, not joined"),C.onError(r),r;if(this.connectionState!=="CONNECTED"&&this.connectionState!=="RECONNECTING")throw r=new ue(oe.INVALID_OPERATION,"Can't subscribe stream in ".concat(this.connectionState," state")),C.onError(r),r;if(!rr(i=this._users).call(i,te=>te===e)){var x;throw r=new ue(oe.INVALID_REMOTE_USER,"user is not in the channel"),z.error(ne(x="[".concat(this._clientId,"] can not subscribe ")).call(x,e.uid,", this user is not in the channel")),C.onError(r),r}if(!e.hasAudio&&!e.hasVideo){var Q;throw r=new ue(oe.INVALID_REMOTE_USER,"user is not published"),z.error(ne(Q="[".concat(this._clientId,"] can not subscribe ")).call(Q,e.uid,", user is not published")),C.onError(r),r}if(x={audio:r==="audio",video:r==="video"},!e.hasAudio&&x.audio||!e.hasVideo&&x.video){var F,V,Y=new ue(oe.REMOTE_USER_IS_NOT_PUBLISHED);throw z.error(ne(F=ne(V="[".concat(this._clientId,"] can not subscribe ")).call(V,e.uid," with mediaType ")).call(F,r,", remote track is not published")),C.onError(Y),Y}(F=this._subscribeMutex.get(e.uid))||(F=new ta("sub-".concat(e.uid)),this._subscribeMutex.set(e.uid,F)),z.info(ne(o=ne(c="[".concat(this._clientId,"] subscribe user ")).call(c,e.uid,", mediaType: ")).call(o,r)),o=yield F.lock(),c=this._remoteStream.get(e.uid);try{if(c)x.audio=x.audio||c.subscribeOptions.audio,x.video=x.video||c.subscribeOptions.video,yield this._gateway.subscribeChange(c,x);else{c=new Hm(e,this._statsCollector,this._joinInfo,x),this._remoteStream.set(e.uid,c);try{yield this._gateway.subscribe(c)}catch(te){throw this._remoteStream.delete(e.uid),te}c.on(Mt.CONNECTION_STATE_CHANGE,(te,ce)=>{te==="connecting"?this.emit(er.MEDIA_RECONNECT_START,e.uid):te==="connected"&&this.emit(er.MEDIA_RECONNECT_END,e.uid)})}o()}catch(te){var $;throw C.onError(te),o(),z.error(ne($="[".concat(this._clientId,"] subscribe user ")).call($,e.uid," error"),te),te}return z.info(ne(Y=ne(h="[".concat(this._clientId,"] subscribe success user ")).call(h,e.uid,", mediaType: ")).call(Y,r)),this._defaultStreamFallbackType&&this.setStreamFallbackOption(e.uid,this._defaultStreamFallbackType).catch(te=>{z.warning("[".concat(this._clientId,"] auto set fallback failed"),te)}),r=r==="audio"?e.audioTrack:e.videoTrack,r?(C.onSuccess(r.getTrackId()),r):(r=new ue(oe.UNEXPECTED_ERROR,"can not find remote track in user object"),C.onError(r),r.throw())})}unsubscribe(e,r){return Ee(this,null,function*(){var i,o,c,h,C;r&&ui(r,"mediaType",["audio","video"]);let x=ke.reportApiInvoke(this._sessionId,{name:Ot.UNSUBSCRIBE,options:[e.uid,r],tag:bt.TRACER});if(!rr(i=this._users).call(i,Y=>Y===e)){var Q;throw r=new ue(oe.INVALID_REMOTE_USER,"user is not in the channel"),z.error(ne(Q="[".concat(this._clientId,"] can not subscribe ")).call(Q,e.uid,", user is not in the channel")),x.onError(r),r}z.info(ne(o=ne(c="[".concat(this._clientId,"] unsubscribe uid: ")).call(c,e.uid,", mediaType: ")).call(o,r)),(Q=this._subscribeMutex.get(e.uid))||(Q=new ta("sub-".concat(e.uid)),this._subscribeMutex.set(e.uid,Q)),Q=yield Q.lock(),i=this._remoteStream.get(e.uid);var F;if(!i)return z.warning(ne(F="[".concat(this._clientId,"]: you have not subscribe the remote user ")).call(F,e.uid)),x.onSuccess(),void Q();F=$s({},i.subscribeOptions),r==="audio"?F.audio=!1:r==="video"?(F.video=!1,i.pc._statsFilter.setVideoIsReady(!1)):(F.audio=!1,F.video=!1);try{F.audio||F.video?yield this._gateway.subscribeChange(i,F):(yield i.closeP2PConnection(),this._remoteStream.delete(e.uid)),Q()}catch(Y){var V;if(Y.code!==oe.OPERATION_ABORTED)throw x.onError(Y),Q(),z.error(ne(V="[".concat(this._clientId,"] unsubscribe user ")).call(V,e.uid," error"),Y.toString()),Y;Q(),z.debug("[".concat(this._clientId,"] ignore unsub operation abort"))}z.info(ne(h=ne(C="[".concat(this._clientId,"] unsubscribe success uid: ")).call(C,e.uid,", mediaType: ")).call(h,r)),x.onSuccess()})}setLowStreamParameter(e){if(!e)throw new ue(oe.INVALID_PARAMS);e.width==null||Xt(e.width,"streamParameter.width"),e.height==null||Xt(e.height,"streamParameter.height"),e.framerate==null||Xt(e.framerate,"streamParameter.framerate"),e.bitrate==null||Xt(e.bitrate,"streamParameter.bitrate");let r=ke.reportApiInvoke(this._sessionId,{name:Ot.SET_LOW_STREAM_PARAMETER,options:[e],tag:bt.TRACER});(!e.width&&e.height||e.width&&!e.height)&&z.warning("[".concat(this._clientId,"] The width and height parameters take effect only when both are set")),z.info("[".concat(this._clientId,"] set low stream parameter to"),ht(e));let i=this._configDistribute.getLowStreamConfigDistribute();i&&i.bitrate&&e.bitrate&&i.bitrate<e.bitrate&&(e.bitrate=i.bitrate),this._lowStreamParameter=e,r.onSuccess()}enableDualStream(){return Ee(this,null,function*(){let e=ke.reportApiInvoke(this._sessionId,{name:Ot.ENABLE_DUAL_STREAM,options:[],tag:bt.TRACER});if(!Nr.supportDualStream){ke.streamSwitch(this._sessionId,{lts:at(),isdual:!0,succ:!1});var r=new ue(oe.NOT_SUPPORTED,"Your browser is not support dual stream");throw e.onError(r),r}if(this._isDualStreamEnabled)throw r=new ue(oe.INVALID_OPERATION,"Dual stream is already enabled"),e.onError(r),r;if(this._highStream&&this._highStream.connectionState==="connected"&&this._highStream.videoTrack)try{yield this._publishLowStream(this._highStream.videoTrack)}catch(i){throw ke.streamSwitch(this._sessionId,{lts:at(),isdual:!0,succ:!1}),e.onError(i),i}this._isDualStreamEnabled=!0,ke.streamSwitch(this._sessionId,{lts:at(),isdual:!0,succ:!0}),z.info("[".concat(this._clientId,"] enable dual stream")),e.onSuccess()})}disableDualStream(){return Ee(this,null,function*(){let e=ke.reportApiInvoke(this._sessionId,{name:Ot.DISABLE_DUAL_STREAM,options:[],tag:bt.TRACER});if(this._lowStream)try{yield this._lowStream.closeP2PConnection()}catch(r){throw ke.streamSwitch(this._sessionId,{lts:at(),isdual:!1,succ:!1}),e.onError(r),r}this._lowStream=void 0,this._isDualStreamEnabled=!1,this._highStream&&(this._highStream.lowStreamConnection=void 0),ke.streamSwitch(this._sessionId,{lts:at(),isdual:!1,succ:!0}),z.info("[".concat(this._clientId,"] disable dual stream")),e.onSuccess()})}setClientRole(e,r){return Ee(this,null,function*(){ui(e,"role",["audience","host"]),r&&Oo(r);let i=ke.reportApiInvoke(this._sessionId,{name:Ot.SET_CLIENT_ROLE,options:[e,r],tag:bt.TRACER});if(this._mode==="rtc")return z.warning("[".concat(this._clientId,"]rtc mode can not use setClientRole")),e=new ue(oe.INVALID_OPERATION,"rtc mode can not use setClientRole"),i.onError(e),e.throw();if(r&&r.level&&e==="host")return e=new ue(oe.INVALID_OPERATION,"host mode can not set audience latency level"),i.onError(e),e.throw();try{var o,c;if(e==="audience"&&this._highStream){let h=new ue(oe.INVALID_OPERATION,"can not set client role to audience when publishing stream");return i.onError(h),h.throw()}yield this._gateway.setClientRole(e,r),z.info(ne(o=ne(c="[".concat(this._clientId,"] set client role to ")).call(c,e,", level: ")).call(o,r&&r.level)),i.onSuccess()}catch(h){throw i.onError(h),h}})}setProxyServer(e){if(Ur(e,"proxyServer"),this.connectionState!=="DISCONNECTED")throw new ue(oe.INVALID_OPERATION,"Set proxy server before join channel");if(this._cloudProxyServerMode!=="disabled"||this._useLocalAccessPoint)throw new ue(oe.INVALID_OPERATION,"You have already set the proxy");this._proxyServer=e,ke.setProxyServer(this._proxyServer),z.setProxyServer(this._proxyServer)}setTurnServer(e){if(so(e)||(e=[e]),this.connectionState!=="DISCONNECTED")throw new ue(oe.INVALID_OPERATION,"Set turn server before join channel");if(this._cloudProxyServerMode!=="disabled"||this._useLocalAccessPoint)throw new ue(oe.INVALID_OPERATION,"You have already set the proxy");var r;if(oa(e))return this._turnServer={servers:e,mode:"original-manual"},void z.info(ne(r="[".concat(this._clientId,"] Set original turnserver success: ")).call(r,_t(e).call(e,i=>i.urls).join(","),"."));Re(e).call(e,i=>bo(i)),this._turnServer={servers:e,mode:"manual"},z.info("[".concat(this._clientId,"] Set turnserver success."))}startProxyServer(e){let r=ke.reportApiInvoke(this._sessionId,{name:Ot.START_PROXY_SERVER,options:[],tag:bt.TRACER});if(this.connectionState!=="DISCONNECTED")throw e=new ue(oe.INVALID_OPERATION,"Start proxy server before join channel"),r.onError(e),e;if(this._proxyServer||this._turnServer.mode==="manual"||this._useLocalAccessPoint)throw e=new ue(oe.INVALID_OPERATION,"You have already set the proxy"),r.onError(e),e;let i=[1,2,3,4,5];switch(e===void 0&&(e=1),e){case 1:this._cloudProxyServerMode="normal";break;case 2:this._cloudProxyServerMode="443only";break;case 3:this._cloudProxyServerMode="proxy3";break;case 4:this._cloudProxyServerMode="proxy4";break;case 5:this._cloudProxyServerMode="proxy5";break;default:throw e=new ue(oe.INVALID_PARAMS,"proxy server mode must be ".concat(i.join("|"))),r.onError(e),e}z.info("[".concat(this._clientId,"] set cloud proxy server mode to"),this._cloudProxyServerMode),r.onSuccess()}stopProxyServer(){let e=ke.reportApiInvoke(this._sessionId,{name:Ot.STOP_PROXY_SERVER,options:[],tag:bt.TRACER});if(this.connectionState!=="DISCONNECTED")throw new ue(oe.INVALID_OPERATION,"Stop proxy server after leave channel");ke.setProxyServer(),z.setProxyServer(),this._cloudProxyServerMode="disabled",z.info("[".concat(this._clientId,"] set cloud proxy server mode to"),this._cloudProxyServerMode),this._proxyServer=void 0,this._turnServer={mode:"auto",servers:[]},e.onSuccess()}setLocalAccessPoints(e,r){if(Rs(e,"serverList"),Ur(r,"domain"),this._proxyServer||this._cloudProxyServerMode!=="disabled")throw new ue(oe.INVALID_OPERATION,"set local access point failed, You have already set the cloud proxy");let i=/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/;e=_t(e).call(e,o=>{var c;return i.test(o)?ne(c="".concat(o.replace(/\./g,"-"),".")).call(c,r):o}),this._useLocalAccessPoint=!0,Gr("WEBCS_DOMAIN",e),Gr("WEBCS_DOMAIN_BACKUP_LIST",e),Gr("GATEWAY_DOMAINS",[r]),Gr("EVENT_REPORT_DOMAIN",e[0]),Gr("EVENT_REPORT_BACKUP_DOMAIN",e[1]||e[0]),Gr("LOG_UPLOAD_SERVER","".concat(e[0],":6444")),z.info("set local access point success")}setRemoteVideoStreamType(e,r){return Ee(this,null,function*(){var i,o;ui(r,"streamType",[0,1]);let c=ke.reportApiInvoke(this._sessionId,{name:Ot.SET_REMOTE_VIDEO_STREAM_TYPE,options:[e,r],tag:bt.TRACER});try{yield this._gateway.setRemoteVideoStreamType(e,r),_s(()=>{var h;let C=rr(h=this._users).call(h,x=>x.uid===e);C&&C.videoTrack&&C.videoTrack.updateMediaStreamTrackResolution()},2e3)}catch(h){throw c.onError(h),z.error("[".concat(this._clientId,"] set remote video stream type error"),h.toString()),h}z.info(ne(i=ne(o="[".concat(this._clientId,"] set remote ")).call(o,e," video stream type to ")).call(i,r)),this._remoteStreamTypeCacheMap.set(e,r),c.onSuccess()})}setStreamFallbackOption(e,r){return Ee(this,null,function*(){var i,o;ui(r,"fallbackType",[0,1,2]);let c=ke.reportApiInvoke(this._sessionId,{name:Ot.SET_STREAM_FALLBACK_OPTION,options:["too long to show",r],tag:bt.TRACER});try{yield this._gateway.setStreamFallbackOption(e,r)}catch(h){throw c.onError(h),z.error("[".concat(this._clientId,"] set stream fallback option"),h.toString()),h}z.info(ne(i=ne(o="[".concat(this._clientId,"] set remote ")).call(o,e," stream fallback type to ")).call(i,r)),this._streamFallbackTypeCacheMap.set(e,r),c.onSuccess()})}setEncryptionConfig(e,r,i){ui(e,"encryptionMode","aes-128-xts aes-256-xts aes-128-ecb sm4-128-ecb aes-128-gcm aes-256-gcm aes-128-gcm2 aes-256-gcm2 none".split(" ")),Ur(r,"secret");let o=["aes-128-gcm2","aes-256-gcm2"];if(_r(o).call(o,e)){if(!(i&&i instanceof Uint8Array&&i.length===32))throw new ue(oe.INVALID_PARAMS,"salt must be an Uint8Array and exactly equal to 32 bytes")}else if(i)throw new ue(oe.INVALID_PARAMS,"current encrypt mode does not need salt");/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*,.<>?/:;'"|{}\[\]])(?=.{8,})/.test(r)||z.warning(`The secret is not strong:
|
|
131
|
+
The secret must contain at least 1 lowercase alphabetical character,
|
|
132
|
+
The secret must contain at least 1 uppercase alphabetical character,
|
|
133
|
+
The secret must contain at least 1 numeric character,
|
|
134
|
+
The secret must contain at least one special character,
|
|
135
|
+
The secret must be eight characters or longer.
|
|
136
|
+
`),this._encryptionMode=e,this._encryptionSecret=r,i&&(this._encryptionSalt=Os(i))}renewToken(e){return Ee(this,null,function*(){Ur(e,"token",1,2047);let r=ke.reportApiInvoke(this._sessionId,{name:Ot.RENEW_TOKEN,options:[e],tag:bt.TRACER});if(!this._key)return e=new ue(oe.INVALID_OPERATION,"renewToken should not be called before user join"),r.onError(e),e.throw();this._key=e;try{yield this._gateway.renewToken(e)}catch(i){throw r.onError(i),z.error("[".concat(this._clientId,"] renewToken failed"),i.toString()),i}z.debug("[".concat(this._clientId,"] renewToken success")),r.onSuccess()})}enableAudioVolumeIndicator(){let e=ke.reportApiInvoke(this._sessionId,{name:Ot.ENABLE_AUDIO_VOLUME_INDICATOR,options:[],tag:bt.TRACER});if(this._audioVolumeIndicationInterval)return z.warning("you have already enabled audio volume indicator!"),e.onSuccess();this._audioVolumeIndicationInterval=window.setInterval(()=>{var r,i,o;let c=Hc(r=_t(i=co(Na(o=this._remoteStream).call(o))).call(i,h=>({level:h.user.audioTrack?100*h.user.audioTrack._source.getAccurateVolumeLevel():0,uid:h.getUserId()}))).call(r,(h,C)=>h.level-C.level);this._highStream&&this._highStream.audioTrack&&(c.push({level:100*this._highStream.audioTrack._source.getAccurateVolumeLevel(),uid:this._highStream._userId}),c=Hc(c).call(c,(h,C)=>h.level-C.level)),this.emit(er.VOLUME_INDICATOR,c)},Xe.AUDIO_VOLUME_INDICATION_INTERVAL||2e3),e.onSuccess()}getRTCStats(){let e=this._statsCollector.getRTCStats(),r=this._gateway.getInChannelInfo();return e.Duration=Math.round(r.duration/1e3),e}startLiveStreaming(e,r){let i=ke.reportApiInvoke(this._sessionId,{name:Ot.START_LIVE_STREAMING,options:[e,r],tag:bt.TRACER});if(!r){if(this._codec!=="h264")return e=new ue(oe.LIVE_STREAMING_INVALID_RAW_STREAM,"raw streaming is only support h264"),i.onError(e),it.reject(e);if(!this._highStream)return e=new ue(oe.LIVE_STREAMING_INVALID_RAW_STREAM,"can not find stream to raw streaming"),i.onError(e),it.reject(e)}return this._liveRawStreamingClient&&this._liveRawStreamingClient.hasUrl(e)||this._liveTranscodeStreamingClient&&this._liveTranscodeStreamingClient.hasUrl(e)?(e=new ue(oe.LIVE_STREAMING_TASK_CONFLICT),i.onError(e),it.reject(e)):(r=r?mi.TRANSCODE:mi.RAW,this._createLiveStreamingClient(r).startLiveStreamingTask(e,r).then(()=>i.onSuccess()).catch(o=>{throw i.onError(o),o}))}setLiveTranscoding(e){let r=ke.reportApiInvoke(this._sessionId,{name:Ot.SET_LIVE_TRANSCODING,options:[e],tag:bt.TRACER});return this._createLiveStreamingClient(mi.TRANSCODE).setTranscodingConfig(e).then(()=>r.onSuccess()).catch(i=>{throw r.onError(i),i})}stopLiveStreaming(e){var r;let i=ke.reportApiInvoke(this._sessionId,{name:Ot.STOP_LIVE_STREAMING,options:[e],tag:bt.TRACER}),o=Wt(r=[this._liveRawStreamingClient,this._liveTranscodeStreamingClient]).call(r,c=>c&&c.hasUrl(e));return o.length?it.all(_t(o).call(o,c=>c&&c.stopLiveStreamingTask(e))).then(()=>i.onSuccess()).catch(c=>{throw i.onError(c),c}):(r=new ue(oe.INVALID_PARAMS,"can not find live streaming url to stop"),i.onError(r),it.reject(r))}addInjectStreamUrl(e,r){return Ee(this,null,function*(){let i=ke.reportApiInvoke(this._sessionId,{name:Ot.ADD_INJECT_STREAM_URL,options:[e,r],tag:bt.TRACER});try{if(!this._joinInfo)throw new ue(oe.INVALID_OPERATION,"can not addInjectStreamUrl, no joininfo");let o=this._createLiveStreamingClient(mi.INJECT);o.setInjectStreamConfig(r,0),yield o.startLiveStreamingTask(e,mi.INJECT)}catch(o){throw i.onError(o),o}i.onSuccess()})}removeInjectStreamUrl(){return Ee(this,null,function*(){let e=ke.reportApiInvoke(this._sessionId,{name:Ot.REMOVE_INJECT_STREAM_URL,options:[],tag:bt.TRACER});try{var r,i;let o=this._createLiveStreamingClient(mi.INJECT),c=rr(r=co(Na(i=o.streamingTasks).call(i))).call(r,h=>h.mode===mi.INJECT);if(!this._joinInfo||!c)throw new ue(oe.INVALID_OPERATION,"can remove addInjectStreamUrl, no joininfo or inject task");yield o.stopLiveStreamingTask(c.url)}catch(o){throw e.onError(o),o}e.onSuccess()})}startChannelMediaRelay(e){return Ee(this,null,function*(){let r=ke.reportApiInvoke(this._sessionId,{name:Ot.START_CHANNEL_MEDIA_RELAY,options:[e],tag:bt.TRACER});try{ml(e),yield this._createChannelMediaRelayClient().startChannelMediaRelay(e)}catch(i){return r.onError(i),i.throw()}r.onSuccess()})}updateChannelMediaRelay(e){return Ee(this,null,function*(){let r=ke.reportApiInvoke(this._sessionId,{name:Ot.UPDATE_CHANNEL_MEDIA_RELAY,options:[e],tag:bt.TRACER});try{ml(e),yield this._createChannelMediaRelayClient().updateChannelMediaRelay(e)}catch(i){return r.onError(i),i.throw()}r.onSuccess()})}stopChannelMediaRelay(){return Ee(this,null,function*(){let e=ke.reportApiInvoke(this._sessionId,{name:Ot.STOP_CHANNEL_MEDIA_RELAY,options:[],tag:bt.TRACER});try{yield this._createChannelMediaRelayClient().stopChannelMediaRelay()}catch(r){return e.onError(r),r.throw()}e.onSuccess()})}sendStreamMessage(e,r=!0){if(!this._joinInfo)throw new ue(oe.INVALID_OPERATION,"can not send data stream, not joined");if(typeof e=="string"&&(e=new TextEncoder().encode(e)),1024<new Blob([e]).size)throw new ue(oe.INVALID_PARAMS,"stream message out of range.");return this._gateway.signal.request(br.DATA_STREAM,{payload:Os(e)},!r)}sendMetadata(e){if(!this._joinInfo)throw new ue(oe.INVALID_OPERATION,"can not send metadata, not joined");if(1024<new Blob([e]).size)throw new ue(oe.METADATA_OUT_OF_RANGE);return this._gateway.signal.request(br.SEND_METADATA,{session_id:this._joinInfo.sid,metadata:Os(e)})}sendCustomReportMessage(e){return Ee(this,null,function*(){so(e)||(e=[e]),Re(e).call(e,sa);let r=ke.reportApiInvoke(this._sessionId,{name:Ot.SEND_CUSTOM_REPORT_MESSAGE,options:[ht(e)],tag:bt.TRACER});if(!this._joinInfo)return e=new ue(oe.INVALID_OPERATION,"can not send custom report, not joined"),r.onError(e),e.throw();yield ke.sendCustomReportMessage(this._joinInfo.sid,e),r.onSuccess()})}getLocalAudioStats(){if(!this._highStream)return Yl;let e=this._statsCollector.getLocalAudioTrackStats(this._highStream.connectionId);return Pt()&&this._highStream&&this._highStream.audioTrack&&(this._highStream.audioTrack instanceof bn?!this._highStream.audioTrack.isActive:!this._highStream.audioTrack.enabled)&&(e.sendVolumeLevel=0),e}getRemoteAudioStats(){var e;let r={};return Re(e=this._remoteStream).call(e,(i,o)=>{r[o]=this._statsCollector.getRemoteAudioTrackStats(i.connectionId)}),r}getLocalVideoStats(){return this._highStream?this._statsCollector.getLocalVideoTrackStats(this._highStream.connectionId):Jl}getRemoteVideoStats(){var e;let r={};return Re(e=this._remoteStream).call(e,(i,o)=>{r[o]=this._statsCollector.getRemoteVideoTrackStats(i.connectionId)}),r}getRemoteNetworkQuality(){var e;let r={};return Re(e=this._remoteStream).call(e,(i,o)=>{r[o]=this._statsCollector.getRemoteNetworkQualityStats(i.connectionId)}),r}pickSVCLayer(e,r){return Ee(this,null,function*(){ui(r.spatialLayer,"spatialLayer",[0,1,2,3]),ui(r.temporalLayer,"temporalLayer",[0,1,2,3]);try{yield this._gateway.pickSVCLayer(e,r)}catch(i){throw z.error("[".concat(this._clientId,"] pick SVC layer failed"),i.toString()),i}})}_reset(){var e,r,i;z.debug("[".concat(this._clientId,"] reset client")),this._axiosCancelSource.cancel(),this._axiosCancelSource=So.CancelToken.source(),this._streamFallbackTypeCacheMap=new Tr,this._remoteStreamTypeCacheMap=new Tr,this._configDistribute.stopGetConfigDistribute(),this._defaultStreamFallbackType=this._proxyServer=this._joinInfo=void 0,this._sessionId=null,this._statsCollector.reset(),this._channelName=this._uid=this._appId=this._key=void 0,this._encryptionMode="none",this._encryptionSalt=this._encryptionSecret=null,Re(e=this._users).call(e,o=>{o.audioTrack&&(o.audioTrack.stop(),o.audioTrack._isDestroyed=!0),o.videoTrack&&(o.videoTrack.stop(),o.videoTrack._isDestroyed=!0)}),this._users=[],this._audioVolumeIndicationInterval&&(window.clearInterval(this._audioVolumeIndicationInterval),this._audioVolumeIndicationInterval=void 0),this._highStream&&(this._highStream.closeP2PConnection(!0),this._highStream=void 0),Re(r=this._bindEnabledTracks).call(r,o=>{o.off(Ut.NEED_ADD_TRACK,this._handleLocalTrackEnable),o.off(Ut.NEED_REMOVE_TRACK,this._handleLocalTrackDisable)}),this._bindEnabledTracks=[],this._lowStream&&(this._lowStream.closeP2PConnection(!0),this._lowStream=void 0),Re(i=this._remoteStream).call(i,o=>{o.closeP2PConnection(!0)}),this._remoteStream=new Tr,this._publishMutex=new ta("client-publish"),this._subscribeMutex=new Tr,this._networkQualityInterval&&(window.clearInterval(this._networkQualityInterval),this._networkQualityInterval=void 0),this._injectStreamingClient&&(this._injectStreamingClient.terminate(),this._injectStreamingClient.removeAllListeners(),this._injectStreamingClient=void 0),this._liveRawStreamingClient&&(this._liveRawStreamingClient.terminate(),this._liveRawStreamingClient.removeAllListeners(),this._liveRawStreamingClient=void 0),this._liveTranscodeStreamingClient&&(this._liveTranscodeStreamingClient.terminate(),this._liveTranscodeStreamingClient.removeAllListeners(),this._liveTranscodeStreamingClient=void 0),this._channelMediaRelayClient&&(this._channelMediaRelayClient.dispose(),this._channelMediaRelayClient=void 0)}_startSession(e,r){var i,o,c;let h=e||be(32,"").toUpperCase();e?z.debug(ne(i="[".concat(this._clientId,"] new Session ")).call(i,h)):z.debug(ne(o=ne(c="[".concat(this._clientId,"] renewSession ")).call(c,this._sessionId," => ")).call(o,h)),this._sessionId=h,r?ke.sessionInit(this._sessionId,{lts:new Date().getTime(),cname:r.channel,appid:r.appId,mode:this._mode}):this._joinInfo?ke.sessionInit(this._sessionId,{lts:new Date().getTime(),cname:this._joinInfo.cname,appid:this._joinInfo.appId,mode:this._mode}):this._gateway.joinInfo&&ke.sessionInit(this._sessionId,{lts:new Date().getTime(),cname:this._gateway.joinInfo.cname,appid:this._gateway.joinInfo.appId,mode:this._mode}),this._joinInfo&&(this._joinInfo.sid=h),this._gateway.joinInfo&&(this._gateway.joinInfo.sid=h)}_publishHighStream(e){return Ee(this,null,function*(){if(!this._joinInfo)throw new ue(oe.INVALID_OPERATION,"Can't publish stream, haven't joined yet!");if(this.connectionState!=="CONNECTED"&&this.connectionState!=="RECONNECTING")throw new ue(oe.INVALID_OPERATION,"can not publish stream in ".concat(this.connectionState," state"));if(this._turnServer.mode==="auto"&&Xe.FORCE_TURN&&!Xe.TURN_ENABLE_TCP&&!Xe.TURN_ENABLE_UDP)throw new ue(oe.UNEXPECTED_ERROR,"force TURN With No TURN Configuration");if(z.debug("[".concat(this._clientId,"] publish high stream")),this._highStream)return yield this._highStream.addTracks(e),this._highStream;this._highStream=new Tg(this._statsCollector,this._joinInfo,this._codec),this._highStream.on(Mt.P2P_LOST,()=>{this._highStream&&this.emit(er.P2P_LOST,this._highStream.getUserId())}),yield this._highStream.addTracks(e);try{yield this._gateway.publish(this._highStream,"high")}catch(r){throw this._highStream=void 0,r}return this._highStream.on(Mt.CONNECTION_STATE_CHANGE,(r,i)=>{this._highStream&&(r==="connected"?this.emit(er.MEDIA_RECONNECT_END,this._highStream.getUserId()):r==="connecting"&&this.emit(er.MEDIA_RECONNECT_START,this._highStream.getUserId()))}),this._highStream})}_publishLowStream(e){return Ee(this,null,function*(){if(!this._joinInfo)throw new ue(oe.INVALID_OPERATION,"Can't publish stream, haven't joined yet!");if(this.connectionState!=="CONNECTED"&&this.connectionState!=="RECONNECTING")throw new ue(oe.INVALID_OPERATION,"can not publish stream in ".concat(this.connectionState," state"));if(!this._highStream||this._highStream.connectionState!=="connected")throw new ue(oe.UNEXPECTED_ERROR,"Could not find high stream");if(this._lowStream)return new ue(oe.UNEXPECTED_ERROR,"[".concat(this._clientId,"] Can't publish low stream when stream already publish")).throw();z.debug("[".concat(this._clientId,"] publish low stream")),this._lowStream=new Tg(this._statsCollector,this._joinInfo,this._codec,!0);let r=this._configDistribute.getLowStreamConfigDistribute();r&&r.bitrate&&(this._lowStreamParameter||(this._lowStreamParameter={width:160,height:120,framerate:15,bitrate:50}),this._lowStreamParameter&&this._lowStreamParameter.bitrate&&r.bitrate<this._lowStreamParameter.bitrate&&(this._lowStreamParameter.bitrate=r.bitrate)),this._lowStream.lowStreamParameter=this._lowStreamParameter,yield this._lowStream.addTracks([e]);try{yield this._gateway.publish(this._lowStream,"low")}catch(i){throw this._lowStream=void 0,i}this._highStream.lowStreamConnection=this._lowStream})}_createLiveStreamingClient(e){if(!this._joinInfo||!this._appId)return new ue(oe.INVALID_OPERATION,"can not create live streaming client, please join channel first").throw();let r=()=>new Wm(this._joinInfo,this._config.websocketRetryConfig||Ki,this._config.httpRetryConfig||Ki),i=o=>{o.onLiveStreamError=(c,h)=>{ke.reportApiInvoke(this._sessionId,{name:Ot.ON_LIVE_STREAM_ERROR,options:[c,h],tag:bt.TRACER}).onSuccess(),this.emit(er.LIVE_STREAMING_ERROR,c,h)},o.onLiveStreamWarning=(c,h)=>{ke.reportApiInvoke(this._sessionId,{name:Ot.ON_LIVE_STREAM_WARNING,options:[c,h],tag:bt.TRACER}).onSuccess(),this.emit(er.LIVE_STREAMING_WARNING,c,h)},o.on(oc.REQUEST_WORKER_MANAGER_LIST,(c,h,C)=>{if(!this._joinInfo)return C(new ue(oe.INVALID_OPERATION,"can not find join info to get worker manager"));ua(c,this._joinInfo,this._axiosCancelSource.token,Ki).then(h).catch(C)})};switch(e){case mi.RAW:return this._liveRawStreamingClient||(this._liveRawStreamingClient=r(),i(this._liveRawStreamingClient)),this._liveRawStreamingClient;case mi.TRANSCODE:return this._liveTranscodeStreamingClient||(this._liveTranscodeStreamingClient=r(),i(this._liveTranscodeStreamingClient)),this._liveTranscodeStreamingClient;case mi.INJECT:return this._injectStreamingClient||(this._injectStreamingClient=r(),this._injectStreamingClient.on(oc.REQUEST_WORKER_MANAGER_LIST,(o,c,h)=>{if(!this._joinInfo)return h(new ue(oe.INVALID_OPERATION,"can not find join info to get worker manager"));ua(o,this._joinInfo,this._axiosCancelSource.token,Ki).then(c).catch(h)}),this._injectStreamingClient.onInjectStatusChange=(o,c,h)=>{this.emit(er.INJECT_STREAM_STATUS,o,c,h)}),this._injectStreamingClient}}_createChannelMediaRelayClient(){return this._joinInfo?(this._channelMediaRelayClient||(this._channelMediaRelayClient=new Vm(this._joinInfo,this._clientId,this._config.websocketRetryConfig||Ki,this._config.httpRetryConfig||Ki),this._channelMediaRelayClient.on("state",e=>{e==="RELAY_STATE_FAILURE"&&this._channelMediaRelayClient&&this._channelMediaRelayClient.dispose(),this.emit(er.CHANNEL_MEDIA_RELAY_STATE,e)}),this._channelMediaRelayClient.on("event",e=>{this.emit(er.CHANNEL_MEDIA_RELAY_EVENT,e)})),this._channelMediaRelayClient):new ue(oe.INVALID_OPERATION,"can not create channel media relay client, please join channel first").throw()}_handleGatewayEvents(){this._gateway.on(Gi.DISCONNECT_P2P,()=>{var e;z.debug("[".concat(this._clientId,"] start full reconnect")),this._highStream&&this._highStream.connectionState!=="disconnected"&&(z.debug("[".concat(this._clientId,"] ready to reconnect high stream")),this._highStream.readyToReconnectPC()),this._lowStream&&this._lowStream.connectionState!=="disconnected"&&(z.debug("[".concat(this._clientId,"] ready to reconnect low stream")),this._lowStream.readyToReconnectPC()),Re(e=this._remoteStream).call(e,(r,i)=>{var o;z.debug(ne(o="[".concat(this._clientId,"] ready to reconnect remote stream ")).call(o,i)),r.readyToReconnectPC()})}),this._gateway.on(Gi.CONNECTION_STATE_CHANGE,(e,r,i)=>{var o,c;let h=()=>{this.emit(er.CONNECTION_STATE_CHANGE,e,r,i)};if(z.info(ne(o=ne(c="[".concat(this._clientId,"] connection state change: ")).call(c,r," -> ")).call(o,e)),e==="DISCONNECTED")return this._reset(),void h();var C,x;if(e==="RECONNECTING")this._highStream&&this._highStream.connectionState==="connecting"&&(z.debug("[".concat(this._clientId,"] ready to reconnect high stream")),this._highStream.readyToReconnectPC()),this._lowStream&&this._lowStream.connectionState==="connecting"&&(z.debug("[".concat(this._clientId,"] ready to reconnect low stream")),this._lowStream.readyToReconnectPC()),Re(C=this._remoteStream).call(C,(V,Y)=>{var $;V.connectionState==="connecting"&&(z.debug(ne($="[".concat(this._clientId,"] ready to reconnect remote stream ")).call($,Y)),V.readyToReconnectPC())}),Re(x=this._users).call(x,V=>{V._trust_in_room_=!1,V._trust_audio_enabled_state_=!1,V._trust_video_enabled_state_=!1,V._trust_audio_mute_state_=!1,V._trust_video_mute_state_=!1,V._trust_stream_added_state_=!1}),this._userOfflineTimeout&&window.clearTimeout(this._userOfflineTimeout),this._streamRemovedTimeout&&window.clearTimeout(this._streamRemovedTimeout),this._streamRemovedTimeout=this._userOfflineTimeout=void 0;else if(e==="CONNECTED"){var Q,F;Re(Q=this._streamFallbackTypeCacheMap).call(Q,(V,Y)=>{this._gateway.setStreamFallbackOption(Y,V).catch($=>z.warning("[".concat(this._clientId,"] auto set stream fallback option failed"),$))}),Re(F=this._remoteStreamTypeCacheMap).call(F,(V,Y)=>{this._gateway.setRemoteVideoStreamType(Y,V).catch($=>z.warning("[".concat(this._clientId,"] auto set remote stream type failed"),$))}),this._highStream&&this._highStream.connectionState==="connecting"?this._highStream.reconnectPC().then(()=>{this._lowStream&&this._lowStream.connectionState==="connecting"&&this._lowStream.reconnectPC().catch(V=>{z.error("[".concat(this._clientId,"] republish low stream error"),V.toString()),this.emit(er.ERROR,{reason:V})})}).catch(V=>{z.error("[".concat(this._clientId,"] republish high stream error"),V.toString()),this.emit(er.ERROR,{reason:V})}):this._lowStream&&this._lowStream.connectionState==="connecting"&&this._lowStream.reconnectPC().catch(V=>{z.error("[".concat(this._clientId,"] republish low stream error"),V.toString()),this.emit(er.ERROR,{reason:V})}),this._userOfflineTimeout=window.setTimeout(()=>{var V;if(this.connectionState==="CONNECTED"){this._userOfflineTimeout=void 0;var Y=Wt(V=this._users).call(V,$=>!$._trust_in_room_);Re(Y).call(Y,$=>{var te;z.debug(ne(te="[".concat(this._clientId,"] user offline timeout, emit user offline ")).call(te,$.uid)),this._handleUserOffline({uid:$.uid})})}},3e3),this._streamRemovedTimeout=window.setTimeout(()=>{var V;this.connectionState==="CONNECTED"&&(this._streamRemovedTimeout=void 0,Re(V=this._users).call(V,Y=>{var $,te,ce,Ae,Me;Y._trust_audio_mute_state_||(z.debug(ne($="[".concat(this._clientId,"] auto dispatch audio unmute event ")).call($,Y.uid)),this._handleMuteStream(Y.uid,"audio",!1)),Y._trust_video_mute_state_||(z.debug(ne(te="[".concat(this._clientId,"] auto dispatch video unmute event ")).call(te,Y.uid)),this._handleMuteStream(Y.uid,"video",!1)),Y._trust_audio_enabled_state_||(z.debug(ne(ce="[".concat(this._clientId,"] auto dispatch enable local audio ")).call(ce,Y.uid)),this._handleSetStreamLocalEnable("audio",Y.uid,!0)),!Y._trust_video_enabled_state_&&Y._video_enabled_&&(z.debug(ne(Ae="[".concat(this._clientId,"] auto dispatch enable local video ")).call(Ae,Y.uid)),this._handleSetStreamLocalEnable("video",Y.uid,!0)),Y._trust_stream_added_state_||(z.debug(ne(Me="[".concat(this._clientId,"] auto dispatch stream remove ")).call(Me,Y.uid)),this._handleRemoveStream({uid:Y.uid,uint_id:Y._uintid}))}))},1e3)}h()}),this._gateway.on(Gi.REQUEST_NEW_GATEWAY_LIST,(e,r)=>{if(!this._joinInfo)return r(new ue(oe.UNEXPECTED_ERROR,"can not recover, no join info"));Ns(this._joinInfo,this._axiosCancelSource.token,this._config.httpRetryConfig||Ki).then(i=>{var o;this._joinInfo&&(this._joinInfo.apResponse=i.gatewayInfo.res),e(_t(o=i.gatewayInfo.gatewayAddrs).call(o,c=>{if(this._joinInfo&&this._joinInfo.proxyServer){var h,C;return c=c.split(":"),ne(h=ne(C="wss://".concat(this._joinInfo.proxyServer,"/ws/?h=")).call(C,c[0],"&p=")).call(h,c[1])}return"wss://".concat(c)}))}).catch(r)}),this._gateway.on(Gi.NETWORK_QUALITY,e=>{this._networkQualitySensitivity==="normal"&&this.emit(er.NETWORK_QUALITY,e)}),this._gateway.on(Gi.STREAM_TYPE_CHANGE,(e,r)=>{this.emit(er.STREAM_TYPE_CHANGED,e,r),ke.reportApiInvoke(this._sessionId,{name:Ot.STREAM_TYPE_CHANGE,options:[e,r],tag:bt.TRACER}).onSuccess(ht({uid:e,streamType:r}))}),this._gateway.on(Gi.IS_P2P_DISCONNECTED,e=>{var r,i,o;let c=[];return this._highStream&&c.push(this._highStream),Re(r=this._remoteStream).call(r,h=>c.push(h)),c.length===0||Wt(c).call(c,h=>h.connectionState==="connected").length===0?e(!0):(z.debug(ne(i="[".concat(this._clientId,"] ")).call(i,_t(o=Wt(c).call(c,h=>h.connectionState==="connected")).call(o,h=>h.connectionId)," is connected")),void e(!1))}),this._gateway.on(Gi.NEED_RENEW_SESSION,()=>{this._startSession()}),this._gateway.signal.on(Cr.ON_USER_ONLINE,this._handleUserOnline),this._gateway.signal.on(Cr.ON_USER_OFFLINE,this._handleUserOffline),this._gateway.signal.on(Cr.ON_ADD_AUDIO_STREAM,e=>this._handleAddAudioOrVideoStream("audio",e.uid,e.uint_id)),this._gateway.signal.on(Cr.ON_ADD_VIDEO_STREAM,e=>this._handleAddAudioOrVideoStream("video",e.uid,e.uint_id)),this._gateway.signal.on(Cr.ON_REMOVE_STREAM,this._handleRemoveStream),this._gateway.signal.on(Cr.ON_P2P_LOST,this._handleP2PLost),this._gateway.signal.on(Cr.MUTE_AUDIO,e=>this._handleMuteStream(e.uid,"audio",!0)),this._gateway.signal.on(Cr.UNMUTE_AUDIO,e=>this._handleMuteStream(e.uid,"audio",!1)),this._gateway.signal.on(Cr.MUTE_VIDEO,e=>this._handleMuteStream(e.uid,"video",!0)),this._gateway.signal.on(Cr.UNMUTE_VIDEO,e=>this._handleMuteStream(e.uid,"video",!1)),this._gateway.signal.on(Cr.RECEIVE_METADATA,e=>{let r=qs(e.metadata);this.emit(er.RECEIVE_METADATA,e.uid,r)}),this._gateway.signal.on(Cr.ON_DATA_STREAM,e=>{e.seq&&delete e.seq,e.payload=qs(e.payload),this.emit(er.STREAM_MESSAGE,e.uid,e.payload),this.onStreamMessage&&this.onStreamMessage(e)}),this._gateway.signal.on(Cr.ON_CRYPT_ERROR,()=>{Pi(()=>{z.warning("[".concat(this._clientId,"] on crypt error")),this.emit(er.CRYPT_ERROR)},this._sessionId)}),this._gateway.signal.on(Cr.ON_TOKEN_PRIVILEGE_WILL_EXPIRE,this._handleTokenWillExpire),this._gateway.signal.on(Cr.ON_TOKEN_PRIVILEGE_DID_EXPIRE,()=>{z.warning("[".concat(this._clientId,"] received message onTokenPrivilegeDidExpire, please get new token and join again")),this._reset(),this._gateway.leave(!0),this.emit(er.ON_TOKEN_PRIVILEGE_DID_EXPIRE)}),this._gateway.signal.on(Cr.ON_STREAM_FALLBACK_UPDATE,e=>{var r,i;z.debug(ne(r=ne(i="[".concat(this._clientId,"] stream fallback peerId: ")).call(i,e.stream_id,", attr: ")).call(r,e.stream_type)),this.emit(er.STREAM_FALLBACK,e.stream_id,e.stream_type===1?"fallback":"recover")}),this._gateway.signal.on(Cr.ON_PUBLISH_STREAM,e=>{var r;this.uid===this._uid&&(this._highStream&&this._highStream._waitingSuccessResponse&&this._highStream.connectionState==="connected"?(this._highStream.reportPublishEvent(!0,null,ht({proxy:e.proxy})),z.info(ne(r="[".concat(this._clientId,"] on publish stream, ")).call(r,ht(e))),e.proxy!==void 0&&this.emit(er.IS_USING_CLOUD_PROXY,!!e.proxy)):this._lowStream?this._lowStream.reportPublishEvent(!0,null,ht({proxy:e.proxy})):z.warning("get on_publish_stream message but cannot handle"))}),this._gateway.signal.on(Cr.ENABLE_LOCAL_VIDEO,e=>{this._handleSetStreamLocalEnable("video",e.uid,!0)}),this._gateway.signal.on(Cr.DISABLE_LOCAL_VIDEO,e=>{this._handleSetStreamLocalEnable("video",e.uid,!1)}),this._gateway.signal.on(nr.REQUEST_TIMEOUT,(e,r)=>{if(this._joinInfo)switch(e){case br.PUBLISH:var i;if(!r||(e=r.stream_type==="high"?this._highStream:this._lowStream,!e))break;r.state==="offer"&&ke.publish(this._joinInfo.sid,{lts:e.startTime,succ:!1,ec:oe.TIMEOUT,audio:r.audio,video:r.video,p2pid:r.p2p_id,publishRequestid:e.ID,screenshare:!(!e.videoTrack||Vt(i=e.videoTrack._hints).call(i,oo.SCREEN_TRACK)===-1),audioName:e.audioTrack&&(e.audioTrack instanceof bn?e.audioTrack.getSubTrackLabels().join(","):e.audioTrack.getTrackLabel()),videoName:e.videoTrack&&e.videoTrack.getTrackLabel()});break;case br.SUBSCRIBE:(i=this._remoteStream.get(r.stream_id))&&r&&ke.subscribe(this._joinInfo.sid,{lts:i.startTime,succ:!1,ec:oe.TIMEOUT,audio:!!r.audio,video:!!r.video,peerid:r.stream_id,subscribeRequestid:i.ID,p2pid:i.pc.ID})}})}}sl([us({report:ke}),zn("design:type",Function),zn("design:paramtypes",[String]),zn("design:returntype",void 0)],Ac.prototype,"setProxyServer",null),sl([us(),zn("design:type",Function),zn("design:paramtypes",[Object]),zn("design:returntype",void 0)],Ac.prototype,"setTurnServer",null),sl([us({report:ke}),zn("design:type",Function),zn("design:paramtypes",[Array,String]),zn("design:returntype",void 0)],Ac.prototype,"setLocalAccessPoints",null),sl([us({report:ke}),zn("design:type",Function),zn("design:paramtypes",[String,String,Uint8Array]),zn("design:returntype",void 0)],Ac.prototype,"setEncryptionConfig",null),sl([Ao({report:ke}),zn("design:type",Function),zn("design:paramtypes",[Object,Object]),zn("design:returntype",it)],Ac.prototype,"pickSVCLayer",null);class Zm extends eA{constructor(e,r={}){super();this.currentLoopCount=this.pausePlayTime=this.startPlayOffset=this.startPlayTime=0,this._currentState="stopped",this.audioBuffer=e,this.options=r,this.startPlayOffset=this.options.startPlayTime||0}set currentState(e){e!==this._currentState&&(this._currentState=e,this.emit(Us.AUDIO_SOURCE_STATE_CHANGE,this._currentState))}get currentState(){return this._currentState}createWebAudioDiagram(){return this.context.createGain()}get duration(){return this.audioBuffer.duration}get currentTime(){return this.currentState==="stopped"?0:this.currentState==="paused"?this.pausePlayTime:(this.context.currentTime-this.startPlayTime+this.startPlayOffset)%this.audioBuffer.duration}updateOptions(e){this.currentState==="stopped"?(this.options=e,this.startPlayOffset=this.options.startPlayTime||0):z.warning("can not set audio source options")}startProcessAudioBuffer(){this.sourceNode&&this.stopProcessAudioBuffer(),this.sourceNode=this.createSourceNode(),this.startSourceNode(),this.currentState="playing"}pauseProcessAudioBuffer(){this.sourceNode&&this.currentState==="playing"&&(this.pausePlayTime=this.currentTime,this.sourceNode.onended=null,this.sourceNode.stop(),this.sourceNode.buffer=null,this.sourceNode=this.createSourceNode(),this.currentState="paused")}seekAudioBuffer(e){this.sourceNode&&(this.sourceNode.onended=null,this.currentState==="playing"&&this.sourceNode.stop(),this.sourceNode=this.createSourceNode(),this.currentState==="playing"?(this.startPlayOffset=e,this.startSourceNode()):this.currentState==="paused"&&(this.pausePlayTime=e))}resumeProcessAudioBuffer(){this.currentState==="paused"&&this.sourceNode&&(this.startPlayOffset=this.pausePlayTime,this.pausePlayTime=0,this.startSourceNode(),this.currentState="playing")}stopProcessAudioBuffer(){if(this.sourceNode){this.sourceNode.onended=null;try{this.sourceNode.stop()}catch(e){}this.reset()}}startSourceNode(){var e;this.sourceNode&&this.sourceNode.buffer&&(this.sourceNode.start(0,this.startPlayOffset),this.startPlayTime=this.context.currentTime,this.sourceNode.onended=Ti(e=this.handleSourceNodeEnded).call(e,this))}createSourceNode(){let e=this.context.createBufferSource();return e.buffer=this.audioBuffer,e.loop=!!this.options.loop,e.connect(this.outputNode),e}handleSourceNodeEnded(){if(this.currentLoopCount+=1,this.options.cycle&&this.options.cycle>this.currentLoopCount)return this.startPlayOffset=0,this.sourceNode=void 0,void this.startProcessAudioBuffer();this.reset()}reset(){this.startPlayOffset=this.options.startPlayTime||0,this.currentState="stopped",this.sourceNode&&(this.sourceNode.disconnect(),this.sourceNode=void 0),this.currentLoopCount=0}}let Lg=new Tr;var $m=Dr.setInterval;let e0=Ye().name;class ol{constructor(e,r){this.id=0,ol.count+=1,this.id=ol.count,this.element=e,this.context=r}initPeers(){this.peerPair=[new RTCPeerConnection,new RTCPeerConnection],this.peerPair[1].ontrack=e=>{let r=document.createElement("audio");r.srcObject=new MediaStream([e.track]),r.play(),this.audioPlayerElement=r}}switchSdp(){return Ee(this,null,function*(){if(this.peerPair){var e=(i,o)=>Ee(this,null,function*(){return o=o==="offer"?yield i.createOffer():yield i.createAnswer(),yield i.setLocalDescription(o),i.iceGatheringState==="complete"?i.localDescription:new it(c=>{i.onicegatheringstatechange=()=>{i.iceGatheringState==="complete"&&c(i.localDescription)}})}),r=(i,o)=>Ee(this,null,function*(){return yield i.setRemoteDescription(o)});try{let i=yield e(this.peerPair[0],"offer");yield r(this.peerPair[1],i);let o=yield e(this.peerPair[1],"answer");yield r(this.peerPair[0],o)}catch(i){throw new ue(oe.LOCAL_AEC_ERROR,i.toString()).print()}}})}getTracksFromMediaElement(e){return Ee(this,null,function*(){if(this.audioTrack)return this.audioTrack;let r;try{e instanceof HTMLVideoElement&&(e.captureStream?e.captureStream():e.mozCaptureStream()),r=this.context.createMediaStreamDestination(),this.context.createMediaElementSource(e).connect(r)}catch(i){throw new ue(oe.LOCAL_AEC_ERROR,i.toString()).print()}if(!r)throw new ue(oe.LOCAL_AEC_ERROR,"no dest node when local aec").print();return e=r.stream.getAudioTracks()[0],this.audioTrack=e,e})}getElement(){return this.element}startEchoCancellation(){return Ee(this,null,function*(){this.context.resume(),this.peerPair&&this.close(),this.initPeers();let e=yield this.getTracksFromMediaElement(this.element);this.peerPair&&this.peerPair[0].addTrack(e),yield this.switchSdp()})}close(){var e;z.debug("close echo cancellation unit, id is",this.id),this.audioPlayerElement&&this.audioPlayerElement.pause(),this.peerPair&&Re(e=this.peerPair).call(e,r=>{r.close()}),this.audioPlayerElement=this.peerPair=void 0}}ol.count=0;var th=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)};let t0=window.AudioContext||window.webkitAudioContext;class Dg{constructor(){this.units=[]}processExternalMediaAEC(e){var r;if(!this._doesEnvironmentNeedAEC())return z.debug("the system does not need to process local aec"),-1;this.context||(this.context=new t0);let i=rr(r=this.units).call(r,o=>o&&o.getElement()===e);return i||(i=new ol(e,this.context),this.units.push(i)),i.startEchoCancellation(),z.debug("start processing local audio echo cancellation, id is",i.id),i.id}_doesEnvironmentNeedAEC(){return Ye().name!==ir.SAFARI}}(function(t,e,r,i){var o,c=arguments.length,h=3>c?e:i===null?i=Ar(e,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(t,e,r,i);else for(var C=t.length-1;0<=C;C--)(o=t[C])&&(h=(3>c?o(h):3<c?o(e,r,h):o(e,r))||h);return 3<c&&h&&mr(e,r,h),h})([us({report:ke}),th("design:type",Function),th("design:paramtypes",[HTMLAudioElement]),th("design:returntype",Number)],Dg.prototype,"processExternalMediaAEC",null);let r0=new Dg;var bg,Og,Bg,Ng;Gr("PROCESS_ID",ne(bg=ne(Og=ne(Bg=ne(Ng="process-".concat(be(8,""),"-")).call(Ng,be(4,""),"-")).call(Bg,be(4,""),"-")).call(Og,be(4,""),"-")).call(bg,be(12,""))),function(){let t=Ye();var e=!!(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia);Nr.getDisplayMedia=e,Nr.getStreamFromExtension=t.name===ir.CHROME&&34<Number(t.version),Nr.supportUnifiedPlan=function(){if(!(window.RTCRtpTransceiver&&"currentDirection"in RTCRtpTransceiver.prototype))return!1;let r=new RTCPeerConnection,i=!1;try{r.addTransceiver("audio"),i=!0}catch(o){}return r.close(),i}(),Nr.supportMinBitrate=t.name===ir.CHROME||t.name===ir.EDGE,Nr.supportSetRtpSenderParameters=function(){let r=Ye();return window.RTCRtpSender&&window.RTCRtpSender.prototype.setParameters&&window.RTCRtpSender.prototype.getParameters?!!Ji()||!(!Pt()&&!st())||r.name===ir.FIREFOX&&64<=Number(r.version):!1}(),t.name===ir.SAFARI&&(14<=Number(t.version)?Nr.supportDualStream=!0:Nr.supportDualStream=!1),Nr.webAudioMediaStreamDest=function(){let r=Ye();return!(r.name===ir.SAFARI&&12>Number(r.version))}(),Nr.supportReplaceTrack=window.RTCRtpSender?typeof RTCRtpSender.prototype.replaceTrack=="function":!1,Nr.supportWebGL=typeof WebGLRenderingContext!="undefined",Nr.supportRequestFrame=!!window.CanvasCaptureMediaStreamTrack,Ji()||(Nr.webAudioWithAEC=!0),Nr.supportShareAudio=function(){let r=Ye();return(r.os===tn.WIN_10||r.os===tn.WIN_81||r.os===tn.WIN_7||r.os===tn.LINUX||r.os===tn.MAC_OS)&&r.name===ir.CHROME&&74<=Number(r.version)}(),Nr.supportDualStreamEncoding=function(){let r=Ye();return r.name==="Safari"&&14<=Number(r.version)}(),z.info("browser compatibility",ht(Nr),ht(t))}();let qn={__CLIENT_LIST__:Zo,__TRACK_LIST__:pa,VERSION:rs,BUILD:"v4.7.3-0-g0eb931c7(11/16/2021, 7:57:58 PM)",setParameter:Gr,getParameter:function(t){return Xe[t]},getSupportedCodec:function(t){return Ee(this,null,function*(){let e=null;return t?(e=new fg({}),e.addStream(t)):e=new Ag({}),t=hl(yield e.createOfferSDP()),e.close(),t})},checkSystemRequirements:function(){const t=ke.reportApiInvoke(null,{name:Ot.CHECK_SYSTEM_REQUIREMENTS,options:[],tag:bt.TRACER});var e=!1;try{var r=navigator.mediaDevices&&navigator.mediaDevices.getUserMedia,i=window.WebSocket;e=!!(window.RTCPeerConnection&&r&&i)}catch(o){return z.error("check system requirement failed: ",o),!1}return r=!1,i=Ye(),i.name===ir.CHROME&&58<=Number(i.version)&&(kn.engine.name!=="WebKit"||Ft())&&(r=!0),i.name===ir.FIREFOX&&56<=Number(i.version)&&(r=!0),i.name===ir.OPERA&&45<=Number(i.version)&&(r=!0),i.name===ir.SAFARI&&11<=Number(i.version)&&(r=!0),Ye().name!==ir.WECHAT&&Ye().name!==ir.QQ||(r=!0),z.debug("checkSystemRequirements, api:",e,"browser",r),e=e&&r,t.onSuccess(e),e},getDevices:function(t){return Jn.enumerateDevices(!0,!0,t)},getMicrophones:function(t){return Jn.getRecordingDevices(t)},getCameras:function(t){return Jn.getCamerasDevices(t)},getElectronScreenSources:go,getPlaybackDevices:function(t){return Jn.getSpeakers(t)},createClient:function(t={codec:"vp8",mode:"rtc"}){const e=ke.reportApiInvoke(null,{name:Ot.CREATE_CLIENT,options:[t],tag:bt.TRACER});try{ui(t.codec,"config.codec",["vp8","vp9","av1","h264"]),ui(t.mode,"config.mode",["rtc","live"]),t.proxyServer!==void 0&&Ur(t.proxyServer,"config.proxyServer",1,1e4),t.turnServer!==void 0&&bo(t.turnServer),t.httpRetryConfig!==void 0&&Do(t.httpRetryConfig),t.websocketRetryConfig!==void 0&&Do(t.websocketRetryConfig)}catch(r){throw e.onError(r),r}return e.onSuccess(),new Ac($s({forceWaitGatewayResponse:!0},t,{role:t.mode==="rtc"?"host":t.role}))},createCameraVideoTrack:function(){return Ee(this,arguments,function*(t={encoderConfig:"480p_1"}){const e=ke.reportApiInvoke(null,{tag:bt.TRACER,name:Ot.CREATE_CAM_VIDEO_TRACK,options:[_l({},t)]}),r=yc(t);var i=be(8,"track-cam-");let o=null;z.info("start create camera video track with config",ht(t),"trackId",i);try{o=(yield Ii({video:r},i)).getVideoTracks()[0]||null}catch(c){throw e.onError(c),c}return o?(t.optimizationMode&&Tc(i,o,t,t.encoderConfig&&kr(t.encoderConfig)),t=new rl(o,t,r,t.scalabiltyMode?gi(t.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},t.optimizationMode,i),e.onSuccess(t.getTrackId()),z.info("create camera video success, trackId:",i),t):(i=new ue(oe.UNEXPECTED_ERROR,"can not find track in media stream"),e.onError(i),i.throw())})},createCustomVideoTrack:function(t){const e=ke.reportApiInvoke(null,{tag:bt.TRACER,name:Ot.CREATE_CUSTOM_VIDEO_TRACK,options:[t]}),r=new ai(t.mediaStreamTrack,{bitrateMax:t.bitrateMax,bitrateMin:t.bitrateMin},t.scalabiltyMode?gi(t.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},t.optimizationMode);return e.onSuccess(r.getTrackId()),z.info("create custom video track success with config",t,"trackId",r.getTrackId()),r},createScreenVideoTrack:function(){return Ee(this,arguments,function*(t={},e="disable"){const r=ke.reportApiInvoke(null,{tag:bt.TRACER,name:Ot.CREATE_SCREEN_VIDEO_TRACK,options:[_l({},t),e]});t.encoderConfig?typeof t.encoderConfig=="string"||t.encoderConfig.width&&t.encoderConfig.height||(t.encoderConfig.width={max:1920},t.encoderConfig.height={max:1080}):t.encoderConfig="1080p_2";var i={};t.screenSourceType&&(i.mediaSource=t.screenSourceType),t.extensionId&&Bt()&&(i.extensionId=t.extensionId),t.electronScreenSourceId&&(i.sourceId=t.electronScreenSourceId);var o=t.encoderConfig?Bi(t.encoderConfig):null;o=(i.mandatory={chromeMediaSource:"desktop",maxWidth:o?o.width:void 0,maxHeight:o?o.height:void 0},o&&o.frameRate&&(typeof o.frameRate=="number"?(i.mandatory.maxFrameRate=o.frameRate,i.mandatory.minFrameRate=o.frameRate):(i.mandatory.maxFrameRate=o.frameRate.max||o.frameRate.ideal||o.frameRate.exact||void 0,i.mandatory.minFrameRate=o.frameRate.min||o.frameRate.ideal||o.frameRate.exact||void 0),i.frameRate=o.frameRate),o&&o.width&&(i.width=o.width),o&&o.height&&(i.height=o.height),i);const c=be(8,"track-scr");let h=null;i=null;const C=Nr;if(!C.supportShareAudio&&e==="enable")return t=new ue(oe.NOT_SUPPORTED,"your browser or platform is not support share-screen with audio"),r.onError(t),t.throw();z.info("start create screen video track with config",t,"withAudio",e,"trackId",c);try{const x=yield Ii({screen:o,screenAudio:e==="auto"?C.supportShareAudio:e==="enable"},c);h=x.getVideoTracks()[0]||null,i=x.getAudioTracks()[0]||null}catch(x){throw r.onError(x),x}return h?!i&&e==="enable"?(h&&h.stop(),t=new ue(oe.SHARE_AUDIO_NOT_ALLOWED),r.onError(t),t.throw()):(t.optimizationMode||(t.optimizationMode="detail"),t.optimizationMode&&(Tc(c,h,t,t.encoderConfig&&Bi(t.encoderConfig)),t.encoderConfig&&typeof t.encoderConfig!="string"&&(t.encoderConfig.bitrateMin=t.encoderConfig.bitrateMax)),t=new ai(h,t.encoderConfig?Bi(t.encoderConfig):{},t.scalabiltyMode?gi(t.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},t.optimizationMode,c),t._hints.push(oo.SCREEN_TRACK),i?(e=new ji(i),r.onSuccess([t.getTrackId(),e.getTrackId()]),z.info("create screen video track success","video:",t.getTrackId(),"audio:",e.getTrackId()),[t,e]):(r.onSuccess(t.getTrackId()),z.info("create screen video track success","video:",t.getTrackId()),t)):(t=new ue(oe.UNEXPECTED_ERROR,"can not find track in media stream"),r.onError(t),t.throw())})},createMicrophoneAndCameraTracks:function(){return Ee(this,arguments,function*(t={},e={encoderConfig:"480p_1"}){var r,i,o;const c=ke.reportApiInvoke(null,{tag:bt.TRACER,name:Ot.CREATE_MIC_AND_CAM_TRACKS,options:[t,e]}),h=yc(e),C=ul(t),x=be(8,"track-mic-"),Q=be(8,"track-cam-");let F=null,V=null;z.info(ne(r=ne(i=ne(o="start create camera video track(".concat(Q,") and microphone audio track(")).call(o,x,") with config, audio: ")).call(i,ht(t),", video: ")).call(r,ht(e)));try{var Y;const te=yield Ii({audio:C,video:h},ne(Y="".concat(x,"-")).call(Y,Q));F=te.getAudioTracks()[0],V=te.getVideoTracks()[0]}catch(te){throw c.onError(te),te}if(!F||!V){var $=new ue(oe.UNEXPECTED_ERROR,"can not find tracks in media stream");return c.onError($),$.throw()}return e.optimizationMode&&Tc(Q,V,e,e.encoderConfig&&kr(e.encoderConfig)),t=new Jc(F,t,C,x),e=new rl(V,e,h,e.scalabiltyMode?gi(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,Q),c.onSuccess([t.getTrackId(),e.getTrackId()]),z.info(ne($="create camera video track(".concat(Q,") and microphone audio track(")).call($,x,") success")),[t,e]})},createMicrophoneAudioTrack:function(){return Ee(this,arguments,function*(t={}){const e=ke.reportApiInvoke(null,{tag:bt.TRACER,name:Ot.CREATE_MIC_AUDIO_TRACK,options:[t]}),r=ul(t);var i=be(8,"track-mic-");let o=null;z.info("start create microphone audio track with config",ht(t),"trackId",i);try{o=(yield Ii({audio:r},i)).getAudioTracks()[0]||null}catch(c){throw e.onError(c),c}return o?(t=new Jc(o,t,r,i),e.onSuccess(t.getTrackId()),z.info("create microphone audio track success, trackId:",i),t):(i=new ue(oe.UNEXPECTED_ERROR,"can not find track in media stream"),e.onError(i),i.throw())})},createCustomAudioTrack:function(t){const e=ke.reportApiInvoke(null,{tag:bt.TRACER,name:Ot.CREATE_CUSTOM_AUDIO_TRACK,options:[t]}),r=new ji(t.mediaStreamTrack,t.encoderConfig?Ei(t.encoderConfig):{});return z.info("create custom audio track success with config",t,"trackId",r.getTrackId()),e.onSuccess(r.getTrackId()),r},createBufferSourceAudioTrack:function(t){return Ee(this,null,function*(){const e=ke.reportApiInvoke(null,{tag:bt.TRACER,name:Ot.CREATE_BUFFER_AUDIO_TRACK,options:[t]}),r=be(8,"track-buf-");z.info("start create buffer source audio track with config",ht(t),"trackId",r);const i=t.source;if(!(t.source instanceof AudioBuffer))try{t.source=yield vu(t.source,t.cacheOnlineFile)}catch(c){return e.onError(c),c.throw()}const o=new Zm(t.source);return t=new cc(i,o,t.encoderConfig?Ei(t.encoderConfig):{},r),z.info("create buffer source audio track success, trackId:",r),e.onSuccess(t.getTrackId()),t})},setLogLevel:function(t){z.setLogLevel(t)},enableLogUpload:function(){z.enableLogUpload()},disableLogUpload:function(){z.disableLogUpload()},createChannelMediaRelayConfiguration:function(){return new wg},checkAudioTrackIsActive:function(t,e=5e3){return Ee(this,null,function*(){const r=ke.reportApiInvoke(null,{tag:bt.TRACER,name:Ot.CHECK_AUDIO_TRACK_IS_ACTIVE,options:[e]});if(!(t instanceof ji||t instanceof nl)){var i=new ue(oe.INVALID_TRACK,"the parameter is not a audio track");return r.onError(i),i.throw()}e&&1e3>e&&(e=1e3);const o=t instanceof ji?t.getTrackLabel():"remote_track";let c=i=t.getVolumeLevel(),h=i;const C=at();return new it(x=>{const Q=$m(()=>{var F=t.getVolumeLevel();c=F>c?F:c,h=F<h?F:h,F=1e-4<c-h;var V=at()-C;if(F||V>e){var Y;clearInterval(Q),V={duration:V,deviceLabel:o,maxVolumeLevel:c,result:F},z.info(ne(Y="[track-".concat(t.getTrackId(),"] check audio track active completed. ")).call(Y,ht(V))),r.onSuccess(V),x(F)}},200)})})},checkVideoTrackIsActive:function(t,e=5e3){return Ee(this,null,function*(){var r;const i=ke.reportApiInvoke(null,{tag:bt.TRACER,name:Ot.CHECK_VIDEO_TRACK_IS_ACTIVE,options:[e]});if(!(t instanceof ai||t instanceof il))return t=new ue(oe.INVALID_TRACK,"the parameter is not a video track"),i.onError(t),t.throw();e&&1e3>e&&(e=1e3);var o=t instanceof ai?t.getTrackLabel():"remote_track",c=t.getMediaStreamTrack(!0);const h=document.createElement("video");h.style.width="1px",h.style.height="1px",h.setAttribute("muted",""),h.muted=!0,h.setAttribute("playsinline",""),h.controls=!1,(Pt()||st())&&(h.style.opacity="0.01",h.style.position="fixed",h.style.left="0",h.style.top="0",document.body.appendChild(h)),h.srcObject=new MediaStream([c]),h.play();const C=document.createElement("canvas");C.width=160,C.height=120;let x=c=0;try{const Q=at();c=yield function(F,V,Y,$){let te,ce=0,Ae=null;return new it((Me,et)=>{_s(()=>{te&&(te(),Me(ce))},V),te=js(()=>{e:{ce>$&&te&&(te(),Me(ce));var pt=Y.getContext("2d");if(pt){pt.drawImage(F,0,0,160,120),pt=pt.getImageData(0,0,Y.width,Y.height);var Qt=Math.floor(pt.data.length/3);if(Ae){for(let kt=0;kt<Qt;kt+=3)if(pt.data[kt]!==Ae[kt]){ce+=1,Ae=pt.data;break e}}Ae=pt.data}else pt=new ue(oe.UNEXPECTED_ERROR,"can not get canvas 2d context."),z.error(pt.toString()),et(pt)}},30)})}(h,e,C,4),x=at()-Q}catch(Q){throw i.onError(Q),Q}return e0===ir.SAFARI&&(h.pause(),h.remove()),h.srcObject=null,e=4<c,o={duration:x,changedPicNum:c,deviceLabel:o,result:e},z.info(ne(r="[track-".concat(t.getTrackId(),"] check video track active completed. ")).call(r,ht(o))),i.onSuccess(o),e})},setArea:function(t){const e=ke.reportApiInvoke(null,{name:Ot.SET_AREA,options:t,tag:bt.TRACER});try{var r;let i=[];if(typeof t=="string"&&(i=[t]),so(t)&&(Re(t).call(t,c=>{if(!_r(kf).call(kf,c))throw new ue(oe.INVALID_PARAMS,"invalid area code")}),i=t),Object.prototype.toString.call(t)==="[object Object]"){const{areaCode:c,excludedArea:h}=t;if(!c)throw new ue(oe.INVALID_PARAMS,"area code is needed");t=c,typeof c=="string"&&(t=[c]),i=h?ym(t,h):t}Gr("AREAS",i);const o=(c=>{const h={CODE:"",WEBCS_DOMAIN:[],WEBCS_DOMAIN_BACKUP_LIST:[],PROXY_CS:[],CDS_AP:[],ACCOUNT_REGISTER:[],UAP_AP:[],EVENT_REPORT_DOMAIN:[],EVENT_REPORT_BACKUP_DOMAIN:[],LOG_UPLOAD_SERVER:[],PROXY_SERVER_TYPE3:[]};return _t(c).call(c,C=>{const x=Ad[C];(C=vr(x))&&_t(C).call(C,Q=>{var F;Q!=="CODE"&&(h[Q]=ne(F=h[Q]).call(F,x[Q]))})}),h})(i);_t(r=vr(o)).call(r,c=>{c==="LOG_UPLOAD_SERVER"||c==="EVENT_REPORT_DOMAIN"||c==="EVENT_REPORT_BACKUP_DOMAIN"||c==="PROXY_SERVER_TYPE3"?Gr(c,o[c][0]):Gr(c,o[c])}),z.debug("set area success:",i.join(","))}catch(i){throw e.onError(i),i}e.onSuccess()},loadModule:function(t,e){return Ee(this,null,function*(){var r;if(z.debug(ne(r="loadModule: ".concat(t.name,", loadOption: ")).call(r,ht(e))),!t.moduleInit)throw z.debug("Invalid Plugin"),new ue(oe.INVALID_PLUGIN,"invalid plugin");try{yield t.moduleInit({logger:z,report:ke},e)}catch(i){throw new ue(oe.UNEXPECTED_ERROR,"unexpected error in loadModule",i)}})},processExternalMediaAEC:function(t){r0.processExternalMediaAEC(t)}};return Jn.on($o.CAMERA_DEVICE_CHANGED,t=>{z.info("camera device changed",ht(t)),qn.onCameraChanged&&qn.onCameraChanged(t)}),Jn.on($o.RECORDING_DEVICE_CHANGED,t=>{z.info("microphone device changed",ht(t)),qn.onMicrophoneChanged&&qn.onMicrophoneChanged(t)}),Jn.on($o.PLAYOUT_DEVICE_CHANGED,t=>{z.debug("playout device changed",ht(t)),qn.onPlaybackDeviceChanged&&qn.onPlaybackDeviceChanged(t)}),ys.onAutoplayFailed=()=>{z.info("detect audio element autoplay failed"),qn.onAudioAutoplayFailed&&qn.onAudioAutoplayFailed()},hr.on("autoplay-failed",()=>{z.info("detect webaudio autoplay failed"),qn.onAudioAutoplayFailed&&qn.onAudioAutoplayFailed()}),oA.on("autoplay-failed",()=>{z.info("detect media autoplay failed, document: https://docs.agora.io/cn/Voice/autoplay_policy_web_ng?platform=Web"),qn.onAutoplayFailed?qn.onAutoplayFailed():qn.onAudioAutoplayFailed?z.warning(`AgoraRTC.onAudioAutoplayFailed has been deprecated in favor of AgoraRTC.onAutoplayFailed.
|
|
137
|
+
|
|
138
|
+
Please refer to the Agora document to migrate the newer API, https://docs.agora.io/en/Voice/autoplay_policy_web_ng?platform=Web .`):z.warning(`We have detected a media autoplay failed event, and found out that you haven't implemented AgoraRTC.onAutoplayFailed callback yet.
|
|
139
|
+
|
|
140
|
+
It will cause audio/video element not playing automatically on some browsers without user interaction, possibly hurting user experiences.
|
|
141
|
+
|
|
142
|
+
Please refer to the Agora document to properly handle autoplay failed event, https://docs.agora.io/en/Voice/autoplay_policy_web_ng?platform=Web .`)}),window&&(window.__ARTC__=qn),qn})},88711:function(Ne){typeof window!="undefined"&&function(H,k){Ne.exports=k()}(this,function(){return function(de){var H={};function k(j){if(H[j])return H[j].exports;var N=H[j]={i:j,l:!1,exports:{}};return de[j].call(N.exports,N,N.exports,k),N.l=!0,N.exports}return k.m=de,k.c=H,k.d=function(j,N,v){k.o(j,N)||Object.defineProperty(j,N,{enumerable:!0,get:v})},k.r=function(j){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(j,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(j,"__esModule",{value:!0})},k.t=function(j,N){if(N&1&&(j=k(j)),N&8||N&4&&typeof j=="object"&&j&&j.__esModule)return j;var v=Object.create(null);if(k.r(v),Object.defineProperty(v,"default",{enumerable:!0,value:j}),N&2&&typeof j!="string")for(var L in j)k.d(v,L,function(O){return j[O]}.bind(null,L));return v},k.n=function(j){var N=j&&j.__esModule?function(){return j.default}:function(){return j};return k.d(N,"a",N),N},k.o=function(j,N){return Object.prototype.hasOwnProperty.call(j,N)},k.p="/dist/",k(k.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(de,H,k){"use strict";var j=Object.prototype.hasOwnProperty,N="~";function v(){}Object.create&&(v.prototype=Object.create(null),new v().__proto__||(N=!1));function L(g,b,T){this.fn=g,this.context=b,this.once=T||!1}function O(g,b,T,f,p){if(typeof T!="function")throw new TypeError("The listener must be a function");var E=new L(T,f||g,p),u=N?N+b:b;return g._events[u]?g._events[u].fn?g._events[u]=[g._events[u],E]:g._events[u].push(E):(g._events[u]=E,g._eventsCount++),g}function D(g,b){--g._eventsCount===0?g._events=new v:delete g._events[b]}function w(){this._events=new v,this._eventsCount=0}w.prototype.eventNames=function(){var b=[],T,f;if(this._eventsCount===0)return b;for(f in T=this._events)j.call(T,f)&&b.push(N?f.slice(1):f);return Object.getOwnPropertySymbols?b.concat(Object.getOwnPropertySymbols(T)):b},w.prototype.listeners=function(b){var T=N?N+b:b,f=this._events[T];if(!f)return[];if(f.fn)return[f.fn];for(var p=0,E=f.length,u=new Array(E);p<E;p++)u[p]=f[p].fn;return u},w.prototype.listenerCount=function(b){var T=N?N+b:b,f=this._events[T];return f?f.fn?1:f.length:0},w.prototype.emit=function(b,T,f,p,E,u){var a=N?N+b:b;if(!this._events[a])return!1;var n=this._events[a],s=arguments.length,l,d;if(n.fn){switch(n.once&&this.removeListener(b,n.fn,void 0,!0),s){case 1:return n.fn.call(n.context),!0;case 2:return n.fn.call(n.context,T),!0;case 3:return n.fn.call(n.context,T,f),!0;case 4:return n.fn.call(n.context,T,f,p),!0;case 5:return n.fn.call(n.context,T,f,p,E),!0;case 6:return n.fn.call(n.context,T,f,p,E,u),!0}for(d=1,l=new Array(s-1);d<s;d++)l[d-1]=arguments[d];n.fn.apply(n.context,l)}else{var A=n.length,S;for(d=0;d<A;d++)switch(n[d].once&&this.removeListener(b,n[d].fn,void 0,!0),s){case 1:n[d].fn.call(n[d].context);break;case 2:n[d].fn.call(n[d].context,T);break;case 3:n[d].fn.call(n[d].context,T,f);break;case 4:n[d].fn.call(n[d].context,T,f,p);break;default:if(!l)for(S=1,l=new Array(s-1);S<s;S++)l[S-1]=arguments[S];n[d].fn.apply(n[d].context,l)}}return!0},w.prototype.on=function(b,T,f){return O(this,b,T,f,!1)},w.prototype.once=function(b,T,f){return O(this,b,T,f,!0)},w.prototype.removeListener=function(b,T,f,p){var E=N?N+b:b;if(!this._events[E])return this;if(!T)return D(this,E),this;var u=this._events[E];if(u.fn)u.fn===T&&(!p||u.once)&&(!f||u.context===f)&&D(this,E);else{for(var a=0,n=[],s=u.length;a<s;a++)(u[a].fn!==T||p&&!u[a].once||f&&u[a].context!==f)&&n.push(u[a]);n.length?this._events[E]=n.length===1?n[0]:n:D(this,E)}return this},w.prototype.removeAllListeners=function(b){var T;return b?(T=N?N+b:b,this._events[T]&&D(this,T)):(this._events=new v,this._eventsCount=0),this},w.prototype.off=w.prototype.removeListener,w.prototype.addListener=w.prototype.on,w.prefixed=N,w.EventEmitter=w,de.exports=w},"./node_modules/url-toolkit/src/url-toolkit.js":function(de,H,k){(function(j){var N=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,v=/^([^\/?#]*)([^]*)$/,L=/(?:\/|^)\.(?=\/)/g,O=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,D={buildAbsoluteURL:function(w,g,b){if(b=b||{},w=w.trim(),g=g.trim(),!g){if(!b.alwaysNormalize)return w;var T=D.parseURL(w);if(!T)throw new Error("Error trying to parse base URL.");return T.path=D.normalizePath(T.path),D.buildURLFromParts(T)}var f=D.parseURL(g);if(!f)throw new Error("Error trying to parse relative URL.");if(f.scheme)return b.alwaysNormalize?(f.path=D.normalizePath(f.path),D.buildURLFromParts(f)):g;var p=D.parseURL(w);if(!p)throw new Error("Error trying to parse base URL.");if(!p.netLoc&&p.path&&p.path[0]!=="/"){var E=v.exec(p.path);p.netLoc=E[1],p.path=E[2]}p.netLoc&&!p.path&&(p.path="/");var u={scheme:p.scheme,netLoc:f.netLoc,path:null,params:f.params,query:f.query,fragment:f.fragment};if(!f.netLoc&&(u.netLoc=p.netLoc,f.path[0]!=="/"))if(!f.path)u.path=p.path,f.params||(u.params=p.params,f.query||(u.query=p.query));else{var a=p.path,n=a.substring(0,a.lastIndexOf("/")+1)+f.path;u.path=D.normalizePath(n)}return u.path===null&&(u.path=b.alwaysNormalize?D.normalizePath(f.path):f.path),D.buildURLFromParts(u)},parseURL:function(w){var g=N.exec(w);return g?{scheme:g[1]||"",netLoc:g[2]||"",path:g[3]||"",params:g[4]||"",query:g[5]||"",fragment:g[6]||""}:null},normalizePath:function(w){for(w=w.split("").reverse().join("").replace(L,"");w.length!==(w=w.replace(O,"")).length;);return w.split("").reverse().join("")},buildURLFromParts:function(w){return w.scheme+w.netLoc+w.path+w.params+w.query+w.fragment}};de.exports=D})(this)},"./node_modules/webworkify-webpack/index.js":function(de,H,k){function j(b){var T={};function f(E){if(T[E])return T[E].exports;var u=T[E]={i:E,l:!1,exports:{}};return b[E].call(u.exports,u,u.exports,f),u.l=!0,u.exports}f.m=b,f.c=T,f.i=function(E){return E},f.d=function(E,u,a){f.o(E,u)||Object.defineProperty(E,u,{configurable:!1,enumerable:!0,get:a})},f.r=function(E){Object.defineProperty(E,"__esModule",{value:!0})},f.n=function(E){var u=E&&E.__esModule?function(){return E.default}:function(){return E};return f.d(u,"a",u),u},f.o=function(E,u){return Object.prototype.hasOwnProperty.call(E,u)},f.p="/",f.oe=function(E){throw console.error(E),E};var p=f(f.s=ENTRY_MODULE);return p.default||p}var N="[\\.|\\-|\\+|\\w|/|@]+",v="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+N+").*?\\)";function L(b){return(b+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function O(b){return!isNaN(1*b)}function D(b,T,f){var p={};p[f]=[];var E=T.toString(),u=E.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!u)return p;for(var a=u[1],n=new RegExp("(\\\\n|\\W)"+L(a)+v,"g"),s;s=n.exec(E);)s[3]!=="dll-reference"&&p[f].push(s[3]);for(n=new RegExp("\\("+L(a)+'\\("(dll-reference\\s('+N+'))"\\)\\)'+v,"g");s=n.exec(E);)b[s[2]]||(p[f].push(s[1]),b[s[2]]=k(s[1]).m),p[s[2]]=p[s[2]]||[],p[s[2]].push(s[4]);for(var l=Object.keys(p),d=0;d<l.length;d++)for(var A=0;A<p[l[d]].length;A++)O(p[l[d]][A])&&(p[l[d]][A]=1*p[l[d]][A]);return p}function w(b){var T=Object.keys(b);return T.reduce(function(f,p){return f||b[p].length>0},!1)}function g(b,T){for(var f={main:[T]},p={main:[]},E={main:{}};w(f);)for(var u=Object.keys(f),a=0;a<u.length;a++){var n=u[a],s=f[n],l=s.pop();if(E[n]=E[n]||{},!(E[n][l]||!b[n][l])){E[n][l]=!0,p[n]=p[n]||[],p[n].push(l);for(var d=D(b,b[n][l],n),A=Object.keys(d),S=0;S<A.length;S++)f[A[S]]=f[A[S]]||[],f[A[S]]=f[A[S]].concat(d[A[S]])}}return p}de.exports=function(b,T){T=T||{};var f={main:k.m},p=T.all?{main:Object.keys(f.main)}:g(f,b),E="";Object.keys(p).filter(function(l){return l!=="main"}).forEach(function(l){for(var d=0;p[l][d];)d++;p[l].push(d),f[l][d]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",E=E+"var "+l+" = ("+j.toString().replace("ENTRY_MODULE",JSON.stringify(d))+")({"+p[l].map(function(A){return""+JSON.stringify(A)+": "+f[l][A].toString()}).join(",")+`});
|
|
143
|
+
`}),E=E+"new (("+j.toString().replace("ENTRY_MODULE",JSON.stringify(b))+")({"+p.main.map(function(l){return""+JSON.stringify(l)+": "+f.main[l].toString()}).join(",")+"}))(self);";var u=new window.Blob([E],{type:"text/javascript"});if(T.bare)return u;var a=window.URL||window.webkitURL||window.mozURL||window.msURL,n=a.createObjectURL(u),s=new window.Worker(n);return s.objectURL=n,s}},"./src/config.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"hlsDefaultConfig",function(){return S}),k.d(H,"mergeConfig",function(){return y}),k.d(H,"enableStreamingMode",function(){return _});var j=k("./src/controller/abr-controller.ts"),N=k("./src/controller/audio-stream-controller.ts"),v=k("./src/controller/audio-track-controller.ts"),L=k("./src/controller/subtitle-stream-controller.ts"),O=k("./src/controller/subtitle-track-controller.ts"),D=k("./src/controller/buffer-controller.ts"),w=k("./src/controller/timeline-controller.ts"),g=k("./src/controller/cap-level-controller.ts"),b=k("./src/controller/fps-controller.ts"),T=k("./src/controller/eme-controller.ts"),f=k("./src/controller/cmcd-controller.ts"),p=k("./src/utils/xhr-loader.ts"),E=k("./src/utils/fetch-loader.ts"),u=k("./src/utils/cues.ts"),a=k("./src/utils/mediakeys-helper.ts"),n=k("./src/utils/logger.ts");function s(){return s=Object.assign||function(m){for(var I=1;I<arguments.length;I++){var B=arguments[I];for(var P in B)Object.prototype.hasOwnProperty.call(B,P)&&(m[P]=B[P])}return m},s.apply(this,arguments)}function l(m,I){var B=Object.keys(m);if(Object.getOwnPropertySymbols){var P=Object.getOwnPropertySymbols(m);I&&(P=P.filter(function(M){return Object.getOwnPropertyDescriptor(m,M).enumerable})),B.push.apply(B,P)}return B}function d(m){for(var I=1;I<arguments.length;I++){var B=arguments[I]!=null?arguments[I]:{};I%2?l(Object(B),!0).forEach(function(P){A(m,P,B[P])}):Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(B)):l(Object(B)).forEach(function(P){Object.defineProperty(m,P,Object.getOwnPropertyDescriptor(B,P))})}return m}function A(m,I,B){return I in m?Object.defineProperty(m,I,{value:B,enumerable:!0,configurable:!0,writable:!0}):m[I]=B,m}var S=d(d({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:p.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:j.default,bufferController:D.default,capLevelController:g.default,fpsController:b.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:a.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},R()),{},{subtitleStreamController:L.SubtitleStreamController,subtitleTrackController:O.default,timelineController:w.TimelineController,audioStreamController:N.default,audioTrackController:v.default,emeController:T.default,cmcdController:f.default});function R(){return{cueHandler:u.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function y(m,I){if((I.liveSyncDurationCount||I.liveMaxLatencyDurationCount)&&(I.liveSyncDuration||I.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(I.liveMaxLatencyDurationCount!==void 0&&(I.liveSyncDurationCount===void 0||I.liveMaxLatencyDurationCount<=I.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(I.liveMaxLatencyDuration!==void 0&&(I.liveSyncDuration===void 0||I.liveMaxLatencyDuration<=I.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return s({},m,I)}function _(m){var I=m.loader;if(I!==E.default&&I!==p.default)n.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),m.progressive=!1;else{var B=Object(E.fetchSupported)();B&&(m.loader=E.default,m.progressive=!0,m.enableSoftwareAES=!0,n.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(de,H,k){"use strict";k.r(H);var j=k("./src/polyfills/number.ts"),N=k("./src/utils/ewma-bandwidth-estimator.ts"),v=k("./src/events.ts"),L=k("./src/utils/buffer-helper.ts"),O=k("./src/errors.ts"),D=k("./src/types/loader.ts"),w=k("./src/utils/logger.ts");function g(f,p){for(var E=0;E<p.length;E++){var u=p[E];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(f,u.key,u)}}function b(f,p,E){return p&&g(f.prototype,p),E&&g(f,E),f}var T=function(){function f(E){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=E;var u=E.config;this.bwEstimator=new N.default(u.abrEwmaSlowVoD,u.abrEwmaFastVoD,u.abrEwmaDefaultEstimate),this.registerListeners()}var p=f.prototype;return p.registerListeners=function(){var u=this.hls;u.on(v.Events.FRAG_LOADING,this.onFragLoading,this),u.on(v.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(v.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.on(v.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(v.Events.ERROR,this.onError,this)},p.unregisterListeners=function(){var u=this.hls;u.off(v.Events.FRAG_LOADING,this.onFragLoading,this),u.off(v.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(v.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.off(v.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(v.Events.ERROR,this.onError,this)},p.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},p.onFragLoading=function(u,a){var n=a.frag;if(n.type===D.PlaylistLevelType.MAIN&&!this.timer){var s;this.fragCurrent=n,this.partCurrent=(s=a.part)!=null?s:null,this.timer=self.setInterval(this.onCheck,100)}},p.onLevelLoaded=function(u,a){var n=this.hls.config;a.details.live?this.bwEstimator.update(n.abrEwmaSlowLive,n.abrEwmaFastLive):this.bwEstimator.update(n.abrEwmaSlowVoD,n.abrEwmaFastVoD)},p._abandonRulesCheck=function(){var u=this.fragCurrent,a=this.partCurrent,n=this.hls,s=n.autoLevelEnabled,l=n.config,d=n.media;if(!(!u||!d)){var A=a?a.stats:u.stats,S=a?a.duration:u.duration;if(A.aborted){w.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!(!s||d.paused||!d.playbackRate||!d.readyState)){var R=performance.now()-A.loading.start,y=Math.abs(d.playbackRate);if(!(R<=500*S/y)){var _=n.levels,m=n.minAutoLevel,I=_[u.level],B=A.total||Math.max(A.loaded,Math.round(S*I.maxBitrate/8)),P=Math.max(1,A.bwEstimate?A.bwEstimate/8:A.loaded*1e3/R),M=(B-A.loaded)/P,U=d.currentTime,K=(L.BufferHelper.bufferInfo(d,U,l.maxBufferHole).end-U)/y;if(!(K>=2*S/y||M<=K)){var W=Number.POSITIVE_INFINITY,X;for(X=u.level-1;X>m;X--){var ie=_[X].maxBitrate;if(W=S*ie/(8*.8*P),W<K)break}if(!(W>=M)){var se=this.bwEstimator.getEstimate();w.logger.warn("Fragment "+u.sn+(a?" part "+a.index:"")+" of level "+u.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+X+`
|
|
144
|
+
Current BW estimate: `+(Object(j.isFiniteNumber)(se)?(se/1024).toFixed(3):"Unknown")+` Kb/s
|
|
145
|
+
Estimated load time for current fragment: `+M.toFixed(3)+` s
|
|
146
|
+
Estimated load time for the next fragment: `+W.toFixed(3)+` s
|
|
147
|
+
Time to underbuffer: `+K.toFixed(3)+" s"),n.nextLoadLevel=X,this.bwEstimator.sample(R,A.loaded),this.clearTimer(),u.loader&&(this.fragCurrent=this.partCurrent=null,u.loader.abort()),n.trigger(v.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:u,part:a,stats:A})}}}}}},p.onFragLoaded=function(u,a){var n=a.frag,s=a.part;if(n.type===D.PlaylistLevelType.MAIN&&Object(j.isFiniteNumber)(n.sn)){var l=s?s.stats:n.stats,d=s?s.duration:n.duration;if(this.clearTimer(),this.lastLoadedFragLevel=n.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var A=this.hls.levels[n.level],S=(A.loaded?A.loaded.bytes:0)+l.loaded,R=(A.loaded?A.loaded.duration:0)+d;A.loaded={bytes:S,duration:R},A.realBitrate=Math.round(8*S/R)}if(n.bitrateTest){var y={stats:l,frag:n,part:s,id:n.type};this.onFragBuffered(v.Events.FRAG_BUFFERED,y),n.bitrateTest=!1}}},p.onFragBuffered=function(u,a){var n=a.frag,s=a.part,l=s?s.stats:n.stats;if(!l.aborted&&!(n.type!==D.PlaylistLevelType.MAIN||n.sn==="initSegment")){var d=l.parsing.end-l.loading.start;this.bwEstimator.sample(d,l.loaded),l.bwEstimate=this.bwEstimator.getEstimate(),n.bitrateTest?this.bitrateTestDelay=d/1e3:this.bitrateTestDelay=0}},p.onError=function(u,a){switch(a.details){case O.ErrorDetails.FRAG_LOAD_ERROR:case O.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},p.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},p.getNextABRAutoLevel=function(){var u=this.fragCurrent,a=this.partCurrent,n=this.hls,s=n.maxAutoLevel,l=n.config,d=n.minAutoLevel,A=n.media,S=a?a.duration:u?u.duration:0,R=A?A.currentTime:0,y=A&&A.playbackRate!==0?Math.abs(A.playbackRate):1,_=this.bwEstimator?this.bwEstimator.getEstimate():l.abrEwmaDefaultEstimate,m=(L.BufferHelper.bufferInfo(A,R,l.maxBufferHole).end-R)/y,I=this.findBestLevel(_,d,s,m,l.abrBandWidthFactor,l.abrBandWidthUpFactor);if(I>=0)return I;w.logger.trace((m?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var B=S?Math.min(S,l.maxStarvationDelay):l.maxStarvationDelay,P=l.abrBandWidthFactor,M=l.abrBandWidthUpFactor;if(!m){var U=this.bitrateTestDelay;if(U){var K=S?Math.min(S,l.maxLoadingDelay):l.maxLoadingDelay;B=K-U,w.logger.trace("bitrate test took "+Math.round(1e3*U)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*B)+" ms"),P=M=1}}return I=this.findBestLevel(_,d,s,m+B,P,M),Math.max(I,0)},p.findBestLevel=function(u,a,n,s,l,d){for(var A,S=this.fragCurrent,R=this.partCurrent,y=this.lastLoadedFragLevel,_=this.hls.levels,m=_[y],I=!!(m!=null&&(A=m.details)!==null&&A!==void 0&&A.live),B=m==null?void 0:m.codecSet,P=R?R.duration:S?S.duration:0,M=n;M>=a;M--){var U=_[M];if(!(!U||B&&U.codecSet!==B)){var K=U.details,W=(R?K==null?void 0:K.partTarget:K==null?void 0:K.averagetargetduration)||P,X=void 0;M<=y?X=l*u:X=d*u;var ie=_[M].maxBitrate,se=ie*W/X;if(w.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+M+"/"+Math.round(X)+"/"+ie+"/"+W+"/"+s+"/"+se),X>ie&&(!se||I&&!this.bitrateTestDelay||se<s))return M}}return-1},b(f,[{key:"nextAutoLevel",get:function(){var u=this._nextAutoLevel,a=this.bwEstimator;if(u!==-1&&(!a||!a.canEstimate()))return u;var n=this.getNextABRAutoLevel();return u!==-1&&(n=Math.min(u,n)),n},set:function(u){this._nextAutoLevel=u}}]),f}();H.default=T},"./src/controller/audio-stream-controller.ts":function(de,H,k){"use strict";k.r(H);var j=k("./src/polyfills/number.ts"),N=k("./src/controller/base-stream-controller.ts"),v=k("./src/events.ts"),L=k("./src/utils/buffer-helper.ts"),O=k("./src/controller/fragment-tracker.ts"),D=k("./src/types/level.ts"),w=k("./src/types/loader.ts"),g=k("./src/loader/fragment.ts"),b=k("./src/demux/chunk-cache.ts"),T=k("./src/demux/transmuxer-interface.ts"),f=k("./src/types/transmuxer.ts"),p=k("./src/controller/fragment-finders.ts"),E=k("./src/utils/discontinuities.ts"),u=k("./src/errors.ts"),a=k("./src/utils/logger.ts");function n(){return n=Object.assign||function(S){for(var R=1;R<arguments.length;R++){var y=arguments[R];for(var _ in y)Object.prototype.hasOwnProperty.call(y,_)&&(S[_]=y[_])}return S},n.apply(this,arguments)}function s(S,R){S.prototype=Object.create(R.prototype),S.prototype.constructor=S,l(S,R)}function l(S,R){return l=Object.setPrototypeOf||function(_,m){return _.__proto__=m,_},l(S,R)}var d=100,A=function(S){s(R,S);function R(_,m){var I;return I=S.call(this,_,m,"[audio-stream-controller]")||this,I.videoBuffer=null,I.videoTrackCC=-1,I.waitingVideoCC=-1,I.audioSwitch=!1,I.trackId=-1,I.waitingData=null,I.mainDetails=null,I.bufferFlushed=!1,I._registerListeners(),I}var y=R.prototype;return y.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},y._registerListeners=function(){var m=this.hls;m.on(v.Events.MEDIA_ATTACHED,this.onMediaAttached,this),m.on(v.Events.MEDIA_DETACHING,this.onMediaDetaching,this),m.on(v.Events.MANIFEST_LOADING,this.onManifestLoading,this),m.on(v.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.on(v.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),m.on(v.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),m.on(v.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),m.on(v.Events.ERROR,this.onError,this),m.on(v.Events.BUFFER_RESET,this.onBufferReset,this),m.on(v.Events.BUFFER_CREATED,this.onBufferCreated,this),m.on(v.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),m.on(v.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),m.on(v.Events.FRAG_BUFFERED,this.onFragBuffered,this)},y._unregisterListeners=function(){var m=this.hls;m.off(v.Events.MEDIA_ATTACHED,this.onMediaAttached,this),m.off(v.Events.MEDIA_DETACHING,this.onMediaDetaching,this),m.off(v.Events.MANIFEST_LOADING,this.onManifestLoading,this),m.off(v.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.off(v.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),m.off(v.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),m.off(v.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),m.off(v.Events.ERROR,this.onError,this),m.off(v.Events.BUFFER_RESET,this.onBufferReset,this),m.off(v.Events.BUFFER_CREATED,this.onBufferCreated,this),m.off(v.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),m.off(v.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),m.off(v.Events.FRAG_BUFFERED,this.onFragBuffered,this)},y.onInitPtsFound=function(m,I){var B=I.frag,P=I.id,M=I.initPTS;if(P==="main"){var U=B.cc;this.initPTS[B.cc]=M,this.log("InitPTS for cc: "+U+" found from main: "+M),this.videoTrackCC=U,this.state===N.State.WAITING_INIT_PTS&&this.tick()}},y.startLoad=function(m){if(!this.levels){this.startPosition=m,this.state=N.State.STOPPED;return}var I=this.lastCurrentTime;this.stopLoad(),this.setInterval(d),this.fragLoadError=0,I>0&&m===-1?(this.log("Override startPosition with lastCurrentTime @"+I.toFixed(3)),this.state=N.State.IDLE):(this.loadedmetadata=!1,this.state=N.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=m,this.tick()},y.doTick=function(){switch(this.state){case N.State.IDLE:this.doTickIdle();break;case N.State.WAITING_TRACK:{var m,I=this.levels,B=this.trackId,P=I==null||(m=I[B])===null||m===void 0?void 0:m.details;if(P){if(this.waitForCdnTuneIn(P))break;this.state=N.State.WAITING_INIT_PTS}break}case N.State.FRAG_LOADING_WAITING_RETRY:{var M,U=performance.now(),K=this.retryDate;(!K||U>=K||(M=this.media)!==null&&M!==void 0&&M.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=N.State.IDLE);break}case N.State.WAITING_INIT_PTS:{var W=this.waitingData;if(W){var X=W.frag,ie=W.part,se=W.cache,le=W.complete;if(this.initPTS[X.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=N.State.FRAG_LOADING;var ve=se.flush(),q={frag:X,part:ie,payload:ve,networkDetails:null};this._handleFragmentLoadProgress(q),le&&S.prototype._handleFragmentLoadComplete.call(this,q)}else if(this.videoTrackCC!==this.waitingVideoCC)a.logger.log("Waiting fragment cc ("+X.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ee=this.getLoadPosition(),ae=L.BufferHelper.bufferInfo(this.mediaBuffer,ee,this.config.maxBufferHole),_e=Object(p.fragmentWithinToleranceTest)(ae.end,this.config.maxFragLookUpTolerance,X);_e<0&&(a.logger.log("Waiting fragment cc ("+X.cc+") @ "+X.start+" cancelled because another fragment at "+ae.end+" is needed"),this.clearWaitingFragment())}}else this.state=N.State.IDLE}}this.onTickEnd()},y.clearWaitingFragment=function(){var m=this.waitingData;m&&(this.fragmentTracker.removeFragment(m.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=N.State.IDLE)},y.onTickEnd=function(){var m=this.media;if(!(!m||!m.readyState)){var I=this.mediaBuffer?this.mediaBuffer:m,B=I.buffered;!this.loadedmetadata&&B.length&&(this.loadedmetadata=!0),this.lastCurrentTime=m.currentTime}},y.doTickIdle=function(){var m,I,B=this.hls,P=this.levels,M=this.media,U=this.trackId,K=B.config;if(!(!P||!P[U])&&!(!M&&(this.startFragRequested||!K.startFragPrefetch))){var W=P[U],X=W.details;if(!X||X.live&&this.levelLastLoaded!==U||this.waitForCdnTuneIn(X)){this.state=N.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,g.ElementaryStreamTypes.AUDIO,w.PlaylistLevelType.AUDIO));var ie=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,w.PlaylistLevelType.AUDIO);if(ie!==null){var se=ie.len,le=this.getMaxBufferLength(),ve=this.audioSwitch;if(!(se>=le&&!ve)){if(!ve&&this._streamEnded(ie,X)){B.trigger(v.Events.BUFFER_EOS,{type:"audio"}),this.state=N.State.ENDED;return}var q=X.fragments,ee=q[0].start,ae=ie.end;if(ve){var _e=this.getLoadPosition();ae=_e,X.PTSKnown&&_e<ee&&(ie.end>ee||ie.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),M.currentTime=ee+.05)}var fe=this.getNextFragment(ae,X);if(!fe){this.bufferFlushed=!0;return}((m=fe.decryptdata)===null||m===void 0?void 0:m.keyFormat)==="identity"&&!((I=fe.decryptdata)!==null&&I!==void 0&&I.key)?this.loadKey(fe,X):this.loadFragment(fe,X,ae)}}}},y.getMaxBufferLength=function(){var m=S.prototype.getMaxBufferLength.call(this),I=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,w.PlaylistLevelType.MAIN);return I===null?m:Math.max(m,I.len)},y.onMediaDetaching=function(){this.videoBuffer=null,S.prototype.onMediaDetaching.call(this)},y.onAudioTracksUpdated=function(m,I){var B=I.audioTracks;this.resetTransmuxer(),this.levels=B.map(function(P){return new D.Level(P)})},y.onAudioTrackSwitching=function(m,I){var B=!!I.url;this.trackId=I.id;var P=this.fragCurrent;P!=null&&P.loader&&P.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),B?this.setInterval(d):this.resetTransmuxer(),B?(this.audioSwitch=!0,this.state=N.State.IDLE):this.state=N.State.STOPPED,this.tick()},y.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},y.onLevelLoaded=function(m,I){this.mainDetails=I.details},y.onAudioTrackLoaded=function(m,I){var B,P=this.levels,M=I.details,U=I.id;if(!P){this.warn("Audio tracks were reset while loading level "+U);return}this.log("Track "+U+" loaded ["+M.startSN+","+M.endSN+"],duration:"+M.totalduration);var K=P[U],W=0;if(M.live||(B=K.details)!==null&&B!==void 0&&B.live){var X=this.mainDetails;if(M.fragments[0]||(M.deltaUpdateFailed=!0),M.deltaUpdateFailed||!X)return;!K.details&&M.hasProgramDateTime&&X.hasProgramDateTime?(Object(E.alignMediaPlaylistByPDT)(M,X),W=M.fragments[0].start):W=this.alignPlaylists(M,K.details)}K.details=M,this.levelLastLoaded=U,!this.startFragRequested&&(this.mainDetails||!M.live)&&this.setStartPosition(K.details,W),this.state===N.State.WAITING_TRACK&&!this.waitForCdnTuneIn(M)&&(this.state=N.State.IDLE),this.tick()},y._handleFragmentLoadProgress=function(m){var I,B=m.frag,P=m.part,M=m.payload,U=this.config,K=this.trackId,W=this.levels;if(!W){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+B.sn+" of level "+B.level+" will not be buffered");return}var X=W[K];console.assert(X,"Audio track is defined on fragment load progress");var ie=X.details;console.assert(ie,"Audio track details are defined on fragment load progress");var se=U.defaultAudioCodec||X.audioCodec||"mp4a.40.2",le=this.transmuxer;le||(le=this.transmuxer=new T.default(this.hls,w.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ve=this.initPTS[B.cc],q=(I=B.initSegment)===null||I===void 0?void 0:I.data;if(ve!==void 0){var ee=!1,ae=P?P.index:-1,_e=ae!==-1,fe=new f.ChunkMetadata(B.level,B.sn,B.stats.chunkCount,M.byteLength,ae,_e);le.push(M,q,se,"",B,P,ie.totalduration,ee,fe,ve)}else{a.logger.log("Unknown video PTS for cc "+B.cc+", waiting for video PTS before demuxing audio frag "+B.sn+" of ["+ie.startSN+" ,"+ie.endSN+"],track "+K);var Ue=this.waitingData=this.waitingData||{frag:B,part:P,cache:new b.default,complete:!1},Te=Ue.cache;Te.push(new Uint8Array(M)),this.waitingVideoCC=this.videoTrackCC,this.state=N.State.WAITING_INIT_PTS}},y._handleFragmentLoadComplete=function(m){if(this.waitingData){this.waitingData.complete=!0;return}S.prototype._handleFragmentLoadComplete.call(this,m)},y.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},y.onBufferCreated=function(m,I){var B=I.tracks.audio;B&&(this.mediaBuffer=B.buffer),I.tracks.video&&(this.videoBuffer=I.tracks.video.buffer)},y.onFragBuffered=function(m,I){var B=I.frag,P=I.part;if(B.type===w.PlaylistLevelType.AUDIO){if(this.fragContextChanged(B)){this.warn("Fragment "+B.sn+(P?" p: "+P.index:"")+" of level "+B.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}B.sn!=="initSegment"&&(this.fragPrevious=B,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(v.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(B,P)}},y.onError=function(m,I){switch(I.details){case u.ErrorDetails.FRAG_LOAD_ERROR:case u.ErrorDetails.FRAG_LOAD_TIMEOUT:case u.ErrorDetails.KEY_LOAD_ERROR:case u.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(w.PlaylistLevelType.AUDIO,I);break;case u.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case u.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==N.State.ERROR&&this.state!==N.State.STOPPED&&(this.state=I.fatal?N.State.ERROR:N.State.IDLE,this.warn(I.details+" while loading frag, switching to "+this.state+" state"));break;case u.ErrorDetails.BUFFER_FULL_ERROR:if(I.parent==="audio"&&(this.state===N.State.PARSING||this.state===N.State.PARSED)){var B=!0,P=this.getFwdBufferInfo(this.mediaBuffer,w.PlaylistLevelType.AUDIO);P&&P.len>.5&&(B=!this.reduceMaxBufferLength(P.len)),B&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,S.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},y.onBufferFlushed=function(m,I){var B=I.type;B===g.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},y._handleTransmuxComplete=function(m){var I,B="audio",P=this.hls,M=m.remuxResult,U=m.chunkMeta,K=this.getCurrentContext(U);if(!K){this.warn("The loading context changed while buffering fragment "+U.sn+" of level "+U.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(U.level);return}var W=K.frag,X=K.part,ie=M.audio,se=M.text,le=M.id3,ve=M.initSegment;if(!this.fragContextChanged(W)){if(this.state=N.State.PARSING,this.audioSwitch&&ie&&this.completeAudioSwitch(),ve!=null&&ve.tracks&&(this._bufferInitSegment(ve.tracks,W,U),P.trigger(v.Events.FRAG_PARSING_INIT_SEGMENT,{frag:W,id:B,tracks:ve.tracks})),ie){var q=ie.startPTS,ee=ie.endPTS,ae=ie.startDTS,_e=ie.endDTS;X&&(X.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:q,endPTS:ee,startDTS:ae,endDTS:_e}),W.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,q,ee,ae,_e),this.bufferFragmentData(ie,W,X,U)}if(le!=null&&(I=le.samples)!==null&&I!==void 0&&I.length){var fe=n({frag:W,id:B},le);P.trigger(v.Events.FRAG_PARSING_METADATA,fe)}if(se){var Ue=n({frag:W,id:B},se);P.trigger(v.Events.FRAG_PARSING_USERDATA,Ue)}}},y._bufferInitSegment=function(m,I,B){if(this.state===N.State.PARSING){m.video&&delete m.video;var P=m.audio;if(!!P){P.levelCodec=P.codec,P.id="audio",this.log("Init audio buffer, container:"+P.container+", codecs[parsed]=["+P.codec+"]"),this.hls.trigger(v.Events.BUFFER_CODECS,m);var M=P.initSegment;if(M!=null&&M.byteLength){var U={type:"audio",frag:I,part:null,chunkMeta:B,parent:I.type,data:M};this.hls.trigger(v.Events.BUFFER_APPENDING,U)}this.tick()}}},y.loadFragment=function(m,I,B){var P=this.fragmentTracker.getState(m);this.fragCurrent=m,(this.audioSwitch||P===O.FragmentState.NOT_LOADED||P===O.FragmentState.PARTIAL)&&(m.sn==="initSegment"?this._loadInitSegment(m):I.live&&!Object(j.isFiniteNumber)(this.initPTS[m.cc])?(this.log("Waiting for video PTS in continuity counter "+m.cc+" of live stream before loading audio fragment "+m.sn+" of level "+this.trackId),this.state=N.State.WAITING_INIT_PTS):(this.startFragRequested=!0,S.prototype.loadFragment.call(this,m,I,B)))},y.completeAudioSwitch=function(){var m=this.hls,I=this.media,B=this.trackId;I&&(this.log("Switching audio track : flushing all audio"),S.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,m.trigger(v.Events.AUDIO_TRACK_SWITCHED,{id:B})},R}(N.default);H.default=A},"./src/controller/audio-track-controller.ts":function(de,H,k){"use strict";k.r(H);var j=k("./src/events.ts"),N=k("./src/errors.ts"),v=k("./src/controller/base-playlist-controller.ts"),L=k("./src/types/loader.ts");function O(T,f){for(var p=0;p<f.length;p++){var E=f[p];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(T,E.key,E)}}function D(T,f,p){return f&&O(T.prototype,f),p&&O(T,p),T}function w(T,f){T.prototype=Object.create(f.prototype),T.prototype.constructor=T,g(T,f)}function g(T,f){return g=Object.setPrototypeOf||function(E,u){return E.__proto__=u,E},g(T,f)}var b=function(T){w(f,T);function f(E){var u;return u=T.call(this,E,"[audio-track-controller]")||this,u.tracks=[],u.groupId=null,u.tracksInGroup=[],u.trackId=-1,u.trackName="",u.selectDefaultTrack=!0,u.registerListeners(),u}var p=f.prototype;return p.registerListeners=function(){var u=this.hls;u.on(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.on(j.Events.LEVEL_LOADING,this.onLevelLoading,this),u.on(j.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.on(j.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.on(j.Events.ERROR,this.onError,this)},p.unregisterListeners=function(){var u=this.hls;u.off(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.off(j.Events.LEVEL_LOADING,this.onLevelLoading,this),u.off(j.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.off(j.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.off(j.Events.ERROR,this.onError,this)},p.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,T.prototype.destroy.call(this)},p.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},p.onManifestParsed=function(u,a){this.tracks=a.audioTracks||[]},p.onAudioTrackLoaded=function(u,a){var n=a.id,s=a.details,l=this.tracksInGroup[n];if(!l){this.warn("Invalid audio track id "+n);return}var d=l.details;l.details=a.details,this.log("audioTrack "+n+" loaded ["+s.startSN+"-"+s.endSN+"]"),n===this.trackId&&(this.retryCount=0,this.playlistLoaded(n,a,d))},p.onLevelLoading=function(u,a){this.switchLevel(a.level)},p.onLevelSwitching=function(u,a){this.switchLevel(a.level)},p.switchLevel=function(u){var a=this.hls.levels[u];if(!!(a!=null&&a.audioGroupIds)){var n=a.audioGroupIds[a.urlId];if(this.groupId!==n){this.groupId=n;var s=this.tracks.filter(function(d){return!n||d.groupId===n});this.selectDefaultTrack&&!s.some(function(d){return d.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=s;var l={audioTracks:s};this.log("Updating audio tracks, "+s.length+' track(s) found in "'+n+'" group-id'),this.hls.trigger(j.Events.AUDIO_TRACKS_UPDATED,l),this.selectInitialTrack()}}},p.onError=function(u,a){T.prototype.onError.call(this,u,a),!(a.fatal||!a.context)&&a.context.type===L.PlaylistContextType.AUDIO_TRACK&&a.context.id===this.trackId&&a.context.groupId===this.groupId&&this.retryLoadingOrFail(a)},p.setAudioTrack=function(u){var a=this.tracksInGroup;if(u<0||u>=a.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var n=a[this.trackId];this.log("Now switching to audio-track index "+u);var s=a[u],l=s.id,d=s.groupId,A=d===void 0?"":d,S=s.name,R=s.type,y=s.url;if(this.trackId=u,this.trackName=S,this.selectDefaultTrack=!1,this.hls.trigger(j.Events.AUDIO_TRACK_SWITCHING,{id:l,groupId:A,name:S,type:R,url:y}),!(s.details&&!s.details.live)){var _=this.switchParams(s.url,n==null?void 0:n.details);this.loadPlaylist(_)}},p.selectInitialTrack=function(){var u=this.tracksInGroup;console.assert(u.length,"Initial audio track should be selected when tracks are known");var a=this.trackName,n=this.findTrackId(a)||this.findTrackId();n!==-1?this.setAudioTrack(n):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(j.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},p.findTrackId=function(u){for(var a=this.tracksInGroup,n=0;n<a.length;n++){var s=a[n];if((!this.selectDefaultTrack||s.default)&&(!u||u===s.name))return s.id}return-1},p.loadPlaylist=function(u){var a=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(a)){var n=a.id,s=a.groupId,l=a.url;if(u)try{l=u.addDirectives(l)}catch(d){this.warn("Could not construct new URL with HLS Delivery Directives: "+d)}this.log("loading audio-track playlist for id: "+n),this.clearTimer(),this.hls.trigger(j.Events.AUDIO_TRACK_LOADING,{url:l,id:n,groupId:s,deliveryDirectives:u||null})}},D(f,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(u){this.selectDefaultTrack=!1,this.setAudioTrack(u)}}]),f}(v.default);H.default=b},"./src/controller/base-playlist-controller.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"default",function(){return D});var j=k("./src/polyfills/number.ts"),N=k("./src/types/level.ts"),v=k("./src/controller/level-helper.ts"),L=k("./src/utils/logger.ts"),O=k("./src/errors.ts"),D=function(){function w(b,T){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=L.logger.log.bind(L.logger,T+":"),this.warn=L.logger.warn.bind(L.logger,T+":"),this.hls=b}var g=w.prototype;return g.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},g.onError=function(T,f){f.fatal&&f.type===O.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},g.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},g.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},g.stopLoad=function(){this.canLoad=!1,this.clearTimer()},g.switchParams=function(T,f){var p=f==null?void 0:f.renditionReports;if(p)for(var E=0;E<p.length;E++){var u=p[E],a=""+u.URI;if(a===T.substr(-a.length)){var n=parseInt(u["LAST-MSN"]),s=parseInt(u["LAST-PART"]);if(f&&this.hls.config.lowLatencyMode){var l=Math.min(f.age-f.partTarget,f.targetduration);s!==void 0&&l>f.partTarget&&(s+=1)}if(Object(j.isFiniteNumber)(n))return new N.HlsUrlParameters(n,Object(j.isFiniteNumber)(s)?s:void 0,N.HlsSkip.No)}}},g.loadPlaylist=function(T){},g.shouldLoadTrack=function(T){return this.canLoad&&T&&!!T.url&&(!T.details||T.details.live)},g.playlistLoaded=function(T,f,p){var E=this,u=f.details,a=f.stats,n=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(u.advancedDateTime=Date.now()-n,u.live||p!=null&&p.live){if(u.reloaded(p),p&&this.log("live playlist "+T+" "+(u.advanced?"REFRESHED "+u.lastPartSn+"-"+u.lastPartIndex:"MISSED")),p&&u.fragments.length>0&&Object(v.mergeDetails)(p,u),!this.canLoad||!u.live)return;var s,l=void 0,d=void 0;if(u.canBlockReload&&u.endSN&&u.advanced){var A=this.hls.config.lowLatencyMode,S=u.lastPartSn,R=u.endSN,y=u.lastPartIndex,_=y!==-1,m=S===R,I=A?0:y;_?(l=m?R+1:S,d=m?I:y+1):l=R+1;var B=u.age,P=B+u.ageHeader,M=Math.min(P-u.partTarget,u.targetduration*1.5);if(M>0){if(p&&M>p.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+p.tuneInGoal+" to: "+M+" with playlist age: "+u.age),M=0;else{var U=Math.floor(M/u.targetduration);if(l+=U,d!==void 0){var K=Math.round(M%u.targetduration/u.partTarget);d+=K}this.log("CDN Tune-in age: "+u.ageHeader+"s last advanced "+B.toFixed(2)+"s goal: "+M+" skip sn "+U+" to part "+d)}u.tuneInGoal=M}if(s=this.getDeliveryDirectives(u,f.deliveryDirectives,l,d),A||!m){this.loadPlaylist(s);return}}else s=this.getDeliveryDirectives(u,f.deliveryDirectives,l,d);var W=Object(v.computeReloadInterval)(u,a);l!==void 0&&u.canBlockReload&&(W-=u.partTarget||1),this.log("reload live playlist "+T+" in "+Math.round(W)+" ms"),this.timer=self.setTimeout(function(){return E.loadPlaylist(s)},W)}else this.clearTimer()},g.getDeliveryDirectives=function(T,f,p,E){var u=Object(N.getSkipValue)(T,p);return f!=null&&f.skip&&T.deltaUpdateFailed&&(p=f.msn,E=f.part,u=N.HlsSkip.No),new N.HlsUrlParameters(p,E,u)},g.retryLoadingOrFail=function(T){var f=this,p=this.hls.config,E=this.retryCount<p.levelLoadingMaxRetry;if(E){var u;if(this.retryCount++,T.details.indexOf("LoadTimeOut")>-1&&(u=T.context)!==null&&u!==void 0&&u.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+T.details+'"'),this.loadPlaylist();else{var a=Math.min(Math.pow(2,this.retryCount)*p.levelLoadingRetryDelay,p.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return f.loadPlaylist()},a),this.warn("retry playlist loading #"+this.retryCount+" in "+a+' ms after "'+T.details+'"')}}else this.warn('cannot recover from error "'+T.details+'"'),this.clearTimer(),T.fatal=!0;return E},w}()},"./src/controller/base-stream-controller.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"State",function(){return R}),k.d(H,"default",function(){return y});var j=k("./src/polyfills/number.ts"),N=k("./src/task-loop.ts"),v=k("./src/controller/fragment-tracker.ts"),L=k("./src/utils/buffer-helper.ts"),O=k("./src/utils/logger.ts"),D=k("./src/events.ts"),w=k("./src/errors.ts"),g=k("./src/types/transmuxer.ts"),b=k("./src/utils/mp4-tools.ts"),T=k("./src/utils/discontinuities.ts"),f=k("./src/controller/fragment-finders.ts"),p=k("./src/controller/level-helper.ts"),E=k("./src/loader/fragment-loader.ts"),u=k("./src/crypt/decrypter.ts"),a=k("./src/utils/time-ranges.ts"),n=k("./src/types/loader.ts");function s(_,m){for(var I=0;I<m.length;I++){var B=m[I];B.enumerable=B.enumerable||!1,B.configurable=!0,"value"in B&&(B.writable=!0),Object.defineProperty(_,B.key,B)}}function l(_,m,I){return m&&s(_.prototype,m),I&&s(_,I),_}function d(_){if(_===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _}function A(_,m){_.prototype=Object.create(m.prototype),_.prototype.constructor=_,S(_,m)}function S(_,m){return S=Object.setPrototypeOf||function(B,P){return B.__proto__=P,B},S(_,m)}var R={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},y=function(_){A(m,_);function m(B,P,M){var U;return U=_.call(this)||this,U.hls=void 0,U.fragPrevious=null,U.fragCurrent=null,U.fragmentTracker=void 0,U.transmuxer=null,U._state=R.STOPPED,U.media=void 0,U.mediaBuffer=void 0,U.config=void 0,U.bitrateTest=!1,U.lastCurrentTime=0,U.nextLoadPosition=0,U.startPosition=0,U.loadedmetadata=!1,U.fragLoadError=0,U.retryDate=0,U.levels=null,U.fragmentLoader=void 0,U.levelLastLoaded=null,U.startFragRequested=!1,U.decrypter=void 0,U.initPTS=[],U.onvseeking=null,U.onvended=null,U.logPrefix="",U.log=void 0,U.warn=void 0,U.logPrefix=M,U.log=O.logger.log.bind(O.logger,M+":"),U.warn=O.logger.warn.bind(O.logger,M+":"),U.hls=B,U.fragmentLoader=new E.default(B.config),U.fragmentTracker=P,U.config=B.config,U.decrypter=new u.default(B,B.config),B.on(D.Events.KEY_LOADED,U.onKeyLoaded,d(U)),U}var I=m.prototype;return I.doTick=function(){this.onTickEnd()},I.onTickEnd=function(){},I.startLoad=function(P){},I.stopLoad=function(){this.fragmentLoader.abort();var P=this.fragCurrent;P&&this.fragmentTracker.removeFragment(P),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=R.STOPPED},I._streamEnded=function(P,M){var U=this.fragCurrent,K=this.fragmentTracker;if(!M.live&&U&&U.sn===M.endSN&&!P.nextStart){var W=K.getState(U);return W===v.FragmentState.PARTIAL||W===v.FragmentState.OK}return!1},I.onMediaAttached=function(P,M){var U=this.media=this.mediaBuffer=M.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),U.addEventListener("seeking",this.onvseeking),U.addEventListener("ended",this.onvended);var K=this.config;this.levels&&K.autoStartLoad&&this.state===R.STOPPED&&this.startLoad(K.startPosition)},I.onMediaDetaching=function(){var P=this.media;P!=null&&P.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),P&&(P.removeEventListener("seeking",this.onvseeking),P.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},I.onMediaSeeking=function(){var P=this.config,M=this.fragCurrent,U=this.media,K=this.mediaBuffer,W=this.state,X=U?U.currentTime:0,ie=L.BufferHelper.bufferInfo(K||U,X,P.maxBufferHole);if(this.log("media seeking to "+(Object(j.isFiniteNumber)(X)?X.toFixed(3):X)+", state: "+W),W===R.ENDED)this.resetLoadingState();else if(M&&!ie.len){var se=P.maxFragLookUpTolerance,le=M.start-se,ve=M.start+M.duration+se,q=X>ve;(X<le||q)&&(q&&M.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),M.loader.abort()),this.resetLoadingState())}U&&(this.lastCurrentTime=X),!this.loadedmetadata&&!ie.len&&(this.nextLoadPosition=this.startPosition=X),this.tickImmediate()},I.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},I.onKeyLoaded=function(P,M){if(!(this.state!==R.KEY_LOADING||M.frag!==this.fragCurrent||!this.levels)){this.state=R.IDLE;var U=this.levels[M.frag.level].details;U&&this.loadFragment(M.frag,U,M.frag.start)}},I.onHandlerDestroying=function(){this.stopLoad(),_.prototype.onHandlerDestroying.call(this)},I.onHandlerDestroyed=function(){this.state=R.STOPPED,this.hls.off(D.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,_.prototype.onHandlerDestroyed.call(this)},I.loadKey=function(P,M){this.log("Loading key for "+P.sn+" of ["+M.startSN+"-"+M.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+P.level),this.state=R.KEY_LOADING,this.fragCurrent=P,this.hls.trigger(D.Events.KEY_LOADING,{frag:P})},I.loadFragment=function(P,M,U){this._loadFragForPlayback(P,M,U)},I._loadFragForPlayback=function(P,M,U){var K=this,W=function(ie){if(K.fragContextChanged(P)){K.warn("Fragment "+P.sn+(ie.part?" p: "+ie.part.index:"")+" of level "+P.level+" was dropped during download."),K.fragmentTracker.removeFragment(P);return}P.stats.chunkCount++,K._handleFragmentLoadProgress(ie)};this._doFragLoad(P,M,U,W).then(function(X){if(!!X){K.fragLoadError=0;var ie=K.state;if(K.fragContextChanged(P)){(ie===R.FRAG_LOADING||ie===R.BACKTRACKING||!K.fragCurrent&&ie===R.PARSING)&&(K.fragmentTracker.removeFragment(P),K.state=R.IDLE);return}if("payload"in X&&(K.log("Loaded fragment "+P.sn+" of level "+P.level),K.hls.trigger(D.Events.FRAG_LOADED,X),K.state===R.BACKTRACKING)){K.fragmentTracker.backtrack(P,X),K.resetFragmentLoading(P);return}K._handleFragmentLoadComplete(X)}}).catch(function(X){K.warn(X),K.resetFragmentLoading(P)})},I.flushMainBuffer=function(P,M,U){if(U===void 0&&(U=null),!!(P-M)){var K={startOffset:P,endOffset:M,type:U};this.fragLoadError=0,this.hls.trigger(D.Events.BUFFER_FLUSHING,K)}},I._loadInitSegment=function(P){var M=this;this._doFragLoad(P).then(function(U){if(!U||M.fragContextChanged(P)||!M.levels)throw new Error("init load aborted");return U}).then(function(U){var K=M.hls,W=U.payload,X=P.decryptdata;if(W&&W.byteLength>0&&X&&X.key&&X.iv&&X.method==="AES-128"){var ie=self.performance.now();return M.decrypter.webCryptoDecrypt(new Uint8Array(W),X.key.buffer,X.iv.buffer).then(function(se){var le=self.performance.now();return K.trigger(D.Events.FRAG_DECRYPTED,{frag:P,payload:se,stats:{tstart:ie,tdecrypt:le}}),U.payload=se,U})}return U}).then(function(U){var K=M.fragCurrent,W=M.hls,X=M.levels;if(!X)throw new Error("init load aborted, missing levels");var ie=X[P.level].details;console.assert(ie,"Level details are defined when init segment is loaded");var se=P.stats;M.state=R.IDLE,M.fragLoadError=0,P.data=new Uint8Array(U.payload),se.parsing.start=se.buffering.start=self.performance.now(),se.parsing.end=se.buffering.end=self.performance.now(),U.frag===K&&W.trigger(D.Events.FRAG_BUFFERED,{stats:se,frag:K,part:null,id:P.type}),M.tick()}).catch(function(U){M.warn(U),M.resetFragmentLoading(P)})},I.fragContextChanged=function(P){var M=this.fragCurrent;return!P||!M||P.level!==M.level||P.sn!==M.sn||P.urlId!==M.urlId},I.fragBufferedComplete=function(P,M){var U=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+P.type+" sn: "+P.sn+(M?" part: "+M.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+P.level+" "+a.default.toString(L.BufferHelper.getBuffered(U))),this.state=R.IDLE,this.tick()},I._handleFragmentLoadComplete=function(P){var M=this.transmuxer;if(!!M){var U=P.frag,K=P.part,W=P.partsLoaded,X=!W||W.length===0||W.some(function(se){return!se}),ie=new g.ChunkMetadata(U.level,U.sn,U.stats.chunkCount+1,0,K?K.index:-1,!X);M.flush(ie)}},I._handleFragmentLoadProgress=function(P){},I._doFragLoad=function(P,M,U,K){var W=this;if(U===void 0&&(U=null),!this.levels)throw new Error("frag load aborted, missing levels");if(U=Math.max(P.start,U||0),this.config.lowLatencyMode&&M){var X=M.partList;if(X&&K){U>P.end&&M.fragmentHint&&(P=M.fragmentHint);var ie=this.getNextPart(X,P,U);if(ie>-1){var se=X[ie];return this.log("Loading part sn: "+P.sn+" p: "+se.index+" cc: "+P.cc+" of playlist ["+M.startSN+"-"+M.endSN+"] parts [0-"+ie+"-"+(X.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+P.level+", target: "+parseFloat(U.toFixed(3))),this.nextLoadPosition=se.start+se.duration,this.state=R.FRAG_LOADING,this.hls.trigger(D.Events.FRAG_LOADING,{frag:P,part:X[ie],targetBufferTime:U}),this.doFragPartsLoad(P,X,ie,K).catch(function(le){return W.handleFragLoadError(le)})}else if(!P.url||this.loadedEndOfParts(X,U))return Promise.resolve(null)}}return this.log("Loading fragment "+P.sn+" cc: "+P.cc+" "+(M?"of ["+M.startSN+"-"+M.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+P.level+", target: "+parseFloat(U.toFixed(3))),Object(j.isFiniteNumber)(P.sn)&&!this.bitrateTest&&(this.nextLoadPosition=P.start+P.duration),this.state=R.FRAG_LOADING,this.hls.trigger(D.Events.FRAG_LOADING,{frag:P,targetBufferTime:U}),this.fragmentLoader.load(P,K).catch(function(le){return W.handleFragLoadError(le)})},I.doFragPartsLoad=function(P,M,U,K){var W=this;return new Promise(function(X,ie){var se=[],le=function ve(q){var ee=M[q];W.fragmentLoader.loadPart(P,ee,K).then(function(ae){se[ee.index]=ae;var _e=ae.part;W.hls.trigger(D.Events.FRAG_LOADED,ae);var fe=M[q+1];if(fe&&fe.fragment===P)ve(q+1);else return X({frag:P,part:_e,partsLoaded:se})}).catch(ie)};le(U)})},I.handleFragLoadError=function(P){var M=P.data;return M&&M.details===w.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(M.frag,M.part):this.hls.trigger(D.Events.ERROR,M),null},I._handleTransmuxerFlush=function(P){var M=this.getCurrentContext(P);if(!M||this.state!==R.PARSING){this.fragCurrent||(this.state=R.IDLE);return}var U=M.frag,K=M.part,W=M.level,X=self.performance.now();U.stats.parsing.end=X,K&&(K.stats.parsing.end=X),this.updateLevelTiming(U,K,W,P.partial)},I.getCurrentContext=function(P){var M=this.levels,U=P.level,K=P.sn,W=P.part;if(!M||!M[U])return this.warn("Levels object was unset while buffering fragment "+K+" of level "+U+". The current chunk will not be buffered."),null;var X=M[U],ie=W>-1?Object(p.getPartWith)(X,K,W):null,se=ie?ie.fragment:Object(p.getFragmentWithSN)(X,K,this.fragCurrent);return se?{frag:se,part:ie,level:X}:null},I.bufferFragmentData=function(P,M,U,K){if(!(!P||this.state!==R.PARSING)){var W=P.data1,X=P.data2,ie=W;if(W&&X&&(ie=Object(b.appendUint8Array)(W,X)),!(!ie||!ie.length)){var se={type:P.type,frag:M,part:U,chunkMeta:K,parent:M.type,data:ie};this.hls.trigger(D.Events.BUFFER_APPENDING,se),P.dropped&&P.independent&&!U&&this.flushBufferGap(M)}}},I.flushBufferGap=function(P){var M=this.media;if(!!M){if(!L.BufferHelper.isBuffered(M,M.currentTime)){this.flushMainBuffer(0,P.start);return}var U=M.currentTime,K=L.BufferHelper.bufferInfo(M,U,0),W=P.duration,X=Math.min(this.config.maxFragLookUpTolerance*2,W*.25),ie=Math.max(Math.min(P.start-X,K.end-X),U+X);P.start-ie>X&&this.flushMainBuffer(ie,P.start)}},I.getFwdBufferInfo=function(P,M){var U=this.config,K=this.getLoadPosition();if(!Object(j.isFiniteNumber)(K))return null;var W=L.BufferHelper.bufferInfo(P,K,U.maxBufferHole);if(W.len===0&&W.nextStart!==void 0){var X=this.fragmentTracker.getBufferedFrag(K,M);if(X&&W.nextStart<X.end)return L.BufferHelper.bufferInfo(P,K,Math.max(W.nextStart,U.maxBufferHole))}return W},I.getMaxBufferLength=function(P){var M=this.config,U;return P?U=Math.max(8*M.maxBufferSize/P,M.maxBufferLength):U=M.maxBufferLength,Math.min(U,M.maxMaxBufferLength)},I.reduceMaxBufferLength=function(P){var M=this.config,U=P||M.maxBufferLength;return M.maxMaxBufferLength>=U?(M.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+M.maxMaxBufferLength+"s"),!0):!1},I.getNextFragment=function(P,M){var U,K,W=M.fragments,X=W.length;if(!X)return null;var ie=this.config,se=W[0].start,le;if(M.live){var ve=ie.initialLiveManifestSize;if(X<ve)return this.warn("Not enough fragments to start playback (have: "+X+", need: "+ve+")"),null;!M.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(le=this.getInitialLiveFragment(M,W),this.startPosition=le?this.hls.liveSyncPosition||le.start:P)}else P<=se&&(le=W[0]);if(!le){var q=ie.lowLatencyMode?M.partEnd:M.fragmentEnd;le=this.getFragmentAtPosition(P,q,M)}return(U=le)!==null&&U!==void 0&&U.initSegment&&!((K=le)!==null&&K!==void 0&&K.initSegment.data)&&!this.bitrateTest&&(le=le.initSegment),le},I.getNextPart=function(P,M,U){for(var K=-1,W=!1,X=!0,ie=0,se=P.length;ie<se;ie++){var le=P[ie];if(X=X&&!le.independent,K>-1&&U<le.start)break;var ve=le.loaded;!ve&&(W||le.independent||X)&&le.fragment===M&&(K=ie),W=ve}return K},I.loadedEndOfParts=function(P,M){var U=P[P.length-1];return U&&M>U.start&&U.loaded},I.getInitialLiveFragment=function(P,M){var U=this.fragPrevious,K=null;if(U){if(P.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+U.programDateTime),K=Object(f.findFragmentByPDT)(M,U.endProgramDateTime,this.config.maxFragLookUpTolerance)),!K){var W=U.sn+1;if(W>=P.startSN&&W<=P.endSN){var X=M[W-P.startSN];U.cc===X.cc&&(K=X,this.log("Live playlist, switching playlist, load frag with next SN: "+K.sn))}K||(K=Object(f.findFragWithCC)(M,U.cc),K&&this.log("Live playlist, switching playlist, load frag with same CC: "+K.sn))}}else{var ie=this.hls.liveSyncPosition;ie!==null&&(K=this.getFragmentAtPosition(ie,this.bitrateTest?P.fragmentEnd:P.edge,P))}return K},I.getFragmentAtPosition=function(P,M,U){var K=this.config,W=this.fragPrevious,X=U.fragments,ie=U.endSN,se=U.fragmentHint,le=K.maxFragLookUpTolerance,ve=!!(K.lowLatencyMode&&U.partList&&se);ve&&se&&!this.bitrateTest&&(X=X.concat(se),ie=se.sn);var q;if(P<M){var ee=P>M-le?0:le;q=Object(f.findFragmentByPTS)(W,X,P,ee)}else q=X[X.length-1];if(q){var ae=q.sn-U.startSN,_e=W&&q.level===W.level,fe=X[ae+1],Ue=this.fragmentTracker.getState(q);if(Ue===v.FragmentState.BACKTRACKED){q=null;for(var Te=ae;X[Te]&&this.fragmentTracker.getState(X[Te])===v.FragmentState.BACKTRACKED;)W?q=X[Te--]:q=X[--Te];q||(q=fe)}else W&&q.sn===W.sn&&!ve&&_e&&(q.sn<ie&&this.fragmentTracker.getState(fe)!==v.FragmentState.OK?(this.log("SN "+q.sn+" just loaded, load next one: "+fe.sn),q=fe):q=null)}return q},I.synchronizeToLiveEdge=function(P){var M=this.config,U=this.media;if(!!U){var K=this.hls.liveSyncPosition,W=U.currentTime,X=P.fragments[0].start,ie=P.edge,se=W>=X-M.maxFragLookUpTolerance&&W<=ie;if(K!==null&&U.duration>K&&(W<K||!se)){var le=M.liveMaxLatencyDuration!==void 0?M.liveMaxLatencyDuration:M.liveMaxLatencyDurationCount*P.targetduration;(!se&&U.readyState<4||W<ie-le)&&(this.loadedmetadata||(this.nextLoadPosition=K),U.readyState&&(this.warn("Playback: "+W.toFixed(3)+" is located too far from the end of live sliding playlist: "+ie+", reset currentTime to : "+K.toFixed(3)),U.currentTime=K))}}},I.alignPlaylists=function(P,M){var U=this.levels,K=this.levelLastLoaded,W=this.fragPrevious,X=K!==null?U[K]:null,ie=P.fragments.length;if(!ie)return this.warn("No fragments in live playlist"),0;var se=P.fragments[0].start,le=!M,ve=P.alignedSliding&&Object(j.isFiniteNumber)(se);if(le||!ve&&!se){Object(T.alignStream)(W,X,P);var q=P.fragments[0].start;return this.log("Live playlist sliding: "+q.toFixed(2)+" start-sn: "+(M?M.startSN:"na")+"->"+P.startSN+" prev-sn: "+(W?W.sn:"na")+" fragments: "+ie),q}return se},I.waitForCdnTuneIn=function(P){var M=3;return P.live&&P.canBlockReload&&P.tuneInGoal>Math.max(P.partHoldBack,P.partTarget*M)},I.setStartPosition=function(P,M){var U=this.startPosition;if(U<M&&(U=-1),U===-1||this.lastCurrentTime===-1){var K=P.startTimeOffset;Object(j.isFiniteNumber)(K)?(U=M+K,K<0&&(U+=P.totalduration),U=Math.min(Math.max(M,U),M+P.totalduration),this.log("Start time offset "+K+" found in playlist, adjust startPosition to "+U),this.startPosition=U):P.live?U=this.hls.liveSyncPosition||M:this.startPosition=U=0,this.lastCurrentTime=U}this.nextLoadPosition=U},I.getLoadPosition=function(){var P=this.media,M=0;return this.loadedmetadata&&P?M=P.currentTime:this.nextLoadPosition&&(M=this.nextLoadPosition),M},I.handleFragLoadAborted=function(P,M){this.transmuxer&&P.sn!=="initSegment"&&P.stats.aborted&&(this.warn("Fragment "+P.sn+(M?" part"+M.index:"")+" of level "+P.level+" was aborted"),this.resetFragmentLoading(P))},I.resetFragmentLoading=function(P){(!this.fragCurrent||!this.fragContextChanged(P))&&(this.state=R.IDLE)},I.onFragmentOrKeyLoadError=function(P,M){if(!M.fatal){var U=M.frag;if(!(!U||U.type!==P)){var K=this.fragCurrent;console.assert(K&&U.sn===K.sn&&U.level===K.level&&U.urlId===K.urlId,"Frag load error must match current frag to retry");var W=this.config;if(this.fragLoadError+1<=W.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(U.level))return;var X=Math.min(Math.pow(2,this.fragLoadError)*W.fragLoadingRetryDelay,W.fragLoadingMaxRetryTimeout);this.warn("Fragment "+U.sn+" of "+P+" "+U.level+" failed to load, retrying in "+X+"ms"),this.retryDate=self.performance.now()+X,this.fragLoadError++,this.state=R.FRAG_LOADING_WAITING_RETRY}else M.levelRetry?(P===n.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=R.IDLE):(O.logger.error(M.details+" reaches max retry, redispatch as fatal ..."),M.fatal=!0,this.hls.stopLoad(),this.state=R.ERROR)}}},I.afterBufferFlushed=function(P,M,U){if(!!P){var K=L.BufferHelper.getBuffered(P);this.fragmentTracker.detectEvictedFragments(M,K,U),this.state===R.ENDED&&this.resetLoadingState()}},I.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=R.IDLE},I.resetLiveStartWhenNotLoaded=function(P){if(!this.loadedmetadata){this.startFragRequested=!1;var M=this.levels?this.levels[P].details:null;if(M!=null&&M.live)return this.startPosition=-1,this.setStartPosition(M,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},I.updateLevelTiming=function(P,M,U,K){var W=this,X=U.details;console.assert(!!X,"level.details must be defined");var ie=Object.keys(P.elementaryStreams).reduce(function(se,le){var ve=P.elementaryStreams[le];if(ve){var q=ve.endPTS-ve.startPTS;if(q<=0)return W.warn("Could not parse fragment "+P.sn+" "+le+" duration reliably ("+q+") resetting transmuxer to fallback to playlist timing"),W.resetTransmuxer(),se||!1;var ee=K?0:Object(p.updateFragPTSDTS)(X,P,ve.startPTS,ve.endPTS,ve.startDTS,ve.endDTS);return W.hls.trigger(D.Events.LEVEL_PTS_UPDATED,{details:X,level:U,drift:ee,type:le,frag:P,start:ve.startPTS,end:ve.endPTS}),!0}return se},!1);ie?(this.state=R.PARSED,this.hls.trigger(D.Events.FRAG_PARSED,{frag:P,part:M})):this.resetLoadingState()},I.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},l(m,[{key:"state",get:function(){return this._state},set:function(P){var M=this._state;M!==P&&(this._state=P,this.log(M+"->"+P))}}]),m}(N.default)},"./src/controller/buffer-controller.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"default",function(){return f});var j=k("./src/polyfills/number.ts"),N=k("./src/events.ts"),v=k("./src/utils/logger.ts"),L=k("./src/errors.ts"),O=k("./src/utils/buffer-helper.ts"),D=k("./src/utils/mediasource-helper.ts"),w=k("./src/loader/fragment.ts"),g=k("./src/controller/buffer-operation-queue.ts"),b=Object(D.getMediaSource)(),T=/([ha]vc.)(?:\.[^.,]+)+/,f=function(){function p(u){var a=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var n=a.hls,s=a.media,l=a.mediaSource;v.logger.log("[buffer-controller]: Media source opened"),s&&(a.updateMediaElementDuration(),n.trigger(N.Events.MEDIA_ATTACHED,{media:s})),l&&l.removeEventListener("sourceopen",a._onMediaSourceOpen),a.checkPendingTracks()},this._onMediaSourceClose=function(){v.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){v.logger.log("[buffer-controller]: Media source ended")},this.hls=u,this._initSourceBuffer(),this.registerListeners()}var E=p.prototype;return E.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},E.destroy=function(){this.unregisterListeners(),this.details=null},E.registerListeners=function(){var a=this.hls;a.on(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(N.Events.BUFFER_RESET,this.onBufferReset,this),a.on(N.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.on(N.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.on(N.Events.BUFFER_EOS,this.onBufferEos,this),a.on(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.on(N.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.on(N.Events.FRAG_PARSED,this.onFragParsed,this),a.on(N.Events.FRAG_CHANGED,this.onFragChanged,this)},E.unregisterListeners=function(){var a=this.hls;a.off(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(N.Events.BUFFER_RESET,this.onBufferReset,this),a.off(N.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.off(N.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.off(N.Events.BUFFER_EOS,this.onBufferEos,this),a.off(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.off(N.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.off(N.Events.FRAG_PARSED,this.onFragParsed,this),a.off(N.Events.FRAG_CHANGED,this.onFragChanged,this)},E._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new g.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},E.onManifestParsed=function(a,n){var s=2;(n.audio&&!n.video||!n.altAudio)&&(s=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=s,this.details=null,v.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},E.onMediaAttaching=function(a,n){var s=this.media=n.media;if(s&&b){var l=this.mediaSource=new b;l.addEventListener("sourceopen",this._onMediaSourceOpen),l.addEventListener("sourceended",this._onMediaSourceEnded),l.addEventListener("sourceclose",this._onMediaSourceClose),s.src=self.URL.createObjectURL(l),this._objectUrl=s.src}},E.onMediaDetaching=function(){var a=this.media,n=this.mediaSource,s=this._objectUrl;if(n){if(v.logger.log("[buffer-controller]: media source detaching"),n.readyState==="open")try{n.endOfStream()}catch(l){v.logger.warn("[buffer-controller]: onMediaDetaching: "+l.message+" while calling endOfStream")}this.onBufferReset(),n.removeEventListener("sourceopen",this._onMediaSourceOpen),n.removeEventListener("sourceended",this._onMediaSourceEnded),n.removeEventListener("sourceclose",this._onMediaSourceClose),a&&(s&&self.URL.revokeObjectURL(s),a.src===s?(a.removeAttribute("src"),a.load()):v.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(N.Events.MEDIA_DETACHED,void 0)},E.onBufferReset=function(){var a=this;this.getSourceBufferTypes().forEach(function(n){var s=a.sourceBuffer[n];try{s&&(a.removeBufferListeners(n),a.mediaSource&&a.mediaSource.removeSourceBuffer(s),a.sourceBuffer[n]=void 0)}catch(l){v.logger.warn("[buffer-controller]: Failed to reset the "+n+" buffer",l)}}),this._initSourceBuffer()},E.onBufferCodecs=function(a,n){var s=this,l=this.getSourceBufferTypes().length;Object.keys(n).forEach(function(d){if(l){var A=s.tracks[d];if(A&&typeof A.buffer.changeType=="function"){var S=n[d],R=S.codec,y=S.levelCodec,_=S.container,m=(A.levelCodec||A.codec).replace(T,"$1"),I=(y||R).replace(T,"$1");if(m!==I){var B=_+";codecs="+(y||R);s.appendChangeType(d,B)}}}else s.pendingTracks[d]=n[d]}),!l&&(this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks())},E.appendChangeType=function(a,n){var s=this,l=this.operationQueue,d={execute:function(){var S=s.sourceBuffer[a];S&&(v.logger.log("[buffer-controller]: changing "+a+" sourceBuffer type to "+n),S.changeType(n)),l.shiftAndExecuteNext(a)},onStart:function(){},onComplete:function(){},onError:function(S){v.logger.warn("[buffer-controller]: Failed to change "+a+" SourceBuffer type",S)}};l.append(d,a)},E.onBufferAppending=function(a,n){var s=this,l=this.hls,d=this.operationQueue,A=this.tracks,S=n.data,R=n.type,y=n.frag,_=n.part,m=n.chunkMeta,I=m.buffering[R],B=self.performance.now();I.start=B;var P=y.stats.buffering,M=_?_.stats.buffering:null;P.start===0&&(P.start=B),M&&M.start===0&&(M.start=B);var U=A.audio,K=R==="audio"&&m.id===1&&(U==null?void 0:U.container)==="audio/mpeg",W={execute:function(){if(I.executeStart=self.performance.now(),K){var ie=s.sourceBuffer[R];if(ie){var se=y.start-ie.timestampOffset;Math.abs(se)>=.1&&(v.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+y.start+" (delta: "+se+") sn: "+y.sn+")"),ie.timestampOffset=y.start)}}s.appendExecutor(S,R)},onStart:function(){},onComplete:function(){var ie=self.performance.now();I.executeEnd=I.end=ie,P.first===0&&(P.first=ie),M&&M.first===0&&(M.first=ie);var se=s.sourceBuffer,le={};for(var ve in se)le[ve]=O.BufferHelper.getBuffered(se[ve]);s.appendError=0,s.hls.trigger(N.Events.BUFFER_APPENDED,{type:R,frag:y,part:_,chunkMeta:m,parent:y.type,timeRanges:le})},onError:function(ie){v.logger.error("[buffer-controller]: Error encountered while trying to append to the "+R+" SourceBuffer",ie);var se={type:L.ErrorTypes.MEDIA_ERROR,parent:y.type,details:L.ErrorDetails.BUFFER_APPEND_ERROR,err:ie,fatal:!1};ie.code===DOMException.QUOTA_EXCEEDED_ERR?se.details=L.ErrorDetails.BUFFER_FULL_ERROR:(s.appendError++,se.details=L.ErrorDetails.BUFFER_APPEND_ERROR,s.appendError>l.config.appendErrorMaxRetry&&(v.logger.error("[buffer-controller]: Failed "+l.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),se.fatal=!0)),l.trigger(N.Events.ERROR,se)}};d.append(W,R)},E.onBufferFlushing=function(a,n){var s=this,l=this.operationQueue,d=function(S){return{execute:s.removeExecutor.bind(s,S,n.startOffset,n.endOffset),onStart:function(){},onComplete:function(){s.hls.trigger(N.Events.BUFFER_FLUSHED,{type:S})},onError:function(y){v.logger.warn("[buffer-controller]: Failed to remove from "+S+" SourceBuffer",y)}}};n.type?l.append(d(n.type),n.type):this.getSourceBufferTypes().forEach(function(A){l.append(d(A),A)})},E.onFragParsed=function(a,n){var s=this,l=n.frag,d=n.part,A=[],S=d?d.elementaryStreams:l.elementaryStreams;S[w.ElementaryStreamTypes.AUDIOVIDEO]?A.push("audiovideo"):(S[w.ElementaryStreamTypes.AUDIO]&&A.push("audio"),S[w.ElementaryStreamTypes.VIDEO]&&A.push("video"));var R=function(){var _=self.performance.now();l.stats.buffering.end=_,d&&(d.stats.buffering.end=_);var m=d?d.stats:l.stats;s.hls.trigger(N.Events.FRAG_BUFFERED,{frag:l,part:d,stats:m,id:l.type})};A.length===0&&v.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+l.type+" level: "+l.level+" sn: "+l.sn),this.blockBuffers(R,A)},E.onFragChanged=function(a,n){this.flushBackBuffer()},E.onBufferEos=function(a,n){var s=this,l=this.getSourceBufferTypes().reduce(function(d,A){var S=s.sourceBuffer[A];return(!n.type||n.type===A)&&S&&!S.ended&&(S.ended=!0,v.logger.log("[buffer-controller]: "+A+" sourceBuffer now EOS")),d&&!!(!S||S.ended)},!0);l&&this.blockBuffers(function(){var d=s.mediaSource;!d||d.readyState!=="open"||d.endOfStream()})},E.onLevelUpdated=function(a,n){var s=n.details;!s.fragments.length||(this.details=s,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())},E.flushBackBuffer=function(){var a=this.hls,n=this.details,s=this.media,l=this.sourceBuffer;if(!(!s||n===null)){var d=this.getSourceBufferTypes();if(!!d.length){var A=n.live&&a.config.liveBackBufferLength!==null?a.config.liveBackBufferLength:a.config.backBufferLength;if(!(!Object(j.isFiniteNumber)(A)||A<0)){var S=s.currentTime,R=n.levelTargetDuration,y=Math.max(A,R),_=Math.floor(S/R)*R-y;d.forEach(function(m){var I=l[m];if(I){var B=O.BufferHelper.getBuffered(I);B.length>0&&_>B.start(0)&&(a.trigger(N.Events.BACK_BUFFER_REACHED,{bufferEnd:_}),n.live&&a.trigger(N.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:_}),a.trigger(N.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:_,type:m}))}})}}}},E.updateMediaElementDuration=function(){if(!(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")){var a=this.details,n=this.hls,s=this.media,l=this.mediaSource,d=a.fragments[0].start+a.totalduration,A=s.duration,S=Object(j.isFiniteNumber)(l.duration)?l.duration:0;a.live&&n.config.liveDurationInfinity?(v.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),l.duration=1/0,this.updateSeekableRange(a)):(d>S&&d>A||!Object(j.isFiniteNumber)(A))&&(v.logger.log("[buffer-controller]: Updating Media Source duration to "+d.toFixed(3)),l.duration=d)}},E.updateSeekableRange=function(a){var n=this.mediaSource,s=a.fragments,l=s.length;if(l&&a.live&&n!==null&&n!==void 0&&n.setLiveSeekableRange){var d=Math.max(0,s[0].start),A=Math.max(d,d+a.totalduration);n.setLiveSeekableRange(d,A)}},E.checkPendingTracks=function(){var a=this.bufferCodecEventsExpected,n=this.operationQueue,s=this.pendingTracks,l=Object.keys(s).length;if(l&&!a||l===2){this.createSourceBuffers(s),this.pendingTracks={};var d=this.getSourceBufferTypes();if(d.length===0){this.hls.trigger(N.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}d.forEach(function(A){n.executeNext(A)})}},E.createSourceBuffers=function(a){var n=this.sourceBuffer,s=this.mediaSource;if(!s)throw Error("createSourceBuffers called when mediaSource was null");var l=0;for(var d in a)if(!n[d]){var A=a[d];if(!A)throw Error("source buffer exists for track "+d+", however track does not");var S=A.levelCodec||A.codec,R=A.container+";codecs="+S;v.logger.log("[buffer-controller]: creating sourceBuffer("+R+")");try{var y=n[d]=s.addSourceBuffer(R),_=d;this.addBufferListener(_,"updatestart",this._onSBUpdateStart),this.addBufferListener(_,"updateend",this._onSBUpdateEnd),this.addBufferListener(_,"error",this._onSBUpdateError),this.tracks[d]={buffer:y,codec:S,container:A.container,levelCodec:A.levelCodec,id:A.id},l++}catch(m){v.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+m.message),this.hls.trigger(N.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:m,mimeType:R})}}l&&this.hls.trigger(N.Events.BUFFER_CREATED,{tracks:this.tracks})},E._onSBUpdateStart=function(a){var n=this.operationQueue,s=n.current(a);s.onStart()},E._onSBUpdateEnd=function(a){var n=this.operationQueue,s=n.current(a);s.onComplete(),n.shiftAndExecuteNext(a)},E._onSBUpdateError=function(a,n){v.logger.error("[buffer-controller]: "+a+" SourceBuffer error",n),this.hls.trigger(N.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var s=this.operationQueue.current(a);s&&s.onError(n)},E.removeExecutor=function(a,n,s){var l=this.media,d=this.mediaSource,A=this.operationQueue,S=this.sourceBuffer,R=S[a];if(!l||!d||!R){v.logger.warn("[buffer-controller]: Attempting to remove from the "+a+" SourceBuffer, but it does not exist"),A.shiftAndExecuteNext(a);return}var y=Object(j.isFiniteNumber)(l.duration)?l.duration:1/0,_=Object(j.isFiniteNumber)(d.duration)?d.duration:1/0,m=Math.max(0,n),I=Math.min(s,y,_);I>m?(v.logger.log("[buffer-controller]: Removing ["+m+","+I+"] from the "+a+" SourceBuffer"),console.assert(!R.updating,a+" sourceBuffer must not be updating"),R.remove(m,I)):A.shiftAndExecuteNext(a)},E.appendExecutor=function(a,n){var s=this.operationQueue,l=this.sourceBuffer,d=l[n];if(!d){v.logger.warn("[buffer-controller]: Attempting to append to the "+n+" SourceBuffer, but it does not exist"),s.shiftAndExecuteNext(n);return}d.ended=!1,console.assert(!d.updating,n+" sourceBuffer must not be updating"),d.appendBuffer(a)},E.blockBuffers=function(a,n){var s=this;if(n===void 0&&(n=this.getSourceBufferTypes()),!n.length){v.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(a);return}var l=this.operationQueue,d=n.map(function(A){return l.appendBlocker(A)});Promise.all(d).then(function(){a(),n.forEach(function(A){var S=s.sourceBuffer[A];(!S||!S.updating)&&l.shiftAndExecuteNext(A)})})},E.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},E.addBufferListener=function(a,n,s){var l=this.sourceBuffer[a];if(!!l){var d=s.bind(this,a);this.listeners[a].push({event:n,listener:d}),l.addEventListener(n,d)}},E.removeBufferListeners=function(a){var n=this.sourceBuffer[a];!n||this.listeners[a].forEach(function(s){n.removeEventListener(s.event,s.listener)})},p}()},"./src/controller/buffer-operation-queue.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"default",function(){return N});var j=k("./src/utils/logger.ts"),N=function(){function v(O){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=O}var L=v.prototype;return L.append=function(D,w){var g=this.queues[w];g.push(D),g.length===1&&this.buffers[w]&&this.executeNext(w)},L.insertAbort=function(D,w){var g=this.queues[w];g.unshift(D),this.executeNext(w)},L.appendBlocker=function(D){var w,g=new Promise(function(T){w=T}),b={execute:w,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(b,D),g},L.executeNext=function(D){var w=this.buffers,g=this.queues,b=w[D],T=g[D];if(T.length){var f=T[0];try{f.execute()}catch(p){j.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),f.onError(p),(!b||!b.updating)&&(T.shift(),this.executeNext(D))}}},L.shiftAndExecuteNext=function(D){this.queues[D].shift(),this.executeNext(D)},L.current=function(D){return this.queues[D][0]},v}()},"./src/controller/cap-level-controller.ts":function(de,H,k){"use strict";k.r(H);var j=k("./src/events.ts");function N(O,D){for(var w=0;w<D.length;w++){var g=D[w];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(O,g.key,g)}}function v(O,D,w){return D&&N(O.prototype,D),w&&N(O,w),O}var L=function(){function O(w){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=w,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var D=O.prototype;return D.setStreamController=function(g){this.streamController=g},D.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},D.registerListeners=function(){var g=this.hls;g.on(j.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.on(j.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.on(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.on(j.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.on(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},D.unregisterListener=function(){var g=this.hls;g.off(j.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.off(j.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.off(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.off(j.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.off(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},D.onFpsDropLevelCapping=function(g,b){O.isLevelAllowed(b.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(b.droppedLevel)},D.onMediaAttaching=function(g,b){this.media=b.media instanceof HTMLVideoElement?b.media:null},D.onManifestParsed=function(g,b){var T=this.hls;this.restrictedLevels=[],this.firstLevel=b.firstLevel,T.config.capLevelToPlayerSize&&b.video&&this.startCapping()},D.onBufferCodecs=function(g,b){var T=this.hls;T.config.capLevelToPlayerSize&&b.video&&this.startCapping()},D.onMediaDetaching=function(){this.stopCapping()},D.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var g=this.hls.levels;if(g.length){var b=this.hls;b.autoLevelCapping=this.getMaxLevel(g.length-1),b.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=b.autoLevelCapping}}},D.getMaxLevel=function(g){var b=this,T=this.hls.levels;if(!T.length)return-1;var f=T.filter(function(p,E){return O.isLevelAllowed(E,b.restrictedLevels)&&E<=g});return this.clientRect=null,O.getMaxLevelByMediaSize(f,this.mediaWidth,this.mediaHeight)},D.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},D.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},D.getDimensions=function(){if(this.clientRect)return this.clientRect;var g=this.media,b={width:0,height:0};if(g){var T=g.getBoundingClientRect();b.width=T.width,b.height=T.height,!b.width&&!b.height&&(b.width=T.right-T.left||g.width||0,b.height=T.bottom-T.top||g.height||0)}return this.clientRect=b,b},O.isLevelAllowed=function(g,b){return b===void 0&&(b=[]),b.indexOf(g)===-1},O.getMaxLevelByMediaSize=function(g,b,T){if(!g||!g.length)return-1;for(var f=function(n,s){return s?n.width!==s.width||n.height!==s.height:!0},p=g.length-1,E=0;E<g.length;E+=1){var u=g[E];if((u.width>=b||u.height>=T)&&f(u,g[E+1])){p=E;break}}return p},v(O,[{key:"mediaWidth",get:function(){return this.getDimensions().width*O.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*O.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var g=1;try{g=self.devicePixelRatio}catch(b){}return g}}]),O}();H.default=L},"./src/controller/cmcd-controller.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"default",function(){return f});var j=k("./src/events.ts"),N=k("./src/types/cmcd.ts"),v=k("./src/utils/buffer-helper.ts"),L=k("./src/utils/logger.ts");function O(p,E){for(var u=0;u<E.length;u++){var a=E[u];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(p,a.key,a)}}function D(p,E,u){return E&&O(p.prototype,E),u&&O(p,u),p}function w(p,E){var u=typeof Symbol!="undefined"&&p[Symbol.iterator]||p["@@iterator"];if(u)return(u=u.call(p)).next.bind(u);if(Array.isArray(p)||(u=g(p))||E&&p&&typeof p.length=="number"){u&&(p=u);var a=0;return function(){return a>=p.length?{done:!0}:{done:!1,value:p[a++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
148
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function g(p,E){if(!!p){if(typeof p=="string")return b(p,E);var u=Object.prototype.toString.call(p).slice(8,-1);if(u==="Object"&&p.constructor&&(u=p.constructor.name),u==="Map"||u==="Set")return Array.from(p);if(u==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u))return b(p,E)}}function b(p,E){(E==null||E>p.length)&&(E=p.length);for(var u=0,a=new Array(E);u<E;u++)a[u]=p[u];return a}function T(){return T=Object.assign||function(p){for(var E=1;E<arguments.length;E++){var u=arguments[E];for(var a in u)Object.prototype.hasOwnProperty.call(u,a)&&(p[a]=u[a])}return p},T.apply(this,arguments)}var f=function(){function p(u){var a=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){a.initialized&&(a.starved=!0),a.buffering=!0},this.onPlaying=function(){a.initialized||(a.initialized=!0),a.buffering=!1},this.applyPlaylistData=function(l){try{a.apply(l,{ot:N.CMCDObjectType.MANIFEST,su:!a.initialized})}catch(d){L.logger.warn("Could not generate manifest CMCD data.",d)}},this.applyFragmentData=function(l){try{var d=l.frag,A=a.hls.levels[d.level],S=a.getObjectType(d),R={d:d.duration*1e3,ot:S};(S===N.CMCDObjectType.VIDEO||S===N.CMCDObjectType.AUDIO||S==N.CMCDObjectType.MUXED)&&(R.br=A.bitrate/1e3,R.tb=a.getTopBandwidth(S),R.bl=a.getBufferLength(S)),a.apply(l,R)}catch(y){L.logger.warn("Could not generate segment CMCD data.",y)}},this.hls=u;var n=this.config=u.config,s=n.cmcd;s!=null&&(n.pLoader=this.createPlaylistLoader(),n.fLoader=this.createFragmentLoader(),this.sid=s.sessionId||p.uuid(),this.cid=s.contentId,this.useHeaders=s.useHeaders===!0,this.registerListeners())}var E=p.prototype;return E.registerListeners=function(){var a=this.hls;a.on(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(j.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.on(j.Events.BUFFER_CREATED,this.onBufferCreated,this)},E.unregisterListeners=function(){var a=this.hls;a.off(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(j.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.off(j.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},E.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},E.onMediaAttached=function(a,n){this.media=n.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},E.onMediaDetached=function(){!this.media||(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)},E.onBufferCreated=function(a,n){var s,l;this.audioBuffer=(s=n.tracks.audio)===null||s===void 0?void 0:s.buffer,this.videoBuffer=(l=n.tracks.video)===null||l===void 0?void 0:l.buffer},E.createData=function(){var a;return{v:N.CMCDVersion,sf:N.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(a=this.media)===null||a===void 0?void 0:a.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},E.apply=function(a,n){n===void 0&&(n={}),T(n,this.createData());var s=n.ot===N.CMCDObjectType.INIT||n.ot===N.CMCDObjectType.VIDEO||n.ot===N.CMCDObjectType.MUXED;if(this.starved&&s&&(n.bs=!0,n.su=!0,this.starved=!1),n.su==null&&(n.su=this.buffering),this.useHeaders){var l=p.toHeaders(n);if(!Object.keys(l).length)return;a.headers||(a.headers={}),T(a.headers,l)}else{var d=p.toQuery(n);if(!d)return;a.url=p.appendQueryToUri(a.url,d)}},E.getObjectType=function(a){var n=a.type;if(n==="subtitle")return N.CMCDObjectType.TIMED_TEXT;if(a.sn==="initSegment")return N.CMCDObjectType.INIT;if(n==="audio")return N.CMCDObjectType.AUDIO;if(n==="main")return this.hls.audioTracks.length?N.CMCDObjectType.VIDEO:N.CMCDObjectType.MUXED},E.getTopBandwidth=function(a){for(var n=0,s=a===N.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,l=w(s),d;!(d=l()).done;){var A=d.value;A.bitrate>n&&(n=A.bitrate)}return n>0?n:NaN},E.getBufferLength=function(a){var n=this.hls.media,s=a===N.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!s||!n)return NaN;var l=v.BufferHelper.bufferInfo(s,n.currentTime,this.config.maxBufferHole);return l.len*1e3},E.createPlaylistLoader=function(){var a=this.config.pLoader,n=this.applyPlaylistData,s=a||this.config.loader;return function(){function l(A){this.loader=void 0,this.loader=new s(A)}var d=l.prototype;return d.destroy=function(){this.loader.destroy()},d.abort=function(){this.loader.abort()},d.load=function(S,R,y){n(S),this.loader.load(S,R,y)},D(l,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),l}()},E.createFragmentLoader=function(){var a=this.config.fLoader,n=this.applyFragmentData,s=a||this.config.loader;return function(){function l(A){this.loader=void 0,this.loader=new s(A)}var d=l.prototype;return d.destroy=function(){this.loader.destroy()},d.abort=function(){this.loader.abort()},d.load=function(S,R,y){n(S),this.loader.load(S,R,y)},D(l,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),l}()},p.uuid=function(){var a=URL.createObjectURL(new Blob),n=a.toString();return URL.revokeObjectURL(a),n.substr(n.lastIndexOf("/")+1)},p.serialize=function(a){for(var n=[],s=function(K){return!Number.isNaN(K)&&K!=null&&K!==""&&K!==!1},l=function(K){return Math.round(K)},d=function(K){return l(K/100)*100},A=function(K){return encodeURIComponent(K)},S={br:l,d:l,bl:d,dl:d,mtp:d,nor:A,rtp:d,tb:l},R=Object.keys(a||{}).sort(),y=w(R),_;!(_=y()).done;){var m=_.value,I=a[m];if(!!s(I)&&!(m==="v"&&I===1)&&!(m=="pr"&&I===1)){var B=S[m];B&&(I=B(I));var P=typeof I,M=void 0;m==="ot"||m==="sf"||m==="st"?M=m+"="+I:P==="boolean"?M=m:P==="number"?M=m+"="+I:M=m+"="+JSON.stringify(I),n.push(M)}}return n.join(",")},p.toHeaders=function(a){for(var n=Object.keys(a),s={},l=["Object","Request","Session","Status"],d=[{},{},{},{}],A={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},S=0,R=n;S<R.length;S++){var y=R[S],_=A[y]!=null?A[y]:1;d[_][y]=a[y]}for(var m=0;m<d.length;m++){var I=p.serialize(d[m]);I&&(s["CMCD-"+l[m]]=I)}return s},p.toQuery=function(a){return"CMCD="+encodeURIComponent(p.serialize(a))},p.appendQueryToUri=function(a,n){if(!n)return a;var s=a.includes("?")?"&":"?";return""+a+s+n},p}()},"./src/controller/eme-controller.ts":function(de,H,k){"use strict";k.r(H);var j=k("./src/events.ts"),N=k("./src/errors.ts"),v=k("./src/utils/logger.ts"),L=k("./src/utils/mediakeys-helper.ts");function O(f,p){for(var E=0;E<p.length;E++){var u=p[E];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(f,u.key,u)}}function D(f,p,E){return p&&O(f.prototype,p),E&&O(f,E),f}var w=3,g=function(p,E,u){var a={audioCapabilities:[],videoCapabilities:[]};return p.forEach(function(n){a.audioCapabilities.push({contentType:'audio/mp4; codecs="'+n+'"',robustness:u.audioRobustness||""})}),E.forEach(function(n){a.videoCapabilities.push({contentType:'video/mp4; codecs="'+n+'"',robustness:u.videoRobustness||""})}),[a]},b=function(p,E,u,a){switch(p){case L.KeySystems.WIDEVINE:return g(E,u,a);default:throw new Error("Unknown key-system: "+p)}},T=function(){function f(E){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=E,this._config=E.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var p=f.prototype;return p.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},p._registerListeners=function(){this.hls.on(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(j.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(j.Events.MANIFEST_PARSED,this.onManifestParsed,this)},p._unregisterListeners=function(){this.hls.off(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(j.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(j.Events.MANIFEST_PARSED,this.onManifestParsed,this)},p.getLicenseServerUrl=function(u){switch(u){case L.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+u+'"')},p._attemptKeySystemAccess=function(u,a,n){var s=this,l=b(u,a,n,this._drmSystemOptions);v.logger.log("Requesting encrypted media key-system access");var d=this.requestMediaKeySystemAccess(u,l);this.mediaKeysPromise=d.then(function(A){return s._onMediaKeySystemAccessObtained(u,A)}),d.catch(function(A){v.logger.error('Failed to obtain key-system "'+u+'" access:',A)})},p._onMediaKeySystemAccessObtained=function(u,a){var n=this;v.logger.log('Access for key-system "'+u+'" obtained');var s={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:a,mediaKeySystemDomain:u};this._mediaKeysList.push(s);var l=Promise.resolve().then(function(){return a.createMediaKeys()}).then(function(d){return s.mediaKeys=d,v.logger.log('Media-keys created for key-system "'+u+'"'),n._onMediaKeysCreated(),d});return l.catch(function(d){v.logger.error("Failed to create media-keys:",d)}),l},p._onMediaKeysCreated=function(){var u=this;this._mediaKeysList.forEach(function(a){a.mediaKeysSession||(a.mediaKeysSession=a.mediaKeys.createSession(),u._onNewMediaKeySession(a.mediaKeysSession))})},p._onNewMediaKeySession=function(u){var a=this;v.logger.log("New key-system session "+u.sessionId),u.addEventListener("message",function(n){a._onKeySessionMessage(u,n.message)},!1)},p._onKeySessionMessage=function(u,a){v.logger.log("Got EME message event, creating license request"),this._requestLicense(a,function(n){v.logger.log("Received license data (length: "+(n&&n.byteLength)+"), updating key-session"),u.update(n)})},p.onMediaEncrypted=function(u){var a=this;if(v.logger.log('Media is encrypted using "'+u.initDataType+'" init data type'),!this.mediaKeysPromise){v.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(j.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var n=function(l){!a._media||(a._attemptSetMediaKeys(l),a._generateRequestWithPreferredKeySession(u.initDataType,u.initData))};this.mediaKeysPromise.then(n).catch(n)},p._attemptSetMediaKeys=function(u){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var a=this._mediaKeysList[0];if(!a||!a.mediaKeys){v.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(j.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}v.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(a.mediaKeys),this._hasSetMediaKeys=!0}},p._generateRequestWithPreferredKeySession=function(u,a){var n=this,s=this._mediaKeysList[0];if(!s){v.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(j.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(s.mediaKeysSessionInitialized){v.logger.warn("Key-Session already initialized but requested again");return}var l=s.mediaKeysSession;if(!l){v.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(j.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!a){v.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(j.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}v.logger.log('Generating key-session request for "'+u+'" init data type'),s.mediaKeysSessionInitialized=!0,l.generateRequest(u,a).then(function(){v.logger.debug("Key-session generation succeeded")}).catch(function(d){v.logger.error("Error generating key-session request:",d),n.hls.trigger(j.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},p._createLicenseXhr=function(u,a,n){var s=new XMLHttpRequest;s.responseType="arraybuffer",s.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,s,u,a,n);var l=this._licenseXhrSetup;if(l)try{l.call(this.hls,s,u),l=void 0}catch(d){v.logger.error(d)}try{s.readyState||s.open("POST",u,!0),l&&l.call(this.hls,s,u)}catch(d){throw new Error("issue setting up KeySystem license XHR "+d)}return s},p._onLicenseRequestReadyStageChange=function(u,a,n,s){switch(u.readyState){case 4:if(u.status===200){this._requestLicenseFailureCount=0,v.logger.log("License request succeeded");var l=u.response,d=this._licenseResponseCallback;if(d)try{l=d.call(this.hls,u,a)}catch(S){v.logger.error(S)}s(l)}else{if(v.logger.error("License Request XHR failed ("+a+"). Status: "+u.status+" ("+u.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>w){this.hls.trigger(j.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var A=w-this._requestLicenseFailureCount+1;v.logger.warn("Retrying license request, "+A+" attempts left"),this._requestLicense(n,s)}break}},p._generateLicenseRequestChallenge=function(u,a){switch(u.mediaKeySystemDomain){case L.KeySystems.WIDEVINE:return a}throw new Error("unsupported key-system: "+u.mediaKeySystemDomain)},p._requestLicense=function(u,a){v.logger.log("Requesting content license for key-system");var n=this._mediaKeysList[0];if(!n){v.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(j.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var s=this.getLicenseServerUrl(n.mediaKeySystemDomain),l=this._createLicenseXhr(s,u,a);v.logger.log("Sending license request to URL: "+s);var d=this._generateLicenseRequestChallenge(n,u);l.send(d)}catch(A){v.logger.error("Failure requesting DRM license: "+A),this.hls.trigger(j.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},p.onMediaAttached=function(u,a){if(!!this._emeEnabled){var n=a.media;this._media=n,n.addEventListener("encrypted",this._onMediaEncrypted)}},p.onMediaDetached=function(){var u=this._media,a=this._mediaKeysList;!u||(u.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(a.map(function(n){if(n.mediaKeysSession)return n.mediaKeysSession.close().catch(function(){})})).then(function(){return u.setMediaKeys(null)}).catch(function(){}))},p.onManifestParsed=function(u,a){if(!!this._emeEnabled){var n=a.levels.map(function(l){return l.audioCodec}).filter(function(l){return!!l}),s=a.levels.map(function(l){return l.videoCodec}).filter(function(l){return!!l});this._attemptKeySystemAccess(L.KeySystems.WIDEVINE,n,s)}},D(f,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),f}();H.default=T},"./src/controller/fps-controller.ts":function(de,H,k){"use strict";k.r(H);var j=k("./src/events.ts"),N=k("./src/utils/logger.ts"),v=function(){function L(D){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=D,this.registerListeners()}var O=L.prototype;return O.setStreamController=function(w){this.streamController=w},O.registerListeners=function(){this.hls.on(j.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},O.unregisterListeners=function(){this.hls.off(j.Events.MEDIA_ATTACHING,this.onMediaAttaching)},O.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},O.onMediaAttaching=function(w,g){var b=this.hls.config;if(b.capLevelOnFPSDrop){var T=g.media instanceof self.HTMLVideoElement?g.media:null;this.media=T,T&&typeof T.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),b.fpsDroppedMonitoringPeriod)}},O.checkFPS=function(w,g,b){var T=performance.now();if(g){if(this.lastTime){var f=T-this.lastTime,p=b-this.lastDroppedFrames,E=g-this.lastDecodedFrames,u=1e3*p/f,a=this.hls;if(a.trigger(j.Events.FPS_DROP,{currentDropped:p,currentDecoded:E,totalDroppedFrames:b}),u>0&&p>a.config.fpsDroppedMonitoringThreshold*E){var n=a.currentLevel;N.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+n),n>0&&(a.autoLevelCapping===-1||a.autoLevelCapping>=n)&&(n=n-1,a.trigger(j.Events.FPS_DROP_LEVEL_CAPPING,{level:n,droppedLevel:a.currentLevel}),a.autoLevelCapping=n,this.streamController.nextLevelSwitch())}}this.lastTime=T,this.lastDroppedFrames=b,this.lastDecodedFrames=g}},O.checkFPSInterval=function(){var w=this.media;if(w)if(this.isVideoPlaybackQualityAvailable){var g=w.getVideoPlaybackQuality();this.checkFPS(w,g.totalVideoFrames,g.droppedVideoFrames)}else this.checkFPS(w,w.webkitDecodedFrameCount,w.webkitDroppedFrameCount)},L}();H.default=v},"./src/controller/fragment-finders.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"findFragmentByPDT",function(){return v}),k.d(H,"findFragmentByPTS",function(){return L}),k.d(H,"fragmentWithinToleranceTest",function(){return O}),k.d(H,"pdtWithinToleranceTest",function(){return D}),k.d(H,"findFragWithCC",function(){return w});var j=k("./src/polyfills/number.ts"),N=k("./src/utils/binary-search.ts");function v(g,b,T){if(b===null||!Array.isArray(g)||!g.length||!Object(j.isFiniteNumber)(b))return null;var f=g[0].programDateTime;if(b<(f||0))return null;var p=g[g.length-1].endProgramDateTime;if(b>=(p||0))return null;T=T||0;for(var E=0;E<g.length;++E){var u=g[E];if(D(b,T,u))return u}return null}function L(g,b,T,f){T===void 0&&(T=0),f===void 0&&(f=0);var p=null;if(g?p=b[g.sn-b[0].sn+1]||null:T===0&&b[0].start===0&&(p=b[0]),p&&O(T,f,p)===0)return p;var E=N.default.search(b,O.bind(null,T,f));return E||p}function O(g,b,T){g===void 0&&(g=0),b===void 0&&(b=0);var f=Math.min(b,T.duration+(T.deltaPTS?T.deltaPTS:0));return T.start+T.duration-f<=g?1:T.start-f>g&&T.start?-1:0}function D(g,b,T){var f=Math.min(b,T.duration+(T.deltaPTS?T.deltaPTS:0))*1e3,p=T.endProgramDateTime||0;return p-f>g}function w(g,b){return N.default.search(g,function(T){return T.cc<b?1:T.cc>b?-1:0})}},"./src/controller/fragment-tracker.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"FragmentState",function(){return v}),k.d(H,"FragmentTracker",function(){return L});var j=k("./src/events.ts"),N=k("./src/types/loader.ts"),v;(function(w){w.NOT_LOADED="NOT_LOADED",w.BACKTRACKED="BACKTRACKED",w.APPENDING="APPENDING",w.PARTIAL="PARTIAL",w.OK="OK"})(v||(v={}));var L=function(){function w(b){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=b,this._registerListeners()}var g=w.prototype;return g._registerListeners=function(){var T=this.hls;T.on(j.Events.BUFFER_APPENDED,this.onBufferAppended,this),T.on(j.Events.FRAG_BUFFERED,this.onFragBuffered,this),T.on(j.Events.FRAG_LOADED,this.onFragLoaded,this)},g._unregisterListeners=function(){var T=this.hls;T.off(j.Events.BUFFER_APPENDED,this.onBufferAppended,this),T.off(j.Events.FRAG_BUFFERED,this.onFragBuffered,this),T.off(j.Events.FRAG_LOADED,this.onFragLoaded,this)},g.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},g.getAppendedFrag=function(T,f){if(f===N.PlaylistLevelType.MAIN){var p=this.activeFragment,E=this.activeParts;if(!p)return null;if(E)for(var u=E.length;u--;){var a=E[u],n=a?a.end:p.appendedPTS;if(a.start<=T&&n!==void 0&&T<=n)return u>9&&(this.activeParts=E.slice(u-9)),a}else if(p.start<=T&&p.appendedPTS!==void 0&&T<=p.appendedPTS)return p}return this.getBufferedFrag(T,f)},g.getBufferedFrag=function(T,f){for(var p=this.fragments,E=Object.keys(p),u=E.length;u--;){var a=p[E[u]];if((a==null?void 0:a.body.type)===f&&a.buffered){var n=a.body;if(n.start<=T&&T<=n.end)return n}}return null},g.detectEvictedFragments=function(T,f,p){var E=this;Object.keys(this.fragments).forEach(function(u){var a=E.fragments[u];if(!!a){if(!a.buffered){a.body.type===p&&E.removeFragment(a.body);return}var n=a.range[T];!n||n.time.some(function(s){var l=!E.isTimeBuffered(s.startPTS,s.endPTS,f);return l&&E.removeFragment(a.body),l})}})},g.detectPartialFragments=function(T){var f=this,p=this.timeRanges,E=T.frag,u=T.part;if(!(!p||E.sn==="initSegment")){var a=D(E),n=this.fragments[a];!n||(Object.keys(p).forEach(function(s){var l=E.elementaryStreams[s];if(!!l){var d=p[s],A=u!==null||l.partial===!0;n.range[s]=f.getBufferedTimes(E,u,A,d)}}),n.backtrack=n.loaded=null,Object.keys(n.range).length?n.buffered=!0:this.removeFragment(n.body))}},g.fragBuffered=function(T){var f=D(T),p=this.fragments[f];p&&(p.backtrack=p.loaded=null,p.buffered=!0)},g.getBufferedTimes=function(T,f,p,E){for(var u={time:[],partial:p},a=f?f.start:T.start,n=f?f.end:T.end,s=T.minEndPTS||n,l=T.maxStartPTS||a,d=0;d<E.length;d++){var A=E.start(d)-this.bufferPadding,S=E.end(d)+this.bufferPadding;if(l>=A&&s<=S){u.time.push({startPTS:Math.max(a,E.start(d)),endPTS:Math.min(n,E.end(d))});break}else if(a<S&&n>A)u.partial=!0,u.time.push({startPTS:Math.max(a,E.start(d)),endPTS:Math.min(n,E.end(d))});else if(n<=A)break}return u},g.getPartialFragment=function(T){var f=null,p,E,u,a=0,n=this.bufferPadding,s=this.fragments;return Object.keys(s).forEach(function(l){var d=s[l];!d||O(d)&&(E=d.body.start-n,u=d.body.end+n,T>=E&&T<=u&&(p=Math.min(T-E,u-T),a<=p&&(f=d.body,a=p)))}),f},g.getState=function(T){var f=D(T),p=this.fragments[f];return p?p.buffered?O(p)?v.PARTIAL:v.OK:p.backtrack?v.BACKTRACKED:v.APPENDING:v.NOT_LOADED},g.backtrack=function(T,f){var p=D(T),E=this.fragments[p];if(!E||E.backtrack)return null;var u=E.backtrack=f||E.loaded;return E.loaded=null,u},g.getBacktrackData=function(T){var f=D(T),p=this.fragments[f];if(p){var E,u=p.backtrack;if(u!=null&&(E=u.payload)!==null&&E!==void 0&&E.byteLength)return u;this.removeFragment(T)}return null},g.isTimeBuffered=function(T,f,p){for(var E,u,a=0;a<p.length;a++){if(E=p.start(a)-this.bufferPadding,u=p.end(a)+this.bufferPadding,T>=E&&f<=u)return!0;if(f<=E)return!1}return!1},g.onFragLoaded=function(T,f){var p=f.frag,E=f.part;if(!(p.sn==="initSegment"||p.bitrateTest||E)){var u=D(p);this.fragments[u]={body:p,loaded:f,backtrack:null,buffered:!1,range:Object.create(null)}}},g.onBufferAppended=function(T,f){var p=this,E=f.frag,u=f.part,a=f.timeRanges;if(E.type===N.PlaylistLevelType.MAIN)if(this.activeFragment=E,u){var n=this.activeParts;n||(this.activeParts=n=[]),n.push(u)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach(function(s){var l=a[s];if(p.detectEvictedFragments(s,l),!u)for(var d=0;d<l.length;d++)E.appendedPTS=Math.max(l.end(d),E.appendedPTS||0)})},g.onFragBuffered=function(T,f){this.detectPartialFragments(f)},g.hasFragment=function(T){var f=D(T);return!!this.fragments[f]},g.removeFragmentsInRange=function(T,f,p){var E=this;Object.keys(this.fragments).forEach(function(u){var a=E.fragments[u];if(!!a&&a.buffered){var n=a.body;n.type===p&&n.start<f&&n.end>T&&E.removeFragment(n)}})},g.removeFragment=function(T){var f=D(T);T.stats.loaded=0,T.clearElementaryStreamInfo(),delete this.fragments[f]},g.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},w}();function O(w){var g,b;return w.buffered&&(((g=w.range.video)===null||g===void 0?void 0:g.partial)||((b=w.range.audio)===null||b===void 0?void 0:b.partial))}function D(w){return w.type+"_"+w.level+"_"+w.urlId+"_"+w.sn}},"./src/controller/gap-controller.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"STALL_MINIMUM_DURATION_MS",function(){return O}),k.d(H,"MAX_START_GAP_JUMP",function(){return D}),k.d(H,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return w}),k.d(H,"SKIP_BUFFER_RANGE_START",function(){return g}),k.d(H,"default",function(){return b});var j=k("./src/utils/buffer-helper.ts"),N=k("./src/errors.ts"),v=k("./src/events.ts"),L=k("./src/utils/logger.ts"),O=250,D=2,w=.1,g=.05,b=function(){function T(p,E,u,a){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=p,this.media=E,this.fragmentTracker=u,this.hls=a}var f=T.prototype;return f.destroy=function(){this.hls=this.fragmentTracker=this.media=null},f.poll=function(E){var u=this.config,a=this.media,n=this.stalled,s=a.currentTime,l=a.seeking,d=this.seeking&&!l,A=!this.seeking&&l;if(this.seeking=l,s!==E){if(this.moved=!0,n!==null){if(this.stallReported){var S=self.performance.now()-n;L.logger.warn("playback not stuck anymore @"+s+", after "+Math.round(S)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((A||d)&&(this.stalled=null),!(a.paused||a.ended||a.playbackRate===0||!j.BufferHelper.getBuffered(a).length)){var R=j.BufferHelper.bufferInfo(a,s,0),y=R.len>0,_=R.nextStart||0;if(!(!y&&!_)){if(l){var m=R.len>D,I=!_||_-s>D&&!this.fragmentTracker.getPartialFragment(s);if(m||I)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var B,P=Math.max(_,R.start||0)-s,M=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,U=M==null||(B=M.details)===null||B===void 0?void 0:B.live,K=U?M.details.targetduration*2:D;if(P>0&&P<=K){this._trySkipBufferHole(null);return}}var W=self.performance.now();if(n===null){this.stalled=W;return}var X=W-n;!l&&X>=O&&this._reportStall(R.len);var ie=j.BufferHelper.bufferInfo(a,s,u.maxBufferHole);this._tryFixBufferStall(ie,X)}}},f._tryFixBufferStall=function(E,u){var a=this.config,n=this.fragmentTracker,s=this.media,l=s.currentTime,d=n.getPartialFragment(l);if(d){var A=this._trySkipBufferHole(d);if(A)return}E.len>a.maxBufferHole&&u>a.highBufferWatchdogPeriod*1e3&&(L.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},f._reportStall=function(E){var u=this.hls,a=this.media,n=this.stallReported;n||(this.stallReported=!0,L.logger.warn("Playback stalling at @"+a.currentTime+" due to low buffer (buffer="+E+")"),u.trigger(v.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:E}))},f._trySkipBufferHole=function(E){for(var u=this.config,a=this.hls,n=this.media,s=n.currentTime,l=0,d=j.BufferHelper.getBuffered(n),A=0;A<d.length;A++){var S=d.start(A);if(s+u.maxBufferHole>=l&&s<S){var R=Math.max(S+g,n.currentTime+w);return L.logger.warn("skipping hole, adjusting currentTime from "+s+" to "+R),this.moved=!0,this.stalled=null,n.currentTime=R,E&&a.trigger(v.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+s+" to "+R,frag:E}),R}l=d.end(A)}return 0},f._tryNudgeBuffer=function(){var E=this.config,u=this.hls,a=this.media,n=a.currentTime,s=(this.nudgeRetry||0)+1;if(this.nudgeRetry=s,s<E.nudgeMaxRetry){var l=n+s*E.nudgeOffset;L.logger.warn("Nudging 'currentTime' from "+n+" to "+l),a.currentTime=l,u.trigger(v.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else L.logger.error("Playhead still not moving while enough data buffered @"+n+" after "+E.nudgeMaxRetry+" nudges"),u.trigger(v.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},T}()},"./src/controller/id3-track-controller.ts":function(de,H,k){"use strict";k.r(H);var j=k("./src/events.ts"),N=k("./src/utils/texttrack-utils.ts"),v=k("./src/demux/id3.ts"),L=.25,O=function(){function D(g){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=g,this._registerListeners()}var w=D.prototype;return w.destroy=function(){this._unregisterListeners()},w._registerListeners=function(){var b=this.hls;b.on(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),b.on(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),b.on(j.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),b.on(j.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},w._unregisterListeners=function(){var b=this.hls;b.off(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),b.off(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),b.off(j.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),b.off(j.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},w.onMediaAttached=function(b,T){this.media=T.media},w.onMediaDetaching=function(){!this.id3Track||(Object(N.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null)},w.getID3Track=function(b){if(!!this.media){for(var T=0;T<b.length;T++){var f=b[T];if(f.kind==="metadata"&&f.label==="id3")return Object(N.sendAddTrackEvent)(f,this.media),f}return this.media.addTextTrack("metadata","id3")}},w.onFragParsingMetadata=function(b,T){if(!!this.media){var f=T.frag,p=T.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var E=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,u=0;u<p.length;u++){var a=v.getID3Frames(p[u].data);if(a){var n=p[u].pts,s=u<p.length-1?p[u+1].pts:f.end,l=s-n;l<=0&&(s=n+L);for(var d=0;d<a.length;d++){var A=a[d];if(!v.isTimeStampFrame(A)){var S=new E(n,s,"");S.value=A,this.id3Track.addCue(S)}}}}}},w.onBufferFlushing=function(b,T){var f=T.startOffset,p=T.endOffset,E=T.type;if(!E||E==="audio"){var u=this.id3Track;u&&Object(N.removeCuesInRange)(u,f,p)}},D}();H.default=O},"./src/controller/latency-controller.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"default",function(){return D});var j=k("./src/errors.ts"),N=k("./src/events.ts"),v=k("./src/utils/logger.ts");function L(w,g){for(var b=0;b<g.length;b++){var T=g[b];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(w,T.key,T)}}function O(w,g,b){return g&&L(w.prototype,g),b&&L(w,b),w}var D=function(){function w(b){var T=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return T.timeupdate()},this.hls=b,this.config=b.config,this.registerListeners()}var g=w.prototype;return g.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},g.registerListeners=function(){this.hls.on(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(N.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(N.Events.ERROR,this.onError,this)},g.unregisterListeners=function(){this.hls.off(N.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(N.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(N.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(N.Events.ERROR,this.onError)},g.onMediaAttached=function(T,f){this.media=f.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},g.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},g.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},g.onLevelUpdated=function(T,f){var p=f.details;this.levelDetails=p,p.advanced&&this.timeupdate(),!p.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},g.onError=function(T,f){f.details===j.ErrorDetails.BUFFER_STALLED_ERROR&&(this.stallCount++,v.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))},g.timeupdate=function(){var T=this.media,f=this.levelDetails;if(!(!T||!f)){this.currentTime=T.currentTime;var p=this.computeLatency();if(p!==null){this._latency=p;var E=this.config,u=E.lowLatencyMode,a=E.maxLiveSyncPlaybackRate;if(!(!u||a===1)){var n=this.targetLatency;if(n!==null){var s=p-n,l=Math.min(this.maxLatency,n+f.targetduration),d=s<l;if(f.live&&d&&s>.05&&this.forwardBufferLength>1){var A=Math.min(2,Math.max(1,a)),S=Math.round(2/(1+Math.exp(-.75*s-this.edgeStalled))*20)/20;T.playbackRate=Math.min(A,Math.max(1,S))}else T.playbackRate!==1&&T.playbackRate!==0&&(T.playbackRate=1)}}}}},g.estimateLiveEdge=function(){var T=this.levelDetails;return T===null?null:T.edge+T.age},g.computeLatency=function(){var T=this.estimateLiveEdge();return T===null?null:T-this.currentTime},O(w,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var T=this.config,f=this.levelDetails;return T.liveMaxLatencyDuration!==void 0?T.liveMaxLatencyDuration:f?T.liveMaxLatencyDurationCount*f.targetduration:0}},{key:"targetLatency",get:function(){var T=this.levelDetails;if(T===null)return null;var f=T.holdBack,p=T.partHoldBack,E=T.targetduration,u=this.config,a=u.liveSyncDuration,n=u.liveSyncDurationCount,s=u.lowLatencyMode,l=this.hls.userConfig,d=s&&p||f;(l.liveSyncDuration||l.liveSyncDurationCount||d===0)&&(d=a!==void 0?a:n*E);var A=E,S=1;return d+Math.min(this.stallCount*S,A)}},{key:"liveSyncPosition",get:function(){var T=this.estimateLiveEdge(),f=this.targetLatency,p=this.levelDetails;if(T===null||f===null||p===null)return null;var E=p.edge,u=T-f-this.edgeStalled,a=E-p.totalduration,n=E-(this.config.lowLatencyMode&&p.partTarget||p.targetduration);return Math.min(Math.max(a,u),n)}},{key:"drift",get:function(){var T=this.levelDetails;return T===null?1:T.drift}},{key:"edgeStalled",get:function(){var T=this.levelDetails;if(T===null)return 0;var f=(this.config.lowLatencyMode&&T.partTarget||T.targetduration)*3;return Math.max(T.age-f,0)}},{key:"forwardBufferLength",get:function(){var T=this.media,f=this.levelDetails;if(!T||!f)return 0;var p=T.buffered.length;return p?T.buffered.end(p-1):f.edge-this.currentTime}}]),w}()},"./src/controller/level-controller.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"default",function(){return u});var j=k("./src/types/level.ts"),N=k("./src/events.ts"),v=k("./src/errors.ts"),L=k("./src/utils/codecs.ts"),O=k("./src/controller/level-helper.ts"),D=k("./src/controller/base-playlist-controller.ts"),w=k("./src/types/loader.ts");function g(){return g=Object.assign||function(a){for(var n=1;n<arguments.length;n++){var s=arguments[n];for(var l in s)Object.prototype.hasOwnProperty.call(s,l)&&(a[l]=s[l])}return a},g.apply(this,arguments)}function b(a,n){for(var s=0;s<n.length;s++){var l=n[s];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(a,l.key,l)}}function T(a,n,s){return n&&b(a.prototype,n),s&&b(a,s),a}function f(a,n){a.prototype=Object.create(n.prototype),a.prototype.constructor=a,p(a,n)}function p(a,n){return p=Object.setPrototypeOf||function(l,d){return l.__proto__=d,l},p(a,n)}var E=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),u=function(a){f(n,a);function n(l){var d;return d=a.call(this,l,"[level-controller]")||this,d._levels=[],d._firstLevel=-1,d._startLevel=void 0,d.currentLevelIndex=-1,d.manualLevelIndex=-1,d.onParsedComplete=void 0,d._registerListeners(),d}var s=n.prototype;return s._registerListeners=function(){var d=this.hls;d.on(N.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.on(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(N.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),d.on(N.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(N.Events.ERROR,this.onError,this)},s._unregisterListeners=function(){var d=this.hls;d.off(N.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.off(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(N.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),d.off(N.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(N.Events.ERROR,this.onError,this)},s.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,a.prototype.destroy.call(this)},s.startLoad=function(){var d=this._levels;d.forEach(function(A){A.loadError=0}),a.prototype.startLoad.call(this)},s.onManifestLoaded=function(d,A){var S=[],R=[],y=[],_,m={},I,B=!1,P=!1,M=!1;if(A.levels.forEach(function(X){var ie=X.attrs;B=B||!!(X.width&&X.height),P=P||!!X.videoCodec,M=M||!!X.audioCodec,E&&X.audioCodec&&X.audioCodec.indexOf("mp4a.40.34")!==-1&&(X.audioCodec=void 0);var se=X.bitrate+"-"+X.attrs.RESOLUTION+"-"+X.attrs.CODECS;I=m[se],I?I.url.push(X.url):(I=new j.Level(X),m[se]=I,S.push(I)),ie&&(ie.AUDIO&&Object(O.addGroupId)(I,"audio",ie.AUDIO),ie.SUBTITLES&&Object(O.addGroupId)(I,"text",ie.SUBTITLES))}),(B||P)&&M&&(S=S.filter(function(X){var ie=X.videoCodec,se=X.width,le=X.height;return!!ie||!!(se&&le)})),S=S.filter(function(X){var ie=X.audioCodec,se=X.videoCodec;return(!ie||Object(L.isCodecSupportedInMp4)(ie,"audio"))&&(!se||Object(L.isCodecSupportedInMp4)(se,"video"))}),A.audioTracks&&(R=A.audioTracks.filter(function(X){return!X.audioCodec||Object(L.isCodecSupportedInMp4)(X.audioCodec,"audio")}),Object(O.assignTrackIdsByGroup)(R)),A.subtitles&&(y=A.subtitles,Object(O.assignTrackIdsByGroup)(y)),S.length>0){_=S[0].bitrate,S.sort(function(X,ie){return X.bitrate-ie.bitrate}),this._levels=S;for(var U=0;U<S.length;U++)if(S[U].bitrate===_){this._firstLevel=U,this.log("manifest loaded, "+S.length+" level(s) found, first bitrate: "+_);break}var K=M&&!P,W={levels:S,audioTracks:R,subtitleTracks:y,firstLevel:this._firstLevel,stats:A.stats,audio:M,video:P,altAudio:!K&&R.some(function(X){return!!X.url})};this.hls.trigger(N.Events.MANIFEST_PARSED,W),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(N.Events.ERROR,{type:v.ErrorTypes.MEDIA_ERROR,details:v.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:A.url,reason:"no level with compatible codecs found in manifest"})},s.onError=function(d,A){if(a.prototype.onError.call(this,d,A),!A.fatal){var S=A.context,R=this._levels[this.currentLevelIndex];if(S&&(S.type===w.PlaylistContextType.AUDIO_TRACK&&R.audioGroupIds&&S.groupId===R.audioGroupIds[R.urlId]||S.type===w.PlaylistContextType.SUBTITLE_TRACK&&R.textGroupIds&&S.groupId===R.textGroupIds[R.urlId])){this.redundantFailover(this.currentLevelIndex);return}var y=!1,_=!0,m;switch(A.details){case v.ErrorDetails.FRAG_LOAD_ERROR:case v.ErrorDetails.FRAG_LOAD_TIMEOUT:case v.ErrorDetails.KEY_LOAD_ERROR:case v.ErrorDetails.KEY_LOAD_TIMEOUT:if(A.frag){var I=this._levels[A.frag.level];I?(I.fragmentError++,I.fragmentError>this.hls.config.fragLoadingMaxRetry&&(m=A.frag.level)):m=A.frag.level}break;case v.ErrorDetails.LEVEL_LOAD_ERROR:case v.ErrorDetails.LEVEL_LOAD_TIMEOUT:S&&(S.deliveryDirectives&&(_=!1),m=S.level),y=!0;break;case v.ErrorDetails.REMUX_ALLOC_ERROR:m=A.level,y=!0;break}m!==void 0&&this.recoverLevel(A,m,y,_)}},s.recoverLevel=function(d,A,S,R){var y=d.details,_=this._levels[A];if(_.loadError++,S){var m=this.retryLoadingOrFail(d);if(m)d.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(R){var I=_.url.length;if(I>1&&_.loadError<I)d.levelRetry=!0,this.redundantFailover(A);else if(this.manualLevelIndex===-1){var B=A===0?this._levels.length-1:A-1;this.currentLevelIndex!==B&&this._levels[B].loadError===0&&(this.warn(y+": switch to "+B),d.levelRetry=!0,this.hls.nextAutoLevel=B)}}},s.redundantFailover=function(d){var A=this._levels[d],S=A.url.length;if(S>1){var R=(A.urlId+1)%S;this.warn("Switching to redundant URL-id "+R),this._levels.forEach(function(y){y.urlId=R}),this.level=d}},s.onFragLoaded=function(d,A){var S=A.frag;if(S!==void 0&&S.type===w.PlaylistLevelType.MAIN){var R=this._levels[S.level];R!==void 0&&(R.fragmentError=0,R.loadError=0)}},s.onLevelLoaded=function(d,A){var S,R=A.level,y=A.details,_=this._levels[R];if(!_){var m;this.warn("Invalid level index "+R),(m=A.deliveryDirectives)!==null&&m!==void 0&&m.skip&&(y.deltaUpdateFailed=!0);return}R===this.currentLevelIndex?(_.fragmentError===0&&(_.loadError=0,this.retryCount=0),this.playlistLoaded(R,A,_.details)):(S=A.deliveryDirectives)!==null&&S!==void 0&&S.skip&&(y.deltaUpdateFailed=!0)},s.onAudioTrackSwitched=function(d,A){var S=this.hls.levels[this.currentLevelIndex];if(!!S&&S.audioGroupIds){for(var R=-1,y=this.hls.audioTracks[A.id].groupId,_=0;_<S.audioGroupIds.length;_++)if(S.audioGroupIds[_]===y){R=_;break}R!==S.urlId&&(S.urlId=R,this.startLoad())}},s.loadPlaylist=function(d){var A=this.currentLevelIndex,S=this._levels[A];if(this.canLoad&&S&&S.url.length>0){var R=S.urlId,y=S.url[R];if(d)try{y=d.addDirectives(y)}catch(_){this.warn("Could not construct new URL with HLS Delivery Directives: "+_)}this.log("Attempt loading level index "+A+(d?" at sn "+d.msn+" part "+d.part:"")+" with URL-id "+R+" "+y),this.clearTimer(),this.hls.trigger(N.Events.LEVEL_LOADING,{url:y,level:A,id:R,deliveryDirectives:d||null})}},s.removeLevel=function(d,A){var S=function(_,m){return m!==A},R=this._levels.filter(function(y,_){return _!==d?!0:y.url.length>1&&A!==void 0?(y.url=y.url.filter(S),y.audioGroupIds&&(y.audioGroupIds=y.audioGroupIds.filter(S)),y.textGroupIds&&(y.textGroupIds=y.textGroupIds.filter(S)),y.urlId=0,!0):!1}).map(function(y,_){var m=y.details;return m!=null&&m.fragments&&m.fragments.forEach(function(I){I.level=_}),y});this._levels=R,this.hls.trigger(N.Events.LEVELS_UPDATED,{levels:R})},T(n,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(d){var A,S=this._levels;if(S.length!==0&&!(this.currentLevelIndex===d&&(A=S[d])!==null&&A!==void 0&&A.details)){if(d<0||d>=S.length){var R=d<0;if(this.hls.trigger(N.Events.ERROR,{type:v.ErrorTypes.OTHER_ERROR,details:v.ErrorDetails.LEVEL_SWITCH_ERROR,level:d,fatal:R,reason:"invalid level idx"}),R)return;d=Math.min(d,S.length-1)}this.clearTimer();var y=this.currentLevelIndex,_=S[y],m=S[d];this.log("switching to level "+d+" from "+y),this.currentLevelIndex=d;var I=g({},m,{level:d,maxBitrate:m.maxBitrate,uri:m.uri,urlId:m.urlId});delete I._urlId,this.hls.trigger(N.Events.LEVEL_SWITCHING,I);var B=m.details;if(!B||B.live){var P=this.switchParams(m.uri,_==null?void 0:_.details);this.loadPlaylist(P)}}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(d){this.manualLevelIndex=d,this._startLevel===void 0&&(this._startLevel=d),d!==-1&&(this.level=d)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(d){this._firstLevel=d}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var d=this.hls.config.startLevel;return d!==void 0?d:this._firstLevel}else return this._startLevel},set:function(d){this._startLevel=d}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(d){this.level=d,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=d)}}]),n}(D.default)},"./src/controller/level-helper.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"addGroupId",function(){return v}),k.d(H,"assignTrackIdsByGroup",function(){return L}),k.d(H,"updatePTS",function(){return O}),k.d(H,"updateFragPTSDTS",function(){return w}),k.d(H,"mergeDetails",function(){return g}),k.d(H,"mapPartIntersection",function(){return b}),k.d(H,"mapFragmentIntersection",function(){return T}),k.d(H,"adjustSliding",function(){return f}),k.d(H,"addSliding",function(){return p}),k.d(H,"computeReloadInterval",function(){return E}),k.d(H,"getFragmentWithSN",function(){return u}),k.d(H,"getPartWith",function(){return a});var j=k("./src/polyfills/number.ts"),N=k("./src/utils/logger.ts");function v(n,s,l){switch(s){case"audio":n.audioGroupIds||(n.audioGroupIds=[]),n.audioGroupIds.push(l);break;case"text":n.textGroupIds||(n.textGroupIds=[]),n.textGroupIds.push(l);break}}function L(n){var s={};n.forEach(function(l){var d=l.groupId||"";l.id=s[d]=s[d]||0,s[d]++})}function O(n,s,l){var d=n[s],A=n[l];D(d,A)}function D(n,s){var l=s.startPTS;if(Object(j.isFiniteNumber)(l)){var d=0,A;s.sn>n.sn?(d=l-n.start,A=n):(d=n.start-l,A=s),A.duration!==d&&(A.duration=d)}else if(s.sn>n.sn){var S=n.cc===s.cc;S&&n.minEndPTS?s.start=n.start+(n.minEndPTS-n.start):s.start=n.start+n.duration}else s.start=Math.max(n.start-s.duration,0)}function w(n,s,l,d,A,S){var R=d-l;R<=0&&(N.logger.warn("Fragment should have a positive duration",s),d=l+s.duration,S=A+s.duration);var y=l,_=d,m=s.startPTS,I=s.endPTS;if(Object(j.isFiniteNumber)(m)){var B=Math.abs(m-l);Object(j.isFiniteNumber)(s.deltaPTS)?s.deltaPTS=Math.max(B,s.deltaPTS):s.deltaPTS=B,y=Math.max(l,m),l=Math.min(l,m),A=Math.min(A,s.startDTS),_=Math.min(d,I),d=Math.max(d,I),S=Math.max(S,s.endDTS)}s.duration=d-l;var P=l-s.start;s.appendedPTS=d,s.start=s.startPTS=l,s.maxStartPTS=y,s.startDTS=A,s.endPTS=d,s.minEndPTS=_,s.endDTS=S;var M=s.sn;if(!n||M<n.startSN||M>n.endSN)return 0;var U,K=M-n.startSN,W=n.fragments;for(W[K]=s,U=K;U>0;U--)D(W[U],W[U-1]);for(U=K;U<W.length-1;U++)D(W[U],W[U+1]);return n.fragmentHint&&D(W[W.length-1],n.fragmentHint),n.PTSKnown=n.alignedSliding=!0,P}function g(n,s){for(var l=null,d=n.fragments,A=d.length-1;A>=0;A--){var S=d[A].initSegment;if(S){l=S;break}}n.fragmentHint&&delete n.fragmentHint.endPTS;var R=0,y;if(T(n,s,function(U,K){U.relurl&&(R=U.cc-K.cc),Object(j.isFiniteNumber)(U.startPTS)&&Object(j.isFiniteNumber)(U.endPTS)&&(K.start=K.startPTS=U.startPTS,K.startDTS=U.startDTS,K.appendedPTS=U.appendedPTS,K.maxStartPTS=U.maxStartPTS,K.endPTS=U.endPTS,K.endDTS=U.endDTS,K.minEndPTS=U.minEndPTS,K.duration=U.endPTS-U.startPTS,K.duration&&(y=K),s.PTSKnown=s.alignedSliding=!0),K.elementaryStreams=U.elementaryStreams,K.loader=U.loader,K.stats=U.stats,K.urlId=U.urlId,U.initSegment&&(K.initSegment=U.initSegment,l=U.initSegment)}),l){var _=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments;_.forEach(function(U){var K;(!U.initSegment||U.initSegment.relurl===((K=l)===null||K===void 0?void 0:K.relurl))&&(U.initSegment=l)})}if(s.skippedSegments&&(s.deltaUpdateFailed=s.fragments.some(function(U){return!U}),s.deltaUpdateFailed)){N.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var m=s.skippedSegments;m--;)s.fragments.shift();s.startSN=s.fragments[0].sn,s.startCC=s.fragments[0].cc}var I=s.fragments;if(R){N.logger.warn("discontinuity sliding from playlist, take drift into account");for(var B=0;B<I.length;B++)I[B].cc+=R}s.skippedSegments&&(s.startCC=s.fragments[0].cc),b(n.partList,s.partList,function(U,K){K.elementaryStreams=U.elementaryStreams,K.stats=U.stats}),y?w(s,y,y.startPTS,y.endPTS,y.startDTS,y.endDTS):f(n,s),I.length&&(s.totalduration=s.edge-I[0].start),s.driftStartTime=n.driftStartTime,s.driftStart=n.driftStart;var P=s.advancedDateTime;if(s.advanced&&P){var M=s.edge;s.driftStart||(s.driftStartTime=P,s.driftStart=M),s.driftEndTime=P,s.driftEnd=M}else s.driftEndTime=n.driftEndTime,s.driftEnd=n.driftEnd,s.advancedDateTime=n.advancedDateTime}function b(n,s,l){if(n&&s)for(var d=0,A=0,S=n.length;A<=S;A++){var R=n[A],y=s[A+d];R&&y&&R.index===y.index&&R.fragment.sn===y.fragment.sn?l(R,y):d--}}function T(n,s,l){for(var d=s.skippedSegments,A=Math.max(n.startSN,s.startSN)-s.startSN,S=(n.fragmentHint?1:0)+(d?s.endSN:Math.min(n.endSN,s.endSN))-s.startSN,R=s.startSN-n.startSN,y=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,_=n.fragmentHint?n.fragments.concat(n.fragmentHint):n.fragments,m=A;m<=S;m++){var I=_[R+m],B=y[m];d&&!B&&m<d&&(B=s.fragments[m]=I),I&&B&&l(I,B)}}function f(n,s){var l=s.startSN+s.skippedSegments-n.startSN,d=n.fragments;l<0||l>=d.length||p(s,d[l].start)}function p(n,s){if(s){for(var l=n.fragments,d=n.skippedSegments;d<l.length;d++)l[d].start+=s;n.fragmentHint&&(n.fragmentHint.start+=s)}}function E(n,s){var l=1e3*n.levelTargetDuration,d=l/2,A=n.age,S=A>0&&A<l*3,R=s.loading.end-s.loading.start,y,_=n.availabilityDelay;if(n.updated===!1)if(S){var m=333*n.misses;y=Math.max(Math.min(d,R*2),m),n.availabilityDelay=(n.availabilityDelay||0)+y}else y=d;else S?(_=Math.min(_||l/2,A),n.availabilityDelay=_,y=_+l-A):y=l-R;return Math.round(y)}function u(n,s,l){if(!n||!n.details)return null;var d=n.details,A=d.fragments[s-d.startSN];return A||(A=d.fragmentHint,A&&A.sn===s)?A:s<d.startSN&&l&&l.sn===s?l:null}function a(n,s,l){if(!n||!n.details)return null;var d=n.details.partList;if(d)for(var A=d.length;A--;){var S=d[A];if(S.index===l&&S.fragment.sn===s)return S}return null}},"./src/controller/stream-controller.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"default",function(){return d});var j=k("./src/polyfills/number.ts"),N=k("./src/controller/base-stream-controller.ts"),v=k("./src/is-supported.ts"),L=k("./src/events.ts"),O=k("./src/utils/buffer-helper.ts"),D=k("./src/controller/fragment-tracker.ts"),w=k("./src/types/loader.ts"),g=k("./src/loader/fragment.ts"),b=k("./src/demux/transmuxer-interface.ts"),T=k("./src/types/transmuxer.ts"),f=k("./src/controller/gap-controller.ts"),p=k("./src/errors.ts"),E=k("./src/utils/logger.ts");function u(A,S){for(var R=0;R<S.length;R++){var y=S[R];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(A,y.key,y)}}function a(A,S,R){return S&&u(A.prototype,S),R&&u(A,R),A}function n(A,S){A.prototype=Object.create(S.prototype),A.prototype.constructor=A,s(A,S)}function s(A,S){return s=Object.setPrototypeOf||function(y,_){return y.__proto__=_,y},s(A,S)}var l=100,d=function(A){n(S,A);function S(y,_){var m;return m=A.call(this,y,_,"[stream-controller]")||this,m.audioCodecSwap=!1,m.gapController=null,m.level=-1,m._forceStartLoad=!1,m.altAudio=!1,m.audioOnly=!1,m.fragPlaying=null,m.onvplaying=null,m.onvseeked=null,m.fragLastKbps=0,m.stalled=!1,m.couldBacktrack=!1,m.audioCodecSwitch=!1,m.videoBuffer=null,m._registerListeners(),m}var R=S.prototype;return R._registerListeners=function(){var _=this.hls;_.on(L.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.on(L.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.on(L.Events.MANIFEST_LOADING,this.onManifestLoading,this),_.on(L.Events.MANIFEST_PARSED,this.onManifestParsed,this),_.on(L.Events.LEVEL_LOADING,this.onLevelLoading,this),_.on(L.Events.LEVEL_LOADED,this.onLevelLoaded,this),_.on(L.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),_.on(L.Events.ERROR,this.onError,this),_.on(L.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),_.on(L.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),_.on(L.Events.BUFFER_CREATED,this.onBufferCreated,this),_.on(L.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),_.on(L.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),_.on(L.Events.FRAG_BUFFERED,this.onFragBuffered,this)},R._unregisterListeners=function(){var _=this.hls;_.off(L.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.off(L.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.off(L.Events.MANIFEST_LOADING,this.onManifestLoading,this),_.off(L.Events.MANIFEST_PARSED,this.onManifestParsed,this),_.off(L.Events.LEVEL_LOADED,this.onLevelLoaded,this),_.off(L.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),_.off(L.Events.ERROR,this.onError,this),_.off(L.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),_.off(L.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),_.off(L.Events.BUFFER_CREATED,this.onBufferCreated,this),_.off(L.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),_.off(L.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),_.off(L.Events.FRAG_BUFFERED,this.onFragBuffered,this)},R.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},R.startLoad=function(_){if(this.levels){var m=this.lastCurrentTime,I=this.hls;if(this.stopLoad(),this.setInterval(l),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var B=I.startLevel;B===-1&&(I.config.testBandwidth?(B=0,this.bitrateTest=!0):B=I.nextAutoLevel),this.level=I.nextLoadLevel=B,this.loadedmetadata=!1}m>0&&_===-1&&(this.log("Override startPosition with lastCurrentTime @"+m.toFixed(3)),_=m),this.state=N.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=_,this.tick()}else this._forceStartLoad=!0,this.state=N.State.STOPPED},R.stopLoad=function(){this._forceStartLoad=!1,A.prototype.stopLoad.call(this)},R.doTick=function(){switch(this.state){case N.State.IDLE:this.doTickIdle();break;case N.State.WAITING_LEVEL:{var _,m=this.levels,I=this.level,B=m==null||(_=m[I])===null||_===void 0?void 0:_.details;if(B&&(!B.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(B))break;this.state=N.State.IDLE;break}break}case N.State.FRAG_LOADING_WAITING_RETRY:{var P,M=self.performance.now(),U=this.retryDate;(!U||M>=U||(P=this.media)!==null&&P!==void 0&&P.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=N.State.IDLE)}break;default:break}this.onTickEnd()},R.onTickEnd=function(){A.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},R.doTickIdle=function(){var _,m,I=this.hls,B=this.levelLastLoaded,P=this.levels,M=this.media,U=I.config,K=I.nextLoadLevel;if(!(B===null||!M&&(this.startFragRequested||!U.startFragPrefetch))&&!(this.altAudio&&this.audioOnly)&&!(!P||!P[K])){var W=P[K];this.level=I.nextLoadLevel=K;var X=W.details;if(!X||this.state===N.State.WAITING_LEVEL||X.live&&this.levelLastLoaded!==K){this.state=N.State.WAITING_LEVEL;return}var ie=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:M,w.PlaylistLevelType.MAIN);if(ie!==null){var se=ie.len,le=this.getMaxBufferLength(W.maxBitrate);if(!(se>=le)){if(this._streamEnded(ie,X)){var ve={};this.altAudio&&(ve.type="video"),this.hls.trigger(L.Events.BUFFER_EOS,ve),this.state=N.State.ENDED;return}var q=ie.end,ee=this.getNextFragment(q,X);if(this.couldBacktrack&&!this.fragPrevious&&ee&&ee.sn!=="initSegment"){var ae=ee.sn-X.startSN;ae>1&&(ee=X.fragments[ae-1],this.fragmentTracker.removeFragment(ee))}if(ee&&this.fragmentTracker.getState(ee)===D.FragmentState.OK&&this.nextLoadPosition>q){var _e=this.audioOnly&&!this.altAudio?g.ElementaryStreamTypes.AUDIO:g.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(M,_e,w.PlaylistLevelType.MAIN),ee=this.getNextFragment(this.nextLoadPosition,X)}!ee||(ee.initSegment&&!ee.initSegment.data&&!this.bitrateTest&&(ee=ee.initSegment),((_=ee.decryptdata)===null||_===void 0?void 0:_.keyFormat)==="identity"&&!((m=ee.decryptdata)!==null&&m!==void 0&&m.key)?this.loadKey(ee,X):this.loadFragment(ee,X,q))}}}},R.loadFragment=function(_,m,I){var B,P=this.fragmentTracker.getState(_);if(this.fragCurrent=_,P===D.FragmentState.BACKTRACKED){var M=this.fragmentTracker.getBacktrackData(_);if(M){this._handleFragmentLoadProgress(M),this._handleFragmentLoadComplete(M);return}else P=D.FragmentState.NOT_LOADED}P===D.FragmentState.NOT_LOADED||P===D.FragmentState.PARTIAL?_.sn==="initSegment"?this._loadInitSegment(_):this.bitrateTest?(_.bitrateTest=!0,this.log("Fragment "+_.sn+" of level "+_.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(_)):(this.startFragRequested=!0,A.prototype.loadFragment.call(this,_,m,I)):P===D.FragmentState.APPENDING?this.reduceMaxBufferLength(_.duration)&&this.fragmentTracker.removeFragment(_):((B=this.media)===null||B===void 0?void 0:B.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},R.getAppendedFrag=function(_){var m=this.fragmentTracker.getAppendedFrag(_,w.PlaylistLevelType.MAIN);return m&&"fragment"in m?m.fragment:m},R.getBufferedFrag=function(_){return this.fragmentTracker.getBufferedFrag(_,w.PlaylistLevelType.MAIN)},R.followingBufferedFrag=function(_){return _?this.getBufferedFrag(_.end+.5):null},R.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},R.nextLevelSwitch=function(){var _=this.levels,m=this.media;if(m!=null&&m.readyState){var I,B=this.getAppendedFrag(m.currentTime);if(B&&B.start>1&&this.flushMainBuffer(0,B.start-1),!m.paused&&_){var P=this.hls.nextLoadLevel,M=_[P],U=this.fragLastKbps;U&&this.fragCurrent?I=this.fragCurrent.duration*M.maxBitrate/(1e3*U)+1:I=0}else I=0;var K=this.getBufferedFrag(m.currentTime+I);if(K){var W=this.followingBufferedFrag(K);if(W){this.abortCurrentFrag();var X=W.maxStartPTS?W.maxStartPTS:W.start,ie=W.duration,se=Math.max(K.end,X+Math.min(Math.max(ie-this.config.maxFragLookUpTolerance,ie*.5),ie*.75));this.flushMainBuffer(se,Number.POSITIVE_INFINITY)}}}},R.abortCurrentFrag=function(){var _=this.fragCurrent;this.fragCurrent=null,_!=null&&_.loader&&_.loader.abort(),this.state===N.State.KEY_LOADING&&(this.state=N.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},R.flushMainBuffer=function(_,m){A.prototype.flushMainBuffer.call(this,_,m,this.altAudio?"video":null)},R.onMediaAttached=function(_,m){A.prototype.onMediaAttached.call(this,_,m);var I=m.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),I.addEventListener("playing",this.onvplaying),I.addEventListener("seeked",this.onvseeked),this.gapController=new f.default(this.config,I,this.fragmentTracker,this.hls)},R.onMediaDetaching=function(){var _=this.media;_&&(_.removeEventListener("playing",this.onvplaying),_.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),A.prototype.onMediaDetaching.call(this)},R.onMediaPlaying=function(){this.tick()},R.onMediaSeeked=function(){var _=this.media,m=_?_.currentTime:null;Object(j.isFiniteNumber)(m)&&this.log("Media seeked to "+m.toFixed(3)),this.tick()},R.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(L.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},R.onManifestParsed=function(_,m){var I=!1,B=!1,P;m.levels.forEach(function(M){P=M.audioCodec,P&&(P.indexOf("mp4a.40.2")!==-1&&(I=!0),P.indexOf("mp4a.40.5")!==-1&&(B=!0))}),this.audioCodecSwitch=I&&B&&!Object(v.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=m.levels,this.startFragRequested=!1},R.onLevelLoading=function(_,m){var I=this.levels;if(!(!I||this.state!==N.State.IDLE)){var B=I[m.level];(!B.details||B.details.live&&this.levelLastLoaded!==m.level||this.waitForCdnTuneIn(B.details))&&(this.state=N.State.WAITING_LEVEL)}},R.onLevelLoaded=function(_,m){var I,B=this.levels,P=m.level,M=m.details,U=M.totalduration;if(!B){this.warn("Levels were reset while loading level "+P);return}this.log("Level "+P+" loaded ["+M.startSN+","+M.endSN+"], cc ["+M.startCC+", "+M.endCC+"] duration:"+U);var K=this.fragCurrent;K&&(this.state===N.State.FRAG_LOADING||this.state===N.State.FRAG_LOADING_WAITING_RETRY)&&K.level!==m.level&&K.loader&&(this.state=N.State.IDLE,K.loader.abort());var W=B[P],X=0;if(M.live||(I=W.details)!==null&&I!==void 0&&I.live){if(M.fragments[0]||(M.deltaUpdateFailed=!0),M.deltaUpdateFailed)return;X=this.alignPlaylists(M,W.details)}if(W.details=M,this.levelLastLoaded=P,this.hls.trigger(L.Events.LEVEL_UPDATED,{details:M,level:P}),this.state===N.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(M))return;this.state=N.State.IDLE}this.startFragRequested?M.live&&this.synchronizeToLiveEdge(M):this.setStartPosition(M,X),this.tick()},R._handleFragmentLoadProgress=function(_){var m,I=_.frag,B=_.part,P=_.payload,M=this.levels;if(!M){this.warn("Levels were reset while fragment load was in progress. Fragment "+I.sn+" of level "+I.level+" will not be buffered");return}var U=M[I.level],K=U.details;if(!K){this.warn("Dropping fragment "+I.sn+" of level "+I.level+" after level details were reset");return}var W=U.videoCodec,X=K.PTSKnown||!K.live,ie=(m=I.initSegment)===null||m===void 0?void 0:m.data,se=this._getAudioCodec(U),le=this.transmuxer=this.transmuxer||new b.default(this.hls,w.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ve=B?B.index:-1,q=ve!==-1,ee=new T.ChunkMetadata(I.level,I.sn,I.stats.chunkCount,P.byteLength,ve,q),ae=this.initPTS[I.cc];le.push(P,ie,se,W,I,B,K.totalduration,X,ee,ae)},R.onAudioTrackSwitching=function(_,m){var I=this.altAudio,B=!!m.url,P=m.id;if(!B){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var M=this.fragCurrent;M!=null&&M.loader&&(this.log("Switching to main audio track, cancel main fragment load"),M.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var U=this.hls;I&&U.trigger(L.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),U.trigger(L.Events.AUDIO_TRACK_SWITCHED,{id:P})}},R.onAudioTrackSwitched=function(_,m){var I=m.id,B=!!this.hls.audioTracks[I].url;if(B){var P=this.videoBuffer;P&&this.mediaBuffer!==P&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=P)}this.altAudio=B,this.tick()},R.onBufferCreated=function(_,m){var I=m.tracks,B,P,M=!1;for(var U in I){var K=I[U];if(K.id==="main"){if(P=U,B=K,U==="video"){var W=I[U];W&&(this.videoBuffer=W.buffer)}}else M=!0}M&&B?(this.log("Alternate track found, use "+P+".buffered to schedule main fragment loading"),this.mediaBuffer=B.buffer):this.mediaBuffer=this.media},R.onFragBuffered=function(_,m){var I=m.frag,B=m.part;if(!(I&&I.type!==w.PlaylistLevelType.MAIN)){if(this.fragContextChanged(I)){this.warn("Fragment "+I.sn+(B?" p: "+B.index:"")+" of level "+I.level+" finished buffering, but was aborted. state: "+this.state),this.state===N.State.PARSED&&(this.state=N.State.IDLE);return}var P=B?B.stats:I.stats;this.fragLastKbps=Math.round(8*P.total/(P.buffering.end-P.loading.first)),I.sn!=="initSegment"&&(this.fragPrevious=I),this.fragBufferedComplete(I,B)}},R.onError=function(_,m){switch(m.details){case p.ErrorDetails.FRAG_LOAD_ERROR:case p.ErrorDetails.FRAG_LOAD_TIMEOUT:case p.ErrorDetails.KEY_LOAD_ERROR:case p.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(w.PlaylistLevelType.MAIN,m);break;case p.ErrorDetails.LEVEL_LOAD_ERROR:case p.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==N.State.ERROR&&(m.fatal?(this.warn(""+m.details),this.state=N.State.ERROR):!m.levelRetry&&this.state===N.State.WAITING_LEVEL&&(this.state=N.State.IDLE));break;case p.ErrorDetails.BUFFER_FULL_ERROR:if(m.parent==="main"&&(this.state===N.State.PARSING||this.state===N.State.PARSED)){var I=!0,B=this.getFwdBufferInfo(this.media,w.PlaylistLevelType.MAIN);B&&B.len>.5&&(I=!this.reduceMaxBufferLength(B.len)),I&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},R.checkBuffer=function(){var _=this.media,m=this.gapController;if(!(!_||!m||!_.readyState)){var I=O.BufferHelper.getBuffered(_);!this.loadedmetadata&&I.length?(this.loadedmetadata=!0,this.seekToStartPos()):m.poll(this.lastCurrentTime),this.lastCurrentTime=_.currentTime}},R.onFragLoadEmergencyAborted=function(){this.state=N.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},R.onBufferFlushed=function(_,m){var I=m.type;if(I!==g.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var B=(I===g.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(B,I,w.PlaylistLevelType.MAIN)}},R.onLevelsUpdated=function(_,m){this.levels=m.levels},R.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},R.seekToStartPos=function(){var _=this.media,m=_.currentTime,I=this.startPosition;if(I>=0&&m<I){if(_.seeking){E.logger.log("could not seek to "+I+", already seeking at "+m);return}var B=O.BufferHelper.getBuffered(_),P=B.length?B.start(0):0,M=P-I;M>0&&(M<this.config.maxBufferHole||M<this.config.maxFragLookUpTolerance)&&(E.logger.log("adjusting start position by "+M+" to match buffer start"),I+=M,this.startPosition=I),this.log("seek to target start position "+I+" from current time "+m),_.currentTime=I}},R._getAudioCodec=function(_){var m=this.config.defaultAudioCodec||_.audioCodec;return this.audioCodecSwap&&m&&(this.log("Swapping audio codec"),m.indexOf("mp4a.40.5")!==-1?m="mp4a.40.2":m="mp4a.40.5"),m},R._loadBitrateTestFrag=function(_){var m=this;this._doFragLoad(_).then(function(I){var B=m.hls;if(!(!I||B.nextLoadLevel||m.fragContextChanged(_))){m.fragLoadError=0,m.state=N.State.IDLE,m.startFragRequested=!1,m.bitrateTest=!1;var P=_.stats;P.parsing.start=P.parsing.end=P.buffering.start=P.buffering.end=self.performance.now(),B.trigger(L.Events.FRAG_LOADED,I)}})},R._handleTransmuxComplete=function(_){var m,I="main",B=this.hls,P=_.remuxResult,M=_.chunkMeta,U=this.getCurrentContext(M);if(!U){this.warn("The loading context changed while buffering fragment "+M.sn+" of level "+M.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(M.level);return}var K=U.frag,W=U.part,X=U.level,ie=P.video,se=P.text,le=P.id3,ve=P.initSegment,q=this.altAudio?void 0:P.audio;if(!this.fragContextChanged(K)){if(this.state=N.State.PARSING,ve){ve.tracks&&(this._bufferInitSegment(X,ve.tracks,K,M),B.trigger(L.Events.FRAG_PARSING_INIT_SEGMENT,{frag:K,id:I,tracks:ve.tracks}));var ee=ve.initPTS,ae=ve.timescale;Object(j.isFiniteNumber)(ee)&&(this.initPTS[K.cc]=ee,B.trigger(L.Events.INIT_PTS_FOUND,{frag:K,id:I,initPTS:ee,timescale:ae}))}if(ie&&P.independent!==!1){if(X.details){var _e=ie.startPTS,fe=ie.endPTS,Ue=ie.startDTS,Te=ie.endDTS;if(W)W.elementaryStreams[ie.type]={startPTS:_e,endPTS:fe,startDTS:Ue,endDTS:Te};else if(ie.firstKeyFrame&&ie.independent&&(this.couldBacktrack=!0),ie.dropped&&ie.independent){var Fe=this.getLoadPosition()+this.config.maxBufferHole;if(Fe<_e){this.backtrack(K);return}K.setElementaryStreamInfo(ie.type,K.start,fe,K.start,Te,!0)}K.setElementaryStreamInfo(ie.type,_e,fe,Ue,Te),this.bufferFragmentData(ie,K,W,M)}}else if(P.independent===!1){this.backtrack(K);return}if(q){var $e=q.startPTS,Ye=q.endPTS,Ge=q.startDTS,st=q.endDTS;W&&(W.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:$e,endPTS:Ye,startDTS:Ge,endDTS:st}),K.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,$e,Ye,Ge,st),this.bufferFragmentData(q,K,W,M)}if(le!=null&&(m=le.samples)!==null&&m!==void 0&&m.length){var Ft={frag:K,id:I,samples:le.samples};B.trigger(L.Events.FRAG_PARSING_METADATA,Ft)}if(se){var Bt={frag:K,id:I,samples:se.samples};B.trigger(L.Events.FRAG_PARSING_USERDATA,Bt)}}},R._bufferInitSegment=function(_,m,I,B){var P=this;if(this.state===N.State.PARSING){this.audioOnly=!!m.audio&&!m.video,this.altAudio&&!this.audioOnly&&delete m.audio;var M=m.audio,U=m.video,K=m.audiovideo;if(M){var W=_.audioCodec,X=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(W&&(W.indexOf("mp4a.40.5")!==-1?W="mp4a.40.2":W="mp4a.40.5"),M.metadata.channelCount!==1&&X.indexOf("firefox")===-1&&(W="mp4a.40.5")),X.indexOf("android")!==-1&&M.container!=="audio/mpeg"&&(W="mp4a.40.2",this.log("Android: force audio codec to "+W)),_.audioCodec&&_.audioCodec!==W&&this.log('Swapping manifest audio codec "'+_.audioCodec+'" for "'+W+'"'),M.levelCodec=W,M.id="main",this.log("Init audio buffer, container:"+M.container+", codecs[selected/level/parsed]=["+(W||"")+"/"+(_.audioCodec||"")+"/"+M.codec+"]")}U&&(U.levelCodec=_.videoCodec,U.id="main",this.log("Init video buffer, container:"+U.container+", codecs[level/parsed]=["+(_.videoCodec||"")+"/"+U.codec+"]")),K&&this.log("Init audiovideo buffer, container:"+K.container+", codecs[level/parsed]=["+(_.attrs.CODECS||"")+"/"+K.codec+"]"),this.hls.trigger(L.Events.BUFFER_CODECS,m),Object.keys(m).forEach(function(ie){var se=m[ie],le=se.initSegment;le!=null&&le.byteLength&&P.hls.trigger(L.Events.BUFFER_APPENDING,{type:ie,data:le,frag:I,part:null,chunkMeta:B,parent:I.type})}),this.tick()}},R.backtrack=function(_){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(_);var m=this.fragmentTracker.backtrack(_);this.fragPrevious=null,this.nextLoadPosition=_.start,m?this.resetFragmentLoading(_):this.state=N.State.BACKTRACKING},R.checkFragmentChanged=function(){var _=this.media,m=null;if(_&&_.readyState>1&&_.seeking===!1){var I=_.currentTime;if(O.BufferHelper.isBuffered(_,I)?m=this.getAppendedFrag(I):O.BufferHelper.isBuffered(_,I+.1)&&(m=this.getAppendedFrag(I+.1)),m){var B=this.fragPlaying,P=m.level;(!B||m.sn!==B.sn||B.level!==P||m.urlId!==B.urlId)&&(this.hls.trigger(L.Events.FRAG_CHANGED,{frag:m}),(!B||B.level!==P)&&this.hls.trigger(L.Events.LEVEL_SWITCHED,{level:P}),this.fragPlaying=m)}}},a(S,[{key:"nextLevel",get:function(){var _=this.nextBufferedFrag;return _?_.level:-1}},{key:"currentLevel",get:function(){var _=this.media;if(_){var m=this.getAppendedFrag(_.currentTime);if(m)return m.level}return-1}},{key:"nextBufferedFrag",get:function(){var _=this.media;if(_){var m=this.getAppendedFrag(_.currentTime);return this.followingBufferedFrag(m)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),S}(N.default)},"./src/controller/subtitle-stream-controller.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"SubtitleStreamController",function(){return n});var j=k("./src/events.ts"),N=k("./src/utils/logger.ts"),v=k("./src/utils/buffer-helper.ts"),L=k("./src/controller/fragment-finders.ts"),O=k("./src/utils/discontinuities.ts"),D=k("./src/controller/level-helper.ts"),w=k("./src/controller/fragment-tracker.ts"),g=k("./src/controller/base-stream-controller.ts"),b=k("./src/types/loader.ts"),T=k("./src/types/level.ts");function f(s,l){for(var d=0;d<l.length;d++){var A=l[d];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(s,A.key,A)}}function p(s,l,d){return l&&f(s.prototype,l),d&&f(s,d),s}function E(s,l){s.prototype=Object.create(l.prototype),s.prototype.constructor=s,u(s,l)}function u(s,l){return u=Object.setPrototypeOf||function(A,S){return A.__proto__=S,A},u(s,l)}var a=500,n=function(s){E(l,s);function l(A,S){var R;return R=s.call(this,A,S,"[subtitle-stream-controller]")||this,R.levels=[],R.currentTrackId=-1,R.tracksBuffered=[],R.mainDetails=null,R._registerListeners(),R}var d=l.prototype;return d.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},d._registerListeners=function(){var S=this.hls;S.on(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),S.on(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),S.on(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),S.on(j.Events.LEVEL_LOADED,this.onLevelLoaded,this),S.on(j.Events.ERROR,this.onError,this),S.on(j.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),S.on(j.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),S.on(j.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),S.on(j.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),S.on(j.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},d._unregisterListeners=function(){var S=this.hls;S.off(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),S.off(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),S.off(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),S.off(j.Events.LEVEL_LOADED,this.onLevelLoaded,this),S.off(j.Events.ERROR,this.onError,this),S.off(j.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),S.off(j.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),S.off(j.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),S.off(j.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),S.off(j.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},d.startLoad=function(){this.stopLoad(),this.state=g.State.IDLE,this.setInterval(a),this.tick()},d.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},d.onLevelLoaded=function(S,R){this.mainDetails=R.details},d.onSubtitleFragProcessed=function(S,R){var y=R.frag,_=R.success;if(this.fragPrevious=y,this.state=g.State.IDLE,!!_){var m=this.tracksBuffered[this.currentTrackId];if(!!m){for(var I,B=y.start,P=0;P<m.length;P++)if(B>=m[P].start&&B<=m[P].end){I=m[P];break}var M=y.start+y.duration;I?I.end=M:(I={start:B,end:M},m.push(I)),this.fragmentTracker.fragBuffered(y)}}},d.onBufferFlushing=function(S,R){var y=R.startOffset,_=R.endOffset;if(y===0&&_!==Number.POSITIVE_INFINITY){var m=this.currentTrackId,I=this.levels;if(!I.length||!I[m]||!I[m].details)return;var B=I[m].details,P=B.targetduration,M=_-P;if(M<=0)return;R.endOffsetSubtitles=Math.max(0,M),this.tracksBuffered.forEach(function(U){for(var K=0;K<U.length;){if(U[K].end<=M){U.shift();continue}else if(U[K].start<M)U[K].start=M;else break;K++}}),this.fragmentTracker.removeFragmentsInRange(y,M,b.PlaylistLevelType.SUBTITLE)}},d.onError=function(S,R){var y,_=R.frag;!_||_.type!==b.PlaylistLevelType.SUBTITLE||((y=this.fragCurrent)!==null&&y!==void 0&&y.loader&&this.fragCurrent.loader.abort(),this.state=g.State.IDLE)},d.onSubtitleTracksUpdated=function(S,R){var y=this,_=R.subtitleTracks;this.tracksBuffered=[],this.levels=_.map(function(m){return new T.Level(m)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(m){y.tracksBuffered[m.id]=[]}),this.mediaBuffer=null},d.onSubtitleTrackSwitch=function(S,R){if(this.currentTrackId=R.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var y=this.levels[this.currentTrackId];y!=null&&y.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,y&&this.setInterval(a)},d.onSubtitleTrackLoaded=function(S,R){var y,_=R.details,m=R.id,I=this.currentTrackId,B=this.levels;if(!!B.length){var P=B[I];if(!(m>=B.length||m!==I||!P)){if(this.mediaBuffer=this.mediaBufferTimeRanges,_.live||(y=P.details)!==null&&y!==void 0&&y.live){var M=this.mainDetails;if(_.deltaUpdateFailed||!M)return;var U=M.fragments[0];if(!P.details)_.hasProgramDateTime&&M.hasProgramDateTime?Object(O.alignMediaPlaylistByPDT)(_,M):U&&Object(D.addSliding)(_,U.start);else{var K=this.alignPlaylists(_,P.details);K===0&&U&&Object(D.addSliding)(_,U.start)}}if(P.details=_,this.levelLastLoaded=m,this.tick(),_.live&&!this.fragCurrent&&this.media&&this.state===g.State.IDLE){var W=Object(L.findFragmentByPTS)(null,_.fragments,this.media.currentTime,0);W||(this.warn("Subtitle playlist not aligned with playback"),P.details=void 0)}}}},d._handleFragmentLoadComplete=function(S){var R=S.frag,y=S.payload,_=R.decryptdata,m=this.hls;if(!this.fragContextChanged(R)&&y&&y.byteLength>0&&_&&_.key&&_.iv&&_.method==="AES-128"){var I=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(y),_.key.buffer,_.iv.buffer).then(function(B){var P=performance.now();m.trigger(j.Events.FRAG_DECRYPTED,{frag:R,payload:B,stats:{tstart:I,tdecrypt:P}})})}},d.doTick=function(){if(!this.media){this.state=g.State.IDLE;return}if(this.state===g.State.IDLE){var S,R=this.currentTrackId,y=this.levels;if(!y.length||!y[R]||!y[R].details)return;var _=y[R].details,m=_.targetduration,I=this.config,B=this.media,P=v.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,B.currentTime-m,I.maxBufferHole),M=P.end,U=P.len,K=this.getMaxBufferLength()+m;if(U>K)return;console.assert(_,"Subtitle track details are defined on idle subtitle stream controller tick");var W=_.fragments,X=W.length,ie=_.edge,se,le=this.fragPrevious;if(M<ie){var ve=I.maxFragLookUpTolerance;le&&_.hasProgramDateTime&&(se=Object(L.findFragmentByPDT)(W,le.endProgramDateTime,ve)),se||(se=Object(L.findFragmentByPTS)(le,W,M,ve),!se&&le&&le.start<W[0].start&&(se=W[0]))}else se=W[X-1];(S=se)!==null&&S!==void 0&&S.encrypted?(N.logger.log("Loading key for "+se.sn),this.state=g.State.KEY_LOADING,this.hls.trigger(j.Events.KEY_LOADING,{frag:se})):se&&this.fragmentTracker.getState(se)===w.FragmentState.NOT_LOADED&&this.loadFragment(se,_,M)}},d.loadFragment=function(S,R,y){this.fragCurrent=S,s.prototype.loadFragment.call(this,S,R,y)},p(l,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),l}(g.default)},"./src/controller/subtitle-track-controller.ts":function(de,H,k){"use strict";k.r(H);var j=k("./src/events.ts"),N=k("./src/utils/texttrack-utils.ts"),v=k("./src/controller/base-playlist-controller.ts"),L=k("./src/types/loader.ts");function O(f,p){for(var E=0;E<p.length;E++){var u=p[E];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(f,u.key,u)}}function D(f,p,E){return p&&O(f.prototype,p),E&&O(f,E),f}function w(f,p){f.prototype=Object.create(p.prototype),f.prototype.constructor=f,g(f,p)}function g(f,p){return g=Object.setPrototypeOf||function(u,a){return u.__proto__=a,u},g(f,p)}var b=function(f){w(p,f);function p(u){var a;return a=f.call(this,u,"[subtitle-track-controller]")||this,a.media=null,a.tracks=[],a.groupId=null,a.tracksInGroup=[],a.trackId=-1,a.selectDefaultTrack=!0,a.queuedDefaultTrack=-1,a.trackChangeListener=function(){return a.onTextTracksChanged()},a.asyncPollTrackChange=function(){return a.pollTrackChange(0)},a.useTextTrackPolling=!1,a.subtitlePollingInterval=-1,a.subtitleDisplay=!0,a.registerListeners(),a}var E=p.prototype;return E.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,f.prototype.destroy.call(this)},E.registerListeners=function(){var a=this.hls;a.on(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(j.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(j.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(j.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.on(j.Events.ERROR,this.onError,this)},E.unregisterListeners=function(){var a=this.hls;a.off(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(j.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(j.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(j.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.off(j.Events.ERROR,this.onError,this)},E.onMediaAttached=function(a,n){this.media=n.media,!!this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))},E.pollTrackChange=function(a){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,a)},E.onMediaDetaching=function(){if(!!this.media){self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var a=T(this.media.textTracks);a.forEach(function(n){Object(N.clearCurrentCues)(n)}),this.subtitleTrack=-1,this.media=null}},E.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},E.onManifestParsed=function(a,n){this.tracks=n.subtitleTracks},E.onSubtitleTrackLoaded=function(a,n){var s=n.id,l=n.details,d=this.trackId,A=this.tracksInGroup[d];if(!A){this.warn("Invalid subtitle track id "+s);return}var S=A.details;A.details=n.details,this.log("subtitle track "+s+" loaded ["+l.startSN+"-"+l.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,n,S))},E.onLevelLoading=function(a,n){this.switchLevel(n.level)},E.onLevelSwitching=function(a,n){this.switchLevel(n.level)},E.switchLevel=function(a){var n=this.hls.levels[a];if(!!(n!=null&&n.textGroupIds)){var s=n.textGroupIds[n.urlId];if(this.groupId!==s){var l=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,d=this.tracks.filter(function(R){return!s||R.groupId===s});this.tracksInGroup=d;var A=this.findTrackId(l==null?void 0:l.name)||this.findTrackId();this.groupId=s;var S={subtitleTracks:d};this.log("Updating subtitle tracks, "+d.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(j.Events.SUBTITLE_TRACKS_UPDATED,S),A!==-1&&this.setSubtitleTrack(A,l)}}},E.findTrackId=function(a){for(var n=this.tracksInGroup,s=0;s<n.length;s++){var l=n[s];if((!this.selectDefaultTrack||l.default)&&(!a||a===l.name))return l.id}return-1},E.onError=function(a,n){f.prototype.onError.call(this,a,n),!(n.fatal||!n.context)&&n.context.type===L.PlaylistContextType.SUBTITLE_TRACK&&n.context.id===this.trackId&&n.context.groupId===this.groupId&&this.retryLoadingOrFail(n)},E.loadPlaylist=function(a){var n=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(n)){var s=n.id,l=n.groupId,d=n.url;if(a)try{d=a.addDirectives(d)}catch(A){this.warn("Could not construct new URL with HLS Delivery Directives: "+A)}this.log("Loading subtitle playlist for id "+s),this.hls.trigger(j.Events.SUBTITLE_TRACK_LOADING,{url:d,id:s,groupId:l,deliveryDirectives:a||null})}},E.toggleTrackModes=function(a){var n=this,s=this.media,l=this.subtitleDisplay,d=this.trackId;if(!!s){var A=T(s.textTracks),S=A.filter(function(_){return _.groupId===n.groupId});if(a===-1)[].slice.call(A).forEach(function(_){_.mode="disabled"});else{var R=S[d];R&&(R.mode="disabled")}var y=S[a];y&&(y.mode=l?"showing":"hidden")}},E.setSubtitleTrack=function(a,n){var s,l=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=a;return}if(this.trackId!==a&&this.toggleTrackModes(a),!(this.trackId===a&&(a===-1||(s=l[a])!==null&&s!==void 0&&s.details)||a<-1||a>=l.length)){this.clearTimer();var d=l[a];if(this.log("Switching to subtitle track "+a),this.trackId=a,d){var A=d.id,S=d.groupId,R=S===void 0?"":S,y=d.name,_=d.type,m=d.url;this.hls.trigger(j.Events.SUBTITLE_TRACK_SWITCH,{id:A,groupId:R,name:y,type:_,url:m});var I=this.switchParams(d.url,n==null?void 0:n.details);this.loadPlaylist(I)}else this.hls.trigger(j.Events.SUBTITLE_TRACK_SWITCH,{id:a})}},E.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!(!this.media||!this.hls.config.renderTextTracksNatively)){for(var a=-1,n=T(this.media.textTracks),s=0;s<n.length;s++)if(n[s].mode==="hidden")a=s;else if(n[s].mode==="showing"){a=s;break}this.subtitleTrack!==a&&(this.subtitleTrack=a)}},D(p,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(a){this.selectDefaultTrack=!1;var n=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(a,n)}}]),p}(v.default);function T(f){for(var p=[],E=0;E<f.length;E++){var u=f[E];u.kind==="subtitles"&&u.label&&p.push(f[E])}return p}H.default=b},"./src/controller/timeline-controller.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"TimelineController",function(){return T});var j=k("./src/polyfills/number.ts"),N=k("./src/events.ts"),v=k("./src/utils/cea-608-parser.ts"),L=k("./src/utils/output-filter.ts"),O=k("./src/utils/webvtt-parser.ts"),D=k("./src/utils/texttrack-utils.ts"),w=k("./src/utils/imsc1-ttml-parser.ts"),g=k("./src/types/loader.ts"),b=k("./src/utils/logger.ts"),T=function(){function u(n){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=E(),this.captionsProperties=void 0,this.hls=n,this.config=n.config,this.Cues=n.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var s=new L.default(this,"textTrack1"),l=new L.default(this,"textTrack2"),d=new L.default(this,"textTrack3"),A=new L.default(this,"textTrack4");this.cea608Parser1=new v.default(1,s,l),this.cea608Parser2=new v.default(3,d,A)}n.on(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),n.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.on(N.Events.MANIFEST_LOADED,this.onManifestLoaded,this),n.on(N.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),n.on(N.Events.FRAG_LOADING,this.onFragLoading,this),n.on(N.Events.FRAG_LOADED,this.onFragLoaded,this),n.on(N.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),n.on(N.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),n.on(N.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),n.on(N.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),n.on(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var a=u.prototype;return a.destroy=function(){var s=this.hls;s.off(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(N.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.off(N.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.off(N.Events.FRAG_LOADING,this.onFragLoading,this),s.off(N.Events.FRAG_LOADED,this.onFragLoaded,this),s.off(N.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.off(N.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.off(N.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.off(N.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.off(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},a.addCues=function(s,l,d,A,S){for(var R=!1,y=S.length;y--;){var _=S[y],m=p(_[0],_[1],l,d);if(m>=0&&(_[0]=Math.min(_[0],l),_[1]=Math.max(_[1],d),R=!0,m/(d-l)>.5))return}if(R||S.push([l,d]),this.config.renderTextTracksNatively){var I=this.captionsTracks[s];this.Cues.newCue(I,l,d,A)}else{var B=this.Cues.newCue(null,l,d,A);this.hls.trigger(N.Events.CUES_PARSED,{type:"captions",cues:B,track:s})}},a.onInitPtsFound=function(s,l){var d=this,A=l.frag,S=l.id,R=l.initPTS,y=l.timescale,_=this.unparsedVttFrags;S==="main"&&(this.initPTS[A.cc]=R,this.timescale[A.cc]=y),_.length&&(this.unparsedVttFrags=[],_.forEach(function(m){d.onFragLoaded(N.Events.FRAG_LOADED,m)}))},a.getExistingTrack=function(s){var l=this.media;if(l)for(var d=0;d<l.textTracks.length;d++){var A=l.textTracks[d];if(A[s])return A}return null},a.createCaptionsTrack=function(s){this.config.renderTextTracksNatively?this.createNativeTrack(s):this.createNonNativeTrack(s)},a.createNativeTrack=function(s){if(!this.captionsTracks[s]){var l=this.captionsProperties,d=this.captionsTracks,A=this.media,S=l[s],R=S.label,y=S.languageCode,_=this.getExistingTrack(s);if(_)d[s]=_,Object(D.clearCurrentCues)(d[s]),Object(D.sendAddTrackEvent)(d[s],A);else{var m=this.createTextTrack("captions",R,y);m&&(m[s]=!0,d[s]=m)}}},a.createNonNativeTrack=function(s){if(!this.nonNativeCaptionsTracks[s]){var l=this.captionsProperties[s];if(!!l){var d=l.label,A={_id:s,label:d,kind:"captions",default:l.media?!!l.media.default:!1,closedCaptions:l.media};this.nonNativeCaptionsTracks[s]=A,this.hls.trigger(N.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[A]})}}},a.createTextTrack=function(s,l,d){var A=this.media;if(!!A)return A.addTextTrack(s,l,d)},a.onMediaAttaching=function(s,l){this.media=l.media,this._cleanTracks()},a.onMediaDetaching=function(){var s=this.captionsTracks;Object.keys(s).forEach(function(l){Object(D.clearCurrentCues)(s[l]),delete s[l]}),this.nonNativeCaptionsTracks={}},a.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=E(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},a._cleanTracks=function(){var s=this.media;if(!!s){var l=s.textTracks;if(l)for(var d=0;d<l.length;d++)Object(D.clearCurrentCues)(l[d])}},a.onSubtitleTracksUpdated=function(s,l){var d=this;this.textTracks=[];var A=l.subtitleTracks||[],S=A.some(function(m){return m.textCodec===w.IMSC1_CODEC});if(this.config.enableWebVTT||S&&this.config.enableIMSC1){var R=this.tracks&&A&&this.tracks.length===A.length;if(this.tracks=A||[],this.config.renderTextTracksNatively){var y=this.media?this.media.textTracks:[];this.tracks.forEach(function(m,I){var B;if(I<y.length){for(var P=null,M=0;M<y.length;M++)if(f(y[M],m)){P=y[M];break}P&&(B=P)}B?Object(D.clearCurrentCues)(B):(B=d.createTextTrack("subtitles",m.name,m.lang),B&&(B.mode="disabled")),B&&(B.groupId=m.groupId,d.textTracks.push(B))})}else if(!R&&this.tracks&&this.tracks.length){var _=this.tracks.map(function(m){return{label:m.name,kind:m.type.toLowerCase(),default:m.default,subtitleTrack:m}});this.hls.trigger(N.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:_})}}},a.onManifestLoaded=function(s,l){var d=this;this.config.enableCEA708Captions&&l.captions&&l.captions.forEach(function(A){var S=/(?:CC|SERVICE)([1-4])/.exec(A.instreamId);if(!!S){var R="textTrack"+S[1],y=d.captionsProperties[R];!y||(y.label=A.name,A.lang&&(y.languageCode=A.lang),y.media=A)}})},a.onFragLoading=function(s,l){var d=this.cea608Parser1,A=this.cea608Parser2,S=this.lastSn,R=this.lastPartIndex;if(!(!this.enabled||!(d&&A))&&l.frag.type===g.PlaylistLevelType.MAIN){var y,_,m=l.frag.sn,I=(y=l==null||(_=l.part)===null||_===void 0?void 0:_.index)!=null?y:-1;m===S+1||m===S&&I===R+1||(d.reset(),A.reset()),this.lastSn=m,this.lastPartIndex=I}},a.onFragLoaded=function(s,l){var d=l.frag,A=l.payload,S=this.initPTS,R=this.unparsedVttFrags;if(d.type===g.PlaylistLevelType.SUBTITLE)if(A.byteLength){if(!Object(j.isFiniteNumber)(S[d.cc])){R.push(l),S.length&&this.hls.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:new Error("Missing initial subtitle PTS")});return}var y=d.decryptdata;if(y==null||y.key==null||y.method!=="AES-128"){var _=this.tracks[d.level],m=this.vttCCs;m[d.cc]||(m[d.cc]={start:d.start,prevCC:this.prevCC,new:!0},this.prevCC=d.cc),_&&_.textCodec===w.IMSC1_CODEC?this._parseIMSC1(d,A):this._parseVTTs(d,A,m)}}else this.hls.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:new Error("Empty subtitle payload")})},a._parseIMSC1=function(s,l){var d=this,A=this.hls;Object(w.parseIMSC1)(l,this.initPTS[s.cc],this.timescale[s.cc],function(S){d._appendCues(S,s.level),A.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},function(S){b.logger.log("Failed to parse IMSC1: "+S),A.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:S})})},a._parseVTTs=function(s,l,d){var A=this,S=this.hls;Object(O.parseWebVTT)(l,this.initPTS[s.cc],this.timescale[s.cc],d,s.cc,s.start,function(R){A._appendCues(R,s.level),S.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},function(R){A._fallbackToIMSC1(s,l),b.logger.log("Failed to parse VTT cue: "+R),S.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:R})})},a._fallbackToIMSC1=function(s,l){var d=this,A=this.tracks[s.level];A.textCodec||Object(w.parseIMSC1)(l,this.initPTS[s.cc],this.timescale[s.cc],function(){A.textCodec=w.IMSC1_CODEC,d._parseIMSC1(s,l)},function(){A.textCodec="wvtt"})},a._appendCues=function(s,l){var d=this.hls;if(this.config.renderTextTracksNatively){var A=this.textTracks[l];if(A.mode==="disabled")return;s.forEach(function(y){return Object(D.addCueToTrack)(A,y)})}else{var S=this.tracks[l],R=S.default?"default":"subtitles"+l;d.trigger(N.Events.CUES_PARSED,{type:"subtitles",cues:s,track:R})}},a.onFragDecrypted=function(s,l){var d=l.frag;if(d.type===g.PlaylistLevelType.SUBTITLE){if(!Object(j.isFiniteNumber)(this.initPTS[d.cc])){this.unparsedVttFrags.push(l);return}this.onFragLoaded(N.Events.FRAG_LOADED,l)}},a.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},a.onFragParsingUserdata=function(s,l){var d=this.cea608Parser1,A=this.cea608Parser2;if(!(!this.enabled||!(d&&A)))for(var S=0;S<l.samples.length;S++){var R=l.samples[S].bytes;if(R){var y=this.extractCea608Data(R);d.addData(l.samples[S].pts,y[0]),A.addData(l.samples[S].pts,y[1])}}},a.onBufferFlushing=function(s,l){var d=l.startOffset,A=l.endOffset,S=l.endOffsetSubtitles,R=l.type,y=this.media;if(!(!y||y.currentTime<A)){if(!R||R==="video"){var _=this.captionsTracks;Object.keys(_).forEach(function(I){return Object(D.removeCuesInRange)(_[I],d,A)})}if(this.config.renderTextTracksNatively&&d===0&&S!==void 0){var m=this.textTracks;Object.keys(m).forEach(function(I){return Object(D.removeCuesInRange)(m[I],d,S)})}}},a.extractCea608Data=function(s){for(var l=s[0]&31,d=2,A=[[],[]],S=0;S<l;S++){var R=s[d++],y=127&s[d++],_=127&s[d++],m=(4&R)!==0,I=3&R;y===0&&_===0||m&&(I===0||I===1)&&(A[I].push(y),A[I].push(_))}return A},u}();function f(u,a){return u&&u.label===a.name&&!(u.textTrack1||u.textTrack2)}function p(u,a,n,s){return Math.min(a,s)-Math.max(u,n)}function E(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"default",function(){return j});var j=function(){function N(L,O){this.subtle=void 0,this.aesIV=void 0,this.subtle=L,this.aesIV=O}var v=N.prototype;return v.decrypt=function(O,D){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},D,O)},N}()},"./src/crypt/aes-decryptor.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"removePadding",function(){return N}),k.d(H,"default",function(){return v});var j=k("./src/utils/typed-array.ts");function N(L){var O=L.byteLength,D=O&&new DataView(L.buffer).getUint8(O-1);return D?Object(j.sliceUint8)(L,0,O-D):L}var v=function(){function L(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var O=L.prototype;return O.uint8ArrayToUint32Array_=function(w){for(var g=new DataView(w),b=new Uint32Array(4),T=0;T<4;T++)b[T]=g.getUint32(T*4);return b},O.initTable=function(){var w=this.sBox,g=this.invSBox,b=this.subMix,T=b[0],f=b[1],p=b[2],E=b[3],u=this.invSubMix,a=u[0],n=u[1],s=u[2],l=u[3],d=new Uint32Array(256),A=0,S=0,R=0;for(R=0;R<256;R++)R<128?d[R]=R<<1:d[R]=R<<1^283;for(R=0;R<256;R++){var y=S^S<<1^S<<2^S<<3^S<<4;y=y>>>8^y&255^99,w[A]=y,g[y]=A;var _=d[A],m=d[_],I=d[m],B=d[y]*257^y*16843008;T[A]=B<<24|B>>>8,f[A]=B<<16|B>>>16,p[A]=B<<8|B>>>24,E[A]=B,B=I*16843009^m*65537^_*257^A*16843008,a[y]=B<<24|B>>>8,n[y]=B<<16|B>>>16,s[y]=B<<8|B>>>24,l[y]=B,A?(A=_^d[d[d[I^_]]],S^=d[d[S]]):A=S=1}},O.expandKey=function(w){for(var g=this.uint8ArrayToUint32Array_(w),b=!0,T=0;T<g.length&&b;)b=g[T]===this.key[T],T++;if(!b){this.key=g;var f=this.keySize=g.length;if(f!==4&&f!==6&&f!==8)throw new Error("Invalid aes key size="+f);var p=this.ksRows=(f+6+1)*4,E,u,a=this.keySchedule=new Uint32Array(p),n=this.invKeySchedule=new Uint32Array(p),s=this.sBox,l=this.rcon,d=this.invSubMix,A=d[0],S=d[1],R=d[2],y=d[3],_,m;for(E=0;E<p;E++){if(E<f){_=a[E]=g[E];continue}m=_,E%f===0?(m=m<<8|m>>>24,m=s[m>>>24]<<24|s[m>>>16&255]<<16|s[m>>>8&255]<<8|s[m&255],m^=l[E/f|0]<<24):f>6&&E%f===4&&(m=s[m>>>24]<<24|s[m>>>16&255]<<16|s[m>>>8&255]<<8|s[m&255]),a[E]=_=(a[E-f]^m)>>>0}for(u=0;u<p;u++)E=p-u,u&3?m=a[E]:m=a[E-4],u<4||E<=4?n[u]=m:n[u]=A[s[m>>>24]]^S[s[m>>>16&255]]^R[s[m>>>8&255]]^y[s[m&255]],n[u]=n[u]>>>0}},O.networkToHostOrderSwap=function(w){return w<<24|(w&65280)<<8|(w&16711680)>>8|w>>>24},O.decrypt=function(w,g,b){for(var T=this.keySize+6,f=this.invKeySchedule,p=this.invSBox,E=this.invSubMix,u=E[0],a=E[1],n=E[2],s=E[3],l=this.uint8ArrayToUint32Array_(b),d=l[0],A=l[1],S=l[2],R=l[3],y=new Int32Array(w),_=new Int32Array(y.length),m,I,B,P,M,U,K,W,X,ie,se,le,ve,q,ee=this.networkToHostOrderSwap;g<y.length;){for(X=ee(y[g]),ie=ee(y[g+1]),se=ee(y[g+2]),le=ee(y[g+3]),M=X^f[0],U=le^f[1],K=se^f[2],W=ie^f[3],ve=4,q=1;q<T;q++)m=u[M>>>24]^a[U>>16&255]^n[K>>8&255]^s[W&255]^f[ve],I=u[U>>>24]^a[K>>16&255]^n[W>>8&255]^s[M&255]^f[ve+1],B=u[K>>>24]^a[W>>16&255]^n[M>>8&255]^s[U&255]^f[ve+2],P=u[W>>>24]^a[M>>16&255]^n[U>>8&255]^s[K&255]^f[ve+3],M=m,U=I,K=B,W=P,ve=ve+4;m=p[M>>>24]<<24^p[U>>16&255]<<16^p[K>>8&255]<<8^p[W&255]^f[ve],I=p[U>>>24]<<24^p[K>>16&255]<<16^p[W>>8&255]<<8^p[M&255]^f[ve+1],B=p[K>>>24]<<24^p[W>>16&255]<<16^p[M>>8&255]<<8^p[U&255]^f[ve+2],P=p[W>>>24]<<24^p[M>>16&255]<<16^p[U>>8&255]<<8^p[K&255]^f[ve+3],_[g]=ee(m^d),_[g+1]=ee(P^A),_[g+2]=ee(B^S),_[g+3]=ee(I^R),d=X,A=ie,S=se,R=le,g=g+4}return _.buffer},L}()},"./src/crypt/decrypter.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"default",function(){return g});var j=k("./src/crypt/aes-crypto.ts"),N=k("./src/crypt/fast-aes-key.ts"),v=k("./src/crypt/aes-decryptor.ts"),L=k("./src/utils/logger.ts"),O=k("./src/utils/mp4-tools.ts"),D=k("./src/utils/typed-array.ts"),w=16,g=function(){function b(f,p,E){var u=E===void 0?{}:E,a=u.removePKCS7Padding,n=a===void 0?!0:a;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=f,this.config=p,this.removePKCS7Padding=n,n)try{var s=self.crypto;s&&(this.subtle=s.subtle||s.webkitSubtle)}catch(l){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var T=b.prototype;return T.destroy=function(){this.observer=null},T.isSync=function(){return this.config.enableSoftwareAES},T.flush=function(){var p=this.currentResult;if(!p){this.reset();return}var E=new Uint8Array(p);return this.reset(),this.removePKCS7Padding?Object(v.removePadding)(E):E},T.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},T.decrypt=function(p,E,u,a){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(p),E,u);var n=this.flush();n&&a(n.buffer)}else this.webCryptoDecrypt(new Uint8Array(p),E,u).then(a)},T.softwareDecrypt=function(p,E,u){var a=this.currentIV,n=this.currentResult,s=this.remainderData;this.logOnce("JS AES decrypt"),s&&(p=Object(O.appendUint8Array)(s,p),this.remainderData=null);var l=this.getValidChunk(p);if(!l.length)return null;a&&(u=a);var d=this.softwareDecrypter;d||(d=this.softwareDecrypter=new v.default),d.expandKey(E);var A=n;return this.currentResult=d.decrypt(l.buffer,0,u),this.currentIV=Object(D.sliceUint8)(l,-16).buffer,A||null},T.webCryptoDecrypt=function(p,E,u){var a=this,n=this.subtle;return(this.key!==E||!this.fastAesKey)&&(this.key=E,this.fastAesKey=new N.default(n,E)),this.fastAesKey.expandKey().then(function(s){if(!n)return Promise.reject(new Error("web crypto not initialized"));var l=new j.default(n,u);return l.decrypt(p.buffer,s)}).catch(function(s){return a.onWebCryptoError(s,p,E,u)})},T.onWebCryptoError=function(p,E,u,a){return L.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",p),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(E,u,a)},T.getValidChunk=function(p){var E=p,u=p.length-p.length%w;return u!==p.length&&(E=Object(D.sliceUint8)(p,0,u),this.remainderData=Object(D.sliceUint8)(p,u)),E},T.logOnce=function(p){!this.logEnabled||(L.logger.log("[decrypter.ts]: "+p),this.logEnabled=!1)},b}()},"./src/crypt/fast-aes-key.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"default",function(){return j});var j=function(){function N(L,O){this.subtle=void 0,this.key=void 0,this.subtle=L,this.key=O}var v=N.prototype;return v.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},N}()},"./src/demux/aacdemuxer.ts":function(de,H,k){"use strict";k.r(H);var j=k("./src/demux/base-audio-demuxer.ts"),N=k("./src/demux/adts.ts"),v=k("./src/utils/logger.ts"),L=k("./src/demux/id3.ts");function O(g,b){g.prototype=Object.create(b.prototype),g.prototype.constructor=g,D(g,b)}function D(g,b){return D=Object.setPrototypeOf||function(f,p){return f.__proto__=p,f},D(g,b)}var w=function(g){O(b,g);function b(f,p){var E;return E=g.call(this)||this,E.observer=void 0,E.config=void 0,E.observer=f,E.config=p,E}var T=b.prototype;return T.resetInitSegment=function(p,E,u){g.prototype.resetInitSegment.call(this,p,E,u),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:p,duration:u,inputTimeScale:9e4,dropped:0}},b.probe=function(p){if(!p)return!1;for(var E=L.getID3Data(p,0)||[],u=E.length,a=p.length;u<a;u++)if(N.probe(p,u))return v.logger.log("ADTS sync word found !"),!0;return!1},T.canParse=function(p,E){return N.canParse(p,E)},T.appendFrame=function(p,E,u){N.initTrackConfig(p,this.observer,E,u,p.manifestCodec);var a=N.appendFrame(p,E,u,this.initPTS,this.frameIndex);if(a&&a.missing===0)return a},b}(j.default);w.minProbeByteLength=9,H.default=w},"./src/demux/adts.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"getAudioConfig",function(){return L}),k.d(H,"isHeaderPattern",function(){return O}),k.d(H,"getHeaderLength",function(){return D}),k.d(H,"getFullFrameLength",function(){return w}),k.d(H,"canGetFrameLength",function(){return g}),k.d(H,"isHeader",function(){return b}),k.d(H,"canParse",function(){return T}),k.d(H,"probe",function(){return f}),k.d(H,"initTrackConfig",function(){return p}),k.d(H,"getFrameDuration",function(){return E}),k.d(H,"parseFrameHeader",function(){return u}),k.d(H,"appendFrame",function(){return a});var j=k("./src/utils/logger.ts"),N=k("./src/errors.ts"),v=k("./src/events.ts");function L(n,s,l,d){var A,S,R,y,_=navigator.userAgent.toLowerCase(),m=d,I=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];A=((s[l+2]&192)>>>6)+1;var B=(s[l+2]&60)>>>2;if(B>I.length-1){n.trigger(v.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+B});return}return R=(s[l+2]&1)<<2,R|=(s[l+3]&192)>>>6,j.logger.log("manifest codec:"+d+", ADTS type:"+A+", samplingIndex:"+B),/firefox/i.test(_)?B>=6?(A=5,y=new Array(4),S=B-3):(A=2,y=new Array(2),S=B):_.indexOf("android")!==-1?(A=2,y=new Array(2),S=B):(A=5,y=new Array(4),d&&(d.indexOf("mp4a.40.29")!==-1||d.indexOf("mp4a.40.5")!==-1)||!d&&B>=6?S=B-3:((d&&d.indexOf("mp4a.40.2")!==-1&&(B>=6&&R===1||/vivaldi/i.test(_))||!d&&R===1)&&(A=2,y=new Array(2)),S=B)),y[0]=A<<3,y[0]|=(B&14)>>1,y[1]|=(B&1)<<7,y[1]|=R<<3,A===5&&(y[1]|=(S&14)>>1,y[2]=(S&1)<<7,y[2]|=2<<2,y[3]=0),{config:y,samplerate:I[B],channelCount:R,codec:"mp4a.40."+A,manifestCodec:m}}function O(n,s){return n[s]===255&&(n[s+1]&246)===240}function D(n,s){return n[s+1]&1?7:9}function w(n,s){return(n[s+3]&3)<<11|n[s+4]<<3|(n[s+5]&224)>>>5}function g(n,s){return s+5<n.length}function b(n,s){return s+1<n.length&&O(n,s)}function T(n,s){return g(n,s)&&O(n,s)&&w(n,s)<=n.length-s}function f(n,s){if(b(n,s)){var l=D(n,s);if(s+l>=n.length)return!1;var d=w(n,s);if(d<=l)return!1;var A=s+d;return A===n.length||b(n,A)}return!1}function p(n,s,l,d,A){if(!n.samplerate){var S=L(s,l,d,A);if(!S)return;n.config=S.config,n.samplerate=S.samplerate,n.channelCount=S.channelCount,n.codec=S.codec,n.manifestCodec=S.manifestCodec,j.logger.log("parsed codec:"+n.codec+", rate:"+S.samplerate+", channels:"+S.channelCount)}}function E(n){return 1024*9e4/n}function u(n,s,l,d,A){var S=D(n,s),R=w(n,s);if(R-=S,R>0){var y=l+d*A;return{headerLength:S,frameLength:R,stamp:y}}}function a(n,s,l,d,A){var S=E(n.samplerate),R=u(s,l,d,A,S);if(R){var y=R.frameLength,_=R.headerLength,m=R.stamp,I=_+y,B=Math.max(0,l+I-s.length),P;B?(P=new Uint8Array(I-_),P.set(s.subarray(l+_,s.length),0)):P=s.subarray(l+_,l+I);var M={unit:P,pts:m};return B||n.samples.push(M),{sample:M,length:I,missing:B}}}},"./src/demux/base-audio-demuxer.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"initPTSFn",function(){return w});var j=k("./src/polyfills/number.ts"),N=k("./src/demux/id3.ts"),v=k("./src/demux/dummy-demuxed-track.ts"),L=k("./src/utils/mp4-tools.ts"),O=k("./src/utils/typed-array.ts"),D=function(){function g(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var b=g.prototype;return b.resetInitSegment=function(f,p,E){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},b.resetTimeStamp=function(){},b.resetContiguity=function(){},b.canParse=function(f,p){return!1},b.appendFrame=function(f,p,E){},b.demux=function(f,p){this.cachedData&&(f=Object(L.appendUint8Array)(this.cachedData,f),this.cachedData=null);var E=N.getID3Data(f,0),u=E?E.length:0,a,n,s=this._audioTrack,l=this._id3Track,d=E?N.getTimeStamp(E):void 0,A=f.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=w(d,p)),E&&E.length>0&&l.samples.push({pts:this.initPTS,dts:this.initPTS,data:E}),n=this.initPTS;u<A;){if(this.canParse(f,u)){var S=this.appendFrame(s,f,u);S?(this.frameIndex++,n=S.sample.pts,u+=S.length,a=u):u=A}else N.canParse(f,u)?(E=N.getID3Data(f,u),l.samples.push({pts:n,dts:n,data:E}),u+=E.length,a=u):u++;if(u===A&&a!==A){var R=Object(O.sliceUint8)(f,a);this.cachedData?this.cachedData=Object(L.appendUint8Array)(this.cachedData,R):this.cachedData=R}}return{audioTrack:s,avcTrack:Object(v.dummyTrack)(),id3Track:l,textTrack:Object(v.dummyTrack)()}},b.demuxSampleAes=function(f,p,E){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},b.flush=function(f){var p=this.cachedData;return p&&(this.cachedData=null,this.demux(p,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(v.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(v.dummyTrack)()}},b.destroy=function(){},g}(),w=function(b,T){return Object(j.isFiniteNumber)(b)?b*90:T*9e4};H.default=D},"./src/demux/chunk-cache.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"default",function(){return j});var j=function(){function v(){this.chunks=[],this.dataLength=0}var L=v.prototype;return L.push=function(D){this.chunks.push(D),this.dataLength+=D.length},L.flush=function(){var D=this.chunks,w=this.dataLength,g;if(D.length)D.length===1?g=D[0]:g=N(D,w);else return new Uint8Array(0);return this.reset(),g},L.reset=function(){this.chunks.length=0,this.dataLength=0},v}();function N(v,L){for(var O=new Uint8Array(L),D=0,w=0;w<v.length;w++){var g=v[w];O.set(g,D),D+=g.length}return O}},"./src/demux/dummy-demuxed-track.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"dummyTrack",function(){return j});function j(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(de,H,k){"use strict";k.r(H);var j=k("./src/utils/logger.ts"),N=function(){function v(O){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=O,this.bytesAvailable=O.byteLength,this.word=0,this.bitsAvailable=0}var L=v.prototype;return L.loadWord=function(){var D=this.data,w=this.bytesAvailable,g=D.byteLength-w,b=new Uint8Array(4),T=Math.min(4,w);if(T===0)throw new Error("no bytes available");b.set(D.subarray(g,g+T)),this.word=new DataView(b.buffer).getUint32(0),this.bitsAvailable=T*8,this.bytesAvailable-=T},L.skipBits=function(D){var w;this.bitsAvailable>D?(this.word<<=D,this.bitsAvailable-=D):(D-=this.bitsAvailable,w=D>>3,D-=w>>3,this.bytesAvailable-=w,this.loadWord(),this.word<<=D,this.bitsAvailable-=D)},L.readBits=function(D){var w=Math.min(this.bitsAvailable,D),g=this.word>>>32-w;return D>32&&j.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=w,this.bitsAvailable>0?this.word<<=w:this.bytesAvailable>0&&this.loadWord(),w=D-w,w>0&&this.bitsAvailable?g<<w|this.readBits(w):g},L.skipLZ=function(){var D;for(D=0;D<this.bitsAvailable;++D)if((this.word&2147483648>>>D)!==0)return this.word<<=D,this.bitsAvailable-=D,D;return this.loadWord(),D+this.skipLZ()},L.skipUEG=function(){this.skipBits(1+this.skipLZ())},L.skipEG=function(){this.skipBits(1+this.skipLZ())},L.readUEG=function(){var D=this.skipLZ();return this.readBits(D+1)-1},L.readEG=function(){var D=this.readUEG();return 1&D?1+D>>>1:-1*(D>>>1)},L.readBoolean=function(){return this.readBits(1)===1},L.readUByte=function(){return this.readBits(8)},L.readUShort=function(){return this.readBits(16)},L.readUInt=function(){return this.readBits(32)},L.skipScalingList=function(D){for(var w=8,g=8,b,T=0;T<D;T++)g!==0&&(b=this.readEG(),g=(w+b+256)%256),w=g===0?w:g},L.readSPS=function(){var D=0,w=0,g=0,b=0,T,f,p,E=this.readUByte.bind(this),u=this.readBits.bind(this),a=this.readUEG.bind(this),n=this.readBoolean.bind(this),s=this.skipBits.bind(this),l=this.skipEG.bind(this),d=this.skipUEG.bind(this),A=this.skipScalingList.bind(this);E();var S=E();if(u(5),s(3),E(),d(),S===100||S===110||S===122||S===244||S===44||S===83||S===86||S===118||S===128){var R=a();if(R===3&&s(1),d(),d(),s(1),n())for(f=R!==3?8:12,p=0;p<f;p++)n()&&(p<6?A(16):A(64))}d();var y=a();if(y===0)a();else if(y===1)for(s(1),l(),l(),T=a(),p=0;p<T;p++)l();d(),s(1);var _=a(),m=a(),I=u(1);I===0&&s(1),s(1),n()&&(D=a(),w=a(),g=a(),b=a());var B=[1,1];if(n()&&n()){var P=E();switch(P){case 1:B=[1,1];break;case 2:B=[12,11];break;case 3:B=[10,11];break;case 4:B=[16,11];break;case 5:B=[40,33];break;case 6:B=[24,11];break;case 7:B=[20,11];break;case 8:B=[32,11];break;case 9:B=[80,33];break;case 10:B=[18,11];break;case 11:B=[15,11];break;case 12:B=[64,33];break;case 13:B=[160,99];break;case 14:B=[4,3];break;case 15:B=[3,2];break;case 16:B=[2,1];break;case 255:{B=[E()<<8|E(),E()<<8|E()];break}}}return{width:Math.ceil((_+1)*16-D*2-w*2),height:(2-I)*(m+1)*16-(I?2:4)*(g+b),pixelRatio:B}},L.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},v}();H.default=N},"./src/demux/id3.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"isHeader",function(){return j}),k.d(H,"isFooter",function(){return N}),k.d(H,"getID3Data",function(){return v}),k.d(H,"canParse",function(){return O}),k.d(H,"getTimeStamp",function(){return D}),k.d(H,"isTimeStampFrame",function(){return w}),k.d(H,"getID3Frames",function(){return b}),k.d(H,"decodeFrame",function(){return T}),k.d(H,"utf8ArrayToStr",function(){return a}),k.d(H,"testables",function(){return n});var j=function(A,S){return S+10<=A.length&&A[S]===73&&A[S+1]===68&&A[S+2]===51&&A[S+3]<255&&A[S+4]<255&&A[S+6]<128&&A[S+7]<128&&A[S+8]<128&&A[S+9]<128},N=function(A,S){return S+10<=A.length&&A[S]===51&&A[S+1]===68&&A[S+2]===73&&A[S+3]<255&&A[S+4]<255&&A[S+6]<128&&A[S+7]<128&&A[S+8]<128&&A[S+9]<128},v=function(A,S){for(var R=S,y=0;j(A,S);){y+=10;var _=L(A,S+6);y+=_,N(A,S+10)&&(y+=10),S+=y}if(y>0)return A.subarray(R,R+y)},L=function(A,S){var R=0;return R=(A[S]&127)<<21,R|=(A[S+1]&127)<<14,R|=(A[S+2]&127)<<7,R|=A[S+3]&127,R},O=function(A,S){return j(A,S)&&L(A,S+6)+10<=A.length-S},D=function(A){for(var S=b(A),R=0;R<S.length;R++){var y=S[R];if(w(y))return u(y)}},w=function(A){return A&&A.key==="PRIV"&&A.info==="com.apple.streaming.transportStreamTimestamp"},g=function(A){var S=String.fromCharCode(A[0],A[1],A[2],A[3]),R=L(A,4),y=10;return{type:S,size:R,data:A.subarray(y,y+R)}},b=function(A){for(var S=0,R=[];j(A,S);){var y=L(A,S+6);S+=10;for(var _=S+y;S+8<_;){var m=g(A.subarray(S)),I=T(m);I&&R.push(I),S+=m.size+10}N(A,S)&&(S+=10)}return R},T=function(A){return A.type==="PRIV"?f(A):A.type[0]==="W"?E(A):p(A)},f=function(A){if(!(A.size<2)){var S=a(A.data,!0),R=new Uint8Array(A.data.subarray(S.length+1));return{key:A.type,info:S,data:R.buffer}}},p=function(A){if(!(A.size<2)){if(A.type==="TXXX"){var S=1,R=a(A.data.subarray(S),!0);S+=R.length+1;var y=a(A.data.subarray(S));return{key:A.type,info:R,data:y}}var _=a(A.data.subarray(1));return{key:A.type,data:_}}},E=function(A){if(A.type==="WXXX"){if(A.size<2)return;var S=1,R=a(A.data.subarray(S),!0);S+=R.length+1;var y=a(A.data.subarray(S));return{key:A.type,info:R,data:y}}var _=a(A.data);return{key:A.type,data:_}},u=function(A){if(A.data.byteLength===8){var S=new Uint8Array(A.data),R=S[3]&1,y=(S[4]<<23)+(S[5]<<15)+(S[6]<<7)+S[7];return y/=45,R&&(y+=4772185884e-2),Math.round(y)}},a=function(A,S){S===void 0&&(S=!1);var R=l();if(R){var y=R.decode(A);if(S){var _=y.indexOf("\0");return _!==-1?y.substring(0,_):y}return y.replace(/\0/g,"")}for(var m=A.length,I,B,P,M="",U=0;U<m;){if(I=A[U++],I===0&&S)return M;if(I===0||I===3)continue;switch(I>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:M+=String.fromCharCode(I);break;case 12:case 13:B=A[U++],M+=String.fromCharCode((I&31)<<6|B&63);break;case 14:B=A[U++],P=A[U++],M+=String.fromCharCode((I&15)<<12|(B&63)<<6|(P&63)<<0);break;default:}}return M},n={decodeTextFrame:p},s;function l(){return!s&&typeof self.TextDecoder!="undefined"&&(s=new self.TextDecoder("utf-8")),s}},"./src/demux/mp3demuxer.ts":function(de,H,k){"use strict";k.r(H);var j=k("./src/demux/base-audio-demuxer.ts"),N=k("./src/demux/id3.ts"),v=k("./src/utils/logger.ts"),L=k("./src/demux/mpegaudio.ts");function O(g,b){g.prototype=Object.create(b.prototype),g.prototype.constructor=g,D(g,b)}function D(g,b){return D=Object.setPrototypeOf||function(f,p){return f.__proto__=p,f},D(g,b)}var w=function(g){O(b,g);function b(){return g.apply(this,arguments)||this}var T=b.prototype;return T.resetInitSegment=function(p,E,u){g.prototype.resetInitSegment.call(this,p,E,u),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:p,duration:u,inputTimeScale:9e4,dropped:0}},b.probe=function(p){if(!p)return!1;for(var E=N.getID3Data(p,0)||[],u=E.length,a=p.length;u<a;u++)if(L.probe(p,u))return v.logger.log("MPEG Audio sync word found !"),!0;return!1},T.canParse=function(p,E){return L.canParse(p,E)},T.appendFrame=function(p,E,u){if(this.initPTS!==null)return L.appendFrame(p,E,u,this.initPTS,this.frameIndex)},b}(j.default);w.minProbeByteLength=4,H.default=w},"./src/demux/mp4demuxer.ts":function(de,H,k){"use strict";k.r(H);var j=k("./src/utils/mp4-tools.ts"),N=k("./src/demux/dummy-demuxed-track.ts"),v=function(){function L(D,w){this.remainderData=null,this.config=void 0,this.config=w}var O=L.prototype;return O.resetTimeStamp=function(){},O.resetInitSegment=function(){},O.resetContiguity=function(){},L.probe=function(w){return Object(j.findBox)({data:w,start:0,end:Math.min(w.length,16384)},["moof"]).length>0},O.demux=function(w){var g=w,b=Object(N.dummyTrack)();if(this.config.progressive){this.remainderData&&(g=Object(j.appendUint8Array)(this.remainderData,w));var T=Object(j.segmentValidRange)(g);this.remainderData=T.remainder,b.samples=T.valid||new Uint8Array}else b.samples=g;return{audioTrack:Object(N.dummyTrack)(),avcTrack:b,id3Track:Object(N.dummyTrack)(),textTrack:Object(N.dummyTrack)()}},O.flush=function(){var w=Object(N.dummyTrack)();return w.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(N.dummyTrack)(),avcTrack:w,id3Track:Object(N.dummyTrack)(),textTrack:Object(N.dummyTrack)()}},O.demuxSampleAes=function(w,g,b){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},O.destroy=function(){},L}();v.minProbeByteLength=1024,H.default=v},"./src/demux/mpegaudio.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"appendFrame",function(){return D}),k.d(H,"parseHeader",function(){return w}),k.d(H,"isHeaderPattern",function(){return g}),k.d(H,"isHeader",function(){return b}),k.d(H,"canParse",function(){return T}),k.d(H,"probe",function(){return f});var j=null,N=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],v=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],L=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],O=[0,1,1,4];function D(p,E,u,a,n){if(!(u+24>E.length)){var s=w(E,u);if(s&&u+s.frameLength<=E.length){var l=s.samplesPerFrame*9e4/s.sampleRate,d=a+n*l,A={unit:E.subarray(u,u+s.frameLength),pts:d,dts:d};return p.config=[],p.channelCount=s.channelCount,p.samplerate=s.sampleRate,p.samples.push(A),{sample:A,length:s.frameLength,missing:0}}}}function w(p,E){var u=p[E+1]>>3&3,a=p[E+1]>>1&3,n=p[E+2]>>4&15,s=p[E+2]>>2&3;if(u!==1&&n!==0&&n!==15&&s!==3){var l=p[E+2]>>1&1,d=p[E+3]>>6,A=u===3?3-a:a===3?3:4,S=N[A*14+n-1]*1e3,R=u===3?0:u===2?1:2,y=v[R*3+s],_=d===3?1:2,m=L[u][a],I=O[a],B=m*8*I,P=Math.floor(m*S/y+l)*I;if(j===null){var M=navigator.userAgent||"",U=M.match(/Chrome\/(\d+)/i);j=U?parseInt(U[1]):0}var K=!!j&&j<=87;return K&&a===2&&S>=224e3&&d===0&&(p[E+3]=p[E+3]|128),{sampleRate:y,channelCount:_,frameLength:P,samplesPerFrame:B}}}function g(p,E){return p[E]===255&&(p[E+1]&224)===224&&(p[E+1]&6)!==0}function b(p,E){return E+1<p.length&&g(p,E)}function T(p,E){var u=4;return g(p,E)&&u<=p.length-E}function f(p,E){if(E+1<p.length&&g(p,E)){var u=4,a=w(p,E),n=u;a!=null&&a.frameLength&&(n=a.frameLength);var s=E+n;return s===p.length||b(p,s)}return!1}},"./src/demux/sample-aes.ts":function(de,H,k){"use strict";k.r(H);var j=k("./src/crypt/decrypter.ts"),N=k("./src/demux/tsdemuxer.ts"),v=function(){function L(D,w,g){this.keyData=void 0,this.decrypter=void 0,this.keyData=g,this.decrypter=new j.default(D,w,{removePKCS7Padding:!1})}var O=L.prototype;return O.decryptBuffer=function(w,g){this.decrypter.decrypt(w,this.keyData.key.buffer,this.keyData.iv.buffer,g)},O.decryptAacSample=function(w,g,b,T){var f=w[g].unit,p=f.subarray(16,f.length-f.length%16),E=p.buffer.slice(p.byteOffset,p.byteOffset+p.length),u=this;this.decryptBuffer(E,function(a){var n=new Uint8Array(a);f.set(n,16),T||u.decryptAacSamples(w,g+1,b)})},O.decryptAacSamples=function(w,g,b){for(;;g++){if(g>=w.length){b();return}if(!(w[g].unit.length<32)){var T=this.decrypter.isSync();if(this.decryptAacSample(w,g,b,T),!T)return}}},O.getAvcEncryptedData=function(w){for(var g=Math.floor((w.length-48)/160)*16+16,b=new Int8Array(g),T=0,f=32;f<=w.length-16;f+=160,T+=16)b.set(w.subarray(f,f+16),T);return b},O.getAvcDecryptedUnit=function(w,g){for(var b=new Uint8Array(g),T=0,f=32;f<=w.length-16;f+=160,T+=16)w.set(b.subarray(T,T+16),f);return w},O.decryptAvcSample=function(w,g,b,T,f,p){var E=Object(N.discardEPB)(f.data),u=this.getAvcEncryptedData(E),a=this;this.decryptBuffer(u.buffer,function(n){f.data=a.getAvcDecryptedUnit(E,n),p||a.decryptAvcSamples(w,g,b+1,T)})},O.decryptAvcSamples=function(w,g,b,T){if(w instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;g++,b=0){if(g>=w.length){T();return}for(var f=w[g].units;!(b>=f.length);b++){var p=f[b];if(!(p.data.length<=48||p.type!==1&&p.type!==5)){var E=this.decrypter.isSync();if(this.decryptAvcSample(w,g,b,T,p,E),!E)return}}}},L}();H.default=v},"./src/demux/transmuxer-interface.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"default",function(){return f});var j=k("./node_modules/webworkify-webpack/index.js"),N=k.n(j),v=k("./src/events.ts"),L=k("./src/demux/transmuxer.ts"),O=k("./src/utils/logger.ts"),D=k("./src/errors.ts"),w=k("./src/utils/mediasource-helper.ts"),g=k("./node_modules/eventemitter3/index.js"),b=k.n(g),T=Object(w.getMediaSource)()||{isTypeSupported:function(){return!1}},f=function(){function p(u,a,n,s){var l=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=u,this.id=a,this.onTransmuxComplete=n,this.onFlush=s;var d=u.config,A=function(m,I){I=I||{},I.frag=l.frag,I.id=l.id,u.trigger(m,I)};this.observer=new g.EventEmitter,this.observer.on(v.Events.FRAG_DECRYPTED,A),this.observer.on(v.Events.ERROR,A);var S={mp4:T.isTypeSupported("video/mp4"),mpeg:T.isTypeSupported("audio/mpeg"),mp3:T.isTypeSupported('audio/mp4; codecs="mp3"')},R=navigator.vendor;if(d.enableWorker&&typeof Worker!="undefined"){O.logger.log("demuxing in webworker");var y;try{y=this.worker=j("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),y.addEventListener("message",this.onwmsg),y.onerror=function(_){u.trigger(v.Events.ERROR,{type:D.ErrorTypes.OTHER_ERROR,details:D.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(_.message+" ("+_.filename+":"+_.lineno+")")})},y.postMessage({cmd:"init",typeSupported:S,vendor:R,id:a,config:JSON.stringify(d)})}catch(_){O.logger.warn("Error in worker:",_),O.logger.error("Error while initializing DemuxerWorker, fallback to inline"),y&&self.URL.revokeObjectURL(y.objectURL),this.transmuxer=new L.default(this.observer,S,d,R,a),this.worker=null}}else this.transmuxer=new L.default(this.observer,S,d,R,a)}var E=p.prototype;return E.destroy=function(){var a=this.worker;if(a)a.removeEventListener("message",this.onwmsg),a.terminate(),this.worker=null;else{var n=this.transmuxer;n&&(n.destroy(),this.transmuxer=null)}var s=this.observer;s&&s.removeAllListeners(),this.observer=null},E.push=function(a,n,s,l,d,A,S,R,y,_){var m=this;y.transmuxing.start=self.performance.now();var I=this.transmuxer,B=this.worker,P=A?A.start:d.start,M=d.decryptdata,U=this.frag,K=!(U&&d.cc===U.cc),W=!(U&&y.level===U.level),X=U?y.sn-U.sn:-1,ie=this.part?y.part-this.part.index:1,se=!W&&(X===1||X===0&&ie===1),le=self.performance.now();(W||X||d.stats.parsing.start===0)&&(d.stats.parsing.start=le),A&&(ie||!se)&&(A.stats.parsing.start=le);var ve=new L.TransmuxState(K,se,R,W,P);if(!se||K){O.logger.log("[transmuxer-interface, "+d.type+"]: Starting new transmux session for sn: "+y.sn+" p: "+y.part+" level: "+y.level+" id: "+y.id+`
|
|
149
|
+
discontinuity: `+K+`
|
|
150
|
+
trackSwitch: `+W+`
|
|
151
|
+
contiguous: `+se+`
|
|
152
|
+
accurateTimeOffset: `+R+`
|
|
153
|
+
timeOffset: `+P);var q=new L.TransmuxConfig(s,l,n,S,_);this.configureTransmuxer(q)}if(this.frag=d,this.part=A,B)B.postMessage({cmd:"demux",data:a,decryptdata:M,chunkMeta:y,state:ve},a instanceof ArrayBuffer?[a]:[]);else if(I){var ee=I.push(a,M,y,ve);Object(L.isPromise)(ee)?ee.then(function(ae){m.handleTransmuxComplete(ae)}):this.handleTransmuxComplete(ee)}},E.flush=function(a){var n=this;a.transmuxing.start=self.performance.now();var s=this.transmuxer,l=this.worker;if(l)l.postMessage({cmd:"flush",chunkMeta:a});else if(s){var d=s.flush(a);Object(L.isPromise)(d)?d.then(function(A){n.handleFlushResult(A,a)}):this.handleFlushResult(d,a)}},E.handleFlushResult=function(a,n){var s=this;a.forEach(function(l){s.handleTransmuxComplete(l)}),this.onFlush(n)},E.onWorkerMessage=function(a){var n=a.data,s=this.hls;switch(n.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(n.data);break}case"flush":{this.onFlush(n.data);break}default:{n.data=n.data||{},n.data.frag=this.frag,n.data.id=this.id,s.trigger(n.event,n.data);break}}},E.configureTransmuxer=function(a){var n=this.worker,s=this.transmuxer;n?n.postMessage({cmd:"configure",config:a}):s&&s.configure(a)},E.handleTransmuxComplete=function(a){a.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(a)},p}()},"./src/demux/transmuxer-worker.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"default",function(){return D});var j=k("./src/demux/transmuxer.ts"),N=k("./src/events.ts"),v=k("./src/utils/logger.ts"),L=k("./node_modules/eventemitter3/index.js"),O=k.n(L);function D(f){var p=new L.EventEmitter,E=function(a,n){f.postMessage({event:a,data:n})};p.on(N.Events.FRAG_DECRYPTED,E),p.on(N.Events.ERROR,E),f.addEventListener("message",function(u){var a=u.data;switch(a.cmd){case"init":{var n=JSON.parse(a.config);f.transmuxer=new j.default(p,a.typeSupported,n,a.vendor,a.id),Object(v.enableLogs)(n.debug),E("init",null);break}case"configure":{f.transmuxer.configure(a.config);break}case"demux":{var s=f.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Object(j.isPromise)(s)?s.then(function(A){w(f,A)}):w(f,s);break}case"flush":{var l=a.chunkMeta,d=f.transmuxer.flush(l);Object(j.isPromise)(d)?d.then(function(A){b(f,A,l)}):b(f,d,l);break}default:break}})}function w(f,p){if(!T(p.remuxResult)){var E=[],u=p.remuxResult,a=u.audio,n=u.video;a&&g(E,a),n&&g(E,n),f.postMessage({event:"transmuxComplete",data:p},E)}}function g(f,p){p.data1&&f.push(p.data1.buffer),p.data2&&f.push(p.data2.buffer)}function b(f,p,E){p.forEach(function(u){w(f,u)}),f.postMessage({event:"flush",data:E})}function T(f){return!f.audio&&!f.video&&!f.text&&!f.id3&&!f.initSegment}},"./src/demux/transmuxer.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"default",function(){return n}),k.d(H,"isPromise",function(){return d}),k.d(H,"TransmuxConfig",function(){return A}),k.d(H,"TransmuxState",function(){return S});var j=k("./src/events.ts"),N=k("./src/errors.ts"),v=k("./src/crypt/decrypter.ts"),L=k("./src/demux/aacdemuxer.ts"),O=k("./src/demux/mp4demuxer.ts"),D=k("./src/demux/tsdemuxer.ts"),w=k("./src/demux/mp3demuxer.ts"),g=k("./src/remux/mp4-remuxer.ts"),b=k("./src/remux/passthrough-remuxer.ts"),T=k("./src/demux/chunk-cache.ts"),f=k("./src/utils/mp4-tools.ts"),p=k("./src/utils/logger.ts"),E;try{E=self.performance.now.bind(self.performance)}catch(R){p.logger.debug("Unable to use Performance API on this environment"),E=self.Date.now}var u=[{demux:D.default,remux:g.default},{demux:O.default,remux:b.default},{demux:L.default,remux:g.default},{demux:w.default,remux:g.default}],a=1024;u.forEach(function(R){var y=R.demux;a=Math.max(a,y.minProbeByteLength)});var n=function(){function R(_,m,I,B,P){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new T.default,this.observer=_,this.typeSupported=m,this.config=I,this.vendor=B,this.id=P}var y=R.prototype;return y.configure=function(m){this.transmuxConfig=m,this.decrypter&&this.decrypter.reset()},y.push=function(m,I,B,P){var M=this,U=B.transmuxing;U.executeStart=E();var K=new Uint8Array(m),W=this.cache,X=this.config,ie=this.currentTransmuxState,se=this.transmuxConfig;P&&(this.currentTransmuxState=P);var le=s(K,I);if(le&&le.method==="AES-128"){var ve=this.getDecrypter();if(X.enableSoftwareAES){var q=ve.softwareDecrypt(K,le.key.buffer,le.iv.buffer);if(!q)return U.executeEnd=E(),l(B);K=new Uint8Array(q)}else return this.decryptionPromise=ve.webCryptoDecrypt(K,le.key.buffer,le.iv.buffer).then(function(Dt){var qt=M.push(Dt,null,B);return M.decryptionPromise=null,qt}),this.decryptionPromise}var ee=P||ie,ae=ee.contiguous,_e=ee.discontinuity,fe=ee.trackSwitch,Ue=ee.accurateTimeOffset,Te=ee.timeOffset,Fe=se.audioCodec,$e=se.videoCodec,Ye=se.defaultInitPts,Ge=se.duration,st=se.initSegmentData;if((_e||fe)&&this.resetInitSegment(st,Fe,$e,Ge),_e&&this.resetInitialTimestamp(Ye),ae||this.resetContiguity(),this.needsProbing(K,_e,fe)){if(W.dataLength){var Ft=W.flush();K=Object(f.appendUint8Array)(Ft,K)}this.configureTransmuxer(K,se)}var Bt=this.transmux(K,le,Te,Ue,B),Pt=this.currentTransmuxState;return Pt.contiguous=!0,Pt.discontinuity=!1,Pt.trackSwitch=!1,U.executeEnd=E(),Bt},y.flush=function(m){var I=this,B=m.transmuxing;B.executeStart=E();var P=this.decrypter,M=this.cache,U=this.currentTransmuxState,K=this.decryptionPromise;if(K)return K.then(function(){return I.flush(m)});var W=[],X=U.timeOffset;if(P){var ie=P.flush();ie&&W.push(this.push(ie,null,m))}var se=M.dataLength;M.reset();var le=this.demuxer,ve=this.remuxer;if(!le||!ve)return se>=a&&this.observer.emit(j.Events.ERROR,j.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),B.executeEnd=E(),[l(m)];var q=le.flush(X);return d(q)?q.then(function(ee){return I.flushRemux(W,ee,m),W}):(this.flushRemux(W,q,m),W)},y.flushRemux=function(m,I,B){var P=I.audioTrack,M=I.avcTrack,U=I.id3Track,K=I.textTrack,W=this.currentTransmuxState,X=W.accurateTimeOffset,ie=W.timeOffset;p.logger.log("[transmuxer.ts]: Flushed fragment "+B.sn+(B.part>-1?" p: "+B.part:"")+" of level "+B.level);var se=this.remuxer.remux(P,M,U,K,ie,X,!0,this.id);m.push({remuxResult:se,chunkMeta:B}),B.transmuxing.executeEnd=E()},y.resetInitialTimestamp=function(m){var I=this.demuxer,B=this.remuxer;!I||!B||(I.resetTimeStamp(m),B.resetTimeStamp(m))},y.resetContiguity=function(){var m=this.demuxer,I=this.remuxer;!m||!I||(m.resetContiguity(),I.resetNextTimestamp())},y.resetInitSegment=function(m,I,B,P){var M=this.demuxer,U=this.remuxer;!M||!U||(M.resetInitSegment(I,B,P),U.resetInitSegment(m,I,B))},y.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},y.transmux=function(m,I,B,P,M){var U;return I&&I.method==="SAMPLE-AES"?U=this.transmuxSampleAes(m,I,B,P,M):U=this.transmuxUnencrypted(m,B,P,M),U},y.transmuxUnencrypted=function(m,I,B,P){var M=this.demuxer.demux(m,I,!1,!this.config.progressive),U=M.audioTrack,K=M.avcTrack,W=M.id3Track,X=M.textTrack,ie=this.remuxer.remux(U,K,W,X,I,B,!1,this.id);return{remuxResult:ie,chunkMeta:P}},y.transmuxSampleAes=function(m,I,B,P,M){var U=this;return this.demuxer.demuxSampleAes(m,I,B).then(function(K){var W=U.remuxer.remux(K.audioTrack,K.avcTrack,K.id3Track,K.textTrack,B,P,!1,U.id);return{remuxResult:W,chunkMeta:M}})},y.configureTransmuxer=function(m,I){for(var B=this.config,P=this.observer,M=this.typeSupported,U=this.vendor,K=I.audioCodec,W=I.defaultInitPts,X=I.duration,ie=I.initSegmentData,se=I.videoCodec,le,ve=0,q=u.length;ve<q;ve++)if(u[ve].demux.probe(m)){le=u[ve];break}le||(p.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),le={demux:O.default,remux:b.default});var ee=this.demuxer,ae=this.remuxer,_e=le.remux,fe=le.demux;(!ae||!(ae instanceof _e))&&(this.remuxer=new _e(P,B,M,U)),(!ee||!(ee instanceof fe))&&(this.demuxer=new fe(P,B,M),this.probe=fe.probe),this.resetInitSegment(ie,K,se,X),this.resetInitialTimestamp(W)},y.needsProbing=function(m,I,B){return!this.demuxer||!this.remuxer||I||B},y.getDecrypter=function(){var m=this.decrypter;return m||(m=this.decrypter=new v.default(this.observer,this.config)),m},R}();function s(R,y){var _=null;return R.byteLength>0&&y!=null&&y.key!=null&&y.iv!==null&&y.method!=null&&(_=y),_}var l=function(y){return{remuxResult:{},chunkMeta:y}};function d(R){return"then"in R&&R.then instanceof Function}var A=function(y,_,m,I,B){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=y,this.videoCodec=_,this.initSegmentData=m,this.duration=I,this.defaultInitPts=B},S=function(y,_,m,I,B){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=y,this.contiguous=_,this.accurateTimeOffset=m,this.trackSwitch=I,this.timeOffset=B}},"./src/demux/tsdemuxer.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"discardEPB",function(){return l});var j=k("./src/demux/adts.ts"),N=k("./src/demux/mpegaudio.ts"),v=k("./src/demux/exp-golomb.ts"),L=k("./src/demux/id3.ts"),O=k("./src/demux/sample-aes.ts"),D=k("./src/events.ts"),w=k("./src/utils/mp4-tools.ts"),g=k("./src/utils/logger.ts"),b=k("./src/errors.ts"),T={video:1,audio:2,id3:3,text:4},f=function(){function d(S,R,y){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=S,this.config=R,this.typeSupported=y}d.probe=function(R){var y=d.syncOffset(R);return y<0?!1:(y&&g.logger.warn("MPEG2-TS detected but first sync word found @ offset "+y+", junk ahead ?"),!0)},d.syncOffset=function(R){for(var y=Math.min(1e3,R.length-3*188),_=0;_<y;){if(R[_]===71&&R[_+188]===71&&R[_+2*188]===71)return _;_++}return-1},d.createTrack=function(R,y){return{container:R==="video"||R==="audio"?"video/mp2t":void 0,type:R,id:T[R],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:R==="audio"?y:void 0}};var A=d.prototype;return A.resetInitSegment=function(R,y,_){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=d.createTrack("video",_),this._audioTrack=d.createTrack("audio",_),this._id3Track=d.createTrack("id3",_),this._txtTrack=d.createTrack("text",_),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=R,this.videoCodec=y,this._duration=_},A.resetTimeStamp=function(){},A.resetContiguity=function(){var R=this._audioTrack,y=this._avcTrack,_=this._id3Track;R&&(R.pesData=null),y&&(y.pesData=null),_&&(_.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},A.demux=function(R,y,_,m){_===void 0&&(_=!1),m===void 0&&(m=!1),_||(this.sampleAes=null);var I,B=this._avcTrack,P=this._audioTrack,M=this._id3Track,U=B.pid,K=B.pesData,W=P.pid,X=M.pid,ie=P.pesData,se=M.pesData,le=!1,ve=this.pmtParsed,q=this._pmtId,ee=R.length;if(this.remainderData&&(R=Object(w.appendUint8Array)(this.remainderData,R),ee=R.length,this.remainderData=null),ee<188&&!m)return this.remainderData=R,{audioTrack:P,avcTrack:B,id3Track:M,textTrack:this._txtTrack};var ae=Math.max(0,d.syncOffset(R));ee-=(ee+ae)%188,ee<R.byteLength&&!m&&(this.remainderData=new Uint8Array(R.buffer,ee,R.buffer.byteLength-ee));for(var _e=ae;_e<ee;_e+=188)if(R[_e]===71){var fe=!!(R[_e+1]&64),Ue=((R[_e+1]&31)<<8)+R[_e+2],Te=(R[_e+3]&48)>>4,Fe=void 0;if(Te>1){if(Fe=_e+5+R[_e+4],Fe===_e+188)continue}else Fe=_e+4;switch(Ue){case U:fe&&(K&&(I=a(K))&&this.parseAVCPES(I,!1),K={data:[],size:0}),K&&(K.data.push(R.subarray(Fe,_e+188)),K.size+=_e+188-Fe);break;case W:fe&&(ie&&(I=a(ie))&&(P.isAAC?this.parseAACPES(I):this.parseMPEGPES(I)),ie={data:[],size:0}),ie&&(ie.data.push(R.subarray(Fe,_e+188)),ie.size+=_e+188-Fe);break;case X:fe&&(se&&(I=a(se))&&this.parseID3PES(I),se={data:[],size:0}),se&&(se.data.push(R.subarray(Fe,_e+188)),se.size+=_e+188-Fe);break;case 0:fe&&(Fe+=R[Fe]+1),q=this._pmtId=E(R,Fe);break;case q:{fe&&(Fe+=R[Fe]+1);var $e=u(R,Fe,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,_);U=$e.avc,U>0&&(B.pid=U),W=$e.audio,W>0&&(P.pid=W,P.isAAC=$e.isAAC),X=$e.id3,X>0&&(M.pid=X),le&&!ve&&(g.logger.log("reparse from beginning"),le=!1,_e=ae-188),ve=this.pmtParsed=!0;break}case 17:case 8191:break;default:le=!0;break}}else this.observer.emit(D.Events.ERROR,D.Events.ERROR,{type:b.ErrorTypes.MEDIA_ERROR,details:b.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});B.pesData=K,P.pesData=ie,M.pesData=se;var Ye={audioTrack:P,avcTrack:B,id3Track:M,textTrack:this._txtTrack};return m&&this.extractRemainingSamples(Ye),Ye},A.flush=function(){var R=this.remainderData;this.remainderData=null;var y;return R?y=this.demux(R,-1,!1,!0):y={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(y),this.sampleAes?this.decrypt(y,this.sampleAes):y},A.extractRemainingSamples=function(R){var y=R.audioTrack,_=R.avcTrack,m=R.id3Track,I=_.pesData,B=y.pesData,P=m.pesData,M;I&&(M=a(I))?(this.parseAVCPES(M,!0),_.pesData=null):_.pesData=I,B&&(M=a(B))?(y.isAAC?this.parseAACPES(M):this.parseMPEGPES(M),y.pesData=null):(B!=null&&B.size&&g.logger.log("last AAC PES packet truncated,might overlap between fragments"),y.pesData=B),P&&(M=a(P))?(this.parseID3PES(M),m.pesData=null):m.pesData=P},A.demuxSampleAes=function(R,y,_){var m=this.demux(R,_,!0,!this.config.progressive),I=this.sampleAes=new O.default(this.observer,this.config,y);return this.decrypt(m,I)},A.decrypt=function(R,y){return new Promise(function(_){var m=R.audioTrack,I=R.avcTrack;m.samples&&m.isAAC?y.decryptAacSamples(m.samples,0,function(){I.samples?y.decryptAvcSamples(I.samples,0,0,function(){_(R)}):_(R)}):I.samples&&y.decryptAvcSamples(I.samples,0,0,function(){_(R)})})},A.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},A.parseAVCPES=function(R,y){var _=this,m=this._avcTrack,I=this.parseAVCNALu(R.data),B=!1,P=this.avcSample,M,U=!1;R.data=null,P&&I.length&&!m.audFound&&(n(P,m),P=this.avcSample=p(!1,R.pts,R.dts,"")),I.forEach(function(K){switch(K.type){case 1:{M=!0,P||(P=_.avcSample=p(!0,R.pts,R.dts,"")),B&&(P.debug+="NDR "),P.frame=!0;var W=K.data;if(U&&W.length>4){var X=new v.default(W).readSliceType();(X===2||X===4||X===7||X===9)&&(P.key=!0)}break}case 5:M=!0,P||(P=_.avcSample=p(!0,R.pts,R.dts,"")),B&&(P.debug+="IDR "),P.key=!0,P.frame=!0;break;case 6:{M=!0,B&&P&&(P.debug+="SEI ");var ie=new v.default(l(K.data));ie.readUByte();for(var se=0,le=0,ve=!1,q=0;!ve&&ie.bytesAvailable>1;){se=0;do q=ie.readUByte(),se+=q;while(q===255);le=0;do q=ie.readUByte(),le+=q;while(q===255);if(se===4&&ie.bytesAvailable!==0){ve=!0;var ee=ie.readUByte();if(ee===181){var ae=ie.readUShort();if(ae===49){var _e=ie.readUInt();if(_e===1195456820){var fe=ie.readUByte();if(fe===3){for(var Ue=ie.readUByte(),Te=ie.readUByte(),Fe=31&Ue,$e=[Ue,Te],Ye=0;Ye<Fe;Ye++)$e.push(ie.readUByte()),$e.push(ie.readUByte()),$e.push(ie.readUByte());s(_._txtTrack.samples,{type:3,pts:R.pts,bytes:$e})}}}}}else if(se===5&&ie.bytesAvailable!==0){if(ve=!0,le>16){for(var Ge=[],st=0;st<16;st++)Ge.push(ie.readUByte().toString(16)),(st===3||st===5||st===7||st===9)&&Ge.push("-");for(var Ft=le-16,Bt=new Uint8Array(Ft),Pt=0;Pt<Ft;Pt++)Bt[Pt]=ie.readUByte();s(_._txtTrack.samples,{pts:R.pts,payloadType:se,uuid:Ge.join(""),userData:Object(L.utf8ArrayToStr)(Bt),userDataBytes:Bt})}}else if(le<ie.bytesAvailable)for(var Dt=0;Dt<le;Dt++)ie.readUByte()}break}case 7:if(M=!0,U=!0,B&&P&&(P.debug+="SPS "),!m.sps){var qt=new v.default(K.data),Or=qt.readSPS();m.width=Or.width,m.height=Or.height,m.pixelRatio=Or.pixelRatio,m.sps=[K.data],m.duration=_._duration;for(var Ci=K.data.subarray(1,4),Li="avc1.",dr=0;dr<3;dr++){var Qr=Ci[dr].toString(16);Qr.length<2&&(Qr="0"+Qr),Li+=Qr}m.codec=Li}break;case 8:M=!0,B&&P&&(P.debug+="PPS "),m.pps||(m.pps=[K.data]);break;case 9:M=!1,m.audFound=!0,P&&n(P,m),P=_.avcSample=p(!1,R.pts,R.dts,B?"AUD ":"");break;case 12:M=!1;break;default:M=!1,P&&(P.debug+="unknown NAL "+K.type+" ");break}if(P&&M){var Ji=P.units;Ji.push(K)}}),y&&P&&(n(P,m),this.avcSample=null)},A.getLastNalUnit=function(){var R,y=this.avcSample,_;if(!y||y.units.length===0){var m=this._avcTrack.samples;y=m[m.length-1]}if((R=y)!==null&&R!==void 0&&R.units){var I=y.units;_=I[I.length-1]}return _},A.parseAVCNALu=function(R){var y=R.byteLength,_=this._avcTrack,m=_.naluState||0,I=m,B=[],P=0,M,U,K,W=-1,X=0;for(m===-1&&(W=0,X=R[0]&31,m=0,P=1);P<y;){if(M=R[P++],!m){m=M?0:1;continue}if(m===1){m=M?0:2;continue}if(!M)m=3;else if(M===1){if(W>=0){var ie={data:R.subarray(W,P-m-1),type:X};B.push(ie)}else{var se=this.getLastNalUnit();if(se&&(I&&P<=4-I&&se.state&&(se.data=se.data.subarray(0,se.data.byteLength-I)),U=P-m-1,U>0)){var le=new Uint8Array(se.data.byteLength+U);le.set(se.data,0),le.set(R.subarray(0,U),se.data.byteLength),se.data=le,se.state=0}}P<y?(K=R[P]&31,W=P,X=K,m=0):m=-1}else m=0}if(W>=0&&m>=0){var ve={data:R.subarray(W,y),type:X,state:m};B.push(ve)}if(B.length===0){var q=this.getLastNalUnit();if(q){var ee=new Uint8Array(q.data.byteLength+R.byteLength);ee.set(q.data,0),ee.set(R,q.data.byteLength),q.data=ee}}return _.naluState=m,B},A.parseAACPES=function(R){var y=0,_=this._audioTrack,m=this.aacOverFlow,I=R.data;if(m){this.aacOverFlow=null;var B=m.sample.unit.byteLength,P=Math.min(m.missing,B),M=B-P;m.sample.unit.set(I.subarray(0,P),M),_.samples.push(m.sample),y=m.missing}var U,K;for(U=y,K=I.length;U<K-1&&!j.isHeader(I,U);U++);if(U!==y){var W,X;if(U<K-1?(W="AAC PES did not start with ADTS header,offset:"+U,X=!1):(W="no ADTS header found in AAC PES",X=!0),g.logger.warn("parsing error:"+W),this.observer.emit(D.Events.ERROR,D.Events.ERROR,{type:b.ErrorTypes.MEDIA_ERROR,details:b.ErrorDetails.FRAG_PARSING_ERROR,fatal:X,reason:W}),X)return}j.initTrackConfig(_,this.observer,I,U,this.audioCodec);var ie;if(R.pts!==void 0)ie=R.pts;else if(m){var se=j.getFrameDuration(_.samplerate);ie=m.sample.pts+se}else{g.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var le=0;U<K;)if(j.isHeader(I,U)){if(U+5<K){var ve=j.appendFrame(_,I,U,ie,le);if(ve)if(ve.missing)this.aacOverFlow=ve;else{U+=ve.length,le++;continue}}break}else U++},A.parseMPEGPES=function(R){var y=R.data,_=y.length,m=0,I=0,B=R.pts;if(B===void 0){g.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;I<_;)if(N.isHeader(y,I)){var P=N.appendFrame(this._audioTrack,y,I,B,m);if(P)I+=P.length,m++;else break}else I++},A.parseID3PES=function(R){if(R.pts===void 0){g.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(R)},d}();f.minProbeByteLength=188;function p(d,A,S,R){return{key:d,frame:!1,pts:A,dts:S,units:[],debug:R,length:0}}function E(d,A){return(d[A+10]&31)<<8|d[A+11]}function u(d,A,S,R){var y={audio:-1,avc:-1,id3:-1,isAAC:!0},_=(d[A+1]&15)<<8|d[A+2],m=A+3+_-4,I=(d[A+10]&15)<<8|d[A+11];for(A+=12+I;A<m;){var B=(d[A+1]&31)<<8|d[A+2];switch(d[A]){case 207:if(!R){g.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:y.audio===-1&&(y.audio=B);break;case 21:y.id3===-1&&(y.id3=B);break;case 219:if(!R){g.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:y.avc===-1&&(y.avc=B);break;case 3:case 4:S?y.audio===-1&&(y.audio=B,y.isAAC=!1):g.logger.log("MPEG audio found, not supported in this browser");break;case 36:g.logger.warn("Unsupported HEVC stream type found");break;default:break}A+=((d[A+3]&15)<<8|d[A+4])+5}return y}function a(d){var A=0,S,R,y,_,m,I=d.data;if(!d||d.size===0)return null;for(;I[0].length<19&&I.length>1;){var B=new Uint8Array(I[0].length+I[1].length);B.set(I[0]),B.set(I[1],I[0].length),I[0]=B,I.splice(1,1)}S=I[0];var P=(S[0]<<16)+(S[1]<<8)+S[2];if(P===1){if(R=(S[4]<<8)+S[5],R&&R>d.size-6)return null;var M=S[7];M&192&&(_=(S[9]&14)*536870912+(S[10]&255)*4194304+(S[11]&254)*16384+(S[12]&255)*128+(S[13]&254)/2,M&64?(m=(S[14]&14)*536870912+(S[15]&255)*4194304+(S[16]&254)*16384+(S[17]&255)*128+(S[18]&254)/2,_-m>60*9e4&&(g.logger.warn(Math.round((_-m)/9e4)+"s delta between PTS and DTS, align them"),_=m)):m=_),y=S[8];var U=y+9;if(d.size<=U)return null;d.size-=U;for(var K=new Uint8Array(d.size),W=0,X=I.length;W<X;W++){S=I[W];var ie=S.byteLength;if(U)if(U>ie){U-=ie;continue}else S=S.subarray(U),ie-=U,U=0;K.set(S,A),A+=ie}return R&&(R-=y+3),{data:K,pts:_,dts:m,len:R}}return null}function n(d,A){if(d.units.length&&d.frame){if(d.pts===void 0){var S=A.samples,R=S.length;if(R){var y=S[R-1];d.pts=y.pts,d.dts=y.dts}else{A.dropped++;return}}A.samples.push(d)}d.debug.length&&g.logger.log(d.pts+"/"+d.dts+":"+d.debug)}function s(d,A){var S=d.length;if(S>0){if(A.pts>=d[S-1].pts)d.push(A);else for(var R=S-1;R>=0;R--)if(A.pts<d[R].pts){d.splice(R,0,A);break}}else d.push(A)}function l(d){for(var A=d.byteLength,S=[],R=1;R<A-2;)d[R]===0&&d[R+1]===0&&d[R+2]===3?(S.push(R+2),R+=2):R++;if(S.length===0)return d;var y=A-S.length,_=new Uint8Array(y),m=0;for(R=0;R<y;m++,R++)m===S[0]&&(m++,S.shift()),_[R]=d[m];return _}H.default=f},"./src/errors.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"ErrorTypes",function(){return j}),k.d(H,"ErrorDetails",function(){return N});var j;(function(v){v.NETWORK_ERROR="networkError",v.MEDIA_ERROR="mediaError",v.KEY_SYSTEM_ERROR="keySystemError",v.MUX_ERROR="muxError",v.OTHER_ERROR="otherError"})(j||(j={}));var N;(function(v){v.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",v.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",v.KEY_SYSTEM_NO_SESSION="keySystemNoSession",v.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",v.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",v.MANIFEST_LOAD_ERROR="manifestLoadError",v.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",v.MANIFEST_PARSING_ERROR="manifestParsingError",v.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",v.LEVEL_EMPTY_ERROR="levelEmptyError",v.LEVEL_LOAD_ERROR="levelLoadError",v.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",v.LEVEL_SWITCH_ERROR="levelSwitchError",v.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",v.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",v.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",v.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",v.FRAG_LOAD_ERROR="fragLoadError",v.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",v.FRAG_DECRYPT_ERROR="fragDecryptError",v.FRAG_PARSING_ERROR="fragParsingError",v.REMUX_ALLOC_ERROR="remuxAllocError",v.KEY_LOAD_ERROR="keyLoadError",v.KEY_LOAD_TIMEOUT="keyLoadTimeOut",v.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",v.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",v.BUFFER_APPEND_ERROR="bufferAppendError",v.BUFFER_APPENDING_ERROR="bufferAppendingError",v.BUFFER_STALLED_ERROR="bufferStalledError",v.BUFFER_FULL_ERROR="bufferFullError",v.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",v.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",v.INTERNAL_EXCEPTION="internalException",v.INTERNAL_ABORTED="aborted",v.UNKNOWN="unknown"})(N||(N={}))},"./src/events.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"Events",function(){return j});var j;(function(N){N.MEDIA_ATTACHING="hlsMediaAttaching",N.MEDIA_ATTACHED="hlsMediaAttached",N.MEDIA_DETACHING="hlsMediaDetaching",N.MEDIA_DETACHED="hlsMediaDetached",N.BUFFER_RESET="hlsBufferReset",N.BUFFER_CODECS="hlsBufferCodecs",N.BUFFER_CREATED="hlsBufferCreated",N.BUFFER_APPENDING="hlsBufferAppending",N.BUFFER_APPENDED="hlsBufferAppended",N.BUFFER_EOS="hlsBufferEos",N.BUFFER_FLUSHING="hlsBufferFlushing",N.BUFFER_FLUSHED="hlsBufferFlushed",N.MANIFEST_LOADING="hlsManifestLoading",N.MANIFEST_LOADED="hlsManifestLoaded",N.MANIFEST_PARSED="hlsManifestParsed",N.LEVEL_SWITCHING="hlsLevelSwitching",N.LEVEL_SWITCHED="hlsLevelSwitched",N.LEVEL_LOADING="hlsLevelLoading",N.LEVEL_LOADED="hlsLevelLoaded",N.LEVEL_UPDATED="hlsLevelUpdated",N.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",N.LEVELS_UPDATED="hlsLevelsUpdated",N.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",N.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",N.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",N.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",N.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",N.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",N.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",N.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",N.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",N.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",N.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",N.CUES_PARSED="hlsCuesParsed",N.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",N.INIT_PTS_FOUND="hlsInitPtsFound",N.FRAG_LOADING="hlsFragLoading",N.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",N.FRAG_LOADED="hlsFragLoaded",N.FRAG_DECRYPTED="hlsFragDecrypted",N.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",N.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",N.FRAG_PARSING_METADATA="hlsFragParsingMetadata",N.FRAG_PARSED="hlsFragParsed",N.FRAG_BUFFERED="hlsFragBuffered",N.FRAG_CHANGED="hlsFragChanged",N.FPS_DROP="hlsFpsDrop",N.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",N.ERROR="hlsError",N.DESTROYING="hlsDestroying",N.KEY_LOADING="hlsKeyLoading",N.KEY_LOADED="hlsKeyLoaded",N.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",N.BACK_BUFFER_REACHED="hlsBackBufferReached"})(j||(j={}))},"./src/hls.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"default",function(){return d});var j=k("./node_modules/url-toolkit/src/url-toolkit.js"),N=k.n(j),v=k("./src/loader/playlist-loader.ts"),L=k("./src/loader/key-loader.ts"),O=k("./src/controller/id3-track-controller.ts"),D=k("./src/controller/latency-controller.ts"),w=k("./src/controller/level-controller.ts"),g=k("./src/controller/fragment-tracker.ts"),b=k("./src/controller/stream-controller.ts"),T=k("./src/is-supported.ts"),f=k("./src/utils/logger.ts"),p=k("./src/config.ts"),E=k("./node_modules/eventemitter3/index.js"),u=k.n(E),a=k("./src/events.ts"),n=k("./src/errors.ts");function s(A,S){for(var R=0;R<S.length;R++){var y=S[R];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(A,y.key,y)}}function l(A,S,R){return S&&s(A.prototype,S),R&&s(A,R),A}var d=function(){A.isSupported=function(){return Object(T.isSupported)()};function A(R){R===void 0&&(R={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new E.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var y=this.config=Object(p.mergeConfig)(A.DefaultConfig,R);this.userConfig=R,Object(f.enableLogs)(y.debug),this._autoLevelCapping=-1,y.progressive&&Object(p.enableStreamingMode)(y);var _=y.abrController,m=y.bufferController,I=y.capLevelController,B=y.fpsController,P=this.abrController=new _(this),M=this.bufferController=new m(this),U=this.capLevelController=new I(this),K=new B(this),W=new v.default(this),X=new L.default(this),ie=new O.default(this),se=this.levelController=new w.default(this),le=new g.FragmentTracker(this),ve=this.streamController=new b.default(this,le);U.setStreamController(ve),K.setStreamController(ve);var q=[se,ve];this.networkControllers=q;var ee=[W,X,P,M,U,K,ie,le];this.audioTrackController=this.createController(y.audioTrackController,null,q),this.createController(y.audioStreamController,le,q),this.subtitleTrackController=this.createController(y.subtitleTrackController,null,q),this.createController(y.subtitleStreamController,le,q),this.createController(y.timelineController,null,ee),this.emeController=this.createController(y.emeController,null,ee),this.cmcdController=this.createController(y.cmcdController,null,ee),this.latencyController=this.createController(D.default,null,ee),this.coreComponents=ee}var S=A.prototype;return S.createController=function(y,_,m){if(y){var I=_?new y(this,_):new y(this);return m&&m.push(I),I}return null},S.on=function(y,_,m){m===void 0&&(m=this),this._emitter.on(y,_,m)},S.once=function(y,_,m){m===void 0&&(m=this),this._emitter.once(y,_,m)},S.removeAllListeners=function(y){this._emitter.removeAllListeners(y)},S.off=function(y,_,m,I){m===void 0&&(m=this),this._emitter.off(y,_,m,I)},S.listeners=function(y){return this._emitter.listeners(y)},S.emit=function(y,_,m){return this._emitter.emit(y,_,m)},S.trigger=function(y,_){if(this.config.debug)return this.emit(y,y,_);try{return this.emit(y,y,_)}catch(m){f.logger.error("An internal error happened while handling event "+y+'. Error message: "'+m.message+'". Here is a stacktrace:',m),this.trigger(a.Events.ERROR,{type:n.ErrorTypes.OTHER_ERROR,details:n.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:y,error:m})}return!1},S.listenerCount=function(y){return this._emitter.listenerCount(y)},S.destroy=function(){f.logger.log("destroy"),this.trigger(a.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(y){return y.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(y){return y.destroy()}),this.coreComponents.length=0},S.attachMedia=function(y){f.logger.log("attachMedia"),this._media=y,this.trigger(a.Events.MEDIA_ATTACHING,{media:y})},S.detachMedia=function(){f.logger.log("detachMedia"),this.trigger(a.Events.MEDIA_DETACHING,void 0),this._media=null},S.loadSource=function(y){this.stopLoad();var _=this.media,m=this.url,I=this.url=j.buildAbsoluteURL(self.location.href,y,{alwaysNormalize:!0});f.logger.log("loadSource:"+I),_&&m&&m!==I&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(_)),this.trigger(a.Events.MANIFEST_LOADING,{url:y})},S.startLoad=function(y){y===void 0&&(y=-1),f.logger.log("startLoad("+y+")"),this.networkControllers.forEach(function(_){_.startLoad(y)})},S.stopLoad=function(){f.logger.log("stopLoad"),this.networkControllers.forEach(function(y){y.stopLoad()})},S.swapAudioCodec=function(){f.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},S.recoverMediaError=function(){f.logger.log("recoverMediaError");var y=this._media;this.detachMedia(),y&&this.attachMedia(y)},S.removeLevel=function(y,_){_===void 0&&(_=0),this.levelController.removeLevel(y,_)},l(A,[{key:"levels",get:function(){var y=this.levelController.levels;return y||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(y){f.logger.log("set currentLevel:"+y),this.loadLevel=y,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(y){f.logger.log("set nextLevel:"+y),this.levelController.manualLevel=y,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(y){f.logger.log("set loadLevel:"+y),this.levelController.manualLevel=y}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(y){this.levelController.nextLoadLevel=y}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(y){f.logger.log("set firstLevel:"+y),this.levelController.firstLevel=y}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(y){f.logger.log("set startLevel:"+y),y!==-1&&(y=Math.max(y,this.minAutoLevel)),this.levelController.startLevel=y}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(y){var _=!!y;_!==this.config.capLevelToPlayerSize&&(_?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=_)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(y){this._autoLevelCapping!==y&&(f.logger.log("set autoLevelCapping:"+y),this._autoLevelCapping=y)}},{key:"bandwidthEstimate",get:function(){var y=this.abrController.bwEstimator;return y?y.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var y=this.levels,_=this.config.minAutoBitrate;if(!y)return 0;for(var m=y.length,I=0;I<m;I++)if(y[I].maxBitrate>_)return I;return 0}},{key:"maxAutoLevel",get:function(){var y=this.levels,_=this.autoLevelCapping,m;return _===-1&&y&&y.length?m=y.length-1:m=_,m}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(y){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,y)}},{key:"audioTracks",get:function(){var y=this.audioTrackController;return y?y.audioTracks:[]}},{key:"audioTrack",get:function(){var y=this.audioTrackController;return y?y.audioTrack:-1},set:function(y){var _=this.audioTrackController;_&&(_.audioTrack=y)}},{key:"subtitleTracks",get:function(){var y=this.subtitleTrackController;return y?y.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var y=this.subtitleTrackController;return y?y.subtitleTrack:-1},set:function(y){var _=this.subtitleTrackController;_&&(_.subtitleTrack=y)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var y=this.subtitleTrackController;return y?y.subtitleDisplay:!1},set:function(y){var _=this.subtitleTrackController;_&&(_.subtitleDisplay=y)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(y){this.config.lowLatencyMode=y}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return a.Events}},{key:"ErrorTypes",get:function(){return n.ErrorTypes}},{key:"ErrorDetails",get:function(){return n.ErrorDetails}},{key:"DefaultConfig",get:function(){return A.defaultConfig?A.defaultConfig:p.hlsDefaultConfig},set:function(y){A.defaultConfig=y}}]),A}();d.defaultConfig=void 0},"./src/is-supported.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"isSupported",function(){return v}),k.d(H,"changeTypeSupported",function(){return L});var j=k("./src/utils/mediasource-helper.ts");function N(){return self.SourceBuffer||self.WebKitSourceBuffer}function v(){var O=Object(j.getMediaSource)();if(!O)return!1;var D=N(),w=O&&typeof O.isTypeSupported=="function"&&O.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),g=!D||D.prototype&&typeof D.prototype.appendBuffer=="function"&&typeof D.prototype.remove=="function";return!!w&&!!g}function L(){var O,D=N();return typeof(D==null||(O=D.prototype)===null||O===void 0?void 0:O.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"default",function(){return f}),k.d(H,"LoadError",function(){return E});var j=k("./src/polyfills/number.ts"),N=k("./src/errors.ts");function v(u,a){u.prototype=Object.create(a.prototype),u.prototype.constructor=u,g(u,a)}function L(u){var a=typeof Map=="function"?new Map:void 0;return L=function(s){if(s===null||!w(s))return s;if(typeof s!="function")throw new TypeError("Super expression must either be null or a function");if(typeof a!="undefined"){if(a.has(s))return a.get(s);a.set(s,l)}function l(){return O(s,arguments,b(this).constructor)}return l.prototype=Object.create(s.prototype,{constructor:{value:l,enumerable:!1,writable:!0,configurable:!0}}),g(l,s)},L(u)}function O(u,a,n){return D()?O=Reflect.construct:O=function(l,d,A){var S=[null];S.push.apply(S,d);var R=Function.bind.apply(l,S),y=new R;return A&&g(y,A.prototype),y},O.apply(null,arguments)}function D(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(u){return!1}}function w(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function g(u,a){return g=Object.setPrototypeOf||function(s,l){return s.__proto__=l,s},g(u,a)}function b(u){return b=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},b(u)}var T=Math.pow(2,17),f=function(){function u(n){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=n}var a=u.prototype;return a.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},a.abort=function(){this.loader&&this.loader.abort()},a.load=function(s,l){var d=this,A=s.url;if(!A)return Promise.reject(new E({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,networkDetails:null},"Fragment does not have a "+(A?"part list":"url")));this.abort();var S=this.config,R=S.fLoader,y=S.loader;return new Promise(function(_,m){d.loader&&d.loader.destroy();var I=d.loader=s.loader=R?new R(S):new y(S),B=p(s),P={timeout:S.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:S.fragLoadingMaxRetryTimeout,highWaterMark:T};s.stats=I.stats,I.load(B,P,{onSuccess:function(U,K,W,X){d.resetLoader(s,I),_({frag:s,part:null,payload:U.data,networkDetails:X})},onError:function(U,K,W){d.resetLoader(s,I),m(new E({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,response:U,networkDetails:W}))},onAbort:function(U,K,W){d.resetLoader(s,I),m(new E({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:s,networkDetails:W}))},onTimeout:function(U,K,W){d.resetLoader(s,I),m(new E({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:s,networkDetails:W}))},onProgress:function(U,K,W,X){l&&l({frag:s,part:null,payload:W,networkDetails:X})}})})},a.loadPart=function(s,l,d){var A=this;this.abort();var S=this.config,R=S.fLoader,y=S.loader;return new Promise(function(_,m){A.loader&&A.loader.destroy();var I=A.loader=s.loader=R?new R(S):new y(S),B=p(s,l),P={timeout:S.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:S.fragLoadingMaxRetryTimeout,highWaterMark:T};l.stats=I.stats,I.load(B,P,{onSuccess:function(U,K,W,X){A.resetLoader(s,I),A.updateStatsFromPart(s,l);var ie={frag:s,part:l,payload:U.data,networkDetails:X};d(ie),_(ie)},onError:function(U,K,W){A.resetLoader(s,I),m(new E({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,part:l,response:U,networkDetails:W}))},onAbort:function(U,K,W){s.stats.aborted=l.stats.aborted,A.resetLoader(s,I),m(new E({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:s,part:l,networkDetails:W}))},onTimeout:function(U,K,W){A.resetLoader(s,I),m(new E({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:s,part:l,networkDetails:W}))}})})},a.updateStatsFromPart=function(s,l){var d=s.stats,A=l.stats,S=A.total;if(d.loaded+=A.loaded,S){var R=Math.round(s.duration/l.duration),y=Math.min(Math.round(d.loaded/S),R),_=R-y,m=_*Math.round(d.loaded/y);d.total=d.loaded+m}else d.total=Math.max(d.loaded,d.total);var I=d.loading,B=A.loading;I.start?I.first+=B.first-B.start:(I.start=B.start,I.first=B.first),I.end=B.end},a.resetLoader=function(s,l){s.loader=null,this.loader===l&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),l.destroy()},u}();function p(u,a){a===void 0&&(a=null);var n=a||u,s={frag:u,part:a,responseType:"arraybuffer",url:n.url,headers:{},rangeStart:0,rangeEnd:0},l=n.byteRangeStartOffset,d=n.byteRangeEndOffset;return Object(j.isFiniteNumber)(l)&&Object(j.isFiniteNumber)(d)&&(s.rangeStart=l,s.rangeEnd=d),s}var E=function(u){v(a,u);function a(n){for(var s,l=arguments.length,d=new Array(l>1?l-1:0),A=1;A<l;A++)d[A-1]=arguments[A];return s=u.call.apply(u,[this].concat(d))||this,s.data=void 0,s.data=n,s}return a}(L(Error))},"./src/loader/fragment.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"ElementaryStreamTypes",function(){return f}),k.d(H,"BaseSegment",function(){return p}),k.d(H,"Fragment",function(){return E}),k.d(H,"Part",function(){return u});var j=k("./src/polyfills/number.ts"),N=k("./node_modules/url-toolkit/src/url-toolkit.js"),v=k.n(N),L=k("./src/utils/logger.ts"),O=k("./src/loader/level-key.ts"),D=k("./src/loader/load-stats.ts");function w(a,n){a.prototype=Object.create(n.prototype),a.prototype.constructor=a,g(a,n)}function g(a,n){return g=Object.setPrototypeOf||function(l,d){return l.__proto__=d,l},g(a,n)}function b(a,n){for(var s=0;s<n.length;s++){var l=n[s];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(a,l.key,l)}}function T(a,n,s){return n&&b(a.prototype,n),s&&b(a,s),a}var f;(function(a){a.AUDIO="audio",a.VIDEO="video",a.AUDIOVIDEO="audiovideo"})(f||(f={}));var p=function(){function a(s){var l;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(l={},l[f.AUDIO]=null,l[f.VIDEO]=null,l[f.AUDIOVIDEO]=null,l),this.baseurl=s}var n=a.prototype;return n.setByteRange=function(l,d){var A=l.split("@",2),S=[];A.length===1?S[0]=d?d.byteRangeEndOffset:0:S[0]=parseInt(A[1]),S[1]=parseInt(A[0])+S[0],this._byteRange=S},T(a,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(N.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(l){this._url=l}}]),a}(),E=function(a){w(n,a);function n(l,d){var A;return A=a.call(this,d)||this,A._decryptdata=null,A.rawProgramDateTime=null,A.programDateTime=null,A.tagList=[],A.duration=0,A.sn=0,A.levelkey=void 0,A.type=void 0,A.loader=null,A.level=-1,A.cc=0,A.startPTS=void 0,A.endPTS=void 0,A.appendedPTS=void 0,A.startDTS=void 0,A.endDTS=void 0,A.start=0,A.deltaPTS=void 0,A.maxStartPTS=void 0,A.minEndPTS=void 0,A.stats=new D.LoadStats,A.urlId=0,A.data=void 0,A.bitrateTest=!1,A.title=null,A.initSegment=null,A.type=l,A}var s=n.prototype;return s.createInitializationVector=function(d){for(var A=new Uint8Array(16),S=12;S<16;S++)A[S]=d>>8*(15-S)&255;return A},s.setDecryptDataFromLevelKey=function(d,A){var S=d;return(d==null?void 0:d.method)==="AES-128"&&d.uri&&!d.iv&&(S=O.LevelKey.fromURI(d.uri),S.method=d.method,S.iv=this.createInitializationVector(A),S.keyFormat="identity"),S},s.setElementaryStreamInfo=function(d,A,S,R,y,_){_===void 0&&(_=!1);var m=this.elementaryStreams,I=m[d];if(!I){m[d]={startPTS:A,endPTS:S,startDTS:R,endDTS:y,partial:_};return}I.startPTS=Math.min(I.startPTS,A),I.endPTS=Math.max(I.endPTS,S),I.startDTS=Math.min(I.startDTS,R),I.endDTS=Math.max(I.endDTS,y)},s.clearElementaryStreamInfo=function(){var d=this.elementaryStreams;d[f.AUDIO]=null,d[f.VIDEO]=null,d[f.AUDIOVIDEO]=null},T(n,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var d=this.sn;typeof d!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&L.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),d=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,d)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null||!Object(j.isFiniteNumber)(this.programDateTime))return null;var d=Object(j.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+d*1e3}},{key:"encrypted",get:function(){var d;return!!((d=this.decryptdata)!==null&&d!==void 0&&d.keyFormat&&this.decryptdata.uri)}}]),n}(p),u=function(a){w(n,a);function n(s,l,d,A,S){var R;R=a.call(this,d)||this,R.fragOffset=0,R.duration=0,R.gap=!1,R.independent=!1,R.relurl=void 0,R.fragment=void 0,R.index=void 0,R.stats=new D.LoadStats,R.duration=s.decimalFloatingPoint("DURATION"),R.gap=s.bool("GAP"),R.independent=s.bool("INDEPENDENT"),R.relurl=s.enumeratedString("URI"),R.fragment=l,R.index=A;var y=s.enumeratedString("BYTERANGE");return y&&R.setByteRange(y,S),S&&(R.fragOffset=S.fragOffset+S.duration),R}return T(n,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var l=this.elementaryStreams;return!!(l.audio||l.video||l.audiovideo)}}]),n}(p)},"./src/loader/key-loader.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"default",function(){return L});var j=k("./src/events.ts"),N=k("./src/errors.ts"),v=k("./src/utils/logger.ts"),L=function(){function O(w){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=w,this._registerListeners()}var D=O.prototype;return D._registerListeners=function(){this.hls.on(j.Events.KEY_LOADING,this.onKeyLoading,this)},D._unregisterListeners=function(){this.hls.off(j.Events.KEY_LOADING,this.onKeyLoading)},D.destroy=function(){this._unregisterListeners();for(var g in this.loaders){var b=this.loaders[g];b&&b.destroy()}this.loaders={}},D.onKeyLoading=function(g,b){var T=b.frag,f=T.type,p=this.loaders[f];if(!T.decryptdata){v.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var E=T.decryptdata.uri;if(E!==this.decrypturl||this.decryptkey===null){var u=this.hls.config;if(p&&(v.logger.warn("abort previous key loader for type:"+f),p.abort()),!E){v.logger.warn("key uri is falsy");return}var a=u.loader,n=T.loader=this.loaders[f]=new a(u);this.decrypturl=E,this.decryptkey=null;var s={url:E,frag:T,responseType:"arraybuffer"},l={timeout:u.fragLoadingTimeOut,maxRetry:0,retryDelay:u.fragLoadingRetryDelay,maxRetryDelay:u.fragLoadingMaxRetryTimeout,highWaterMark:0},d={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};n.load(s,l,d)}else this.decryptkey&&(T.decryptdata.key=this.decryptkey,this.hls.trigger(j.Events.KEY_LOADED,{frag:T}))},D.loadsuccess=function(g,b,T){var f=T.frag;if(!f.decryptdata){v.logger.error("after key load, decryptdata unset");return}this.decryptkey=f.decryptdata.key=new Uint8Array(g.data),f.loader=null,delete this.loaders[f.type],this.hls.trigger(j.Events.KEY_LOADED,{frag:f})},D.loaderror=function(g,b){var T=b.frag,f=T.loader;f&&f.abort(),delete this.loaders[T.type],this.hls.trigger(j.Events.ERROR,{type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:T,response:g})},D.loadtimeout=function(g,b){var T=b.frag,f=T.loader;f&&f.abort(),delete this.loaders[T.type],this.hls.trigger(j.Events.ERROR,{type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:T})},O}()},"./src/loader/level-details.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"LevelDetails",function(){return O});var j=k("./src/polyfills/number.ts");function N(D,w){for(var g=0;g<w.length;g++){var b=w[g];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(D,b.key,b)}}function v(D,w,g){return w&&N(D.prototype,w),g&&N(D,g),D}var L=10,O=function(){function D(g){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=g}var w=D.prototype;return w.reloaded=function(b){if(!b){this.advanced=!0,this.updated=!0;return}var T=this.lastPartSn-b.lastPartSn,f=this.lastPartIndex-b.lastPartIndex;this.updated=this.endSN!==b.endSN||!!f||!!T,this.advanced=this.endSN>b.endSN||T>0||T===0&&f>0,this.updated||this.advanced?this.misses=Math.floor(b.misses*.6):this.misses=b.misses+1,this.availabilityDelay=b.availabilityDelay},v(D,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(j.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||L}},{key:"drift",get:function(){var b=this.driftEndTime-this.driftStartTime;if(b>0){var T=this.driftEnd-this.driftStart;return T*1e3/b}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var b;return(b=this.partList)!==null&&b!==void 0&&b.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var b;return(b=this.fragments)!==null&&b!==void 0&&b.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var b;return(b=this.partList)!==null&&b!==void 0&&b.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var b;return(b=this.partList)!==null&&b!==void 0&&b.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),D}()},"./src/loader/level-key.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"LevelKey",function(){return O});var j=k("./node_modules/url-toolkit/src/url-toolkit.js"),N=k.n(j);function v(D,w){for(var g=0;g<w.length;g++){var b=w[g];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(D,b.key,b)}}function L(D,w,g){return w&&v(D.prototype,w),g&&v(D,g),D}var O=function(){D.fromURL=function(g,b){return new D(g,b)},D.fromURI=function(g){return new D(g)};function D(w,g){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,g?this._uri=Object(j.buildAbsoluteURL)(w,g,{alwaysNormalize:!0}):this._uri=w}return L(D,[{key:"uri",get:function(){return this._uri}}]),D}()},"./src/loader/load-stats.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"LoadStats",function(){return j});var j=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"default",function(){return n});var j=k("./src/polyfills/number.ts"),N=k("./node_modules/url-toolkit/src/url-toolkit.js"),v=k.n(N),L=k("./src/loader/fragment.ts"),O=k("./src/loader/level-details.ts"),D=k("./src/loader/level-key.ts"),w=k("./src/utils/attr-list.ts"),g=k("./src/utils/logger.ts"),b=k("./src/utils/codecs.ts"),T=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,f=/#EXT-X-MEDIA:(.*)/g,p=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),E=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),u=/\.(mp4|m4s|m4v|m4a)$/i;function a(S){var R,y;return u.test((R=(y=N.parseURL(S))===null||y===void 0?void 0:y.path)!=null?R:"")}var n=function(){function S(){}return S.findGroup=function(y,_){for(var m=0;m<y.length;m++){var I=y[m];if(I.id===_)return I}},S.convertAVC1ToAVCOTI=function(y){var _=y.split(".");if(_.length>2){var m=_.shift()+".";return m+=parseInt(_.shift()).toString(16),m+=("000"+parseInt(_.shift()).toString(16)).substr(-4),m}return y},S.resolve=function(y,_){return N.buildAbsoluteURL(_,y,{alwaysNormalize:!0})},S.parseMasterPlaylist=function(y,_){var m=[],I={},B=!1;T.lastIndex=0;for(var P;(P=T.exec(y))!=null;)if(P[1]){var M=new w.AttrList(P[1]),U={attrs:M,bitrate:M.decimalInteger("AVERAGE-BANDWIDTH")||M.decimalInteger("BANDWIDTH"),name:M.NAME,url:S.resolve(P[2],_)},K=M.decimalResolution("RESOLUTION");K&&(U.width=K.width,U.height=K.height),s((M.CODECS||"").split(/[ ,]+/).filter(function(X){return X}),U),U.videoCodec&&U.videoCodec.indexOf("avc1")!==-1&&(U.videoCodec=S.convertAVC1ToAVCOTI(U.videoCodec)),m.push(U)}else if(P[3]){var W=new w.AttrList(P[3]);W["DATA-ID"]&&(B=!0,I[W["DATA-ID"]]=W)}return{levels:m,sessionData:B?I:null}},S.parseMasterPlaylistMedia=function(y,_,m,I){I===void 0&&(I=[]);var B,P=[],M=0;for(f.lastIndex=0;(B=f.exec(y))!==null;){var U=new w.AttrList(B[1]);if(U.TYPE===m){var K={attrs:U,bitrate:0,id:M++,groupId:U["GROUP-ID"],instreamId:U["INSTREAM-ID"],name:U.NAME||U.LANGUAGE||"",type:m,default:U.bool("DEFAULT"),autoselect:U.bool("AUTOSELECT"),forced:U.bool("FORCED"),lang:U.LANGUAGE,url:U.URI?S.resolve(U.URI,_):""};if(I.length){var W=S.findGroup(I,K.groupId)||I[0];l(K,W,"audioCodec"),l(K,W,"textCodec")}P.push(K)}}return P},S.parseLevelPlaylist=function(y,_,m,I,B){var P=new O.LevelDetails(_),M=P.fragments,U=null,K=0,W=0,X=0,ie=0,se=null,le=new L.Fragment(I,_),ve,q,ee,ae=-1,_e=!1;for(p.lastIndex=0,P.m3u8=y;(ve=p.exec(y))!==null;){_e&&(_e=!1,le=new L.Fragment(I,_),le.start=X,le.sn=K,le.cc=ie,le.level=m,U&&(le.initSegment=U,le.rawProgramDateTime=U.rawProgramDateTime));var fe=ve[1];if(fe){le.duration=parseFloat(fe);var Ue=(" "+ve[2]).slice(1);le.title=Ue||null,le.tagList.push(Ue?["INF",fe,Ue]:["INF",fe])}else if(ve[3])Object(j.isFiniteNumber)(le.duration)&&(le.start=X,ee&&(le.levelkey=ee),le.sn=K,le.level=m,le.cc=ie,le.urlId=B,M.push(le),le.relurl=(" "+ve[3]).slice(1),A(le,se),se=le,X+=le.duration,K++,W=0,_e=!0);else if(ve[4]){var Te=(" "+ve[4]).slice(1);se?le.setByteRange(Te,se):le.setByteRange(Te)}else if(ve[5])le.rawProgramDateTime=(" "+ve[5]).slice(1),le.tagList.push(["PROGRAM-DATE-TIME",le.rawProgramDateTime]),ae===-1&&(ae=M.length);else{if(ve=ve[0].match(E),!ve){g.logger.warn("No matches on slow regex match for level playlist!");continue}for(q=1;q<ve.length&&typeof ve[q]=="undefined";q++);var Fe=(" "+ve[q]).slice(1),$e=(" "+ve[q+1]).slice(1),Ye=ve[q+2]?(" "+ve[q+2]).slice(1):"";switch(Fe){case"PLAYLIST-TYPE":P.type=$e.toUpperCase();break;case"MEDIA-SEQUENCE":K=P.startSN=parseInt($e);break;case"SKIP":{var Ge=new w.AttrList($e),st=Ge.decimalInteger("SKIPPED-SEGMENTS");if(Object(j.isFiniteNumber)(st)){P.skippedSegments=st;for(var Ft=st;Ft--;)M.unshift(null);K+=st}var Bt=Ge.enumeratedString("RECENTLY-REMOVED-DATERANGES");Bt&&(P.recentlyRemovedDateranges=Bt.split(" "));break}case"TARGETDURATION":P.targetduration=parseFloat($e);break;case"VERSION":P.version=parseInt($e);break;case"EXTM3U":break;case"ENDLIST":P.live=!1;break;case"#":($e||Ye)&&le.tagList.push(Ye?[$e,Ye]:[$e]);break;case"DIS":ie++;case"GAP":le.tagList.push([Fe]);break;case"BITRATE":le.tagList.push([Fe,$e]);break;case"DISCONTINUITY-SEQ":ie=parseInt($e);break;case"KEY":{var Pt,Dt=new w.AttrList($e),qt=Dt.enumeratedString("METHOD"),Or=Dt.URI,Ci=Dt.hexadecimalInteger("IV"),Li=Dt.enumeratedString("KEYFORMATVERSIONS"),dr=Dt.enumeratedString("KEYID"),Qr=(Pt=Dt.enumeratedString("KEYFORMAT"))!=null?Pt:"identity",Ji=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Ji.indexOf(Qr)>-1){g.logger.warn("Keyformat "+Qr+" is not supported from the manifest");continue}else if(Qr!=="identity")continue;qt&&(ee=D.LevelKey.fromURL(_,Or),Or&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(qt)>=0&&(ee.method=qt,ee.keyFormat=Qr,dr&&(ee.keyID=dr),Li&&(ee.keyFormatVersions=Li),ee.iv=Ci));break}case"START":{var kr=new w.AttrList($e),Bi=kr.decimalFloatingPoint("TIME-OFFSET");Object(j.isFiniteNumber)(Bi)&&(P.startTimeOffset=Bi);break}case"MAP":{var gi=new w.AttrList($e);le.relurl=gi.URI,gi.BYTERANGE&&le.setByteRange(gi.BYTERANGE),le.level=m,le.sn="initSegment",ee&&(le.levelkey=ee),le.initSegment=null,U=le,_e=!0;break}case"SERVER-CONTROL":{var Ei=new w.AttrList($e);P.canBlockReload=Ei.bool("CAN-BLOCK-RELOAD"),P.canSkipUntil=Ei.optionalFloat("CAN-SKIP-UNTIL",0),P.canSkipDateRanges=P.canSkipUntil>0&&Ei.bool("CAN-SKIP-DATERANGES"),P.partHoldBack=Ei.optionalFloat("PART-HOLD-BACK",0),P.holdBack=Ei.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Gr=new w.AttrList($e);P.partTarget=Gr.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Hr=P.partList;Hr||(Hr=P.partList=[]);var wt=W>0?Hr[Hr.length-1]:void 0,Ir=W++,Ui=new L.Part(new w.AttrList($e),le,_,Ir,wt);Hr.push(Ui),le.duration+=Ui.duration;break}case"PRELOAD-HINT":{var on=new w.AttrList($e);P.preloadHint=on;break}case"RENDITION-REPORT":{var Gn=new w.AttrList($e);P.renditionReports=P.renditionReports||[],P.renditionReports.push(Gn);break}default:g.logger.warn("line parsed but not handled: "+ve);break}}}se&&!se.relurl?(M.pop(),X-=se.duration,P.partList&&(P.fragmentHint=se)):P.partList&&(A(le,se),le.cc=ie,P.fragmentHint=le);var an=M.length,_i=M[0],_n=M[an-1];if(X+=P.skippedSegments*P.targetduration,X>0&&an&&_n){P.averagetargetduration=X/an;var Cn=_n.sn;P.endSN=Cn!=="initSegment"?Cn:0,_i&&(P.startCC=_i.cc,_i.initSegment||P.fragments.every(function(Ni){return Ni.relurl&&a(Ni.relurl)})&&(g.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),le=new L.Fragment(I,_),le.relurl=_n.relurl,le.level=m,le.sn="initSegment",_i.initSegment=le,P.needSidxRanges=!0))}else P.endSN=0,P.startCC=0;return P.fragmentHint&&(X+=P.fragmentHint.duration),P.totalduration=X,P.endCC=ie,ae>0&&d(M,ae),P},S}();function s(S,R){["video","audio","text"].forEach(function(y){var _=S.filter(function(I){return Object(b.isCodecType)(I,y)});if(_.length){var m=_.filter(function(I){return I.lastIndexOf("avc1",0)===0||I.lastIndexOf("mp4a",0)===0});R[y+"Codec"]=m.length>0?m[0]:_[0],S=S.filter(function(I){return _.indexOf(I)===-1})}}),R.unknownCodecs=S}function l(S,R,y){var _=R[y];_&&(S[y]=_)}function d(S,R){for(var y=S[R],_=R;_--;){var m=S[_];if(!m)return;m.programDateTime=y.programDateTime-m.duration*1e3,y=m}}function A(S,R){S.rawProgramDateTime?S.programDateTime=Date.parse(S.rawProgramDateTime):R!=null&&R.programDateTime&&(S.programDateTime=R.endProgramDateTime),Object(j.isFiniteNumber)(S.programDateTime)||(S.programDateTime=null,S.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(de,H,k){"use strict";k.r(H);var j=k("./src/polyfills/number.ts"),N=k("./src/events.ts"),v=k("./src/errors.ts"),L=k("./src/utils/logger.ts"),O=k("./src/utils/mp4-tools.ts"),D=k("./src/loader/m3u8-parser.ts"),w=k("./src/types/loader.ts"),g=k("./src/utils/attr-list.ts");function b(p){var E=p.type;switch(E){case w.PlaylistContextType.AUDIO_TRACK:return w.PlaylistLevelType.AUDIO;case w.PlaylistContextType.SUBTITLE_TRACK:return w.PlaylistLevelType.SUBTITLE;default:return w.PlaylistLevelType.MAIN}}function T(p,E){var u=p.url;return(u===void 0||u.indexOf("data:")===0)&&(u=E.url),u}var f=function(){function p(u){this.hls=void 0,this.loaders=Object.create(null),this.hls=u,this.registerListeners()}var E=p.prototype;return E.registerListeners=function(){var a=this.hls;a.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(N.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(N.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.on(N.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},E.unregisterListeners=function(){var a=this.hls;a.off(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(N.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(N.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.off(N.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},E.createInternalLoader=function(a){var n=this.hls.config,s=n.pLoader,l=n.loader,d=s||l,A=new d(n);return a.loader=A,this.loaders[a.type]=A,A},E.getInternalLoader=function(a){return this.loaders[a.type]},E.resetInternalLoader=function(a){this.loaders[a]&&delete this.loaders[a]},E.destroyInternalLoaders=function(){for(var a in this.loaders){var n=this.loaders[a];n&&n.destroy(),this.resetInternalLoader(a)}},E.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},E.onManifestLoading=function(a,n){var s=n.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:w.PlaylistContextType.MANIFEST,url:s,deliveryDirectives:null})},E.onLevelLoading=function(a,n){var s=n.id,l=n.level,d=n.url,A=n.deliveryDirectives;this.load({id:s,groupId:null,level:l,responseType:"text",type:w.PlaylistContextType.LEVEL,url:d,deliveryDirectives:A})},E.onAudioTrackLoading=function(a,n){var s=n.id,l=n.groupId,d=n.url,A=n.deliveryDirectives;this.load({id:s,groupId:l,level:null,responseType:"text",type:w.PlaylistContextType.AUDIO_TRACK,url:d,deliveryDirectives:A})},E.onSubtitleTrackLoading=function(a,n){var s=n.id,l=n.groupId,d=n.url,A=n.deliveryDirectives;this.load({id:s,groupId:l,level:null,responseType:"text",type:w.PlaylistContextType.SUBTITLE_TRACK,url:d,deliveryDirectives:A})},E.load=function(a){var n,s=this.hls.config,l=this.getInternalLoader(a);if(l){var d=l.context;if(d&&d.url===a.url){L.logger.trace("[playlist-loader]: playlist request ongoing");return}L.logger.log("[playlist-loader]: aborting previous loader for type: "+a.type),l.abort()}var A,S,R,y;switch(a.type){case w.PlaylistContextType.MANIFEST:A=s.manifestLoadingMaxRetry,S=s.manifestLoadingTimeOut,R=s.manifestLoadingRetryDelay,y=s.manifestLoadingMaxRetryTimeout;break;case w.PlaylistContextType.LEVEL:case w.PlaylistContextType.AUDIO_TRACK:case w.PlaylistContextType.SUBTITLE_TRACK:A=0,S=s.levelLoadingTimeOut;break;default:A=s.levelLoadingMaxRetry,S=s.levelLoadingTimeOut,R=s.levelLoadingRetryDelay,y=s.levelLoadingMaxRetryTimeout;break}if(l=this.createInternalLoader(a),(n=a.deliveryDirectives)!==null&&n!==void 0&&n.part){var _;if(a.type===w.PlaylistContextType.LEVEL&&a.level!==null?_=this.hls.levels[a.level].details:a.type===w.PlaylistContextType.AUDIO_TRACK&&a.id!==null?_=this.hls.audioTracks[a.id].details:a.type===w.PlaylistContextType.SUBTITLE_TRACK&&a.id!==null&&(_=this.hls.subtitleTracks[a.id].details),_){var m=_.partTarget,I=_.targetduration;m&&I&&(S=Math.min(Math.max(m*3,I*.8)*1e3,S))}}var B={timeout:S,maxRetry:A,retryDelay:R,maxRetryDelay:y,highWaterMark:0},P={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(a,B,P)},E.loadsuccess=function(a,n,s,l){if(l===void 0&&(l=null),s.isSidxRequest){this.handleSidxRequest(a,s),this.handlePlaylistLoaded(a,n,s,l);return}this.resetInternalLoader(s.type);var d=a.data;if(d.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(a,s,"no EXTM3U delimiter",l);return}n.parsing.start=performance.now(),d.indexOf("#EXTINF:")>0||d.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(a,n,s,l):this.handleMasterPlaylist(a,n,s,l)},E.loaderror=function(a,n,s){s===void 0&&(s=null),this.handleNetworkError(n,s,!1,a)},E.loadtimeout=function(a,n,s){s===void 0&&(s=null),this.handleNetworkError(n,s,!0)},E.handleMasterPlaylist=function(a,n,s,l){var d=this.hls,A=a.data,S=T(a,s),R=D.default.parseMasterPlaylist(A,S),y=R.levels,_=R.sessionData;if(!y.length){this.handleManifestParsingError(a,s,"no level found in manifest",l);return}var m=y.map(function(K){return{id:K.attrs.AUDIO,audioCodec:K.audioCodec}}),I=y.map(function(K){return{id:K.attrs.SUBTITLES,textCodec:K.textCodec}}),B=D.default.parseMasterPlaylistMedia(A,S,"AUDIO",m),P=D.default.parseMasterPlaylistMedia(A,S,"SUBTITLES",I),M=D.default.parseMasterPlaylistMedia(A,S,"CLOSED-CAPTIONS");if(B.length){var U=B.some(function(K){return!K.url});!U&&y[0].audioCodec&&!y[0].attrs.AUDIO&&(L.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),B.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new g.AttrList({}),bitrate:0,url:""}))}d.trigger(N.Events.MANIFEST_LOADED,{levels:y,audioTracks:B,subtitles:P,captions:M,url:S,stats:n,networkDetails:l,sessionData:_})},E.handleTrackOrLevelPlaylist=function(a,n,s,l){var d=this.hls,A=s.id,S=s.level,R=s.type,y=T(a,s),_=Object(j.isFiniteNumber)(A)?A:0,m=Object(j.isFiniteNumber)(S)?S:_,I=b(s),B=D.default.parseLevelPlaylist(a.data,y,m,I,_);if(!B.fragments.length){d.trigger(N.Events.ERROR,{type:v.ErrorTypes.NETWORK_ERROR,details:v.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:y,reason:"no fragments found in level",level:typeof s.level=="number"?s.level:void 0});return}if(R===w.PlaylistContextType.MANIFEST){var P={attrs:new g.AttrList({}),bitrate:0,details:B,name:"",url:y};d.trigger(N.Events.MANIFEST_LOADED,{levels:[P],audioTracks:[],url:y,stats:n,networkDetails:l,sessionData:null})}if(n.parsing.end=performance.now(),B.needSidxRanges){var M,U=(M=B.fragments[0].initSegment)===null||M===void 0?void 0:M.url;this.load({url:U,isSidxRequest:!0,type:R,level:S,levelDetails:B,id:A,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}s.levelDetails=B,this.handlePlaylistLoaded(a,n,s,l)},E.handleSidxRequest=function(a,n){var s=Object(O.parseSegmentIndex)(new Uint8Array(a.data));if(!!s){var l=s.references,d=n.levelDetails;l.forEach(function(A,S){var R=A.info,y=d.fragments[S];y.byteRange.length===0&&y.setByteRange(String(1+R.end-R.start)+"@"+String(R.start)),y.initSegment&&y.initSegment.setByteRange(String(s.moovEndOffset)+"@0")})}},E.handleManifestParsingError=function(a,n,s,l){this.hls.trigger(N.Events.ERROR,{type:v.ErrorTypes.NETWORK_ERROR,details:v.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:n.type===w.PlaylistContextType.MANIFEST,url:a.url,reason:s,response:a,context:n,networkDetails:l})},E.handleNetworkError=function(a,n,s,l){s===void 0&&(s=!1),L.logger.warn("[playlist-loader]: A network "+(s?"timeout":"error")+" occurred while loading "+a.type+" level: "+a.level+" id: "+a.id+' group-id: "'+a.groupId+'"');var d=v.ErrorDetails.UNKNOWN,A=!1,S=this.getInternalLoader(a);switch(a.type){case w.PlaylistContextType.MANIFEST:d=s?v.ErrorDetails.MANIFEST_LOAD_TIMEOUT:v.ErrorDetails.MANIFEST_LOAD_ERROR,A=!0;break;case w.PlaylistContextType.LEVEL:d=s?v.ErrorDetails.LEVEL_LOAD_TIMEOUT:v.ErrorDetails.LEVEL_LOAD_ERROR,A=!1;break;case w.PlaylistContextType.AUDIO_TRACK:d=s?v.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:v.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,A=!1;break;case w.PlaylistContextType.SUBTITLE_TRACK:d=s?v.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:v.ErrorDetails.SUBTITLE_LOAD_ERROR,A=!1;break}S&&this.resetInternalLoader(a.type);var R={type:v.ErrorTypes.NETWORK_ERROR,details:d,fatal:A,url:a.url,loader:S,context:a,networkDetails:n};l&&(R.response=l),this.hls.trigger(N.Events.ERROR,R)},E.handlePlaylistLoaded=function(a,n,s,l){var d=s.type,A=s.level,S=s.id,R=s.groupId,y=s.loader,_=s.levelDetails,m=s.deliveryDirectives;if(!(_!=null&&_.targetduration)){this.handleManifestParsingError(a,s,"invalid target duration",l);return}if(!!y)switch(_.live&&(y.getCacheAge&&(_.ageHeader=y.getCacheAge()||0),(!y.getCacheAge||isNaN(_.ageHeader))&&(_.ageHeader=0)),d){case w.PlaylistContextType.MANIFEST:case w.PlaylistContextType.LEVEL:this.hls.trigger(N.Events.LEVEL_LOADED,{details:_,level:A||0,id:S||0,stats:n,networkDetails:l,deliveryDirectives:m});break;case w.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(N.Events.AUDIO_TRACK_LOADED,{details:_,id:S||0,groupId:R||"",stats:n,networkDetails:l,deliveryDirectives:m});break;case w.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(N.Events.SUBTITLE_TRACK_LOADED,{details:_,id:S||0,groupId:R||"",stats:n,networkDetails:l,deliveryDirectives:m});break}},p}();H.default=f},"./src/polyfills/number.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"isFiniteNumber",function(){return j}),k.d(H,"MAX_SAFE_INTEGER",function(){return N});var j=Number.isFinite||function(v){return typeof v=="number"&&isFinite(v)},N=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(de,H,k){"use strict";k.r(H);var j=function(){function N(){}return N.getSilentFrame=function(L,O){switch(L){case"mp4a.40.2":if(O===1)return new Uint8Array([0,200,0,128,35,128]);if(O===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(O===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(O===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(O===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(O===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(O===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(O===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(O===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}},N}();H.default=j},"./src/remux/mp4-generator.ts":function(de,H,k){"use strict";k.r(H);var j=Math.pow(2,32)-1,N=function(){function v(){}return v.init=function(){v.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var O;for(O in v.types)v.types.hasOwnProperty(O)&&(v.types[O]=[O.charCodeAt(0),O.charCodeAt(1),O.charCodeAt(2),O.charCodeAt(3)]);var D=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),w=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);v.HDLR_TYPES={video:D,audio:w};var g=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),b=new Uint8Array([0,0,0,0,0,0,0,0]);v.STTS=v.STSC=v.STCO=b,v.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),v.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),v.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),v.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var T=new Uint8Array([105,115,111,109]),f=new Uint8Array([97,118,99,49]),p=new Uint8Array([0,0,0,1]);v.FTYP=v.box(v.types.ftyp,T,p,T,f),v.DINF=v.box(v.types.dinf,v.box(v.types.dref,g))},v.box=function(O){for(var D=8,w=arguments.length,g=new Array(w>1?w-1:0),b=1;b<w;b++)g[b-1]=arguments[b];for(var T=g.length,f=T;T--;)D+=g[T].byteLength;var p=new Uint8Array(D);for(p[0]=D>>24&255,p[1]=D>>16&255,p[2]=D>>8&255,p[3]=D&255,p.set(O,4),T=0,D=8;T<f;T++)p.set(g[T],D),D+=g[T].byteLength;return p},v.hdlr=function(O){return v.box(v.types.hdlr,v.HDLR_TYPES[O])},v.mdat=function(O){return v.box(v.types.mdat,O)},v.mdhd=function(O,D){D*=O;var w=Math.floor(D/(j+1)),g=Math.floor(D%(j+1));return v.box(v.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,O>>24&255,O>>16&255,O>>8&255,O&255,w>>24,w>>16&255,w>>8&255,w&255,g>>24,g>>16&255,g>>8&255,g&255,85,196,0,0]))},v.mdia=function(O){return v.box(v.types.mdia,v.mdhd(O.timescale,O.duration),v.hdlr(O.type),v.minf(O))},v.mfhd=function(O){return v.box(v.types.mfhd,new Uint8Array([0,0,0,0,O>>24,O>>16&255,O>>8&255,O&255]))},v.minf=function(O){return O.type==="audio"?v.box(v.types.minf,v.box(v.types.smhd,v.SMHD),v.DINF,v.stbl(O)):v.box(v.types.minf,v.box(v.types.vmhd,v.VMHD),v.DINF,v.stbl(O))},v.moof=function(O,D,w){return v.box(v.types.moof,v.mfhd(O),v.traf(w,D))},v.moov=function(O){for(var D=O.length,w=[];D--;)w[D]=v.trak(O[D]);return v.box.apply(null,[v.types.moov,v.mvhd(O[0].timescale,O[0].duration)].concat(w).concat(v.mvex(O)))},v.mvex=function(O){for(var D=O.length,w=[];D--;)w[D]=v.trex(O[D]);return v.box.apply(null,[v.types.mvex].concat(w))},v.mvhd=function(O,D){D*=O;var w=Math.floor(D/(j+1)),g=Math.floor(D%(j+1)),b=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,O>>24&255,O>>16&255,O>>8&255,O&255,w>>24,w>>16&255,w>>8&255,w&255,g>>24,g>>16&255,g>>8&255,g&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return v.box(v.types.mvhd,b)},v.sdtp=function(O){var D=O.samples||[],w=new Uint8Array(4+D.length),g,b;for(g=0;g<D.length;g++)b=D[g].flags,w[g+4]=b.dependsOn<<4|b.isDependedOn<<2|b.hasRedundancy;return v.box(v.types.sdtp,w)},v.stbl=function(O){return v.box(v.types.stbl,v.stsd(O),v.box(v.types.stts,v.STTS),v.box(v.types.stsc,v.STSC),v.box(v.types.stsz,v.STSZ),v.box(v.types.stco,v.STCO))},v.avc1=function(O){var D=[],w=[],g,b,T;for(g=0;g<O.sps.length;g++)b=O.sps[g],T=b.byteLength,D.push(T>>>8&255),D.push(T&255),D=D.concat(Array.prototype.slice.call(b));for(g=0;g<O.pps.length;g++)b=O.pps[g],T=b.byteLength,w.push(T>>>8&255),w.push(T&255),w=w.concat(Array.prototype.slice.call(b));var f=v.box(v.types.avcC,new Uint8Array([1,D[3],D[4],D[5],252|3,224|O.sps.length].concat(D).concat([O.pps.length]).concat(w))),p=O.width,E=O.height,u=O.pixelRatio[0],a=O.pixelRatio[1];return v.box(v.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,p>>8&255,p&255,E>>8&255,E&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),f,v.box(v.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),v.box(v.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,u&255,a>>24,a>>16&255,a>>8&255,a&255])))},v.esds=function(O){var D=O.config.length;return new Uint8Array([0,0,0,0,3,23+D,0,1,0,4,15+D,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([D]).concat(O.config).concat([6,1,2]))},v.mp4a=function(O){var D=O.samplerate;return v.box(v.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,O.channelCount,0,16,0,0,0,0,D>>8&255,D&255,0,0]),v.box(v.types.esds,v.esds(O)))},v.mp3=function(O){var D=O.samplerate;return v.box(v.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,O.channelCount,0,16,0,0,0,0,D>>8&255,D&255,0,0]))},v.stsd=function(O){return O.type==="audio"?!O.isAAC&&O.codec==="mp3"?v.box(v.types.stsd,v.STSD,v.mp3(O)):v.box(v.types.stsd,v.STSD,v.mp4a(O)):v.box(v.types.stsd,v.STSD,v.avc1(O))},v.tkhd=function(O){var D=O.id,w=O.duration*O.timescale,g=O.width,b=O.height,T=Math.floor(w/(j+1)),f=Math.floor(w%(j+1));return v.box(v.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,D>>24&255,D>>16&255,D>>8&255,D&255,0,0,0,0,T>>24,T>>16&255,T>>8&255,T&255,f>>24,f>>16&255,f>>8&255,f&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,g>>8&255,g&255,0,0,b>>8&255,b&255,0,0]))},v.traf=function(O,D){var w=v.sdtp(O),g=O.id,b=Math.floor(D/(j+1)),T=Math.floor(D%(j+1));return v.box(v.types.traf,v.box(v.types.tfhd,new Uint8Array([0,0,0,0,g>>24,g>>16&255,g>>8&255,g&255])),v.box(v.types.tfdt,new Uint8Array([1,0,0,0,b>>24,b>>16&255,b>>8&255,b&255,T>>24,T>>16&255,T>>8&255,T&255])),v.trun(O,w.length+16+20+8+16+8+8),w)},v.trak=function(O){return O.duration=O.duration||4294967295,v.box(v.types.trak,v.tkhd(O),v.mdia(O))},v.trex=function(O){var D=O.id;return v.box(v.types.trex,new Uint8Array([0,0,0,0,D>>24,D>>16&255,D>>8&255,D&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},v.trun=function(O,D){var w=O.samples||[],g=w.length,b=12+16*g,T=new Uint8Array(b),f,p,E,u,a,n;for(D+=8+b,T.set([0,0,15,1,g>>>24&255,g>>>16&255,g>>>8&255,g&255,D>>>24&255,D>>>16&255,D>>>8&255,D&255],0),f=0;f<g;f++)p=w[f],E=p.duration,u=p.size,a=p.flags,n=p.cts,T.set([E>>>24&255,E>>>16&255,E>>>8&255,E&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.paddingValue<<1|a.isNonSync,a.degradPrio&240<<8,a.degradPrio&15,n>>>24&255,n>>>16&255,n>>>8&255,n&255],12+16*f);return v.box(v.types.trun,T)},v.initSegment=function(O){v.types||v.init();var D=v.moov(O),w=new Uint8Array(v.FTYP.byteLength+D.byteLength);return w.set(v.FTYP),w.set(D,v.FTYP.byteLength),w},v}();N.types=void 0,N.HDLR_TYPES=void 0,N.STTS=void 0,N.STSC=void 0,N.STCO=void 0,N.STSZ=void 0,N.VMHD=void 0,N.SMHD=void 0,N.STSD=void 0,N.FTYP=void 0,N.DINF=void 0,H.default=N},"./src/remux/mp4-remuxer.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"default",function(){return n}),k.d(H,"normalizePts",function(){return s});var j=k("./src/polyfills/number.ts"),N=k("./src/remux/aac-helper.ts"),v=k("./src/remux/mp4-generator.ts"),L=k("./src/events.ts"),O=k("./src/errors.ts"),D=k("./src/utils/logger.ts"),w=k("./src/types/loader.ts"),g=k("./src/utils/timescale-conversion.ts");function b(){return b=Object.assign||function(S){for(var R=1;R<arguments.length;R++){var y=arguments[R];for(var _ in y)Object.prototype.hasOwnProperty.call(y,_)&&(S[_]=y[_])}return S},b.apply(this,arguments)}var T=10*1e3,f=1024,p=1152,E=null,u=null,a=!1,n=function(){function S(y,_,m,I){if(I===void 0&&(I=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=y,this.config=_,this.typeSupported=m,this.ISGenerated=!1,E===null){var B=navigator.userAgent||"",P=B.match(/Chrome\/(\d+)/i);E=P?parseInt(P[1]):0}if(u===null){var M=navigator.userAgent.match(/Safari\/(\d+)/i);u=M?parseInt(M[1]):0}a=!!E&&E<75||!!u&&u<600}var R=S.prototype;return R.destroy=function(){},R.resetTimeStamp=function(_){D.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=_},R.resetNextTimestamp=function(){D.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},R.resetInitSegment=function(){D.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},R.getVideoStartPts=function(_){var m=!1,I=_.reduce(function(B,P){var M=P.pts-B;return M<-4294967296?(m=!0,s(B,P.pts)):M>0?B:P.pts},_[0].pts);return m&&D.logger.debug("PTS rollover detected"),I},R.remux=function(_,m,I,B,P,M,U,K){var W,X,ie,se,le,ve,q=P,ee=P,ae=_.pid>-1,_e=m.pid>-1,fe=m.samples.length,Ue=_.samples.length>0,Te=fe>1,Fe=(!ae||Ue)&&(!_e||Te)||this.ISGenerated||U;if(Fe){this.ISGenerated||(ie=this.generateIS(_,m,P));var $e=this.isVideoContiguous,Ye=-1;if(Te&&(Ye=l(m.samples),!$e&&this.config.forceKeyFrameOnDiscontinuity))if(ve=!0,Ye>0){D.logger.warn("[mp4-remuxer]: Dropped "+Ye+" out of "+fe+" video samples due to a missing keyframe");var Ge=this.getVideoStartPts(m.samples);m.samples=m.samples.slice(Ye),m.dropped+=Ye,ee+=(m.samples[0].pts-Ge)/(m.timescale||9e4)}else Ye===-1&&(D.logger.warn("[mp4-remuxer]: No keyframe found out of "+fe+" video samples"),ve=!1);if(this.ISGenerated){if(Ue&&Te){var st=this.getVideoStartPts(m.samples),Ft=s(_.samples[0].pts,st)-st,Bt=Ft/m.inputTimeScale;q+=Math.max(0,Bt),ee+=Math.max(0,-Bt)}if(Ue){if(_.samplerate||(D.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),ie=this.generateIS(_,m,P)),X=this.remuxAudio(_,q,this.isAudioContiguous,M,_e||Te||K===w.PlaylistLevelType.AUDIO?ee:void 0),Te){var Pt=X?X.endPTS-X.startPTS:0;m.inputTimeScale||(D.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),ie=this.generateIS(_,m,P)),W=this.remuxVideo(m,ee,$e,Pt)}}else Te&&(W=this.remuxVideo(m,ee,$e,0));W&&(W.firstKeyFrame=Ye,W.independent=Ye!==-1)}}return this.ISGenerated&&(I.samples.length&&(le=this.remuxID3(I,P)),B.samples.length&&(se=this.remuxText(B,P))),{audio:X,video:W,initSegment:ie,independent:ve,text:se,id3:le}},R.generateIS=function(_,m,I){var B=_.samples,P=m.samples,M=this.typeSupported,U={},K=!Object(j.isFiniteNumber)(this._initPTS),W="audio/mp4",X,ie,se;if(K&&(X=ie=1/0),_.config&&B.length&&(_.timescale=_.samplerate,_.isAAC||(M.mpeg?(W="audio/mpeg",_.codec=""):M.mp3&&(_.codec="mp3")),U.audio={id:"audio",container:W,codec:_.codec,initSegment:!_.isAAC&&M.mpeg?new Uint8Array(0):v.default.initSegment([_]),metadata:{channelCount:_.channelCount}},K&&(se=_.inputTimeScale,X=ie=B[0].pts-Math.round(se*I))),m.sps&&m.pps&&P.length&&(m.timescale=m.inputTimeScale,U.video={id:"main",container:"video/mp4",codec:m.codec,initSegment:v.default.initSegment([m]),metadata:{width:m.width,height:m.height}},K)){se=m.inputTimeScale;var le=this.getVideoStartPts(P),ve=Math.round(se*I);ie=Math.min(ie,s(P[0].dts,le)-ve),X=Math.min(X,le-ve)}if(Object.keys(U).length)return this.ISGenerated=!0,K&&(this._initPTS=X,this._initDTS=ie),{tracks:U,initPTS:X,timescale:se}},R.remuxVideo=function(_,m,I,B){var P=_.inputTimeScale,M=_.samples,U=[],K=M.length,W=this._initPTS,X=this.nextAvcDts,ie=8,se,le,ve,q=Number.POSITIVE_INFINITY,ee=Number.NEGATIVE_INFINITY,ae=0,_e=!1;if(!I||X===null){var fe=m*P,Ue=M[0].pts-s(M[0].dts,M[0].pts);X=fe-Ue}for(var Te=0;Te<K;Te++){var Fe=M[Te];if(Fe.pts=s(Fe.pts-W,X),Fe.dts=s(Fe.dts-W,X),Fe.dts>Fe.pts){var $e=9e4*.2;ae=Math.max(Math.min(ae,Fe.pts-Fe.dts),-1*$e)}Fe.dts<M[Te>0?Te-1:Te].dts&&(_e=!0)}_e&&M.sort(function(Xt,Ur){var Rs=Xt.dts-Ur.dts,Xn=Xt.pts-Ur.pts;return Rs||Xn}),le=M[0].dts,ve=M[M.length-1].dts;var Ye=Math.round((ve-le)/(K-1));if(ae<0){if(ae<Ye*-2){D.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(g.toMsFromMpegTsClock)(-Ye,!0)+" ms");for(var Ge=ae,st=0;st<K;st++)M[st].dts=Ge=Math.max(Ge,M[st].pts-Ye),M[st].pts=Math.max(Ge,M[st].pts)}else{D.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(g.toMsFromMpegTsClock)(ae,!0)+" ms to overcome this issue");for(var Ft=0;Ft<K;Ft++)M[Ft].dts=M[Ft].dts+ae}le=M[0].dts}if(I){var Bt=le-X,Pt=Bt>Ye,Dt=Bt<-1;if(Pt||Dt){Pt?D.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(Bt,!0)+" ms ("+Bt+"dts) hole between fragments detected, filling it"):D.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(-Bt,!0)+" ms ("+Bt+"dts) overlapping between fragments detected"),le=X;var qt=M[0].pts-Bt;M[0].dts=le,M[0].pts=qt,D.logger.log("Video: First PTS/DTS adjusted: "+Object(g.toMsFromMpegTsClock)(qt,!0)+"/"+Object(g.toMsFromMpegTsClock)(le,!0)+", delta: "+Object(g.toMsFromMpegTsClock)(Bt,!0)+" ms")}}a&&(le=Math.max(0,le));for(var Or=0,Ci=0,Li=0;Li<K;Li++){for(var dr=M[Li],Qr=dr.units,Ji=Qr.length,kr=0,Bi=0;Bi<Ji;Bi++)kr+=Qr[Bi].data.length;Ci+=kr,Or+=Ji,dr.length=kr,dr.dts=Math.max(dr.dts,le),dr.pts=Math.max(dr.pts,dr.dts,0),q=Math.min(dr.pts,q),ee=Math.max(dr.pts,ee)}ve=M[K-1].dts;var gi=Ci+4*Or+8,Ei;try{Ei=new Uint8Array(gi)}catch(Xt){this.observer.emit(L.Events.ERROR,L.Events.ERROR,{type:O.ErrorTypes.MUX_ERROR,details:O.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:gi,reason:"fail allocating video mdat "+gi});return}var Gr=new DataView(Ei.buffer);Gr.setUint32(0,gi),Ei.set(v.default.types.mdat,4);for(var Hr=0;Hr<K;Hr++){for(var wt=M[Hr],Ir=wt.units,Ui=0,on=0,Gn=Ir.length;on<Gn;on++){var an=Ir[on],_i=an.data,_n=an.data.byteLength;Gr.setUint32(ie,_n),ie+=4,Ei.set(_i,ie),ie+=_n,Ui+=4+_n}if(Hr<K-1)se=M[Hr+1].dts-wt.dts;else{var Cn=this.config,Ni=wt.dts-M[Hr>0?Hr-1:Hr].dts;if(Cn.stretchShortVideoTrack&&this.nextAudioPts!==null){var yn=Math.floor(Cn.maxBufferHole*P),as=(B?q+B*P:this.nextAudioPts)-wt.pts;as>yn?(se=as-Ni,se<0&&(se=Ni),D.logger.log("[mp4-remuxer]: It is approximately "+as/90+" ms to the next segment; using duration "+se/90+" ms for the last video frame.")):se=Ni}else se=Ni}var Hn=Math.round(wt.pts-wt.dts);U.push(new d(wt.key,se,Ui,Hn))}if(U.length&&E&&E<70){var Hs=U[0].flags;Hs.dependsOn=2,Hs.isNonSync=0}console.assert(se!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=X=ve+se,this.isVideoContiguous=!0;var Ks=v.default.moof(_.sequenceNumber++,le,b({},_,{samples:U})),cs="video",ui={data1:Ks,data2:Ei,startPTS:q/P,endPTS:(ee+se)/P,startDTS:le/P,endDTS:X/P,type:cs,hasAudio:!1,hasVideo:!0,nb:U.length,dropped:_.dropped};return _.samples=[],_.dropped=0,console.assert(Ei.length,"MDAT length must not be zero"),ui},R.remuxAudio=function(_,m,I,B,P){var M=_.inputTimeScale,U=_.samplerate?_.samplerate:M,K=M/U,W=_.isAAC?f:p,X=W*K,ie=this._initPTS,se=!_.isAAC&&this.typeSupported.mpeg,le=[],ve=_.samples,q=se?0:8,ee=this.nextAudioPts||-1,ae=m*M;if(this.isAudioContiguous=I=I||ve.length&&ee>0&&(B&&Math.abs(ae-ee)<9e3||Math.abs(s(ve[0].pts-ie,ae)-ee)<20*X),ve.forEach(function(_i){_i.pts=s(_i.pts-ie,ae)}),!I||ee<0){if(ve=ve.filter(function(_i){return _i.pts>=0}),!ve.length)return;P===0?ee=0:B?ee=Math.max(0,ae):ee=ve[0].pts}if(_.isAAC)for(var _e=P!==void 0,fe=this.config.maxAudioFramesDrift,Ue=0,Te=ee;Ue<ve.length;Ue++){var Fe=ve[Ue],$e=Fe.pts,Ye=$e-Te,Ge=Math.abs(1e3*Ye/M);if(Ye<=-fe*X&&_e)Ue===0&&(D.logger.warn("Audio frame @ "+($e/M).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Ye/M)+" ms."),this.nextAudioPts=ee=Te=$e);else if(Ye>=fe*X&&Ge<T&&_e){var st=Math.round(Ye/X);Te=$e-st*X,Te<0&&(st--,Te+=X),Ue===0&&(this.nextAudioPts=ee=Te),D.logger.warn("[mp4-remuxer]: Injecting "+st+" audio frame @ "+(Te/M).toFixed(3)+"s due to "+Math.round(1e3*Ye/M)+" ms gap.");for(var Ft=0;Ft<st;Ft++){var Bt=Math.max(Te,0),Pt=N.default.getSilentFrame(_.manifestCodec||_.codec,_.channelCount);Pt||(D.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Pt=Fe.unit.subarray()),ve.splice(Ue,0,{unit:Pt,pts:Bt}),Te+=X,Ue++}}Fe.pts=Te,Te+=X}for(var Dt=null,qt=null,Or,Ci=0,Li=ve.length;Li--;)Ci+=ve[Li].unit.byteLength;for(var dr=0,Qr=ve.length;dr<Qr;dr++){var Ji=ve[dr],kr=Ji.unit,Bi=Ji.pts;if(qt!==null){var gi=le[dr-1];gi.duration=Math.round((Bi-qt)/K)}else if(I&&_.isAAC&&(Bi=ee),Dt=Bi,Ci>0){Ci+=q;try{Or=new Uint8Array(Ci)}catch(_i){this.observer.emit(L.Events.ERROR,L.Events.ERROR,{type:O.ErrorTypes.MUX_ERROR,details:O.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ci,reason:"fail allocating audio mdat "+Ci});return}if(!se){var Ei=new DataView(Or.buffer);Ei.setUint32(0,Ci),Or.set(v.default.types.mdat,4)}}else return;Or.set(kr,q);var Gr=kr.byteLength;q+=Gr,le.push(new d(!0,W,Gr,0)),qt=Bi}var Hr=le.length;if(!!Hr){var wt=le[le.length-1];this.nextAudioPts=ee=qt+K*wt.duration;var Ir=se?new Uint8Array(0):v.default.moof(_.sequenceNumber++,Dt/K,b({},_,{samples:le}));_.samples=[];var Ui=Dt/M,on=ee/M,Gn="audio",an={data1:Ir,data2:Or,startPTS:Ui,endPTS:on,startDTS:Ui,endDTS:on,type:Gn,hasAudio:!0,hasVideo:!1,nb:Hr};return this.isAudioContiguous=!0,console.assert(Or.length,"MDAT length must not be zero"),an}},R.remuxEmptyAudio=function(_,m,I,B){var P=_.inputTimeScale,M=_.samplerate?_.samplerate:P,U=P/M,K=this.nextAudioPts,W=(K!==null?K:B.startDTS*P)+this._initDTS,X=B.endDTS*P+this._initDTS,ie=U*f,se=Math.ceil((X-W)/ie),le=N.default.getSilentFrame(_.manifestCodec||_.codec,_.channelCount);if(D.logger.warn("[mp4-remuxer]: remux empty Audio"),!le){D.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ve=[],q=0;q<se;q++){var ee=W+q*ie;ve.push({unit:le,pts:ee,dts:ee})}return _.samples=ve,this.remuxAudio(_,m,I,!1)},R.remuxID3=function(_,m){var I=_.samples.length;if(!!I){for(var B=_.inputTimeScale,P=this._initPTS,M=this._initDTS,U=0;U<I;U++){var K=_.samples[U];K.pts=s(K.pts-P,m*B)/B,K.dts=s(K.dts-M,m*B)/B}var W=_.samples;return _.samples=[],{samples:W}}},R.remuxText=function(_,m){var I=_.samples.length;if(!!I){for(var B=_.inputTimeScale,P=this._initPTS,M=0;M<I;M++){var U=_.samples[M];U.pts=s(U.pts-P,m*B)/B}_.samples.sort(function(W,X){return W.pts-X.pts});var K=_.samples;return _.samples=[],{samples:K}}},S}();function s(S,R){var y;if(R===null)return S;for(R<S?y=-8589934592:y=8589934592;Math.abs(S-R)>4294967296;)S+=y;return S}function l(S){for(var R=0;R<S.length;R++)if(S[R].key)return R;return-1}var d=function(R,y,_,m){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=y,this.size=_,this.cts=m,this.flags=new A(R)},A=function(R){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=R?2:1,this.isNonSync=R?0:1}},"./src/remux/passthrough-remuxer.ts":function(de,H,k){"use strict";k.r(H);var j=k("./src/polyfills/number.ts"),N=k("./src/utils/mp4-tools.ts"),v=k("./src/loader/fragment.ts"),L=k("./src/utils/logger.ts"),O=function(){function g(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var b=g.prototype;return b.destroy=function(){},b.resetTimeStamp=function(f){this.initPTS=f,this.lastEndDTS=null},b.resetNextTimestamp=function(){this.lastEndDTS=null},b.resetInitSegment=function(f,p,E){this.audioCodec=p,this.videoCodec=E,this.generateInitSegment(f),this.emitInitSegment=!0},b.generateInitSegment=function(f){var p=this.audioCodec,E=this.videoCodec;if(!f||!f.byteLength){this.initTracks=void 0,this.initData=void 0;return}var u=this.initData=Object(N.parseInitSegment)(f);p||(p=w(u.audio,v.ElementaryStreamTypes.AUDIO)),E||(E=w(u.video,v.ElementaryStreamTypes.VIDEO));var a={};u.audio&&u.video?a.audiovideo={container:"video/mp4",codec:p+","+E,initSegment:f,id:"main"}:u.audio?a.audio={container:"audio/mp4",codec:p,initSegment:f,id:"audio"}:u.video?a.video={container:"video/mp4",codec:E,initSegment:f,id:"main"}:L.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a},b.remux=function(f,p,E,u,a){var n=this.initPTS,s=this.lastEndDTS,l={audio:void 0,video:void 0,text:u,id3:E,initSegment:void 0};Object(j.isFiniteNumber)(s)||(s=this.lastEndDTS=a||0);var d=p.samples;if(!d||!d.length)return l;var A={initPTS:void 0,timescale:1},S=this.initData;if((!S||!S.length)&&(this.generateInitSegment(d),S=this.initData),!S||!S.length)return L.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),l;this.emitInitSegment&&(A.tracks=this.initTracks,this.emitInitSegment=!1),Object(j.isFiniteNumber)(n)||(this.initPTS=A.initPTS=n=D(S,d,s));var R=Object(N.getDuration)(d,S),y=s,_=R+y;Object(N.offsetStartDTS)(S,d,n),R>0?this.lastEndDTS=_:(L.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var m=!!S.audio,I=!!S.video,B="";m&&(B+="audio"),I&&(B+="video");var P={data1:d,startPTS:y,startDTS:y,endPTS:_,endDTS:_,type:B,hasAudio:m,hasVideo:I,nb:1,dropped:0};return l.audio=P.type==="audio"?P:void 0,l.video=P.type!=="audio"?P:void 0,l.text=u,l.id3=E,l.initSegment=A,l},g}(),D=function(b,T,f){return Object(N.getStartDTS)(b,T)-f};function w(g,b){var T=g==null?void 0:g.codec;return T&&T.length>4?T:T==="hvc1"?"hvc1.1.c.L120.90":T==="av01"?"av01.0.04M.08":T==="avc1"||b===v.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}H.default=O},"./src/task-loop.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"default",function(){return j});var j=function(){function N(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var v=N.prototype;return v.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},v.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},v.onHandlerDestroyed=function(){},v.hasInterval=function(){return!!this._tickInterval},v.hasNextTick=function(){return!!this._tickTimer},v.setInterval=function(O){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,O),!0)},v.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},v.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},v.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},v.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},v.doTick=function(){},N}()},"./src/types/cmcd.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"CMCDVersion",function(){return j}),k.d(H,"CMCDObjectType",function(){return N}),k.d(H,"CMCDStreamingFormat",function(){return v}),k.d(H,"CMCDStreamType",function(){return L});var j=1,N;(function(O){O.MANIFEST="m",O.AUDIO="a",O.VIDEO="v",O.MUXED="av",O.INIT="i",O.CAPTION="c",O.TIMED_TEXT="tt",O.KEY="k",O.OTHER="o"})(N||(N={}));var v;(function(O){O.DASH="d",O.HLS="h",O.SMOOTH="s",O.OTHER="o"})(v||(v={}));var L;(function(O){O.VOD="v",O.LIVE="l"})(L||(L={}))},"./src/types/level.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"HlsSkip",function(){return v}),k.d(H,"getSkipValue",function(){return L}),k.d(H,"HlsUrlParameters",function(){return O}),k.d(H,"Level",function(){return D});function j(w,g){for(var b=0;b<g.length;b++){var T=g[b];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(w,T.key,T)}}function N(w,g,b){return g&&j(w.prototype,g),b&&j(w,b),w}var v;(function(w){w.No="",w.Yes="YES",w.v2="v2"})(v||(v={}));function L(w,g){var b=w.canSkipUntil,T=w.canSkipDateRanges,f=w.endSN,p=g!==void 0?g-f:0;return b&&p<b?T?v.v2:v.Yes:v.No}var O=function(){function w(b,T,f){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=b,this.part=T,this.skip=f}var g=w.prototype;return g.addDirectives=function(T){var f=new self.URL(T);return this.msn!==void 0&&f.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&f.searchParams.set("_HLS_part",this.part.toString()),this.skip&&f.searchParams.set("_HLS_skip",this.skip),f.toString()},w}(),D=function(){function w(g){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[g.url],this.attrs=g.attrs,this.bitrate=g.bitrate,g.details&&(this.details=g.details),this.id=g.id||0,this.name=g.name,this.width=g.width||0,this.height=g.height||0,this.audioCodec=g.audioCodec,this.videoCodec=g.videoCodec,this.unknownCodecs=g.unknownCodecs,this.codecSet=[g.videoCodec,g.audioCodec].filter(function(b){return b}).join(",").replace(/\.[^.,]+/g,"")}return N(w,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(b){var T=b%this.url.length;this._urlId!==T&&(this.details=void 0,this._urlId=T)}}]),w}()},"./src/types/loader.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"PlaylistContextType",function(){return j}),k.d(H,"PlaylistLevelType",function(){return N});var j;(function(v){v.MANIFEST="manifest",v.LEVEL="level",v.AUDIO_TRACK="audioTrack",v.SUBTITLE_TRACK="subtitleTrack"})(j||(j={}));var N;(function(v){v.MAIN="main",v.AUDIO="audio",v.SUBTITLE="subtitle"})(N||(N={}))},"./src/types/transmuxer.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"ChunkMetadata",function(){return j});var j=function(L,O,D,w,g,b){w===void 0&&(w=0),g===void 0&&(g=-1),b===void 0&&(b=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=N(),this.buffering={audio:N(),video:N(),audiovideo:N()},this.level=L,this.sn=O,this.id=D,this.size=w,this.part=g,this.partial=b};function N(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"AttrList",function(){return v});var j=/^(\d+)x(\d+)$/,N=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,v=function(){function L(D){typeof D=="string"&&(D=L.parseAttrList(D));for(var w in D)D.hasOwnProperty(w)&&(this[w]=D[w])}var O=L.prototype;return O.decimalInteger=function(w){var g=parseInt(this[w],10);return g>Number.MAX_SAFE_INTEGER?1/0:g},O.hexadecimalInteger=function(w){if(this[w]){var g=(this[w]||"0x").slice(2);g=(g.length&1?"0":"")+g;for(var b=new Uint8Array(g.length/2),T=0;T<g.length/2;T++)b[T]=parseInt(g.slice(T*2,T*2+2),16);return b}else return null},O.hexadecimalIntegerAsNumber=function(w){var g=parseInt(this[w],16);return g>Number.MAX_SAFE_INTEGER?1/0:g},O.decimalFloatingPoint=function(w){return parseFloat(this[w])},O.optionalFloat=function(w,g){var b=this[w];return b?parseFloat(b):g},O.enumeratedString=function(w){return this[w]},O.bool=function(w){return this[w]==="YES"},O.decimalResolution=function(w){var g=j.exec(this[w]);if(g!==null)return{width:parseInt(g[1],10),height:parseInt(g[2],10)}},L.parseAttrList=function(w){var g,b={},T='"';for(N.lastIndex=0;(g=N.exec(w))!==null;){var f=g[2];f.indexOf(T)===0&&f.lastIndexOf(T)===f.length-1&&(f=f.slice(1,-1)),b[g[1]]=f}return b},L}()},"./src/utils/binary-search.ts":function(de,H,k){"use strict";k.r(H);var j={search:function(v,L){for(var O=0,D=v.length-1,w=null,g=null;O<=D;){w=(O+D)/2|0,g=v[w];var b=L(g);if(b>0)O=w+1;else if(b<0)D=w-1;else return g}return null}};H.default=j},"./src/utils/buffer-helper.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"BufferHelper",function(){return v});var j=k("./src/utils/logger.ts"),N={length:0,start:function(){return 0},end:function(){return 0}},v=function(){function L(){}return L.isBuffered=function(D,w){try{if(D){for(var g=L.getBuffered(D),b=0;b<g.length;b++)if(w>=g.start(b)&&w<=g.end(b))return!0}}catch(T){}return!1},L.bufferInfo=function(D,w,g){try{if(D){var b=L.getBuffered(D),T=[],f;for(f=0;f<b.length;f++)T.push({start:b.start(f),end:b.end(f)});return this.bufferedInfo(T,w,g)}}catch(p){}return{len:0,start:w,end:w,nextStart:void 0}},L.bufferedInfo=function(D,w,g){w=Math.max(0,w),D.sort(function(A,S){var R=A.start-S.start;return R||S.end-A.end});var b=[];if(g)for(var T=0;T<D.length;T++){var f=b.length;if(f){var p=b[f-1].end;D[T].start-p<g?D[T].end>p&&(b[f-1].end=D[T].end):b.push(D[T])}else b.push(D[T])}else b=D;for(var E=0,u,a=w,n=w,s=0;s<b.length;s++){var l=b[s].start,d=b[s].end;if(w+g>=l&&w<d)a=l,n=d,E=n-w;else if(w+g<l){u=l;break}}return{len:E,start:a||0,end:n||0,nextStart:u}},L.getBuffered=function(D){try{return D.buffered}catch(w){return j.logger.log("failed to get media.buffered",w),N}},L}()},"./src/utils/cea-608-parser.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"Row",function(){return n}),k.d(H,"CaptionScreen",function(){return s});var j=k("./src/utils/logger.ts"),N={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},v=function(_){var m=_;return N.hasOwnProperty(_)&&(m=N[_]),String.fromCharCode(m)},L=15,O=100,D={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},w={17:2,18:4,21:6,22:8,23:10,19:13,20:15},g={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},b={25:2,26:4,29:6,30:8,31:10,27:13,28:15},T=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],f;(function(y){y[y.ERROR=0]="ERROR",y[y.TEXT=1]="TEXT",y[y.WARNING=2]="WARNING",y[y.INFO=2]="INFO",y[y.DEBUG=3]="DEBUG",y[y.DATA=3]="DATA"})(f||(f={}));var p=function(){function y(){this.time=null,this.verboseLevel=f.ERROR}var _=y.prototype;return _.log=function(I,B){this.verboseLevel>=I&&j.logger.log(this.time+" ["+I+"] "+B)},y}(),E=function(_){for(var m=[],I=0;I<_.length;I++)m.push(_[I].toString(16));return m},u=function(){function y(m,I,B,P,M){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=m||"white",this.underline=I||!1,this.italics=B||!1,this.background=P||"black",this.flash=M||!1}var _=y.prototype;return _.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},_.setStyles=function(I){for(var B=["foreground","underline","italics","background","flash"],P=0;P<B.length;P++){var M=B[P];I.hasOwnProperty(M)&&(this[M]=I[M])}},_.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},_.equals=function(I){return this.foreground===I.foreground&&this.underline===I.underline&&this.italics===I.italics&&this.background===I.background&&this.flash===I.flash},_.copy=function(I){this.foreground=I.foreground,this.underline=I.underline,this.italics=I.italics,this.background=I.background,this.flash=I.flash},_.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},y}(),a=function(){function y(m,I,B,P,M,U){this.uchar=void 0,this.penState=void 0,this.uchar=m||" ",this.penState=new u(I,B,P,M,U)}var _=y.prototype;return _.reset=function(){this.uchar=" ",this.penState.reset()},_.setChar=function(I,B){this.uchar=I,this.penState.copy(B)},_.setPenState=function(I){this.penState.copy(I)},_.equals=function(I){return this.uchar===I.uchar&&this.penState.equals(I.penState)},_.copy=function(I){this.uchar=I.uchar,this.penState.copy(I.penState)},_.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},y}(),n=function(){function y(m){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var I=0;I<O;I++)this.chars.push(new a);this.logger=m,this.pos=0,this.currPenState=new u}var _=y.prototype;return _.equals=function(I){for(var B=!0,P=0;P<O;P++)if(!this.chars[P].equals(I.chars[P])){B=!1;break}return B},_.copy=function(I){for(var B=0;B<O;B++)this.chars[B].copy(I.chars[B])},_.isEmpty=function(){for(var I=!0,B=0;B<O;B++)if(!this.chars[B].isEmpty()){I=!1;break}return I},_.setCursor=function(I){this.pos!==I&&(this.pos=I),this.pos<0?(this.logger.log(f.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>O&&(this.logger.log(f.DEBUG,"Too large cursor position "+this.pos),this.pos=O)},_.moveCursor=function(I){var B=this.pos+I;if(I>1)for(var P=this.pos+1;P<B+1;P++)this.chars[P].setPenState(this.currPenState);this.setCursor(B)},_.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},_.insertChar=function(I){I>=144&&this.backSpace();var B=v(I);if(this.pos>=O){this.logger.log(f.ERROR,"Cannot insert "+I.toString(16)+" ("+B+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(B,this.currPenState),this.moveCursor(1)},_.clearFromPos=function(I){var B;for(B=I;B<O;B++)this.chars[B].reset()},_.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},_.clearToEndOfRow=function(){this.clearFromPos(this.pos)},_.getTextString=function(){for(var I=[],B=!0,P=0;P<O;P++){var M=this.chars[P].uchar;M!==" "&&(B=!1),I.push(M)}return B?"":I.join("")},_.setPenStyles=function(I){this.currPenState.setStyles(I);var B=this.chars[this.pos];B.setPenState(this.currPenState)},y}(),s=function(){function y(m){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var I=0;I<L;I++)this.rows.push(new n(m));this.logger=m,this.currRow=L-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var _=y.prototype;return _.reset=function(){for(var I=0;I<L;I++)this.rows[I].clear();this.currRow=L-1},_.equals=function(I){for(var B=!0,P=0;P<L;P++)if(!this.rows[P].equals(I.rows[P])){B=!1;break}return B},_.copy=function(I){for(var B=0;B<L;B++)this.rows[B].copy(I.rows[B])},_.isEmpty=function(){for(var I=!0,B=0;B<L;B++)if(!this.rows[B].isEmpty()){I=!1;break}return I},_.backSpace=function(){var I=this.rows[this.currRow];I.backSpace()},_.clearToEndOfRow=function(){var I=this.rows[this.currRow];I.clearToEndOfRow()},_.insertChar=function(I){var B=this.rows[this.currRow];B.insertChar(I)},_.setPen=function(I){var B=this.rows[this.currRow];B.setPenStyles(I)},_.moveCursor=function(I){var B=this.rows[this.currRow];B.moveCursor(I)},_.setCursor=function(I){this.logger.log(f.INFO,"setCursor: "+I);var B=this.rows[this.currRow];B.setCursor(I)},_.setPAC=function(I){this.logger.log(f.INFO,"pacData = "+JSON.stringify(I));var B=I.row-1;if(this.nrRollUpRows&&B<this.nrRollUpRows-1&&(B=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==B){for(var P=0;P<L;P++)this.rows[P].clear();var M=this.currRow+1-this.nrRollUpRows,U=this.lastOutputScreen;if(U){var K=U.rows[M].cueStartTime,W=this.logger.time;if(K&&W!==null&&K<W)for(var X=0;X<this.nrRollUpRows;X++)this.rows[B-this.nrRollUpRows+X+1].copy(U.rows[M+X])}}this.currRow=B;var ie=this.rows[this.currRow];if(I.indent!==null){var se=I.indent,le=Math.max(se-1,0);ie.setCursor(I.indent),I.color=ie.chars[le].penState.foreground}var ve={foreground:I.color,underline:I.underline,italics:I.italics,background:"black",flash:!1};this.setPen(ve)},_.setBkgData=function(I){this.logger.log(f.INFO,"bkgData = "+JSON.stringify(I)),this.backSpace(),this.setPen(I),this.insertChar(32)},_.setRollUpRows=function(I){this.nrRollUpRows=I},_.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(f.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(f.TEXT,this.getDisplayText());var I=this.currRow+1-this.nrRollUpRows,B=this.rows.splice(I,1)[0];B.clear(),this.rows.splice(this.currRow,0,B),this.logger.log(f.INFO,"Rolling up")},_.getDisplayText=function(I){I=I||!1;for(var B=[],P="",M=-1,U=0;U<L;U++){var K=this.rows[U].getTextString();K&&(M=U+1,I?B.push("Row "+M+": '"+K+"'"):B.push(K.trim()))}return B.length>0&&(I?P="["+B.join(" | ")+"]":P=B.join(`
|
|
154
|
+
`)),P},_.getTextAndFormat=function(){return this.rows},y}(),l=function(){function y(m,I,B){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=m,this.outputFilter=I,this.mode=null,this.verbose=0,this.displayedMemory=new s(B),this.nonDisplayedMemory=new s(B),this.lastOutputScreen=new s(B),this.currRollUpRow=this.displayedMemory.rows[L-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=B}var _=y.prototype;return _.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[L-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},_.getHandler=function(){return this.outputFilter},_.setHandler=function(I){this.outputFilter=I},_.setPAC=function(I){this.writeScreen.setPAC(I)},_.setBkgData=function(I){this.writeScreen.setBkgData(I)},_.setMode=function(I){I!==this.mode&&(this.mode=I,this.logger.log(f.INFO,"MODE="+I),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=I)},_.insertChars=function(I){for(var B=0;B<I.length;B++)this.writeScreen.insertChar(I[B]);var P=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(f.INFO,P+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(f.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},_.ccRCL=function(){this.logger.log(f.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},_.ccBS=function(){this.logger.log(f.INFO,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},_.ccAOF=function(){},_.ccAON=function(){},_.ccDER=function(){this.logger.log(f.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},_.ccRU=function(I){this.logger.log(f.INFO,"RU("+I+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(I)},_.ccFON=function(){this.logger.log(f.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},_.ccRDC=function(){this.logger.log(f.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},_.ccTR=function(){this.logger.log(f.INFO,"TR"),this.setMode("MODE_TEXT")},_.ccRTD=function(){this.logger.log(f.INFO,"RTD"),this.setMode("MODE_TEXT")},_.ccEDM=function(){this.logger.log(f.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},_.ccCR=function(){this.logger.log(f.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},_.ccENM=function(){this.logger.log(f.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},_.ccEOC=function(){if(this.logger.log(f.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var I=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=I,this.writeScreen=this.nonDisplayedMemory,this.logger.log(f.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},_.ccTO=function(I){this.logger.log(f.INFO,"TO("+I+") - Tab Offset"),this.writeScreen.moveCursor(I)},_.ccMIDROW=function(I){var B={flash:!1};if(B.underline=I%2===1,B.italics=I>=46,B.italics)B.foreground="white";else{var P=Math.floor(I/2)-16,M=["white","green","blue","cyan","red","yellow","magenta"];B.foreground=M[P]}this.logger.log(f.INFO,"MIDROW: "+JSON.stringify(B)),this.writeScreen.setPen(B)},_.outputDataUpdate=function(I){I===void 0&&(I=!1);var B=this.logger.time;B!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=B:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,B,this.lastOutputScreen),I&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:B),this.lastOutputScreen.copy(this.displayedMemory))},_.cueSplitAtTime=function(I){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,I,this.displayedMemory),this.cueStartTime=I))},y}(),d=function(){function y(m,I,B){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var P=new p;this.channels=[null,new l(m,I,P),new l(m+1,B,P)],this.cmdHistory=R(),this.logger=P}var _=y.prototype;return _.getHandler=function(I){return this.channels[I].getHandler()},_.setHandler=function(I,B){this.channels[I].setHandler(B)},_.addData=function(I,B){var P,M,U,K=!1;this.logger.time=I;for(var W=0;W<B.length;W+=2)if(M=B[W]&127,U=B[W+1]&127,!(M===0&&U===0)){if(this.logger.log(f.DATA,"["+E([B[W],B[W+1]])+"] -> ("+E([M,U])+")"),P=this.parseCmd(M,U),P||(P=this.parseMidrow(M,U)),P||(P=this.parsePAC(M,U)),P||(P=this.parseBackgroundAttributes(M,U)),!P&&(K=this.parseChars(M,U),K)){var X=this.currentChannel;if(X&&X>0){var ie=this.channels[X];ie.insertChars(K)}else this.logger.log(f.WARNING,"No channel found yet. TEXT-MODE?")}!P&&!K&&this.logger.log(f.WARNING,"Couldn't parse cleaned data "+E([M,U])+" orig: "+E([B[W],B[W+1]]))}},_.parseCmd=function(I,B){var P=this.cmdHistory,M=(I===20||I===28||I===21||I===29)&&B>=32&&B<=47,U=(I===23||I===31)&&B>=33&&B<=35;if(!(M||U))return!1;if(S(I,B,P))return A(null,null,P),this.logger.log(f.DEBUG,"Repeated command ("+E([I,B])+") is dropped"),!0;var K=I===20||I===21||I===23?1:2,W=this.channels[K];return I===20||I===21||I===28||I===29?B===32?W.ccRCL():B===33?W.ccBS():B===34?W.ccAOF():B===35?W.ccAON():B===36?W.ccDER():B===37?W.ccRU(2):B===38?W.ccRU(3):B===39?W.ccRU(4):B===40?W.ccFON():B===41?W.ccRDC():B===42?W.ccTR():B===43?W.ccRTD():B===44?W.ccEDM():B===45?W.ccCR():B===46?W.ccENM():B===47&&W.ccEOC():W.ccTO(B-32),A(I,B,P),this.currentChannel=K,!0},_.parseMidrow=function(I,B){var P=0;if((I===17||I===25)&&B>=32&&B<=47){if(I===17?P=1:P=2,P!==this.currentChannel)return this.logger.log(f.ERROR,"Mismatch channel in midrow parsing"),!1;var M=this.channels[P];return M?(M.ccMIDROW(B),this.logger.log(f.DEBUG,"MIDROW ("+E([I,B])+")"),!0):!1}return!1},_.parsePAC=function(I,B){var P,M=this.cmdHistory,U=(I>=17&&I<=23||I>=25&&I<=31)&&B>=64&&B<=127,K=(I===16||I===24)&&B>=64&&B<=95;if(!(U||K))return!1;if(S(I,B,M))return A(null,null,M),!0;var W=I<=23?1:2;B>=64&&B<=95?P=W===1?D[I]:g[I]:P=W===1?w[I]:b[I];var X=this.channels[W];return X?(X.setPAC(this.interpretPAC(P,B)),A(I,B,M),this.currentChannel=W,!0):!1},_.interpretPAC=function(I,B){var P,M={color:null,italics:!1,indent:null,underline:!1,row:I};return B>95?P=B-96:P=B-64,M.underline=(P&1)===1,P<=13?M.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(P/2)]:P<=15?(M.italics=!0,M.color="white"):M.indent=Math.floor((P-16)/2)*4,M},_.parseChars=function(I,B){var P,M=null,U=null;if(I>=25?(P=2,U=I-8):(P=1,U=I),U>=17&&U<=19){var K;U===17?K=B+80:U===18?K=B+112:K=B+144,this.logger.log(f.INFO,"Special char '"+v(K)+"' in channel "+P),M=[K]}else I>=32&&I<=127&&(M=B===0?[I]:[I,B]);if(M){var W=E(M);this.logger.log(f.DEBUG,"Char codes = "+W.join(",")),A(I,B,this.cmdHistory)}return M},_.parseBackgroundAttributes=function(I,B){var P=(I===16||I===24)&&B>=32&&B<=47,M=(I===23||I===31)&&B>=45&&B<=47;if(!(P||M))return!1;var U,K={};I===16||I===24?(U=Math.floor((B-32)/2),K.background=T[U],B%2===1&&(K.background=K.background+"_semi")):B===45?K.background="transparent":(K.foreground="black",B===47&&(K.underline=!0));var W=I<=23?1:2,X=this.channels[W];return X.setBkgData(K),A(I,B,this.cmdHistory),!0},_.reset=function(){for(var I=0;I<Object.keys(this.channels).length;I++){var B=this.channels[I];B&&B.reset()}this.cmdHistory=R()},_.cueSplitAtTime=function(I){for(var B=0;B<this.channels.length;B++){var P=this.channels[B];P&&P.cueSplitAtTime(I)}},y}();function A(y,_,m){m.a=y,m.b=_}function S(y,_,m){return m.a===y&&m.b===_}function R(){return{a:null,b:null}}H.default=d},"./src/utils/codecs.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"isCodecType",function(){return N}),k.d(H,"isCodecSupportedInMp4",function(){return v});var j={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function N(L,O){var D=j[O];return!!D&&D[L.slice(0,4)]===!0}function v(L,O){return MediaSource.isTypeSupported((O||"video")+'/mp4;codecs="'+L+'"')}},"./src/utils/cues.ts":function(de,H,k){"use strict";k.r(H);var j=k("./src/utils/vttparser.ts"),N=k("./src/utils/webvtt-parser.ts"),v=k("./src/utils/texttrack-utils.ts"),L=/\s/,O={newCue:function(w,g,b,T){for(var f=[],p,E,u,a,n,s=self.VTTCue||self.TextTrackCue,l=0;l<T.rows.length;l++)if(p=T.rows[l],u=!0,a=0,n="",!p.isEmpty()){for(var d=0;d<p.chars.length;d++)L.test(p.chars[d].uchar)&&u?a++:(n+=p.chars[d].uchar,u=!1);p.cueStartTime=g,g===b&&(b+=1e-4),a>=16?a--:a++;var A=Object(j.fixLineBreaks)(n.trim()),S=Object(N.generateCueId)(g,b,A);(!w||!w.cues||!w.cues.getCueById(S))&&(E=new s(g,b,A),E.id=S,E.line=l+1,E.align="left",E.position=10+Math.min(80,Math.floor(a*8/32)*10),f.push(E))}return w&&f.length&&(f.sort(function(R,y){return R.line==="auto"||y.line==="auto"?0:R.line>8&&y.line>8?y.line-R.line:R.line-y.line}),f.forEach(function(R){return Object(v.addCueToTrack)(w,R)})),f}};H.default=O},"./src/utils/discontinuities.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"findFirstFragWithCC",function(){return L}),k.d(H,"shouldAlignOnDiscontinuities",function(){return O}),k.d(H,"findDiscontinuousReferenceFrag",function(){return D}),k.d(H,"adjustSlidingStart",function(){return g}),k.d(H,"alignStream",function(){return b}),k.d(H,"alignPDT",function(){return f}),k.d(H,"alignFragmentByPDTDelta",function(){return p}),k.d(H,"alignMediaPlaylistByPDT",function(){return E});var j=k("./src/polyfills/number.ts"),N=k("./src/utils/logger.ts"),v=k("./src/controller/level-helper.ts");function L(u,a){for(var n=null,s=0,l=u.length;s<l;s++){var d=u[s];if(d&&d.cc===a){n=d;break}}return n}function O(u,a,n){return!!(a.details&&(n.endCC>n.startCC||u&&u.cc<n.startCC))}function D(u,a){var n=u.fragments,s=a.fragments;if(!s.length||!n.length){N.logger.log("No fragments to align");return}var l=L(n,s[0].cc);if(!l||l&&!l.startPTS){N.logger.log("No frag in previous level to align on");return}return l}function w(u,a){if(u){var n=u.start+a;u.start=u.startPTS=n,u.endPTS=n+u.duration}}function g(u,a){for(var n=a.fragments,s=0,l=n.length;s<l;s++)w(n[s],u);a.fragmentHint&&w(a.fragmentHint,u),a.alignedSliding=!0}function b(u,a,n){!a||(T(u,n,a),!n.alignedSliding&&a.details&&f(n,a.details),!n.alignedSliding&&a.details&&!n.skippedSegments&&Object(v.adjustSliding)(a.details,n))}function T(u,a,n){if(O(u,n,a)){var s=D(n.details,a);s&&Object(j.isFiniteNumber)(s.start)&&(N.logger.log("Adjusting PTS using last level due to CC increase within current level "+a.url),g(s.start,a))}}function f(u,a){if(!(!a.fragments.length||!u.hasProgramDateTime||!a.hasProgramDateTime)){var n=a.fragments[0].programDateTime,s=u.fragments[0].programDateTime,l=(s-n)/1e3+a.fragments[0].start;l&&Object(j.isFiniteNumber)(l)&&(N.logger.log("Adjusting PTS using programDateTime delta "+(s-n)+"ms, sliding:"+l.toFixed(3)+" "+u.url+" "),g(l,u))}}function p(u,a){var n=u.programDateTime;if(!!n){var s=(n-a)/1e3;u.start=u.startPTS=s,u.endPTS=s+u.duration}}function E(u,a){if(!(!a.fragments.length||!u.hasProgramDateTime||!a.hasProgramDateTime)){var n=a.fragments[0].programDateTime,s=a.fragments[0].start,l=n-s*1e3;u.fragments.forEach(function(d){p(d,l)}),u.fragmentHint&&p(u.fragmentHint,l),u.alignedSliding=!0}}},"./src/utils/ewma-bandwidth-estimator.ts":function(de,H,k){"use strict";k.r(H);var j=k("./src/utils/ewma.ts"),N=function(){function v(O,D,w){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=w,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new j.default(O),this.fast_=new j.default(D)}var L=v.prototype;return L.update=function(D,w){var g=this.slow_,b=this.fast_;this.slow_.halfLife!==D&&(this.slow_=new j.default(D,g.getEstimate(),g.getTotalWeight())),this.fast_.halfLife!==w&&(this.fast_=new j.default(w,b.getEstimate(),b.getTotalWeight()))},L.sample=function(D,w){D=Math.max(D,this.minDelayMs_);var g=8*w,b=D/1e3,T=g/b;this.fast_.sample(b,T),this.slow_.sample(b,T)},L.canEstimate=function(){var D=this.fast_;return D&&D.getTotalWeight()>=this.minWeight_},L.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},L.destroy=function(){},v}();H.default=N},"./src/utils/ewma.ts":function(de,H,k){"use strict";k.r(H);var j=function(){function N(L,O,D){O===void 0&&(O=0),D===void 0&&(D=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=L,this.alpha_=L?Math.exp(Math.log(.5)/L):0,this.estimate_=O,this.totalWeight_=D}var v=N.prototype;return v.sample=function(O,D){var w=Math.pow(this.alpha_,O);this.estimate_=D*(1-w)+w*this.estimate_,this.totalWeight_+=O},v.getTotalWeight=function(){return this.totalWeight_},v.getEstimate=function(){if(this.alpha_){var O=1-Math.pow(this.alpha_,this.totalWeight_);if(O)return this.estimate_/O}return this.estimate_},N}();H.default=j},"./src/utils/fetch-loader.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"fetchSupported",function(){return p});var j=k("./src/polyfills/number.ts"),N=k("./src/loader/load-stats.ts"),v=k("./src/demux/chunk-cache.ts");function L(s,l){s.prototype=Object.create(l.prototype),s.prototype.constructor=s,b(s,l)}function O(s){var l=typeof Map=="function"?new Map:void 0;return O=function(A){if(A===null||!g(A))return A;if(typeof A!="function")throw new TypeError("Super expression must either be null or a function");if(typeof l!="undefined"){if(l.has(A))return l.get(A);l.set(A,S)}function S(){return D(A,arguments,T(this).constructor)}return S.prototype=Object.create(A.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),b(S,A)},O(s)}function D(s,l,d){return w()?D=Reflect.construct:D=function(S,R,y){var _=[null];_.push.apply(_,R);var m=Function.bind.apply(S,_),I=new m;return y&&b(I,y.prototype),I},D.apply(null,arguments)}function w(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(s){return!1}}function g(s){return Function.toString.call(s).indexOf("[native code]")!==-1}function b(s,l){return b=Object.setPrototypeOf||function(A,S){return A.__proto__=S,A},b(s,l)}function T(s){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(d){return d.__proto__||Object.getPrototypeOf(d)},T(s)}function f(){return f=Object.assign||function(s){for(var l=1;l<arguments.length;l++){var d=arguments[l];for(var A in d)Object.prototype.hasOwnProperty.call(d,A)&&(s[A]=d[A])}return s},f.apply(this,arguments)}function p(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(s){}return!1}var E=function(){function s(d){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=d.fetchSetup||a,this.controller=new self.AbortController,this.stats=new N.LoadStats}var l=s.prototype;return l.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},l.abortInternal=function(){var A=this.response;(!A||!A.ok)&&(this.stats.aborted=!0,this.controller.abort())},l.abort=function(){var A;this.abortInternal(),(A=this.callbacks)!==null&&A!==void 0&&A.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},l.load=function(A,S,R){var y=this,_=this.stats;if(_.loading.start)throw new Error("Loader can only be used once.");_.loading.start=self.performance.now();var m=u(A,this.controller.signal),I=R.onProgress,B=A.responseType==="arraybuffer",P=B?"byteLength":"length";this.context=A,this.config=S,this.callbacks=R,this.request=this.fetchSetup(A,m),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){y.abortInternal(),R.onTimeout(_,A,y.response)},S.timeout),self.fetch(this.request).then(function(M){if(y.response=y.loader=M,!M.ok){var U=M.status,K=M.statusText;throw new n(K||"fetch, bad network response",U,M)}return _.loading.first=Math.max(self.performance.now(),_.loading.start),_.total=parseInt(M.headers.get("Content-Length")||"0"),I&&Object(j.isFiniteNumber)(S.highWaterMark)?y.loadProgressively(M,_,A,S.highWaterMark,I):B?M.arrayBuffer():M.text()}).then(function(M){var U=y.response;self.clearTimeout(y.requestTimeout),_.loading.end=Math.max(self.performance.now(),_.loading.first),_.loaded=_.total=M[P];var K={url:U.url,data:M};I&&!Object(j.isFiniteNumber)(S.highWaterMark)&&I(_,A,M,U),R.onSuccess(K,_,A,U)}).catch(function(M){if(self.clearTimeout(y.requestTimeout),!_.aborted){var U=M.code||0;R.onError({code:U,text:M.message},A,M.details)}})},l.getCacheAge=function(){var A=null;if(this.response){var S=this.response.headers.get("age");A=S?parseFloat(S):null}return A},l.loadProgressively=function(A,S,R,y,_){y===void 0&&(y=0);var m=new v.default,I=A.body.getReader(),B=function P(){return I.read().then(function(M){if(M.done)return m.dataLength&&_(S,R,m.flush(),A),Promise.resolve(new ArrayBuffer(0));var U=M.value,K=U.length;return S.loaded+=K,K<y||m.dataLength?(m.push(U),m.dataLength>=y&&_(S,R,m.flush(),A)):_(S,R,U,A),P()}).catch(function(){return Promise.reject()})};return B()},s}();function u(s,l){var d={method:"GET",mode:"cors",credentials:"same-origin",signal:l,headers:new self.Headers(f({},s.headers))};return s.rangeEnd&&d.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),d}function a(s,l){return new self.Request(s.url,l)}var n=function(s){L(l,s);function l(d,A,S){var R;return R=s.call(this,d)||this,R.code=void 0,R.details=void 0,R.code=A,R.details=S,R}return l}(O(Error));H.default=E},"./src/utils/imsc1-ttml-parser.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"IMSC1_CODEC",function(){return g}),k.d(H,"parseIMSC1",function(){return p});var j=k("./src/utils/mp4-tools.ts"),N=k("./src/utils/vttparser.ts"),v=k("./src/utils/vttcue.ts"),L=k("./src/demux/id3.ts"),O=k("./src/utils/timescale-conversion.ts"),D=k("./src/utils/webvtt-parser.ts");function w(){return w=Object.assign||function(y){for(var _=1;_<arguments.length;_++){var m=arguments[_];for(var I in m)Object.prototype.hasOwnProperty.call(m,I)&&(y[I]=m[I])}return y},w.apply(this,arguments)}var g="stpp.ttml.im1t",b=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,T=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,f={left:"start",center:"center",right:"end",start:"start",end:"end"};function p(y,_,m,I,B){var P=Object(j.findBox)(new Uint8Array(y),["mdat"]);if(P.length===0){B(new Error("Could not parse IMSC1 mdat"));return}var M=P[0],U=Object(L.utf8ArrayToStr)(new Uint8Array(y,M.start,M.end-M.start)),K=Object(O.toTimescaleFromScale)(_,1,m);try{I(E(U,K))}catch(W){B(W)}}function E(y,_){var m=new DOMParser,I=m.parseFromString(y,"text/xml"),B=I.getElementsByTagName("tt")[0];if(!B)throw new Error("Invalid ttml");var P={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},M=Object.keys(P).reduce(function(ie,se){return ie[se]=B.getAttribute("ttp:"+se)||P[se],ie},{}),U=B.getAttribute("xml:space")!=="preserve",K=a(u(B,"styling","style")),W=a(u(B,"layout","region")),X=u(B,"body","[begin]");return[].map.call(X,function(ie){var se=n(ie,U);if(!se||!ie.hasAttribute("begin"))return null;var le=A(ie.getAttribute("begin"),M),ve=A(ie.getAttribute("dur"),M),q=A(ie.getAttribute("end"),M);if(le===null)throw d(ie);if(q===null){if(ve===null)throw d(ie);q=le+ve}var ee=new v.default(le-_,q-_,se);ee.id=Object(D.generateCueId)(ee.startTime,ee.endTime,ee.text);var ae=W[ie.getAttribute("region")],_e=K[ie.getAttribute("style")];ee.position=10,ee.size=80;var fe=s(ae,_e),Ue=fe.textAlign;if(Ue){var Te=f[Ue];Te&&(ee.lineAlign=Te),ee.align=Ue}return w(ee,fe),ee}).filter(function(ie){return ie!==null})}function u(y,_,m){var I=y.getElementsByTagName(_)[0];return I?[].slice.call(I.querySelectorAll(m)):[]}function a(y){return y.reduce(function(_,m){var I=m.getAttribute("xml:id");return I&&(_[I]=m),_},{})}function n(y,_){return[].slice.call(y.childNodes).reduce(function(m,I,B){var P;return I.nodeName==="br"&&B?m+`
|
|
155
|
+
`:(P=I.childNodes)!==null&&P!==void 0&&P.length?n(I,_):_?m+I.textContent.trim().replace(/\s+/g," "):m+I.textContent},"")}function s(y,_){var m="http://www.w3.org/ns/ttml#styling",I=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return I.reduce(function(B,P){var M=l(_,m,P)||l(y,m,P);return M&&(B[P]=M),B},{})}function l(y,_,m){return y.hasAttributeNS(_,m)?y.getAttributeNS(_,m):null}function d(y){return new Error("Could not parse ttml timestamp "+y)}function A(y,_){if(!y)return null;var m=Object(N.parseTimeStamp)(y);return m===null&&(b.test(y)?m=S(y,_):T.test(y)&&(m=R(y,_))),m}function S(y,_){var m=b.exec(y),I=(m[4]|0)+(m[5]|0)/_.subFrameRate;return(m[1]|0)*3600+(m[2]|0)*60+(m[3]|0)+I/_.frameRate}function R(y,_){var m=T.exec(y),I=Number(m[1]),B=m[2];switch(B){case"h":return I*3600;case"m":return I*60;case"ms":return I*1e3;case"f":return I/_.frameRate;case"t":return I/_.tickRate}return I}},"./src/utils/logger.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"enableLogs",function(){return D}),k.d(H,"logger",function(){return w});var j=function(){},N={trace:j,debug:j,log:j,warn:j,info:j,error:j},v=N;function L(g){var b=self.console[g];return b?b.bind(self.console,"["+g+"] >"):j}function O(g){for(var b=arguments.length,T=new Array(b>1?b-1:0),f=1;f<b;f++)T[f-1]=arguments[f];T.forEach(function(p){v[p]=g[p]?g[p].bind(g):L(p)})}function D(g){if(self.console&&g===!0||typeof g=="object"){O(g,"debug","log","info","warn","error");try{v.log()}catch(b){v=N}}else v=N}var w=v},"./src/utils/mediakeys-helper.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"KeySystems",function(){return j}),k.d(H,"requestMediaKeySystemAccess",function(){return N});var j;(function(v){v.WIDEVINE="com.widevine.alpha",v.PLAYREADY="com.microsoft.playready"})(j||(j={}));var N=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"getMediaSource",function(){return j});function j(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"bin2str",function(){return O}),k.d(H,"readUint16",function(){return D}),k.d(H,"readUint32",function(){return w}),k.d(H,"writeUint32",function(){return g}),k.d(H,"findBox",function(){return b}),k.d(H,"parseSegmentIndex",function(){return T}),k.d(H,"parseInitSegment",function(){return f}),k.d(H,"getStartDTS",function(){return p}),k.d(H,"getDuration",function(){return E}),k.d(H,"computeRawDurationFromSamples",function(){return u}),k.d(H,"offsetStartDTS",function(){return a}),k.d(H,"segmentValidRange",function(){return n}),k.d(H,"appendUint8Array",function(){return s});var j=k("./src/utils/typed-array.ts"),N=k("./src/loader/fragment.ts"),v=Math.pow(2,32)-1,L=[].push;function O(l){return String.fromCharCode.apply(null,l)}function D(l,d){"data"in l&&(d+=l.start,l=l.data);var A=l[d]<<8|l[d+1];return A<0?65536+A:A}function w(l,d){"data"in l&&(d+=l.start,l=l.data);var A=l[d]<<24|l[d+1]<<16|l[d+2]<<8|l[d+3];return A<0?4294967296+A:A}function g(l,d,A){"data"in l&&(d+=l.start,l=l.data),l[d]=A>>24,l[d+1]=A>>16&255,l[d+2]=A>>8&255,l[d+3]=A&255}function b(l,d){var A=[];if(!d.length)return A;var S,R,y;"data"in l?(S=l.data,R=l.start,y=l.end):(S=l,R=0,y=S.byteLength);for(var _=R;_<y;){var m=w(S,_),I=O(S.subarray(_+4,_+8)),B=m>1?_+m:y;if(I===d[0])if(d.length===1)A.push({data:S,start:_+8,end:B});else{var P=b({data:S,start:_+8,end:B},d.slice(1));P.length&&L.apply(A,P)}_=B}return A}function T(l){var d=b(l,["moov"]),A=d[0],S=A?A.end:null,R=b(l,["sidx"]);if(!R||!R[0])return null;var y=[],_=R[0],m=_.data[0],I=m===0?8:16,B=w(_,I);I+=4;var P=0,M=0;m===0?I+=8:I+=16,I+=2;var U=_.end+M,K=D(_,I);I+=2;for(var W=0;W<K;W++){var X=I,ie=w(_,X);X+=4;var se=ie&2147483647,le=(ie&2147483648)>>>31;if(le===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ve=w(_,X);X+=4,y.push({referenceSize:se,subsegmentDuration:ve,info:{duration:ve/B,start:U,end:U+se-1}}),U+=se,X+=4,I=X}return{earliestPresentationTime:P,timescale:B,version:m,referencesCount:K,references:y,moovEndOffset:S}}function f(l){for(var d=[],A=b(l,["moov","trak"]),S=0;S<A.length;S++){var R=A[S],y=b(R,["tkhd"])[0];if(y){var _=y.data[y.start],m=_===0?12:20,I=w(y,m),B=b(R,["mdia","mdhd"])[0];if(B){_=B.data[B.start],m=_===0?12:20;var P=w(B,m),M=b(R,["mdia","hdlr"])[0];if(M){var U=O(M.data.subarray(M.start+8,M.start+12)),K={soun:N.ElementaryStreamTypes.AUDIO,vide:N.ElementaryStreamTypes.VIDEO}[U];if(K){var W=b(R,["mdia","minf","stbl","stsd"])[0],X=void 0;W&&(X=O(W.data.subarray(W.start+12,W.start+16))),d[I]={timescale:P,type:K},d[K]={timescale:P,id:I,codec:X}}}}}}var ie=b(l,["moov","mvex","trex"]);return ie.forEach(function(se){var le=w(se,4),ve=d[le];ve&&(ve.default={duration:w(se,12),flags:w(se,20)})}),d}function p(l,d){return b(d,["moof","traf"]).reduce(function(A,S){var R=b(S,["tfdt"])[0],y=R.data[R.start],_=b(S,["tfhd"]).reduce(function(m,I){var B=w(I,4),P=l[B];if(P){var M=w(R,4);y===1&&(M*=Math.pow(2,32),M+=w(R,8));var U=P.timescale||9e4,K=M/U;if(isFinite(K)&&(m===null||K<m))return K}return m},null);return _!==null&&isFinite(_)&&(A===null||_<A)?_:A},null)||0}function E(l,d){for(var A=0,S=0,R=0,y=b(l,["moof","traf"]),_=0;_<y.length;_++){var m=y[_],I=b(m,["tfhd"])[0],B=w(I,4),P=d[B];if(!!P){var M=P.default,U=w(I,0)|(M==null?void 0:M.flags),K=M==null?void 0:M.duration;U&8&&(U&2?K=w(I,12):K=w(I,8));for(var W=P.timescale||9e4,X=b(m,["trun"]),ie=0;ie<X.length;ie++){if(K){var se=w(X[ie],4);A=K*se}else A=u(X[ie]);P.type===N.ElementaryStreamTypes.VIDEO?S+=A/W:P.type===N.ElementaryStreamTypes.AUDIO&&(R+=A/W)}}}if(S===0&&R===0){var le=T(l);if(le!=null&&le.references)return le.references.reduce(function(ve,q){return ve+q.info.duration||0},0)}return S||R}function u(l){var d=w(l,0),A=8;d&1&&(A+=4),d&4&&(A+=4);for(var S=0,R=w(l,4),y=0;y<R;y++){if(d&256){var _=w(l,A);S+=_,A+=4}d&512&&(A+=4),d&1024&&(A+=4),d&2048&&(A+=4)}return S}function a(l,d,A){b(d,["moof","traf"]).forEach(function(S){b(S,["tfhd"]).forEach(function(R){var y=w(R,4),_=l[y];if(!!_){var m=_.timescale||9e4;b(S,["tfdt"]).forEach(function(I){var B=I.data[I.start],P=w(I,4);if(B===0)g(I,4,P-A*m);else{P*=Math.pow(2,32),P+=w(I,8),P-=A*m,P=Math.max(P,0);var M=Math.floor(P/(v+1)),U=Math.floor(P%(v+1));g(I,4,M),g(I,8,U)}})}})})}function n(l){var d={valid:null,remainder:null},A=b(l,["moof"]);if(A){if(A.length<2)return d.remainder=l,d}else return d;var S=A[A.length-1];return d.valid=Object(j.sliceUint8)(l,0,S.start-8),d.remainder=Object(j.sliceUint8)(l,S.start-8),d}function s(l,d){var A=new Uint8Array(l.length+d.length);return A.set(l),A.set(d,l.length),A}},"./src/utils/output-filter.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"default",function(){return j});var j=function(){function N(L,O){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=L,this.trackName=O}var v=N.prototype;return v.dispatchCue=function(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)},v.newCue=function(O,D,w){(this.startTime===null||this.startTime>O)&&(this.startTime=O),this.endTime=D,this.screen=w,this.timelineController.createCaptionsTrack(this.trackName)},v.reset=function(){this.cueRanges=[]},N}()},"./src/utils/texttrack-utils.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"sendAddTrackEvent",function(){return N}),k.d(H,"addCueToTrack",function(){return v}),k.d(H,"clearCurrentCues",function(){return L}),k.d(H,"removeCuesInRange",function(){return O}),k.d(H,"getCuesInRange",function(){return w});var j=k("./src/utils/logger.ts");function N(g,b){var T;try{T=new Event("addtrack")}catch(f){T=document.createEvent("Event"),T.initEvent("addtrack",!1,!1)}T.track=g,b.dispatchEvent(T)}function v(g,b){var T=g.mode;if(T==="disabled"&&(g.mode="hidden"),g.cues&&!g.cues.getCueById(b.id))try{if(g.addCue(b),!g.cues.getCueById(b.id))throw new Error("addCue is failed for: "+b)}catch(p){j.logger.debug("[texttrack-utils]: "+p);var f=new self.TextTrackCue(b.startTime,b.endTime,b.text);f.id=b.id,g.addCue(f)}T==="disabled"&&(g.mode=T)}function L(g){var b=g.mode;if(b==="disabled"&&(g.mode="hidden"),g.cues)for(var T=g.cues.length;T--;)g.removeCue(g.cues[T]);b==="disabled"&&(g.mode=b)}function O(g,b,T){var f=g.mode;if(f==="disabled"&&(g.mode="hidden"),g.cues&&g.cues.length>0)for(var p=w(g.cues,b,T),E=0;E<p.length;E++)g.removeCue(p[E]);f==="disabled"&&(g.mode=f)}function D(g,b){if(b<g[0].startTime)return 0;var T=g.length-1;if(b>g[T].endTime)return-1;for(var f=0,p=T;f<=p;){var E=Math.floor((p+f)/2);if(b<g[E].startTime)p=E-1;else if(b>g[E].startTime&&f<T)f=E+1;else return E}return g[f].startTime-b<b-g[p].startTime?f:p}function w(g,b,T){var f=[],p=D(g,b);if(p>-1)for(var E=p,u=g.length;E<u;E++){var a=g[E];if(a.startTime>=b&&a.endTime<=T)f.push(a);else if(a.startTime>T)return f}return f}},"./src/utils/time-ranges.ts":function(de,H,k){"use strict";k.r(H);var j={toString:function(v){for(var L="",O=v.length,D=0;D<O;D++)L+="["+v.start(D).toFixed(3)+","+v.end(D).toFixed(3)+"]";return L}};H.default=j},"./src/utils/timescale-conversion.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"toTimescaleFromBase",function(){return N}),k.d(H,"toTimescaleFromScale",function(){return v}),k.d(H,"toMsFromMpegTsClock",function(){return L}),k.d(H,"toMpegTsClockFromTimescale",function(){return O});var j=9e4;function N(D,w,g,b){g===void 0&&(g=1),b===void 0&&(b=!1);var T=D*w*g;return b?Math.round(T):T}function v(D,w,g,b){return g===void 0&&(g=1),b===void 0&&(b=!1),N(D,w,1/g,b)}function L(D,w){return w===void 0&&(w=!1),N(D,1e3,1/j,w)}function O(D,w){return w===void 0&&(w=1),N(D,j,1/w)}},"./src/utils/typed-array.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"sliceUint8",function(){return j});function j(N,v,L){return Uint8Array.prototype.slice?N.slice(v,L):new Uint8Array(Array.prototype.slice.call(N,v,L))}},"./src/utils/vttcue.ts":function(de,H,k){"use strict";k.r(H),H.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var j=["","lr","rl"],N=["start","middle","end","left","right"];function v(g,b){if(typeof b!="string"||!Array.isArray(g))return!1;var T=b.toLowerCase();return~g.indexOf(T)?T:!1}function L(g){return v(j,g)}function O(g){return v(N,g)}function D(g){for(var b=arguments.length,T=new Array(b>1?b-1:0),f=1;f<b;f++)T[f-1]=arguments[f];for(var p=1;p<arguments.length;p++){var E=arguments[p];for(var u in E)g[u]=E[u]}return g}function w(g,b,T){var f=this,p={enumerable:!0};f.hasBeenReset=!1;var E="",u=!1,a=g,n=b,s=T,l=null,d="",A=!0,S="auto",R="start",y=50,_="middle",m=50,I="middle";Object.defineProperty(f,"id",D({},p,{get:function(){return E},set:function(P){E=""+P}})),Object.defineProperty(f,"pauseOnExit",D({},p,{get:function(){return u},set:function(P){u=!!P}})),Object.defineProperty(f,"startTime",D({},p,{get:function(){return a},set:function(P){if(typeof P!="number")throw new TypeError("Start time must be set to a number.");a=P,this.hasBeenReset=!0}})),Object.defineProperty(f,"endTime",D({},p,{get:function(){return n},set:function(P){if(typeof P!="number")throw new TypeError("End time must be set to a number.");n=P,this.hasBeenReset=!0}})),Object.defineProperty(f,"text",D({},p,{get:function(){return s},set:function(P){s=""+P,this.hasBeenReset=!0}})),Object.defineProperty(f,"region",D({},p,{get:function(){return l},set:function(P){l=P,this.hasBeenReset=!0}})),Object.defineProperty(f,"vertical",D({},p,{get:function(){return d},set:function(P){var M=L(P);if(M===!1)throw new SyntaxError("An invalid or illegal string was specified.");d=M,this.hasBeenReset=!0}})),Object.defineProperty(f,"snapToLines",D({},p,{get:function(){return A},set:function(P){A=!!P,this.hasBeenReset=!0}})),Object.defineProperty(f,"line",D({},p,{get:function(){return S},set:function(P){if(typeof P!="number"&&P!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");S=P,this.hasBeenReset=!0}})),Object.defineProperty(f,"lineAlign",D({},p,{get:function(){return R},set:function(P){var M=O(P);if(!M)throw new SyntaxError("An invalid or illegal string was specified.");R=M,this.hasBeenReset=!0}})),Object.defineProperty(f,"position",D({},p,{get:function(){return y},set:function(P){if(P<0||P>100)throw new Error("Position must be between 0 and 100.");y=P,this.hasBeenReset=!0}})),Object.defineProperty(f,"positionAlign",D({},p,{get:function(){return _},set:function(P){var M=O(P);if(!M)throw new SyntaxError("An invalid or illegal string was specified.");_=M,this.hasBeenReset=!0}})),Object.defineProperty(f,"size",D({},p,{get:function(){return m},set:function(P){if(P<0||P>100)throw new Error("Size must be between 0 and 100.");m=P,this.hasBeenReset=!0}})),Object.defineProperty(f,"align",D({},p,{get:function(){return I},set:function(P){var M=O(P);if(!M)throw new SyntaxError("An invalid or illegal string was specified.");I=M,this.hasBeenReset=!0}})),f.displayState=void 0}return w.prototype.getCueAsHTML=function(){var g=self.WebVTT;return g.convertCueToDOMTree(self,this.text)},w}()},"./src/utils/vttparser.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"parseTimeStamp",function(){return v}),k.d(H,"fixLineBreaks",function(){return b}),k.d(H,"VTTParser",function(){return T});var j=k("./src/utils/vttcue.ts"),N=function(){function f(){}var p=f.prototype;return p.decode=function(u,a){if(!u)return"";if(typeof u!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(u))},f}();function v(f){function p(u,a,n,s){return(u|0)*3600+(a|0)*60+(n|0)+parseFloat(s||0)}var E=f.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return E?parseFloat(E[2])>59?p(E[2],E[3],0,E[4]):p(E[1],E[2],E[3],E[4]):null}var L=function(){function f(){this.values=Object.create(null)}var p=f.prototype;return p.set=function(u,a){!this.get(u)&&a!==""&&(this.values[u]=a)},p.get=function(u,a,n){return n?this.has(u)?this.values[u]:a[n]:this.has(u)?this.values[u]:a},p.has=function(u){return u in this.values},p.alt=function(u,a,n){for(var s=0;s<n.length;++s)if(a===n[s]){this.set(u,a);break}},p.integer=function(u,a){/^-?\d+$/.test(a)&&this.set(u,parseInt(a,10))},p.percent=function(u,a){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(a)){var n=parseFloat(a);if(n>=0&&n<=100)return this.set(u,n),!0}return!1},f}();function O(f,p,E,u){var a=u?f.split(u):[f];for(var n in a)if(typeof a[n]=="string"){var s=a[n].split(E);if(s.length===2){var l=s[0],d=s[1];p(l,d)}}}var D=new j.default(0,0,""),w=D.align==="middle"?"middle":"center";function g(f,p,E){var u=f;function a(){var l=v(f);if(l===null)throw new Error("Malformed timestamp: "+u);return f=f.replace(/^[^\sa-zA-Z-]+/,""),l}function n(l,d){var A=new L;O(l,function(y,_){var m;switch(y){case"region":for(var I=E.length-1;I>=0;I--)if(E[I].id===_){A.set(y,E[I].region);break}break;case"vertical":A.alt(y,_,["rl","lr"]);break;case"line":m=_.split(","),A.integer(y,m[0]),A.percent(y,m[0])&&A.set("snapToLines",!1),A.alt(y,m[0],["auto"]),m.length===2&&A.alt("lineAlign",m[1],["start",w,"end"]);break;case"position":m=_.split(","),A.percent(y,m[0]),m.length===2&&A.alt("positionAlign",m[1],["start",w,"end","line-left","line-right","auto"]);break;case"size":A.percent(y,_);break;case"align":A.alt(y,_,["start",w,"end","left","right"]);break}},/:/,/\s/),d.region=A.get("region",null),d.vertical=A.get("vertical","");var S=A.get("line","auto");S==="auto"&&D.line===-1&&(S=-1),d.line=S,d.lineAlign=A.get("lineAlign","start"),d.snapToLines=A.get("snapToLines",!0),d.size=A.get("size",100),d.align=A.get("align",w);var R=A.get("position","auto");R==="auto"&&D.position===50&&(R=d.align==="start"||d.align==="left"?0:d.align==="end"||d.align==="right"?100:50),d.position=R}function s(){f=f.replace(/^\s+/,"")}if(s(),p.startTime=a(),s(),f.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+u);f=f.substr(3),s(),p.endTime=a(),s(),n(f,p)}function b(f){return f.replace(/<br(?: \/)?>/gi,`
|
|
156
|
+
`)}var T=function(){function f(){this.state="INITIAL",this.buffer="",this.decoder=new N,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var p=f.prototype;return p.parse=function(u){var a=this;u&&(a.buffer+=a.decoder.decode(u,{stream:!0}));function n(){var R=a.buffer,y=0;for(R=b(R);y<R.length&&R[y]!=="\r"&&R[y]!==`
|
|
157
|
+
`;)++y;var _=R.substr(0,y);return R[y]==="\r"&&++y,R[y]===`
|
|
158
|
+
`&&++y,a.buffer=R.substr(y),_}function s(R){O(R,function(y,_){},/:/)}try{var l="";if(a.state==="INITIAL"){if(!/\r\n|\n/.test(a.buffer))return this;l=n();var d=l.match(/^()?WEBVTT([ \t].*)?$/);if(!d||!d[0])throw new Error("Malformed WebVTT signature.");a.state="HEADER"}for(var A=!1;a.buffer;){if(!/\r\n|\n/.test(a.buffer))return this;switch(A?A=!1:l=n(),a.state){case"HEADER":/:/.test(l)?s(l):l||(a.state="ID");continue;case"NOTE":l||(a.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(l)){a.state="NOTE";break}if(!l)continue;if(a.cue=new j.default(0,0,""),a.state="CUE",l.indexOf("-->")===-1){a.cue.id=l;continue}case"CUE":if(!a.cue){a.state="BADCUE";continue}try{g(l,a.cue,a.regionList)}catch(R){a.cue=null,a.state="BADCUE";continue}a.state="CUETEXT";continue;case"CUETEXT":{var S=l.indexOf("-->")!==-1;if(!l||S&&(A=!0)){a.oncue&&a.cue&&a.oncue(a.cue),a.cue=null,a.state="ID";continue}if(a.cue===null)continue;a.cue.text&&(a.cue.text+=`
|
|
159
|
+
`),a.cue.text+=l}continue;case"BADCUE":l||(a.state="ID")}}}catch(R){a.state==="CUETEXT"&&a.cue&&a.oncue&&a.oncue(a.cue),a.cue=null,a.state=a.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},p.flush=function(){var u=this;try{if((u.cue||u.state==="HEADER")&&(u.buffer+=`
|
|
160
|
+
|
|
161
|
+
`,u.parse()),u.state==="INITIAL"||u.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(a){u.onparsingerror&&u.onparsingerror(a)}return u.onflush&&u.onflush(),this},f}()},"./src/utils/webvtt-parser.ts":function(de,H,k){"use strict";k.r(H),k.d(H,"generateCueId",function(){return T}),k.d(H,"parseWebVTT",function(){return p});var j=k("./src/polyfills/number.ts"),N=k("./src/utils/vttparser.ts"),v=k("./src/demux/id3.ts"),L=k("./src/utils/timescale-conversion.ts"),O=k("./src/remux/mp4-remuxer.ts"),D=/\r\n|\n\r|\n|\r/g,w=function(u,a,n){return n===void 0&&(n=0),u.substr(n,a.length)===a},g=function(u){var a=parseInt(u.substr(-3)),n=parseInt(u.substr(-6,2)),s=parseInt(u.substr(-9,2)),l=u.length>9?parseInt(u.substr(0,u.indexOf(":"))):0;if(!Object(j.isFiniteNumber)(a)||!Object(j.isFiniteNumber)(n)||!Object(j.isFiniteNumber)(s)||!Object(j.isFiniteNumber)(l))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+u);return a+=1e3*n,a+=60*1e3*s,a+=60*60*1e3*l,a},b=function(u){for(var a=5381,n=u.length;n;)a=a*33^u.charCodeAt(--n);return(a>>>0).toString()};function T(E,u,a){return b(E.toString())+b(u.toString())+b(a)}var f=function(u,a,n){var s=u[a],l=u[s.prevCC];if(!l||!l.new&&s.new){u.ccOffset=u.presentationOffset=s.start,s.new=!1;return}for(;(d=l)!==null&&d!==void 0&&d.new;){var d;u.ccOffset+=s.start-l.start,s.new=!1,s=l,l=u[s.prevCC]}u.presentationOffset=n};function p(E,u,a,n,s,l,d,A){var S=new N.VTTParser,R=Object(v.utf8ArrayToStr)(new Uint8Array(E)).trim().replace(D,`
|
|
162
|
+
`).split(`
|
|
163
|
+
`),y=[],_=Object(L.toMpegTsClockFromTimescale)(u,a),m="00:00.000",I=0,B=0,P,M=!0,U=!1;S.oncue=function(K){var W=n[s],X=n.ccOffset,ie=(I-_)/9e4;if(W!=null&&W.new&&(B!==void 0?X=n.ccOffset=W.start:f(n,s,ie)),ie&&(X=ie-n.presentationOffset),U){var se=K.endTime-K.startTime,le=Object(O.normalizePts)((K.startTime+X-B)*9e4,l*9e4)/9e4;K.startTime=le,K.endTime=le+se}var ve=K.text.trim();K.text=decodeURIComponent(encodeURIComponent(ve)),K.id||(K.id=T(K.startTime,K.endTime,ve)),K.endTime>0&&y.push(K)},S.onparsingerror=function(K){P=K},S.onflush=function(){if(P){A(P);return}d(y)},R.forEach(function(K){if(M)if(w(K,"X-TIMESTAMP-MAP=")){M=!1,U=!0,K.substr(16).split(",").forEach(function(W){w(W,"LOCAL:")?m=W.substr(6):w(W,"MPEGTS:")&&(I=parseInt(W.substr(7)))});try{B=g(m)/1e3}catch(W){U=!1,P=W}return}else K===""&&(M=!1);S.parse(K+`
|
|
164
|
+
`)}),S.flush()}},"./src/utils/xhr-loader.ts":function(de,H,k){"use strict";k.r(H);var j=k("./src/utils/logger.ts"),N=k("./src/loader/load-stats.ts"),v=/^age:\s*[\d.]+\s*$/m,L=function(){function O(w){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=w?w.xhrSetup:null,this.stats=new N.LoadStats,this.retryDelay=0}var D=O.prototype;return D.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},D.abortInternal=function(){var g=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),g&&(g.onreadystatechange=null,g.onprogress=null,g.readyState!==4&&(this.stats.aborted=!0,g.abort()))},D.abort=function(){var g;this.abortInternal(),(g=this.callbacks)!==null&&g!==void 0&&g.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},D.load=function(g,b,T){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=g,this.config=b,this.callbacks=T,this.retryDelay=b.retryDelay,this.loadInternal()},D.loadInternal=function(){var g=this.config,b=this.context;if(!!g){var T=this.loader=new self.XMLHttpRequest,f=this.stats;f.loading.first=0,f.loaded=0;var p=this.xhrSetup;try{if(p)try{p(T,b.url)}catch(a){T.open("GET",b.url,!0),p(T,b.url)}T.readyState||T.open("GET",b.url,!0);var E=this.context.headers;if(E)for(var u in E)T.setRequestHeader(u,E[u])}catch(a){this.callbacks.onError({code:T.status,text:a.message},b,T);return}b.rangeEnd&&T.setRequestHeader("Range","bytes="+b.rangeStart+"-"+(b.rangeEnd-1)),T.onreadystatechange=this.readystatechange.bind(this),T.onprogress=this.loadprogress.bind(this),T.responseType=b.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),g.timeout),T.send()}},D.readystatechange=function(){var g=this.context,b=this.loader,T=this.stats;if(!(!g||!b)){var f=b.readyState,p=this.config;if(!T.aborted&&f>=2)if(self.clearTimeout(this.requestTimeout),T.loading.first===0&&(T.loading.first=Math.max(self.performance.now(),T.loading.start)),f===4){b.onreadystatechange=null,b.onprogress=null;var E=b.status;if(E>=200&&E<300){T.loading.end=Math.max(self.performance.now(),T.loading.first);var u,a;if(g.responseType==="arraybuffer"?(u=b.response,a=u.byteLength):(u=b.responseText,a=u.length),T.loaded=T.total=a,!this.callbacks)return;var n=this.callbacks.onProgress;if(n&&n(T,g,u,b),!this.callbacks)return;var s={url:b.responseURL,data:u};this.callbacks.onSuccess(s,T,g,b)}else T.retry>=p.maxRetry||E>=400&&E<499?(j.logger.error(E+" while loading "+g.url),this.callbacks.onError({code:E,text:b.statusText},g,b)):(j.logger.warn(E+" while loading "+g.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,p.maxRetryDelay),T.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),p.timeout)}},D.loadtimeout=function(){j.logger.warn("timeout while loading "+this.context.url);var g=this.callbacks;g&&(this.abortInternal(),g.onTimeout(this.stats,this.context,this.loader))},D.loadprogress=function(g){var b=this.stats;b.loaded=g.loaded,g.lengthComputable&&(b.total=g.total)},D.getCacheAge=function(){var g=null;if(this.loader&&v.test(this.loader.getAllResponseHeaders())){var b=this.loader.getResponseHeader("age");g=b?parseFloat(b):null}return g},O}();H.default=L}}).default})},45386:(Ne,de,H)=>{var k=H(96738),j=H(52842),N=H(52482);function v(L){var O=-1,D=L==null?0:L.length;for(this.__data__=new k;++O<D;)this.add(L[O])}v.prototype.add=v.prototype.push=j,v.prototype.has=N,Ne.exports=v},87064:Ne=>{function de(H,k){for(var j=-1,N=H==null?0:H.length;++j<N;)if(k(H[j],j,H))return!0;return!1}Ne.exports=de},50217:Ne=>{function de(H){return H.split("")}Ne.exports=de},2229:(Ne,de,H)=>{var k=H(4795);function j(N,v,L){for(var O=-1,D=N.length;++O<D;){var w=N[O],g=v(w);if(g!=null&&(b===void 0?g===g&&!k(g):L(g,b)))var b=g,T=w}return T}Ne.exports=j},84134:Ne=>{function de(H,k){return H>k}Ne.exports=de},20187:Ne=>{function de(H,k){return H!=null&&k in Object(H)}Ne.exports=de},88746:(Ne,de,H)=>{var k=H(51952),j=H(15125);function N(v,L,O,D,w){return v===L?!0:v==null||L==null||!j(v)&&!j(L)?v!==v&&L!==L:k(v,L,O,D,N,w)}Ne.exports=N},51952:(Ne,de,H)=>{var k=H(86571),j=H(74871),N=H(11491),v=H(5184),L=H(70940),O=H(86152),D=H(73226),w=H(77598),g=1,b="[object Arguments]",T="[object Array]",f="[object Object]",p=Object.prototype,E=p.hasOwnProperty;function u(a,n,s,l,d,A){var S=O(a),R=O(n),y=S?T:L(a),_=R?T:L(n);y=y==b?f:y,_=_==b?f:_;var m=y==f,I=_==f,B=y==_;if(B&&D(a)){if(!D(n))return!1;S=!0,m=!1}if(B&&!m)return A||(A=new k),S||w(a)?j(a,n,s,l,d,A):N(a,n,y,s,l,d,A);if(!(s&g)){var P=m&&E.call(a,"__wrapped__"),M=I&&E.call(n,"__wrapped__");if(P||M){var U=P?a.value():a,K=M?n.value():n;return A||(A=new k),d(U,K,s,l,A)}}return B?(A||(A=new k),v(a,n,s,l,d,A)):!1}Ne.exports=u},37036:(Ne,de,H)=>{var k=H(86571),j=H(88746),N=1,v=2;function L(O,D,w,g){var b=w.length,T=b,f=!g;if(O==null)return!T;for(O=Object(O);b--;){var p=w[b];if(f&&p[2]?p[1]!==O[p[0]]:!(p[0]in O))return!1}for(;++b<T;){p=w[b];var E=p[0],u=O[E],a=p[1];if(f&&p[2]){if(u===void 0&&!(E in O))return!1}else{var n=new k;if(g)var s=g(u,a,E,O,D,n);if(!(s===void 0?j(a,u,N|v,g,n):s))return!1}}return!0}Ne.exports=L},68286:(Ne,de,H)=>{var k=H(26423),j=H(74716),N=H(23059),v=H(86152),L=H(65798);function O(D){return typeof D=="function"?D:D==null?N:typeof D=="object"?v(D)?j(D[0],D[1]):k(D):L(D)}Ne.exports=O},59355:Ne=>{function de(H,k){return H<k}Ne.exports=de},26423:(Ne,de,H)=>{var k=H(37036),j=H(49882),N=H(73477);function v(L){var O=j(L);return O.length==1&&O[0][2]?N(O[0][0],O[0][1]):function(D){return D===L||k(D,L,O)}}Ne.exports=v},74716:(Ne,de,H)=>{var k=H(88746),j=H(72579),N=H(95041),v=H(21401),L=H(28792),O=H(73477),D=H(33812),w=1,g=2;function b(T,f){return v(T)&&L(f)?O(D(T),f):function(p){var E=j(p,T);return E===void 0&&E===f?N(p,T):k(f,E,w|g)}}Ne.exports=b},92602:(Ne,de,H)=>{var k=H(93759),j=H(95041);function N(v,L){return k(v,L,function(O,D){return j(v,D)})}Ne.exports=N},93759:(Ne,de,H)=>{var k=H(13324),j=H(82857),N=H(17297);function v(L,O,D){for(var w=-1,g=O.length,b={};++w<g;){var T=O[w],f=k(L,T);D(f,T)&&j(b,N(T,L),f)}return b}Ne.exports=v},20256:Ne=>{function de(H){return function(k){return k==null?void 0:k[H]}}Ne.exports=de},82952:(Ne,de,H)=>{var k=H(13324);function j(N){return function(v){return k(v,N)}}Ne.exports=j},62676:(Ne,de,H)=>{var k=H(29078),j=H(39045),N=Array.prototype,v=N.splice;function L(O,D){for(var w=O?D.length:0,g=w-1;w--;){var b=D[w];if(w==g||b!==T){var T=b;j(b)?v.call(O,b,1):k(O,b)}}return O}Ne.exports=L},82857:(Ne,de,H)=>{var k=H(60091),j=H(17297),N=H(39045),v=H(29259),L=H(33812);function O(D,w,g,b){if(!v(D))return D;w=j(w,D);for(var T=-1,f=w.length,p=f-1,E=D;E!=null&&++T<f;){var u=L(w[T]),a=g;if(u==="__proto__"||u==="constructor"||u==="prototype")return D;if(T!=p){var n=E[u];a=b?b(n,u,E):void 0,a===void 0&&(a=v(n)?n:N(w[T+1])?[]:{})}k(E,u,a),E=E[u]}return D}Ne.exports=O},59950:Ne=>{function de(H,k){return H.has(k)}Ne.exports=de},23895:(Ne,de,H)=>{var k=H(39872);function j(N,v,L){var O=N.length;return L=L===void 0?O:L,!v&&L>=O?N:k(N,v,L)}Ne.exports=j},83126:(Ne,de,H)=>{var k=H(23895),j=H(33880),N=H(8435),v=H(66188);function L(O){return function(D){D=v(D);var w=j(D)?N(D):void 0,g=w?w[0]:D.charAt(0),b=w?k(w,1).join(""):D.slice(1);return g[O]()+b}}Ne.exports=L},74871:(Ne,de,H)=>{var k=H(45386),j=H(87064),N=H(59950),v=1,L=2;function O(D,w,g,b,T,f){var p=g&v,E=D.length,u=w.length;if(E!=u&&!(p&&u>E))return!1;var a=f.get(D),n=f.get(w);if(a&&n)return a==w&&n==D;var s=-1,l=!0,d=g&L?new k:void 0;for(f.set(D,w),f.set(w,D);++s<E;){var A=D[s],S=w[s];if(b)var R=p?b(S,A,s,w,D,f):b(A,S,s,D,w,f);if(R!==void 0){if(R)continue;l=!1;break}if(d){if(!j(w,function(y,_){if(!N(d,_)&&(A===y||T(A,y,g,b,f)))return d.push(_)})){l=!1;break}}else if(!(A===S||T(A,S,g,b,f))){l=!1;break}}return f.delete(D),f.delete(w),l}Ne.exports=O},11491:(Ne,de,H)=>{var k=H(50857),j=H(79162),N=H(41225),v=H(74871),L=H(75179),O=H(16909),D=1,w=2,g="[object Boolean]",b="[object Date]",T="[object Error]",f="[object Map]",p="[object Number]",E="[object RegExp]",u="[object Set]",a="[object String]",n="[object Symbol]",s="[object ArrayBuffer]",l="[object DataView]",d=k?k.prototype:void 0,A=d?d.valueOf:void 0;function S(R,y,_,m,I,B,P){switch(_){case l:if(R.byteLength!=y.byteLength||R.byteOffset!=y.byteOffset)return!1;R=R.buffer,y=y.buffer;case s:return!(R.byteLength!=y.byteLength||!B(new j(R),new j(y)));case g:case b:case p:return N(+R,+y);case T:return R.name==y.name&&R.message==y.message;case E:case a:return R==y+"";case f:var M=L;case u:var U=m&D;if(M||(M=O),R.size!=y.size&&!U)return!1;var K=P.get(R);if(K)return K==y;m|=w,P.set(R,y);var W=v(M(R),M(y),m,I,B,P);return P.delete(R),W;case n:if(A)return A.call(R)==A.call(y)}return!1}Ne.exports=S},5184:(Ne,de,H)=>{var k=H(13483),j=1,N=Object.prototype,v=N.hasOwnProperty;function L(O,D,w,g,b,T){var f=w&j,p=k(O),E=p.length,u=k(D),a=u.length;if(E!=a&&!f)return!1;for(var n=E;n--;){var s=p[n];if(!(f?s in D:v.call(D,s)))return!1}var l=T.get(O),d=T.get(D);if(l&&d)return l==D&&d==O;var A=!0;T.set(O,D),T.set(D,O);for(var S=f;++n<E;){s=p[n];var R=O[s],y=D[s];if(g)var _=f?g(y,R,s,D,O,T):g(R,y,s,O,D,T);if(!(_===void 0?R===y||b(R,y,w,g,T):_)){A=!1;break}S||(S=s=="constructor")}if(A&&!S){var m=O.constructor,I=D.constructor;m!=I&&"constructor"in O&&"constructor"in D&&!(typeof m=="function"&&m instanceof m&&typeof I=="function"&&I instanceof I)&&(A=!1)}return T.delete(O),T.delete(D),A}Ne.exports=L},49882:(Ne,de,H)=>{var k=H(28792),j=H(90249);function N(v){for(var L=j(v),O=L.length;O--;){var D=L[O],w=v[D];L[O]=[D,w,k(w)]}return L}Ne.exports=N},1369:(Ne,de,H)=>{var k=H(17297),j=H(79631),N=H(86152),v=H(39045),L=H(61158),O=H(33812);function D(w,g,b){g=k(g,w);for(var T=-1,f=g.length,p=!1;++T<f;){var E=O(g[T]);if(!(p=w!=null&&b(w,E)))break;w=w[E]}return p||++T!=f?p:(f=w==null?0:w.length,!!f&&L(f)&&v(E,f)&&(N(w)||j(w)))}Ne.exports=D},33880:Ne=>{var de="\\ud800-\\udfff",H="\\u0300-\\u036f",k="\\ufe20-\\ufe2f",j="\\u20d0-\\u20ff",N=H+k+j,v="\\ufe0e\\ufe0f",L="\\u200d",O=RegExp("["+L+de+N+v+"]");function D(w){return O.test(w)}Ne.exports=D},28792:(Ne,de,H)=>{var k=H(29259);function j(N){return N===N&&!k(N)}Ne.exports=j},75179:Ne=>{function de(H){var k=-1,j=Array(H.size);return H.forEach(function(N,v){j[++k]=[v,N]}),j}Ne.exports=de},73477:Ne=>{function de(H,k){return function(j){return j==null?!1:j[H]===k&&(k!==void 0||H in Object(j))}}Ne.exports=de},52842:Ne=>{var de="__lodash_hash_undefined__";function H(k){return this.__data__.set(k,de),this}Ne.exports=H},52482:Ne=>{function de(H){return this.__data__.has(H)}Ne.exports=de},16909:Ne=>{function de(H){var k=-1,j=Array(H.size);return H.forEach(function(N){j[++k]=N}),j}Ne.exports=de},8435:(Ne,de,H)=>{var k=H(50217),j=H(33880),N=H(63344);function v(L){return j(L)?N(L):k(L)}Ne.exports=v},63344:Ne=>{var de="\\ud800-\\udfff",H="\\u0300-\\u036f",k="\\ufe20-\\ufe2f",j="\\u20d0-\\u20ff",N=H+k+j,v="\\ufe0e\\ufe0f",L="["+de+"]",O="["+N+"]",D="\\ud83c[\\udffb-\\udfff]",w="(?:"+O+"|"+D+")",g="[^"+de+"]",b="(?:\\ud83c[\\udde6-\\uddff]){2}",T="[\\ud800-\\udbff][\\udc00-\\udfff]",f="\\u200d",p=w+"?",E="["+v+"]?",u="(?:"+f+"(?:"+[g,b,T].join("|")+")"+E+p+")*",a=E+p+u,n="(?:"+[g+O+"?",O,b,T,L].join("|")+")",s=RegExp(D+"(?="+D+")|"+n+a,"g");function l(d){return d.match(s)||[]}Ne.exports=l},82108:(Ne,de,H)=>{var k=H(66188),j=H(23779);function N(v){return j(k(v).toLowerCase())}Ne.exports=N},72579:(Ne,de,H)=>{var k=H(13324);function j(N,v,L){var O=N==null?void 0:k(N,v);return O===void 0?L:O}Ne.exports=j},95041:(Ne,de,H)=>{var k=H(20187),j=H(1369);function N(v,L){return v!=null&&j(v,L,k)}Ne.exports=N},1842:Ne=>{function de(H){return H==null}Ne.exports=de},84336:Ne=>{function de(H){return H===void 0}Ne.exports=de},55324:(Ne,de,H)=>{var k=H(2229),j=H(84134),N=H(68286);function v(L,O){return L&&L.length?k(L,N(O,2),j):void 0}Ne.exports=v},10937:(Ne,de,H)=>{var k=H(2229),j=H(68286),N=H(59355);function v(L,O){return L&&L.length?k(L,j(O,2),N):void 0}Ne.exports=v},13888:(Ne,de,H)=>{var k=H(92602),j=H(29097),N=j(function(v,L){return v==null?{}:k(v,L)});Ne.exports=N},65798:(Ne,de,H)=>{var k=H(20256),j=H(82952),N=H(21401),v=H(33812);function L(O){return N(O)?k(v(O)):j(O)}Ne.exports=L},64116:(Ne,de,H)=>{var k=H(68286),j=H(62676);function N(v,L){var O=[];if(!(v&&v.length))return O;var D=-1,w=[],g=v.length;for(L=k(L,3);++D<g;){var b=v[D];L(b,D,v)&&(O.push(b),w.push(D))}return j(v,w),O}Ne.exports=N},74930:(Ne,de,H)=>{var k=H(66188),j=0;function N(v){var L=++j;return k(v)+L}Ne.exports=N},23779:(Ne,de,H)=>{var k=H(83126),j=k("toUpperCase");Ne.exports=j},79640:function(Ne,de,H){var k,j;(function(N,v){"use strict";k=v,j=typeof k=="function"?k.call(de,H,de,Ne):k,j!==void 0&&(Ne.exports=j)})(this,function(){"use strict";var N=function(){},v="undefined",L=typeof window!==v&&typeof window.navigator!==v&&/Trident\/|MSIE /.test(window.navigator.userAgent),O=["trace","debug","info","warn","error"];function D(n,s){var l=n[s];if(typeof l.bind=="function")return l.bind(n);try{return Function.prototype.bind.call(l,n)}catch(d){return function(){return Function.prototype.apply.apply(l,[n,arguments])}}}function w(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function g(n){return n==="debug"&&(n="log"),typeof console===v?!1:n==="trace"&&L?w:console[n]!==void 0?D(console,n):console.log!==void 0?D(console,"log"):N}function b(n,s){for(var l=0;l<O.length;l++){var d=O[l];this[d]=l<n?N:this.methodFactory(d,n,s)}this.log=this.debug}function T(n,s,l){return function(){typeof console!==v&&(b.call(this,s,l),this[n].apply(this,arguments))}}function f(n,s,l){return g(n)||T.apply(this,arguments)}function p(n,s,l){var d=this,A;s=s==null?"WARN":s;var S="loglevel";typeof n=="string"?S+=":"+n:typeof n=="symbol"&&(S=void 0);function R(I){var B=(O[I]||"silent").toUpperCase();if(!(typeof window===v||!S)){try{window.localStorage[S]=B;return}catch(P){}try{window.document.cookie=encodeURIComponent(S)+"="+B+";"}catch(P){}}}function y(){var I;if(!(typeof window===v||!S)){try{I=window.localStorage[S]}catch(M){}if(typeof I===v)try{var B=window.document.cookie,P=B.indexOf(encodeURIComponent(S)+"=");P!==-1&&(I=/^([^;]+)/.exec(B.slice(P))[1])}catch(M){}return d.levels[I]===void 0&&(I=void 0),I}}function _(){if(!(typeof window===v||!S)){try{window.localStorage.removeItem(S);return}catch(I){}try{window.document.cookie=encodeURIComponent(S)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(I){}}}d.name=n,d.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},d.methodFactory=l||f,d.getLevel=function(){return A},d.setLevel=function(I,B){if(typeof I=="string"&&d.levels[I.toUpperCase()]!==void 0&&(I=d.levels[I.toUpperCase()]),typeof I=="number"&&I>=0&&I<=d.levels.SILENT){if(A=I,B!==!1&&R(I),b.call(d,I,n),typeof console===v&&I<d.levels.SILENT)return"No console available for logging"}else throw"log.setLevel() called with invalid level: "+I},d.setDefaultLevel=function(I){s=I,y()||d.setLevel(I,!1)},d.resetLevel=function(){d.setLevel(s,!1),_()},d.enableAll=function(I){d.setLevel(d.levels.TRACE,I)},d.disableAll=function(I){d.setLevel(d.levels.SILENT,I)};var m=y();m==null&&(m=s),d.setLevel(m,!1)}var E=new p,u={};E.getLogger=function(s){if(typeof s!="symbol"&&typeof s!="string"||s==="")throw new TypeError("You must supply a name when creating a logger.");var l=u[s];return l||(l=u[s]=new p(s,E.getLevel(),E.methodFactory)),l};var a=typeof window!==v?window.log:void 0;return E.noConflict=function(){return typeof window!==v&&window.log===E&&(window.log=a),E},E.getLoggers=function(){return u},E.default=E,E})},1442:(Ne,de,H)=>{"use strict";H.d(de,{Z:()=>Pc});var k=H(7896),j=H(31461),N=H(2784),v=H(13980),L=H.n(v),O=H(1842),D=H.n(O);const w=function(G){return G&&G.ownerDocument||document},g=function(G){return G===(G==null?void 0:G.window)?G:(G==null?void 0:G.nodeType)===9?(G==null?void 0:G.defaultView)||(G==null?void 0:G.parentWindow):null};var b=H(33014),T=function(Z,re){if(re)do if(re===Z)return!0;while(re=re.parentNode);return!1},f=function(Z,re){return Z.contains?Z.contains(re):Z.compareDocumentPosition?Z===re||!!(Z.compareDocumentPosition(re)&16):T(Z,re)};const p=function(){return b.Z?f:T}(),E=function(G){var Z=w(G),re=g(Z),ge=Z&&Z.documentElement,he={top:0,left:0,height:0,width:0};return Z?(p(ge,G)&&(G.getBoundingClientRect!==void 0&&(he=G.getBoundingClientRect()),(he.width||he.height)&&ge&&re&&(he={top:he.top+(re.pageYOffset||ge.scrollTop)-(ge.clientTop||0),left:he.left+(re.pageXOffset||ge.scrollLeft)-(ge.clientLeft||0),width:(he.width===null?G.offsetWidth:he.width)||0,height:(he.height===null?G.offsetHeight:he.height)||0})),he):null};var u=H(85043),a=H(80383),n=H(53359),s=function(Z){return!Z||typeof Z=="function"?Z:function(re){Z.current=re}};function l(G,Z){var re=s(G),ge=s(Z);return function(he){typeof re=="function"&&re(he),typeof ge=="function"&&ge(he)}}var d=function(Z,re){var ge=E(Z),he=(re.pageX||0)-ge.left,Ie=(re.pageY||0)-ge.top,Se=Math.max(ge.width-he,he),De=Math.max(ge.height-Ie,Ie),Qe=Math.sqrt(Math.pow(Se,2)+Math.pow(De,2));return{width:Qe*2,height:Qe*2,left:he-Qe,top:Ie-Qe}},A=N.forwardRef(function(G,Z){var re=G.as,ge=re===void 0?"span":re,he=G.className,Ie=G.classPrefix,Se=Ie===void 0?"ripple":Ie,De=G.onMouseDown,Qe=(0,j.Z)(G,["as","className","classPrefix","onMouseDown"]),Le=(0,n.Z)(Se),we=Le.merge,Be=Le.prefix,He=Le.withClassPrefix,We=we(he,Be("pond")),ze=(0,N.useRef)(null),qe=(0,N.useState)(!1),ot=qe[0],je=qe[1],Ke=(0,N.useState)(),rt=Ke[0],At=Ke[1],yt=function(){je(!1)},Ze=(0,N.useCallback)(function(lt){var vt=d(ze.current,lt);je(!0),At(vt),De==null||De(vt,lt)},[De]);return(0,N.useEffect)(function(){var lt=ze.current.parentNode,vt=(0,u.Z)(lt,"mousedown",Ze);return function(){vt==null||vt.off()}},[Ze]),N.createElement(ge,(0,k.Z)({},Qe,{className:We,ref:l(ze,Z)}),N.createElement(a.ZP,{in:ot,enteringClassName:Be("rippling"),onEntered:yt},function(lt,vt){var dt=lt.className,gt=(0,j.Z)(lt,["className"]);return N.createElement("span",(0,k.Z)({},gt,{ref:vt,className:we(He(),dt),style:rt}))}))});A.displayName="Ripple",A.propTypes={classPrefix:L().string,className:L().string,onMouseDown:L().func};const R=A;function y(G){return!G||G.trim()==="#"}var _=N.forwardRef(function(G,Z){var re=G.as,ge=re===void 0?"a":re,he=G.href,Ie=G.disabled,Se=G.onClick,De=(0,j.Z)(G,["as","href","disabled","onClick"]),Qe=(0,N.useCallback)(function(we){if((Ie||y(he))&&we.preventDefault(),Ie){we.stopPropagation();return}Se==null||Se(we)},[Ie,he,Se]),Le=y(he)?{role:"button",href:"#"}:null;return Ie&&(De.tabIndex=-1,De["aria-disabled"]=!0),N.createElement(ge,(0,k.Z)({ref:Z,href:he},Le,De,{onClick:Qe}))});_.displayName="SafeAnchor",_.propTypes={href:L().string,disabled:L().bool,as:L().elementType};const I=_;var B=Object.prototype.hasOwnProperty;function P(G,Z){return G===Z?G!==0||Z!==0||1/G===1/Z:G!==G&&Z!==Z}function M(G,Z){if(P(G,Z))return!0;if(typeof G!="object"||G===null||typeof Z!="object"||Z===null)return!1;var re=Object.keys(G),ge=Object.keys(Z);if(re.length!==ge.length)return!1;for(var he=0;he<re.length;he+=1)if(!B.call(Z,re[he])||!P(G[re[he]],Z[re[he]]))return!1;return!0}const U=M;var K=H(64116),W=H.n(K),X=H(79857),ie=H.n(X);function se(G){var Z=G.name,re=G.componentAs,ge=G.componentClassPrefix,he=(0,j.Z)(G,["name","componentAs","componentClassPrefix"]),Ie=N.forwardRef(function(Se,De){var Qe=Se.as,Le=Qe===void 0?re||"div":Qe,we=Se.classPrefix,Be=we===void 0?ge||ie()(Z):we,He=Se.className,We=Se.role,ze=(0,j.Z)(Se,["as","classPrefix","className","role"]),qe=(0,n.Z)(Be),ot=qe.withClassPrefix,je=qe.merge,Ke=je(He,ot());return N.createElement(Le,(0,k.Z)({},he,ze,{role:We,ref:De,className:Ke}))});return Ie.displayName=Z,Ie.propTypes={as:L().elementType,className:L().string,classPrefix:L().string,children:L().node},Ie}const le=se;var ve=le({name:"SidenavBody"});const q=ve;var ee=le({name:"SidenavHeader"});const ae=ee;var _e=H(10541),fe=N.createContext(null);const Ue=fe;function Te(G,Z){return Array.isArray(Z)?Z.indexOf(G)>=0:G===Z}var Fe,$e=N.forwardRef(function(G,Z){var re=G.as,ge=G.active,he=G.appearance,Ie=he===void 0?"default":he,Se=G.block,De=G.className,Qe=G.children,Le=G.classPrefix,we=Le===void 0?"btn":Le,Be=G.color,He=G.disabled,We=G.loading,ze=G.ripple,qe=ze===void 0?!0:ze,ot=G.size,je=G.type,Ke=(0,j.Z)(G,["as","active","appearance","block","className","children","classPrefix","color","disabled","loading","ripple","size","type"]),rt=(0,N.useContext)(Ue),At=ot!=null?ot:rt==null?void 0:rt.size,yt=(0,n.Z)(we),Ze=yt.withClassPrefix,lt=yt.prefix,vt=yt.merge,dt=vt(De,Ze(Ie,Be,At,{active:ge,disabled:He,loading:We,block:Se})),gt=qe&&!Te(Ie,["link","ghost"])?N.createElement(R,null):null,Rt=N.createElement("span",{className:lt(Fe||(Fe=(0,_e.Z)(["spin"])))});if(Ke.href)return N.createElement(I,(0,k.Z)({},Ke,{as:re,ref:Z,"aria-disabled":He,disabled:He,className:dt}),We&&Rt,Qe,gt);var Tt=re||"button",Zt=je||(Tt==="button"?"button":void 0),ar=Ke.role||(Tt!=="button"?"button":void 0);return N.createElement(Tt,(0,k.Z)({},Ke,{role:ar,type:Zt,ref:Z,disabled:He,"aria-disabled":He,className:dt}),We&&Rt,Qe,gt)});$e.displayName="Button",$e.propTypes={as:L().elementType,active:L().bool,appearance:L().oneOf(["default","primary","link","subtle","ghost"]),block:L().bool,children:L().node,color:L().oneOf(["red","orange","yellow","green","cyan","blue","violet"]),disabled:L().bool,href:L().string,loading:L().bool,ripple:L().bool,size:L().oneOf(["lg","md","sm","xs"]),type:L().oneOf(["button","reset","submit"])};const Ge=$e;var st=N.forwardRef(function(G,Z){var re=G.icon,ge=G.placement,he=ge===void 0?"left":ge,Ie=G.children,Se=G.circle,De=G.classPrefix,Qe=De===void 0?"btn-icon":De,Le=G.className,we=(0,j.Z)(G,["icon","placement","children","circle","classPrefix","className"]),Be=(0,n.Z)(Qe),He=Be.merge,We=Be.withClassPrefix,ze=He(Le,We("placement-"+he,{circle:Se,"with-text":typeof Ie!="undefined"}));return N.createElement(Ge,(0,k.Z)({},we,{ref:Z,className:ze}),re,Ie)});st.displayName="IconButton",st.propTypes={className:L().string,icon:L().any,classPrefix:L().string,circle:L().bool,children:L().node,placement:L().oneOf(["left","right"])};const Bt=st;var Pt=H(7582),Dt=H(41840),qt=N.forwardRef(function(G,Z){var re=G.as,ge=re===void 0?"div":re,he=G.expanded,Ie=G.className,Se=G.classPrefix,De=Se===void 0?"sidenav-toggle":Se,Qe=G.onToggle,Le=(0,j.Z)(G,["as","expanded","className","classPrefix","onToggle"]),we=(0,n.Z)(De),Be=we.merge,He=we.withClassPrefix,We=Be(Ie,He({collapsed:!he})),ze=he?Dt.Z:Pt.Z,qe=function(je){Qe==null||Qe(!he,je)};return N.createElement(ge,(0,k.Z)({},Le,{ref:Z,className:We}),N.createElement(Bt,{appearance:"default",icon:N.createElement(ze,null),onClick:qe}))});qt.displayName="SidenavToggle",qt.propTypes={classPrefix:L().string,className:L().string,expanded:L().bool,onToggle:L().func};const Or=qt;function Ci(G,Z){var re=(0,N.useRef)(!1);re.current=G!==void 0;var ge=(0,N.useState)(Z),he=ge[0],Ie=ge[1],Se=re.current?G:he,De=(0,N.useCallback)(function(Qe){re.current||Ie(Qe)},[re]);return[Se,De,re.current]}const Li=Ci;var dr={};function Qr(G,Z){return function(ge,he,Ie){if(ge[he]!=null){var Se='"'+he+'" property of "'+Ie+`" has been deprecated.
|
|
165
|
+
`+Z;dr[Se]||(console.warn(Se),dr[Se]=!0)}for(var De=arguments.length,Qe=new Array(De>3?De-3:0),Le=3;Le<De;Le++)Qe[Le-3]=arguments[Le];return G.apply(void 0,[ge,he,Ie].concat(Qe))}}function Ji(){dr={}}Qr._resetWarned=Ji;var kr=N.createContext(null),Bi=[],gi=N.forwardRef(function(G,Z){var re=G.as,ge=re===void 0?"nav":re,he=G.className,Ie=G.classPrefix,Se=Ie===void 0?"sidenav":Ie,De=G.appearance,Qe=De===void 0?"default":De,Le=G.expanded,we=Le===void 0?!0:Le,Be=G.activeKey,He=Be===void 0?null:Be,We=G.defaultOpenKeys,ze=We===void 0?Bi:We,qe=G.openKeys,ot=G.onSelect,je=G.onOpenChange,Ke=(0,j.Z)(G,["as","className","classPrefix","appearance","expanded","activeKey","defaultOpenKeys","openKeys","onSelect","onOpenChange"]),rt=Li(qe,ze),At=rt[0],yt=rt[1],Ze=(0,n.Z)(Se),lt=Ze.prefix,vt=Ze.merge,dt=Ze.withClassPrefix,gt=vt(he,dt(Qe)),Rt=(0,N.useCallback)(function(Zt,ar){var Yt=function(cr){return U(cr,Zt)},tr=[].concat(At);tr.some(Yt)?W()(tr,Yt):tr.push(Zt),yt(tr),je==null||je(tr,ar)},[je,At,yt]),Tt=(0,N.useMemo)(function(){return{expanded:we,activeKey:He,sidenav:!0,openKeys:At!=null?At:[],onOpenChange:Rt,onSelect:ot}},[He,we,Rt,ot,At]);return N.createElement(kr.Provider,{value:Tt},N.createElement(a.ZP,{in:we,timeout:300,exitedClassName:lt("collapse-out"),exitingClassName:lt("collapse-out","collapsing"),enteredClassName:lt("collapse-in"),enteringClassName:lt("collapse-in","collapsing")},function(Zt,ar){var Yt=Zt.className,tr=(0,j.Z)(Zt,["className"]);return N.createElement(ge,(0,k.Z)({},Ke,tr,{ref:l(Z,ar),className:vt(gt,Yt)}))}))});gi.Header=ae,gi.Body=q,gi.Toggle=Or,gi.displayName="Sidenav",gi.propTypes={as:L().elementType,classPrefix:L().string,className:L().string,expanded:L().bool,appearance:L().oneOf(["default","inverse","subtle"]),defaultOpenKeys:L().array,openKeys:L().array,onOpenChange:L().func,activeKey:Qr(L().any,"Use `activeKey` on <Nav> component instead"),onSelect:Qr(L().func,"Use `onSelect` on <Nav> component instead")};const Ei=null;var Gr=H(34291),Hr=H.n(Gr),wt=N.createContext({withinNav:!1,activeKey:null,onSelect:Hr()});const Ir=wt;function Ui(G,Z){var re,ge=(re=G.displayName)!==null&&re!==void 0?re:G.name,he=N.forwardRef(function(Ie,Se){return(0,N.useEffect)(function(){console.warn(Z)},[]),N.createElement(G,(0,k.Z)({ref:Se},Ie))});return he.displayName="deprecated("+ge+")",he}var on=le({name:"NavbarBody"});const Gn=Ui(on,"<Navbar.Body> has been deprecated, you should <Nav> as direct child of <Navbar>");var an=le({name:"NavbarHeader"});const _i=Ui(an,"<Navbar.Header> has been deprecated, use <Navbar.Brand> instead.");var _n=le({name:"NavbarBrand",componentAs:"a",componentClassPrefix:"navbar-brand"});const Cn=_n;var Ni=N.createContext(!1),yn=N.forwardRef(function(G,Z){var re=G.className,ge=G.as,he=ge===void 0?"nav":ge,Ie=G.classPrefix,Se=Ie===void 0?"navbar":Ie,De=G.appearance,Qe=De===void 0?"default":De,Le=(0,j.Z)(G,["className","as","classPrefix","appearance"]),we=(0,n.Z)(Se),Be=we.withClassPrefix,He=we.merge,We=He(re,Be(Qe));return N.createElement(Ni.Provider,{value:!0},N.createElement(he,(0,k.Z)({},Le,{ref:Z,className:We})))});yn.Header=_i,yn.Body=Gn,yn.Brand=Cn,yn.displayName="Navbar";const as=null;var Hn=N.forwardRef(function(G,Z){var re=G.as,ge=re===void 0?"div":re,he=G.className,Ie=G.classPrefix,Se=Ie===void 0?"tooltip":Ie,De=G.children,Qe=G.style,Le=G.visible,we=(0,j.Z)(G,["as","className","classPrefix","children","style","visible"]),Be=(0,n.Z)(Se),He=Be.merge,We=Be.withClassPrefix,ze=He(he,We()),qe=(0,k.Z)({opacity:Le?1:void 0},Qe);return N.createElement(ge,(0,k.Z)({role:"tooltip"},we,{ref:Z,className:ze,style:qe}),De)});Hn.displayName="Tooltip",Hn.propTypes={visible:L().bool,classPrefix:L().string,className:L().string,style:L().object,children:L().node};const Ks=Hn;var cs=H(84336),ui=H.n(cs),Xt=H(72579),Ur=H.n(Xt),Rs=H(72779),Xn=H.n(Rs);const ho=function(G,Z){return G=typeof G=="function"?G():G,G||Z},Lo=function(G,Z){return Z&&(G.classList?G.classList.remove(Z):G.className=G.className.replace(new RegExp("(^|\\s)"+Z+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")),G},sa=function(G,Z){return G.classList?!!Z&&G.classList.contains(Z):(" "+G.className+" ").indexOf(" "+Z+" ")!==-1},Do=function(G,Z){return Z&&(G.classList?G.classList.add(Z):sa(G,Z)||(G.className=G.className+" "+Z)),G};function oa(G){return G.replace(/([A-Z])/g,"_$1").toLowerCase()}function bo(G){return G.replace(/\-(\w)/g,function(Z){return Z.slice(1).toUpperCase()})}function Oo(G){return G.replace(/([A-Z])/g,"-$1").toLowerCase()}function Bo(G){var Z=0,re;for(re=1;re<arguments.length;re+=1)G=G.split("{"+Z+"}").join(arguments[re]),Z+=1;return G}var No=/^ms-/;const Ws=function(G){return Oo(G).replace(No,"-ms-")};function fo(G,Z){var re,ge;(re=G.style)===null||re===void 0||(ge=re.removeProperty)===null||ge===void 0||ge.call(re,Z)}const cn=function(G,Z){typeof Z=="string"?fo(G,Z):Array.isArray(Z)&&Z.forEach(function(re){return fo(G,re)})},ls=function(G,Z,re){var ge="",he=Z;if(typeof Z=="string"){if(re===void 0)throw new Error("value is undefined");(he={})[Z]=re}if(typeof he=="object")for(var Ie in he)Object.prototype.hasOwnProperty.call(he,Ie)&&(!he[Ie]&&he[Ie]!==0?cn(G,Ws(Ie)):ge+=Ws(Ie)+":"+he[Ie]+";");G.style.cssText+=";"+ge};var yi=[],Po=function(){return yi.some(function(G){return G.activeTargets.length>0})},Jr=function(){return yi.some(function(G){return G.skippedTargets.length>0})},us="ResizeObserver loop completed with undelivered notifications.",Ao=function(){var G;typeof ErrorEvent=="function"?G=new ErrorEvent("error",{message:us}):(G=document.createEvent("Event"),G.initEvent("error",!1,!1),G.message=us),window.dispatchEvent(G)},ws;(function(G){G.BORDER_BOX="border-box",G.CONTENT_BOX="content-box",G.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(ws||(ws={}));var ln=function(G){return Object.freeze(G)},Ls=function(){function G(Z,re){this.inlineSize=Z,this.blockSize=re,ln(this)}return G}(),js=function(){function G(Z,re,ge,he){return this.x=Z,this.y=re,this.width=ge,this.height=he,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,ln(this)}return G.prototype.toJSON=function(){var Z=this,re=Z.x,ge=Z.y,he=Z.top,Ie=Z.right,Se=Z.bottom,De=Z.left,Qe=Z.width,Le=Z.height;return{x:re,y:ge,top:he,right:Ie,bottom:Se,left:De,width:Qe,height:Le}},G.fromRect=function(Z){return new G(Z.x,Z.y,Z.width,Z.height)},G}(),Vs=function(G){return G instanceof SVGElement&&"getBBox"in G},xo=function(G){if(Vs(G)){var Z=G.getBBox(),re=Z.width,ge=Z.height;return!re&&!ge}var he=G,Ie=he.offsetWidth,Se=he.offsetHeight;return!(Ie||Se||G.getClientRects().length)},go=function(G){var Z,re;if(G instanceof Element)return!0;var ge=(re=(Z=G)===null||Z===void 0?void 0:Z.ownerDocument)===null||re===void 0?void 0:re.defaultView;return!!(ge&&G instanceof ge.Element)},Mo=function(G){switch(G.tagName){case"INPUT":if(G.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},Ii=typeof window!="undefined"?window:{},Ys=new WeakMap,Ds=/auto|scroll/,bs=/^tb|vertical/,aa=/msie|trident/i.test(Ii.navigator&&Ii.navigator.userAgent),or=function(G){return parseFloat(G||"0")},ds=function(G,Z,re){return G===void 0&&(G=0),Z===void 0&&(Z=0),re===void 0&&(re=!1),new Ls((re?Z:G)||0,(re?G:Z)||0)},Js=ln({devicePixelContentBoxSize:ds(),borderBoxSize:ds(),contentBoxSize:ds(),contentRect:new js(0,0,0,0)}),ko=function(G,Z){if(Z===void 0&&(Z=!1),Ys.has(G)&&!Z)return Ys.get(G);if(xo(G))return Ys.set(G,Js),Js;var re=getComputedStyle(G),ge=Vs(G)&&G.ownerSVGElement&&G.getBBox(),he=!aa&&re.boxSizing==="border-box",Ie=bs.test(re.writingMode||""),Se=!ge&&Ds.test(re.overflowY||""),De=!ge&&Ds.test(re.overflowX||""),Qe=ge?0:or(re.paddingTop),Le=ge?0:or(re.paddingRight),we=ge?0:or(re.paddingBottom),Be=ge?0:or(re.paddingLeft),He=ge?0:or(re.borderTopWidth),We=ge?0:or(re.borderRightWidth),ze=ge?0:or(re.borderBottomWidth),qe=ge?0:or(re.borderLeftWidth),ot=Be+Le,je=Qe+we,Ke=qe+We,rt=He+ze,At=De?G.offsetHeight-rt-G.clientHeight:0,yt=Se?G.offsetWidth-Ke-G.clientWidth:0,Ze=he?ot+Ke:0,lt=he?je+rt:0,vt=ge?ge.width:or(re.width)-Ze-yt,dt=ge?ge.height:or(re.height)-lt-At,gt=vt+ot+yt+Ke,Rt=dt+je+At+rt,Tt=ln({devicePixelContentBoxSize:ds(Math.round(vt*devicePixelRatio),Math.round(dt*devicePixelRatio),Ie),borderBoxSize:ds(gt,Rt,Ie),contentBoxSize:ds(vt,dt,Ie),contentRect:new js(Be,Qe,vt,dt)});return Ys.set(G,Tt),Tt},In=function(G,Z,re){var ge=ko(G,re),he=ge.borderBoxSize,Ie=ge.contentBoxSize,Se=ge.devicePixelContentBoxSize;switch(Z){case ws.DEVICE_PIXEL_CONTENT_BOX:return Se;case ws.BORDER_BOX:return he;default:return Ie}},ca=function(){function G(Z){var re=ko(Z);this.target=Z,this.contentRect=re.contentRect,this.borderBoxSize=ln([re.borderBoxSize]),this.contentBoxSize=ln([re.contentBoxSize]),this.devicePixelContentBoxSize=ln([re.devicePixelContentBoxSize])}return G}(),Uo=function(G){if(xo(G))return 1/0;for(var Z=0,re=G.parentNode;re;)Z+=1,re=re.parentNode;return Z},_a=function(){var G=1/0,Z=[];yi.forEach(function(Se){if(Se.activeTargets.length!==0){var De=[];Se.activeTargets.forEach(function(Le){var we=new ca(Le.target),Be=Uo(Le.target);De.push(we),Le.lastReportedSize=In(Le.target,Le.observedBox),Be<G&&(G=Be)}),Z.push(function(){Se.callback.call(Se.observer,De,Se.observer)}),Se.activeTargets.splice(0,Se.activeTargets.length)}});for(var re=0,ge=Z;re<ge.length;re++){var he=ge[re];he()}return G},Fo=function(G){yi.forEach(function(re){re.activeTargets.splice(0,re.activeTargets.length),re.skippedTargets.splice(0,re.skippedTargets.length),re.observationTargets.forEach(function(he){he.isActive()&&(Uo(he.target)>G?re.activeTargets.push(he):re.skippedTargets.push(he))})})},Zn=function(){var G=0;for(Fo(G);Po();)G=_a(),Fo(G);return Jr()&&Ao(),G>0},po,Qo=[],Ca=function(){return Qo.splice(0).forEach(function(G){return G()})},Go=function(G){if(!po){var Z=0,re=document.createTextNode(""),ge={characterData:!0};new MutationObserver(function(){return Ca()}).observe(re,ge),po=function(){re.textContent=""+(Z?Z--:Z++)}}Qo.push(G),po()},Fa=function(G){Go(function(){requestAnimationFrame(G)})},Ho=0,la=function(){return!!Ho},zs=250,zi={attributes:!0,characterData:!0,childList:!0,subtree:!0},Qa=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],be=function(G){return G===void 0&&(G=0),Date.now()+G},xe=!1,qi=function(){function G(){var Z=this;this.stopped=!0,this.listener=function(){return Z.schedule()}}return G.prototype.run=function(Z){var re=this;if(Z===void 0&&(Z=zs),!xe){xe=!0;var ge=be(Z);Fa(function(){var he=!1;try{he=Zn()}finally{if(xe=!1,Z=ge-be(),!la())return;he?re.run(1e3):Z>0?re.run(Z):re.start()}})}},G.prototype.schedule=function(){this.stop(),this.run()},G.prototype.observe=function(){var Z=this,re=function(){return Z.observer&&Z.observer.observe(document.body,zi)};document.body?re():Ii.addEventListener("DOMContentLoaded",re)},G.prototype.start=function(){var Z=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Qa.forEach(function(re){return Ii.addEventListener(re,Z.listener,!0)}))},G.prototype.stop=function(){var Z=this;this.stopped||(this.observer&&this.observer.disconnect(),Qa.forEach(function(re){return Ii.removeEventListener(re,Z.listener,!0)}),this.stopped=!0)},G}(),Kr=new qi,di=function(G){!Ho&&G>0&&Kr.start(),Ho+=G,!Ho&&Kr.stop()},zr=function(G){return!Vs(G)&&!Mo(G)&&getComputedStyle(G).display==="inline"},un=function(){function G(Z,re){this.target=Z,this.observedBox=re||ws.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return G.prototype.isActive=function(){var Z=In(this.target,this.observedBox,!0);return zr(this.target)&&(this.lastReportedSize=Z),this.lastReportedSize.inlineSize!==Z.inlineSize||this.lastReportedSize.blockSize!==Z.blockSize},G}(),Fi=function(){function G(Z,re){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=Z,this.callback=re}return G}(),hs=new WeakMap,Fr=function(G,Z){for(var re=0;re<G.length;re+=1)if(G[re].target===Z)return re;return-1},Pi=function(){function G(){}return G.connect=function(Z,re){var ge=new Fi(Z,re);hs.set(Z,ge)},G.observe=function(Z,re,ge){var he=hs.get(Z),Ie=he.observationTargets.length===0;Fr(he.observationTargets,re)<0&&(Ie&&yi.push(he),he.observationTargets.push(new un(re,ge&&ge.box)),di(1),Kr.schedule())},G.unobserve=function(Z,re){var ge=hs.get(Z),he=Fr(ge.observationTargets,re),Ie=ge.observationTargets.length===1;he>=0&&(Ie&&yi.splice(yi.indexOf(ge),1),ge.observationTargets.splice(he,1),di(-1))},G.disconnect=function(Z){var re=this,ge=hs.get(Z);ge.observationTargets.slice().forEach(function(he){return re.unobserve(Z,he.target)}),ge.activeTargets.splice(0,ge.activeTargets.length)},G}(),qs=function(){function G(Z){if(arguments.length===0)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if(typeof Z!="function")throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");Pi.connect(this,Z)}return G.prototype.observe=function(Z,re){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!go(Z))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Pi.observe(this,Z,re)},G.prototype.unobserve=function(Z){if(arguments.length===0)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!go(Z))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Pi.unobserve(this,Z)},G.prototype.disconnect=function(){Pi.disconnect(this)},G.toString=function(){return"function ResizeObserver () { [polyfill code] }"},G}(),Os=function(Z){return(Z==null?void 0:Z.nodeType)===1&&typeof(Z==null?void 0:Z.nodeName)=="string"};const fs=Os;var Xs=H(55324),dn=H.n(Xs),hn=H(10937),ri=H.n(hn);const Sn=function(G,Z){var re=g(G),ge=G.scrollTop,he=0;return re&&(ge=re.pageYOffset,he=re.pageXOffset),Z!==void 0&&(re?re.scrollTo(he,Z):G.scrollTop=Z),ge},fn=function(G,Z){var re=g(G),ge=G.scrollLeft,he=0;return re&&(ge=re.pageXOffset,he=re.pageYOffset),Z!==void 0&&(re?re.scrollTo(Z,he):G.scrollLeft=Z),ge},As=function(G){var Z;return(G==null?void 0:G.nodeName)&&(G==null||(Z=G.nodeName)===null||Z===void 0?void 0:Z.toLowerCase())};var Bs=/^ms-/;const Ns=function(G){return bo(G.replace(Bs,"ms-"))},$n=function(G){if(!G)throw new TypeError("No Element passed to `getComputedStyle()`");var Z=G.ownerDocument;return"defaultView"in Z?Z.defaultView.opener?G.ownerDocument.defaultView.getComputedStyle(G,null):window.getComputedStyle(G,null):null},Xi=function(G,Z){if(Z){var re=G.style[Ns(Z)];if(re)return re;var ge=$n(G);if(ge)return ge.getPropertyValue(Ws(Z))}return G.style||$n(G)},es=function(G){for(var Z=w(G),re=G==null?void 0:G.offsetParent;re&&As(G)!=="html"&&Xi(re,"position")==="static";)re=re.offsetParent;return re||Z.documentElement},ya=function(G,Z,re){re===void 0&&(re=!0);var ge={top:0,left:0},he=null;if(Xi(G,"position")==="fixed")he=G.getBoundingClientRect();else{if(Z=Z||es(G),he=E(G),As(Z)!=="html"){var Ie=E(Z);Ie&&(ge.top=Ie.top,ge.left=Ie.left)}ge.top+=parseInt(Xi(Z,"borderTopWidth"),10)-Sn(Z)||0,ge.left+=parseInt(Xi(Z,"borderLeftWidth"),10)-fn(Z)||0}if(he){var Se=re&&parseInt(Xi(G,"marginTop"),10)||0,De=re&&parseInt(Xi(G,"marginLeft"),10)||0;return(0,k.Z)({},he,{top:he.top-ge.top-Se,left:he.left-ge.left-De})}return null};var ua={left:"Start",right:"End",top:"Start",bottom:"End"};function Bn(G){var Z,re,ge,he;if(G.tagName==="BODY")Z=window.innerWidth,re=window.innerHeight,he=Sn(w(G).documentElement)||Sn(G),ge=fn(w(G).documentElement)||fn(G);else{var Ie=E(G);Z=Ie.width,re=Ie.height,he=Sn(G),ge=fn(G)}return{width:Z,height:re,scrollX:ge,scrollY:he}}const Ps=function(G){var Z=G.placement,re=G.preventOverflow,ge=G.padding;function he(Qe,Le,we){if(!re)return 0;var Be=Bn(we),He=Be.height,We=Be.scrollY,ze=Qe-ge-We,qe=Qe+ge+Le-We;return ze<0?-ze:qe>He?He-qe:0}function Ie(Qe,Le,we){if(!re)return 0;var Be=Bn(we),He=Be.scrollX,We=Be.width,ze=Qe-ge-He,qe=Qe+ge+Le-He;return ze<0?-ze:qe>We?We-qe:0}function Se(Qe,Le,we){if(!re)return we;var Be=Bn(Qe),He=Be.scrollY,We=Be.height;return Le+we>We+He?We-Le+He:Math.max(He,we)}function De(Qe,Le,we){if(!re)return we;var Be=Bn(Qe),He=Be.scrollX,We=Be.width;return Le+we>We+He?We-Le+He:Math.max(He,we)}return{getPosition:function(Le,we){var Be=we.tagName==="BODY"?E(Le):ya(Le,we,!1);return Be},calcAutoPlacement:function(Le,we,Be){var He=Bn(we),We=He.width,ze=He.height,qe=He.scrollX,ot=He.scrollY,je=Le.left-qe-Be.width,Ke=Le.top-ot-Be.height,rt=We-Le.left-Le.width+qe-Be.width,At=ze-Le.top-Le.height+ot-Be.height,yt=[{key:"left",value:je},{key:"right",value:rt}],Ze=[{key:"top",value:Ke},{key:"bottom",value:At}],lt="autoVertical",vt="autoHorizontal",dt,gt;return Z.indexOf(lt)!==-1?(dt=dn()(Ze,function(Rt){return Rt.value}),Z===lt?dt.key:""+dt.key+Z.replace(lt,"")):Z.indexOf(vt)!==-1?(dt=dn()(yt,function(Rt){return Rt.value}),Z===vt?dt.key:""+dt.key+Z.replace(vt,"")):(dt=dn()([].concat(Ze,yt),function(Rt){return Rt.value}),dt.key==="left"||dt.key==="right"?gt=ri()(Ze,function(Rt){return Rt.value}):gt=ri()(yt,function(Rt){return Rt.value}),""+dt.key+ua[gt.key])},calcOverlayPosition:function(Le,we,Be){var He=this.getPosition(we,Be),We=E(Le),ze=We.height,qe=We.width,ot=He.top,je=He.left,Ke=Z;Z&&Z.indexOf("auto")>=0&&(Ke=this.calcAutoPlacement(He,Be,{height:ze,width:qe}));var rt,At,yt,Ze;if(Ke==="left"||Ke==="right"){At=He.top+(He.height-ze)/2;var lt=he(At,ze,Be);At+=lt,Ze=50*(1-2*lt/ze)+"%",yt=void 0}else if(Ke==="top"||Ke==="bottom"){rt=je+(He.width-qe)/2;var vt=Ie(rt,qe,Be);rt+=vt,yt=50*(1-2*vt/qe)+"%",Ze=void 0}if((Ke==="top"||Ke==="topStart"||Ke==="topEnd")&&(At=Se(Be,ze,He.top-ze)),(Ke==="bottom"||Ke==="bottomStart"||Ke==="bottomEnd")&&(At=Se(Be,ze,He.top+He.height)),(Ke==="left"||Ke==="leftStart"||Ke==="leftEnd")&&(rt=De(Be,qe,He.left-qe)),(Ke==="right"||Ke==="rightStart"||Ke==="rightEnd")&&(rt=De(Be,qe,He.left+He.width)),document.dir==="rtl"&&(Ke==="left"||Ke==="leftStart"||Ke==="leftEnd"||Ke==="right"||Ke==="rightStart"||Ke==="rightEnd")){var dt=Bn(Be),gt=dt.width;Be.scrollWidth>gt&&(rt=gt+rt-Be.scrollWidth)}if(Ke==="topStart"||Ke==="bottomStart")if(document.dir==="rtl"){var Rt=je+(He.width-qe);rt=Rt+Ie(Rt,qe,Be)}else rt=je+Ie(je,qe,Be);if(Ke==="topEnd"||Ke==="bottomEnd")if(document.dir==="rtl")rt=je+Ie(je,qe,Be);else{var Tt=je+(He.width-qe);rt=Tt+Ie(Tt,qe,Be)}if((Ke==="leftStart"||Ke==="rightStart")&&(At=ot+he(ot,ze,Be)),Ke==="leftEnd"||Ke==="rightEnd"){var Zt=ot+(He.height-ze);At=Zt+he(Zt,ze,Be)}return{positionLeft:rt,positionTop:At,arrowOffsetLeft:yt,arrowOffsetTop:Ze,positionClassName:"placement-"+ie()(Ke)}}}};var xi=H(76088),cl=function(Z,re){var ge=(0,N.useRef)(!0);(0,N.useEffect)(function(){if(ge.current){ge.current=!1;return}Z()},re)};const _c=cl;var Cc=function(Z,re){var ge=Z.placement,he=ge===void 0?"right":ge,Ie=Z.preventOverflow,Se=Ie===void 0?!1:Ie,De=Z.containerPadding,Qe=De===void 0?0:De,Le=Z.container,we=Z.triggerTarget,Be=(0,N.useRef)(null),He=(0,N.useRef)(null),We=(0,N.useRef)(),ze={positionLeft:0,positionTop:0,arrowOffsetLeft:null,arrowOffsetTop:null},qe=(0,N.useState)(ze),ot=qe[0],je=qe[1],Ke=(0,N.useMemo)(function(){return Ps({placement:he,preventOverflow:Se,padding:Qe})},[he,Se,Qe]),rt=(0,N.useCallback)(function(At,yt){if(At===void 0&&(At=!0),!!(we!=null&&we.current)){var Ze=(0,xi.Z)(we);if(!fs(Ze))throw new Error("`target` should return an HTMLElement");if(!(Ze===He.current&&!At)){var lt=(0,xi.Z)(re.current),vt=ho(typeof Le=="function"?Le():Le!=null?Le:null,w(re.current).body),dt=Ke.calcOverlayPosition(lt,Ze,vt);if(yt&<){var gt,Rt,Tt=lt==null||(gt=lt.className)===null||gt===void 0||(Rt=gt.match(/(placement-\S+)/))===null||Rt===void 0?void 0:Rt[0];Lo(lt,Tt),dt.positionClassName&&Do(lt,dt.positionClassName),ls(lt,{left:dt.positionLeft+"px",top:dt.positionTop+"px"})}else je(dt);Be.current=vt,He.current=Ze}}},[Le,re,we,Ke]);return(0,N.useEffect)(function(){rt(!1);var At=(0,xi.Z)(re.current),yt;if(Be.current&&Se){var Ze;yt=(0,u.Z)(((Ze=Be.current)===null||Ze===void 0?void 0:Ze.tagName)==="BODY"?window:Be.current,"scroll",function(){return rt(!0,!0)})}var lt=(0,u.Z)(window,"resize",function(){return rt(!0,!0)});return At&&(We.current=new qs(function(){return rt(!0,!0)}),We.current.observe(At)),function(){var vt,dt;He.current=null,(vt=yt)===null||vt===void 0||vt.off(),lt==null||lt.off(),(dt=We.current)===null||dt===void 0||dt.disconnect()}},[Se,re,rt]),_c(function(){return rt()},[rt,he]),[ot,rt]},Ia=N.forwardRef(function(G,Z){var re=G.children,ge=G.className,he=N.useRef(null),Ie=Cc(G,he),Se=Ie[0],De=Ie[1],Qe=Se.positionClassName,Le=Se.arrowOffsetLeft,we=Se.arrowOffsetTop,Be=Se.positionLeft,He=Se.positionTop;if((0,N.useImperativeHandle)(Z,function(){return{get child(){return he.current},updatePosition:De}}),typeof re=="function"){var We={className:Xn()(ge,Qe),arrowOffsetLeft:Le,arrowOffsetTop:we,left:Be,top:He};return re(We,he)}return re});Ia.displayName="Position",Ia.propTypes={className:L().string,children:L().func.isRequired,container:L().oneOfType([L().func,L().any]),containerPadding:L().number,placement:L().any,preventOverflow:L().bool,triggerTarget:L().any};const gu=Ia;var Lr=H(77700);function ll(G){return(G==null?void 0:G.button)===0}function yc(G){return!!(G.metaKey||G.altKey||G.ctrlKey||G!=null&&G.shiftKey)}function ul(G,Z){var re=Z.disabled,ge=Z.triggerTarget,he=Z.overlayTarget,Ie=Z.listenEscape,Se=Ie===void 0?!0:Ie,De=(0,N.useCallback)(function(Le){Se&&Le.key===Lr.QP.ESC&&(G==null||G(Le))},[Se,G]),Qe=(0,N.useCallback)(function(Le){var we=(0,xi.Z)(ge),Be=(0,xi.Z)(he);we&&p(we,Le.target)||Be&&p(Be,Le.target)||yc(Le)||!ll(Le)||G==null||G(Le)},[G,ge,he]);(0,N.useEffect)(function(){var Le=(0,xi.Z)(ge);if(!(re||!Le)){var we=w(Le),Be=(0,u.Z)(we,"mousedown",Qe,!0),He=(0,u.Z)(we,"keyup",De);return function(){Be==null||Be.off(),He==null||He.off()}}},[ge,re,G,Qe,De])}const dl=ul;var da=N.forwardRef(function(G,Z){var re=G.timeout,ge=re===void 0?300:re,he=G.className,Ie=(0,j.Z)(G,["timeout","className"]),Se=(0,n.Z)("anim"),De=Se.prefix,Qe=Se.merge;return N.createElement(a.ZP,(0,k.Z)({},Ie,{ref:Z,timeout:ge,className:Qe(he,De("fade")),enteredClassName:De("in"),enteringClassName:De("in")}))});da.displayName="Fade";const hl=da;var Ga=N.createContext({});Ga.displayName="OverlayContext";const Ic=Ga;var fl={container:L().any,children:L().any,childrenProps:L().object,className:L().string,containerPadding:L().number,placement:L().any,preventOverflow:L().bool,open:L().bool,rootClose:L().bool,transition:L().any,triggerTarget:L().any,onClose:L().func,onEnter:L().func,onEntering:L().func,onEntered:L().func,onExit:L().func,onExiting:L().func,onExited:L().func},Sa=N.forwardRef(function(G,Z){var re=(0,N.useContext)(Ic),ge=re.overlayContainer,he=G.container,Ie=he===void 0?ge:he,Se=G.containerPadding,De=G.placement,Qe=G.rootClose,Le=G.children,we=G.childrenProps,Be=G.transition,He=Be===void 0?hl:Be,We=G.open,ze=G.preventOverflow,qe=G.triggerTarget,ot=G.onClose,je=G.onExited,Ke=G.onExit,rt=G.onExiting,At=G.onEnter,yt=G.onEntering,Ze=G.onEntered,lt=(0,N.useState)(!We),vt=lt[0],dt=lt[1],gt=(0,N.useRef)(null);We?vt&&dt(!1):!He&&!vt&&dt(!0);var Rt=We||He&&!vt,Tt=(0,N.useCallback)(function(Yt){dt(!0),je==null||je(Yt)},[je]);if(dl(ot,{triggerTarget:qe,overlayTarget:gt,disabled:!Qe||!Rt}),!Rt)return null;var Zt={container:Ie,containerPadding:Se,triggerTarget:qe,placement:De,preventOverflow:ze},ar=function(tr,wr){return N.createElement(gu,(0,k.Z)({},Zt,tr,{ref:l(Z,wr)}),function(cr,Lt){if(typeof Le=="function")return Le(Object.assign(cr,we),l(Lt,gt));var Br=cr.left,Xr=cr.top,hi=cr.className;return N.cloneElement(Le,(0,k.Z)({},we,Le.props,{className:Xn()(hi,Le.props.className),style:(0,k.Z)({left:Br,top:Xr},Le.props.style),ref:l(Lt,gt)}))})};return He?N.createElement(He,{in:We,transitionAppear:!0,onExit:Ke,onExiting:rt,onExited:Tt,onEnter:At,onEntering:yt,onEntered:Ze},ar):ar()});Sa.displayName="Overlay",Sa.propTypes=fl;const pu=Sa;var Di=H(21426),Al=H(28316);function gl(G){G===void 0&&(G={});var Z=G,re=Z.id,ge=Z.container,he=(0,N.useRef)(b.Z?document.body:null);(0,N.useEffect)(function(){var Se=typeof ge=="function"?ge():ge,De=re&&document.querySelector("#"+re),Qe=Se||De||document.body;he.current=Qe},[he,ge,re]);var Ie=(0,N.useCallback)(function(Se){var De=Se.children;return he.current!=null?(0,Al.createPortal)(De,he.current):null},[he]);return{target:he.current,Portal:Ie}}const Sc=gl;function pl(G,Z){G===void 0&&(G={}),Z===void 0&&(Z={});var re={};return Object.keys(G).forEach(function(ge){if(G[ge]){var he;re[ge]=(0,Di.Z)(G[ge],(he=Z)===null||he===void 0?void 0:he[ge])}}),re}function Ha(G,Z,re){var ge=Z.currentTarget,he=Z.relatedTarget||Ur()(Z,["nativeEvent","toElement"]);(!he||he!==ge)&&!p(ge,he)&&G(Z,re)}var vl=["hover","focus"],Zs=N.forwardRef(function(G,Z){var re=(0,N.useContext)(Ic),ge=re.overlayContainer,he=G.children,Ie=G.container,Se=Ie===void 0?ge:Ie,De=G.controlId,Qe=G.defaultOpen,Le=G.trigger,we=Le===void 0?vl:Le,Be=G.disabled,He=G.readOnly,We=G.plaintext,ze=G.open,qe=G.delay,ot=G.delayOpen,je=G.delayClose,Ke=G.enterable,rt=G.placement,At=rt===void 0?"bottomStart":rt,yt=G.speaker,Ze=G.rootClose,lt=Ze===void 0?!0:Ze,vt=G.onClick,dt=G.onMouseOver,gt=G.onMouseOut,Rt=G.onContextMenu,Tt=G.onFocus,Zt=G.onBlur,ar=G.onClose,Yt=(0,j.Z)(G,["children","container","controlId","defaultOpen","trigger","disabled","readOnly","plaintext","open","delay","delayOpen","delayClose","enterable","placement","speaker","rootClose","onClick","onMouseOver","onMouseOut","onContextMenu","onFocus","onBlur","onClose"]),tr=Sc({container:Se}),wr=tr.Portal,cr=(0,N.useRef)(),Lt=(0,N.useRef)(),Br=Li(ze,Qe),Xr=Br[0],hi=Br[1],Vr=(0,N.useRef)(null),si=(0,N.useRef)(null),oi=D()(ot)?qe:ot,Zi=D()(je)?qe:je,wn=(0,N.useRef)(!1),Pn=(0,N.useRef)(!1);(0,N.useEffect)(function(){return function(){D()(Vr.current)||clearTimeout(Vr.current),D()(si.current)||clearTimeout(si.current)}},[]);var $i=(0,N.useCallback)(function(vi){var fi=ui()(vi)?oi:vi;if(fi&&typeof fi=="number")return Vr.current=setTimeout(function(){Vr.current=null,hi(!0)},fi);hi(!0)},[oi,hi]),xn=(0,N.useCallback)(function(vi){var fi=ui()(vi)?Zi:vi;if(fi&&typeof fi=="number")return si.current=setTimeout(function(){si.current=null,hi(!1)},fi);hi(!1)},[Zi,hi]);(0,N.useImperativeHandle)(Z,function(){return{get root(){return cr.current},get overlay(){var vi;return(vi=Lt.current)===null||vi===void 0?void 0:vi.child},open:$i,close:xn,updatePosition:function(){var fi,Xo;(fi=Lt.current)===null||fi===void 0||(Xo=fi.updatePosition)===null||Xo===void 0||Xo.call(fi)}}});var Ln=(0,N.useCallback)(function(){!wn.current&&!Pn.current&&xn()},[xn]),Mn=(0,N.useCallback)(function(){Xr?Ln():$i()},[Xr,Ln,$i]),Zr=(0,N.useCallback)(function(){if(!Ke)return $i();if(Pn.current=!0,!D()(si.current))return clearTimeout(si.current),si.current=null,$i();Xr||$i()},[Ke,Xr,$i]),$r=(0,N.useCallback)(function(){if(Ke||xn(),Pn.current=!1,!D()(Vr.current)){clearTimeout(Vr.current),Vr.current=null;return}!Xr||!D()(si.current)||(si.current=setTimeout(function(){D()(si.current)||(clearTimeout(si.current),si.current=null),Ln()},200))},[Ke,Xr,xn,Ln]),ft=(0,N.useCallback)(function(){wn.current=!0},[]),ei=(0,N.useCallback)(function(){wn.current=!1,!Te("click",we)&&!Te("contextMenu",we)&&!Te("active",we)&&Ln()},[Ln,we]),bi=(0,N.useCallback)(function(vi){vi.preventDefault()},[]),Sr={onClick:vt,onContextMenu:Rt,onMouseOver:dt,onMouseOut:gt,onFocus:Tt,onBlur:Zt};if(!Be&&!He&&!We){if(Te("click",we)&&(Sr.onClick=(0,Di.Z)(Mn,Sr.onClick)),Te("contextMenu",we)&&(Sr.onContextMenu=(0,Di.Z)(bi,Mn,Sr.onContextMenu)),Te("active",we)&&(Sr.onClick=(0,Di.Z)(Zr,Sr.onClick)),Te("hover",we)){var Vn=null,wa=null;we!=="none"&&(Vn=function(fi){return Ha(Zr,fi)},wa=function(fi){return Ha($r,fi)}),Sr.onMouseOver=(0,Di.Z)(Vn,dt),Sr.onMouseOut=(0,Di.Z)(wa,gt)}Te("focus",we)&&(Sr.onFocus=(0,Di.Z)(Zr,Tt),Sr.onBlur=(0,Di.Z)($r,Zt))}var Za=function(){var fi=(0,k.Z)({},Yt,{rootClose:lt,triggerTarget:cr,onClose:we!=="none"?(0,Di.Z)(xn,ar):void 0,placement:At,container:Se,open:Xr}),Xo={id:De};return we!=="none"&&Ke&&(Xo.onMouseEnter=ft,Xo.onMouseLeave=ei),N.createElement(pu,(0,k.Z)({},fi,{ref:Lt,childrenProps:Xo}),typeof yt=="function"?function(Pl,Nu){return yt((0,k.Z)({},Pl,{onClose:xn}),Nu)}:yt)};return N.createElement(N.Fragment,null,typeof he=="function"?he(Sr,cr):N.cloneElement(he,(0,k.Z)({ref:cr,"aria-describedby":De},pl(Sr,he.props))),N.createElement(wr,null,Za()))});Zs.displayName="OverlayTrigger";const ml=Zs;function El(G,Z){return Z===void 0&&(Z=!1),typeof G=="string"?(Z&&(G=G.replace(/left|right/,function(re){return re==="left"?"right":"left"})),G.replace(/Left|Top/,"Start").replace(/Right|Bottom/,"End")):G}const $s=El;var vu=H(10356),Ka=N.forwardRef(function(G,Z){var re=G.onOpen,ge=G.onClose,he=G.onEntered,Ie=G.onExited,Se=G.placement,De=Se===void 0?"right":Se,Qe=G.preventOverflow,Le=(0,j.Z)(G,["onOpen","onClose","onEntered","onExited","placement","preventOverflow"]);return N.createElement(vu.wu,null,function(we){return N.createElement(ml,(0,k.Z)({},Le,{ref:Z,preventOverflow:Qe,placement:$s(De,we==null?void 0:we.rtl),onEntered:(0,Di.Z)(re,he),onExited:(0,Di.Z)(ge,Ie)}))})});Ka.displayName="Whisper",Ka.propTypes={onOpen:L().func,onClose:L().func,onEntered:L().func,onExited:L().func,placement:L().oneOf(Lr.r4),preventOverflow:L().bool};const Tc=Ka;function Ta(G){var Z=G.message,re=G.ref,ge=(0,j.Z)(G,["message","ref"]);return N.createElement(Tc,(0,k.Z)({ref:re,speaker:N.createElement(Ks,null,Z)},ge))}var Wa=H(74930),Ht=H.n(Wa);function ii(G,Z){var re=(0,N.useRef)();return re.current||(re.current=Ht()(G)),Z!=null?Z:re.current}var xt;(function(G){G[G.RegisterItem=0]="RegisterItem",G[G.UnregisterItem=1]="UnregisterItem",G[G.OpenMenu=2]="OpenMenu",G[G.CloseMenu=3]="CloseMenu",G[G.MoveFocus=4]="MoveFocus"})(xt||(xt={}));var qr;(function(G){G[G.Next=0]="Next",G[G.Prev=1]="Prev",G[G.Last=2]="Last",G[G.First=3]="First",G[G.Specific=4]="Specific",G[G.None=5]="None"})(qr||(qr={}));var Rc=N.createContext(null);Rc.displayName="MenuContext";const vo=Rc;function gs(G){var Z=G.children,re=G.selected,ge=re===void 0?!1:re,he=G.disabled,Ie=he===void 0?!1:he,Se=G.onActivate,De=(0,N.useRef)(null),Qe=ii("menuitem-"),Le=(0,N.useContext)(vo);if(!Le)throw new Error("<MenuItem> must be rendered within a <Menu>");var we=Le[0],Be=Le[1],He=!D()(De.current)&&!D()(we.activeItemIndex)&&we.items[we.activeItemIndex].element===De.current,We=(0,N.useCallback)(function(Ke){Ie||Se==null||Se(Ke)},[Ie,Se]),ze=(0,N.useCallback)(function(){!D()(De.current)&&!He&&Be({type:xt.MoveFocus,to:qr.Specific,id:De.current.id})},[Be]),qe=(0,N.useCallback)(function(){!D()(De.current)&&!He&&Be({type:xt.MoveFocus,to:qr.Specific,id:De.current.id})},[He,Be]),ot=(0,N.useCallback)(function(){Be({type:xt.MoveFocus,to:qr.None})},[Be]);(0,N.useEffect)(function(){var Ke=De.current;return Be({type:xt.RegisterItem,element:Ke,props:{disabled:Ie}}),function(){Be({type:xt.UnregisterItem,id:Ke.id})}},[De,Ie,Be]);var je={id:Qe,role:"menuitem","aria-checked":ge||void 0,"aria-disabled":Ie,tabIndex:-1,onClick:We,selected:ge,active:He};return(we==null?void 0:we.role)==="menu"&&(je.onMouseMove=qe,je.onMouseLeave=ot),(we==null?void 0:we.role)==="menubar"&&(je.onMouseDown=ze),Z(je,De)}gs.displayName="MenuItem",gs.propTypes={selected:L().bool,disabled:L().bool,children:L().func.isRequired,onActivate:L().func};const ja=gs;var xs=H(17620),ps=H.n(xs),ha=N.forwardRef(function(G,Z){var re=G.as,ge=re===void 0?I:re,he=G.active,Ie=G.children,Se=G.className,De=G.disabled,Qe=G.classPrefix,Le=Qe===void 0?"sidenav-item":Qe,we=G.icon,Be=G.eventKey,He=G.style,We=G.onClick,ze=G.onSelect,qe=G.divider,ot=G.panel,je=(0,j.Z)(G,["as","active","children","className","disabled","classPrefix","icon","eventKey","style","onClick","onSelect","divider","panel"]),Ke=(0,N.useContext)(kr);if(!Ke)throw new Error("<SidenavItem> component is not supposed to be used standalone. Use <Nav.Item> inside <Sidenav> instead.");var rt=(0,N.useContext)(Ir),At=rt.activeKey,yt=rt.onSelect,Ze=(0,n.Z)(Le),lt=Ze.merge,vt=Ze.withClassPrefix,dt=Ze.prefix,gt=he!=null?he:!D()(Be)&&U(At,Be),Rt=(0,N.useCallback)(function(Tt){De||(ze==null||ze(Be,Tt),yt==null||yt(Be,Tt),We==null||We(Tt))},[De,ze,yt,Be,We]);return Ke.expanded?qe?N.createElement("li",(0,k.Z)({ref:Z,role:"separator",style:He,className:lt(Se,dt("divider"))},je)):ot?N.createElement("li",(0,k.Z)({ref:Z,role:"none presentation",style:He,className:lt(Se,dt("panel"))},je),Ie):N.createElement(ge,(0,k.Z)({ref:Z,className:lt(Se,vt({active:gt,disabled:De})),onClick:Rt,style:He,"aria-selected":gt||void 0,"data-event-key":Be},je),we,Ie,N.createElement(R,null)):N.createElement(ja,{selected:gt,disabled:De,onActivate:Rt},function(Tt,Zt){var ar=Tt.selected,Yt=Tt.active,tr=(0,j.Z)(Tt,["selected","active"]),wr=lt(Se,vt({focus:Yt,active:ar,disabled:De}));return Ta({children:function(Lt,Br){return N.createElement(ge,(0,k.Z)({ref:l(l(Z,Zt),Br),disabled:ge===I?De:void 0,className:wr,"data-event-key":Be},ps()(je,["divider","panel"]),Lt,tr),we,Ie,N.createElement(R,null))},message:Ie,placement:"right"})})});ha.displayName="Sidenav.Item",ha.propTypes={classPrefix:L().string,disabled:L().bool,icon:L().node,className:L().string,children:L().node,eventKey:L().any,as:L().elementType,style:L().object,onSelect:L().func,onMouseEnter:L().func,onMouseLeave:L().func,onContextMenu:L().func,onClick:L().func};const Ko=ha;var Tn=N.forwardRef(function(G,Z){var re=G.as,ge=re===void 0?I:re,he=G.active,Ie=G.disabled,Se=G.eventKey,De=G.className,Qe=G.classPrefix,Le=Qe===void 0?"navbar-item":Qe,we=G.style,Be=G.children,He=G.icon,We=G.onClick,ze=G.onSelect,qe=(0,j.Z)(G,["as","active","disabled","eventKey","className","classPrefix","style","children","icon","onClick","onSelect"]),ot=(0,N.useContext)(Ir),je=ot.activeKey,Ke=ot.onSelect,rt=he!=null?he:!D()(Se)&&U(Se,je),At=(0,N.useCallback)(function(gt){ze==null||ze(Se,gt),Ke==null||Ke(Se,gt)},[Se,ze,Ke]),yt=(0,n.Z)(Le),Ze=yt.withClassPrefix,lt=yt.merge,vt=lt(De,Ze({active:rt,disabled:Ie})),dt=(0,N.useCallback)(function(gt){Ie||(At(gt),We==null||We(gt))},[Ie,At,We]);return N.createElement(ge,(0,k.Z)({ref:Z,"aria-selected":rt||void 0},qe,{className:vt,onClick:dt,style:we}),He,Be,N.createElement(R,null))});Tn.displayName="Navbar.Item",Tn.propTypes={as:L().elementType,active:L().bool,disabled:L().bool,className:L().string,classPrefix:L().string,onClick:L().func,style:L().object,icon:L().node,onSelect:L().func,children:L().node,eventKey:L().any};const jr=Tn;var mo=N.forwardRef(function(G,Z){var re=G.as,ge=re===void 0?I:re,he=G.active,Ie=G.disabled,Se=G.eventKey,De=G.className,Qe=G.classPrefix,Le=Qe===void 0?"nav-item":Qe,we=G.style,Be=G.children,He=G.icon,We=G.divider,ze=G.panel,qe=G.onClick,ot=G.onSelect,je=(0,j.Z)(G,["as","active","disabled","eventKey","className","classPrefix","style","children","icon","divider","panel","onClick","onSelect"]),Ke=(0,N.useContext)(Ir),rt=Ke.activeKey,At=Ke.onSelect,yt=he!=null?he:!D()(Se)&&U(Se,rt),Ze=(0,N.useCallback)(function(Yt){ot==null||ot(Se,Yt),At==null||At(Se,Yt)},[Se,ot,At]),lt=(0,N.useContext)(Ni),vt=(0,N.useContext)(kr),dt=(0,n.Z)(Le),gt=dt.withClassPrefix,Rt=dt.merge,Tt=dt.prefix,Zt=Rt(De,gt({active:yt,disabled:Ie})),ar=(0,N.useCallback)(function(Yt){Ie||(Ze(Yt),qe==null||qe(Yt))},[Ie,Ze,qe]);return vt?N.createElement(Ko,G):We?N.createElement("div",(0,k.Z)({ref:Z,role:"separator",style:we,className:Rt(De,Tt("divider"))},je)):ze?N.createElement("div",(0,k.Z)({ref:Z,style:we,className:Rt(De,Tt("panel"))},je),Be):lt?N.createElement(jr,G):N.createElement(ge,(0,k.Z)({ref:Z,tabIndex:Ie?-1:void 0},je,{className:Zt,onClick:ar,style:we,"aria-selected":yt||void 0}),He,Be,N.createElement(R,null))});mo.displayName="Nav.Item",mo.propTypes={as:L().elementType,active:L().bool,disabled:L().bool,className:L().string,classPrefix:L().string,divider:L().bool,panel:L().bool,onClick:L().func,style:L().object,icon:L().node,onSelect:L().func,children:L().node,eventKey:L().any};const mu=mo;var $t=H(13888),fa=H.n($t),Eo=H(52885),Cl={role:"menu",open:!1,items:[],activeItemIndex:null};function yl(G,Z){var re=G.items,ge=G.activeItemIndex;switch(Z.type){case xt.RegisterItem:return(0,k.Z)({},G,{items:[].concat(re,[{element:Z.element,props:Z.props}])});case xt.UnregisterItem:return(0,k.Z)({},G,{items:re.filter(function(qe){return qe.element.id!==Z.id})});case xt.OpenMenu:return(0,k.Z)({},G,{open:!0});case xt.CloseMenu:return(0,k.Z)({},G,{open:!1});case xt.MoveFocus:var he=ge;switch(Z.to){case qr.Next:for(var Ie=ge===null?0:ge+1;Ie<re.length;Ie++){var Se;if(!((Se=re[Ie].props)!==null&&Se!==void 0&&Se.disabled)){he=Ie;break}}break;case qr.Prev:for(var De=ge===null?re.length-1:ge-1;De>=0;De--){var Qe;if(!((Qe=re[De].props)!==null&&Qe!==void 0&&Qe.disabled)){he=De;break}}break;case qr.First:for(var Le=0;Le<re.length;Le++){var we;if(!((we=re[Le].props)!==null&&we!==void 0&&we.disabled)){he=Le;break}}break;case qr.Last:for(var Be=re.length-1;Be>=0;Be--){var He;if(!((He=re[Be].props)!==null&&He!==void 0&&He.disabled)){he=Be;break}}break;case qr.Specific:for(var We=0;We<re.length;We++){var ze;if(re[We].element.id===Z.id&&!((ze=re[We].props)!==null&&ze!==void 0&&ze.disabled)){he=We;break}}break;case qr.None:he=null;break}return(0,k.Z)({},G,{activeItemIndex:he});default:return G}}function Wo(G){var Z=(0,N.useReducer)(yl,(0,k.Z)({},Cl,G)),re=Z[0],ge=Z[1];return[re,ge]}function Eu(G){var Z=(0,N.useRef)(null),re=(0,N.useCallback)(function(){requestAnimationFrame(function(){if(document.activeElement!==G.current){var he;Z.current=document.activeElement,(he=G.current)===null||he===void 0||he.focus()}})},[G]),ge=(0,N.useCallback)(function(he){requestAnimationFrame(function(){var Ie;(Ie=Z.current)===null||Ie===void 0||Ie.focus(he)})},[]);return{grab:re,release:ge}}function jo(G){var Z=G.enabled,re=Z===void 0?!0:Z,ge=G.isOutside,he=G.handle,Ie=(0,N.useRef)(ge),Se=(0,N.useRef)(he);(0,N.useEffect)(function(){Ie.current=ge,Se.current=he},[ge,he]),(0,N.useEffect)(function(){if(re){var De=function(Le){Ie.current(Le)&&Se.current(Le)};return window.addEventListener("mousedown",De),function(){window.removeEventListener("mousedown",De)}}},[re])}function _u(G){return G.type==="focus"&&!G.currentTarget.contains(G.relatedTarget)}function Il(G){return G.type==="blur"&&!G.currentTarget.contains(G.relatedTarget)}var Cu=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(function(G){return G+":not([tabindex='-1'])"}).join(",");function yu(G){return G===document.body?!1:G.matches(Cu)}var Dr=["click"];function Kn(G){var Z,re=G.disabled,ge=G.children,he=G.openMenuOn,Ie=he===void 0?Dr:he,Se=G.menuButtonText,De=G.renderMenuButton,Qe=G.renderMenuPopup,Le=G.onToggleMenu,we=(0,N.useRef)(null),Be=(0,N.useRef)(null),He=(0,N.useContext)(vo),We=!!He,ze=Wo(),qe=ze[0],ot=qe.open,je=qe.items,Ke=qe.activeItemIndex,rt=ze[1],At=(0,Eo.Z)("Menu"),yt=At.rtl,Ze=D()(Ke)?null:(Z=je[Ke])===null||Z===void 0?void 0:Z.element,lt=Eu(Be),vt=lt.grab,dt=(0,N.useCallback)(function(ft){rt({type:xt.OpenMenu}),ft.isTrusted||rt({type:xt.MoveFocus,to:qr.First}),Le==null||Le(!0,ft),vt()},[rt,Le,vt]),gt=(0,N.useCallback)(function(ft,ei){if(ei===void 0&&(ei=!0),rt({type:xt.CloseMenu}),rt({type:xt.MoveFocus,to:qr.None}),Le==null||Le(!1,ft),ei){var bi;(bi=we.current)===null||bi===void 0||bi.focus({preventScroll:!0})}},[rt,Le,we]),Rt=(0,N.useCallback)(function(ft){ot?gt(ft):dt(ft)},[ot,dt,gt]);jo({enabled:ot,isOutside:function(ei){var bi,Sr;return!((bi=we.current)!==null&&bi!==void 0&&bi.contains(ei.target))&&!((Sr=Be.current)!==null&&Sr!==void 0&&Sr.contains(ei.target))},handle:function(ei){return gt(ei,!yu(ei.target))}});var Tt=(0,N.useCallback)(function(ft){switch(ft.key){case Lr.QP.ENTER:case Lr.QP.SPACE:ft.preventDefault(),ft.stopPropagation(),ot?gt(ft):(dt(ft),rt({type:xt.MoveFocus,to:qr.First}));break;case Lr.QP.DOWN:ft.preventDefault(),ft.stopPropagation(),ot||dt(ft),rt({type:xt.MoveFocus,to:qr.First});break}},[ot,dt,gt,rt]),Zt=(0,N.useCallback)(function(ft){re||Rt(ft)},[re,Rt]),ar=(0,N.useCallback)(function(ft){ft.preventDefault(),!ot&&(re||dt(ft))},[ot,re,dt]),Yt=(0,N.useMemo)(function(){var ft={onKeyDown:Tt};return Ie!=null&&Ie.includes("click")&&(ft.onClick=Zt),Ie!=null&&Ie.includes("contextmenu")&&(ft.onContextMenu=ar),ft},[Ie,Tt,Zt,ar]),tr=ii("menubutton-"),wr=ii("menu-"),cr=(0,N.useMemo)(function(){return{role:"button","aria-haspopup":"menu","aria-expanded":ot||void 0,"aria-controls":wr}},[ot,wr]),Lt=(0,N.useMemo)(function(){return(0,k.Z)({id:tr},cr,Yt,{open:ot})},[tr,cr,Yt,ot]),Br=(0,N.useMemo)(function(){return De==null?void 0:De(Lt,we)},[De,Lt,we]),Xr=Br!=null?Br:N.createElement("button",(0,k.Z)({ref:we},Lt),Se),hi=(0,N.useCallback)(function(ft){switch(ft.key){case Lr.QP.UP:ft.preventDefault(),ft.stopPropagation(),rt({type:xt.MoveFocus,to:qr.Prev});break;case Lr.QP.DOWN:ft.preventDefault(),ft.stopPropagation(),rt({type:xt.MoveFocus,to:qr.Next});break;case Lr.QP.RIGHT:ft.preventDefault(),ft.stopPropagation(),yt?We&&rt({type:xt.CloseMenu}):(Ze==null?void 0:Ze.getAttribute("aria-haspopup"))==="menu"&&Ze.click();break;case Lr.QP.LEFT:ft.preventDefault(),ft.stopPropagation(),yt?(Ze==null?void 0:Ze.getAttribute("aria-haspopup"))==="menu"&&Ze.click():We&>(ft);break;case Lr.QP.HOME:ft.preventDefault(),ft.stopPropagation(),rt({type:xt.MoveFocus,to:qr.First});break;case Lr.QP.END:ft.preventDefault(),ft.stopPropagation(),rt({type:xt.MoveFocus,to:qr.Last});break;case Lr.QP.ENTER:case Lr.QP.SPACE:Ze&&(ft.preventDefault(),ft.stopPropagation(),Ze.click(),Ze.getAttribute("aria-haspopup")||gt(ft));break;case Lr.QP.ESC:gt(ft);break}},[rt,Ze,We,yt,gt]),Vr=(0,N.useCallback)(function(ft){var ei=ft.target;ei.getAttribute("role")==="menuitem"&&ei.getAttribute("aria-haspopup")!=="menu"&&ei.getAttribute("aria-disabled")!=="true"&>(ft,!We)},[gt,We]),si={role:"menu","aria-labelledby":tr,"aria-activedescendant":Ze==null?void 0:Ze.id},oi={onClick:Vr,onKeyDown:hi},Zi=(0,k.Z)({id:wr},si,oi,{tabIndex:0}),wn=Qe==null?void 0:Qe((0,k.Z)({},Zi,{open:ot}),Be),Pn=wn!=null?wn:N.createElement("ul",(0,k.Z)({ref:Be},Zi,{hidden:!ot}),ge),$i=(0,N.useCallback)(function(ft){re||dt(ft)},[re,dt]),xn=(0,N.useCallback)(function(ft){re||gt(ft)},[re,gt]),Ln=(0,N.useRef)(null),Mn=(0,N.useCallback)(function(ft){Il(ft)&>(ft,!1)},[gt]),Zr={onBlur:Mn};Ie!=null&&Ie.includes("mouseover")&&(Zr.onMouseEnter=$i,Zr.onMouseLeave=xn);var $r=(0,k.Z)({},Zr,{children:N.createElement(N.Fragment,null,Xr,N.createElement(vo.Provider,{value:ze},Pn)),open:ot});return We&&($r.role="none presentation"),ge($r,Ln)}Kn.displayName="Menu",Kn.propTypes={children:L().func.isRequired};const eo=Kn;var Qi=N.createContext(null);Qi.displayName="DropdownContext";const to=Qi;function Wn(G){var Z=G.vertical,re=Z===void 0?!1:Z,ge=G.children,he=G.onActivateItem,Ie=Wo({role:"menubar"}),Se=Ie[0],De=Se.items,Qe=Se.activeItemIndex,Le=Ie[1],we=(0,N.useRef)(null),Be=(0,N.useCallback)(function(je){_u(je)&&Qe===null&&Le({type:xt.MoveFocus,to:qr.First})},[Qe,Le]),He=(0,N.useCallback)(function(je){Il(je)&&Le({type:xt.MoveFocus,to:qr.None})},[Le]),We=(0,Eo.Z)("Menubar"),ze=We.rtl,qe=(0,N.useCallback)(function(je){var Ke=D()(Qe)?null:De[Qe].element;switch(!0){case(!re&&!ze&&je.key===Lr.QP.RIGHT):case(!re&&ze&&je.key===Lr.QP.LEFT):case(re&&je.key===Lr.QP.DOWN):je.preventDefault(),je.stopPropagation(),Le({type:xt.MoveFocus,to:qr.Next});break;case(!re&&!ze&&je.key===Lr.QP.LEFT):case(!re&&ze&&je.key===Lr.QP.RIGHT):case(re&&je.key===Lr.QP.UP):je.preventDefault(),je.stopPropagation(),Le({type:xt.MoveFocus,to:qr.Prev});break;case je.key===Lr.QP.HOME:je.preventDefault(),je.stopPropagation(),Le({type:xt.MoveFocus,to:qr.First});break;case je.key===Lr.QP.END:je.preventDefault(),je.stopPropagation(),Le({type:xt.MoveFocus,to:qr.Last});break;case(!re&&je.key===Lr.QP.DOWN):case(re&&!ze&&je.key===Lr.QP.RIGHT):case(re&&ze&&je.key===Lr.QP.LEFT):(Ke==null?void 0:Ke.getAttribute("aria-haspopup"))==="menu"&&(je.preventDefault(),je.stopPropagation(),Ke.click());break;case je.key===Lr.QP.ENTER:case je.key===Lr.QP.SPACE:je.preventDefault(),je.stopPropagation(),Ke==null||Ke.click();break}},[ze,De,Qe,Le,re]),ot=(0,N.useCallback)(function(je){De.some(function(Ke){return Ke.element===je.target})&&(he==null||he(je))},[De,he]);return N.createElement(vo.Provider,{value:Ie},ge({role:"menubar",tabIndex:0,onFocus:Be,onBlur:He,onKeyDown:qe,onClick:ot,"aria-activedescendant":D()(Qe)?void 0:De[Qe].element.id,"aria-orientation":re?"vertical":void 0},we))}var vs=H(82108),Sl=H.n(vs),wc;(function(G){G.HEIGHT="height",G.WIDTH="width"})(wc||(wc={}));var Kt=function(Z){return Ur()(Z,"offsetHeight")},Tl={height:["marginTop","marginBottom"],width:["marginLeft","marginRight"]};function ms(G,Z){var re=Ur()(Z,"offset"+Sl()(G)),ge=Tl[G];return re+parseInt(Xi(Z,ge[0]),10)+parseInt(Xi(Z,ge[1]),10)}function Va(G,Z){var re=Ur()(G,"scroll"+Sl()(Z));return re+"px"}var Lc=N.forwardRef(function(G,Z){var re=G.className,ge=G.timeout,he=ge===void 0?300:ge,Ie=G.dimension,Se=Ie===void 0?wc.HEIGHT:Ie,De=G.exitedClassName,Qe=G.exitingClassName,Le=G.enteredClassName,we=G.enteringClassName,Be=G.getDimensionValue,He=Be===void 0?ms:Be,We=G.onEnter,ze=G.onEntering,qe=G.onEntered,ot=G.onExit,je=G.onExiting,Ke=(0,j.Z)(G,["className","timeout","dimension","exitedClassName","exitingClassName","enteredClassName","enteringClassName","getDimensionValue","onEnter","onEntering","onEntered","onExit","onExiting"]),rt=(0,n.Z)("anim"),At=rt.prefix,yt=rt.merge,Ze=typeof Se=="function"?Se():Se,lt=(0,N.useCallback)(function(Tt){ls(Tt,Ze,0)},[Ze]),vt=(0,N.useCallback)(function(Tt){ls(Tt,Ze,Va(Tt,Ze))},[Ze]),dt=(0,N.useCallback)(function(Tt){ls(Tt,Ze,"auto")},[Ze]),gt=(0,N.useCallback)(function(Tt){var Zt=He?He(Ze,Tt):0;ls(Tt,Ze,Zt+"px")},[Ze,He]),Rt=(0,N.useCallback)(function(Tt){Kt(Tt),ls(Tt,Ze,0)},[Ze]);return N.createElement(a.ZP,(0,k.Z)({},Ke,{ref:Z,timeout:he,className:yt(re,At({"collapse-horizontal":Ze==="width"})),exitedClassName:De||At("collapse"),exitingClassName:Qe||At("collapsing"),enteredClassName:Le||At("collapse","in"),enteringClassName:we||At("collapsing"),onEnter:(0,Di.Z)(lt,We),onEntering:(0,Di.Z)(vt,ze),onEntered:(0,Di.Z)(dt,qe),onExit:(0,Di.Z)(gt,ot),onExiting:(0,Di.Z)(Rt,je)}))});Lc.displayName="Collapse",Lc.propTypes=(0,k.Z)({},a.f4,{dimension:L().any,getDimensionValue:L().func});const Rl=Lc;var Dc,wl,Ll,Vo,Aa=N.forwardRef(function(G,Z){var re=G.className,ge=G.classPrefix,he=ge===void 0?"dropdown-menu":ge,Ie=G.open,Se=(0,j.Z)(G,["className","classPrefix","open"]),De=(0,n.Z)(he),Qe=De.withClassPrefix,Le=De.merge,we=De.prefix,Be=Le(re,Qe());return N.createElement(Rl,{in:Ie,exitedClassName:we(Dc||(Dc=(0,_e.Z)(["collapse-out"]))),exitingClassName:we(wl||(wl=(0,_e.Z)(["collapsing"]))),enteredClassName:we(Ll||(Ll=(0,_e.Z)(["collapse-in"]))),enteringClassName:we(Vo||(Vo=(0,_e.Z)(["collapsing"])))},function(He,We){var ze=He.className,qe=(0,j.Z)(He,["className"]);return N.createElement("ul",(0,k.Z)({ref:l(Z,We),role:"group",className:Xn()(Be,ze)},Se,qe))})});Aa.displayName="Sidenav.Dropdown.Collapse",Aa.propTypes={className:L().string,children:L().node,classPrefix:L().string,open:L().bool};const ht=Aa;var Nn;(function(G){G[G.Show=0]="Show",G[G.Hide=1]="Hide"})(Nn||(Nn={}));var jn=N.createContext(null);jn.displayName="Disclosure.Context";const bc=jn;function Dl(G){var Z=(0,N.useContext)(bc);if(!Z)throw new Error("<"+G+"> component must be rendered within a <Disclosure>");return Z}function Yo(G){var Z=G.children,re=(0,N.useRef)(null),ge=Dl(Yo.displayName),he=ge[0].open,Ie=ge[1],Se=ge[2].onToggle,De=(0,N.useCallback)(function(we){he?(Ie({type:Nn.Hide}),Se==null||Se(!1,we)):(Ie({type:Nn.Show}),Se==null||Se(!0,we))},[he,Ie,Se]),Qe=(0,N.useCallback)(function(we){De(we)},[De]),Le=(0,N.useCallback)(function(we){switch(we.key){case Lr.QP.ENTER:case Lr.QP.SPACE:we.preventDefault(),we.stopPropagation(),De(we);break}},[De]);return Z({role:"button","aria-expanded":he,onClick:Qe,onKeyDown:Le,open:he},re)}Yo.displayName="Disclosure.Button";const Iu=Yo;function Rn(G){var Z=G.children,re=(0,N.useRef)(null),ge=Dl(Rn.displayName),he=ge[0].open;return Z({open:he},re)}Rn.displayName="Disclosure.Content";const Jo=Rn;var bl={open:!1};function ro(G,Z){switch(Z.type){case Nn.Show:return(0,k.Z)({},G,{open:!0});case Nn.Hide:return(0,k.Z)({},G,{open:!1})}return G}function Oc(G){var Z=G.children,re=G.open,ge=G.defaultOpen,he=ge===void 0?!1:ge,Ie=G.hideOnClickOutside,Se=Ie===void 0?!1:Ie,De=G.onToggle,Qe=(0,N.useReducer)(ro,(0,k.Z)({},bl,{open:he})),Le=Qe[0].open,we=Qe[1],Be=(0,N.useRef)(null),He=re!=null?re:Le;jo({enabled:Se,isOutside:function(qe){var ot;return!((ot=Be.current)!==null&&ot!==void 0&&ot.contains(qe.target))},handle:function(){return we({type:Nn.Hide})}});var We=(0,N.useMemo)(function(){return[{open:He},we,{onToggle:De}]},[He,we,De]);return N.createElement(bc.Provider,{value:We},Z({open:He},Be))}Oc.Button=Iu,Oc.Content=Jo;const io=Oc;var Ra,Es,Ya=N.forwardRef(function(G,Z){var re=G.as,ge=re===void 0?"li":re,he=G.children,Ie=G.disabled,Se=G.className,De=G.style,Qe=G.classPrefix,Le=Qe===void 0?"dropdown-item":Qe,we=G.tabIndex,Be=G.icon,He=G.title,We=G.eventKey,ze=G.onClick,qe=G.onSelect,ot=(0,j.Z)(G,["as","children","disabled","className","style","classPrefix","tabIndex","icon","title","eventKey","onClick","onSelect"]),je=(0,Eo.Z)("DropdownMenu"),Ke=je.rtl,rt=(0,n.Z)(Le),At=rt.merge,yt=rt.withClassPrefix,Ze=rt.prefix,lt=(0,N.useContext)(kr);if(!lt)throw new Error("<SidenavDropdownMenu> component is not supposed to be used standalone. Use <Dropdown.Item> inside <Sidenav> instead.");var vt=lt.openKeys,dt=vt===void 0?[]:vt,gt=lt.onOpenChange,Rt=lt.onSelect,Tt=(0,N.useCallback)(function(Yt){Ie||(qe==null||qe(We,Yt),Rt==null||Rt(We,Yt))},[Ie,qe,Rt,We]),Zt={onClick:(0,Di.Z)(Tt,ze)},ar=Ke?Pt.Z:Dt.Z;return N.createElement(io,{open:!D()(We)&&dt.includes(We),onToggle:function(tr,wr){return gt==null?void 0:gt(We,wr)}},function(Yt){var tr=Yt.open,wr=At(Se,Ze("submenu"),Ze("pull-"+(Ke?"left":"right")),Ze(tr?"expand":"collapse"),yt({"with-icon":Be,disabled:Ie}));return N.createElement(ge,(0,k.Z)({ref:Z},ot,{tabIndex:Ie?-1:we,style:De,className:wr},Zt),N.createElement(io.Button,null,function(cr){return N.createElement("button",(0,k.Z)({className:Ze(Ra||(Ra=(0,_e.Z)(["toggle"]))),onClick:Tt},ps()(cr,["open"])),Be&&N.cloneElement(Be,{className:Ze("menu-icon")}),He,N.createElement(ar,{className:Ze(Es||(Es=(0,_e.Z)(["toggle-icon"])))}),N.createElement(R,null))}),N.createElement(io.Content,null,function(cr){var Lt=cr.open;return N.createElement(ht,{open:Lt},he)}))})});Ya.displayName="Sidenav.Dropdown.Menu",Ya.propTypes={as:L().elementType,expanded:L().bool,disabled:L().bool,onSelect:L().func,onClick:L().func,icon:L().node,eventKey:L().any,className:L().string,style:L().object,children:L().node,classPrefix:L().string,tabIndex:L().number,title:L().node,onMouseOver:L().func,onMouseOut:L().func};const Ja=Ya;var za,Ol,ni=N.forwardRef(function(G,Z){var re=G.onToggle,ge=G.eventKey,he=G.title,Ie=G.activeKey,Se=G.onSelect,De=G.classPrefix,Qe=De===void 0?"dropdown-menu":De,Le=G.children,we=(0,j.Z)(G,["onToggle","eventKey","title","activeKey","onSelect","classPrefix","children"]),Be=(0,N.useContext)(to),He=(0,N.useContext)(kr),We=(0,Eo.Z)("DropdownMenu"),ze=We.rtl,qe=(0,N.useCallback)(function(cr,Lt){re==null||re(ge,Lt)},[ge,re]),ot=(0,n.Z)(Qe),je=ot.merge,Ke=ot.prefix,rt=ot.withClassPrefix,At=(0,n.Z)("dropdown-menu"),yt=At.withClassPrefix,Ze=At.merge,lt=(0,n.Z)("dropdown-item"),vt=lt.merge,dt=lt.withClassPrefix,gt=lt.prefix;if(!Be){var Rt=je(G.className,rt());return N.createElement(to.Provider,{value:{activeKey:Ie,onSelect:Se}},N.createElement(Wn,{vertical:!0,onActivateItem:function(Lt){var Br=Lt.target.dataset,Xr=Br.eventKey,hi=Br.eventKeyType,Vr=hi==="number"?Number(Xr):Xr;Se==null||Se(Vr,Lt)}},function(cr,Lt){return N.createElement("ul",(0,k.Z)({ref:l(Lt,Z),className:Rt},cr,we),Le)}))}if(He!=null&&He.expanded)return N.createElement(Ja,ps()(G,"classPrefix"));var Tt=ps()(we,["trigger"]),Zt=Tt.icon,ar=Tt.className,Yt=Tt.disabled,tr=(0,j.Z)(Tt,["icon","className","disabled"]),wr=ze?Pt.Z:Dt.Z;return N.createElement(eo,{openMenuOn:["mouseover","click"],renderMenuButton:function(Lt,Br){var Xr=Lt.open,hi=(0,j.Z)(Lt,["open"]);return N.createElement(ja,{disabled:Yt},function(Vr,si){var oi=Vr.selected,Zi=Vr.active,wn=(0,j.Z)(Vr,["selected","active"]),Pn=vt(ar,gt("pull-"+(ze?"left":"right")),gt(za||(za=(0,_e.Z)(["toggle"]))),dt({"with-icon":Zt,open:Xr,active:oi,disabled:Yt,focus:Zi}));return N.createElement("div",(0,k.Z)({ref:l(Br,si),className:Pn,"data-event-key":ge,"data-event-key-type":typeof ge},wn,ps()(hi,["role"])),Zt&&N.cloneElement(Zt,{className:Ke("menu-icon")}),he,N.createElement(wr,{className:Ke(Ol||(Ol=(0,_e.Z)(["toggle-icon"])))}))})},renderMenuPopup:function(Lt,Br){var Xr=Lt.open,hi=(0,j.Z)(Lt,["open"]),Vr=Ze(ar,yt());return N.createElement("ul",(0,k.Z)({ref:Br,className:Vr,hidden:!Xr},hi,tr),Le)},onToggleMenu:qe},function(cr,Lt){var Br=cr.open,Xr=(0,j.Z)(cr,["open"]),hi=vt(ar,dt({disabled:Yt,open:Br,submenu:!0}));return N.createElement("li",(0,k.Z)({ref:l(Z,Lt),className:hi},Xr))})});ni.displayName="Dropdown.Menu",ni.propTypes={active:L().bool,activeKey:L().any,className:L().string,children:L().node,icon:L().any,classPrefix:L().string,pullLeft:L().bool,title:L().node,open:L().bool,trigger:L().oneOf(["click","hover"]),eventKey:L().any,expanded:L().bool,collapsible:L().bool,onSelect:L().func,onToggle:L().func};const Su=ni;function qa(G){return(0,N.useCallback)(function(Z,re){return G==="li"?re?N.createElement("li",{role:"none presentation"},N.createElement(re,Z)):N.createElement(G,Z):N.createElement("li",{role:"none presentation"},N.createElement(G,Z))},[G])}var zo=N.forwardRef(function(G,Z){var re=G.as,ge=re===void 0?"li":re,he=G.active,Ie=G.children,Se=G.disabled,De=G.divider,Qe=G.panel,Le=G.className,we=G.style,Be=G.classPrefix,He=Be===void 0?"dropdown-item":Be,We=G.icon,ze=G.eventKey,qe=G.onClick,ot=G.onSelect,je=(0,j.Z)(G,["as","active","children","disabled","divider","panel","className","style","classPrefix","icon","eventKey","onClick","onSelect"]),Ke=(0,N.useContext)(kr),rt=(0,N.useContext)(to);if(!Ke||!rt)throw new Error("<SidenavDropdownItem> component is not supposed to be used standalone. Use <Dropdown.Item> within <Sidenav> instead.");var At=Ke.activeKey,yt=Ke.onSelect,Ze=(0,N.useContext)(Ir),lt=(0,n.Z)(He),vt=lt.merge,dt=lt.withClassPrefix,gt=lt.prefix,Rt=he!=null?he:!D()(ze)&&(U(ze,At)||U(Ze==null?void 0:Ze.activeKey,ze)),Tt=vt(Le,dt({"with-icon":We,active:Rt,disabled:Se})),Zt=(0,N.useCallback)(function(tr){var wr;Se||(ot==null||ot(ze,tr),(wr=rt.onSelect)===null||wr===void 0||wr.call(rt,ze,tr),yt==null||yt(ze,tr))},[Se,ot,yt,ze,rt]),ar={onClick:(0,Di.Z)(Zt,qe)},Yt=qa(ge);return De?Yt((0,k.Z)({ref:Z,role:"separator",style:we,className:vt(gt("divider"),Le)},je)):Qe?Yt((0,k.Z)({ref:Z,role:"none presentation",style:we,className:vt(gt("panel"),Le)},je,{children:Ie})):Yt((0,k.Z)({ref:Z},je,{style:we,className:Tt,"aria-current":Rt||void 0},ar,{children:N.createElement(N.Fragment,null,We&&N.cloneElement(We,{className:gt("menu-icon")}),Ie,N.createElement(R,null))}),I)});zo.displayName="Sidenav.Dropdown.Item",zo.propTypes={as:L().elementType,expanded:L().bool,active:L().bool,divider:L().bool,panel:L().bool,disabled:L().bool,submenu:L().element,onSelect:L().func,onClick:L().func,icon:L().node,eventKey:L().any,className:L().string,style:L().object,children:L().node,classPrefix:L().string,tabIndex:L().number,title:L().node,onMouseOver:L().func,onMouseOut:L().func};const Bl=zo;function Bc(G){var Z=(0,N.useRef)();return Z.current||(Z.current=Ht()("internal://"+G)),(0,N.useDebugValue)(Z.current),Z.current}var Nc={items:[]},no;(function(G){G[G.RegisterItem=0]="RegisterItem",G[G.UnregisterItem=1]="UnregisterItem",G[G.UpdateItem=2]="UpdateItem"})(no||(no={}));function Tu(G,Z){switch(G===void 0&&(G=Nc),Z.type){case no.RegisterItem:return G.items.find(function(re){return re.id===Z.payload.id})?(0,k.Z)({},G,{items:G.items.map(function(re){return re.id===Z.payload.id?(0,k.Z)({},re,{props:(0,k.Z)({},re.props,{selected:Z.payload.props.selected})}):re})}):(0,k.Z)({},G,{items:[].concat(G.items,[{id:Z.payload.id,props:Z.payload.props}])});case no.UnregisterItem:return(0,k.Z)({},G,{items:G.items.filter(function(re){return re.id!==Z.payload.id})});default:return G}}var qo=N.forwardRef(function(G,Z){var re=G.classPrefix,ge=re===void 0?"dropdown-item":re,he=G.className,Ie=G.active,Se=G.eventKey,De=G.onSelect,Qe=G.icon,Le=G.as,we=Le===void 0?"li":Le,Be=G.divider,He=G.panel,We=G.children,ze=G.disabled,qe=(0,j.Z)(G,["classPrefix","className","active","eventKey","onSelect","icon","as","divider","panel","children","disabled"]),ot=Bc("DropdownItem"),je=(0,N.useContext)(Ir),Ke=(0,N.useContext)(to),rt=(0,n.Z)(ge),At=rt.merge,yt=rt.withClassPrefix,Ze=rt.prefix,lt=(0,N.useCallback)(function(Lt){var Br;De==null||De(Se,Lt),Ke==null||(Br=Ke.onSelect)===null||Br===void 0||Br.call(Ke,Se,Lt)},[De,Se,Ke]),vt=(0,N.useContext)(kr),dt=(0,N.useContext)(Ni),gt=(0,N.useContext)(bc),Rt=gt!=null?gt:[],Tt=Rt[1],Zt=(0,N.useCallback)(function(Lt){Tt==null||Tt({type:Nn.Hide}),lt==null||lt(Lt)},[Tt,lt]),ar=Ie||!D()(Se)&&(U(Ke==null?void 0:Ke.activeKey,Se)||U(je==null?void 0:je.activeKey,Se)),Yt=Ke==null?void 0:Ke.dispatch;(0,N.useEffect)(function(){if(Yt)return Yt({type:no.RegisterItem,payload:{id:ot,props:{selected:ar}}}),function(){Yt({type:no.UnregisterItem,payload:{id:ot}})}},[ot,ar,Yt]);var tr=qa(we);if(vt!=null&&vt.expanded)return N.createElement(Bl,(0,k.Z)({ref:Z},G));if(Be)return tr((0,k.Z)({ref:Z,role:"separator",className:At(Ze("divider"),he)},qe));if(He)return tr((0,k.Z)({ref:Z,className:At(Ze("panel"),he),children:We},qe));if(dt){var wr=At(he,yt({"with-icon":Qe,disabled:ze,divider:Be,panel:He,active:ar})),cr={"data-event-key":Se};return!D()(Se)&&typeof Se!="string"&&(cr["data-event-key-type"]=typeof Se),N.createElement("li",null,N.createElement(I,(0,k.Z)({ref:Z,className:wr,"aria-current":ar||void 0},cr,qe,{as:we,onClick:(0,Di.Z)(Zt,qe.onClick)}),Qe&&N.cloneElement(Qe,{className:Ze("menu-icon")}),We))}return N.createElement(ja,{selected:ar,disabled:ze,onActivate:lt},function(Lt,Br){var Xr=Lt.selected,hi=Lt.active,Vr=(0,j.Z)(Lt,["selected","active"]),si=At(he,yt({"with-icon":Qe,active:Xr,disabled:ze,focus:hi,divider:Be,panel:He})),oi={"data-event-key":Se};return!D()(Se)&&typeof Se!="string"&&(oi["data-event-key-type"]=typeof Se),tr((0,k.Z)({ref:l(Z,Br),className:si},Vr,oi,qe,{children:N.createElement(N.Fragment,null,Qe&&N.cloneElement(Qe,{className:Ze("menu-icon")}),We)}))})});qo.displayName="Dropdown.Item",qo.propTypes={as:L().elementType,divider:L().bool,panel:L().bool,trigger:L().oneOfType([L().array,L().oneOf(["click","hover"])]),open:Qr(L().bool),active:L().bool,disabled:L().bool,pullLeft:Qr(L().bool),submenu:L().element,onSelect:L().func,onClick:L().func,icon:L().node,eventKey:L().any,className:L().string,style:L().object,children:L().node,classPrefix:L().string,tabIndex:L().number};const Nl=qo;var Ru=H(28801),wu=H(70095);function pi(G){var Z=(0,Eo.Z)("Dropdown"),re=Z.rtl;return(0,N.useMemo)(function(){switch(!0){case/^top/.test(G):return wu.Z;case/^right/.test(G):return re?Pt.Z:Dt.Z;case/^left/.test(G):return re?Dt.Z:Pt.Z;case/^bottom/.test(G):default:return Ru.Z}},[G,re])}const Lu=pi;var Xa=N.forwardRef(function(G,Z){var re=G.as,ge=re===void 0?Ge:re,he=G.className,Ie=G.classPrefix,Se=Ie===void 0?"dropdown-toggle":Ie,De=G.renderToggle,Qe=G.children,Le=G.icon,we=G.noCaret,Be=G.placement,He=Be===void 0?"bottomStart":Be,We=(0,j.Z)(G,["as","className","classPrefix","renderToggle","children","icon","noCaret","placement"]),ze=(0,N.useContext)(kr),qe=(0,N.useContext)(Ir),ot=qe.withinNav,je=(0,n.Z)(Se),Ke=je.prefix,rt=je.withClassPrefix,At=je.merge,yt=At(he,rt({"no-caret":we})),Ze=!!ze,lt=Lu(Ze?"bottomStart":He),vt=N.createElement(ge,(0,k.Z)({appearance:ot?"subtle":void 0},We,{ref:Z,className:yt}),Le&&N.cloneElement(Le,{className:Ke("icon")}),Qe,we?null:N.createElement(lt,{className:Ke("caret")}));return De?De(We,Z):vt});Xa.displayName="DropdownToggle",Xa.propTypes={className:L().string,children:L().node,icon:L().node,classPrefix:L().string,noCaret:L().bool,as:L().elementType,renderToggle:L().func,placement:L().oneOf(["bottomStart","bottomEnd","topStart","topEnd","leftStart","rightStart","leftEnd","rightEnd"])};const ne=Xa;var _o=N.forwardRef(function(G,Z){var re=G.as,ge=re===void 0?"div":re,he=G.title,Ie=G.children,Se=G.className,De=G.menuStyle,Qe=G.disabled,Le=G.renderTitle,we=G.renderToggle,Be=G.classPrefix,He=Be===void 0?"dropdown":Be,We=G.placement,ze=We===void 0?"bottomStart":We,qe=G.toggleClassName,ot=G.icon,je=G.eventKey,Ke=G.toggleAs,rt=G.noCaret,At=G.style,yt=G.onOpen,Ze=G.onClose,lt=G.open,vt=G.onToggle,dt=(0,j.Z)(G,["as","title","children","className","menuStyle","disabled","renderTitle","renderToggle","classPrefix","placement","toggleClassName","icon","eventKey","toggleAs","noCaret","style","onOpen","onClose","open","onToggle"]),gt=(0,N.useContext)(kr),Rt=(0,N.useContext)(to),Tt=(0,n.Z)(He),Zt=Tt.merge,ar=Tt.withClassPrefix,Yt=Bc("SidenavDropdown"),tr=je!=null?je:Yt;if(!gt||!Rt)throw new Error("<SidenavDropdown> component is not supposed to be used standalone. Use <Dropdown> inside <Sidenav> instead.");var wr=gt.openKeys,cr=wr===void 0?[]:wr,Lt=gt.onOpenChange,Br=Rt.hasSelectedItem,Xr=(0,N.useCallback)(function(Vr,si){Vr?Ze==null||Ze():yt==null||yt(),vt==null||vt(Vr),Lt==null||Lt(tr,si)},[Ze,yt,vt,tr,Lt]),hi=lt!=null?lt:cr.includes(tr);return N.createElement(io,{open:hi,onToggle:Xr},function(Vr,si){var oi,Zi=Vr.open,wn=Zt(Se,ar((oi={},oi["placement-"+ie()($s(ze))]=ze,oi[Zi?"expand":"collapse"]=!0,oi.disabled=Qe,oi["selected-within"]=Br,oi["no-caret"]=rt,oi)));return N.createElement(ge,(0,k.Z)({ref:l(Z,si),style:At,className:wn},dt,{"data-event-key":je}),N.createElement(io.Button,null,function(Pn,$i){return N.createElement(ne,(0,k.Z)({ref:$i,as:Ke,noCaret:rt,className:qe,renderToggle:we,icon:ot,placement:ze},ps()(Pn,["open"])),he)}),N.createElement(io.Content,null,function(Pn){var $i=Pn.open;return N.createElement(ht,{open:$i,style:De},Ie)}))})});_o.displayName="Sidenav.Dropdown",_o.propTypes={activeKey:L().any,classPrefix:L().string,placement:L().oneOf(Lr.aR),title:L().node,disabled:L().bool,icon:L().node,menuStyle:L().object,className:L().string,toggleClassName:L().string,children:L().node,tabIndex:L().number,open:Qr(L().bool),eventKey:L().any,as:L().elementType,toggleAs:L().elementType,noCaret:L().bool,style:L().object,onClose:L().func,onOpen:L().func,onToggle:L().func,onMouseEnter:L().func,onMouseLeave:L().func,onContextMenu:L().func,onClick:L().func,renderTitle:Qr(L().func),renderToggle:L().func};const Du=_o;var Co=N.forwardRef(function(G,Z){var re=G.activeKey,ge=G.onSelect,he=(0,j.Z)(G,["activeKey","onSelect"]),Ie=he.as,Se=Ie===void 0?"div":Ie,De=he.title,Qe=he.onClose,Le=he.onOpen,we=he.onToggle,Be=he.eventKey,He=he.trigger,We=He===void 0?"click":He,ze=he.placement,qe=ze===void 0?"bottomStart":ze,ot=he.toggleAs,je=he.toggleClassName,Ke=he.classPrefix,rt=Ke===void 0?"dropdown":Ke,At=he.className,yt=he.disabled,Ze=he.children,lt=he.menuStyle,vt=he.style,dt=(0,j.Z)(he,["as","title","onClose","onOpen","onToggle","eventKey","trigger","placement","toggleAs","toggleClassName","classPrefix","className","disabled","children","menuStyle","style"]),gt=(0,N.useContext)(Ir),Rt=gt.onSelect,Tt=(0,N.useCallback)(function(Zr,$r){ge==null||ge(Zr,$r),Rt==null||Rt(Zr,$r)},[ge,Rt]),Zt=(0,n.Z)(rt),ar=Zt.merge,Yt=Zt.withClassPrefix,tr=Zt.prefix,wr=(0,n.Z)("dropdown-menu"),cr=wr.withClassPrefix,Lt=wr.merge,Br=(0,n.Z)("nav-item"),Xr=Br.withClassPrefix,hi=Br.merge,Vr=(0,N.useMemo)(function(){if(!!We){var Zr={hover:"mouseover",click:"click",contextMenu:"contextmenu"};return Array.isArray(We)?We.map(function($r){return Zr[$r]}):[Zr[We]]}},[We]),si=(0,N.useContext)(vo),oi=(0,N.useContext)(kr),Zi=(0,N.useContext)(Ni),wn=(0,N.useReducer)(Tu,Nc),Pn=wn[0].items,$i=wn[1],xn=(0,N.useMemo)(function(){return Pn.some(function(Zr){return Zr.props.selected})},[Pn]),Ln=(0,N.useMemo)(function(){return{activeKey:re,onSelect:Tt,hasSelectedItem:xn,dispatch:$i}},[re,Tt,xn,$i]);if(oi!=null&&oi.expanded)return N.createElement(to.Provider,{value:Ln},N.createElement(Du,(0,k.Z)({ref:Z},he)));if(Zi)return N.createElement(to.Provider,{value:Ln},N.createElement(io,{hideOnClickOutside:!0},function(Zr,$r){var ft,ei=Zr.open,bi=ar(At,Yt((ft={},ft["placement-"+ie()($s(qe))]=!!qe,ft.disabled=yt,ft.open=ei,ft)));return N.createElement(Se,{ref:l(Z,$r),className:bi,style:vt},N.createElement(io.Button,null,function(Sr,Vn){return N.createElement(ne,(0,k.Z)({ref:Vn,as:ot,className:je,placement:qe,disabled:yt},ps()(Sr,["open"]),dt),De)}),N.createElement(io.Content,null,function(Sr,Vn){var wa=Sr.open,Za=Lt(At,cr());return N.createElement("ul",{ref:Vn,className:Za,style:lt,hidden:!wa},Ze)}))}));var Mn=function($r,ft){return N.createElement(ne,(0,k.Z)({ref:ft,as:ot,className:je,placement:qe,disabled:yt},ps()($r,["open"]),ps()(dt,["data-testid"])),De)};return si&&(Mn=function($r,ft){return N.createElement(ja,{disabled:yt},function(ei,bi){var Sr=ei.active,Vn=(0,j.Z)(ei,["active"]);return N.createElement(ne,(0,k.Z)({ref:l(ft,bi),as:ot,className:hi(je,Xr({focus:Sr}))},$r,ps()(Vn,["onClick"]),ps()(dt,"data-testid")),De)})}),N.createElement(to.Provider,{value:Ln},N.createElement(eo,{menuButtonText:De,renderMenuButton:Mn,openMenuOn:Vr,renderMenuPopup:function($r,ft){var ei=$r.open,bi=(0,j.Z)($r,["open"]),Sr=Lt(At,cr({})),Vn=!!oi;return N.createElement("ul",(0,k.Z)({ref:ft,className:Sr,style:lt,hidden:!ei},bi),Vn&&N.createElement("div",{className:tr("header")},De),Ze)},onToggleMenu:function($r,ft){we==null||we($r),oi==null||oi.onOpenChange(Be,ft),$r?Le==null||Le():Qe==null||Qe()}},function(Zr,$r){var ft,ei=Zr.open,bi=(0,j.Z)(Zr,["open"]),Sr=ar(At,Yt((ft={},ft["placement-"+ie()($s(qe))]=!!qe,ft.disabled=yt,ft.open=ei,ft.submenu=!!si,ft["selected-within"]=xn,ft)));return N.createElement(Se,(0,k.Z)({ref:l(Z,$r),className:Sr},bi,fa()(dt,["data-testid"]),{style:vt}))}))});Co.Item=Nl,Co.Menu=Su,Co.displayName="Dropdown",Co.propTypes={activeKey:L().any,classPrefix:L().string,trigger:L().oneOfType([L().array,L().oneOf(["click","hover","contextMenu"])]),placement:L().oneOf(Lr.aR),title:L().node,disabled:L().bool,icon:L().node,menuStyle:L().object,className:L().string,toggleClassName:L().string,children:L().node,open:Qr(L().bool),eventKey:L().any,as:L().elementType,toggleAs:L().elementType,noCaret:L().bool,style:L().object,onClose:L().func,onOpen:L().func,onToggle:L().func,onSelect:L().func,onMouseEnter:L().func,onMouseLeave:L().func,onContextMenu:L().func,onClick:L().func,renderToggle:L().func};const bu=Co;function Ou(G){var Z=(0,N.useRef)();return G||Z}var ga=N.forwardRef(function(G,Z){var re=G.as,ge=re===void 0?"div":re,he=G.classPrefix,Ie=he===void 0?"nav":he,Se=G.appearance,De=Se===void 0?"default":Se,Qe=G.vertical,Le=G.justified,we=G.reversed,Be=G.pullRight,He=G.className,We=G.children,ze=G.activeKey,qe=G.onSelect,ot=(0,j.Z)(G,["as","classPrefix","appearance","vertical","justified","reversed","pullRight","className","children","activeKey","onSelect"]),je=(0,N.useContext)(kr),Ke=(0,N.useContext)(Ni),rt=Ou(Z),At=(0,n.Z)(Ie),yt=At.withClassPrefix,Ze=At.merge,lt=At.rootPrefix,vt=At.prefix,dt=Ze(He,lt({"navbar-nav":Ke,"navbar-right":Be,"sidenav-nav":je}),yt(De,{horizontal:Ke||!Qe&&!je,vertical:Qe||je,justified:Le,reversed:we})),gt=je||{},Rt=gt.activeKey,Tt=gt.onSelect,Zt=Tt===void 0?qe:Tt,ar=ze!=null?ze:Rt;if(je!=null&&je.expanded)return N.createElement(Ir.Provider,{value:{withinNav:!0,activeKey:ar,onSelect:qe!=null?qe:Zt}},N.createElement("ul",(0,k.Z)({ref:Z,className:dt},ot),We));var Yt=De!=="default";return je?N.createElement(Ir.Provider,{value:{withinNav:!0,activeKey:ar,onSelect:qe!=null?qe:Zt}},N.createElement(Wn,{vertical:!!je},function(tr,wr){return N.createElement(ge,(0,k.Z)({ref:wr},ot,{className:dt},tr),We)})):N.createElement(Ir.Provider,{value:{withinNav:!0,activeKey:ar,onSelect:qe!=null?qe:Zt}},N.createElement(ge,(0,k.Z)({},ot,{ref:rt,className:dt}),We,Yt&&N.createElement("div",{className:vt("bar")})))});ga.Dropdown=bu,ga.Item=mu,ga.displayName="Nav",ga.propTypes={classPrefix:L().string,className:L().string,children:L().node,appearance:L().oneOf(["default","subtle","tabs"]),reversed:L().bool,justified:L().bool,vertical:L().bool,pullRight:L().bool,activeKey:L().any,onSelect:L().func};const Pc=ga},78440:Ne=>{(function(de,H){Ne.exports=H()})(self,function(){return(()=>{"use strict";var de={775:(k,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.FitAddon=void 0;var N=function(){function v(){}return v.prototype.activate=function(L){this._terminal=L},v.prototype.dispose=function(){},v.prototype.fit=function(){var L=this.proposeDimensions();if(L&&this._terminal){var O=this._terminal._core;this._terminal.rows===L.rows&&this._terminal.cols===L.cols||(O._renderService.clear(),this._terminal.resize(L.cols,L.rows))}},v.prototype.proposeDimensions=function(){if(this._terminal&&this._terminal.element&&this._terminal.element.parentElement){var L=this._terminal._core;if(L._renderService.dimensions.actualCellWidth!==0&&L._renderService.dimensions.actualCellHeight!==0){var O=window.getComputedStyle(this._terminal.element.parentElement),D=parseInt(O.getPropertyValue("height")),w=Math.max(0,parseInt(O.getPropertyValue("width"))),g=window.getComputedStyle(this._terminal.element),b=D-(parseInt(g.getPropertyValue("padding-top"))+parseInt(g.getPropertyValue("padding-bottom"))),T=w-(parseInt(g.getPropertyValue("padding-right"))+parseInt(g.getPropertyValue("padding-left")))-L.viewport.scrollBarWidth;return{cols:Math.max(2,Math.floor(T/L._renderService.dimensions.actualCellWidth)),rows:Math.max(1,Math.floor(b/L._renderService.dimensions.actualCellHeight))}}}},v}();j.FitAddon=N}},H={};return function k(j){if(H[j])return H[j].exports;var N=H[j]={exports:{}};return de[j](N,N.exports,k),N.exports}(775)})()})},77289:Ne=>{(function(de,H){if(!0)Ne.exports=H();else var k,j})(self,function(){return(()=>{"use strict";var de={4567:function(N,v,L){var O,D=this&&this.__extends||(O=function(a,n){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,l){s.__proto__=l}||function(s,l){for(var d in l)Object.prototype.hasOwnProperty.call(l,d)&&(s[d]=l[d])},O(a,n)},function(a,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function s(){this.constructor=a}O(a,n),a.prototype=n===null?Object.create(n):(s.prototype=n.prototype,new s)});Object.defineProperty(v,"__esModule",{value:!0}),v.AccessibilityManager=void 0;var w=L(9042),g=L(6114),b=L(9924),T=L(3656),f=L(844),p=L(5596),E=L(9631),u=function(a){function n(s,l){var d=a.call(this)||this;d._terminal=s,d._renderService=l,d._liveRegionLineCount=0,d._charsToConsume=[],d._charsToAnnounce="",d._accessibilityTreeRoot=document.createElement("div"),d._accessibilityTreeRoot.setAttribute("role","document"),d._accessibilityTreeRoot.classList.add("xterm-accessibility"),d._rowContainer=document.createElement("div"),d._rowContainer.setAttribute("role","list"),d._rowContainer.classList.add("xterm-accessibility-tree"),d._rowElements=[];for(var A=0;A<d._terminal.rows;A++)d._rowElements[A]=d._createAccessibilityTreeNode(),d._rowContainer.appendChild(d._rowElements[A]);if(d._topBoundaryFocusListener=function(S){return d._onBoundaryFocus(S,0)},d._bottomBoundaryFocusListener=function(S){return d._onBoundaryFocus(S,1)},d._rowElements[0].addEventListener("focus",d._topBoundaryFocusListener),d._rowElements[d._rowElements.length-1].addEventListener("focus",d._bottomBoundaryFocusListener),d._refreshRowsDimensions(),d._accessibilityTreeRoot.appendChild(d._rowContainer),d._renderRowsDebouncer=new b.TimeBasedDebouncer(d._renderRows.bind(d)),d._refreshRows(),d._liveRegion=document.createElement("div"),d._liveRegion.classList.add("live-region"),d._liveRegion.setAttribute("aria-live","assertive"),d._accessibilityTreeRoot.appendChild(d._liveRegion),!d._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");return d._terminal.element.insertAdjacentElement("afterbegin",d._accessibilityTreeRoot),d.register(d._renderRowsDebouncer),d.register(d._terminal.onResize(function(S){return d._onResize(S.rows)})),d.register(d._terminal.onRender(function(S){return d._refreshRows(S.start,S.end)})),d.register(d._terminal.onScroll(function(){return d._refreshRows()})),d.register(d._terminal.onA11yChar(function(S){return d._onChar(S)})),d.register(d._terminal.onLineFeed(function(){return d._onChar(`
|
|
166
|
+
`)})),d.register(d._terminal.onA11yTab(function(S){return d._onTab(S)})),d.register(d._terminal.onKey(function(S){return d._onKey(S.key)})),d.register(d._terminal.onBlur(function(){return d._clearLiveRegion()})),d.register(d._renderService.onDimensionsChange(function(){return d._refreshRowsDimensions()})),d._screenDprMonitor=new p.ScreenDprMonitor,d.register(d._screenDprMonitor),d._screenDprMonitor.setListener(function(){return d._refreshRowsDimensions()}),d.register((0,T.addDisposableDomListener)(window,"resize",function(){return d._refreshRowsDimensions()})),d}return D(n,a),n.prototype.dispose=function(){a.prototype.dispose.call(this),(0,E.removeElementFromParent)(this._accessibilityTreeRoot),this._rowElements.length=0},n.prototype._onBoundaryFocus=function(s,l){var d=s.target,A=this._rowElements[l===0?1:this._rowElements.length-2];if(d.getAttribute("aria-posinset")!==(l===0?"1":""+this._terminal.buffer.lines.length)&&s.relatedTarget===A){var S,R;if(l===0?(S=d,R=this._rowElements.pop(),this._rowContainer.removeChild(R)):(S=this._rowElements.shift(),R=d,this._rowContainer.removeChild(S)),S.removeEventListener("focus",this._topBoundaryFocusListener),R.removeEventListener("focus",this._bottomBoundaryFocusListener),l===0){var y=this._createAccessibilityTreeNode();this._rowElements.unshift(y),this._rowContainer.insertAdjacentElement("afterbegin",y)}else y=this._createAccessibilityTreeNode(),this._rowElements.push(y),this._rowContainer.appendChild(y);this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(l===0?-1:1),this._rowElements[l===0?1:this._rowElements.length-2].focus(),s.preventDefault(),s.stopImmediatePropagation()}},n.prototype._onResize=function(s){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(var l=this._rowContainer.children.length;l<this._terminal.rows;l++)this._rowElements[l]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[l]);for(;this._rowElements.length>s;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()},n.prototype._createAccessibilityTreeNode=function(){var s=document.createElement("div");return s.setAttribute("role","listitem"),s.tabIndex=-1,this._refreshRowDimensions(s),s},n.prototype._onTab=function(s){for(var l=0;l<s;l++)this._onChar(" ")},n.prototype._onChar=function(s){var l=this;this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==s&&(this._charsToAnnounce+=s):this._charsToAnnounce+=s,s===`
|
|
167
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=w.tooMuchOutput)),g.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout(function(){l._accessibilityTreeRoot.appendChild(l._liveRegion)},0))},n.prototype._clearLiveRegion=function(){this._liveRegion.textContent="",this._liveRegionLineCount=0,g.isMac&&(0,E.removeElementFromParent)(this._liveRegion)},n.prototype._onKey=function(s){this._clearLiveRegion(),this._charsToConsume.push(s)},n.prototype._refreshRows=function(s,l){this._renderRowsDebouncer.refresh(s,l,this._terminal.rows)},n.prototype._renderRows=function(s,l){for(var d=this._terminal.buffer,A=d.lines.length.toString(),S=s;S<=l;S++){var R=d.translateBufferLineToString(d.ydisp+S,!0),y=(d.ydisp+S+1).toString(),_=this._rowElements[S];_&&(R.length===0?_.innerText="\xA0":_.textContent=R,_.setAttribute("aria-posinset",y),_.setAttribute("aria-setsize",A))}this._announceCharacters()},n.prototype._refreshRowsDimensions=function(){if(this._renderService.dimensions.actualCellHeight){this._rowElements.length!==this._terminal.rows&&this._onResize(this._terminal.rows);for(var s=0;s<this._terminal.rows;s++)this._refreshRowDimensions(this._rowElements[s])}},n.prototype._refreshRowDimensions=function(s){s.style.height=this._renderService.dimensions.actualCellHeight+"px"},n.prototype._announceCharacters=function(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")},n}(f.Disposable);v.AccessibilityManager=u},3614:(N,v)=>{function L(g){return g.replace(/\r?\n/g,"\r")}function O(g,b){return b?"[200~"+g+"[201~":g}function D(g,b,T){g=O(g=L(g),T.decPrivateModes.bracketedPasteMode),T.triggerDataEvent(g,!0),b.value=""}function w(g,b,T){var f=T.getBoundingClientRect(),p=g.clientX-f.left-10,E=g.clientY-f.top-10;b.style.width="20px",b.style.height="20px",b.style.left=p+"px",b.style.top=E+"px",b.style.zIndex="1000",b.focus()}Object.defineProperty(v,"__esModule",{value:!0}),v.rightClickHandler=v.moveTextAreaUnderMouseCursor=v.paste=v.handlePasteEvent=v.copyHandler=v.bracketTextForPaste=v.prepareTextForTerminal=void 0,v.prepareTextForTerminal=L,v.bracketTextForPaste=O,v.copyHandler=function(g,b){g.clipboardData&&g.clipboardData.setData("text/plain",b.selectionText),g.preventDefault()},v.handlePasteEvent=function(g,b,T){g.stopPropagation(),g.clipboardData&&D(g.clipboardData.getData("text/plain"),b,T)},v.paste=D,v.moveTextAreaUnderMouseCursor=w,v.rightClickHandler=function(g,b,T,f,p){w(g,b,T),p&&f.rightClickSelect(g),b.value=f.selectionText,b.select()}},4774:(N,v)=>{var L,O,D,w;function g(T){var f=T.toString(16);return f.length<2?"0"+f:f}function b(T,f){return T<f?(f+.05)/(T+.05):(T+.05)/(f+.05)}Object.defineProperty(v,"__esModule",{value:!0}),v.contrastRatio=v.toPaddedHex=v.rgba=v.rgb=v.css=v.color=v.channels=void 0,function(T){T.toCss=function(f,p,E,u){return u!==void 0?"#"+g(f)+g(p)+g(E)+g(u):"#"+g(f)+g(p)+g(E)},T.toRgba=function(f,p,E,u){return u===void 0&&(u=255),(f<<24|p<<16|E<<8|u)>>>0}}(L=v.channels||(v.channels={})),(O=v.color||(v.color={})).blend=function(T,f){var p=(255&f.rgba)/255;if(p===1)return{css:f.css,rgba:f.rgba};var E=f.rgba>>24&255,u=f.rgba>>16&255,a=f.rgba>>8&255,n=T.rgba>>24&255,s=T.rgba>>16&255,l=T.rgba>>8&255,d=n+Math.round((E-n)*p),A=s+Math.round((u-s)*p),S=l+Math.round((a-l)*p);return{css:L.toCss(d,A,S),rgba:L.toRgba(d,A,S)}},O.isOpaque=function(T){return(255&T.rgba)==255},O.ensureContrastRatio=function(T,f,p){var E=w.ensureContrastRatio(T.rgba,f.rgba,p);if(E)return w.toColor(E>>24&255,E>>16&255,E>>8&255)},O.opaque=function(T){var f=(255|T.rgba)>>>0,p=w.toChannels(f),E=p[0],u=p[1],a=p[2];return{css:L.toCss(E,u,a),rgba:f}},O.opacity=function(T,f){var p=Math.round(255*f),E=w.toChannels(T.rgba),u=E[0],a=E[1],n=E[2];return{css:L.toCss(u,a,n,p),rgba:L.toRgba(u,a,n,p)}},(v.css||(v.css={})).toColor=function(T){switch(T.length){case 7:return{css:T,rgba:(parseInt(T.slice(1),16)<<8|255)>>>0};case 9:return{css:T,rgba:parseInt(T.slice(1),16)>>>0}}throw new Error("css.toColor: Unsupported css format")},function(T){function f(p,E,u){var a=p/255,n=E/255,s=u/255;return .2126*(a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4))+.7152*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))+.0722*(s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4))}T.relativeLuminance=function(p){return f(p>>16&255,p>>8&255,255&p)},T.relativeLuminance2=f}(D=v.rgb||(v.rgb={})),function(T){function f(E,u,a){for(var n=E>>24&255,s=E>>16&255,l=E>>8&255,d=u>>24&255,A=u>>16&255,S=u>>8&255,R=b(D.relativeLuminance2(d,S,A),D.relativeLuminance2(n,s,l));R<a&&(d>0||A>0||S>0);)d-=Math.max(0,Math.ceil(.1*d)),A-=Math.max(0,Math.ceil(.1*A)),S-=Math.max(0,Math.ceil(.1*S)),R=b(D.relativeLuminance2(d,S,A),D.relativeLuminance2(n,s,l));return(d<<24|A<<16|S<<8|255)>>>0}function p(E,u,a){for(var n=E>>24&255,s=E>>16&255,l=E>>8&255,d=u>>24&255,A=u>>16&255,S=u>>8&255,R=b(D.relativeLuminance2(d,S,A),D.relativeLuminance2(n,s,l));R<a&&(d<255||A<255||S<255);)d=Math.min(255,d+Math.ceil(.1*(255-d))),A=Math.min(255,A+Math.ceil(.1*(255-A))),S=Math.min(255,S+Math.ceil(.1*(255-S))),R=b(D.relativeLuminance2(d,S,A),D.relativeLuminance2(n,s,l));return(d<<24|A<<16|S<<8|255)>>>0}T.ensureContrastRatio=function(E,u,a){var n=D.relativeLuminance(E>>8),s=D.relativeLuminance(u>>8);if(b(n,s)<a)return s<n?f(E,u,a):p(E,u,a)},T.reduceLuminance=f,T.increaseLuminance=p,T.toChannels=function(E){return[E>>24&255,E>>16&255,E>>8&255,255&E]},T.toColor=function(E,u,a){return{css:L.toCss(E,u,a),rgba:L.toRgba(E,u,a)}}}(w=v.rgba||(v.rgba={})),v.toPaddedHex=g,v.contrastRatio=b},7239:(N,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.ColorContrastCache=void 0;var L=function(){function O(){this._color={},this._rgba={}}return O.prototype.clear=function(){this._color={},this._rgba={}},O.prototype.setCss=function(D,w,g){this._rgba[D]||(this._rgba[D]={}),this._rgba[D][w]=g},O.prototype.getCss=function(D,w){return this._rgba[D]?this._rgba[D][w]:void 0},O.prototype.setColor=function(D,w,g){this._color[D]||(this._color[D]={}),this._color[D][w]=g},O.prototype.getColor=function(D,w){return this._color[D]?this._color[D][w]:void 0},O}();v.ColorContrastCache=L},5680:(N,v,L)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.ColorManager=v.DEFAULT_ANSI_COLORS=void 0;var O=L(4774),D=L(7239),w=O.css.toColor("#ffffff"),g=O.css.toColor("#000000"),b=O.css.toColor("#ffffff"),T=O.css.toColor("#000000"),f={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};v.DEFAULT_ANSI_COLORS=Object.freeze(function(){for(var E=[O.css.toColor("#2e3436"),O.css.toColor("#cc0000"),O.css.toColor("#4e9a06"),O.css.toColor("#c4a000"),O.css.toColor("#3465a4"),O.css.toColor("#75507b"),O.css.toColor("#06989a"),O.css.toColor("#d3d7cf"),O.css.toColor("#555753"),O.css.toColor("#ef2929"),O.css.toColor("#8ae234"),O.css.toColor("#fce94f"),O.css.toColor("#729fcf"),O.css.toColor("#ad7fa8"),O.css.toColor("#34e2e2"),O.css.toColor("#eeeeec")],u=[0,95,135,175,215,255],a=0;a<216;a++){var n=u[a/36%6|0],s=u[a/6%6|0],l=u[a%6];E.push({css:O.channels.toCss(n,s,l),rgba:O.channels.toRgba(n,s,l)})}for(a=0;a<24;a++){var d=8+10*a;E.push({css:O.channels.toCss(d,d,d),rgba:O.channels.toRgba(d,d,d)})}return E}());var p=function(){function E(u,a){this.allowTransparency=a;var n=u.createElement("canvas");n.width=1,n.height=1;var s=n.getContext("2d");if(!s)throw new Error("Could not get rendering context");this._ctx=s,this._ctx.globalCompositeOperation="copy",this._litmusColor=this._ctx.createLinearGradient(0,0,1,1),this._contrastCache=new D.ColorContrastCache,this.colors={foreground:w,background:g,cursor:b,cursorAccent:T,selectionTransparent:f,selectionOpaque:O.color.blend(g,f),ansi:v.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache}}return E.prototype.onOptionsChange=function(u){u==="minimumContrastRatio"&&this._contrastCache.clear()},E.prototype.setTheme=function(u){u===void 0&&(u={}),this.colors.foreground=this._parseColor(u.foreground,w),this.colors.background=this._parseColor(u.background,g),this.colors.cursor=this._parseColor(u.cursor,b,!0),this.colors.cursorAccent=this._parseColor(u.cursorAccent,T,!0),this.colors.selectionTransparent=this._parseColor(u.selection,f,!0),this.colors.selectionOpaque=O.color.blend(this.colors.background,this.colors.selectionTransparent),O.color.isOpaque(this.colors.selectionTransparent)&&(this.colors.selectionTransparent=O.color.opacity(this.colors.selectionTransparent,.3)),this.colors.ansi[0]=this._parseColor(u.black,v.DEFAULT_ANSI_COLORS[0]),this.colors.ansi[1]=this._parseColor(u.red,v.DEFAULT_ANSI_COLORS[1]),this.colors.ansi[2]=this._parseColor(u.green,v.DEFAULT_ANSI_COLORS[2]),this.colors.ansi[3]=this._parseColor(u.yellow,v.DEFAULT_ANSI_COLORS[3]),this.colors.ansi[4]=this._parseColor(u.blue,v.DEFAULT_ANSI_COLORS[4]),this.colors.ansi[5]=this._parseColor(u.magenta,v.DEFAULT_ANSI_COLORS[5]),this.colors.ansi[6]=this._parseColor(u.cyan,v.DEFAULT_ANSI_COLORS[6]),this.colors.ansi[7]=this._parseColor(u.white,v.DEFAULT_ANSI_COLORS[7]),this.colors.ansi[8]=this._parseColor(u.brightBlack,v.DEFAULT_ANSI_COLORS[8]),this.colors.ansi[9]=this._parseColor(u.brightRed,v.DEFAULT_ANSI_COLORS[9]),this.colors.ansi[10]=this._parseColor(u.brightGreen,v.DEFAULT_ANSI_COLORS[10]),this.colors.ansi[11]=this._parseColor(u.brightYellow,v.DEFAULT_ANSI_COLORS[11]),this.colors.ansi[12]=this._parseColor(u.brightBlue,v.DEFAULT_ANSI_COLORS[12]),this.colors.ansi[13]=this._parseColor(u.brightMagenta,v.DEFAULT_ANSI_COLORS[13]),this.colors.ansi[14]=this._parseColor(u.brightCyan,v.DEFAULT_ANSI_COLORS[14]),this.colors.ansi[15]=this._parseColor(u.brightWhite,v.DEFAULT_ANSI_COLORS[15]),this._contrastCache.clear()},E.prototype._parseColor=function(u,a,n){if(n===void 0&&(n=this.allowTransparency),u===void 0)return a;if(this._ctx.fillStyle=this._litmusColor,this._ctx.fillStyle=u,typeof this._ctx.fillStyle!="string")return console.warn("Color: "+u+" is invalid using fallback "+a.css),a;this._ctx.fillRect(0,0,1,1);var s=this._ctx.getImageData(0,0,1,1).data;if(s[3]!==255){if(!n)return console.warn("Color: "+u+" is using transparency, but allowTransparency is false. Using fallback "+a.css+"."),a;var l=this._ctx.fillStyle.substring(5,this._ctx.fillStyle.length-1).split(",").map(function(_){return Number(_)}),d=l[0],A=l[1],S=l[2],R=l[3],y=Math.round(255*R);return{rgba:O.channels.toRgba(d,A,S,y),css:u}}return{css:this._ctx.fillStyle,rgba:O.channels.toRgba(s[0],s[1],s[2],s[3])}},E}();v.ColorManager=p},9631:(N,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.removeElementFromParent=void 0,v.removeElementFromParent=function(){for(var L,O=[],D=0;D<arguments.length;D++)O[D]=arguments[D];for(var w=0,g=O;w<g.length;w++){var b=g[w];(L=b==null?void 0:b.parentElement)===null||L===void 0||L.removeChild(b)}}},3656:(N,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.addDisposableDomListener=void 0,v.addDisposableDomListener=function(L,O,D,w){L.addEventListener(O,D,w);var g=!1;return{dispose:function(){g||(g=!0,L.removeEventListener(O,D,w))}}}},3551:function(N,v,L){var O=this&&this.__decorate||function(f,p,E,u){var a,n=arguments.length,s=n<3?p:u===null?u=Object.getOwnPropertyDescriptor(p,E):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(f,p,E,u);else for(var l=f.length-1;l>=0;l--)(a=f[l])&&(s=(n<3?a(s):n>3?a(p,E,s):a(p,E))||s);return n>3&&s&&Object.defineProperty(p,E,s),s},D=this&&this.__param||function(f,p){return function(E,u){p(E,u,f)}};Object.defineProperty(v,"__esModule",{value:!0}),v.MouseZone=v.Linkifier=void 0;var w=L(8460),g=L(2585),b=function(){function f(p,E,u){this._bufferService=p,this._logService=E,this._unicodeService=u,this._linkMatchers=[],this._nextLinkMatcherId=0,this._onShowLinkUnderline=new w.EventEmitter,this._onHideLinkUnderline=new w.EventEmitter,this._onLinkTooltip=new w.EventEmitter,this._rowsToLinkify={start:void 0,end:void 0}}return Object.defineProperty(f.prototype,"onShowLinkUnderline",{get:function(){return this._onShowLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"onHideLinkUnderline",{get:function(){return this._onHideLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"onLinkTooltip",{get:function(){return this._onLinkTooltip.event},enumerable:!1,configurable:!0}),f.prototype.attachToDom=function(p,E){this._element=p,this._mouseZoneManager=E},f.prototype.linkifyRows=function(p,E){var u=this;this._mouseZoneManager&&(this._rowsToLinkify.start===void 0||this._rowsToLinkify.end===void 0?(this._rowsToLinkify.start=p,this._rowsToLinkify.end=E):(this._rowsToLinkify.start=Math.min(this._rowsToLinkify.start,p),this._rowsToLinkify.end=Math.max(this._rowsToLinkify.end,E)),this._mouseZoneManager.clearAll(p,E),this._rowsTimeoutId&&clearTimeout(this._rowsTimeoutId),this._rowsTimeoutId=setTimeout(function(){return u._linkifyRows()},f._timeBeforeLatency))},f.prototype._linkifyRows=function(){this._rowsTimeoutId=void 0;var p=this._bufferService.buffer;if(this._rowsToLinkify.start!==void 0&&this._rowsToLinkify.end!==void 0){var E=p.ydisp+this._rowsToLinkify.start;if(!(E>=p.lines.length)){for(var u=p.ydisp+Math.min(this._rowsToLinkify.end,this._bufferService.rows)+1,a=Math.ceil(2e3/this._bufferService.cols),n=this._bufferService.buffer.iterator(!1,E,u,a,a);n.hasNext();)for(var s=n.next(),l=0;l<this._linkMatchers.length;l++)this._doLinkifyRow(s.range.first,s.content,this._linkMatchers[l]);this._rowsToLinkify.start=void 0,this._rowsToLinkify.end=void 0}}else this._logService.debug("_rowToLinkify was unset before _linkifyRows was called")},f.prototype.registerLinkMatcher=function(p,E,u){if(u===void 0&&(u={}),!E)throw new Error("handler must be defined");var a={id:this._nextLinkMatcherId++,regex:p,handler:E,matchIndex:u.matchIndex,validationCallback:u.validationCallback,hoverTooltipCallback:u.tooltipCallback,hoverLeaveCallback:u.leaveCallback,willLinkActivate:u.willLinkActivate,priority:u.priority||0};return this._addLinkMatcherToList(a),a.id},f.prototype._addLinkMatcherToList=function(p){if(this._linkMatchers.length!==0){for(var E=this._linkMatchers.length-1;E>=0;E--)if(p.priority<=this._linkMatchers[E].priority)return void this._linkMatchers.splice(E+1,0,p);this._linkMatchers.splice(0,0,p)}else this._linkMatchers.push(p)},f.prototype.deregisterLinkMatcher=function(p){for(var E=0;E<this._linkMatchers.length;E++)if(this._linkMatchers[E].id===p)return this._linkMatchers.splice(E,1),!0;return!1},f.prototype._doLinkifyRow=function(p,E,u){for(var a,n=this,s=new RegExp(u.regex.source,(u.regex.flags||"")+"g"),l=-1,d=function(){var S=a[typeof u.matchIndex!="number"?0:u.matchIndex];if(!S)return A._logService.debug("match found without corresponding matchIndex",a,u),"break";if(l=E.indexOf(S,l+1),s.lastIndex=l+S.length,l<0)return"break";var R=A._bufferService.buffer.stringIndexToBufferIndex(p,l);if(R[0]<0)return"break";var y=A._bufferService.buffer.lines.get(R[0]);if(!y)return"break";var _=y.getFg(R[1]),m=_?_>>9&511:void 0;u.validationCallback?u.validationCallback(S,function(I){n._rowsTimeoutId||I&&n._addLink(R[1],R[0]-n._bufferService.buffer.ydisp,S,u,m)}):A._addLink(R[1],R[0]-A._bufferService.buffer.ydisp,S,u,m)},A=this;(a=s.exec(E))!==null&&d()!=="break";);},f.prototype._addLink=function(p,E,u,a,n){var s=this;if(this._mouseZoneManager&&this._element){var l=this._unicodeService.getStringCellWidth(u),d=p%this._bufferService.cols,A=E+Math.floor(p/this._bufferService.cols),S=(d+l)%this._bufferService.cols,R=A+Math.floor((d+l)/this._bufferService.cols);S===0&&(S=this._bufferService.cols,R--),this._mouseZoneManager.add(new T(d+1,A+1,S+1,R+1,function(y){if(a.handler)return a.handler(y,u);var _=window.open();_?(_.opener=null,_.location.href=u):console.warn("Opening link blocked as opener could not be cleared")},function(){s._onShowLinkUnderline.fire(s._createLinkHoverEvent(d,A,S,R,n)),s._element.classList.add("xterm-cursor-pointer")},function(y){s._onLinkTooltip.fire(s._createLinkHoverEvent(d,A,S,R,n)),a.hoverTooltipCallback&&a.hoverTooltipCallback(y,u,{start:{x:d,y:A},end:{x:S,y:R}})},function(){s._onHideLinkUnderline.fire(s._createLinkHoverEvent(d,A,S,R,n)),s._element.classList.remove("xterm-cursor-pointer"),a.hoverLeaveCallback&&a.hoverLeaveCallback()},function(y){return!a.willLinkActivate||a.willLinkActivate(y,u)}))}},f.prototype._createLinkHoverEvent=function(p,E,u,a,n){return{x1:p,y1:E,x2:u,y2:a,cols:this._bufferService.cols,fg:n}},f._timeBeforeLatency=200,f=O([D(0,g.IBufferService),D(1,g.ILogService),D(2,g.IUnicodeService)],f)}();v.Linkifier=b;var T=function(f,p,E,u,a,n,s,l,d){this.x1=f,this.y1=p,this.x2=E,this.y2=u,this.clickCallback=a,this.hoverCallback=n,this.tooltipCallback=s,this.leaveCallback=l,this.willLinkActivate=d};v.MouseZone=T},6465:function(N,v,L){var O,D=this&&this.__extends||(O=function(u,a){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var l in s)Object.prototype.hasOwnProperty.call(s,l)&&(n[l]=s[l])},O(u,a)},function(u,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");function n(){this.constructor=u}O(u,a),u.prototype=a===null?Object.create(a):(n.prototype=a.prototype,new n)}),w=this&&this.__decorate||function(u,a,n,s){var l,d=arguments.length,A=d<3?a:s===null?s=Object.getOwnPropertyDescriptor(a,n):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(u,a,n,s);else for(var S=u.length-1;S>=0;S--)(l=u[S])&&(A=(d<3?l(A):d>3?l(a,n,A):l(a,n))||A);return d>3&&A&&Object.defineProperty(a,n,A),A},g=this&&this.__param||function(u,a){return function(n,s){a(n,s,u)}};Object.defineProperty(v,"__esModule",{value:!0}),v.Linkifier2=void 0;var b=L(2585),T=L(8460),f=L(844),p=L(3656),E=function(u){function a(n){var s=u.call(this)||this;return s._bufferService=n,s._linkProviders=[],s._linkCacheDisposables=[],s._isMouseOut=!0,s._activeLine=-1,s._onShowLinkUnderline=s.register(new T.EventEmitter),s._onHideLinkUnderline=s.register(new T.EventEmitter),s.register((0,f.getDisposeArrayDisposable)(s._linkCacheDisposables)),s}return D(a,u),Object.defineProperty(a.prototype,"currentLink",{get:function(){return this._currentLink},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"onShowLinkUnderline",{get:function(){return this._onShowLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"onHideLinkUnderline",{get:function(){return this._onHideLinkUnderline.event},enumerable:!1,configurable:!0}),a.prototype.registerLinkProvider=function(n){var s=this;return this._linkProviders.push(n),{dispose:function(){var l=s._linkProviders.indexOf(n);l!==-1&&s._linkProviders.splice(l,1)}}},a.prototype.attachToDom=function(n,s,l){var d=this;this._element=n,this._mouseService=s,this._renderService=l,this.register((0,p.addDisposableDomListener)(this._element,"mouseleave",function(){d._isMouseOut=!0,d._clearCurrentLink()})),this.register((0,p.addDisposableDomListener)(this._element,"mousemove",this._onMouseMove.bind(this))),this.register((0,p.addDisposableDomListener)(this._element,"click",this._onClick.bind(this)))},a.prototype._onMouseMove=function(n){if(this._lastMouseEvent=n,this._element&&this._mouseService){var s=this._positionFromMouseEvent(n,this._element,this._mouseService);if(s){this._isMouseOut=!1;for(var l=n.composedPath(),d=0;d<l.length;d++){var A=l[d];if(A.classList.contains("xterm"))break;if(A.classList.contains("xterm-hover"))return}this._lastBufferCell&&s.x===this._lastBufferCell.x&&s.y===this._lastBufferCell.y||(this._onHover(s),this._lastBufferCell=s)}}},a.prototype._onHover=function(n){if(this._activeLine!==n.y)return this._clearCurrentLink(),void this._askForLink(n,!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,n)||(this._clearCurrentLink(),this._askForLink(n,!0))},a.prototype._askForLink=function(n,s){var l,d=this;this._activeProviderReplies&&s||((l=this._activeProviderReplies)===null||l===void 0||l.forEach(function(S){S==null||S.forEach(function(R){R.link.dispose&&R.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=n.y);var A=!1;this._linkProviders.forEach(function(S,R){var y;s?((y=d._activeProviderReplies)===null||y===void 0?void 0:y.get(R))&&(A=d._checkLinkProviderResult(R,n,A)):S.provideLinks(n.y,function(_){var m,I;if(!d._isMouseOut){var B=_==null?void 0:_.map(function(P){return{link:P}});(m=d._activeProviderReplies)===null||m===void 0||m.set(R,B),A=d._checkLinkProviderResult(R,n,A),((I=d._activeProviderReplies)===null||I===void 0?void 0:I.size)===d._linkProviders.length&&d._removeIntersectingLinks(n.y,d._activeProviderReplies)}})})},a.prototype._removeIntersectingLinks=function(n,s){for(var l=new Set,d=0;d<s.size;d++){var A=s.get(d);if(A)for(var S=0;S<A.length;S++)for(var R=A[S],y=R.link.range.start.y<n?0:R.link.range.start.x,_=R.link.range.end.y>n?this._bufferService.cols:R.link.range.end.x,m=y;m<=_;m++){if(l.has(m)){A.splice(S--,1);break}l.add(m)}}},a.prototype._checkLinkProviderResult=function(n,s,l){var d,A=this;if(!this._activeProviderReplies)return l;for(var S=this._activeProviderReplies.get(n),R=!1,y=0;y<n;y++)this._activeProviderReplies.has(y)&&!this._activeProviderReplies.get(y)||(R=!0);if(!R&&S){var _=S.find(function(I){return A._linkAtPosition(I.link,s)});_&&(l=!0,this._handleNewLink(_))}if(this._activeProviderReplies.size===this._linkProviders.length&&!l)for(y=0;y<this._activeProviderReplies.size;y++){var m=(d=this._activeProviderReplies.get(y))===null||d===void 0?void 0:d.find(function(I){return A._linkAtPosition(I.link,s)});if(m){l=!0,this._handleNewLink(m);break}}return l},a.prototype._onClick=function(n){if(this._element&&this._mouseService&&this._currentLink){var s=this._positionFromMouseEvent(n,this._element,this._mouseService);s&&this._linkAtPosition(this._currentLink.link,s)&&this._currentLink.link.activate(n,this._currentLink.link.text)}},a.prototype._clearCurrentLink=function(n,s){this._element&&this._currentLink&&this._lastMouseEvent&&(!n||!s||this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=s)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,f.disposeArray)(this._linkCacheDisposables))},a.prototype._handleNewLink=function(n){var s=this;if(this._element&&this._lastMouseEvent&&this._mouseService){var l=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);l&&this._linkAtPosition(n.link,l)&&(this._currentLink=n,this._currentLink.state={decorations:{underline:n.link.decorations===void 0||n.link.decorations.underline,pointerCursor:n.link.decorations===void 0||n.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,n.link,this._lastMouseEvent),n.link.decorations={},Object.defineProperties(n.link.decorations,{pointerCursor:{get:function(){var d,A;return(A=(d=s._currentLink)===null||d===void 0?void 0:d.state)===null||A===void 0?void 0:A.decorations.pointerCursor},set:function(d){var A,S;((A=s._currentLink)===null||A===void 0?void 0:A.state)&&s._currentLink.state.decorations.pointerCursor!==d&&(s._currentLink.state.decorations.pointerCursor=d,s._currentLink.state.isHovered&&((S=s._element)===null||S===void 0||S.classList.toggle("xterm-cursor-pointer",d)))}},underline:{get:function(){var d,A;return(A=(d=s._currentLink)===null||d===void 0?void 0:d.state)===null||A===void 0?void 0:A.decorations.underline},set:function(d){var A,S,R;((A=s._currentLink)===null||A===void 0?void 0:A.state)&&((R=(S=s._currentLink)===null||S===void 0?void 0:S.state)===null||R===void 0?void 0:R.decorations.underline)!==d&&(s._currentLink.state.decorations.underline=d,s._currentLink.state.isHovered&&s._fireUnderlineEvent(n.link,d))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedBufferChange(function(d){var A=d.start===0?0:d.start+1+s._bufferService.buffer.ydisp;s._clearCurrentLink(A,d.end+1+s._bufferService.buffer.ydisp)})))}},a.prototype._linkHover=function(n,s,l){var d;((d=this._currentLink)===null||d===void 0?void 0:d.state)&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(s,!0),this._currentLink.state.decorations.pointerCursor&&n.classList.add("xterm-cursor-pointer")),s.hover&&s.hover(l,s.text)},a.prototype._fireUnderlineEvent=function(n,s){var l=n.range,d=this._bufferService.buffer.ydisp,A=this._createLinkUnderlineEvent(l.start.x-1,l.start.y-d-1,l.end.x,l.end.y-d-1,void 0);(s?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(A)},a.prototype._linkLeave=function(n,s,l){var d;((d=this._currentLink)===null||d===void 0?void 0:d.state)&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(s,!1),this._currentLink.state.decorations.pointerCursor&&n.classList.remove("xterm-cursor-pointer")),s.leave&&s.leave(l,s.text)},a.prototype._linkAtPosition=function(n,s){var l=n.range.start.y===n.range.end.y,d=n.range.start.y<s.y,A=n.range.end.y>s.y;return(l&&n.range.start.x<=s.x&&n.range.end.x>=s.x||d&&n.range.end.x>=s.x||A&&n.range.start.x<=s.x||d&&A)&&n.range.start.y<=s.y&&n.range.end.y>=s.y},a.prototype._positionFromMouseEvent=function(n,s,l){var d=l.getCoords(n,s,this._bufferService.cols,this._bufferService.rows);if(d)return{x:d[0],y:d[1]+this._bufferService.buffer.ydisp}},a.prototype._createLinkUnderlineEvent=function(n,s,l,d,A){return{x1:n,y1:s,x2:l,y2:d,cols:this._bufferService.cols,fg:A}},w([g(0,b.IBufferService)],a)}(f.Disposable);v.Linkifier2=E},9042:(N,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.tooMuchOutput=v.promptLabel=void 0,v.promptLabel="Terminal input",v.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},6954:function(N,v,L){var O,D=this&&this.__extends||(O=function(u,a){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var l in s)Object.prototype.hasOwnProperty.call(s,l)&&(n[l]=s[l])},O(u,a)},function(u,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");function n(){this.constructor=u}O(u,a),u.prototype=a===null?Object.create(a):(n.prototype=a.prototype,new n)}),w=this&&this.__decorate||function(u,a,n,s){var l,d=arguments.length,A=d<3?a:s===null?s=Object.getOwnPropertyDescriptor(a,n):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(u,a,n,s);else for(var S=u.length-1;S>=0;S--)(l=u[S])&&(A=(d<3?l(A):d>3?l(a,n,A):l(a,n))||A);return d>3&&A&&Object.defineProperty(a,n,A),A},g=this&&this.__param||function(u,a){return function(n,s){a(n,s,u)}};Object.defineProperty(v,"__esModule",{value:!0}),v.MouseZoneManager=void 0;var b=L(844),T=L(3656),f=L(4725),p=L(2585),E=function(u){function a(n,s,l,d,A,S){var R=u.call(this)||this;return R._element=n,R._screenElement=s,R._bufferService=l,R._mouseService=d,R._selectionService=A,R._optionsService=S,R._zones=[],R._areZonesActive=!1,R._lastHoverCoords=[void 0,void 0],R._initialSelectionLength=0,R.register((0,T.addDisposableDomListener)(R._element,"mousedown",function(y){return R._onMouseDown(y)})),R._mouseMoveListener=function(y){return R._onMouseMove(y)},R._mouseLeaveListener=function(y){return R._onMouseLeave(y)},R._clickListener=function(y){return R._onClick(y)},R}return D(a,u),a.prototype.dispose=function(){u.prototype.dispose.call(this),this._deactivate()},a.prototype.add=function(n){this._zones.push(n),this._zones.length===1&&this._activate()},a.prototype.clearAll=function(n,s){if(this._zones.length!==0){n&&s||(n=0,s=this._bufferService.rows-1);for(var l=0;l<this._zones.length;l++){var d=this._zones[l];(d.y1>n&&d.y1<=s+1||d.y2>n&&d.y2<=s+1||d.y1<n&&d.y2>s+1)&&(this._currentZone&&this._currentZone===d&&(this._currentZone.leaveCallback(),this._currentZone=void 0),this._zones.splice(l--,1))}this._zones.length===0&&this._deactivate()}},a.prototype._activate=function(){this._areZonesActive||(this._areZonesActive=!0,this._element.addEventListener("mousemove",this._mouseMoveListener),this._element.addEventListener("mouseleave",this._mouseLeaveListener),this._element.addEventListener("click",this._clickListener))},a.prototype._deactivate=function(){this._areZonesActive&&(this._areZonesActive=!1,this._element.removeEventListener("mousemove",this._mouseMoveListener),this._element.removeEventListener("mouseleave",this._mouseLeaveListener),this._element.removeEventListener("click",this._clickListener))},a.prototype._onMouseMove=function(n){this._lastHoverCoords[0]===n.pageX&&this._lastHoverCoords[1]===n.pageY||(this._onHover(n),this._lastHoverCoords=[n.pageX,n.pageY])},a.prototype._onHover=function(n){var s=this,l=this._findZoneEventAt(n);l!==this._currentZone&&(this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout)),l&&(this._currentZone=l,l.hoverCallback&&l.hoverCallback(n),this._tooltipTimeout=window.setTimeout(function(){return s._onTooltip(n)},this._optionsService.options.linkTooltipHoverDuration)))},a.prototype._onTooltip=function(n){this._tooltipTimeout=void 0;var s=this._findZoneEventAt(n);s==null||s.tooltipCallback(n)},a.prototype._onMouseDown=function(n){if(this._initialSelectionLength=this._getSelectionLength(),this._areZonesActive){var s=this._findZoneEventAt(n);(s==null?void 0:s.willLinkActivate(n))&&(n.preventDefault(),n.stopImmediatePropagation())}},a.prototype._onMouseLeave=function(n){this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout))},a.prototype._onClick=function(n){var s=this._findZoneEventAt(n),l=this._getSelectionLength();s&&l===this._initialSelectionLength&&(s.clickCallback(n),n.preventDefault(),n.stopImmediatePropagation())},a.prototype._getSelectionLength=function(){var n=this._selectionService.selectionText;return n?n.length:0},a.prototype._findZoneEventAt=function(n){var s=this._mouseService.getCoords(n,this._screenElement,this._bufferService.cols,this._bufferService.rows);if(s)for(var l=s[0],d=s[1],A=0;A<this._zones.length;A++){var S=this._zones[A];if(S.y1===S.y2){if(d===S.y1&&l>=S.x1&&l<S.x2)return S}else if(d===S.y1&&l>=S.x1||d===S.y2&&l<S.x2||d>S.y1&&d<S.y2)return S}},w([g(2,p.IBufferService),g(3,f.IMouseService),g(4,f.ISelectionService),g(5,p.IOptionsService)],a)}(b.Disposable);v.MouseZoneManager=E},6193:(N,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.RenderDebouncer=void 0;var L=function(){function O(D){this._renderCallback=D}return O.prototype.dispose=function(){this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},O.prototype.refresh=function(D,w,g){var b=this;this._rowCount=g,D=D!==void 0?D:0,w=w!==void 0?w:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,D):D,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,w):w,this._animationFrame||(this._animationFrame=window.requestAnimationFrame(function(){return b._innerRefresh()}))},O.prototype._innerRefresh=function(){if(this._rowStart!==void 0&&this._rowEnd!==void 0&&this._rowCount!==void 0){var D=Math.max(this._rowStart,0),w=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._animationFrame=void 0,this._renderCallback(D,w)}},O}();v.RenderDebouncer=L},5596:function(N,v,L){var O,D=this&&this.__extends||(O=function(g,b){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(T,f){T.__proto__=f}||function(T,f){for(var p in f)Object.prototype.hasOwnProperty.call(f,p)&&(T[p]=f[p])},O(g,b)},function(g,b){if(typeof b!="function"&&b!==null)throw new TypeError("Class extends value "+String(b)+" is not a constructor or null");function T(){this.constructor=g}O(g,b),g.prototype=b===null?Object.create(b):(T.prototype=b.prototype,new T)});Object.defineProperty(v,"__esModule",{value:!0}),v.ScreenDprMonitor=void 0;var w=function(g){function b(){var T=g!==null&&g.apply(this,arguments)||this;return T._currentDevicePixelRatio=window.devicePixelRatio,T}return D(b,g),b.prototype.setListener=function(T){var f=this;this._listener&&this.clearListener(),this._listener=T,this._outerListener=function(){f._listener&&(f._listener(window.devicePixelRatio,f._currentDevicePixelRatio),f._updateDpr())},this._updateDpr()},b.prototype.dispose=function(){g.prototype.dispose.call(this),this.clearListener()},b.prototype._updateDpr=function(){var T;this._outerListener&&((T=this._resolutionMediaMatchList)===null||T===void 0||T.removeListener(this._outerListener),this._currentDevicePixelRatio=window.devicePixelRatio,this._resolutionMediaMatchList=window.matchMedia("screen and (resolution: "+window.devicePixelRatio+"dppx)"),this._resolutionMediaMatchList.addListener(this._outerListener))},b.prototype.clearListener=function(){this._resolutionMediaMatchList&&this._listener&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._listener=void 0,this._outerListener=void 0)},b}(L(844).Disposable);v.ScreenDprMonitor=w},3236:function(N,v,L){var O,D=this&&this.__extends||(O=function(ve,q){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(ee,ae){ee.__proto__=ae}||function(ee,ae){for(var _e in ae)Object.prototype.hasOwnProperty.call(ae,_e)&&(ee[_e]=ae[_e])},O(ve,q)},function(ve,q){if(typeof q!="function"&&q!==null)throw new TypeError("Class extends value "+String(q)+" is not a constructor or null");function ee(){this.constructor=ve}O(ve,q),ve.prototype=q===null?Object.create(q):(ee.prototype=q.prototype,new ee)});Object.defineProperty(v,"__esModule",{value:!0}),v.Terminal=void 0;var w=L(2950),g=L(1680),b=L(3614),T=L(2584),f=L(5435),p=L(3525),E=L(3551),u=L(9312),a=L(6114),n=L(3656),s=L(9042),l=L(357),d=L(6954),A=L(4567),S=L(1296),R=L(7399),y=L(8460),_=L(8437),m=L(5680),I=L(3230),B=L(4725),P=L(428),M=L(8934),U=L(6465),K=L(5114),W=L(8969),X=L(4774),ie=L(4269),se=typeof window!="undefined"?window.document:null,le=function(ve){function q(ee){ee===void 0&&(ee={});var ae=ve.call(this,ee)||this;return ae.browser=a,ae._keyDownHandled=!1,ae._keyPressHandled=!1,ae._unprocessedDeadKey=!1,ae._onCursorMove=new y.EventEmitter,ae._onKey=new y.EventEmitter,ae._onRender=new y.EventEmitter,ae._onSelectionChange=new y.EventEmitter,ae._onTitleChange=new y.EventEmitter,ae._onBell=new y.EventEmitter,ae._onFocus=new y.EventEmitter,ae._onBlur=new y.EventEmitter,ae._onA11yCharEmitter=new y.EventEmitter,ae._onA11yTabEmitter=new y.EventEmitter,ae._setup(),ae.linkifier=ae._instantiationService.createInstance(E.Linkifier),ae.linkifier2=ae.register(ae._instantiationService.createInstance(U.Linkifier2)),ae.register(ae._inputHandler.onRequestBell(function(){return ae.bell()})),ae.register(ae._inputHandler.onRequestRefreshRows(function(_e,fe){return ae.refresh(_e,fe)})),ae.register(ae._inputHandler.onRequestSendFocus(function(){return ae._reportFocus()})),ae.register(ae._inputHandler.onRequestReset(function(){return ae.reset()})),ae.register(ae._inputHandler.onRequestWindowsOptionsReport(function(_e){return ae._reportWindowsOptions(_e)})),ae.register(ae._inputHandler.onAnsiColorChange(function(_e){return ae._changeAnsiColor(_e)})),ae.register((0,y.forwardEvent)(ae._inputHandler.onCursorMove,ae._onCursorMove)),ae.register((0,y.forwardEvent)(ae._inputHandler.onTitleChange,ae._onTitleChange)),ae.register((0,y.forwardEvent)(ae._inputHandler.onA11yChar,ae._onA11yCharEmitter)),ae.register((0,y.forwardEvent)(ae._inputHandler.onA11yTab,ae._onA11yTabEmitter)),ae.register(ae._bufferService.onResize(function(_e){return ae._afterResize(_e.cols,_e.rows)})),ae}return D(q,ve),Object.defineProperty(q.prototype,"options",{get:function(){return this.optionsService.options},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"onKey",{get:function(){return this._onKey.event},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"onRender",{get:function(){return this._onRender.event},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"onTitleChange",{get:function(){return this._onTitleChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"onBell",{get:function(){return this._onBell.event},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"onFocus",{get:function(){return this._onFocus.event},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"onBlur",{get:function(){return this._onBlur.event},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"onA11yChar",{get:function(){return this._onA11yCharEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"onA11yTab",{get:function(){return this._onA11yTabEmitter.event},enumerable:!1,configurable:!0}),q.prototype._changeAnsiColor=function(ee){var ae,_e;if(this._colorManager){for(var fe=0,Ue=ee.colors;fe<Ue.length;fe++){var Te=Ue[fe],Fe=X.rgba.toColor(Te.red,Te.green,Te.blue);this._colorManager.colors.ansi[Te.colorIndex]=Fe}(ae=this._renderService)===null||ae===void 0||ae.setColors(this._colorManager.colors),(_e=this.viewport)===null||_e===void 0||_e.onThemeChange(this._colorManager.colors)}},q.prototype.dispose=function(){var ee,ae,_e;this._isDisposed||(ve.prototype.dispose.call(this),(ee=this._renderService)===null||ee===void 0||ee.dispose(),this._customKeyEventHandler=void 0,this.write=function(){},(_e=(ae=this.element)===null||ae===void 0?void 0:ae.parentNode)===null||_e===void 0||_e.removeChild(this.element))},q.prototype._setup=function(){ve.prototype._setup.call(this),this._customKeyEventHandler=void 0},Object.defineProperty(q.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!1,configurable:!0}),q.prototype.focus=function(){this.textarea&&this.textarea.focus({preventScroll:!0})},q.prototype._updateOptions=function(ee){var ae,_e,fe,Ue;switch(ve.prototype._updateOptions.call(this,ee),ee){case"fontFamily":case"fontSize":(ae=this._renderService)===null||ae===void 0||ae.clear(),(_e=this._charSizeService)===null||_e===void 0||_e.measure();break;case"cursorBlink":case"cursorStyle":this.refresh(this.buffer.y,this.buffer.y);break;case"customGlyphs":case"drawBoldTextInBrightColors":case"letterSpacing":case"lineHeight":case"fontWeight":case"fontWeightBold":case"minimumContrastRatio":this._renderService&&(this._renderService.clear(),this._renderService.onResize(this.cols,this.rows),this.refresh(0,this.rows-1));break;case"rendererType":this._renderService&&(this._renderService.setRenderer(this._createRenderer()),this._renderService.onResize(this.cols,this.rows));break;case"scrollback":(fe=this.viewport)===null||fe===void 0||fe.syncScrollArea();break;case"screenReaderMode":this.optionsService.options.screenReaderMode?!this._accessibilityManager&&this._renderService&&(this._accessibilityManager=new A.AccessibilityManager(this,this._renderService)):((Ue=this._accessibilityManager)===null||Ue===void 0||Ue.dispose(),this._accessibilityManager=void 0);break;case"tabStopWidth":this.buffers.setupTabStops();break;case"theme":this._setTheme(this.optionsService.options.theme)}},q.prototype._onTextAreaFocus=function(ee){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(T.C0.ESC+"[I"),this.updateCursorStyle(ee),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()},q.prototype.blur=function(){var ee;return(ee=this.textarea)===null||ee===void 0?void 0:ee.blur()},q.prototype._onTextAreaBlur=function(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(T.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()},q.prototype._syncTextArea=function(){if(this.textarea&&this.buffer.isCursorInViewport&&!this._compositionHelper.isComposing&&this._renderService){var ee=this.buffer.ybase+this.buffer.y,ae=this.buffer.lines.get(ee);if(ae){var _e=Math.min(this.buffer.x,this.cols-1),fe=this._renderService.dimensions.actualCellHeight,Ue=ae.getWidth(_e),Te=this._renderService.dimensions.actualCellWidth*Ue,Fe=this.buffer.y*this._renderService.dimensions.actualCellHeight,$e=_e*this._renderService.dimensions.actualCellWidth;this.textarea.style.left=$e+"px",this.textarea.style.top=Fe+"px",this.textarea.style.width=Te+"px",this.textarea.style.height=fe+"px",this.textarea.style.lineHeight=fe+"px",this.textarea.style.zIndex="-5"}}},q.prototype._initGlobal=function(){var ee=this;this._bindKeys(),this.register((0,n.addDisposableDomListener)(this.element,"copy",function(_e){ee.hasSelection()&&(0,b.copyHandler)(_e,ee._selectionService)}));var ae=function(_e){return(0,b.handlePasteEvent)(_e,ee.textarea,ee.coreService)};this.register((0,n.addDisposableDomListener)(this.textarea,"paste",ae)),this.register((0,n.addDisposableDomListener)(this.element,"paste",ae)),a.isFirefox?this.register((0,n.addDisposableDomListener)(this.element,"mousedown",function(_e){_e.button===2&&(0,b.rightClickHandler)(_e,ee.textarea,ee.screenElement,ee._selectionService,ee.options.rightClickSelectsWord)})):this.register((0,n.addDisposableDomListener)(this.element,"contextmenu",function(_e){(0,b.rightClickHandler)(_e,ee.textarea,ee.screenElement,ee._selectionService,ee.options.rightClickSelectsWord)})),a.isLinux&&this.register((0,n.addDisposableDomListener)(this.element,"auxclick",function(_e){_e.button===1&&(0,b.moveTextAreaUnderMouseCursor)(_e,ee.textarea,ee.screenElement)}))},q.prototype._bindKeys=function(){var ee=this;this.register((0,n.addDisposableDomListener)(this.textarea,"keyup",function(ae){return ee._keyUp(ae)},!0)),this.register((0,n.addDisposableDomListener)(this.textarea,"keydown",function(ae){return ee._keyDown(ae)},!0)),this.register((0,n.addDisposableDomListener)(this.textarea,"keypress",function(ae){return ee._keyPress(ae)},!0)),this.register((0,n.addDisposableDomListener)(this.textarea,"compositionstart",function(){return ee._compositionHelper.compositionstart()})),this.register((0,n.addDisposableDomListener)(this.textarea,"compositionupdate",function(ae){return ee._compositionHelper.compositionupdate(ae)})),this.register((0,n.addDisposableDomListener)(this.textarea,"compositionend",function(){return ee._compositionHelper.compositionend()})),this.register((0,n.addDisposableDomListener)(this.textarea,"input",function(ae){return ee._inputEvent(ae)},!0)),this.register(this.onRender(function(){return ee._compositionHelper.updateCompositionElements()})),this.register(this.onRender(function(ae){return ee._queueLinkification(ae.start,ae.end)}))},q.prototype.open=function(ee){var ae=this;if(!ee)throw new Error("Terminal requires a parent element.");ee.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=ee.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),this.element.setAttribute("tabindex","0"),ee.appendChild(this.element);var _e=se.createDocumentFragment();this._viewportElement=se.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),_e.appendChild(this._viewportElement),this._viewportScrollArea=se.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=se.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=se.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),_e.appendChild(this.screenElement),this.textarea=se.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",s.promptLabel),this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this.register((0,n.addDisposableDomListener)(this.textarea,"focus",function(Te){return ae._onTextAreaFocus(Te)})),this.register((0,n.addDisposableDomListener)(this.textarea,"blur",function(){return ae._onTextAreaBlur()})),this._helperContainer.appendChild(this.textarea);var fe=this._instantiationService.createInstance(K.CoreBrowserService,this.textarea);this._instantiationService.setService(B.ICoreBrowserService,fe),this._charSizeService=this._instantiationService.createInstance(P.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(B.ICharSizeService,this._charSizeService),this._theme=this.options.theme||this._theme,this._colorManager=new m.ColorManager(se,this.options.allowTransparency),this.register(this.optionsService.onOptionChange(function(Te){return ae._colorManager.onOptionsChange(Te)})),this._colorManager.setTheme(this._theme),this._characterJoinerService=this._instantiationService.createInstance(ie.CharacterJoinerService),this._instantiationService.setService(B.ICharacterJoinerService,this._characterJoinerService);var Ue=this._createRenderer();this._renderService=this.register(this._instantiationService.createInstance(I.RenderService,Ue,this.rows,this.screenElement)),this._instantiationService.setService(B.IRenderService,this._renderService),this.register(this._renderService.onRenderedBufferChange(function(Te){return ae._onRender.fire(Te)})),this.onResize(function(Te){return ae._renderService.resize(Te.cols,Te.rows)}),this._compositionView=se.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(w.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(_e),this._soundService=this._instantiationService.createInstance(l.SoundService),this._instantiationService.setService(B.ISoundService,this._soundService),this._mouseService=this._instantiationService.createInstance(M.MouseService),this._instantiationService.setService(B.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(g.Viewport,function(Te){return ae.scrollLines(Te,!0,1)},this._viewportElement,this._viewportScrollArea,this.element),this.viewport.onThemeChange(this._colorManager.colors),this.register(this._inputHandler.onRequestSyncScrollBar(function(){return ae.viewport.syncScrollArea()})),this.register(this.viewport),this.register(this.onCursorMove(function(){ae._renderService.onCursorMove(),ae._syncTextArea()})),this.register(this.onResize(function(){return ae._renderService.onResize(ae.cols,ae.rows)})),this.register(this.onBlur(function(){return ae._renderService.onBlur()})),this.register(this.onFocus(function(){return ae._renderService.onFocus()})),this.register(this._renderService.onDimensionsChange(function(){return ae.viewport.syncScrollArea()})),this._selectionService=this.register(this._instantiationService.createInstance(u.SelectionService,this.element,this.screenElement,this.linkifier2)),this._instantiationService.setService(B.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(function(Te){return ae.scrollLines(Te.amount,Te.suppressScrollEvent)})),this.register(this._selectionService.onSelectionChange(function(){return ae._onSelectionChange.fire()})),this.register(this._selectionService.onRequestRedraw(function(Te){return ae._renderService.onSelectionChanged(Te.start,Te.end,Te.columnSelectMode)})),this.register(this._selectionService.onLinuxMouseSelection(function(Te){ae.textarea.value=Te,ae.textarea.focus(),ae.textarea.select()})),this.register(this._onScroll.event(function(Te){ae.viewport.syncScrollArea(),ae._selectionService.refresh()})),this.register((0,n.addDisposableDomListener)(this._viewportElement,"scroll",function(){return ae._selectionService.refresh()})),this._mouseZoneManager=this._instantiationService.createInstance(d.MouseZoneManager,this.element,this.screenElement),this.register(this._mouseZoneManager),this.register(this.onScroll(function(){return ae._mouseZoneManager.clearAll()})),this.linkifier.attachToDom(this.element,this._mouseZoneManager),this.linkifier2.attachToDom(this.element,this._mouseService,this._renderService),this.register((0,n.addDisposableDomListener)(this.element,"mousedown",function(Te){return ae._selectionService.onMouseDown(Te)})),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager=new A.AccessibilityManager(this,this._renderService)),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()},q.prototype._createRenderer=function(){switch(this.options.rendererType){case"canvas":return this._instantiationService.createInstance(p.Renderer,this._colorManager.colors,this.screenElement,this.linkifier,this.linkifier2);case"dom":return this._instantiationService.createInstance(S.DomRenderer,this._colorManager.colors,this.element,this.screenElement,this._viewportElement,this.linkifier,this.linkifier2);default:throw new Error('Unrecognized rendererType "'+this.options.rendererType+'"')}},q.prototype._setTheme=function(ee){var ae,_e,fe;this._theme=ee,(ae=this._colorManager)===null||ae===void 0||ae.setTheme(ee),(_e=this._renderService)===null||_e===void 0||_e.setColors(this._colorManager.colors),(fe=this.viewport)===null||fe===void 0||fe.onThemeChange(this._colorManager.colors)},q.prototype.bindMouse=function(){var ee=this,ae=this,_e=this.element;function fe(Ge){var st,Ft,Bt=ae._mouseService.getRawByteCoords(Ge,ae.screenElement,ae.cols,ae.rows);if(!Bt)return!1;switch(Ge.overrideType||Ge.type){case"mousemove":Ft=32,Ge.buttons===void 0?(st=3,Ge.button!==void 0&&(st=Ge.button<3?Ge.button:3)):st=1&Ge.buttons?0:4&Ge.buttons?1:2&Ge.buttons?2:3;break;case"mouseup":Ft=0,st=Ge.button<3?Ge.button:3;break;case"mousedown":Ft=1,st=Ge.button<3?Ge.button:3;break;case"wheel":Ge.deltaY!==0&&(Ft=Ge.deltaY<0?0:1),st=4;break;default:return!1}return!(Ft===void 0||st===void 0||st>4)&&ae.coreMouseService.triggerMouseEvent({col:Bt.x-33,row:Bt.y-33,button:st,action:Ft,ctrl:Ge.ctrlKey,alt:Ge.altKey,shift:Ge.shiftKey})}var Ue={mouseup:null,wheel:null,mousedrag:null,mousemove:null},Te=function(Ge){return fe(Ge),Ge.buttons||(ee._document.removeEventListener("mouseup",Ue.mouseup),Ue.mousedrag&&ee._document.removeEventListener("mousemove",Ue.mousedrag)),ee.cancel(Ge)},Fe=function(Ge){return fe(Ge),ee.cancel(Ge,!0)},$e=function(Ge){Ge.buttons&&fe(Ge)},Ye=function(Ge){Ge.buttons||fe(Ge)};this.register(this.coreMouseService.onProtocolChange(function(Ge){Ge?(ee.optionsService.options.logLevel==="debug"&&ee._logService.debug("Binding to mouse events:",ee.coreMouseService.explainEvents(Ge)),ee.element.classList.add("enable-mouse-events"),ee._selectionService.disable()):(ee._logService.debug("Unbinding from mouse events."),ee.element.classList.remove("enable-mouse-events"),ee._selectionService.enable()),8&Ge?Ue.mousemove||(_e.addEventListener("mousemove",Ye),Ue.mousemove=Ye):(_e.removeEventListener("mousemove",Ue.mousemove),Ue.mousemove=null),16&Ge?Ue.wheel||(_e.addEventListener("wheel",Fe,{passive:!1}),Ue.wheel=Fe):(_e.removeEventListener("wheel",Ue.wheel),Ue.wheel=null),2&Ge?Ue.mouseup||(Ue.mouseup=Te):(ee._document.removeEventListener("mouseup",Ue.mouseup),Ue.mouseup=null),4&Ge?Ue.mousedrag||(Ue.mousedrag=$e):(ee._document.removeEventListener("mousemove",Ue.mousedrag),Ue.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,n.addDisposableDomListener)(_e,"mousedown",function(Ge){if(Ge.preventDefault(),ee.focus(),ee.coreMouseService.areMouseEventsActive&&!ee._selectionService.shouldForceSelection(Ge))return fe(Ge),Ue.mouseup&&ee._document.addEventListener("mouseup",Ue.mouseup),Ue.mousedrag&&ee._document.addEventListener("mousemove",Ue.mousedrag),ee.cancel(Ge)})),this.register((0,n.addDisposableDomListener)(_e,"wheel",function(Ge){if(!Ue.wheel){if(!ee.buffer.hasScrollback){var st=ee.viewport.getLinesScrolled(Ge);if(st===0)return;for(var Ft=T.C0.ESC+(ee.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(Ge.deltaY<0?"A":"B"),Bt="",Pt=0;Pt<Math.abs(st);Pt++)Bt+=Ft;return ee.coreService.triggerDataEvent(Bt,!0),ee.cancel(Ge,!0)}return ee.viewport.onWheel(Ge)?void 0:ee.cancel(Ge)}},{passive:!1})),this.register((0,n.addDisposableDomListener)(_e,"touchstart",function(Ge){if(!ee.coreMouseService.areMouseEventsActive)return ee.viewport.onTouchStart(Ge),ee.cancel(Ge)},{passive:!0})),this.register((0,n.addDisposableDomListener)(_e,"touchmove",function(Ge){if(!ee.coreMouseService.areMouseEventsActive)return ee.viewport.onTouchMove(Ge)?void 0:ee.cancel(Ge)},{passive:!1}))},q.prototype.refresh=function(ee,ae){var _e;(_e=this._renderService)===null||_e===void 0||_e.refreshRows(ee,ae)},q.prototype._queueLinkification=function(ee,ae){var _e;(_e=this.linkifier)===null||_e===void 0||_e.linkifyRows(ee,ae)},q.prototype.updateCursorStyle=function(ee){var ae;((ae=this._selectionService)===null||ae===void 0?void 0:ae.shouldColumnSelect(ee))?this.element.classList.add("column-select"):this.element.classList.remove("column-select")},q.prototype._showCursor=function(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))},q.prototype.scrollLines=function(ee,ae,_e){_e===void 0&&(_e=0),ve.prototype.scrollLines.call(this,ee,ae,_e),this.refresh(0,this.rows-1)},q.prototype.paste=function(ee){(0,b.paste)(ee,this.textarea,this.coreService)},q.prototype.attachCustomKeyEventHandler=function(ee){this._customKeyEventHandler=ee},q.prototype.registerLinkMatcher=function(ee,ae,_e){var fe=this.linkifier.registerLinkMatcher(ee,ae,_e);return this.refresh(0,this.rows-1),fe},q.prototype.deregisterLinkMatcher=function(ee){this.linkifier.deregisterLinkMatcher(ee)&&this.refresh(0,this.rows-1)},q.prototype.registerLinkProvider=function(ee){return this.linkifier2.registerLinkProvider(ee)},q.prototype.registerCharacterJoiner=function(ee){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");var ae=this._characterJoinerService.register(ee);return this.refresh(0,this.rows-1),ae},q.prototype.deregisterCharacterJoiner=function(ee){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(ee)&&this.refresh(0,this.rows-1)},Object.defineProperty(q.prototype,"markers",{get:function(){return this.buffer.markers},enumerable:!1,configurable:!0}),q.prototype.addMarker=function(ee){if(this.buffer===this.buffers.normal)return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+ee)},q.prototype.hasSelection=function(){return!!this._selectionService&&this._selectionService.hasSelection},q.prototype.select=function(ee,ae,_e){this._selectionService.setSelection(ee,ae,_e)},q.prototype.getSelection=function(){return this._selectionService?this._selectionService.selectionText:""},q.prototype.getSelectionPosition=function(){if(this._selectionService&&this._selectionService.hasSelection)return{startColumn:this._selectionService.selectionStart[0],startRow:this._selectionService.selectionStart[1],endColumn:this._selectionService.selectionEnd[0],endRow:this._selectionService.selectionEnd[1]}},q.prototype.clearSelection=function(){var ee;(ee=this._selectionService)===null||ee===void 0||ee.clearSelection()},q.prototype.selectAll=function(){var ee;(ee=this._selectionService)===null||ee===void 0||ee.selectAll()},q.prototype.selectLines=function(ee,ae){var _e;(_e=this._selectionService)===null||_e===void 0||_e.selectLines(ee,ae)},q.prototype._keyDown=function(ee){if(this._keyDownHandled=!1,this._customKeyEventHandler&&this._customKeyEventHandler(ee)===!1)return!1;if(!this._compositionHelper.keydown(ee))return this.buffer.ybase!==this.buffer.ydisp&&this._bufferService.scrollToBottom(),!1;ee.key!=="Dead"&&ee.key!=="AltGraph"||(this._unprocessedDeadKey=!0);var ae=(0,R.evaluateKeyboardEvent)(ee,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(ee),ae.type===3||ae.type===2){var _e=this.rows-1;return this.scrollLines(ae.type===2?-_e:_e),this.cancel(ee,!0)}return ae.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,ee)||(ae.cancel&&this.cancel(ee,!0),!ae.key||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(ae.key!==T.C0.ETX&&ae.key!==T.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ae.key,domEvent:ee}),this._showCursor(),this.coreService.triggerDataEvent(ae.key,!0),this.optionsService.options.screenReaderMode?void(this._keyDownHandled=!0):this.cancel(ee,!0))))},q.prototype._isThirdLevelShift=function(ee,ae){var _e=ee.isMac&&!this.options.macOptionIsMeta&&ae.altKey&&!ae.ctrlKey&&!ae.metaKey||ee.isWindows&&ae.altKey&&ae.ctrlKey&&!ae.metaKey||ee.isWindows&&ae.getModifierState("AltGraph");return ae.type==="keypress"?_e:_e&&(!ae.keyCode||ae.keyCode>47)},q.prototype._keyUp=function(ee){this._customKeyEventHandler&&this._customKeyEventHandler(ee)===!1||(function(ae){return ae.keyCode===16||ae.keyCode===17||ae.keyCode===18}(ee)||this.focus(),this.updateCursorStyle(ee),this._keyPressHandled=!1)},q.prototype._keyPress=function(ee){var ae;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(ee)===!1)return!1;if(this.cancel(ee),ee.charCode)ae=ee.charCode;else if(ee.which===null||ee.which===void 0)ae=ee.keyCode;else{if(ee.which===0||ee.charCode===0)return!1;ae=ee.which}return!(!ae||(ee.altKey||ee.ctrlKey||ee.metaKey)&&!this._isThirdLevelShift(this.browser,ee)||(ae=String.fromCharCode(ae),this._onKey.fire({key:ae,domEvent:ee}),this._showCursor(),this.coreService.triggerDataEvent(ae,!0),this._keyPressHandled=!0,0))},q.prototype._inputEvent=function(ee){if(ee.data&&ee.inputType==="insertText"&&!this.optionsService.options.screenReaderMode){if(this._keyPressHandled)return!1;var ae=ee.data;return this.coreService.triggerDataEvent(ae,!0),this.cancel(ee),!0}return!1},q.prototype.bell=function(){var ee;this._soundBell()&&((ee=this._soundService)===null||ee===void 0||ee.playBellSound()),this._onBell.fire()},q.prototype.resize=function(ee,ae){ee!==this.cols||ae!==this.rows?ve.prototype.resize.call(this,ee,ae):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()},q.prototype._afterResize=function(ee,ae){var _e,fe;(_e=this._charSizeService)===null||_e===void 0||_e.measure(),(fe=this.viewport)===null||fe===void 0||fe.syncScrollArea(!0)},q.prototype.clear=function(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(var ee=1;ee<this.rows;ee++)this.buffer.lines.push(this.buffer.getBlankLine(_.DEFAULT_ATTR_DATA));this.refresh(0,this.rows-1),this._onScroll.fire({position:this.buffer.ydisp,source:0})}},q.prototype.reset=function(){var ee,ae;this.options.rows=this.rows,this.options.cols=this.cols;var _e=this._customKeyEventHandler;this._setup(),ve.prototype.reset.call(this),(ee=this._selectionService)===null||ee===void 0||ee.reset(),this._customKeyEventHandler=_e,this.refresh(0,this.rows-1),(ae=this.viewport)===null||ae===void 0||ae.syncScrollArea()},q.prototype.clearTextureAtlas=function(){var ee;(ee=this._renderService)===null||ee===void 0||ee.clearTextureAtlas()},q.prototype._reportFocus=function(){var ee;((ee=this.element)===null||ee===void 0?void 0:ee.classList.contains("focus"))?this.coreService.triggerDataEvent(T.C0.ESC+"[I"):this.coreService.triggerDataEvent(T.C0.ESC+"[O")},q.prototype._reportWindowsOptions=function(ee){if(this._renderService)switch(ee){case f.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:var ae=this._renderService.dimensions.scaledCanvasWidth.toFixed(0),_e=this._renderService.dimensions.scaledCanvasHeight.toFixed(0);this.coreService.triggerDataEvent(T.C0.ESC+"[4;"+_e+";"+ae+"t");break;case f.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:var fe=this._renderService.dimensions.scaledCellWidth.toFixed(0),Ue=this._renderService.dimensions.scaledCellHeight.toFixed(0);this.coreService.triggerDataEvent(T.C0.ESC+"[6;"+Ue+";"+fe+"t")}},q.prototype.cancel=function(ee,ae){if(this.options.cancelEvents||ae)return ee.preventDefault(),ee.stopPropagation(),!1},q.prototype._visualBell=function(){return!1},q.prototype._soundBell=function(){return this.options.bellStyle==="sound"},q}(W.CoreTerminal);v.Terminal=le},9924:(N,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.TimeBasedDebouncer=void 0;var L=function(){function O(D,w){w===void 0&&(w=1e3),this._renderCallback=D,this._debounceThresholdMS=w,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}return O.prototype.dispose=function(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)},O.prototype.refresh=function(D,w,g){var b=this;this._rowCount=g,D=D!==void 0?D:0,w=w!==void 0?w:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,D):D,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,w):w;var T=Date.now();if(T-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=T,this._innerRefresh();else if(!this._additionalRefreshRequested){var f=T-this._lastRefreshMs,p=this._debounceThresholdMS-f;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(function(){b._lastRefreshMs=Date.now(),b._innerRefresh(),b._additionalRefreshRequested=!1,b._refreshTimeoutID=void 0},p)}},O.prototype._innerRefresh=function(){if(this._rowStart!==void 0&&this._rowEnd!==void 0&&this._rowCount!==void 0){var D=Math.max(this._rowStart,0),w=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(D,w)}},O}();v.TimeBasedDebouncer=L},1680:function(N,v,L){var O,D=this&&this.__extends||(O=function(u,a){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var l in s)Object.prototype.hasOwnProperty.call(s,l)&&(n[l]=s[l])},O(u,a)},function(u,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");function n(){this.constructor=u}O(u,a),u.prototype=a===null?Object.create(a):(n.prototype=a.prototype,new n)}),w=this&&this.__decorate||function(u,a,n,s){var l,d=arguments.length,A=d<3?a:s===null?s=Object.getOwnPropertyDescriptor(a,n):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(u,a,n,s);else for(var S=u.length-1;S>=0;S--)(l=u[S])&&(A=(d<3?l(A):d>3?l(a,n,A):l(a,n))||A);return d>3&&A&&Object.defineProperty(a,n,A),A},g=this&&this.__param||function(u,a){return function(n,s){a(n,s,u)}};Object.defineProperty(v,"__esModule",{value:!0}),v.Viewport=void 0;var b=L(844),T=L(3656),f=L(4725),p=L(2585),E=function(u){function a(n,s,l,d,A,S,R,y){var _=u.call(this)||this;return _._scrollLines=n,_._viewportElement=s,_._scrollArea=l,_._element=d,_._bufferService=A,_._optionsService=S,_._charSizeService=R,_._renderService=y,_.scrollBarWidth=0,_._currentRowHeight=0,_._currentScaledCellHeight=0,_._lastRecordedBufferLength=0,_._lastRecordedViewportHeight=0,_._lastRecordedBufferHeight=0,_._lastTouchY=0,_._lastScrollTop=0,_._lastHadScrollBar=!1,_._wheelPartialScroll=0,_._refreshAnimationFrame=null,_._ignoreNextScrollEvent=!1,_.scrollBarWidth=_._viewportElement.offsetWidth-_._scrollArea.offsetWidth||15,_._lastHadScrollBar=!0,_.register((0,T.addDisposableDomListener)(_._viewportElement,"scroll",_._onScroll.bind(_))),_._activeBuffer=_._bufferService.buffer,_.register(_._bufferService.buffers.onBufferActivate(function(m){return _._activeBuffer=m.activeBuffer})),_._renderDimensions=_._renderService.dimensions,_.register(_._renderService.onDimensionsChange(function(m){return _._renderDimensions=m})),setTimeout(function(){return _.syncScrollArea()},0),_}return D(a,u),a.prototype.onThemeChange=function(n){this._viewportElement.style.backgroundColor=n.background.css},a.prototype._refresh=function(n){var s=this;if(n)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=requestAnimationFrame(function(){return s._innerRefresh()}))},a.prototype._innerRefresh=function(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderService.dimensions.scaledCellHeight/window.devicePixelRatio,this._currentScaledCellHeight=this._renderService.dimensions.scaledCellHeight,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;var n=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.canvasHeight);this._lastRecordedBufferHeight!==n&&(this._lastRecordedBufferHeight=n,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}var s=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==s&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=s),this._optionsService.options.scrollback===0?this.scrollBarWidth=0:this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this._lastHadScrollBar=this.scrollBarWidth>0;var l=window.getComputedStyle(this._element),d=parseInt(l.paddingLeft)+parseInt(l.paddingRight);this._viewportElement.style.width=(this._renderService.dimensions.actualCellWidth*this._bufferService.cols+this.scrollBarWidth+(this._lastHadScrollBar?d:0)).toString()+"px",this._refreshAnimationFrame=null},a.prototype.syncScrollArea=function(n){if(n===void 0&&(n=!1),this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(n);this._lastRecordedViewportHeight===this._renderService.dimensions.canvasHeight&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.scaledCellHeight===this._currentScaledCellHeight?this._lastHadScrollBar!==this._optionsService.options.scrollback>0&&this._refresh(n):this._refresh(n)},a.prototype._onScroll=function(n){if(this._lastScrollTop=this._viewportElement.scrollTop,this._viewportElement.offsetParent){if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._scrollLines(0);var s=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._scrollLines(s)}},a.prototype._bubbleScroll=function(n,s){var l=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(s<0&&this._viewportElement.scrollTop!==0||s>0&&l<this._lastRecordedBufferHeight)||(n.cancelable&&n.preventDefault(),!1)},a.prototype.onWheel=function(n){var s=this._getPixelsScrolled(n);return s!==0&&(this._viewportElement.scrollTop+=s,this._bubbleScroll(n,s))},a.prototype._getPixelsScrolled=function(n){if(n.deltaY===0)return 0;var s=this._applyScrollModifier(n.deltaY,n);return n.deltaMode===WheelEvent.DOM_DELTA_LINE?s*=this._currentRowHeight:n.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._currentRowHeight*this._bufferService.rows),s},a.prototype.getLinesScrolled=function(n){if(n.deltaY===0)return 0;var s=this._applyScrollModifier(n.deltaY,n);return n.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=this._currentRowHeight+0,this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):n.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s},a.prototype._applyScrollModifier=function(n,s){var l=this._optionsService.options.fastScrollModifier;return l==="alt"&&s.altKey||l==="ctrl"&&s.ctrlKey||l==="shift"&&s.shiftKey?n*this._optionsService.options.fastScrollSensitivity*this._optionsService.options.scrollSensitivity:n*this._optionsService.options.scrollSensitivity},a.prototype.onTouchStart=function(n){this._lastTouchY=n.touches[0].pageY},a.prototype.onTouchMove=function(n){var s=this._lastTouchY-n.touches[0].pageY;return this._lastTouchY=n.touches[0].pageY,s!==0&&(this._viewportElement.scrollTop+=s,this._bubbleScroll(n,s))},w([g(4,p.IBufferService),g(5,p.IOptionsService),g(6,f.ICharSizeService),g(7,f.IRenderService)],a)}(b.Disposable);v.Viewport=E},2950:function(N,v,L){var O=this&&this.__decorate||function(T,f,p,E){var u,a=arguments.length,n=a<3?f:E===null?E=Object.getOwnPropertyDescriptor(f,p):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(T,f,p,E);else for(var s=T.length-1;s>=0;s--)(u=T[s])&&(n=(a<3?u(n):a>3?u(f,p,n):u(f,p))||n);return a>3&&n&&Object.defineProperty(f,p,n),n},D=this&&this.__param||function(T,f){return function(p,E){f(p,E,T)}};Object.defineProperty(v,"__esModule",{value:!0}),v.CompositionHelper=void 0;var w=L(4725),g=L(2585),b=function(){function T(f,p,E,u,a,n){this._textarea=f,this._compositionView=p,this._bufferService=E,this._optionsService=u,this._coreService=a,this._renderService=n,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}return Object.defineProperty(T.prototype,"isComposing",{get:function(){return this._isComposing},enumerable:!1,configurable:!0}),T.prototype.compositionstart=function(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")},T.prototype.compositionupdate=function(f){var p=this;this._compositionView.textContent=f.data,this.updateCompositionElements(),setTimeout(function(){p._compositionPosition.end=p._textarea.value.length},0)},T.prototype.compositionend=function(){this._finalizeComposition(!0)},T.prototype.keydown=function(f){if(this._isComposing||this._isSendingComposition){if(f.keyCode===229||f.keyCode===16||f.keyCode===17||f.keyCode===18)return!1;this._finalizeComposition(!1)}return f.keyCode!==229||(this._handleAnyTextareaChanges(),!1)},T.prototype._finalizeComposition=function(f){var p=this;if(this._compositionView.classList.remove("active"),this._isComposing=!1,f){var E={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(function(){if(p._isSendingComposition){p._isSendingComposition=!1;var a;E.start+=p._dataAlreadySent.length,(a=p._isComposing?p._textarea.value.substring(E.start,E.end):p._textarea.value.substring(E.start)).length>0&&p._coreService.triggerDataEvent(a,!0)}},0)}else{this._isSendingComposition=!1;var u=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(u,!0)}},T.prototype._handleAnyTextareaChanges=function(){var f=this,p=this._textarea.value;setTimeout(function(){if(!f._isComposing){var E=f._textarea.value.replace(p,"");E.length>0&&(f._dataAlreadySent=E,f._coreService.triggerDataEvent(E,!0))}},0)},T.prototype.updateCompositionElements=function(f){var p=this;if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){var E=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),u=this._renderService.dimensions.actualCellHeight,a=this._bufferService.buffer.y*this._renderService.dimensions.actualCellHeight,n=E*this._renderService.dimensions.actualCellWidth;this._compositionView.style.left=n+"px",this._compositionView.style.top=a+"px",this._compositionView.style.height=u+"px",this._compositionView.style.lineHeight=u+"px",this._compositionView.style.fontFamily=this._optionsService.options.fontFamily,this._compositionView.style.fontSize=this._optionsService.options.fontSize+"px";var s=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"px",this._textarea.style.top=a+"px",this._textarea.style.width=Math.max(s.width,1)+"px",this._textarea.style.height=Math.max(s.height,1)+"px",this._textarea.style.lineHeight=s.height+"px"}f||setTimeout(function(){return p.updateCompositionElements(!0)},0)}},O([D(2,g.IBufferService),D(3,g.IOptionsService),D(4,g.ICoreService),D(5,w.IRenderService)],T)}();v.CompositionHelper=b},9806:(N,v)=>{function L(O,D){var w=D.getBoundingClientRect();return[O.clientX-w.left,O.clientY-w.top]}Object.defineProperty(v,"__esModule",{value:!0}),v.getRawByteCoords=v.getCoords=v.getCoordsRelativeToElement=void 0,v.getCoordsRelativeToElement=L,v.getCoords=function(O,D,w,g,b,T,f,p){if(b){var E=L(O,D);if(E)return E[0]=Math.ceil((E[0]+(p?T/2:0))/T),E[1]=Math.ceil(E[1]/f),E[0]=Math.min(Math.max(E[0],1),w+(p?1:0)),E[1]=Math.min(Math.max(E[1],1),g),E}},v.getRawByteCoords=function(O){if(O)return{x:O[0]+32,y:O[1]+32}}},9504:(N,v,L)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.moveToCellSequence=void 0;var O=L(2584);function D(p,E,u,a){var n=p-w(u,p),s=E-w(u,E),l=Math.abs(n-s)-function(d,A,S){for(var R=0,y=d-w(S,d),_=A-w(S,A),m=0;m<Math.abs(y-_);m++){var I=g(d,A)==="A"?-1:1,B=S.buffer.lines.get(y+I*m);B&&B.isWrapped&&R++}return R}(p,E,u);return f(l,T(g(p,E),a))}function w(p,E){for(var u=0,a=p.buffer.lines.get(E),n=a&&a.isWrapped;n&&E>=0&&E<p.rows;)u++,n=(a=p.buffer.lines.get(--E))&&a.isWrapped;return u}function g(p,E){return p>E?"A":"B"}function b(p,E,u,a,n,s){for(var l=p,d=E,A="";l!==u||d!==a;)l+=n?1:-1,n&&l>s.cols-1?(A+=s.buffer.translateBufferLineToString(d,!1,p,l),l=0,p=0,d++):!n&&l<0&&(A+=s.buffer.translateBufferLineToString(d,!1,0,p+1),p=l=s.cols-1,d--);return A+s.buffer.translateBufferLineToString(d,!1,p,l)}function T(p,E){var u=E?"O":"[";return O.C0.ESC+u+p}function f(p,E){p=Math.floor(p);for(var u="",a=0;a<p;a++)u+=E;return u}v.moveToCellSequence=function(p,E,u,a){var n,s=u.buffer.x,l=u.buffer.y;if(!u.buffer.hasScrollback)return function(A,S,R,y,_,m){return D(S,y,_,m).length===0?"":f(b(A,S,A,S-w(_,S),!1,_).length,T("D",m))}(s,l,0,E,u,a)+D(l,E,u,a)+function(A,S,R,y,_,m){var I;I=D(S,y,_,m).length>0?y-w(_,y):S;var B=y,P=function(M,U,K,W,X,ie){var se;return se=D(K,W,X,ie).length>0?W-w(X,W):U,M<K&&se<=W||M>=K&&se<W?"C":"D"}(A,S,R,y,_,m);return f(b(A,I,R,B,P==="C",_).length,T(P,m))}(s,l,p,E,u,a);if(l===E)return n=s>p?"D":"C",f(Math.abs(s-p),T(n,a));n=l>E?"D":"C";var d=Math.abs(l-E);return f(function(A,S){return S.cols-A}(l>E?p:s,u)+(d-1)*u.cols+1+((l>E?s:p)-1),T(n,a))}},1546:(N,v,L)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.BaseRenderLayer=void 0;var O=L(643),D=L(8803),w=L(1420),g=L(3734),b=L(1752),T=L(4774),f=L(9631),p=L(8978),E=function(){function u(a,n,s,l,d,A,S,R){this._container=a,this._alpha=l,this._colors=d,this._rendererId=A,this._bufferService=S,this._optionsService=R,this._scaledCharWidth=0,this._scaledCharHeight=0,this._scaledCellWidth=0,this._scaledCellHeight=0,this._scaledCharLeft=0,this._scaledCharTop=0,this._currentGlyphIdentifier={chars:"",code:0,bg:0,fg:0,bold:!1,dim:!1,italic:!1},this._canvas=document.createElement("canvas"),this._canvas.classList.add("xterm-"+n+"-layer"),this._canvas.style.zIndex=s.toString(),this._initCanvas(),this._container.appendChild(this._canvas)}return u.prototype.dispose=function(){var a;(0,f.removeElementFromParent)(this._canvas),(a=this._charAtlas)===null||a===void 0||a.dispose()},u.prototype._initCanvas=function(){this._ctx=(0,b.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()},u.prototype.onOptionsChanged=function(){},u.prototype.onBlur=function(){},u.prototype.onFocus=function(){},u.prototype.onCursorMove=function(){},u.prototype.onGridChanged=function(a,n){},u.prototype.onSelectionChanged=function(a,n,s){s===void 0&&(s=!1)},u.prototype.setColors=function(a){this._refreshCharAtlas(a)},u.prototype._setTransparency=function(a){if(a!==this._alpha){var n=this._canvas;this._alpha=a,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(this._colors),this.onGridChanged(0,this._bufferService.rows-1)}},u.prototype._refreshCharAtlas=function(a){this._scaledCharWidth<=0&&this._scaledCharHeight<=0||(this._charAtlas=(0,w.acquireCharAtlas)(this._optionsService.options,this._rendererId,a,this._scaledCharWidth,this._scaledCharHeight),this._charAtlas.warmUp())},u.prototype.resize=function(a){this._scaledCellWidth=a.scaledCellWidth,this._scaledCellHeight=a.scaledCellHeight,this._scaledCharWidth=a.scaledCharWidth,this._scaledCharHeight=a.scaledCharHeight,this._scaledCharLeft=a.scaledCharLeft,this._scaledCharTop=a.scaledCharTop,this._canvas.width=a.scaledCanvasWidth,this._canvas.height=a.scaledCanvasHeight,this._canvas.style.width=a.canvasWidth+"px",this._canvas.style.height=a.canvasHeight+"px",this._alpha||this._clearAll(),this._refreshCharAtlas(this._colors)},u.prototype.clearTextureAtlas=function(){var a;(a=this._charAtlas)===null||a===void 0||a.clear()},u.prototype._fillCells=function(a,n,s,l){this._ctx.fillRect(a*this._scaledCellWidth,n*this._scaledCellHeight,s*this._scaledCellWidth,l*this._scaledCellHeight)},u.prototype._fillMiddleLineAtCells=function(a,n,s){s===void 0&&(s=1);var l=Math.ceil(.5*this._scaledCellHeight);this._ctx.fillRect(a*this._scaledCellWidth,(n+1)*this._scaledCellHeight-l-window.devicePixelRatio,s*this._scaledCellWidth,window.devicePixelRatio)},u.prototype._fillBottomLineAtCells=function(a,n,s){s===void 0&&(s=1),this._ctx.fillRect(a*this._scaledCellWidth,(n+1)*this._scaledCellHeight-window.devicePixelRatio-1,s*this._scaledCellWidth,window.devicePixelRatio)},u.prototype._fillLeftLineAtCell=function(a,n,s){this._ctx.fillRect(a*this._scaledCellWidth,n*this._scaledCellHeight,window.devicePixelRatio*s,this._scaledCellHeight)},u.prototype._strokeRectAtCell=function(a,n,s,l){this._ctx.lineWidth=window.devicePixelRatio,this._ctx.strokeRect(a*this._scaledCellWidth+window.devicePixelRatio/2,n*this._scaledCellHeight+window.devicePixelRatio/2,s*this._scaledCellWidth-window.devicePixelRatio,l*this._scaledCellHeight-window.devicePixelRatio)},u.prototype._clearAll=function(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))},u.prototype._clearCells=function(a,n,s,l){this._alpha?this._ctx.clearRect(a*this._scaledCellWidth,n*this._scaledCellHeight,s*this._scaledCellWidth,l*this._scaledCellHeight):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(a*this._scaledCellWidth,n*this._scaledCellHeight,s*this._scaledCellWidth,l*this._scaledCellHeight))},u.prototype._fillCharTrueColor=function(a,n,s){this._ctx.font=this._getFont(!1,!1),this._ctx.textBaseline=D.TEXT_BASELINE,this._clipRow(s);var l=!1;this._optionsService.options.customGlyphs!==!1&&(l=(0,p.tryDrawCustomChar)(this._ctx,a.getChars(),n*this._scaledCellWidth,s*this._scaledCellHeight,this._scaledCellWidth,this._scaledCellHeight)),l||this._ctx.fillText(a.getChars(),n*this._scaledCellWidth+this._scaledCharLeft,s*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight)},u.prototype._drawChars=function(a,n,s){var l,d,A=this._getContrastColor(a);A||a.isFgRGB()||a.isBgRGB()?this._drawUncachedChars(a,n,s,A):(a.isInverse()?(l=a.isBgDefault()?D.INVERTED_DEFAULT_COLOR:a.getBgColor(),d=a.isFgDefault()?D.INVERTED_DEFAULT_COLOR:a.getFgColor()):(d=a.isBgDefault()?O.DEFAULT_COLOR:a.getBgColor(),l=a.isFgDefault()?O.DEFAULT_COLOR:a.getFgColor()),l+=this._optionsService.options.drawBoldTextInBrightColors&&a.isBold()&&l<8?8:0,this._currentGlyphIdentifier.chars=a.getChars()||O.WHITESPACE_CELL_CHAR,this._currentGlyphIdentifier.code=a.getCode()||O.WHITESPACE_CELL_CODE,this._currentGlyphIdentifier.bg=d,this._currentGlyphIdentifier.fg=l,this._currentGlyphIdentifier.bold=!!a.isBold(),this._currentGlyphIdentifier.dim=!!a.isDim(),this._currentGlyphIdentifier.italic=!!a.isItalic(),this._charAtlas&&this._charAtlas.draw(this._ctx,this._currentGlyphIdentifier,n*this._scaledCellWidth+this._scaledCharLeft,s*this._scaledCellHeight+this._scaledCharTop)||this._drawUncachedChars(a,n,s))},u.prototype._drawUncachedChars=function(a,n,s,l){if(this._ctx.save(),this._ctx.font=this._getFont(!!a.isBold(),!!a.isItalic()),this._ctx.textBaseline=D.TEXT_BASELINE,a.isInverse())if(l)this._ctx.fillStyle=l.css;else if(a.isBgDefault())this._ctx.fillStyle=T.color.opaque(this._colors.background).css;else if(a.isBgRGB())this._ctx.fillStyle="rgb("+g.AttributeData.toColorRGB(a.getBgColor()).join(",")+")";else{var d=a.getBgColor();this._optionsService.options.drawBoldTextInBrightColors&&a.isBold()&&d<8&&(d+=8),this._ctx.fillStyle=this._colors.ansi[d].css}else if(l)this._ctx.fillStyle=l.css;else if(a.isFgDefault())this._ctx.fillStyle=this._colors.foreground.css;else if(a.isFgRGB())this._ctx.fillStyle="rgb("+g.AttributeData.toColorRGB(a.getFgColor()).join(",")+")";else{var A=a.getFgColor();this._optionsService.options.drawBoldTextInBrightColors&&a.isBold()&&A<8&&(A+=8),this._ctx.fillStyle=this._colors.ansi[A].css}this._clipRow(s),a.isDim()&&(this._ctx.globalAlpha=D.DIM_OPACITY);var S=!1;this._optionsService.options.customGlyphs!==!1&&(S=(0,p.tryDrawCustomChar)(this._ctx,a.getChars(),n*this._scaledCellWidth,s*this._scaledCellHeight,this._scaledCellWidth,this._scaledCellHeight)),S||this._ctx.fillText(a.getChars(),n*this._scaledCellWidth+this._scaledCharLeft,s*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight),this._ctx.restore()},u.prototype._clipRow=function(a){this._ctx.beginPath(),this._ctx.rect(0,a*this._scaledCellHeight,this._bufferService.cols*this._scaledCellWidth,this._scaledCellHeight),this._ctx.clip()},u.prototype._getFont=function(a,n){return(n?"italic":"")+" "+(a?this._optionsService.options.fontWeightBold:this._optionsService.options.fontWeight)+" "+this._optionsService.options.fontSize*window.devicePixelRatio+"px "+this._optionsService.options.fontFamily},u.prototype._getContrastColor=function(a){if(this._optionsService.options.minimumContrastRatio!==1){var n=this._colors.contrastCache.getColor(a.bg,a.fg);if(n!==void 0)return n||void 0;var s=a.getFgColor(),l=a.getFgColorMode(),d=a.getBgColor(),A=a.getBgColorMode(),S=!!a.isInverse(),R=!!a.isInverse();if(S){var y=s;s=d,d=y;var _=l;l=A,A=_}var m=this._resolveBackgroundRgba(A,d,S),I=this._resolveForegroundRgba(l,s,S,R),B=T.rgba.ensureContrastRatio(m,I,this._optionsService.options.minimumContrastRatio);if(B){var P={css:T.channels.toCss(B>>24&255,B>>16&255,B>>8&255),rgba:B};return this._colors.contrastCache.setColor(a.bg,a.fg,P),P}this._colors.contrastCache.setColor(a.bg,a.fg,null)}},u.prototype._resolveBackgroundRgba=function(a,n,s){switch(a){case 16777216:case 33554432:return this._colors.ansi[n].rgba;case 50331648:return n<<8;default:return s?this._colors.foreground.rgba:this._colors.background.rgba}},u.prototype._resolveForegroundRgba=function(a,n,s,l){switch(a){case 16777216:case 33554432:return this._optionsService.options.drawBoldTextInBrightColors&&l&&n<8&&(n+=8),this._colors.ansi[n].rgba;case 50331648:return n<<8;default:return s?this._colors.background.rgba:this._colors.foreground.rgba}},u}();v.BaseRenderLayer=E},2512:function(N,v,L){var O,D=this&&this.__extends||(O=function(n,s){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,d){l.__proto__=d}||function(l,d){for(var A in d)Object.prototype.hasOwnProperty.call(d,A)&&(l[A]=d[A])},O(n,s)},function(n,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");function l(){this.constructor=n}O(n,s),n.prototype=s===null?Object.create(s):(l.prototype=s.prototype,new l)}),w=this&&this.__decorate||function(n,s,l,d){var A,S=arguments.length,R=S<3?s:d===null?d=Object.getOwnPropertyDescriptor(s,l):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(n,s,l,d);else for(var y=n.length-1;y>=0;y--)(A=n[y])&&(R=(S<3?A(R):S>3?A(s,l,R):A(s,l))||R);return S>3&&R&&Object.defineProperty(s,l,R),R},g=this&&this.__param||function(n,s){return function(l,d){s(l,d,n)}};Object.defineProperty(v,"__esModule",{value:!0}),v.CursorRenderLayer=void 0;var b=L(1546),T=L(511),f=L(2585),p=L(4725),E=600,u=function(n){function s(l,d,A,S,R,y,_,m,I){var B=n.call(this,l,"cursor",d,!0,A,S,y,_)||this;return B._onRequestRedraw=R,B._coreService=m,B._coreBrowserService=I,B._cell=new T.CellData,B._state={x:0,y:0,isFocused:!1,style:"",width:0},B._cursorRenderers={bar:B._renderBarCursor.bind(B),block:B._renderBlockCursor.bind(B),underline:B._renderUnderlineCursor.bind(B)},B}return D(s,n),s.prototype.dispose=function(){this._cursorBlinkStateManager&&(this._cursorBlinkStateManager.dispose(),this._cursorBlinkStateManager=void 0),n.prototype.dispose.call(this)},s.prototype.resize=function(l){n.prototype.resize.call(this,l),this._state={x:0,y:0,isFocused:!1,style:"",width:0}},s.prototype.reset=function(){var l;this._clearCursor(),(l=this._cursorBlinkStateManager)===null||l===void 0||l.restartBlinkAnimation(),this.onOptionsChanged()},s.prototype.onBlur=function(){var l;(l=this._cursorBlinkStateManager)===null||l===void 0||l.pause(),this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},s.prototype.onFocus=function(){var l;(l=this._cursorBlinkStateManager)===null||l===void 0||l.resume(),this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},s.prototype.onOptionsChanged=function(){var l,d=this;this._optionsService.options.cursorBlink?this._cursorBlinkStateManager||(this._cursorBlinkStateManager=new a(this._coreBrowserService.isFocused,function(){d._render(!0)})):((l=this._cursorBlinkStateManager)===null||l===void 0||l.dispose(),this._cursorBlinkStateManager=void 0),this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},s.prototype.onCursorMove=function(){var l;(l=this._cursorBlinkStateManager)===null||l===void 0||l.restartBlinkAnimation()},s.prototype.onGridChanged=function(l,d){!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isPaused?this._render(!1):this._cursorBlinkStateManager.restartBlinkAnimation()},s.prototype._render=function(l){if(this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden){var d=this._bufferService.buffer.ybase+this._bufferService.buffer.y,A=d-this._bufferService.buffer.ydisp;if(A<0||A>=this._bufferService.rows)this._clearCursor();else{var S=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1);if(this._bufferService.buffer.lines.get(d).loadCell(S,this._cell),this._cell.content!==void 0){if(!this._coreBrowserService.isFocused){this._clearCursor(),this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css;var R=this._optionsService.options.cursorStyle;return R&&R!=="block"?this._cursorRenderers[R](S,A,this._cell):this._renderBlurCursor(S,A,this._cell),this._ctx.restore(),this._state.x=S,this._state.y=A,this._state.isFocused=!1,this._state.style=R,void(this._state.width=this._cell.getWidth())}if(!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isCursorVisible){if(this._state){if(this._state.x===S&&this._state.y===A&&this._state.isFocused===this._coreBrowserService.isFocused&&this._state.style===this._optionsService.options.cursorStyle&&this._state.width===this._cell.getWidth())return;this._clearCursor()}this._ctx.save(),this._cursorRenderers[this._optionsService.options.cursorStyle||"block"](S,A,this._cell),this._ctx.restore(),this._state.x=S,this._state.y=A,this._state.isFocused=!1,this._state.style=this._optionsService.options.cursorStyle,this._state.width=this._cell.getWidth()}else this._clearCursor()}}}else this._clearCursor()},s.prototype._clearCursor=function(){this._state&&(window.devicePixelRatio<1?this._clearAll():this._clearCells(this._state.x,this._state.y,this._state.width,1),this._state={x:0,y:0,isFocused:!1,style:"",width:0})},s.prototype._renderBarCursor=function(l,d,A){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillLeftLineAtCell(l,d,this._optionsService.options.cursorWidth),this._ctx.restore()},s.prototype._renderBlockCursor=function(l,d,A){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillCells(l,d,A.getWidth(),1),this._ctx.fillStyle=this._colors.cursorAccent.css,this._fillCharTrueColor(A,l,d),this._ctx.restore()},s.prototype._renderUnderlineCursor=function(l,d,A){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillBottomLineAtCells(l,d),this._ctx.restore()},s.prototype._renderBlurCursor=function(l,d,A){this._ctx.save(),this._ctx.strokeStyle=this._colors.cursor.css,this._strokeRectAtCell(l,d,A.getWidth(),1),this._ctx.restore()},w([g(5,f.IBufferService),g(6,f.IOptionsService),g(7,f.ICoreService),g(8,p.ICoreBrowserService)],s)}(b.BaseRenderLayer);v.CursorRenderLayer=u;var a=function(){function n(s,l){this._renderCallback=l,this.isCursorVisible=!0,s&&this._restartInterval()}return Object.defineProperty(n.prototype,"isPaused",{get:function(){return!(this._blinkStartTimeout||this._blinkInterval)},enumerable:!1,configurable:!0}),n.prototype.dispose=function(){this._blinkInterval&&(window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},n.prototype.restartBlinkAnimation=function(){var s=this;this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=window.requestAnimationFrame(function(){s._renderCallback(),s._animationFrame=void 0})))},n.prototype._restartInterval=function(s){var l=this;s===void 0&&(s=E),this._blinkInterval&&(window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=window.setTimeout(function(){if(l._animationTimeRestarted){var d=E-(Date.now()-l._animationTimeRestarted);if(l._animationTimeRestarted=void 0,d>0)return void l._restartInterval(d)}l.isCursorVisible=!1,l._animationFrame=window.requestAnimationFrame(function(){l._renderCallback(),l._animationFrame=void 0}),l._blinkInterval=window.setInterval(function(){if(l._animationTimeRestarted){var A=E-(Date.now()-l._animationTimeRestarted);return l._animationTimeRestarted=void 0,void l._restartInterval(A)}l.isCursorVisible=!l.isCursorVisible,l._animationFrame=window.requestAnimationFrame(function(){l._renderCallback(),l._animationFrame=void 0})},E)},s)},n.prototype.pause=function(){this.isCursorVisible=!0,this._blinkInterval&&(window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},n.prototype.resume=function(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()},n}()},8978:(N,v,L)=>{var O,D,w,g,b,T,f,p,E,u,a,n,s,l,d,A,S,R,y,_,m,I,B,P,M,U,K,W,X,ie,se,le,ve,q,ee,ae,_e,fe,Ue,Te,Fe,$e,Ye,Ge,st,Ft,Bt,Pt,Dt,qt,Or,Ci,Li,dr,Qr,Ji,kr,Bi,gi,Ei,Gr,Hr,wt,Ir,Ui,on,Gn,an,_i,_n,Cn,Ni,yn,as,Hn,Hs,Ks,cs,ui,Xt,Ur,Rs,Xn,ho,Lo,sa,Do,oa,bo,Oo,Bo,No,Ws,fo,cn,ls,yi,Po,Jr,us,Ao,ws,ln,Ls,js,Vs,xo,go,Mo,Ii,Ys,Ds,bs,aa,or,ds,Js,ko,In,ca,Uo,_a,Fo,Zn,po,Qo,Ca,Go;Object.defineProperty(v,"__esModule",{value:!0}),v.tryDrawCustomChar=v.boxDrawingDefinitions=v.blockElementDefinitions=void 0;var Fa=L(1752);v.blockElementDefinitions={"\u2580":[{x:0,y:0,w:8,h:4}],"\u2581":[{x:0,y:7,w:8,h:1}],"\u2582":[{x:0,y:6,w:8,h:2}],"\u2583":[{x:0,y:5,w:8,h:3}],"\u2584":[{x:0,y:4,w:8,h:4}],"\u2585":[{x:0,y:3,w:8,h:5}],"\u2586":[{x:0,y:2,w:8,h:6}],"\u2587":[{x:0,y:1,w:8,h:7}],"\u2588":[{x:0,y:0,w:8,h:8}],"\u2589":[{x:0,y:0,w:7,h:8}],"\u258A":[{x:0,y:0,w:6,h:8}],"\u258B":[{x:0,y:0,w:5,h:8}],"\u258C":[{x:0,y:0,w:4,h:8}],"\u258D":[{x:0,y:0,w:3,h:8}],"\u258E":[{x:0,y:0,w:2,h:8}],"\u258F":[{x:0,y:0,w:1,h:8}],"\u2590":[{x:4,y:0,w:4,h:8}],"\u2594":[{x:0,y:0,w:9,h:1}],"\u2595":[{x:7,y:0,w:1,h:8}],"\u2596":[{x:0,y:4,w:4,h:4}],"\u2597":[{x:4,y:4,w:4,h:4}],"\u2598":[{x:0,y:0,w:4,h:4}],"\u2599":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"\u259A":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"\u259B":[{x:0,y:0,w:4,h:8},{x:0,y:0,w:4,h:8}],"\u259C":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"\u259D":[{x:4,y:0,w:4,h:4}],"\u259E":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"\u259F":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"\u{1FB70}":[{x:1,y:0,w:1,h:8}],"\u{1FB71}":[{x:2,y:0,w:1,h:8}],"\u{1FB72}":[{x:3,y:0,w:1,h:8}],"\u{1FB73}":[{x:4,y:0,w:1,h:8}],"\u{1FB74}":[{x:5,y:0,w:1,h:8}],"\u{1FB75}":[{x:6,y:0,w:1,h:8}],"\u{1FB76}":[{x:0,y:1,w:8,h:1}],"\u{1FB77}":[{x:0,y:2,w:8,h:1}],"\u{1FB78}":[{x:0,y:3,w:8,h:1}],"\u{1FB79}":[{x:0,y:4,w:8,h:1}],"\u{1FB7A}":[{x:0,y:5,w:8,h:1}],"\u{1FB7B}":[{x:0,y:6,w:8,h:1}],"\u{1FB7C}":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"\u{1FB7D}":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"\u{1FB7E}":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"\u{1FB7F}":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"\u{1FB80}":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"\u{1FB81}":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"\u{1FB82}":[{x:0,y:0,w:8,h:2}],"\u{1FB83}":[{x:0,y:0,w:8,h:3}],"\u{1FB84}":[{x:0,y:0,w:8,h:5}],"\u{1FB85}":[{x:0,y:0,w:8,h:6}],"\u{1FB86}":[{x:0,y:0,w:8,h:7}],"\u{1FB87}":[{x:6,y:0,w:2,h:8}],"\u{1FB88}":[{x:5,y:0,w:3,h:8}],"\u{1FB89}":[{x:3,y:0,w:5,h:8}],"\u{1FB8A}":[{x:2,y:0,w:6,h:8}],"\u{1FB8B}":[{x:1,y:0,w:7,h:8}],"\u{1FB95}":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"\u{1FB96}":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"\u{1FB97}":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};var Ho={"\u2591":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"\u2592":[[1,0],[0,0],[0,1],[0,0]],"\u2593":[[0,1],[1,1],[1,0],[1,1]]};v.boxDrawingDefinitions={"\u2500":(O={},O[1]="M0,.5 L1,.5",O),"\u2501":(D={},D[3]="M0,.5 L1,.5",D),"\u2502":(w={},w[1]="M.5,0 L.5,1",w),"\u2503":(g={},g[3]="M.5,0 L.5,1",g),"\u250C":(b={},b[1]="M0.5,1 L.5,.5 L1,.5",b),"\u250F":(T={},T[3]="M0.5,1 L.5,.5 L1,.5",T),"\u2510":(f={},f[1]="M0,.5 L.5,.5 L.5,1",f),"\u2513":(p={},p[3]="M0,.5 L.5,.5 L.5,1",p),"\u2514":(E={},E[1]="M.5,0 L.5,.5 L1,.5",E),"\u2517":(u={},u[3]="M.5,0 L.5,.5 L1,.5",u),"\u2518":(a={},a[1]="M.5,0 L.5,.5 L0,.5",a),"\u251B":(n={},n[3]="M.5,0 L.5,.5 L0,.5",n),"\u251C":(s={},s[1]="M.5,0 L.5,1 M.5,.5 L1,.5",s),"\u2523":(l={},l[3]="M.5,0 L.5,1 M.5,.5 L1,.5",l),"\u2524":(d={},d[1]="M.5,0 L.5,1 M.5,.5 L0,.5",d),"\u252B":(A={},A[3]="M.5,0 L.5,1 M.5,.5 L0,.5",A),"\u252C":(S={},S[1]="M0,.5 L1,.5 M.5,.5 L.5,1",S),"\u2533":(R={},R[3]="M0,.5 L1,.5 M.5,.5 L.5,1",R),"\u2534":(y={},y[1]="M0,.5 L1,.5 M.5,.5 L.5,0",y),"\u253B":(_={},_[3]="M0,.5 L1,.5 M.5,.5 L.5,0",_),"\u253C":(m={},m[1]="M0,.5 L1,.5 M.5,0 L.5,1",m),"\u254B":(I={},I[3]="M0,.5 L1,.5 M.5,0 L.5,1",I),"\u2574":(B={},B[1]="M.5,.5 L0,.5",B),"\u2578":(P={},P[3]="M.5,.5 L0,.5",P),"\u2575":(M={},M[1]="M.5,.5 L.5,0",M),"\u2579":(U={},U[3]="M.5,.5 L.5,0",U),"\u2576":(K={},K[1]="M.5,.5 L1,.5",K),"\u257A":(W={},W[3]="M.5,.5 L1,.5",W),"\u2577":(X={},X[1]="M.5,.5 L.5,1",X),"\u257B":(ie={},ie[3]="M.5,.5 L.5,1",ie),"\u2550":(se={},se[1]=function(be,xe){return"M0,"+(.5-xe)+" L1,"+(.5-xe)+" M0,"+(.5+xe)+" L1,"+(.5+xe)},se),"\u2551":(le={},le[1]=function(be,xe){return"M"+(.5-be)+",0 L"+(.5-be)+",1 M"+(.5+be)+",0 L"+(.5+be)+",1"},le),"\u2552":(ve={},ve[1]=function(be,xe){return"M.5,1 L.5,"+(.5-xe)+" L1,"+(.5-xe)+" M.5,"+(.5+xe)+" L1,"+(.5+xe)},ve),"\u2553":(q={},q[1]=function(be,xe){return"M"+(.5-be)+",1 L"+(.5-be)+",.5 L1,.5 M"+(.5+be)+",.5 L"+(.5+be)+",1"},q),"\u2554":(ee={},ee[1]=function(be,xe){return"M1,"+(.5-xe)+" L"+(.5-be)+","+(.5-xe)+" L"+(.5-be)+",1 M1,"+(.5+xe)+" L"+(.5+be)+","+(.5+xe)+" L"+(.5+be)+",1"},ee),"\u2555":(ae={},ae[1]=function(be,xe){return"M0,"+(.5-xe)+" L.5,"+(.5-xe)+" L.5,1 M0,"+(.5+xe)+" L.5,"+(.5+xe)},ae),"\u2556":(_e={},_e[1]=function(be,xe){return"M"+(.5+be)+",1 L"+(.5+be)+",.5 L0,.5 M"+(.5-be)+",.5 L"+(.5-be)+",1"},_e),"\u2557":(fe={},fe[1]=function(be,xe){return"M0,"+(.5+xe)+" L"+(.5-be)+","+(.5+xe)+" L"+(.5-be)+",1 M0,"+(.5-xe)+" L"+(.5+be)+","+(.5-xe)+" L"+(.5+be)+",1"},fe),"\u2558":(Ue={},Ue[1]=function(be,xe){return"M.5,0 L.5,"+(.5+xe)+" L1,"+(.5+xe)+" M.5,"+(.5-xe)+" L1,"+(.5-xe)},Ue),"\u2559":(Te={},Te[1]=function(be,xe){return"M1,.5 L"+(.5-be)+",.5 L"+(.5-be)+",0 M"+(.5+be)+",.5 L"+(.5+be)+",0"},Te),"\u255A":(Fe={},Fe[1]=function(be,xe){return"M1,"+(.5-xe)+" L"+(.5+be)+","+(.5-xe)+" L"+(.5+be)+",0 M1,"+(.5+xe)+" L"+(.5-be)+","+(.5+xe)+" L"+(.5-be)+",0"},Fe),"\u255B":($e={},$e[1]=function(be,xe){return"M0,"+(.5+xe)+" L.5,"+(.5+xe)+" L.5,0 M0,"+(.5-xe)+" L.5,"+(.5-xe)},$e),"\u255C":(Ye={},Ye[1]=function(be,xe){return"M0,.5 L"+(.5+be)+",.5 L"+(.5+be)+",0 M"+(.5-be)+",.5 L"+(.5-be)+",0"},Ye),"\u255D":(Ge={},Ge[1]=function(be,xe){return"M0,"+(.5-xe)+" L"+(.5-be)+","+(.5-xe)+" L"+(.5-be)+",0 M0,"+(.5+xe)+" L"+(.5+be)+","+(.5+xe)+" L"+(.5+be)+",0"},Ge),"\u255E":(st={},st[1]=function(be,xe){return"M.5,0 L.5,1 M.5,"+(.5-xe)+" L1,"+(.5-xe)+" M.5,"+(.5+xe)+" L1,"+(.5+xe)},st),"\u255F":(Ft={},Ft[1]=function(be,xe){return"M"+(.5-be)+",0 L"+(.5-be)+",1 M"+(.5+be)+",0 L"+(.5+be)+",1 M"+(.5+be)+",.5 L1,.5"},Ft),"\u2560":(Bt={},Bt[1]=function(be,xe){return"M"+(.5-be)+",0 L"+(.5-be)+",1 M1,"+(.5+xe)+" L"+(.5+be)+","+(.5+xe)+" L"+(.5+be)+",1 M1,"+(.5-xe)+" L"+(.5+be)+","+(.5-xe)+" L"+(.5+be)+",0"},Bt),"\u2561":(Pt={},Pt[1]=function(be,xe){return"M.5,0 L.5,1 M0,"+(.5-xe)+" L.5,"+(.5-xe)+" M0,"+(.5+xe)+" L.5,"+(.5+xe)},Pt),"\u2562":(Dt={},Dt[1]=function(be,xe){return"M0,.5 L"+(.5-be)+",.5 M"+(.5-be)+",0 L"+(.5-be)+",1 M"+(.5+be)+",0 L"+(.5+be)+",1"},Dt),"\u2563":(qt={},qt[1]=function(be,xe){return"M"+(.5+be)+",0 L"+(.5+be)+",1 M0,"+(.5+xe)+" L"+(.5-be)+","+(.5+xe)+" L"+(.5-be)+",1 M0,"+(.5-xe)+" L"+(.5-be)+","+(.5-xe)+" L"+(.5-be)+",0"},qt),"\u2564":(Or={},Or[1]=function(be,xe){return"M0,"+(.5-xe)+" L1,"+(.5-xe)+" M0,"+(.5+xe)+" L1,"+(.5+xe)+" M.5,"+(.5+xe)+" L.5,1"},Or),"\u2565":(Ci={},Ci[1]=function(be,xe){return"M0,.5 L1,.5 M"+(.5-be)+",.5 L"+(.5-be)+",1 M"+(.5+be)+",.5 L"+(.5+be)+",1"},Ci),"\u2566":(Li={},Li[1]=function(be,xe){return"M0,"+(.5-xe)+" L1,"+(.5-xe)+" M0,"+(.5+xe)+" L"+(.5-be)+","+(.5+xe)+" L"+(.5-be)+",1 M1,"+(.5+xe)+" L"+(.5+be)+","+(.5+xe)+" L"+(.5+be)+",1"},Li),"\u2567":(dr={},dr[1]=function(be,xe){return"M.5,0 L.5,"+(.5-xe)+" M0,"+(.5-xe)+" L1,"+(.5-xe)+" M0,"+(.5+xe)+" L1,"+(.5+xe)},dr),"\u2568":(Qr={},Qr[1]=function(be,xe){return"M0,.5 L1,.5 M"+(.5-be)+",.5 L"+(.5-be)+",0 M"+(.5+be)+",.5 L"+(.5+be)+",0"},Qr),"\u2569":(Ji={},Ji[1]=function(be,xe){return"M0,"+(.5+xe)+" L1,"+(.5+xe)+" M0,"+(.5-xe)+" L"+(.5-be)+","+(.5-xe)+" L"+(.5-be)+",0 M1,"+(.5-xe)+" L"+(.5+be)+","+(.5-xe)+" L"+(.5+be)+",0"},Ji),"\u256A":(kr={},kr[1]=function(be,xe){return"M.5,0 L.5,1 M0,"+(.5-xe)+" L1,"+(.5-xe)+" M0,"+(.5+xe)+" L1,"+(.5+xe)},kr),"\u256B":(Bi={},Bi[1]=function(be,xe){return"M0,.5 L1,.5 M"+(.5-be)+",0 L"+(.5-be)+",1 M"+(.5+be)+",0 L"+(.5+be)+",1"},Bi),"\u256C":(gi={},gi[1]=function(be,xe){return"M0,"+(.5+xe)+" L"+(.5-be)+","+(.5+xe)+" L"+(.5-be)+",1 M1,"+(.5+xe)+" L"+(.5+be)+","+(.5+xe)+" L"+(.5+be)+",1 M0,"+(.5-xe)+" L"+(.5-be)+","+(.5-xe)+" L"+(.5-be)+",0 M1,"+(.5-xe)+" L"+(.5+be)+","+(.5-xe)+" L"+(.5+be)+",0"},gi),"\u2571":(Ei={},Ei[1]="M1,0 L0,1",Ei),"\u2572":(Gr={},Gr[1]="M0,0 L1,1",Gr),"\u2573":(Hr={},Hr[1]="M1,0 L0,1 M0,0 L1,1",Hr),"\u257C":(wt={},wt[1]="M.5,.5 L0,.5",wt[3]="M.5,.5 L1,.5",wt),"\u257D":(Ir={},Ir[1]="M.5,.5 L.5,0",Ir[3]="M.5,.5 L.5,1",Ir),"\u257E":(Ui={},Ui[1]="M.5,.5 L1,.5",Ui[3]="M.5,.5 L0,.5",Ui),"\u257F":(on={},on[1]="M.5,.5 L.5,1",on[3]="M.5,.5 L.5,0",on),"\u250D":(Gn={},Gn[1]="M.5,.5 L.5,1",Gn[3]="M.5,.5 L1,.5",Gn),"\u250E":(an={},an[1]="M.5,.5 L1,.5",an[3]="M.5,.5 L.5,1",an),"\u2511":(_i={},_i[1]="M.5,.5 L.5,1",_i[3]="M.5,.5 L0,.5",_i),"\u2512":(_n={},_n[1]="M.5,.5 L0,.5",_n[3]="M.5,.5 L.5,1",_n),"\u2515":(Cn={},Cn[1]="M.5,.5 L.5,0",Cn[3]="M.5,.5 L1,.5",Cn),"\u2516":(Ni={},Ni[1]="M.5,.5 L1,.5",Ni[3]="M.5,.5 L.5,0",Ni),"\u2519":(yn={},yn[1]="M.5,.5 L.5,0",yn[3]="M.5,.5 L0,.5",yn),"\u251A":(as={},as[1]="M.5,.5 L0,.5",as[3]="M.5,.5 L.5,0",as),"\u251D":(Hn={},Hn[1]="M.5,0 L.5,1",Hn[3]="M.5,.5 L1,.5",Hn),"\u251E":(Hs={},Hs[1]="M0.5,1 L.5,.5 L1,.5",Hs[3]="M.5,.5 L.5,0",Hs),"\u251F":(Ks={},Ks[1]="M.5,0 L.5,.5 L1,.5",Ks[3]="M.5,.5 L.5,1",Ks),"\u2520":(cs={},cs[1]="M.5,.5 L1,.5",cs[3]="M.5,0 L.5,1",cs),"\u2521":(ui={},ui[1]="M.5,.5 L.5,1",ui[3]="M.5,0 L.5,.5 L1,.5",ui),"\u2522":(Xt={},Xt[1]="M.5,.5 L.5,0",Xt[3]="M0.5,1 L.5,.5 L1,.5",Xt),"\u2525":(Ur={},Ur[1]="M.5,0 L.5,1",Ur[3]="M.5,.5 L0,.5",Ur),"\u2526":(Rs={},Rs[1]="M0,.5 L.5,.5 L.5,1",Rs[3]="M.5,.5 L.5,0",Rs),"\u2527":(Xn={},Xn[1]="M.5,0 L.5,.5 L0,.5",Xn[3]="M.5,.5 L.5,1",Xn),"\u2528":(ho={},ho[1]="M.5,.5 L0,.5",ho[3]="M.5,0 L.5,1",ho),"\u2529":(Lo={},Lo[1]="M.5,.5 L.5,1",Lo[3]="M.5,0 L.5,.5 L0,.5",Lo),"\u252A":(sa={},sa[1]="M.5,.5 L.5,0",sa[3]="M0,.5 L.5,.5 L.5,1",sa),"\u252D":(Do={},Do[1]="M0.5,1 L.5,.5 L1,.5",Do[3]="M.5,.5 L0,.5",Do),"\u252E":(oa={},oa[1]="M0,.5 L.5,.5 L.5,1",oa[3]="M.5,.5 L1,.5",oa),"\u252F":(bo={},bo[1]="M.5,.5 L.5,1",bo[3]="M0,.5 L1,.5",bo),"\u2530":(Oo={},Oo[1]="M0,.5 L1,.5",Oo[3]="M.5,.5 L.5,1",Oo),"\u2531":(Bo={},Bo[1]="M.5,.5 L1,.5",Bo[3]="M0,.5 L.5,.5 L.5,1",Bo),"\u2532":(No={},No[1]="M.5,.5 L0,.5",No[3]="M0.5,1 L.5,.5 L1,.5",No),"\u2535":(Ws={},Ws[1]="M.5,0 L.5,.5 L1,.5",Ws[3]="M.5,.5 L0,.5",Ws),"\u2536":(fo={},fo[1]="M.5,0 L.5,.5 L0,.5",fo[3]="M.5,.5 L1,.5",fo),"\u2537":(cn={},cn[1]="M.5,.5 L.5,0",cn[3]="M0,.5 L1,.5",cn),"\u2538":(ls={},ls[1]="M0,.5 L1,.5",ls[3]="M.5,.5 L.5,0",ls),"\u2539":(yi={},yi[1]="M.5,.5 L1,.5",yi[3]="M.5,0 L.5,.5 L0,.5",yi),"\u253A":(Po={},Po[1]="M.5,.5 L0,.5",Po[3]="M.5,0 L.5,.5 L1,.5",Po),"\u253D":(Jr={},Jr[1]="M.5,0 L.5,1 M.5,.5 L1,.5",Jr[3]="M.5,.5 L0,.5",Jr),"\u253E":(us={},us[1]="M.5,0 L.5,1 M.5,.5 L0,.5",us[3]="M.5,.5 L1,.5",us),"\u253F":(Ao={},Ao[1]="M.5,0 L.5,1",Ao[3]="M0,.5 L1,.5",Ao),"\u2540":(ws={},ws[1]="M0,.5 L1,.5 M.5,.5 L.5,1",ws[3]="M.5,.5 L.5,0",ws),"\u2541":(ln={},ln[1]="M.5,.5 L.5,0 M0,.5 L1,.5",ln[3]="M.5,.5 L.5,1",ln),"\u2542":(Ls={},Ls[1]="M0,.5 L1,.5",Ls[3]="M.5,0 L.5,1",Ls),"\u2543":(js={},js[1]="M0.5,1 L.5,.5 L1,.5",js[3]="M.5,0 L.5,.5 L0,.5",js),"\u2544":(Vs={},Vs[1]="M0,.5 L.5,.5 L.5,1",Vs[3]="M.5,0 L.5,.5 L1,.5",Vs),"\u2545":(xo={},xo[1]="M.5,0 L.5,.5 L1,.5",xo[3]="M0,.5 L.5,.5 L.5,1",xo),"\u2546":(go={},go[1]="M.5,0 L.5,.5 L0,.5",go[3]="M0.5,1 L.5,.5 L1,.5",go),"\u2547":(Mo={},Mo[1]="M.5,.5 L.5,1",Mo[3]="M.5,.5 L.5,0 M0,.5 L1,.5",Mo),"\u2548":(Ii={},Ii[1]="M.5,.5 L.5,0",Ii[3]="M0,.5 L1,.5 M.5,.5 L.5,1",Ii),"\u2549":(Ys={},Ys[1]="M.5,.5 L1,.5",Ys[3]="M.5,0 L.5,1 M.5,.5 L0,.5",Ys),"\u254A":(Ds={},Ds[1]="M.5,.5 L0,.5",Ds[3]="M.5,0 L.5,1 M.5,.5 L1,.5",Ds),"\u254C":(bs={},bs[1]="M.1,.5 L.4,.5 M.6,.5 L.9,.5",bs),"\u254D":(aa={},aa[3]="M.1,.5 L.4,.5 M.6,.5 L.9,.5",aa),"\u2504":(or={},or[1]="M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5",or),"\u2505":(ds={},ds[3]="M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5",ds),"\u2508":(Js={},Js[1]="M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5",Js),"\u2509":(ko={},ko[3]="M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5",ko),"\u254E":(In={},In[1]="M.5,.1 L.5,.4 M.5,.6 L.5,.9",In),"\u254F":(ca={},ca[3]="M.5,.1 L.5,.4 M.5,.6 L.5,.9",ca),"\u2506":(Uo={},Uo[1]="M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333",Uo),"\u2507":(_a={},_a[3]="M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333",_a),"\u250A":(Fo={},Fo[1]="M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95",Fo),"\u250B":(Zn={},Zn[3]="M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95",Zn),"\u256D":(po={},po[1]="C.5,1,.5,.5,1,.5",po),"\u256E":(Qo={},Qo[1]="C.5,1,.5,.5,0,.5",Qo),"\u256F":(Ca={},Ca[1]="C.5,0,.5,.5,0,.5",Ca),"\u2570":(Go={},Go[1]="C.5,0,.5,.5,1,.5",Go)},v.tryDrawCustomChar=function(be,xe,qi,Kr,di,zr){var un=v.blockElementDefinitions[xe];if(un)return function(Fr,Pi,qs,Os,fs,Xs){for(var dn=0;dn<Pi.length;dn++){var hn=Pi[dn],ri=fs/8,Sn=Xs/8;Fr.fillRect(qs+hn.x*ri,Os+hn.y*Sn,hn.w*ri,hn.h*Sn)}}(be,un,qi,Kr,di,zr),!0;var Fi=Ho[xe];if(Fi)return function(Fr,Pi,qs,Os,fs,Xs){var dn,hn=la.get(Pi);hn||(hn=new Map,la.set(Pi,hn));var ri=Fr.fillStyle;if(typeof ri!="string")throw new Error('Unexpected fillStyle type "'+ri+'"');var Sn=hn.get(ri);if(!Sn){var fn=Pi[0].length,As=Pi.length,Bs=document.createElement("canvas");Bs.width=fn,Bs.height=As;var Ns=(0,Fa.throwIfFalsy)(Bs.getContext("2d")),$n=new ImageData(fn,As),Xi=void 0,es=void 0,ya=void 0,ua=void 0;if(ri.startsWith("#"))Xi=parseInt(ri.substr(1,2),16),es=parseInt(ri.substr(3,2),16),ya=parseInt(ri.substr(5,2),16),ua=ri.length>7&&parseInt(ri.substr(7,2),16)||1;else{if(!ri.startsWith("rgba"))throw new Error('Unexpected fillStyle color format "'+ri+'" when drawing pattern glyph');Xi=(dn=ri.substring(5,ri.length-1).split(",").map(function(xi){return parseFloat(xi)}))[0],es=dn[1],ya=dn[2],ua=dn[3]}for(var Bn=0;Bn<As;Bn++)for(var Ps=0;Ps<fn;Ps++)$n.data[4*(Bn*fn+Ps)]=Xi,$n.data[4*(Bn*fn+Ps)+1]=es,$n.data[4*(Bn*fn+Ps)+2]=ya,$n.data[4*(Bn*fn+Ps)+3]=Pi[Bn][Ps]*(255*ua);Ns.putImageData($n,0,0),Sn=(0,Fa.throwIfFalsy)(Fr.createPattern(Bs,null)),hn.set(ri,Sn)}Fr.fillStyle=Sn,Fr.fillRect(qs,Os,fs,Xs)}(be,Fi,qi,Kr,di,zr),!0;var hs=v.boxDrawingDefinitions[xe];return!!hs&&(function(Fr,Pi,qs,Os,fs,Xs){Fr.strokeStyle=Fr.fillStyle;for(var dn=0,hn=Object.entries(Pi);dn<hn.length;dn++){var ri=hn[dn],Sn=ri[0],fn=ri[1];Fr.beginPath(),Fr.lineWidth=window.devicePixelRatio*Number.parseInt(Sn);for(var As=0,Bs=(typeof fn=="function"?fn(.15,.15/Xs*fs):fn).split(" ");As<Bs.length;As++){var Ns=Bs[As],$n=Ns[0],Xi=zi[$n];if(Xi){var es=Ns.substring(1).split(",");es[0]&&es[1]&&Xi(Fr,Qa(es,fs,Xs,qs,Os))}else console.error('Could not find drawing instructions for "'+$n+'"')}Fr.stroke(),Fr.closePath()}}(be,hs,qi,Kr,di,zr),!0)};var la=new Map;function zs(be,xe,qi){return qi===void 0&&(qi=0),Math.max(Math.min(be,xe),qi)}var zi={C:function(be,xe){return be.bezierCurveTo(xe[0],xe[1],xe[2],xe[3],xe[4],xe[5])},L:function(be,xe){return be.lineTo(xe[0],xe[1])},M:function(be,xe){return be.moveTo(xe[0],xe[1])}};function Qa(be,xe,qi,Kr,di){var zr=be.map(function(hs){return parseFloat(hs)||parseInt(hs)});if(zr.length<2)throw new Error("Too few arguments for instruction");for(var un=0;un<zr.length;un+=2)zr[un]*=xe,zr[un]!==0&&(zr[un]=zs(Math.round(zr[un]+.5)-.5,xe,0)),zr[un]+=Kr;for(var Fi=1;Fi<zr.length;Fi+=2)zr[Fi]*=qi,zr[Fi]!==0&&(zr[Fi]=zs(Math.round(zr[Fi]+.5)-.5,qi,0)),zr[Fi]+=di;return zr}},3700:(N,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.GridCache=void 0;var L=function(){function O(){this.cache=[]}return O.prototype.resize=function(D,w){for(var g=0;g<D;g++){this.cache.length<=g&&this.cache.push([]);for(var b=this.cache[g].length;b<w;b++)this.cache[g].push(void 0);this.cache[g].length=w}this.cache.length=D},O.prototype.clear=function(){for(var D=0;D<this.cache.length;D++)for(var w=0;w<this.cache[D].length;w++)this.cache[D][w]=void 0},O}();v.GridCache=L},5098:function(N,v,L){var O,D=this&&this.__extends||(O=function(u,a){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var l in s)Object.prototype.hasOwnProperty.call(s,l)&&(n[l]=s[l])},O(u,a)},function(u,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");function n(){this.constructor=u}O(u,a),u.prototype=a===null?Object.create(a):(n.prototype=a.prototype,new n)}),w=this&&this.__decorate||function(u,a,n,s){var l,d=arguments.length,A=d<3?a:s===null?s=Object.getOwnPropertyDescriptor(a,n):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(u,a,n,s);else for(var S=u.length-1;S>=0;S--)(l=u[S])&&(A=(d<3?l(A):d>3?l(a,n,A):l(a,n))||A);return d>3&&A&&Object.defineProperty(a,n,A),A},g=this&&this.__param||function(u,a){return function(n,s){a(n,s,u)}};Object.defineProperty(v,"__esModule",{value:!0}),v.LinkRenderLayer=void 0;var b=L(1546),T=L(8803),f=L(2040),p=L(2585),E=function(u){function a(n,s,l,d,A,S,R,y){var _=u.call(this,n,"link",s,!0,l,d,R,y)||this;return A.onShowLinkUnderline(function(m){return _._onShowLinkUnderline(m)}),A.onHideLinkUnderline(function(m){return _._onHideLinkUnderline(m)}),S.onShowLinkUnderline(function(m){return _._onShowLinkUnderline(m)}),S.onHideLinkUnderline(function(m){return _._onHideLinkUnderline(m)}),_}return D(a,u),a.prototype.resize=function(n){u.prototype.resize.call(this,n),this._state=void 0},a.prototype.reset=function(){this._clearCurrentLink()},a.prototype._clearCurrentLink=function(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);var n=this._state.y2-this._state.y1-1;n>0&&this._clearCells(0,this._state.y1+1,this._state.cols,n),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}},a.prototype._onShowLinkUnderline=function(n){if(n.fg===T.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._colors.background.css:n.fg&&(0,f.is256Color)(n.fg)?this._ctx.fillStyle=this._colors.ansi[n.fg].css:this._ctx.fillStyle=this._colors.foreground.css,n.y1===n.y2)this._fillBottomLineAtCells(n.x1,n.y1,n.x2-n.x1);else{this._fillBottomLineAtCells(n.x1,n.y1,n.cols-n.x1);for(var s=n.y1+1;s<n.y2;s++)this._fillBottomLineAtCells(0,s,n.cols);this._fillBottomLineAtCells(0,n.y2,n.x2)}this._state=n},a.prototype._onHideLinkUnderline=function(n){this._clearCurrentLink()},w([g(6,p.IBufferService),g(7,p.IOptionsService)],a)}(b.BaseRenderLayer);v.LinkRenderLayer=E},3525:function(N,v,L){var O,D=this&&this.__extends||(O=function(A,S){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(R,y){R.__proto__=y}||function(R,y){for(var _ in y)Object.prototype.hasOwnProperty.call(y,_)&&(R[_]=y[_])},O(A,S)},function(A,S){if(typeof S!="function"&&S!==null)throw new TypeError("Class extends value "+String(S)+" is not a constructor or null");function R(){this.constructor=A}O(A,S),A.prototype=S===null?Object.create(S):(R.prototype=S.prototype,new R)}),w=this&&this.__decorate||function(A,S,R,y){var _,m=arguments.length,I=m<3?S:y===null?y=Object.getOwnPropertyDescriptor(S,R):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(A,S,R,y);else for(var B=A.length-1;B>=0;B--)(_=A[B])&&(I=(m<3?_(I):m>3?_(S,R,I):_(S,R))||I);return m>3&&I&&Object.defineProperty(S,R,I),I},g=this&&this.__param||function(A,S){return function(R,y){S(R,y,A)}};Object.defineProperty(v,"__esModule",{value:!0}),v.Renderer=void 0;var b=L(9596),T=L(4149),f=L(2512),p=L(5098),E=L(844),u=L(4725),a=L(2585),n=L(1420),s=L(8460),l=1,d=function(A){function S(R,y,_,m,I,B,P,M){var U=A.call(this)||this;U._colors=R,U._screenElement=y,U._bufferService=B,U._charSizeService=P,U._optionsService=M,U._id=l++,U._onRequestRedraw=new s.EventEmitter;var K=U._optionsService.options.allowTransparency;return U._renderLayers=[I.createInstance(b.TextRenderLayer,U._screenElement,0,U._colors,K,U._id),I.createInstance(T.SelectionRenderLayer,U._screenElement,1,U._colors,U._id),I.createInstance(p.LinkRenderLayer,U._screenElement,2,U._colors,U._id,_,m),I.createInstance(f.CursorRenderLayer,U._screenElement,3,U._colors,U._id,U._onRequestRedraw)],U.dimensions={scaledCharWidth:0,scaledCharHeight:0,scaledCellWidth:0,scaledCellHeight:0,scaledCharLeft:0,scaledCharTop:0,scaledCanvasWidth:0,scaledCanvasHeight:0,canvasWidth:0,canvasHeight:0,actualCellWidth:0,actualCellHeight:0},U._devicePixelRatio=window.devicePixelRatio,U._updateDimensions(),U.onOptionsChanged(),U}return D(S,A),Object.defineProperty(S.prototype,"onRequestRedraw",{get:function(){return this._onRequestRedraw.event},enumerable:!1,configurable:!0}),S.prototype.dispose=function(){for(var R=0,y=this._renderLayers;R<y.length;R++)y[R].dispose();A.prototype.dispose.call(this),(0,n.removeTerminalFromCache)(this._id)},S.prototype.onDevicePixelRatioChange=function(){this._devicePixelRatio!==window.devicePixelRatio&&(this._devicePixelRatio=window.devicePixelRatio,this.onResize(this._bufferService.cols,this._bufferService.rows))},S.prototype.setColors=function(R){this._colors=R;for(var y=0,_=this._renderLayers;y<_.length;y++){var m=_[y];m.setColors(this._colors),m.reset()}},S.prototype.onResize=function(R,y){this._updateDimensions();for(var _=0,m=this._renderLayers;_<m.length;_++)m[_].resize(this.dimensions);this._screenElement.style.width=this.dimensions.canvasWidth+"px",this._screenElement.style.height=this.dimensions.canvasHeight+"px"},S.prototype.onCharSizeChanged=function(){this.onResize(this._bufferService.cols,this._bufferService.rows)},S.prototype.onBlur=function(){this._runOperation(function(R){return R.onBlur()})},S.prototype.onFocus=function(){this._runOperation(function(R){return R.onFocus()})},S.prototype.onSelectionChanged=function(R,y,_){_===void 0&&(_=!1),this._runOperation(function(m){return m.onSelectionChanged(R,y,_)})},S.prototype.onCursorMove=function(){this._runOperation(function(R){return R.onCursorMove()})},S.prototype.onOptionsChanged=function(){this._runOperation(function(R){return R.onOptionsChanged()})},S.prototype.clear=function(){this._runOperation(function(R){return R.reset()})},S.prototype._runOperation=function(R){for(var y=0,_=this._renderLayers;y<_.length;y++)R(_[y])},S.prototype.renderRows=function(R,y){for(var _=0,m=this._renderLayers;_<m.length;_++)m[_].onGridChanged(R,y)},S.prototype.clearTextureAtlas=function(){for(var R=0,y=this._renderLayers;R<y.length;R++)y[R].clearTextureAtlas()},S.prototype._updateDimensions=function(){this._charSizeService.hasValidSize&&(this.dimensions.scaledCharWidth=Math.floor(this._charSizeService.width*window.devicePixelRatio),this.dimensions.scaledCharHeight=Math.ceil(this._charSizeService.height*window.devicePixelRatio),this.dimensions.scaledCellHeight=Math.floor(this.dimensions.scaledCharHeight*this._optionsService.options.lineHeight),this.dimensions.scaledCharTop=this._optionsService.options.lineHeight===1?0:Math.round((this.dimensions.scaledCellHeight-this.dimensions.scaledCharHeight)/2),this.dimensions.scaledCellWidth=this.dimensions.scaledCharWidth+Math.round(this._optionsService.options.letterSpacing),this.dimensions.scaledCharLeft=Math.floor(this._optionsService.options.letterSpacing/2),this.dimensions.scaledCanvasHeight=this._bufferService.rows*this.dimensions.scaledCellHeight,this.dimensions.scaledCanvasWidth=this._bufferService.cols*this.dimensions.scaledCellWidth,this.dimensions.canvasHeight=Math.round(this.dimensions.scaledCanvasHeight/window.devicePixelRatio),this.dimensions.canvasWidth=Math.round(this.dimensions.scaledCanvasWidth/window.devicePixelRatio),this.dimensions.actualCellHeight=this.dimensions.canvasHeight/this._bufferService.rows,this.dimensions.actualCellWidth=this.dimensions.canvasWidth/this._bufferService.cols)},w([g(4,a.IInstantiationService),g(5,a.IBufferService),g(6,u.ICharSizeService),g(7,a.IOptionsService)],S)}(E.Disposable);v.Renderer=d},1752:(N,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.throwIfFalsy=void 0,v.throwIfFalsy=function(L){if(!L)throw new Error("value must not be falsy");return L}},4149:function(N,v,L){var O,D=this&&this.__extends||(O=function(p,E){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,a){u.__proto__=a}||function(u,a){for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(u[n]=a[n])},O(p,E)},function(p,E){if(typeof E!="function"&&E!==null)throw new TypeError("Class extends value "+String(E)+" is not a constructor or null");function u(){this.constructor=p}O(p,E),p.prototype=E===null?Object.create(E):(u.prototype=E.prototype,new u)}),w=this&&this.__decorate||function(p,E,u,a){var n,s=arguments.length,l=s<3?E:a===null?a=Object.getOwnPropertyDescriptor(E,u):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(p,E,u,a);else for(var d=p.length-1;d>=0;d--)(n=p[d])&&(l=(s<3?n(l):s>3?n(E,u,l):n(E,u))||l);return s>3&&l&&Object.defineProperty(E,u,l),l},g=this&&this.__param||function(p,E){return function(u,a){E(u,a,p)}};Object.defineProperty(v,"__esModule",{value:!0}),v.SelectionRenderLayer=void 0;var b=L(1546),T=L(2585),f=function(p){function E(u,a,n,s,l,d){var A=p.call(this,u,"selection",a,!0,n,s,l,d)||this;return A._clearState(),A}return D(E,p),E.prototype._clearState=function(){this._state={start:void 0,end:void 0,columnSelectMode:void 0,ydisp:void 0}},E.prototype.resize=function(u){p.prototype.resize.call(this,u),this._clearState()},E.prototype.reset=function(){this._state.start&&this._state.end&&(this._clearState(),this._clearAll())},E.prototype.onSelectionChanged=function(u,a,n){if(this._didStateChange(u,a,n,this._bufferService.buffer.ydisp))if(this._clearAll(),u&&a){var s=u[1]-this._bufferService.buffer.ydisp,l=a[1]-this._bufferService.buffer.ydisp,d=Math.max(s,0),A=Math.min(l,this._bufferService.rows-1);if(d>=this._bufferService.rows||A<0)this._state.ydisp=this._bufferService.buffer.ydisp;else{if(this._ctx.fillStyle=this._colors.selectionTransparent.css,n){var S=u[0],R=a[0]-S,y=A-d+1;this._fillCells(S,d,R,y)}else{S=s===d?u[0]:0;var _=d===l?a[0]:this._bufferService.cols;this._fillCells(S,d,_-S,1);var m=Math.max(A-d-1,0);if(this._fillCells(0,d+1,this._bufferService.cols,m),d!==A){var I=l===A?a[0]:this._bufferService.cols;this._fillCells(0,A,I,1)}}this._state.start=[u[0],u[1]],this._state.end=[a[0],a[1]],this._state.columnSelectMode=n,this._state.ydisp=this._bufferService.buffer.ydisp}}else this._clearState()},E.prototype._didStateChange=function(u,a,n,s){return!this._areCoordinatesEqual(u,this._state.start)||!this._areCoordinatesEqual(a,this._state.end)||n!==this._state.columnSelectMode||s!==this._state.ydisp},E.prototype._areCoordinatesEqual=function(u,a){return!(!u||!a)&&u[0]===a[0]&&u[1]===a[1]},w([g(4,T.IBufferService),g(5,T.IOptionsService)],E)}(b.BaseRenderLayer);v.SelectionRenderLayer=f},9596:function(N,v,L){var O,D=this&&this.__extends||(O=function(l,d){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,S){A.__proto__=S}||function(A,S){for(var R in S)Object.prototype.hasOwnProperty.call(S,R)&&(A[R]=S[R])},O(l,d)},function(l,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");function A(){this.constructor=l}O(l,d),l.prototype=d===null?Object.create(d):(A.prototype=d.prototype,new A)}),w=this&&this.__decorate||function(l,d,A,S){var R,y=arguments.length,_=y<3?d:S===null?S=Object.getOwnPropertyDescriptor(d,A):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(l,d,A,S);else for(var m=l.length-1;m>=0;m--)(R=l[m])&&(_=(y<3?R(_):y>3?R(d,A,_):R(d,A))||_);return y>3&&_&&Object.defineProperty(d,A,_),_},g=this&&this.__param||function(l,d){return function(A,S){d(A,S,l)}};Object.defineProperty(v,"__esModule",{value:!0}),v.TextRenderLayer=void 0;var b=L(3700),T=L(1546),f=L(3734),p=L(643),E=L(511),u=L(2585),a=L(4725),n=L(4269),s=function(l){function d(A,S,R,y,_,m,I,B){var P=l.call(this,A,"text",S,y,R,_,m,I)||this;return P._characterJoinerService=B,P._characterWidth=0,P._characterFont="",P._characterOverlapCache={},P._workCell=new E.CellData,P._state=new b.GridCache,P}return D(d,l),d.prototype.resize=function(A){l.prototype.resize.call(this,A);var S=this._getFont(!1,!1);this._characterWidth===A.scaledCharWidth&&this._characterFont===S||(this._characterWidth=A.scaledCharWidth,this._characterFont=S,this._characterOverlapCache={}),this._state.clear(),this._state.resize(this._bufferService.cols,this._bufferService.rows)},d.prototype.reset=function(){this._state.clear(),this._clearAll()},d.prototype._forEachCell=function(A,S,R){for(var y=A;y<=S;y++)for(var _=y+this._bufferService.buffer.ydisp,m=this._bufferService.buffer.lines.get(_),I=this._characterJoinerService.getJoinedCharacters(_),B=0;B<this._bufferService.cols;B++){m.loadCell(B,this._workCell);var P=this._workCell,M=!1,U=B;if(P.getWidth()!==0){if(I.length>0&&B===I[0][0]){M=!0;var K=I.shift();P=new n.JoinedCellData(this._workCell,m.translateToString(!0,K[0],K[1]),K[1]-K[0]),U=K[1]-1}!M&&this._isOverlapping(P)&&U<m.length-1&&m.getCodePoint(U+1)===p.NULL_CELL_CODE&&(P.content&=-12582913,P.content|=2<<22),R(P,B,y),B=U}}},d.prototype._drawBackground=function(A,S){var R=this,y=this._ctx,_=this._bufferService.cols,m=0,I=0,B=null;y.save(),this._forEachCell(A,S,function(P,M,U){var K=null;P.isInverse()?K=P.isFgDefault()?R._colors.foreground.css:P.isFgRGB()?"rgb("+f.AttributeData.toColorRGB(P.getFgColor()).join(",")+")":R._colors.ansi[P.getFgColor()].css:P.isBgRGB()?K="rgb("+f.AttributeData.toColorRGB(P.getBgColor()).join(",")+")":P.isBgPalette()&&(K=R._colors.ansi[P.getBgColor()].css),B===null&&(m=M,I=U),U!==I?(y.fillStyle=B||"",R._fillCells(m,I,_-m,1),m=M,I=U):B!==K&&(y.fillStyle=B||"",R._fillCells(m,I,M-m,1),m=M,I=U),B=K}),B!==null&&(y.fillStyle=B,this._fillCells(m,I,_-m,1)),y.restore()},d.prototype._drawForeground=function(A,S){var R=this;this._forEachCell(A,S,function(y,_,m){if(!y.isInvisible()&&(R._drawChars(y,_,m),y.isUnderline()||y.isStrikethrough())){if(R._ctx.save(),y.isInverse())if(y.isBgDefault())R._ctx.fillStyle=R._colors.background.css;else if(y.isBgRGB())R._ctx.fillStyle="rgb("+f.AttributeData.toColorRGB(y.getBgColor()).join(",")+")";else{var I=y.getBgColor();R._optionsService.options.drawBoldTextInBrightColors&&y.isBold()&&I<8&&(I+=8),R._ctx.fillStyle=R._colors.ansi[I].css}else if(y.isFgDefault())R._ctx.fillStyle=R._colors.foreground.css;else if(y.isFgRGB())R._ctx.fillStyle="rgb("+f.AttributeData.toColorRGB(y.getFgColor()).join(",")+")";else{var B=y.getFgColor();R._optionsService.options.drawBoldTextInBrightColors&&y.isBold()&&B<8&&(B+=8),R._ctx.fillStyle=R._colors.ansi[B].css}y.isStrikethrough()&&R._fillMiddleLineAtCells(_,m,y.getWidth()),y.isUnderline()&&R._fillBottomLineAtCells(_,m,y.getWidth()),R._ctx.restore()}})},d.prototype.onGridChanged=function(A,S){this._state.cache.length!==0&&(this._charAtlas&&this._charAtlas.beginFrame(),this._clearCells(0,A,this._bufferService.cols,S-A+1),this._drawBackground(A,S),this._drawForeground(A,S))},d.prototype.onOptionsChanged=function(){this._setTransparency(this._optionsService.options.allowTransparency)},d.prototype._isOverlapping=function(A){if(A.getWidth()!==1||A.getCode()<256)return!1;var S=A.getChars();if(this._characterOverlapCache.hasOwnProperty(S))return this._characterOverlapCache[S];this._ctx.save(),this._ctx.font=this._characterFont;var R=Math.floor(this._ctx.measureText(S).width)>this._characterWidth;return this._ctx.restore(),this._characterOverlapCache[S]=R,R},w([g(5,u.IBufferService),g(6,u.IOptionsService),g(7,a.ICharacterJoinerService)],d)}(T.BaseRenderLayer);v.TextRenderLayer=s},9616:(N,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.BaseCharAtlas=void 0;var L=function(){function O(){this._didWarmUp=!1}return O.prototype.dispose=function(){},O.prototype.warmUp=function(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)},O.prototype._doWarmUp=function(){},O.prototype.clear=function(){},O.prototype.beginFrame=function(){},O}();v.BaseCharAtlas=L},1420:(N,v,L)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.removeTerminalFromCache=v.acquireCharAtlas=void 0;var O=L(2040),D=L(1906),w=[];v.acquireCharAtlas=function(g,b,T,f,p){for(var E=(0,O.generateConfig)(f,p,g,T),u=0;u<w.length;u++){var a=(n=w[u]).ownedBy.indexOf(b);if(a>=0){if((0,O.configEquals)(n.config,E))return n.atlas;n.ownedBy.length===1?(n.atlas.dispose(),w.splice(u,1)):n.ownedBy.splice(a,1);break}}for(u=0;u<w.length;u++){var n=w[u];if((0,O.configEquals)(n.config,E))return n.ownedBy.push(b),n.atlas}var s={atlas:new D.DynamicCharAtlas(document,E),config:E,ownedBy:[b]};return w.push(s),s.atlas},v.removeTerminalFromCache=function(g){for(var b=0;b<w.length;b++){var T=w[b].ownedBy.indexOf(g);if(T!==-1){w[b].ownedBy.length===1?(w[b].atlas.dispose(),w.splice(b,1)):w[b].ownedBy.splice(T,1);break}}}},2040:(N,v,L)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.is256Color=v.configEquals=v.generateConfig=void 0;var O=L(643);v.generateConfig=function(D,w,g,b){var T={foreground:b.foreground,background:b.background,cursor:void 0,cursorAccent:void 0,selection:void 0,ansi:b.ansi};return{devicePixelRatio:window.devicePixelRatio,scaledCharWidth:D,scaledCharHeight:w,fontFamily:g.fontFamily,fontSize:g.fontSize,fontWeight:g.fontWeight,fontWeightBold:g.fontWeightBold,allowTransparency:g.allowTransparency,colors:T}},v.configEquals=function(D,w){for(var g=0;g<D.colors.ansi.length;g++)if(D.colors.ansi[g].rgba!==w.colors.ansi[g].rgba)return!1;return D.devicePixelRatio===w.devicePixelRatio&&D.fontFamily===w.fontFamily&&D.fontSize===w.fontSize&&D.fontWeight===w.fontWeight&&D.fontWeightBold===w.fontWeightBold&&D.allowTransparency===w.allowTransparency&&D.scaledCharWidth===w.scaledCharWidth&&D.scaledCharHeight===w.scaledCharHeight&&D.colors.foreground===w.colors.foreground&&D.colors.background===w.colors.background},v.is256Color=function(D){return D<O.DEFAULT_COLOR}},8803:(N,v,L)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.CHAR_ATLAS_CELL_SPACING=v.TEXT_BASELINE=v.DIM_OPACITY=v.INVERTED_DEFAULT_COLOR=void 0;var O=L(6114);v.INVERTED_DEFAULT_COLOR=257,v.DIM_OPACITY=.5,v.TEXT_BASELINE=O.isFirefox?"bottom":"ideographic",v.CHAR_ATLAS_CELL_SPACING=1},1906:function(N,v,L){var O,D=this&&this.__extends||(O=function(S,R){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,_){y.__proto__=_}||function(y,_){for(var m in _)Object.prototype.hasOwnProperty.call(_,m)&&(y[m]=_[m])},O(S,R)},function(S,R){if(typeof R!="function"&&R!==null)throw new TypeError("Class extends value "+String(R)+" is not a constructor or null");function y(){this.constructor=S}O(S,R),S.prototype=R===null?Object.create(R):(y.prototype=R.prototype,new y)});Object.defineProperty(v,"__esModule",{value:!0}),v.NoneCharAtlas=v.DynamicCharAtlas=v.getGlyphCacheKey=void 0;var w=L(8803),g=L(9616),b=L(5680),T=L(7001),f=L(6114),p=L(1752),E=L(4774),u=1024,a=1024,n={css:"rgba(0, 0, 0, 0)",rgba:0};function s(S){return S.code<<21|S.bg<<12|S.fg<<3|(S.bold?0:4)+(S.dim?0:2)+(S.italic?0:1)}v.getGlyphCacheKey=s;var l=function(S){function R(y,_){var m=S.call(this)||this;m._config=_,m._drawToCacheCount=0,m._glyphsWaitingOnBitmap=[],m._bitmapCommitTimeout=null,m._bitmap=null,m._cacheCanvas=y.createElement("canvas"),m._cacheCanvas.width=u,m._cacheCanvas.height=a,m._cacheCtx=(0,p.throwIfFalsy)(m._cacheCanvas.getContext("2d",{alpha:!0}));var I=y.createElement("canvas");I.width=m._config.scaledCharWidth,I.height=m._config.scaledCharHeight,m._tmpCtx=(0,p.throwIfFalsy)(I.getContext("2d",{alpha:m._config.allowTransparency})),m._width=Math.floor(u/m._config.scaledCharWidth),m._height=Math.floor(a/m._config.scaledCharHeight);var B=m._width*m._height;return m._cacheMap=new T.LRUMap(B),m._cacheMap.prealloc(B),m}return D(R,S),R.prototype.dispose=function(){this._bitmapCommitTimeout!==null&&(window.clearTimeout(this._bitmapCommitTimeout),this._bitmapCommitTimeout=null)},R.prototype.beginFrame=function(){this._drawToCacheCount=0},R.prototype.clear=function(){if(this._cacheMap.size>0){var y=this._width*this._height;this._cacheMap=new T.LRUMap(y),this._cacheMap.prealloc(y)}this._cacheCtx.clearRect(0,0,u,a),this._tmpCtx.clearRect(0,0,this._config.scaledCharWidth,this._config.scaledCharHeight)},R.prototype.draw=function(y,_,m,I){if(_.code===32)return!0;if(!this._canCache(_))return!1;var B=s(_),P=this._cacheMap.get(B);if(P!=null)return this._drawFromCache(y,P,m,I),!0;if(this._drawToCacheCount<100){var M;M=this._cacheMap.size<this._cacheMap.capacity?this._cacheMap.size:this._cacheMap.peek().index;var U=this._drawToCache(_,M);return this._cacheMap.set(B,U),this._drawFromCache(y,U,m,I),!0}return!1},R.prototype._canCache=function(y){return y.code<256},R.prototype._toCoordinateX=function(y){return y%this._width*this._config.scaledCharWidth},R.prototype._toCoordinateY=function(y){return Math.floor(y/this._width)*this._config.scaledCharHeight},R.prototype._drawFromCache=function(y,_,m,I){if(!_.isEmpty){var B=this._toCoordinateX(_.index),P=this._toCoordinateY(_.index);y.drawImage(_.inBitmap?this._bitmap:this._cacheCanvas,B,P,this._config.scaledCharWidth,this._config.scaledCharHeight,m,I,this._config.scaledCharWidth,this._config.scaledCharHeight)}},R.prototype._getColorFromAnsiIndex=function(y){return y<this._config.colors.ansi.length?this._config.colors.ansi[y]:b.DEFAULT_ANSI_COLORS[y]},R.prototype._getBackgroundColor=function(y){return this._config.allowTransparency?n:y.bg===w.INVERTED_DEFAULT_COLOR?this._config.colors.foreground:y.bg<256?this._getColorFromAnsiIndex(y.bg):this._config.colors.background},R.prototype._getForegroundColor=function(y){return y.fg===w.INVERTED_DEFAULT_COLOR?E.color.opaque(this._config.colors.background):y.fg<256?this._getColorFromAnsiIndex(y.fg):this._config.colors.foreground},R.prototype._drawToCache=function(y,_){this._drawToCacheCount++,this._tmpCtx.save();var m=this._getBackgroundColor(y);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=m.css,this._tmpCtx.fillRect(0,0,this._config.scaledCharWidth,this._config.scaledCharHeight),this._tmpCtx.globalCompositeOperation="source-over";var I=y.bold?this._config.fontWeightBold:this._config.fontWeight,B=y.italic?"italic":"";this._tmpCtx.font=B+" "+I+" "+this._config.fontSize*this._config.devicePixelRatio+"px "+this._config.fontFamily,this._tmpCtx.textBaseline=w.TEXT_BASELINE,this._tmpCtx.fillStyle=this._getForegroundColor(y).css,y.dim&&(this._tmpCtx.globalAlpha=w.DIM_OPACITY),this._tmpCtx.fillText(y.chars,0,this._config.scaledCharHeight);var P=this._tmpCtx.getImageData(0,0,this._config.scaledCharWidth,this._config.scaledCharHeight),M=!1;if(this._config.allowTransparency||(M=A(P,m)),M&&y.chars==="_"&&!this._config.allowTransparency)for(var U=1;U<=5&&(this._tmpCtx.fillText(y.chars,0,this._config.scaledCharHeight-U),M=A(P=this._tmpCtx.getImageData(0,0,this._config.scaledCharWidth,this._config.scaledCharHeight),m));U++);this._tmpCtx.restore();var K=this._toCoordinateX(_),W=this._toCoordinateY(_);this._cacheCtx.putImageData(P,K,W);var X={index:_,isEmpty:M,inBitmap:!1};return this._addGlyphToBitmap(X),X},R.prototype._addGlyphToBitmap=function(y){var _=this;!("createImageBitmap"in window)||f.isFirefox||f.isSafari||(this._glyphsWaitingOnBitmap.push(y),this._bitmapCommitTimeout===null&&(this._bitmapCommitTimeout=window.setTimeout(function(){return _._generateBitmap()},100)))},R.prototype._generateBitmap=function(){var y=this,_=this._glyphsWaitingOnBitmap;this._glyphsWaitingOnBitmap=[],window.createImageBitmap(this._cacheCanvas).then(function(m){y._bitmap=m;for(var I=0;I<_.length;I++)_[I].inBitmap=!0}),this._bitmapCommitTimeout=null},R}(g.BaseCharAtlas);v.DynamicCharAtlas=l;var d=function(S){function R(y,_){return S.call(this)||this}return D(R,S),R.prototype.draw=function(y,_,m,I){return!1},R}(g.BaseCharAtlas);function A(S,R){for(var y=!0,_=R.rgba>>>24,m=R.rgba>>>16&255,I=R.rgba>>>8&255,B=0;B<S.data.length;B+=4)S.data[B]===_&&S.data[B+1]===m&&S.data[B+2]===I?S.data[B+3]=0:y=!1;return y}v.NoneCharAtlas=d},7001:(N,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.LRUMap=void 0;var L=function(){function O(D){this.capacity=D,this._map={},this._head=null,this._tail=null,this._nodePool=[],this.size=0}return O.prototype._unlinkNode=function(D){var w=D.prev,g=D.next;D===this._head&&(this._head=g),D===this._tail&&(this._tail=w),w!==null&&(w.next=g),g!==null&&(g.prev=w)},O.prototype._appendNode=function(D){var w=this._tail;w!==null&&(w.next=D),D.prev=w,D.next=null,this._tail=D,this._head===null&&(this._head=D)},O.prototype.prealloc=function(D){for(var w=this._nodePool,g=0;g<D;g++)w.push({prev:null,next:null,key:null,value:null})},O.prototype.get=function(D){var w=this._map[D];return w!==void 0?(this._unlinkNode(w),this._appendNode(w),w.value):null},O.prototype.peekValue=function(D){var w=this._map[D];return w!==void 0?w.value:null},O.prototype.peek=function(){var D=this._head;return D===null?null:D.value},O.prototype.set=function(D,w){var g=this._map[D];if(g!==void 0)g=this._map[D],this._unlinkNode(g),g.value=w;else if(this.size>=this.capacity)g=this._head,this._unlinkNode(g),delete this._map[g.key],g.key=D,g.value=w,this._map[D]=g;else{var b=this._nodePool;b.length>0?((g=b.pop()).key=D,g.value=w):g={prev:null,next:null,key:D,value:w},this._map[D]=g,this.size++}this._appendNode(g)},O}();v.LRUMap=L},1296:function(N,v,L){var O,D=this&&this.__extends||(O=function(y,_){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,I){m.__proto__=I}||function(m,I){for(var B in I)Object.prototype.hasOwnProperty.call(I,B)&&(m[B]=I[B])},O(y,_)},function(y,_){if(typeof _!="function"&&_!==null)throw new TypeError("Class extends value "+String(_)+" is not a constructor or null");function m(){this.constructor=y}O(y,_),y.prototype=_===null?Object.create(_):(m.prototype=_.prototype,new m)}),w=this&&this.__decorate||function(y,_,m,I){var B,P=arguments.length,M=P<3?_:I===null?I=Object.getOwnPropertyDescriptor(_,m):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(y,_,m,I);else for(var U=y.length-1;U>=0;U--)(B=y[U])&&(M=(P<3?B(M):P>3?B(_,m,M):B(_,m))||M);return P>3&&M&&Object.defineProperty(_,m,M),M},g=this&&this.__param||function(y,_){return function(m,I){_(m,I,y)}};Object.defineProperty(v,"__esModule",{value:!0}),v.DomRenderer=void 0;var b=L(3787),T=L(8803),f=L(844),p=L(4725),E=L(2585),u=L(8460),a=L(4774),n=L(9631),s="xterm-dom-renderer-owner-",l="xterm-fg-",d="xterm-bg-",A="xterm-focus",S=1,R=function(y){function _(m,I,B,P,M,U,K,W,X,ie){var se=y.call(this)||this;return se._colors=m,se._element=I,se._screenElement=B,se._viewportElement=P,se._linkifier=M,se._linkifier2=U,se._charSizeService=W,se._optionsService=X,se._bufferService=ie,se._terminalClass=S++,se._rowElements=[],se._rowContainer=document.createElement("div"),se._rowContainer.classList.add("xterm-rows"),se._rowContainer.style.lineHeight="normal",se._rowContainer.setAttribute("aria-hidden","true"),se._refreshRowElements(se._bufferService.cols,se._bufferService.rows),se._selectionContainer=document.createElement("div"),se._selectionContainer.classList.add("xterm-selection"),se._selectionContainer.setAttribute("aria-hidden","true"),se.dimensions={scaledCharWidth:0,scaledCharHeight:0,scaledCellWidth:0,scaledCellHeight:0,scaledCharLeft:0,scaledCharTop:0,scaledCanvasWidth:0,scaledCanvasHeight:0,canvasWidth:0,canvasHeight:0,actualCellWidth:0,actualCellHeight:0},se._updateDimensions(),se._injectCss(),se._rowFactory=K.createInstance(b.DomRendererRowFactory,document,se._colors),se._element.classList.add(s+se._terminalClass),se._screenElement.appendChild(se._rowContainer),se._screenElement.appendChild(se._selectionContainer),se._linkifier.onShowLinkUnderline(function(le){return se._onLinkHover(le)}),se._linkifier.onHideLinkUnderline(function(le){return se._onLinkLeave(le)}),se._linkifier2.onShowLinkUnderline(function(le){return se._onLinkHover(le)}),se._linkifier2.onHideLinkUnderline(function(le){return se._onLinkLeave(le)}),se}return D(_,y),Object.defineProperty(_.prototype,"onRequestRedraw",{get:function(){return new u.EventEmitter().event},enumerable:!1,configurable:!0}),_.prototype.dispose=function(){this._element.classList.remove(s+this._terminalClass),(0,n.removeElementFromParent)(this._rowContainer,this._selectionContainer,this._themeStyleElement,this._dimensionsStyleElement),y.prototype.dispose.call(this)},_.prototype._updateDimensions=function(){this.dimensions.scaledCharWidth=this._charSizeService.width*window.devicePixelRatio,this.dimensions.scaledCharHeight=Math.ceil(this._charSizeService.height*window.devicePixelRatio),this.dimensions.scaledCellWidth=this.dimensions.scaledCharWidth+Math.round(this._optionsService.options.letterSpacing),this.dimensions.scaledCellHeight=Math.floor(this.dimensions.scaledCharHeight*this._optionsService.options.lineHeight),this.dimensions.scaledCharLeft=0,this.dimensions.scaledCharTop=0,this.dimensions.scaledCanvasWidth=this.dimensions.scaledCellWidth*this._bufferService.cols,this.dimensions.scaledCanvasHeight=this.dimensions.scaledCellHeight*this._bufferService.rows,this.dimensions.canvasWidth=Math.round(this.dimensions.scaledCanvasWidth/window.devicePixelRatio),this.dimensions.canvasHeight=Math.round(this.dimensions.scaledCanvasHeight/window.devicePixelRatio),this.dimensions.actualCellWidth=this.dimensions.canvasWidth/this._bufferService.cols,this.dimensions.actualCellHeight=this.dimensions.canvasHeight/this._bufferService.rows;for(var m=0,I=this._rowElements;m<I.length;m++){var B=I[m];B.style.width=this.dimensions.canvasWidth+"px",B.style.height=this.dimensions.actualCellHeight+"px",B.style.lineHeight=this.dimensions.actualCellHeight+"px",B.style.overflow="hidden"}this._dimensionsStyleElement||(this._dimensionsStyleElement=document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));var P=this._terminalSelector+" .xterm-rows span { display: inline-block; height: 100%; vertical-align: top; width: "+this.dimensions.actualCellWidth+"px}";this._dimensionsStyleElement.textContent=P,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=this.dimensions.canvasWidth+"px",this._screenElement.style.height=this.dimensions.canvasHeight+"px"},_.prototype.setColors=function(m){this._colors=m,this._injectCss()},_.prototype._injectCss=function(){var m=this;this._themeStyleElement||(this._themeStyleElement=document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));var I=this._terminalSelector+" .xterm-rows { color: "+this._colors.foreground.css+"; font-family: "+this._optionsService.options.fontFamily+"; font-size: "+this._optionsService.options.fontSize+"px;}";I+=this._terminalSelector+" span:not(."+b.BOLD_CLASS+") { font-weight: "+this._optionsService.options.fontWeight+";}"+this._terminalSelector+" span."+b.BOLD_CLASS+" { font-weight: "+this._optionsService.options.fontWeightBold+";}"+this._terminalSelector+" span."+b.ITALIC_CLASS+" { font-style: italic;}",I+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% { box-shadow: none; }}",I+="@keyframes blink_block_"+this._terminalClass+" { 0% { background-color: "+this._colors.cursor.css+"; color: "+this._colors.cursorAccent.css+"; } 50% { background-color: "+this._colors.cursorAccent.css+"; color: "+this._colors.cursor.css+"; }}",I+=this._terminalSelector+" .xterm-rows:not(.xterm-focus) ."+b.CURSOR_CLASS+"."+b.CURSOR_STYLE_BLOCK_CLASS+" { outline: 1px solid "+this._colors.cursor.css+"; outline-offset: -1px;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+b.CURSOR_CLASS+"."+b.CURSOR_BLINK_CLASS+":not(."+b.CURSOR_STYLE_BLOCK_CLASS+") { animation: blink_box_shadow_"+this._terminalClass+" 1s step-end infinite;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+b.CURSOR_CLASS+"."+b.CURSOR_BLINK_CLASS+"."+b.CURSOR_STYLE_BLOCK_CLASS+" { animation: blink_block_"+this._terminalClass+" 1s step-end infinite;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+b.CURSOR_CLASS+"."+b.CURSOR_STYLE_BLOCK_CLASS+" { background-color: "+this._colors.cursor.css+"; color: "+this._colors.cursorAccent.css+";}"+this._terminalSelector+" .xterm-rows ."+b.CURSOR_CLASS+"."+b.CURSOR_STYLE_BAR_CLASS+" { box-shadow: "+this._optionsService.options.cursorWidth+"px 0 0 "+this._colors.cursor.css+" inset;}"+this._terminalSelector+" .xterm-rows ."+b.CURSOR_CLASS+"."+b.CURSOR_STYLE_UNDERLINE_CLASS+" { box-shadow: 0 -1px 0 "+this._colors.cursor.css+" inset;}",I+=this._terminalSelector+" .xterm-selection { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}"+this._terminalSelector+" .xterm-selection div { position: absolute; background-color: "+this._colors.selectionTransparent.css+";}",this._colors.ansi.forEach(function(B,P){I+=m._terminalSelector+" ."+l+P+" { color: "+B.css+"; }"+m._terminalSelector+" ."+d+P+" { background-color: "+B.css+"; }"}),I+=this._terminalSelector+" ."+l+T.INVERTED_DEFAULT_COLOR+" { color: "+a.color.opaque(this._colors.background).css+"; }"+this._terminalSelector+" ."+d+T.INVERTED_DEFAULT_COLOR+" { background-color: "+this._colors.foreground.css+"; }",this._themeStyleElement.textContent=I},_.prototype.onDevicePixelRatioChange=function(){this._updateDimensions()},_.prototype._refreshRowElements=function(m,I){for(var B=this._rowElements.length;B<=I;B++){var P=document.createElement("div");this._rowContainer.appendChild(P),this._rowElements.push(P)}for(;this._rowElements.length>I;)this._rowContainer.removeChild(this._rowElements.pop())},_.prototype.onResize=function(m,I){this._refreshRowElements(m,I),this._updateDimensions()},_.prototype.onCharSizeChanged=function(){this._updateDimensions()},_.prototype.onBlur=function(){this._rowContainer.classList.remove(A)},_.prototype.onFocus=function(){this._rowContainer.classList.add(A)},_.prototype.onSelectionChanged=function(m,I,B){for(;this._selectionContainer.children.length;)this._selectionContainer.removeChild(this._selectionContainer.children[0]);if(m&&I){var P=m[1]-this._bufferService.buffer.ydisp,M=I[1]-this._bufferService.buffer.ydisp,U=Math.max(P,0),K=Math.min(M,this._bufferService.rows-1);if(!(U>=this._bufferService.rows||K<0)){var W=document.createDocumentFragment();if(B)W.appendChild(this._createSelectionElement(U,m[0],I[0],K-U+1));else{var X=P===U?m[0]:0,ie=U===M?I[0]:this._bufferService.cols;W.appendChild(this._createSelectionElement(U,X,ie));var se=K-U-1;if(W.appendChild(this._createSelectionElement(U+1,0,this._bufferService.cols,se)),U!==K){var le=M===K?I[0]:this._bufferService.cols;W.appendChild(this._createSelectionElement(K,0,le))}}this._selectionContainer.appendChild(W)}}},_.prototype._createSelectionElement=function(m,I,B,P){P===void 0&&(P=1);var M=document.createElement("div");return M.style.height=P*this.dimensions.actualCellHeight+"px",M.style.top=m*this.dimensions.actualCellHeight+"px",M.style.left=I*this.dimensions.actualCellWidth+"px",M.style.width=this.dimensions.actualCellWidth*(B-I)+"px",M},_.prototype.onCursorMove=function(){},_.prototype.onOptionsChanged=function(){this._updateDimensions(),this._injectCss()},_.prototype.clear=function(){for(var m=0,I=this._rowElements;m<I.length;m++)I[m].innerText=""},_.prototype.renderRows=function(m,I){for(var B=this._bufferService.buffer.ybase+this._bufferService.buffer.y,P=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),M=this._optionsService.options.cursorBlink,U=m;U<=I;U++){var K=this._rowElements[U];K.innerText="";var W=U+this._bufferService.buffer.ydisp,X=this._bufferService.buffer.lines.get(W),ie=this._optionsService.options.cursorStyle;K.appendChild(this._rowFactory.createRow(X,W,W===B,ie,P,M,this.dimensions.actualCellWidth,this._bufferService.cols))}},Object.defineProperty(_.prototype,"_terminalSelector",{get:function(){return"."+s+this._terminalClass},enumerable:!1,configurable:!0}),_.prototype._onLinkHover=function(m){this._setCellUnderline(m.x1,m.x2,m.y1,m.y2,m.cols,!0)},_.prototype._onLinkLeave=function(m){this._setCellUnderline(m.x1,m.x2,m.y1,m.y2,m.cols,!1)},_.prototype._setCellUnderline=function(m,I,B,P,M,U){for(;m!==I||B!==P;){var K=this._rowElements[B];if(!K)return;var W=K.children[m];W&&(W.style.textDecoration=U?"underline":"none"),++m>=M&&(m=0,B++)}},w([g(6,E.IInstantiationService),g(7,p.ICharSizeService),g(8,E.IOptionsService),g(9,E.IBufferService)],_)}(f.Disposable);v.DomRenderer=R},3787:function(N,v,L){var O=this&&this.__decorate||function(n,s,l,d){var A,S=arguments.length,R=S<3?s:d===null?d=Object.getOwnPropertyDescriptor(s,l):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(n,s,l,d);else for(var y=n.length-1;y>=0;y--)(A=n[y])&&(R=(S<3?A(R):S>3?A(s,l,R):A(s,l))||R);return S>3&&R&&Object.defineProperty(s,l,R),R},D=this&&this.__param||function(n,s){return function(l,d){s(l,d,n)}};Object.defineProperty(v,"__esModule",{value:!0}),v.DomRendererRowFactory=v.CURSOR_STYLE_UNDERLINE_CLASS=v.CURSOR_STYLE_BAR_CLASS=v.CURSOR_STYLE_BLOCK_CLASS=v.CURSOR_BLINK_CLASS=v.CURSOR_CLASS=v.STRIKETHROUGH_CLASS=v.UNDERLINE_CLASS=v.ITALIC_CLASS=v.DIM_CLASS=v.BOLD_CLASS=void 0;var w=L(8803),g=L(643),b=L(511),T=L(2585),f=L(4774),p=L(4725),E=L(4269);v.BOLD_CLASS="xterm-bold",v.DIM_CLASS="xterm-dim",v.ITALIC_CLASS="xterm-italic",v.UNDERLINE_CLASS="xterm-underline",v.STRIKETHROUGH_CLASS="xterm-strikethrough",v.CURSOR_CLASS="xterm-cursor",v.CURSOR_BLINK_CLASS="xterm-cursor-blink",v.CURSOR_STYLE_BLOCK_CLASS="xterm-cursor-block",v.CURSOR_STYLE_BAR_CLASS="xterm-cursor-bar",v.CURSOR_STYLE_UNDERLINE_CLASS="xterm-cursor-underline";var u=function(){function n(s,l,d,A,S){this._document=s,this._colors=l,this._characterJoinerService=d,this._optionsService=A,this._coreService=S,this._workCell=new b.CellData}return n.prototype.setColors=function(s){this._colors=s},n.prototype.createRow=function(s,l,d,A,S,R,y,_){for(var m=this._document.createDocumentFragment(),I=this._characterJoinerService.getJoinedCharacters(l),B=0,P=Math.min(s.length,_)-1;P>=0;P--)if(s.loadCell(P,this._workCell).getCode()!==g.NULL_CELL_CODE||d&&P===S){B=P+1;break}for(P=0;P<B;P++){s.loadCell(P,this._workCell);var M=this._workCell.getWidth();if(M!==0){var U=!1,K=P,W=this._workCell;if(I.length>0&&P===I[0][0]){U=!0;var X=I.shift();W=new E.JoinedCellData(this._workCell,s.translateToString(!0,X[0],X[1]),X[1]-X[0]),K=X[1]-1,M=W.getWidth()}var ie=this._document.createElement("span");if(M>1&&(ie.style.width=y*M+"px"),U&&(ie.style.display="inline",S>=P&&S<=K&&(S=P)),!this._coreService.isCursorHidden&&d&&P===S)switch(ie.classList.add(v.CURSOR_CLASS),R&&ie.classList.add(v.CURSOR_BLINK_CLASS),A){case"bar":ie.classList.add(v.CURSOR_STYLE_BAR_CLASS);break;case"underline":ie.classList.add(v.CURSOR_STYLE_UNDERLINE_CLASS);break;default:ie.classList.add(v.CURSOR_STYLE_BLOCK_CLASS)}W.isBold()&&ie.classList.add(v.BOLD_CLASS),W.isItalic()&&ie.classList.add(v.ITALIC_CLASS),W.isDim()&&ie.classList.add(v.DIM_CLASS),W.isUnderline()&&ie.classList.add(v.UNDERLINE_CLASS),W.isInvisible()?ie.textContent=g.WHITESPACE_CELL_CHAR:ie.textContent=W.getChars()||g.WHITESPACE_CELL_CHAR,W.isStrikethrough()&&ie.classList.add(v.STRIKETHROUGH_CLASS);var se=W.getFgColor(),le=W.getFgColorMode(),ve=W.getBgColor(),q=W.getBgColorMode(),ee=!!W.isInverse();if(ee){var ae=se;se=ve,ve=ae;var _e=le;le=q,q=_e}switch(le){case 16777216:case 33554432:W.isBold()&&se<8&&this._optionsService.options.drawBoldTextInBrightColors&&(se+=8),this._applyMinimumContrast(ie,this._colors.background,this._colors.ansi[se])||ie.classList.add("xterm-fg-"+se);break;case 50331648:var fe=f.rgba.toColor(se>>16&255,se>>8&255,255&se);this._applyMinimumContrast(ie,this._colors.background,fe)||this._addStyle(ie,"color:#"+a(se.toString(16),"0",6));break;default:this._applyMinimumContrast(ie,this._colors.background,this._colors.foreground)||ee&&ie.classList.add("xterm-fg-"+w.INVERTED_DEFAULT_COLOR)}switch(q){case 16777216:case 33554432:ie.classList.add("xterm-bg-"+ve);break;case 50331648:this._addStyle(ie,"background-color:#"+a(ve.toString(16),"0",6));break;default:ee&&ie.classList.add("xterm-bg-"+w.INVERTED_DEFAULT_COLOR)}m.appendChild(ie),P=K}}return m},n.prototype._applyMinimumContrast=function(s,l,d){if(this._optionsService.options.minimumContrastRatio===1)return!1;var A=this._colors.contrastCache.getColor(this._workCell.bg,this._workCell.fg);return A===void 0&&(A=f.color.ensureContrastRatio(l,d,this._optionsService.options.minimumContrastRatio),this._colors.contrastCache.setColor(this._workCell.bg,this._workCell.fg,A!=null?A:null)),!!A&&(this._addStyle(s,"color:"+A.css),!0)},n.prototype._addStyle=function(s,l){s.setAttribute("style",""+(s.getAttribute("style")||"")+l+";")},O([D(2,p.ICharacterJoinerService),D(3,T.IOptionsService),D(4,T.ICoreService)],n)}();function a(n,s,l){for(;n.length<l;)n=s+n;return n}v.DomRendererRowFactory=u},456:(N,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.SelectionModel=void 0;var L=function(){function O(D){this._bufferService=D,this.isSelectAllActive=!1,this.selectionStartLength=0}return O.prototype.clearSelection=function(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0},Object.defineProperty(O.prototype,"finalSelectionStart",{get:function(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"finalSelectionEnd",{get:function(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){var D=this.selectionStart[0]+this.selectionStartLength;return D>this._bufferService.cols?[D%this._bufferService.cols,this.selectionStart[1]+Math.floor(D/this._bufferService.cols)]:[D,this.selectionStart[1]]}return this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]?[Math.max(this.selectionStart[0]+this.selectionStartLength,this.selectionEnd[0]),this.selectionEnd[1]]:this.selectionEnd}},enumerable:!1,configurable:!0}),O.prototype.areSelectionValuesReversed=function(){var D=this.selectionStart,w=this.selectionEnd;return!(!D||!w)&&(D[1]>w[1]||D[1]===w[1]&&D[0]>w[0])},O.prototype.onTrim=function(D){return this.selectionStart&&(this.selectionStart[1]-=D),this.selectionEnd&&(this.selectionEnd[1]-=D),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)},O}();v.SelectionModel=L},428:function(N,v,L){var O=this&&this.__decorate||function(f,p,E,u){var a,n=arguments.length,s=n<3?p:u===null?u=Object.getOwnPropertyDescriptor(p,E):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(f,p,E,u);else for(var l=f.length-1;l>=0;l--)(a=f[l])&&(s=(n<3?a(s):n>3?a(p,E,s):a(p,E))||s);return n>3&&s&&Object.defineProperty(p,E,s),s},D=this&&this.__param||function(f,p){return function(E,u){p(E,u,f)}};Object.defineProperty(v,"__esModule",{value:!0}),v.CharSizeService=void 0;var w=L(2585),g=L(8460),b=function(){function f(p,E,u){this._optionsService=u,this.width=0,this.height=0,this._onCharSizeChange=new g.EventEmitter,this._measureStrategy=new T(p,E,this._optionsService)}return Object.defineProperty(f.prototype,"hasValidSize",{get:function(){return this.width>0&&this.height>0},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"onCharSizeChange",{get:function(){return this._onCharSizeChange.event},enumerable:!1,configurable:!0}),f.prototype.measure=function(){var p=this._measureStrategy.measure();p.width===this.width&&p.height===this.height||(this.width=p.width,this.height=p.height,this._onCharSizeChange.fire())},O([D(2,w.IOptionsService)],f)}();v.CharSizeService=b;var T=function(){function f(p,E,u){this._document=p,this._parentElement=E,this._optionsService=u,this._result={width:0,height:0},this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W",this._measureElement.setAttribute("aria-hidden","true"),this._parentElement.appendChild(this._measureElement)}return f.prototype.measure=function(){this._measureElement.style.fontFamily=this._optionsService.options.fontFamily,this._measureElement.style.fontSize=this._optionsService.options.fontSize+"px";var p=this._measureElement.getBoundingClientRect();return p.width!==0&&p.height!==0&&(this._result.width=p.width,this._result.height=Math.ceil(p.height)),this._result},f}()},4269:function(N,v,L){var O,D=this&&this.__extends||(O=function(a,n){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,l){s.__proto__=l}||function(s,l){for(var d in l)Object.prototype.hasOwnProperty.call(l,d)&&(s[d]=l[d])},O(a,n)},function(a,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function s(){this.constructor=a}O(a,n),a.prototype=n===null?Object.create(n):(s.prototype=n.prototype,new s)}),w=this&&this.__decorate||function(a,n,s,l){var d,A=arguments.length,S=A<3?n:l===null?l=Object.getOwnPropertyDescriptor(n,s):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(a,n,s,l);else for(var R=a.length-1;R>=0;R--)(d=a[R])&&(S=(A<3?d(S):A>3?d(n,s,S):d(n,s))||S);return A>3&&S&&Object.defineProperty(n,s,S),S},g=this&&this.__param||function(a,n){return function(s,l){n(s,l,a)}};Object.defineProperty(v,"__esModule",{value:!0}),v.CharacterJoinerService=v.JoinedCellData=void 0;var b=L(3734),T=L(643),f=L(511),p=L(2585),E=function(a){function n(s,l,d){var A=a.call(this)||this;return A.content=0,A.combinedData="",A.fg=s.fg,A.bg=s.bg,A.combinedData=l,A._width=d,A}return D(n,a),n.prototype.isCombined=function(){return 2097152},n.prototype.getWidth=function(){return this._width},n.prototype.getChars=function(){return this.combinedData},n.prototype.getCode=function(){return 2097151},n.prototype.setFromCharData=function(s){throw new Error("not implemented")},n.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},n}(b.AttributeData);v.JoinedCellData=E;var u=function(){function a(n){this._bufferService=n,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new f.CellData}return a.prototype.register=function(n){var s={id:this._nextCharacterJoinerId++,handler:n};return this._characterJoiners.push(s),s.id},a.prototype.deregister=function(n){for(var s=0;s<this._characterJoiners.length;s++)if(this._characterJoiners[s].id===n)return this._characterJoiners.splice(s,1),!0;return!1},a.prototype.getJoinedCharacters=function(n){if(this._characterJoiners.length===0)return[];var s=this._bufferService.buffer.lines.get(n);if(!s||s.length===0)return[];for(var l=[],d=s.translateToString(!0),A=0,S=0,R=0,y=s.getFg(0),_=s.getBg(0),m=0;m<s.getTrimmedLength();m++)if(s.loadCell(m,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==y||this._workCell.bg!==_){if(m-A>1)for(var I=this._getJoinedRanges(d,R,S,s,A),B=0;B<I.length;B++)l.push(I[B]);A=m,R=S,y=this._workCell.fg,_=this._workCell.bg}S+=this._workCell.getChars().length||T.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-A>1)for(I=this._getJoinedRanges(d,R,S,s,A),B=0;B<I.length;B++)l.push(I[B]);return l},a.prototype._getJoinedRanges=function(n,s,l,d,A){for(var S=n.substring(s,l),R=this._characterJoiners[0].handler(S),y=1;y<this._characterJoiners.length;y++)for(var _=this._characterJoiners[y].handler(S),m=0;m<_.length;m++)a._mergeRanges(R,_[m]);return this._stringRangesToCellRanges(R,d,A),R},a.prototype._stringRangesToCellRanges=function(n,s,l){var d=0,A=!1,S=0,R=n[d];if(R){for(var y=l;y<this._bufferService.cols;y++){var _=s.getWidth(y),m=s.getString(y).length||T.WHITESPACE_CELL_CHAR.length;if(_!==0){if(!A&&R[0]<=S&&(R[0]=y,A=!0),R[1]<=S){if(R[1]=y,!(R=n[++d]))break;R[0]<=S?(R[0]=y,A=!0):A=!1}S+=m}}R&&(R[1]=this._bufferService.cols)}},a._mergeRanges=function(n,s){for(var l=!1,d=0;d<n.length;d++){var A=n[d];if(l){if(s[1]<=A[0])return n[d-1][1]=s[1],n;if(s[1]<=A[1])return n[d-1][1]=Math.max(s[1],A[1]),n.splice(d,1),n;n.splice(d,1),d--}else{if(s[1]<=A[0])return n.splice(d,0,s),n;if(s[1]<=A[1])return A[0]=Math.min(s[0],A[0]),n;s[0]<A[1]&&(A[0]=Math.min(s[0],A[0]),l=!0)}}return l?n[n.length-1][1]=s[1]:n.push(s),n},a=w([g(0,p.IBufferService)],a)}();v.CharacterJoinerService=u},5114:(N,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.CoreBrowserService=void 0;var L=function(){function O(D){this._textarea=D}return Object.defineProperty(O.prototype,"isFocused",{get:function(){return(this._textarea.getRootNode?this._textarea.getRootNode():document).activeElement===this._textarea&&document.hasFocus()},enumerable:!1,configurable:!0}),O}();v.CoreBrowserService=L},8934:function(N,v,L){var O=this&&this.__decorate||function(T,f,p,E){var u,a=arguments.length,n=a<3?f:E===null?E=Object.getOwnPropertyDescriptor(f,p):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(T,f,p,E);else for(var s=T.length-1;s>=0;s--)(u=T[s])&&(n=(a<3?u(n):a>3?u(f,p,n):u(f,p))||n);return a>3&&n&&Object.defineProperty(f,p,n),n},D=this&&this.__param||function(T,f){return function(p,E){f(p,E,T)}};Object.defineProperty(v,"__esModule",{value:!0}),v.MouseService=void 0;var w=L(4725),g=L(9806),b=function(){function T(f,p){this._renderService=f,this._charSizeService=p}return T.prototype.getCoords=function(f,p,E,u,a){return(0,g.getCoords)(f,p,E,u,this._charSizeService.hasValidSize,this._renderService.dimensions.actualCellWidth,this._renderService.dimensions.actualCellHeight,a)},T.prototype.getRawByteCoords=function(f,p,E,u){var a=this.getCoords(f,p,E,u);return(0,g.getRawByteCoords)(a)},O([D(0,w.IRenderService),D(1,w.ICharSizeService)],T)}();v.MouseService=b},3230:function(N,v,L){var O,D=this&&this.__extends||(O=function(s,l){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,A){d.__proto__=A}||function(d,A){for(var S in A)Object.prototype.hasOwnProperty.call(A,S)&&(d[S]=A[S])},O(s,l)},function(s,l){if(typeof l!="function"&&l!==null)throw new TypeError("Class extends value "+String(l)+" is not a constructor or null");function d(){this.constructor=s}O(s,l),s.prototype=l===null?Object.create(l):(d.prototype=l.prototype,new d)}),w=this&&this.__decorate||function(s,l,d,A){var S,R=arguments.length,y=R<3?l:A===null?A=Object.getOwnPropertyDescriptor(l,d):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(s,l,d,A);else for(var _=s.length-1;_>=0;_--)(S=s[_])&&(y=(R<3?S(y):R>3?S(l,d,y):S(l,d))||y);return R>3&&y&&Object.defineProperty(l,d,y),y},g=this&&this.__param||function(s,l){return function(d,A){l(d,A,s)}};Object.defineProperty(v,"__esModule",{value:!0}),v.RenderService=void 0;var b=L(6193),T=L(8460),f=L(844),p=L(5596),E=L(3656),u=L(2585),a=L(4725),n=function(s){function l(d,A,S,R,y,_){var m=s.call(this)||this;if(m._renderer=d,m._rowCount=A,m._charSizeService=y,m._isPaused=!1,m._needsFullRefresh=!1,m._isNextRenderRedrawOnly=!0,m._needsSelectionRefresh=!1,m._canvasWidth=0,m._canvasHeight=0,m._selectionState={start:void 0,end:void 0,columnSelectMode:!1},m._onDimensionsChange=new T.EventEmitter,m._onRender=new T.EventEmitter,m._onRefreshRequest=new T.EventEmitter,m.register({dispose:function(){return m._renderer.dispose()}}),m._renderDebouncer=new b.RenderDebouncer(function(B,P){return m._renderRows(B,P)}),m.register(m._renderDebouncer),m._screenDprMonitor=new p.ScreenDprMonitor,m._screenDprMonitor.setListener(function(){return m.onDevicePixelRatioChange()}),m.register(m._screenDprMonitor),m.register(_.onResize(function(B){return m._fullRefresh()})),m.register(R.onOptionChange(function(){return m._renderer.onOptionsChanged()})),m.register(m._charSizeService.onCharSizeChange(function(){return m.onCharSizeChanged()})),m._renderer.onRequestRedraw(function(B){return m.refreshRows(B.start,B.end,!0)}),m.register((0,E.addDisposableDomListener)(window,"resize",function(){return m.onDevicePixelRatioChange()})),"IntersectionObserver"in window){var I=new IntersectionObserver(function(B){return m._onIntersectionChange(B[B.length-1])},{threshold:0});I.observe(S),m.register({dispose:function(){return I.disconnect()}})}return m}return D(l,s),Object.defineProperty(l.prototype,"onDimensionsChange",{get:function(){return this._onDimensionsChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"onRenderedBufferChange",{get:function(){return this._onRender.event},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"onRefreshRequest",{get:function(){return this._onRefreshRequest.event},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"dimensions",{get:function(){return this._renderer.dimensions},enumerable:!1,configurable:!0}),l.prototype._onIntersectionChange=function(d){this._isPaused=d.isIntersecting===void 0?d.intersectionRatio===0:!d.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)},l.prototype.refreshRows=function(d,A,S){S===void 0&&(S=!1),this._isPaused?this._needsFullRefresh=!0:(S||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(d,A,this._rowCount))},l.prototype._renderRows=function(d,A){this._renderer.renderRows(d,A),this._needsSelectionRefresh&&(this._renderer.onSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRender.fire({start:d,end:A}),this._isNextRenderRedrawOnly=!0},l.prototype.resize=function(d,A){this._rowCount=A,this._fireOnCanvasResize()},l.prototype.changeOptions=function(){this._renderer.onOptionsChanged(),this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize()},l.prototype._fireOnCanvasResize=function(){this._renderer.dimensions.canvasWidth===this._canvasWidth&&this._renderer.dimensions.canvasHeight===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.dimensions)},l.prototype.dispose=function(){s.prototype.dispose.call(this)},l.prototype.setRenderer=function(d){var A=this;this._renderer.dispose(),this._renderer=d,this._renderer.onRequestRedraw(function(S){return A.refreshRows(S.start,S.end,!0)}),this._needsSelectionRefresh=!0,this._fullRefresh()},l.prototype._fullRefresh=function(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)},l.prototype.clearTextureAtlas=function(){var d,A;(A=(d=this._renderer)===null||d===void 0?void 0:d.clearTextureAtlas)===null||A===void 0||A.call(d),this._fullRefresh()},l.prototype.setColors=function(d){this._renderer.setColors(d),this._fullRefresh()},l.prototype.onDevicePixelRatioChange=function(){this._charSizeService.measure(),this._renderer.onDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1)},l.prototype.onResize=function(d,A){this._renderer.onResize(d,A),this._fullRefresh()},l.prototype.onCharSizeChanged=function(){this._renderer.onCharSizeChanged()},l.prototype.onBlur=function(){this._renderer.onBlur()},l.prototype.onFocus=function(){this._renderer.onFocus()},l.prototype.onSelectionChanged=function(d,A,S){this._selectionState.start=d,this._selectionState.end=A,this._selectionState.columnSelectMode=S,this._renderer.onSelectionChanged(d,A,S)},l.prototype.onCursorMove=function(){this._renderer.onCursorMove()},l.prototype.clear=function(){this._renderer.clear()},w([g(3,u.IOptionsService),g(4,a.ICharSizeService),g(5,u.IBufferService)],l)}(f.Disposable);v.RenderService=n},9312:function(N,v,L){var O,D=this&&this.__extends||(O=function(R,y){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(_,m){_.__proto__=m}||function(_,m){for(var I in m)Object.prototype.hasOwnProperty.call(m,I)&&(_[I]=m[I])},O(R,y)},function(R,y){if(typeof y!="function"&&y!==null)throw new TypeError("Class extends value "+String(y)+" is not a constructor or null");function _(){this.constructor=R}O(R,y),R.prototype=y===null?Object.create(y):(_.prototype=y.prototype,new _)}),w=this&&this.__decorate||function(R,y,_,m){var I,B=arguments.length,P=B<3?y:m===null?m=Object.getOwnPropertyDescriptor(y,_):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(R,y,_,m);else for(var M=R.length-1;M>=0;M--)(I=R[M])&&(P=(B<3?I(P):B>3?I(y,_,P):I(y,_))||P);return B>3&&P&&Object.defineProperty(y,_,P),P},g=this&&this.__param||function(R,y){return function(_,m){y(_,m,R)}};Object.defineProperty(v,"__esModule",{value:!0}),v.SelectionService=void 0;var b=L(6114),T=L(456),f=L(511),p=L(8460),E=L(4725),u=L(2585),a=L(9806),n=L(9504),s=L(844),l=L(4841),d=String.fromCharCode(160),A=new RegExp(d,"g"),S=function(R){function y(_,m,I,B,P,M,U,K){var W=R.call(this)||this;return W._element=_,W._screenElement=m,W._linkifier=I,W._bufferService=B,W._coreService=P,W._mouseService=M,W._optionsService=U,W._renderService=K,W._dragScrollAmount=0,W._enabled=!0,W._workCell=new f.CellData,W._mouseDownTimeStamp=0,W._oldHasSelection=!1,W._oldSelectionStart=void 0,W._oldSelectionEnd=void 0,W._onLinuxMouseSelection=W.register(new p.EventEmitter),W._onRedrawRequest=W.register(new p.EventEmitter),W._onSelectionChange=W.register(new p.EventEmitter),W._onRequestScrollLines=W.register(new p.EventEmitter),W._mouseMoveListener=function(X){return W._onMouseMove(X)},W._mouseUpListener=function(X){return W._onMouseUp(X)},W._coreService.onUserInput(function(){W.hasSelection&&W.clearSelection()}),W._trimListener=W._bufferService.buffer.lines.onTrim(function(X){return W._onTrim(X)}),W.register(W._bufferService.buffers.onBufferActivate(function(X){return W._onBufferActivate(X)})),W.enable(),W._model=new T.SelectionModel(W._bufferService),W._activeSelectionMode=0,W}return D(y,R),Object.defineProperty(y.prototype,"onLinuxMouseSelection",{get:function(){return this._onLinuxMouseSelection.event},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"onRequestRedraw",{get:function(){return this._onRedrawRequest.event},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"onRequestScrollLines",{get:function(){return this._onRequestScrollLines.event},enumerable:!1,configurable:!0}),y.prototype.dispose=function(){this._removeMouseDownListeners()},y.prototype.reset=function(){this.clearSelection()},y.prototype.disable=function(){this.clearSelection(),this._enabled=!1},y.prototype.enable=function(){this._enabled=!0},Object.defineProperty(y.prototype,"selectionStart",{get:function(){return this._model.finalSelectionStart},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"selectionEnd",{get:function(){return this._model.finalSelectionEnd},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"hasSelection",{get:function(){var _=this._model.finalSelectionStart,m=this._model.finalSelectionEnd;return!(!_||!m||_[0]===m[0]&&_[1]===m[1])},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"selectionText",{get:function(){var _=this._model.finalSelectionStart,m=this._model.finalSelectionEnd;if(!_||!m)return"";var I=this._bufferService.buffer,B=[];if(this._activeSelectionMode===3){if(_[0]===m[0])return"";for(var P=_[1];P<=m[1];P++){var M=I.translateBufferLineToString(P,!0,_[0],m[0]);B.push(M)}}else{var U=_[1]===m[1]?m[0]:void 0;for(B.push(I.translateBufferLineToString(_[1],!0,_[0],U)),P=_[1]+1;P<=m[1]-1;P++){var K=I.lines.get(P);M=I.translateBufferLineToString(P,!0),K&&K.isWrapped?B[B.length-1]+=M:B.push(M)}_[1]!==m[1]&&(K=I.lines.get(m[1]),M=I.translateBufferLineToString(m[1],!0,0,m[0]),K&&K.isWrapped?B[B.length-1]+=M:B.push(M))}return B.map(function(W){return W.replace(A," ")}).join(b.isWindows?`\r
|
|
168
|
+
`:`
|
|
169
|
+
`)},enumerable:!1,configurable:!0}),y.prototype.clearSelection=function(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()},y.prototype.refresh=function(_){var m=this;this._refreshAnimationFrame||(this._refreshAnimationFrame=window.requestAnimationFrame(function(){return m._refresh()})),b.isLinux&&_&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)},y.prototype._refresh=function(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})},y.prototype._isClickInSelection=function(_){var m=this._getMouseBufferCoords(_),I=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!!(I&&B&&m)&&this._areCoordsInSelection(m,I,B)},y.prototype._areCoordsInSelection=function(_,m,I){return _[1]>m[1]&&_[1]<I[1]||m[1]===I[1]&&_[1]===m[1]&&_[0]>=m[0]&&_[0]<I[0]||m[1]<I[1]&&_[1]===I[1]&&_[0]<I[0]||m[1]<I[1]&&_[1]===m[1]&&_[0]>=m[0]},y.prototype._selectWordAtCursor=function(_,m){var I,B,P=(B=(I=this._linkifier.currentLink)===null||I===void 0?void 0:I.link)===null||B===void 0?void 0:B.range;if(P)return this._model.selectionStart=[P.start.x-1,P.start.y-1],this._model.selectionStartLength=(0,l.getRangeLength)(P,this._bufferService.cols),this._model.selectionEnd=void 0,!0;var M=this._getMouseBufferCoords(_);return!!M&&(this._selectWordAt(M,m),this._model.selectionEnd=void 0,!0)},y.prototype.selectAll=function(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()},y.prototype.selectLines=function(_,m){this._model.clearSelection(),_=Math.max(_,0),m=Math.min(m,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,_],this._model.selectionEnd=[this._bufferService.cols,m],this.refresh(),this._onSelectionChange.fire()},y.prototype._onTrim=function(_){this._model.onTrim(_)&&this.refresh()},y.prototype._getMouseBufferCoords=function(_){var m=this._mouseService.getCoords(_,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(m)return m[0]--,m[1]--,m[1]+=this._bufferService.buffer.ydisp,m},y.prototype._getMouseEventScrollAmount=function(_){var m=(0,a.getCoordsRelativeToElement)(_,this._screenElement)[1],I=this._renderService.dimensions.canvasHeight;return m>=0&&m<=I?0:(m>I&&(m-=I),m=Math.min(Math.max(m,-50),50),(m/=50)/Math.abs(m)+Math.round(14*m))},y.prototype.shouldForceSelection=function(_){return b.isMac?_.altKey&&this._optionsService.options.macOptionClickForcesSelection:_.shiftKey},y.prototype.onMouseDown=function(_){if(this._mouseDownTimeStamp=_.timeStamp,(_.button!==2||!this.hasSelection)&&_.button===0){if(!this._enabled){if(!this.shouldForceSelection(_))return;_.stopPropagation()}_.preventDefault(),this._dragScrollAmount=0,this._enabled&&_.shiftKey?this._onIncrementalClick(_):_.detail===1?this._onSingleClick(_):_.detail===2?this._onDoubleClick(_):_.detail===3&&this._onTripleClick(_),this._addMouseDownListeners(),this.refresh(!0)}},y.prototype._addMouseDownListeners=function(){var _=this;this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=window.setInterval(function(){return _._dragScroll()},50)},y.prototype._removeMouseDownListeners=function(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0},y.prototype._onIncrementalClick=function(_){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(_))},y.prototype._onSingleClick=function(_){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(_)?3:0,this._model.selectionStart=this._getMouseBufferCoords(_),this._model.selectionStart){this._model.selectionEnd=void 0;var m=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);m&&m.length!==this._model.selectionStart[0]&&m.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}},y.prototype._onDoubleClick=function(_){this._selectWordAtCursor(_,!0)&&(this._activeSelectionMode=1)},y.prototype._onTripleClick=function(_){var m=this._getMouseBufferCoords(_);m&&(this._activeSelectionMode=2,this._selectLineAt(m[1]))},y.prototype.shouldColumnSelect=function(_){return _.altKey&&!(b.isMac&&this._optionsService.options.macOptionClickForcesSelection)},y.prototype._onMouseMove=function(_){if(_.stopImmediatePropagation(),this._model.selectionStart){var m=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(_),this._model.selectionEnd){this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(_),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));var I=this._bufferService.buffer;if(this._model.selectionEnd[1]<I.lines.length){var B=I.lines.get(this._model.selectionEnd[1]);B&&B.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]++}m&&m[0]===this._model.selectionEnd[0]&&m[1]===this._model.selectionEnd[1]||this.refresh(!0)}else this.refresh(!0)}},y.prototype._dragScroll=function(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});var _=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(_.ydisp+this._bufferService.rows,_.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=_.ydisp),this.refresh()}},y.prototype._onMouseUp=function(_){var m=_.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&m<500&&_.altKey&&this._optionsService.getOption("altClickMovesCursor")){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){var I=this._mouseService.getCoords(_,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(I&&I[0]!==void 0&&I[1]!==void 0){var B=(0,n.moveToCellSequence)(I[0]-1,I[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(B,!0)}}}else this._fireEventIfSelectionChanged()},y.prototype._fireEventIfSelectionChanged=function(){var _=this._model.finalSelectionStart,m=this._model.finalSelectionEnd,I=!(!_||!m||_[0]===m[0]&&_[1]===m[1]);I?_&&m&&(this._oldSelectionStart&&this._oldSelectionEnd&&_[0]===this._oldSelectionStart[0]&&_[1]===this._oldSelectionStart[1]&&m[0]===this._oldSelectionEnd[0]&&m[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(_,m,I)):this._oldHasSelection&&this._fireOnSelectionChange(_,m,I)},y.prototype._fireOnSelectionChange=function(_,m,I){this._oldSelectionStart=_,this._oldSelectionEnd=m,this._oldHasSelection=I,this._onSelectionChange.fire()},y.prototype._onBufferActivate=function(_){var m=this;this.clearSelection(),this._trimListener.dispose(),this._trimListener=_.activeBuffer.lines.onTrim(function(I){return m._onTrim(I)})},y.prototype._convertViewportColToCharacterIndex=function(_,m){for(var I=m[0],B=0;m[0]>=B;B++){var P=_.loadCell(B,this._workCell).getChars().length;this._workCell.getWidth()===0?I--:P>1&&m[0]!==B&&(I+=P-1)}return I},y.prototype.setSelection=function(_,m,I){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[_,m],this._model.selectionStartLength=I,this.refresh()},y.prototype.rightClickSelect=function(_){this._isClickInSelection(_)||(this._selectWordAtCursor(_,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())},y.prototype._getWordAt=function(_,m,I,B){if(I===void 0&&(I=!0),B===void 0&&(B=!0),!(_[0]>=this._bufferService.cols)){var P=this._bufferService.buffer,M=P.lines.get(_[1]);if(M){var U=P.translateBufferLineToString(_[1],!1),K=this._convertViewportColToCharacterIndex(M,_),W=K,X=_[0]-K,ie=0,se=0,le=0,ve=0;if(U.charAt(K)===" "){for(;K>0&&U.charAt(K-1)===" ";)K--;for(;W<U.length&&U.charAt(W+1)===" ";)W++}else{var q=_[0],ee=_[0];M.getWidth(q)===0&&(ie++,q--),M.getWidth(ee)===2&&(se++,ee++);var ae=M.getString(ee).length;for(ae>1&&(ve+=ae-1,W+=ae-1);q>0&&K>0&&!this._isCharWordSeparator(M.loadCell(q-1,this._workCell));){M.loadCell(q-1,this._workCell);var _e=this._workCell.getChars().length;this._workCell.getWidth()===0?(ie++,q--):_e>1&&(le+=_e-1,K-=_e-1),K--,q--}for(;ee<M.length&&W+1<U.length&&!this._isCharWordSeparator(M.loadCell(ee+1,this._workCell));){M.loadCell(ee+1,this._workCell);var fe=this._workCell.getChars().length;this._workCell.getWidth()===2?(se++,ee++):fe>1&&(ve+=fe-1,W+=fe-1),W++,ee++}}W++;var Ue=K+X-ie+le,Te=Math.min(this._bufferService.cols,W-K+ie+se-le-ve);if(m||U.slice(K,W).trim()!==""){if(I&&Ue===0&&M.getCodePoint(0)!==32){var Fe=P.lines.get(_[1]-1);if(Fe&&M.isWrapped&&Fe.getCodePoint(this._bufferService.cols-1)!==32){var $e=this._getWordAt([this._bufferService.cols-1,_[1]-1],!1,!0,!1);if($e){var Ye=this._bufferService.cols-$e.start;Ue-=Ye,Te+=Ye}}}if(B&&Ue+Te===this._bufferService.cols&&M.getCodePoint(this._bufferService.cols-1)!==32){var Ge=P.lines.get(_[1]+1);if(Ge&&Ge.isWrapped&&Ge.getCodePoint(0)!==32){var st=this._getWordAt([0,_[1]+1],!1,!1,!0);st&&(Te+=st.length)}}return{start:Ue,length:Te}}}}},y.prototype._selectWordAt=function(_,m){var I=this._getWordAt(_,m);if(I){for(;I.start<0;)I.start+=this._bufferService.cols,_[1]--;this._model.selectionStart=[I.start,_[1]],this._model.selectionStartLength=I.length}},y.prototype._selectToWordAt=function(_){var m=this._getWordAt(_,!0);if(m){for(var I=_[1];m.start<0;)m.start+=this._bufferService.cols,I--;if(!this._model.areSelectionValuesReversed())for(;m.start+m.length>this._bufferService.cols;)m.length-=this._bufferService.cols,I++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?m.start:m.start+m.length,I]}},y.prototype._isCharWordSeparator=function(_){return _.getWidth()!==0&&this._optionsService.options.wordSeparator.indexOf(_.getChars())>=0},y.prototype._selectLineAt=function(_){var m=this._bufferService.buffer.getWrappedRangeForLine(_);this._model.selectionStart=[0,m.first],this._model.selectionEnd=[this._bufferService.cols,m.last],this._model.selectionStartLength=0},w([g(3,u.IBufferService),g(4,u.ICoreService),g(5,E.IMouseService),g(6,u.IOptionsService),g(7,E.IRenderService)],y)}(s.Disposable);v.SelectionService=S},4725:(N,v,L)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.ICharacterJoinerService=v.ISoundService=v.ISelectionService=v.IRenderService=v.IMouseService=v.ICoreBrowserService=v.ICharSizeService=void 0;var O=L(8343);v.ICharSizeService=(0,O.createDecorator)("CharSizeService"),v.ICoreBrowserService=(0,O.createDecorator)("CoreBrowserService"),v.IMouseService=(0,O.createDecorator)("MouseService"),v.IRenderService=(0,O.createDecorator)("RenderService"),v.ISelectionService=(0,O.createDecorator)("SelectionService"),v.ISoundService=(0,O.createDecorator)("SoundService"),v.ICharacterJoinerService=(0,O.createDecorator)("CharacterJoinerService")},357:function(N,v,L){var O=this&&this.__decorate||function(b,T,f,p){var E,u=arguments.length,a=u<3?T:p===null?p=Object.getOwnPropertyDescriptor(T,f):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(b,T,f,p);else for(var n=b.length-1;n>=0;n--)(E=b[n])&&(a=(u<3?E(a):u>3?E(T,f,a):E(T,f))||a);return u>3&&a&&Object.defineProperty(T,f,a),a},D=this&&this.__param||function(b,T){return function(f,p){T(f,p,b)}};Object.defineProperty(v,"__esModule",{value:!0}),v.SoundService=void 0;var w=L(2585),g=function(){function b(T){this._optionsService=T}return Object.defineProperty(b,"audioContext",{get:function(){if(!b._audioContext){var T=window.AudioContext||window.webkitAudioContext;if(!T)return console.warn("Web Audio API is not supported by this browser. Consider upgrading to the latest version"),null;b._audioContext=new T}return b._audioContext},enumerable:!1,configurable:!0}),b.prototype.playBellSound=function(){var T=b.audioContext;if(T){var f=T.createBufferSource();T.decodeAudioData(this._base64ToArrayBuffer(this._removeMimeType(this._optionsService.options.bellSound)),function(p){f.buffer=p,f.connect(T.destination),f.start(0)})}},b.prototype._base64ToArrayBuffer=function(T){for(var f=window.atob(T),p=f.length,E=new Uint8Array(p),u=0;u<p;u++)E[u]=f.charCodeAt(u);return E.buffer},b.prototype._removeMimeType=function(T){return T.split(",")[1]},b=O([D(0,w.IOptionsService)],b)}();v.SoundService=g},6349:(N,v,L)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.CircularList=void 0;var O=L(8460),D=function(){function w(g){this._maxLength=g,this.onDeleteEmitter=new O.EventEmitter,this.onInsertEmitter=new O.EventEmitter,this.onTrimEmitter=new O.EventEmitter,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}return Object.defineProperty(w.prototype,"onDelete",{get:function(){return this.onDeleteEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"onInsert",{get:function(){return this.onInsertEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"onTrim",{get:function(){return this.onTrimEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"maxLength",{get:function(){return this._maxLength},set:function(g){if(this._maxLength!==g){for(var b=new Array(g),T=0;T<Math.min(g,this.length);T++)b[T]=this._array[this._getCyclicIndex(T)];this._array=b,this._maxLength=g,this._startIndex=0}},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"length",{get:function(){return this._length},set:function(g){if(g>this._length)for(var b=this._length;b<g;b++)this._array[b]=void 0;this._length=g},enumerable:!1,configurable:!0}),w.prototype.get=function(g){return this._array[this._getCyclicIndex(g)]},w.prototype.set=function(g,b){this._array[this._getCyclicIndex(g)]=b},w.prototype.push=function(g){this._array[this._getCyclicIndex(this._length)]=g,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++},w.prototype.recycle=function(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]},Object.defineProperty(w.prototype,"isFull",{get:function(){return this._length===this._maxLength},enumerable:!1,configurable:!0}),w.prototype.pop=function(){return this._array[this._getCyclicIndex(this._length---1)]},w.prototype.splice=function(g,b){for(var T=[],f=2;f<arguments.length;f++)T[f-2]=arguments[f];if(b){for(var p=g;p<this._length-b;p++)this._array[this._getCyclicIndex(p)]=this._array[this._getCyclicIndex(p+b)];this._length-=b,this.onDeleteEmitter.fire({index:g,amount:b})}for(p=this._length-1;p>=g;p--)this._array[this._getCyclicIndex(p+T.length)]=this._array[this._getCyclicIndex(p)];for(p=0;p<T.length;p++)this._array[this._getCyclicIndex(g+p)]=T[p];if(T.length&&this.onInsertEmitter.fire({index:g,amount:T.length}),this._length+T.length>this._maxLength){var E=this._length+T.length-this._maxLength;this._startIndex+=E,this._length=this._maxLength,this.onTrimEmitter.fire(E)}else this._length+=T.length},w.prototype.trimStart=function(g){g>this._length&&(g=this._length),this._startIndex+=g,this._length-=g,this.onTrimEmitter.fire(g)},w.prototype.shiftElements=function(g,b,T){if(!(b<=0)){if(g<0||g>=this._length)throw new Error("start argument out of range");if(g+T<0)throw new Error("Cannot shift elements in list beyond index 0");if(T>0){for(var f=b-1;f>=0;f--)this.set(g+f+T,this.get(g+f));var p=g+b+T-this._length;if(p>0)for(this._length+=p;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(f=0;f<b;f++)this.set(g+f+T,this.get(g+f))}},w.prototype._getCyclicIndex=function(g){return(this._startIndex+g)%this._maxLength},w}();v.CircularList=D},1439:(N,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.clone=void 0,v.clone=function L(O,D){if(D===void 0&&(D=5),typeof O!="object")return O;var w=Array.isArray(O)?[]:{};for(var g in O)w[g]=D<=1?O[g]:O[g]&&L(O[g],D-1);return w}},8969:function(N,v,L){var O,D=this&&this.__extends||(O=function(_,m){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(I,B){I.__proto__=B}||function(I,B){for(var P in B)Object.prototype.hasOwnProperty.call(B,P)&&(I[P]=B[P])},O(_,m)},function(_,m){if(typeof m!="function"&&m!==null)throw new TypeError("Class extends value "+String(m)+" is not a constructor or null");function I(){this.constructor=_}O(_,m),_.prototype=m===null?Object.create(m):(I.prototype=m.prototype,new I)});Object.defineProperty(v,"__esModule",{value:!0}),v.CoreTerminal=void 0;var w=L(844),g=L(2585),b=L(4348),T=L(7866),f=L(744),p=L(7302),E=L(6975),u=L(8460),a=L(1753),n=L(3730),s=L(1480),l=L(7994),d=L(9282),A=L(5435),S=L(5981),R=!1,y=function(_){function m(I){var B=_.call(this)||this;return B._onBinary=new u.EventEmitter,B._onData=new u.EventEmitter,B._onLineFeed=new u.EventEmitter,B._onResize=new u.EventEmitter,B._onScroll=new u.EventEmitter,B._instantiationService=new b.InstantiationService,B.optionsService=new p.OptionsService(I),B._instantiationService.setService(g.IOptionsService,B.optionsService),B._bufferService=B.register(B._instantiationService.createInstance(f.BufferService)),B._instantiationService.setService(g.IBufferService,B._bufferService),B._logService=B._instantiationService.createInstance(T.LogService),B._instantiationService.setService(g.ILogService,B._logService),B.coreService=B.register(B._instantiationService.createInstance(E.CoreService,function(){return B.scrollToBottom()})),B._instantiationService.setService(g.ICoreService,B.coreService),B.coreMouseService=B._instantiationService.createInstance(a.CoreMouseService),B._instantiationService.setService(g.ICoreMouseService,B.coreMouseService),B._dirtyRowService=B._instantiationService.createInstance(n.DirtyRowService),B._instantiationService.setService(g.IDirtyRowService,B._dirtyRowService),B.unicodeService=B._instantiationService.createInstance(s.UnicodeService),B._instantiationService.setService(g.IUnicodeService,B.unicodeService),B._charsetService=B._instantiationService.createInstance(l.CharsetService),B._instantiationService.setService(g.ICharsetService,B._charsetService),B._inputHandler=new A.InputHandler(B._bufferService,B._charsetService,B.coreService,B._dirtyRowService,B._logService,B.optionsService,B.coreMouseService,B.unicodeService),B.register((0,u.forwardEvent)(B._inputHandler.onLineFeed,B._onLineFeed)),B.register(B._inputHandler),B.register((0,u.forwardEvent)(B._bufferService.onResize,B._onResize)),B.register((0,u.forwardEvent)(B.coreService.onData,B._onData)),B.register((0,u.forwardEvent)(B.coreService.onBinary,B._onBinary)),B.register(B.optionsService.onOptionChange(function(P){return B._updateOptions(P)})),B.register(B._bufferService.onScroll(function(P){B._onScroll.fire({position:B._bufferService.buffer.ydisp,source:0}),B._dirtyRowService.markRangeDirty(B._bufferService.buffer.scrollTop,B._bufferService.buffer.scrollBottom)})),B.register(B._inputHandler.onScroll(function(P){B._onScroll.fire({position:B._bufferService.buffer.ydisp,source:0}),B._dirtyRowService.markRangeDirty(B._bufferService.buffer.scrollTop,B._bufferService.buffer.scrollBottom)})),B._writeBuffer=new S.WriteBuffer(function(P,M){return B._inputHandler.parse(P,M)}),B}return D(m,_),Object.defineProperty(m.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"onData",{get:function(){return this._onData.event},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"onLineFeed",{get:function(){return this._onLineFeed.event},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"onResize",{get:function(){return this._onResize.event},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"onScroll",{get:function(){var I=this;return this._onScrollApi||(this._onScrollApi=new u.EventEmitter,this.register(this._onScroll.event(function(B){var P;(P=I._onScrollApi)===null||P===void 0||P.fire(B.position)}))),this._onScrollApi.event},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"cols",{get:function(){return this._bufferService.cols},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"rows",{get:function(){return this._bufferService.rows},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"buffers",{get:function(){return this._bufferService.buffers},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"options",{get:function(){return this.optionsService.publicOptions},enumerable:!1,configurable:!0}),m.prototype.dispose=function(){var I;this._isDisposed||(_.prototype.dispose.call(this),(I=this._windowsMode)===null||I===void 0||I.dispose(),this._windowsMode=void 0)},m.prototype.write=function(I,B){this._writeBuffer.write(I,B)},m.prototype.writeSync=function(I,B){this._logService.logLevel<=g.LogLevelEnum.WARN&&!R&&(this._logService.warn("writeSync is unreliable and will be removed soon."),R=!0),this._writeBuffer.writeSync(I,B)},m.prototype.resize=function(I,B){isNaN(I)||isNaN(B)||(I=Math.max(I,f.MINIMUM_COLS),B=Math.max(B,f.MINIMUM_ROWS),this._bufferService.resize(I,B))},m.prototype.scroll=function(I,B){B===void 0&&(B=!1),this._bufferService.scroll(I,B)},m.prototype.scrollLines=function(I,B,P){this._bufferService.scrollLines(I,B,P)},m.prototype.scrollPages=function(I){this._bufferService.scrollPages(I)},m.prototype.scrollToTop=function(){this._bufferService.scrollToTop()},m.prototype.scrollToBottom=function(){this._bufferService.scrollToBottom()},m.prototype.scrollToLine=function(I){this._bufferService.scrollToLine(I)},m.prototype.registerEscHandler=function(I,B){return this._inputHandler.registerEscHandler(I,B)},m.prototype.registerDcsHandler=function(I,B){return this._inputHandler.registerDcsHandler(I,B)},m.prototype.registerCsiHandler=function(I,B){return this._inputHandler.registerCsiHandler(I,B)},m.prototype.registerOscHandler=function(I,B){return this._inputHandler.registerOscHandler(I,B)},m.prototype._setup=function(){this.optionsService.options.windowsMode&&this._enableWindowsMode()},m.prototype.reset=function(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()},m.prototype._updateOptions=function(I){var B;switch(I){case"scrollback":this.buffers.resize(this.cols,this.rows);break;case"windowsMode":this.optionsService.options.windowsMode?this._enableWindowsMode():((B=this._windowsMode)===null||B===void 0||B.dispose(),this._windowsMode=void 0)}},m.prototype._enableWindowsMode=function(){var I=this;if(!this._windowsMode){var B=[];B.push(this.onLineFeed(d.updateWindowsModeWrappedState.bind(null,this._bufferService))),B.push(this.registerCsiHandler({final:"H"},function(){return(0,d.updateWindowsModeWrappedState)(I._bufferService),!1})),this._windowsMode={dispose:function(){for(var P=0,M=B;P<M.length;P++)M[P].dispose()}}}},m}(w.Disposable);v.CoreTerminal=y},8460:(N,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.forwardEvent=v.EventEmitter=void 0;var L=function(){function O(){this._listeners=[],this._disposed=!1}return Object.defineProperty(O.prototype,"event",{get:function(){var D=this;return this._event||(this._event=function(w){return D._listeners.push(w),{dispose:function(){if(!D._disposed){for(var g=0;g<D._listeners.length;g++)if(D._listeners[g]===w)return void D._listeners.splice(g,1)}}}}),this._event},enumerable:!1,configurable:!0}),O.prototype.fire=function(D,w){for(var g=[],b=0;b<this._listeners.length;b++)g.push(this._listeners[b]);for(b=0;b<g.length;b++)g[b].call(void 0,D,w)},O.prototype.dispose=function(){this._listeners&&(this._listeners.length=0),this._disposed=!0},O}();v.EventEmitter=L,v.forwardEvent=function(O,D){return O(function(w){return D.fire(w)})}},5435:function(N,v,L){var O,D=this&&this.__extends||(O=function(B,P){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(M,U){M.__proto__=U}||function(M,U){for(var K in U)Object.prototype.hasOwnProperty.call(U,K)&&(M[K]=U[K])},O(B,P)},function(B,P){if(typeof P!="function"&&P!==null)throw new TypeError("Class extends value "+String(P)+" is not a constructor or null");function M(){this.constructor=B}O(B,P),B.prototype=P===null?Object.create(P):(M.prototype=P.prototype,new M)});Object.defineProperty(v,"__esModule",{value:!0}),v.InputHandler=v.WindowsOptionsReportType=void 0;var w,g=L(2584),b=L(7116),T=L(2015),f=L(844),p=L(8273),E=L(482),u=L(8437),a=L(8460),n=L(643),s=L(511),l=L(3734),d=L(2585),A=L(6242),S=L(6351),R={"(":0,")":1,"*":2,"+":3,"-":1,".":2},y=131072;function _(B,P){if(B>24)return P.setWinLines||!1;switch(B){case 1:return!!P.restoreWin;case 2:return!!P.minimizeWin;case 3:return!!P.setWinPosition;case 4:return!!P.setWinSizePixels;case 5:return!!P.raiseWin;case 6:return!!P.lowerWin;case 7:return!!P.refreshWin;case 8:return!!P.setWinSizeChars;case 9:return!!P.maximizeWin;case 10:return!!P.fullscreenWin;case 11:return!!P.getWinState;case 13:return!!P.getWinPosition;case 14:return!!P.getWinSizePixels;case 15:return!!P.getScreenSizePixels;case 16:return!!P.getCellSizePixels;case 18:return!!P.getWinSizeChars;case 19:return!!P.getScreenSizeChars;case 20:return!!P.getIconTitle;case 21:return!!P.getWinTitle;case 22:return!!P.pushTitle;case 23:return!!P.popTitle;case 24:return!!P.setWinLines}return!1}(function(B){B[B.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",B[B.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(w=v.WindowsOptionsReportType||(v.WindowsOptionsReportType={}));var m=function(){function B(P,M,U,K){this._bufferService=P,this._coreService=M,this._logService=U,this._optionsService=K,this._data=new Uint32Array(0)}return B.prototype.hook=function(P){this._data=new Uint32Array(0)},B.prototype.put=function(P,M,U){this._data=(0,p.concat)(this._data,P.subarray(M,U))},B.prototype.unhook=function(P){if(!P)return this._data=new Uint32Array(0),!0;var M=(0,E.utf32ToString)(this._data);switch(this._data=new Uint32Array(0),M){case'"q':this._coreService.triggerDataEvent(g.C0.ESC+'P1$r0"q'+g.C0.ESC+"\\");break;case'"p':this._coreService.triggerDataEvent(g.C0.ESC+'P1$r61;1"p'+g.C0.ESC+"\\");break;case"r":var U=this._bufferService.buffer.scrollTop+1+";"+(this._bufferService.buffer.scrollBottom+1)+"r";this._coreService.triggerDataEvent(g.C0.ESC+"P1$r"+U+g.C0.ESC+"\\");break;case"m":this._coreService.triggerDataEvent(g.C0.ESC+"P1$r0m"+g.C0.ESC+"\\");break;case" q":var K={block:2,underline:4,bar:6}[this._optionsService.options.cursorStyle];K-=this._optionsService.options.cursorBlink?1:0,this._coreService.triggerDataEvent(g.C0.ESC+"P1$r"+K+" q"+g.C0.ESC+"\\");break;default:this._logService.debug("Unknown DCS $q %s",M),this._coreService.triggerDataEvent(g.C0.ESC+"P0$r"+g.C0.ESC+"\\")}return!0},B}(),I=function(B){function P(M,U,K,W,X,ie,se,le,ve){ve===void 0&&(ve=new T.EscapeSequenceParser);var q=B.call(this)||this;q._bufferService=M,q._charsetService=U,q._coreService=K,q._dirtyRowService=W,q._logService=X,q._optionsService=ie,q._coreMouseService=se,q._unicodeService=le,q._parser=ve,q._parseBuffer=new Uint32Array(4096),q._stringDecoder=new E.StringToUtf32,q._utf8Decoder=new E.Utf8ToUtf32,q._workCell=new s.CellData,q._windowTitle="",q._iconName="",q._windowTitleStack=[],q._iconNameStack=[],q._curAttrData=u.DEFAULT_ATTR_DATA.clone(),q._eraseAttrDataInternal=u.DEFAULT_ATTR_DATA.clone(),q._onRequestBell=new a.EventEmitter,q._onRequestRefreshRows=new a.EventEmitter,q._onRequestReset=new a.EventEmitter,q._onRequestSendFocus=new a.EventEmitter,q._onRequestSyncScrollBar=new a.EventEmitter,q._onRequestWindowsOptionsReport=new a.EventEmitter,q._onA11yChar=new a.EventEmitter,q._onA11yTab=new a.EventEmitter,q._onCursorMove=new a.EventEmitter,q._onLineFeed=new a.EventEmitter,q._onScroll=new a.EventEmitter,q._onTitleChange=new a.EventEmitter,q._onAnsiColorChange=new a.EventEmitter,q._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},q.register(q._parser),q._activeBuffer=q._bufferService.buffer,q.register(q._bufferService.buffers.onBufferActivate(function(fe){return q._activeBuffer=fe.activeBuffer})),q._parser.setCsiHandlerFallback(function(fe,Ue){q._logService.debug("Unknown CSI code: ",{identifier:q._parser.identToString(fe),params:Ue.toArray()})}),q._parser.setEscHandlerFallback(function(fe){q._logService.debug("Unknown ESC code: ",{identifier:q._parser.identToString(fe)})}),q._parser.setExecuteHandlerFallback(function(fe){q._logService.debug("Unknown EXECUTE code: ",{code:fe})}),q._parser.setOscHandlerFallback(function(fe,Ue,Te){q._logService.debug("Unknown OSC code: ",{identifier:fe,action:Ue,data:Te})}),q._parser.setDcsHandlerFallback(function(fe,Ue,Te){Ue==="HOOK"&&(Te=Te.toArray()),q._logService.debug("Unknown DCS code: ",{identifier:q._parser.identToString(fe),action:Ue,payload:Te})}),q._parser.setPrintHandler(function(fe,Ue,Te){return q.print(fe,Ue,Te)}),q._parser.registerCsiHandler({final:"@"},function(fe){return q.insertChars(fe)}),q._parser.registerCsiHandler({intermediates:" ",final:"@"},function(fe){return q.scrollLeft(fe)}),q._parser.registerCsiHandler({final:"A"},function(fe){return q.cursorUp(fe)}),q._parser.registerCsiHandler({intermediates:" ",final:"A"},function(fe){return q.scrollRight(fe)}),q._parser.registerCsiHandler({final:"B"},function(fe){return q.cursorDown(fe)}),q._parser.registerCsiHandler({final:"C"},function(fe){return q.cursorForward(fe)}),q._parser.registerCsiHandler({final:"D"},function(fe){return q.cursorBackward(fe)}),q._parser.registerCsiHandler({final:"E"},function(fe){return q.cursorNextLine(fe)}),q._parser.registerCsiHandler({final:"F"},function(fe){return q.cursorPrecedingLine(fe)}),q._parser.registerCsiHandler({final:"G"},function(fe){return q.cursorCharAbsolute(fe)}),q._parser.registerCsiHandler({final:"H"},function(fe){return q.cursorPosition(fe)}),q._parser.registerCsiHandler({final:"I"},function(fe){return q.cursorForwardTab(fe)}),q._parser.registerCsiHandler({final:"J"},function(fe){return q.eraseInDisplay(fe)}),q._parser.registerCsiHandler({prefix:"?",final:"J"},function(fe){return q.eraseInDisplay(fe)}),q._parser.registerCsiHandler({final:"K"},function(fe){return q.eraseInLine(fe)}),q._parser.registerCsiHandler({prefix:"?",final:"K"},function(fe){return q.eraseInLine(fe)}),q._parser.registerCsiHandler({final:"L"},function(fe){return q.insertLines(fe)}),q._parser.registerCsiHandler({final:"M"},function(fe){return q.deleteLines(fe)}),q._parser.registerCsiHandler({final:"P"},function(fe){return q.deleteChars(fe)}),q._parser.registerCsiHandler({final:"S"},function(fe){return q.scrollUp(fe)}),q._parser.registerCsiHandler({final:"T"},function(fe){return q.scrollDown(fe)}),q._parser.registerCsiHandler({final:"X"},function(fe){return q.eraseChars(fe)}),q._parser.registerCsiHandler({final:"Z"},function(fe){return q.cursorBackwardTab(fe)}),q._parser.registerCsiHandler({final:"`"},function(fe){return q.charPosAbsolute(fe)}),q._parser.registerCsiHandler({final:"a"},function(fe){return q.hPositionRelative(fe)}),q._parser.registerCsiHandler({final:"b"},function(fe){return q.repeatPrecedingCharacter(fe)}),q._parser.registerCsiHandler({final:"c"},function(fe){return q.sendDeviceAttributesPrimary(fe)}),q._parser.registerCsiHandler({prefix:">",final:"c"},function(fe){return q.sendDeviceAttributesSecondary(fe)}),q._parser.registerCsiHandler({final:"d"},function(fe){return q.linePosAbsolute(fe)}),q._parser.registerCsiHandler({final:"e"},function(fe){return q.vPositionRelative(fe)}),q._parser.registerCsiHandler({final:"f"},function(fe){return q.hVPosition(fe)}),q._parser.registerCsiHandler({final:"g"},function(fe){return q.tabClear(fe)}),q._parser.registerCsiHandler({final:"h"},function(fe){return q.setMode(fe)}),q._parser.registerCsiHandler({prefix:"?",final:"h"},function(fe){return q.setModePrivate(fe)}),q._parser.registerCsiHandler({final:"l"},function(fe){return q.resetMode(fe)}),q._parser.registerCsiHandler({prefix:"?",final:"l"},function(fe){return q.resetModePrivate(fe)}),q._parser.registerCsiHandler({final:"m"},function(fe){return q.charAttributes(fe)}),q._parser.registerCsiHandler({final:"n"},function(fe){return q.deviceStatus(fe)}),q._parser.registerCsiHandler({prefix:"?",final:"n"},function(fe){return q.deviceStatusPrivate(fe)}),q._parser.registerCsiHandler({intermediates:"!",final:"p"},function(fe){return q.softReset(fe)}),q._parser.registerCsiHandler({intermediates:" ",final:"q"},function(fe){return q.setCursorStyle(fe)}),q._parser.registerCsiHandler({final:"r"},function(fe){return q.setScrollRegion(fe)}),q._parser.registerCsiHandler({final:"s"},function(fe){return q.saveCursor(fe)}),q._parser.registerCsiHandler({final:"t"},function(fe){return q.windowOptions(fe)}),q._parser.registerCsiHandler({final:"u"},function(fe){return q.restoreCursor(fe)}),q._parser.registerCsiHandler({intermediates:"'",final:"}"},function(fe){return q.insertColumns(fe)}),q._parser.registerCsiHandler({intermediates:"'",final:"~"},function(fe){return q.deleteColumns(fe)}),q._parser.setExecuteHandler(g.C0.BEL,function(){return q.bell()}),q._parser.setExecuteHandler(g.C0.LF,function(){return q.lineFeed()}),q._parser.setExecuteHandler(g.C0.VT,function(){return q.lineFeed()}),q._parser.setExecuteHandler(g.C0.FF,function(){return q.lineFeed()}),q._parser.setExecuteHandler(g.C0.CR,function(){return q.carriageReturn()}),q._parser.setExecuteHandler(g.C0.BS,function(){return q.backspace()}),q._parser.setExecuteHandler(g.C0.HT,function(){return q.tab()}),q._parser.setExecuteHandler(g.C0.SO,function(){return q.shiftOut()}),q._parser.setExecuteHandler(g.C0.SI,function(){return q.shiftIn()}),q._parser.setExecuteHandler(g.C1.IND,function(){return q.index()}),q._parser.setExecuteHandler(g.C1.NEL,function(){return q.nextLine()}),q._parser.setExecuteHandler(g.C1.HTS,function(){return q.tabSet()}),q._parser.registerOscHandler(0,new A.OscHandler(function(fe){return q.setTitle(fe),q.setIconName(fe),!0})),q._parser.registerOscHandler(1,new A.OscHandler(function(fe){return q.setIconName(fe)})),q._parser.registerOscHandler(2,new A.OscHandler(function(fe){return q.setTitle(fe)})),q._parser.registerOscHandler(4,new A.OscHandler(function(fe){return q.setAnsiColor(fe)})),q._parser.registerEscHandler({final:"7"},function(){return q.saveCursor()}),q._parser.registerEscHandler({final:"8"},function(){return q.restoreCursor()}),q._parser.registerEscHandler({final:"D"},function(){return q.index()}),q._parser.registerEscHandler({final:"E"},function(){return q.nextLine()}),q._parser.registerEscHandler({final:"H"},function(){return q.tabSet()}),q._parser.registerEscHandler({final:"M"},function(){return q.reverseIndex()}),q._parser.registerEscHandler({final:"="},function(){return q.keypadApplicationMode()}),q._parser.registerEscHandler({final:">"},function(){return q.keypadNumericMode()}),q._parser.registerEscHandler({final:"c"},function(){return q.fullReset()}),q._parser.registerEscHandler({final:"n"},function(){return q.setgLevel(2)}),q._parser.registerEscHandler({final:"o"},function(){return q.setgLevel(3)}),q._parser.registerEscHandler({final:"|"},function(){return q.setgLevel(3)}),q._parser.registerEscHandler({final:"}"},function(){return q.setgLevel(2)}),q._parser.registerEscHandler({final:"~"},function(){return q.setgLevel(1)}),q._parser.registerEscHandler({intermediates:"%",final:"@"},function(){return q.selectDefaultCharset()}),q._parser.registerEscHandler({intermediates:"%",final:"G"},function(){return q.selectDefaultCharset()});var ee=function(fe){ae._parser.registerEscHandler({intermediates:"(",final:fe},function(){return q.selectCharset("("+fe)}),ae._parser.registerEscHandler({intermediates:")",final:fe},function(){return q.selectCharset(")"+fe)}),ae._parser.registerEscHandler({intermediates:"*",final:fe},function(){return q.selectCharset("*"+fe)}),ae._parser.registerEscHandler({intermediates:"+",final:fe},function(){return q.selectCharset("+"+fe)}),ae._parser.registerEscHandler({intermediates:"-",final:fe},function(){return q.selectCharset("-"+fe)}),ae._parser.registerEscHandler({intermediates:".",final:fe},function(){return q.selectCharset("."+fe)}),ae._parser.registerEscHandler({intermediates:"/",final:fe},function(){return q.selectCharset("/"+fe)})},ae=this;for(var _e in b.CHARSETS)ee(_e);return q._parser.registerEscHandler({intermediates:"#",final:"8"},function(){return q.screenAlignmentPattern()}),q._parser.setErrorHandler(function(fe){return q._logService.error("Parsing error: ",fe),fe}),q._parser.registerDcsHandler({intermediates:"$",final:"q"},new m(q._bufferService,q._coreService,q._logService,q._optionsService)),q}return D(P,B),Object.defineProperty(P.prototype,"onRequestBell",{get:function(){return this._onRequestBell.event},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"onRequestRefreshRows",{get:function(){return this._onRequestRefreshRows.event},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"onRequestReset",{get:function(){return this._onRequestReset.event},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"onRequestSendFocus",{get:function(){return this._onRequestSendFocus.event},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"onRequestSyncScrollBar",{get:function(){return this._onRequestSyncScrollBar.event},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"onRequestWindowsOptionsReport",{get:function(){return this._onRequestWindowsOptionsReport.event},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"onA11yChar",{get:function(){return this._onA11yChar.event},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"onA11yTab",{get:function(){return this._onA11yTab.event},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"onLineFeed",{get:function(){return this._onLineFeed.event},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"onScroll",{get:function(){return this._onScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"onTitleChange",{get:function(){return this._onTitleChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"onAnsiColorChange",{get:function(){return this._onAnsiColorChange.event},enumerable:!1,configurable:!0}),P.prototype.dispose=function(){B.prototype.dispose.call(this)},P.prototype._preserveStack=function(M,U,K,W){this._parseStack.paused=!0,this._parseStack.cursorStartX=M,this._parseStack.cursorStartY=U,this._parseStack.decodedLength=K,this._parseStack.position=W},P.prototype._logSlowResolvingAsync=function(M){this._logService.logLevel<=d.LogLevelEnum.WARN&&Promise.race([M,new Promise(function(U,K){return setTimeout(function(){return K("#SLOW_TIMEOUT")},5e3)})]).catch(function(U){if(U!=="#SLOW_TIMEOUT")throw U;console.warn("async parser handler taking longer than 5000 ms")})},P.prototype.parse=function(M,U){var K,W=this._activeBuffer.x,X=this._activeBuffer.y,ie=0,se=this._parseStack.paused;if(se){if(K=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,U))return this._logSlowResolvingAsync(K),K;W=this._parseStack.cursorStartX,X=this._parseStack.cursorStartY,this._parseStack.paused=!1,M.length>y&&(ie=this._parseStack.position+y)}if(this._logService.debug("parsing data",M),this._parseBuffer.length<M.length&&this._parseBuffer.length<y&&(this._parseBuffer=new Uint32Array(Math.min(M.length,y))),se||this._dirtyRowService.clearRange(),M.length>y)for(var le=ie;le<M.length;le+=y){var ve=le+y<M.length?le+y:M.length,q=typeof M=="string"?this._stringDecoder.decode(M.substring(le,ve),this._parseBuffer):this._utf8Decoder.decode(M.subarray(le,ve),this._parseBuffer);if(K=this._parser.parse(this._parseBuffer,q))return this._preserveStack(W,X,q,le),this._logSlowResolvingAsync(K),K}else if(!se&&(q=typeof M=="string"?this._stringDecoder.decode(M,this._parseBuffer):this._utf8Decoder.decode(M,this._parseBuffer),K=this._parser.parse(this._parseBuffer,q)))return this._preserveStack(W,X,q,0),this._logSlowResolvingAsync(K),K;this._activeBuffer.x===W&&this._activeBuffer.y===X||this._onCursorMove.fire(),this._onRequestRefreshRows.fire(this._dirtyRowService.start,this._dirtyRowService.end)},P.prototype.print=function(M,U,K){var W,X,ie=this._charsetService.charset,se=this._optionsService.options.screenReaderMode,le=this._bufferService.cols,ve=this._coreService.decPrivateModes.wraparound,q=this._coreService.modes.insertMode,ee=this._curAttrData,ae=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowService.markDirty(this._activeBuffer.y),this._activeBuffer.x&&K-U>0&&ae.getWidth(this._activeBuffer.x-1)===2&&ae.setCellFromCodePoint(this._activeBuffer.x-1,0,1,ee.fg,ee.bg,ee.extended);for(var _e=U;_e<K;++_e){if(W=M[_e],X=this._unicodeService.wcwidth(W),W<127&&ie){var fe=ie[String.fromCharCode(W)];fe&&(W=fe.charCodeAt(0))}if(se&&this._onA11yChar.fire((0,E.stringFromCodePoint)(W)),X||!this._activeBuffer.x){if(this._activeBuffer.x+X-1>=le){if(ve){for(;this._activeBuffer.x<le;)ae.setCellFromCodePoint(this._activeBuffer.x++,0,1,ee.fg,ee.bg,ee.extended);this._activeBuffer.x=0,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),ae=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)}else if(this._activeBuffer.x=le-1,X===2)continue}if(q&&(ae.insertCells(this._activeBuffer.x,X,this._activeBuffer.getNullCell(ee),ee),ae.getWidth(le-1)===2&&ae.setCellFromCodePoint(le-1,n.NULL_CELL_CODE,n.NULL_CELL_WIDTH,ee.fg,ee.bg,ee.extended)),ae.setCellFromCodePoint(this._activeBuffer.x++,W,X,ee.fg,ee.bg,ee.extended),X>0)for(;--X;)ae.setCellFromCodePoint(this._activeBuffer.x++,0,0,ee.fg,ee.bg,ee.extended)}else ae.getWidth(this._activeBuffer.x-1)?ae.addCodepointToCell(this._activeBuffer.x-1,W):ae.addCodepointToCell(this._activeBuffer.x-2,W)}K-U>0&&(ae.loadCell(this._activeBuffer.x-1,this._workCell),this._workCell.getWidth()===2||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),this._activeBuffer.x<le&&K-U>0&&ae.getWidth(this._activeBuffer.x)===0&&!ae.hasContent(this._activeBuffer.x)&&ae.setCellFromCodePoint(this._activeBuffer.x,0,1,ee.fg,ee.bg,ee.extended),this._dirtyRowService.markDirty(this._activeBuffer.y)},P.prototype.registerCsiHandler=function(M,U){var K=this;return M.final!=="t"||M.prefix||M.intermediates?this._parser.registerCsiHandler(M,U):this._parser.registerCsiHandler(M,function(W){return!_(W.params[0],K._optionsService.options.windowOptions)||U(W)})},P.prototype.registerDcsHandler=function(M,U){return this._parser.registerDcsHandler(M,new S.DcsHandler(U))},P.prototype.registerEscHandler=function(M,U){return this._parser.registerEscHandler(M,U)},P.prototype.registerOscHandler=function(M,U){return this._parser.registerOscHandler(M,new A.OscHandler(U))},P.prototype.bell=function(){return this._onRequestBell.fire(),!0},P.prototype.lineFeed=function(){return this._dirtyRowService.markDirty(this._activeBuffer.y),this._optionsService.options.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowService.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0},P.prototype.carriageReturn=function(){return this._activeBuffer.x=0,!0},P.prototype.backspace=function(){var M;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))===null||M===void 0?void 0:M.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;var U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);U.hasWidth(this._activeBuffer.x)&&!U.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0},P.prototype.tab=function(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;var M=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.options.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-M),!0},P.prototype.shiftOut=function(){return this._charsetService.setgLevel(1),!0},P.prototype.shiftIn=function(){return this._charsetService.setgLevel(0),!0},P.prototype._restrictCursor=function(M){M===void 0&&(M=this._bufferService.cols-1),this._activeBuffer.x=Math.min(M,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowService.markDirty(this._activeBuffer.y)},P.prototype._setCursor=function(M,U){this._dirtyRowService.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=M,this._activeBuffer.y=this._activeBuffer.scrollTop+U):(this._activeBuffer.x=M,this._activeBuffer.y=U),this._restrictCursor(),this._dirtyRowService.markDirty(this._activeBuffer.y)},P.prototype._moveCursor=function(M,U){this._restrictCursor(),this._setCursor(this._activeBuffer.x+M,this._activeBuffer.y+U)},P.prototype.cursorUp=function(M){var U=this._activeBuffer.y-this._activeBuffer.scrollTop;return U>=0?this._moveCursor(0,-Math.min(U,M.params[0]||1)):this._moveCursor(0,-(M.params[0]||1)),!0},P.prototype.cursorDown=function(M){var U=this._activeBuffer.scrollBottom-this._activeBuffer.y;return U>=0?this._moveCursor(0,Math.min(U,M.params[0]||1)):this._moveCursor(0,M.params[0]||1),!0},P.prototype.cursorForward=function(M){return this._moveCursor(M.params[0]||1,0),!0},P.prototype.cursorBackward=function(M){return this._moveCursor(-(M.params[0]||1),0),!0},P.prototype.cursorNextLine=function(M){return this.cursorDown(M),this._activeBuffer.x=0,!0},P.prototype.cursorPrecedingLine=function(M){return this.cursorUp(M),this._activeBuffer.x=0,!0},P.prototype.cursorCharAbsolute=function(M){return this._setCursor((M.params[0]||1)-1,this._activeBuffer.y),!0},P.prototype.cursorPosition=function(M){return this._setCursor(M.length>=2?(M.params[1]||1)-1:0,(M.params[0]||1)-1),!0},P.prototype.charPosAbsolute=function(M){return this._setCursor((M.params[0]||1)-1,this._activeBuffer.y),!0},P.prototype.hPositionRelative=function(M){return this._moveCursor(M.params[0]||1,0),!0},P.prototype.linePosAbsolute=function(M){return this._setCursor(this._activeBuffer.x,(M.params[0]||1)-1),!0},P.prototype.vPositionRelative=function(M){return this._moveCursor(0,M.params[0]||1),!0},P.prototype.hVPosition=function(M){return this.cursorPosition(M),!0},P.prototype.tabClear=function(M){var U=M.params[0];return U===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:U===3&&(this._activeBuffer.tabs={}),!0},P.prototype.cursorForwardTab=function(M){if(this._activeBuffer.x>=this._bufferService.cols)return!0;for(var U=M.params[0]||1;U--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0},P.prototype.cursorBackwardTab=function(M){if(this._activeBuffer.x>=this._bufferService.cols)return!0;for(var U=M.params[0]||1;U--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0},P.prototype._eraseInBufferLine=function(M,U,K,W){W===void 0&&(W=!1);var X=this._activeBuffer.lines.get(this._activeBuffer.ybase+M);X.replaceCells(U,K,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),W&&(X.isWrapped=!1)},P.prototype._resetBufferLine=function(M){var U=this._activeBuffer.lines.get(this._activeBuffer.ybase+M);U.fill(this._activeBuffer.getNullCell(this._eraseAttrData())),U.isWrapped=!1},P.prototype.eraseInDisplay=function(M){var U;switch(this._restrictCursor(this._bufferService.cols),M.params[0]){case 0:for(U=this._activeBuffer.y,this._dirtyRowService.markDirty(U),this._eraseInBufferLine(U++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0);U<this._bufferService.rows;U++)this._resetBufferLine(U);this._dirtyRowService.markDirty(U);break;case 1:for(U=this._activeBuffer.y,this._dirtyRowService.markDirty(U),this._eraseInBufferLine(U,0,this._activeBuffer.x+1,!0),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(U+1).isWrapped=!1);U--;)this._resetBufferLine(U);this._dirtyRowService.markDirty(0);break;case 2:for(U=this._bufferService.rows,this._dirtyRowService.markDirty(U-1);U--;)this._resetBufferLine(U);this._dirtyRowService.markDirty(0);break;case 3:var K=this._activeBuffer.lines.length-this._bufferService.rows;K>0&&(this._activeBuffer.lines.trimStart(K),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-K,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-K,0),this._onScroll.fire(0))}return!0},P.prototype.eraseInLine=function(M){switch(this._restrictCursor(this._bufferService.cols),M.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols)}return this._dirtyRowService.markDirty(this._activeBuffer.y),!0},P.prototype.insertLines=function(M){this._restrictCursor();var U=M.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;for(var K=this._activeBuffer.ybase+this._activeBuffer.y,W=this._bufferService.rows-1-this._activeBuffer.scrollBottom,X=this._bufferService.rows-1+this._activeBuffer.ybase-W+1;U--;)this._activeBuffer.lines.splice(X-1,1),this._activeBuffer.lines.splice(K,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowService.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0},P.prototype.deleteLines=function(M){this._restrictCursor();var U=M.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;var K,W=this._activeBuffer.ybase+this._activeBuffer.y;for(K=this._bufferService.rows-1-this._activeBuffer.scrollBottom,K=this._bufferService.rows-1+this._activeBuffer.ybase-K;U--;)this._activeBuffer.lines.splice(W,1),this._activeBuffer.lines.splice(K,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowService.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0},P.prototype.insertChars=function(M){this._restrictCursor();var U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return U&&(U.insertCells(this._activeBuffer.x,M.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._activeBuffer.y)),!0},P.prototype.deleteChars=function(M){this._restrictCursor();var U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return U&&(U.deleteCells(this._activeBuffer.x,M.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._activeBuffer.y)),!0},P.prototype.scrollUp=function(M){for(var U=M.params[0]||1;U--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0},P.prototype.scrollDown=function(M){for(var U=M.params[0]||1;U--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(u.DEFAULT_ATTR_DATA));return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0},P.prototype.scrollLeft=function(M){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;for(var U=M.params[0]||1,K=this._activeBuffer.scrollTop;K<=this._activeBuffer.scrollBottom;++K){var W=this._activeBuffer.lines.get(this._activeBuffer.ybase+K);W.deleteCells(0,U,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),W.isWrapped=!1}return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0},P.prototype.scrollRight=function(M){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;for(var U=M.params[0]||1,K=this._activeBuffer.scrollTop;K<=this._activeBuffer.scrollBottom;++K){var W=this._activeBuffer.lines.get(this._activeBuffer.ybase+K);W.insertCells(0,U,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),W.isWrapped=!1}return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0},P.prototype.insertColumns=function(M){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;for(var U=M.params[0]||1,K=this._activeBuffer.scrollTop;K<=this._activeBuffer.scrollBottom;++K){var W=this._activeBuffer.lines.get(this._activeBuffer.ybase+K);W.insertCells(this._activeBuffer.x,U,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),W.isWrapped=!1}return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0},P.prototype.deleteColumns=function(M){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;for(var U=M.params[0]||1,K=this._activeBuffer.scrollTop;K<=this._activeBuffer.scrollBottom;++K){var W=this._activeBuffer.lines.get(this._activeBuffer.ybase+K);W.deleteCells(this._activeBuffer.x,U,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),W.isWrapped=!1}return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0},P.prototype.eraseChars=function(M){this._restrictCursor();var U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return U&&(U.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(M.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._activeBuffer.y)),!0},P.prototype.repeatPrecedingCharacter=function(M){if(!this._parser.precedingCodepoint)return!0;for(var U=M.params[0]||1,K=new Uint32Array(U),W=0;W<U;++W)K[W]=this._parser.precedingCodepoint;return this.print(K,0,K.length),!0},P.prototype.sendDeviceAttributesPrimary=function(M){return M.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(g.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(g.C0.ESC+"[?6c")),!0},P.prototype.sendDeviceAttributesSecondary=function(M){return M.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(g.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(g.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(M.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(g.C0.ESC+"[>83;40003;0c")),!0},P.prototype._is=function(M){return(this._optionsService.options.termName+"").indexOf(M)===0},P.prototype.setMode=function(M){for(var U=0;U<M.length;U++)M.params[U]===4&&(this._coreService.modes.insertMode=!0);return!0},P.prototype.setModePrivate=function(M){for(var U=0;U<M.length;U++)switch(M.params[U]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,b.DEFAULT_CHARSET),this._charsetService.setgCharset(1,b.DEFAULT_CHARSET),this._charsetService.setgCharset(2,b.DEFAULT_CHARSET),this._charsetService.setgCharset(3,b.DEFAULT_CHARSET);break;case 3:this._optionsService.options.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0},P.prototype.resetMode=function(M){for(var U=0;U<M.length;U++)M.params[U]===4&&(this._coreService.modes.insertMode=!1);return!0},P.prototype.resetModePrivate=function(M){for(var U=0;U<M.length;U++)switch(M.params[U]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.options.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),M.params[U]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0},P.prototype._updateAttrColor=function(M,U,K,W,X){return U===2?(M|=50331648,M&=-16777216,M|=l.AttributeData.fromColorRGB([K,W,X])):U===5&&(M&=-50331904,M|=33554432|255&K),M},P.prototype._extractColor=function(M,U,K){var W=[0,0,-1,0,0,0],X=0,ie=0;do{if(W[ie+X]=M.params[U+ie],M.hasSubParams(U+ie)){var se=M.getSubParams(U+ie),le=0;do W[1]===5&&(X=1),W[ie+le+1+X]=se[le];while(++le<se.length&&le+ie+1+X<W.length);break}if(W[1]===5&&ie+X>=2||W[1]===2&&ie+X>=5)break;W[1]&&(X=1)}while(++ie+U<M.length&&ie+X<W.length);for(le=2;le<W.length;++le)W[le]===-1&&(W[le]=0);switch(W[0]){case 38:K.fg=this._updateAttrColor(K.fg,W[1],W[3],W[4],W[5]);break;case 48:K.bg=this._updateAttrColor(K.bg,W[1],W[3],W[4],W[5]);break;case 58:K.extended=K.extended.clone(),K.extended.underlineColor=this._updateAttrColor(K.extended.underlineColor,W[1],W[3],W[4],W[5])}return ie},P.prototype._processUnderline=function(M,U){U.extended=U.extended.clone(),(!~M||M>5)&&(M=1),U.extended.underlineStyle=M,U.fg|=268435456,M===0&&(U.fg&=-268435457),U.updateExtended()},P.prototype.charAttributes=function(M){if(M.length===1&&M.params[0]===0)return this._curAttrData.fg=u.DEFAULT_ATTR_DATA.fg,this._curAttrData.bg=u.DEFAULT_ATTR_DATA.bg,!0;for(var U,K=M.length,W=this._curAttrData,X=0;X<K;X++)(U=M.params[X])>=30&&U<=37?(W.fg&=-50331904,W.fg|=16777216|U-30):U>=40&&U<=47?(W.bg&=-50331904,W.bg|=16777216|U-40):U>=90&&U<=97?(W.fg&=-50331904,W.fg|=16777224|U-90):U>=100&&U<=107?(W.bg&=-50331904,W.bg|=16777224|U-100):U===0?(W.fg=u.DEFAULT_ATTR_DATA.fg,W.bg=u.DEFAULT_ATTR_DATA.bg):U===1?W.fg|=134217728:U===3?W.bg|=67108864:U===4?(W.fg|=268435456,this._processUnderline(M.hasSubParams(X)?M.getSubParams(X)[0]:1,W)):U===5?W.fg|=536870912:U===7?W.fg|=67108864:U===8?W.fg|=1073741824:U===9?W.fg|=2147483648:U===2?W.bg|=134217728:U===21?this._processUnderline(2,W):U===22?(W.fg&=-134217729,W.bg&=-134217729):U===23?W.bg&=-67108865:U===24?W.fg&=-268435457:U===25?W.fg&=-536870913:U===27?W.fg&=-67108865:U===28?W.fg&=-1073741825:U===29?W.fg&=2147483647:U===39?(W.fg&=-67108864,W.fg|=16777215&u.DEFAULT_ATTR_DATA.fg):U===49?(W.bg&=-67108864,W.bg|=16777215&u.DEFAULT_ATTR_DATA.bg):U===38||U===48||U===58?X+=this._extractColor(M,X,W):U===59?(W.extended=W.extended.clone(),W.extended.underlineColor=-1,W.updateExtended()):U===100?(W.fg&=-67108864,W.fg|=16777215&u.DEFAULT_ATTR_DATA.fg,W.bg&=-67108864,W.bg|=16777215&u.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",U);return!0},P.prototype.deviceStatus=function(M){switch(M.params[0]){case 5:this._coreService.triggerDataEvent(g.C0.ESC+"[0n");break;case 6:var U=this._activeBuffer.y+1,K=this._activeBuffer.x+1;this._coreService.triggerDataEvent(g.C0.ESC+"["+U+";"+K+"R")}return!0},P.prototype.deviceStatusPrivate=function(M){if(M.params[0]===6){var U=this._activeBuffer.y+1,K=this._activeBuffer.x+1;this._coreService.triggerDataEvent(g.C0.ESC+"[?"+U+";"+K+"R")}return!0},P.prototype.softReset=function(M){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0},P.prototype.setCursorStyle=function(M){var U=M.params[0]||1;switch(U){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}var K=U%2==1;return this._optionsService.options.cursorBlink=K,!0},P.prototype.setScrollRegion=function(M){var U,K=M.params[0]||1;return(M.length<2||(U=M.params[1])>this._bufferService.rows||U===0)&&(U=this._bufferService.rows),U>K&&(this._activeBuffer.scrollTop=K-1,this._activeBuffer.scrollBottom=U-1,this._setCursor(0,0)),!0},P.prototype.windowOptions=function(M){if(!_(M.params[0],this._optionsService.options.windowOptions))return!0;var U=M.length>1?M.params[1]:0;switch(M.params[0]){case 14:U!==2&&this._onRequestWindowsOptionsReport.fire(w.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(w.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(g.C0.ESC+"[8;"+this._bufferService.rows+";"+this._bufferService.cols+"t");break;case 22:U!==0&&U!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),U!==0&&U!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:U!==0&&U!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),U!==0&&U!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0},P.prototype.saveCursor=function(M){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0},P.prototype.restoreCursor=function(M){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0},P.prototype.setTitle=function(M){return this._windowTitle=M,this._onTitleChange.fire(M),!0},P.prototype.setIconName=function(M){return this._iconName=M,!0},P.prototype._parseAnsiColorChange=function(M){for(var U,K={colors:[]},W=/(\d+);rgb:([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})/gi;(U=W.exec(M))!==null;)K.colors.push({colorIndex:parseInt(U[1]),red:parseInt(U[2],16),green:parseInt(U[3],16),blue:parseInt(U[4],16)});return K.colors.length===0?null:K},P.prototype.setAnsiColor=function(M){var U=this._parseAnsiColorChange(M);return U?this._onAnsiColorChange.fire(U):this._logService.warn("Expected format <num>;rgb:<rr>/<gg>/<bb> but got data: "+M),!0},P.prototype.nextLine=function(){return this._activeBuffer.x=0,this.index(),!0},P.prototype.keypadApplicationMode=function(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0},P.prototype.keypadNumericMode=function(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0},P.prototype.selectDefaultCharset=function(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,b.DEFAULT_CHARSET),!0},P.prototype.selectCharset=function(M){return M.length!==2?(this.selectDefaultCharset(),!0):(M[0]==="/"||this._charsetService.setgCharset(R[M[0]],b.CHARSETS[M[1]]||b.DEFAULT_CHARSET),!0)},P.prototype.index=function(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0},P.prototype.tabSet=function(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0},P.prototype.reverseIndex=function(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){var M=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,M,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0},P.prototype.fullReset=function(){return this._parser.reset(),this._onRequestReset.fire(),!0},P.prototype.reset=function(){this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=u.DEFAULT_ATTR_DATA.clone()},P.prototype._eraseAttrData=function(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal},P.prototype.setgLevel=function(M){return this._charsetService.setgLevel(M),!0},P.prototype.screenAlignmentPattern=function(){var M=new s.CellData;M.content=1<<22|"E".charCodeAt(0),M.fg=this._curAttrData.fg,M.bg=this._curAttrData.bg,this._setCursor(0,0);for(var U=0;U<this._bufferService.rows;++U){var K=this._activeBuffer.ybase+this._activeBuffer.y+U,W=this._activeBuffer.lines.get(K);W&&(W.fill(M),W.isWrapped=!1)}return this._dirtyRowService.markAllDirty(),this._setCursor(0,0),!0},P}(f.Disposable);v.InputHandler=I},844:(N,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.getDisposeArrayDisposable=v.disposeArray=v.Disposable=void 0;var L=function(){function D(){this._disposables=[],this._isDisposed=!1}return D.prototype.dispose=function(){this._isDisposed=!0;for(var w=0,g=this._disposables;w<g.length;w++)g[w].dispose();this._disposables.length=0},D.prototype.register=function(w){return this._disposables.push(w),w},D.prototype.unregister=function(w){var g=this._disposables.indexOf(w);g!==-1&&this._disposables.splice(g,1)},D}();function O(D){for(var w=0,g=D;w<g.length;w++)g[w].dispose();D.length=0}v.Disposable=L,v.disposeArray=O,v.getDisposeArrayDisposable=function(D){return{dispose:function(){return O(D)}}}},6114:(N,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.isLinux=v.isWindows=v.isIphone=v.isIpad=v.isMac=v.isSafari=v.isFirefox=void 0;var L=typeof navigator=="undefined",O=L?"node":navigator.userAgent,D=L?"node":navigator.platform;v.isFirefox=O.includes("Firefox"),v.isSafari=/^((?!chrome|android).)*safari/i.test(O),v.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(D),v.isIpad=D==="iPad",v.isIphone=D==="iPhone",v.isWindows=["Windows","Win16","Win32","WinCE"].includes(D),v.isLinux=D.indexOf("Linux")>=0},8273:(N,v)=>{function L(O,D,w,g){if(w===void 0&&(w=0),g===void 0&&(g=O.length),w>=O.length)return O;w=(O.length+w)%O.length,g=g>=O.length?O.length:(O.length+g)%O.length;for(var b=w;b<g;++b)O[b]=D;return O}Object.defineProperty(v,"__esModule",{value:!0}),v.concat=v.fillFallback=v.fill=void 0,v.fill=function(O,D,w,g){return O.fill?O.fill(D,w,g):L(O,D,w,g)},v.fillFallback=L,v.concat=function(O,D){var w=new O.constructor(O.length+D.length);return w.set(O),w.set(D,O.length),w}},9282:(N,v,L)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.updateWindowsModeWrappedState=void 0;var O=L(643);v.updateWindowsModeWrappedState=function(D){var w=D.buffer.lines.get(D.buffer.ybase+D.buffer.y-1),g=w==null?void 0:w.get(D.cols-1),b=D.buffer.lines.get(D.buffer.ybase+D.buffer.y);b&&g&&(b.isWrapped=g[O.CHAR_DATA_CODE_INDEX]!==O.NULL_CELL_CODE&&g[O.CHAR_DATA_CODE_INDEX]!==O.WHITESPACE_CELL_CODE)}},3734:(N,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.ExtendedAttrs=v.AttributeData=void 0;var L=function(){function D(){this.fg=0,this.bg=0,this.extended=new O}return D.toColorRGB=function(w){return[w>>>16&255,w>>>8&255,255&w]},D.fromColorRGB=function(w){return(255&w[0])<<16|(255&w[1])<<8|255&w[2]},D.prototype.clone=function(){var w=new D;return w.fg=this.fg,w.bg=this.bg,w.extended=this.extended.clone(),w},D.prototype.isInverse=function(){return 67108864&this.fg},D.prototype.isBold=function(){return 134217728&this.fg},D.prototype.isUnderline=function(){return 268435456&this.fg},D.prototype.isBlink=function(){return 536870912&this.fg},D.prototype.isInvisible=function(){return 1073741824&this.fg},D.prototype.isItalic=function(){return 67108864&this.bg},D.prototype.isDim=function(){return 134217728&this.bg},D.prototype.isStrikethrough=function(){return 2147483648&this.fg},D.prototype.getFgColorMode=function(){return 50331648&this.fg},D.prototype.getBgColorMode=function(){return 50331648&this.bg},D.prototype.isFgRGB=function(){return(50331648&this.fg)==50331648},D.prototype.isBgRGB=function(){return(50331648&this.bg)==50331648},D.prototype.isFgPalette=function(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432},D.prototype.isBgPalette=function(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432},D.prototype.isFgDefault=function(){return(50331648&this.fg)==0},D.prototype.isBgDefault=function(){return(50331648&this.bg)==0},D.prototype.isAttributeDefault=function(){return this.fg===0&&this.bg===0},D.prototype.getFgColor=function(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}},D.prototype.getBgColor=function(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}},D.prototype.hasExtendedAttrs=function(){return 268435456&this.bg},D.prototype.updateExtended=function(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456},D.prototype.getUnderlineColor=function(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()},D.prototype.getUnderlineColorMode=function(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()},D.prototype.isUnderlineColorRGB=function(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()},D.prototype.isUnderlineColorPalette=function(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()},D.prototype.isUnderlineColorDefault=function(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()},D.prototype.getUnderlineStyle=function(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0},D}();v.AttributeData=L;var O=function(){function D(w,g){w===void 0&&(w=0),g===void 0&&(g=-1),this.underlineStyle=w,this.underlineColor=g}return D.prototype.clone=function(){return new D(this.underlineStyle,this.underlineColor)},D.prototype.isEmpty=function(){return this.underlineStyle===0},D}();v.ExtendedAttrs=O},9092:(N,v,L)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.BufferStringIterator=v.Buffer=v.MAX_BUFFER_SIZE=void 0;var O=L(6349),D=L(8437),w=L(511),g=L(643),b=L(4634),T=L(4863),f=L(7116),p=L(3734);v.MAX_BUFFER_SIZE=4294967295;var E=function(){function a(n,s,l){this._hasScrollback=n,this._optionsService=s,this._bufferService=l,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.savedY=0,this.savedX=0,this.savedCurAttrData=D.DEFAULT_ATTR_DATA.clone(),this.savedCharset=f.DEFAULT_CHARSET,this.markers=[],this._nullCell=w.CellData.fromCharData([0,g.NULL_CELL_CHAR,g.NULL_CELL_WIDTH,g.NULL_CELL_CODE]),this._whitespaceCell=w.CellData.fromCharData([0,g.WHITESPACE_CELL_CHAR,g.WHITESPACE_CELL_WIDTH,g.WHITESPACE_CELL_CODE]),this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new O.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}return a.prototype.getNullCell=function(n){return n?(this._nullCell.fg=n.fg,this._nullCell.bg=n.bg,this._nullCell.extended=n.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new p.ExtendedAttrs),this._nullCell},a.prototype.getWhitespaceCell=function(n){return n?(this._whitespaceCell.fg=n.fg,this._whitespaceCell.bg=n.bg,this._whitespaceCell.extended=n.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new p.ExtendedAttrs),this._whitespaceCell},a.prototype.getBlankLine=function(n,s){return new D.BufferLine(this._bufferService.cols,this.getNullCell(n),s)},Object.defineProperty(a.prototype,"hasScrollback",{get:function(){return this._hasScrollback&&this.lines.maxLength>this._rows},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"isCursorInViewport",{get:function(){var n=this.ybase+this.y-this.ydisp;return n>=0&&n<this._rows},enumerable:!1,configurable:!0}),a.prototype._getCorrectBufferLength=function(n){if(!this._hasScrollback)return n;var s=n+this._optionsService.options.scrollback;return s>v.MAX_BUFFER_SIZE?v.MAX_BUFFER_SIZE:s},a.prototype.fillViewportRows=function(n){if(this.lines.length===0){n===void 0&&(n=D.DEFAULT_ATTR_DATA);for(var s=this._rows;s--;)this.lines.push(this.getBlankLine(n))}},a.prototype.clear=function(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new O.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()},a.prototype.resize=function(n,s){var l=this.getNullCell(D.DEFAULT_ATTR_DATA),d=this._getCorrectBufferLength(s);if(d>this.lines.maxLength&&(this.lines.maxLength=d),this.lines.length>0){if(this._cols<n)for(var A=0;A<this.lines.length;A++)this.lines.get(A).resize(n,l);var S=0;if(this._rows<s)for(var R=this._rows;R<s;R++)this.lines.length<s+this.ybase&&(this._optionsService.options.windowsMode?this.lines.push(new D.BufferLine(n,l)):this.ybase>0&&this.lines.length<=this.ybase+this.y+S+1?(this.ybase--,S++,this.ydisp>0&&this.ydisp--):this.lines.push(new D.BufferLine(n,l)));else for(R=this._rows;R>s;R--)this.lines.length>s+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(d<this.lines.maxLength){var y=this.lines.length-d;y>0&&(this.lines.trimStart(y),this.ybase=Math.max(this.ybase-y,0),this.ydisp=Math.max(this.ydisp-y,0),this.savedY=Math.max(this.savedY-y,0)),this.lines.maxLength=d}this.x=Math.min(this.x,n-1),this.y=Math.min(this.y,s-1),S&&(this.y+=S),this.savedX=Math.min(this.savedX,n-1),this.scrollTop=0}if(this.scrollBottom=s-1,this._isReflowEnabled&&(this._reflow(n,s),this._cols>n))for(A=0;A<this.lines.length;A++)this.lines.get(A).resize(n,l);this._cols=n,this._rows=s},Object.defineProperty(a.prototype,"_isReflowEnabled",{get:function(){return this._hasScrollback&&!this._optionsService.options.windowsMode},enumerable:!1,configurable:!0}),a.prototype._reflow=function(n,s){this._cols!==n&&(n>this._cols?this._reflowLarger(n,s):this._reflowSmaller(n,s))},a.prototype._reflowLarger=function(n,s){var l=(0,b.reflowLargerGetLinesToRemove)(this.lines,this._cols,n,this.ybase+this.y,this.getNullCell(D.DEFAULT_ATTR_DATA));if(l.length>0){var d=(0,b.reflowLargerCreateNewLayout)(this.lines,l);(0,b.reflowLargerApplyNewLayout)(this.lines,d.layout),this._reflowLargerAdjustViewport(n,s,d.countRemoved)}},a.prototype._reflowLargerAdjustViewport=function(n,s,l){for(var d=this.getNullCell(D.DEFAULT_ATTR_DATA),A=l;A-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<s&&this.lines.push(new D.BufferLine(n,d))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-l,0)},a.prototype._reflowSmaller=function(n,s){for(var l=this.getNullCell(D.DEFAULT_ATTR_DATA),d=[],A=0,S=this.lines.length-1;S>=0;S--){var R=this.lines.get(S);if(!(!R||!R.isWrapped&&R.getTrimmedLength()<=n)){for(var y=[R];R.isWrapped&&S>0;)R=this.lines.get(--S),y.unshift(R);var _=this.ybase+this.y;if(!(_>=S&&_<S+y.length)){var m,I=y[y.length-1].getTrimmedLength(),B=(0,b.reflowSmallerGetNewLineLengths)(y,this._cols,n),P=B.length-y.length;m=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+P):Math.max(0,this.lines.length-this.lines.maxLength+P);for(var M=[],U=0;U<P;U++){var K=this.getBlankLine(D.DEFAULT_ATTR_DATA,!0);M.push(K)}M.length>0&&(d.push({start:S+y.length+A,newLines:M}),A+=M.length),y.push.apply(y,M);var W=B.length-1,X=B[W];X===0&&(X=B[--W]);for(var ie=y.length-P-1,se=I;ie>=0;){var le=Math.min(se,X);if(y[W].copyCellsFrom(y[ie],se-le,X-le,le,!0),(X-=le)==0&&(X=B[--W]),(se-=le)==0){ie--;var ve=Math.max(ie,0);se=(0,b.getWrappedLineTrimmedLength)(y,ve,this._cols)}}for(U=0;U<y.length;U++)B[U]<n&&y[U].setCell(B[U],l);for(var q=P-m;q-- >0;)this.ybase===0?this.y<s-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+A)-s&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+P,this.ybase+s-1)}}}if(d.length>0){var ee=[],ae=[];for(U=0;U<this.lines.length;U++)ae.push(this.lines.get(U));var _e=this.lines.length,fe=_e-1,Ue=0,Te=d[Ue];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+A);var Fe=0;for(U=Math.min(this.lines.maxLength-1,_e+A-1);U>=0;U--)if(Te&&Te.start>fe+Fe){for(var $e=Te.newLines.length-1;$e>=0;$e--)this.lines.set(U--,Te.newLines[$e]);U++,ee.push({index:fe+1,amount:Te.newLines.length}),Fe+=Te.newLines.length,Te=d[++Ue]}else this.lines.set(U,ae[fe--]);var Ye=0;for(U=ee.length-1;U>=0;U--)ee[U].index+=Ye,this.lines.onInsertEmitter.fire(ee[U]),Ye+=ee[U].amount;var Ge=Math.max(0,_e+A-this.lines.maxLength);Ge>0&&this.lines.onTrimEmitter.fire(Ge)}},a.prototype.stringIndexToBufferIndex=function(n,s,l){for(l===void 0&&(l=!1);s;){var d=this.lines.get(n);if(!d)return[-1,-1];for(var A=l?d.getTrimmedLength():d.length,S=0;S<A;++S)if(d.get(S)[g.CHAR_DATA_WIDTH_INDEX]&&(s-=d.get(S)[g.CHAR_DATA_CHAR_INDEX].length||1),s<0)return[n,S];n++}return[n,0]},a.prototype.translateBufferLineToString=function(n,s,l,d){l===void 0&&(l=0);var A=this.lines.get(n);return A?A.translateToString(s,l,d):""},a.prototype.getWrappedRangeForLine=function(n){for(var s=n,l=n;s>0&&this.lines.get(s).isWrapped;)s--;for(;l+1<this.lines.length&&this.lines.get(l+1).isWrapped;)l++;return{first:s,last:l}},a.prototype.setupTabStops=function(n){for(n!=null?this.tabs[n]||(n=this.prevStop(n)):(this.tabs={},n=0);n<this._cols;n+=this._optionsService.options.tabStopWidth)this.tabs[n]=!0},a.prototype.prevStop=function(n){for(n==null&&(n=this.x);!this.tabs[--n]&&n>0;);return n>=this._cols?this._cols-1:n<0?0:n},a.prototype.nextStop=function(n){for(n==null&&(n=this.x);!this.tabs[++n]&&n<this._cols;);return n>=this._cols?this._cols-1:n<0?0:n},a.prototype.addMarker=function(n){var s=this,l=new T.Marker(n);return this.markers.push(l),l.register(this.lines.onTrim(function(d){l.line-=d,l.line<0&&l.dispose()})),l.register(this.lines.onInsert(function(d){l.line>=d.index&&(l.line+=d.amount)})),l.register(this.lines.onDelete(function(d){l.line>=d.index&&l.line<d.index+d.amount&&l.dispose(),l.line>d.index&&(l.line-=d.amount)})),l.register(l.onDispose(function(){return s._removeMarker(l)})),l},a.prototype._removeMarker=function(n){this.markers.splice(this.markers.indexOf(n),1)},a.prototype.iterator=function(n,s,l,d,A){return new u(this,n,s,l,d,A)},a}();v.Buffer=E;var u=function(){function a(n,s,l,d,A,S){l===void 0&&(l=0),d===void 0&&(d=n.lines.length),A===void 0&&(A=0),S===void 0&&(S=0),this._buffer=n,this._trimRight=s,this._startIndex=l,this._endIndex=d,this._startOverscan=A,this._endOverscan=S,this._startIndex<0&&(this._startIndex=0),this._endIndex>this._buffer.lines.length&&(this._endIndex=this._buffer.lines.length),this._current=this._startIndex}return a.prototype.hasNext=function(){return this._current<this._endIndex},a.prototype.next=function(){var n=this._buffer.getWrappedRangeForLine(this._current);n.first<this._startIndex-this._startOverscan&&(n.first=this._startIndex-this._startOverscan),n.last>this._endIndex+this._endOverscan&&(n.last=this._endIndex+this._endOverscan),n.first=Math.max(n.first,0),n.last=Math.min(n.last,this._buffer.lines.length);for(var s="",l=n.first;l<=n.last;++l)s+=this._buffer.translateBufferLineToString(l,this._trimRight);return this._current=n.last+1,{range:n,content:s}},a}();v.BufferStringIterator=u},8437:(N,v,L)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.BufferLine=v.DEFAULT_ATTR_DATA=void 0;var O=L(482),D=L(643),w=L(511),g=L(3734);v.DEFAULT_ATTR_DATA=Object.freeze(new g.AttributeData);var b=function(){function T(f,p,E){E===void 0&&(E=!1),this.isWrapped=E,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*f);for(var u=p||w.CellData.fromCharData([0,D.NULL_CELL_CHAR,D.NULL_CELL_WIDTH,D.NULL_CELL_CODE]),a=0;a<f;++a)this.setCell(a,u);this.length=f}return T.prototype.get=function(f){var p=this._data[3*f+0],E=2097151&p;return[this._data[3*f+1],2097152&p?this._combined[f]:E?(0,O.stringFromCodePoint)(E):"",p>>22,2097152&p?this._combined[f].charCodeAt(this._combined[f].length-1):E]},T.prototype.set=function(f,p){this._data[3*f+1]=p[D.CHAR_DATA_ATTR_INDEX],p[D.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[f]=p[1],this._data[3*f+0]=2097152|f|p[D.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*f+0]=p[D.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|p[D.CHAR_DATA_WIDTH_INDEX]<<22},T.prototype.getWidth=function(f){return this._data[3*f+0]>>22},T.prototype.hasWidth=function(f){return 12582912&this._data[3*f+0]},T.prototype.getFg=function(f){return this._data[3*f+1]},T.prototype.getBg=function(f){return this._data[3*f+2]},T.prototype.hasContent=function(f){return 4194303&this._data[3*f+0]},T.prototype.getCodePoint=function(f){var p=this._data[3*f+0];return 2097152&p?this._combined[f].charCodeAt(this._combined[f].length-1):2097151&p},T.prototype.isCombined=function(f){return 2097152&this._data[3*f+0]},T.prototype.getString=function(f){var p=this._data[3*f+0];return 2097152&p?this._combined[f]:2097151&p?(0,O.stringFromCodePoint)(2097151&p):""},T.prototype.loadCell=function(f,p){var E=3*f;return p.content=this._data[E+0],p.fg=this._data[E+1],p.bg=this._data[E+2],2097152&p.content&&(p.combinedData=this._combined[f]),268435456&p.bg&&(p.extended=this._extendedAttrs[f]),p},T.prototype.setCell=function(f,p){2097152&p.content&&(this._combined[f]=p.combinedData),268435456&p.bg&&(this._extendedAttrs[f]=p.extended),this._data[3*f+0]=p.content,this._data[3*f+1]=p.fg,this._data[3*f+2]=p.bg},T.prototype.setCellFromCodePoint=function(f,p,E,u,a,n){268435456&a&&(this._extendedAttrs[f]=n),this._data[3*f+0]=p|E<<22,this._data[3*f+1]=u,this._data[3*f+2]=a},T.prototype.addCodepointToCell=function(f,p){var E=this._data[3*f+0];2097152&E?this._combined[f]+=(0,O.stringFromCodePoint)(p):(2097151&E?(this._combined[f]=(0,O.stringFromCodePoint)(2097151&E)+(0,O.stringFromCodePoint)(p),E&=-2097152,E|=2097152):E=p|1<<22,this._data[3*f+0]=E)},T.prototype.insertCells=function(f,p,E,u){if((f%=this.length)&&this.getWidth(f-1)===2&&this.setCellFromCodePoint(f-1,0,1,(u==null?void 0:u.fg)||0,(u==null?void 0:u.bg)||0,(u==null?void 0:u.extended)||new g.ExtendedAttrs),p<this.length-f){for(var a=new w.CellData,n=this.length-f-p-1;n>=0;--n)this.setCell(f+p+n,this.loadCell(f+n,a));for(n=0;n<p;++n)this.setCell(f+n,E)}else for(n=f;n<this.length;++n)this.setCell(n,E);this.getWidth(this.length-1)===2&&this.setCellFromCodePoint(this.length-1,0,1,(u==null?void 0:u.fg)||0,(u==null?void 0:u.bg)||0,(u==null?void 0:u.extended)||new g.ExtendedAttrs)},T.prototype.deleteCells=function(f,p,E,u){if(f%=this.length,p<this.length-f){for(var a=new w.CellData,n=0;n<this.length-f-p;++n)this.setCell(f+n,this.loadCell(f+p+n,a));for(n=this.length-p;n<this.length;++n)this.setCell(n,E)}else for(n=f;n<this.length;++n)this.setCell(n,E);f&&this.getWidth(f-1)===2&&this.setCellFromCodePoint(f-1,0,1,(u==null?void 0:u.fg)||0,(u==null?void 0:u.bg)||0,(u==null?void 0:u.extended)||new g.ExtendedAttrs),this.getWidth(f)!==0||this.hasContent(f)||this.setCellFromCodePoint(f,0,1,(u==null?void 0:u.fg)||0,(u==null?void 0:u.bg)||0,(u==null?void 0:u.extended)||new g.ExtendedAttrs)},T.prototype.replaceCells=function(f,p,E,u){for(f&&this.getWidth(f-1)===2&&this.setCellFromCodePoint(f-1,0,1,(u==null?void 0:u.fg)||0,(u==null?void 0:u.bg)||0,(u==null?void 0:u.extended)||new g.ExtendedAttrs),p<this.length&&this.getWidth(p-1)===2&&this.setCellFromCodePoint(p,0,1,(u==null?void 0:u.fg)||0,(u==null?void 0:u.bg)||0,(u==null?void 0:u.extended)||new g.ExtendedAttrs);f<p&&f<this.length;)this.setCell(f++,E)},T.prototype.resize=function(f,p){if(f!==this.length){if(f>this.length){var E=new Uint32Array(3*f);this.length&&(3*f<this._data.length?E.set(this._data.subarray(0,3*f)):E.set(this._data)),this._data=E;for(var u=this.length;u<f;++u)this.setCell(u,p)}else if(f){(E=new Uint32Array(3*f)).set(this._data.subarray(0,3*f)),this._data=E;var a=Object.keys(this._combined);for(u=0;u<a.length;u++){var n=parseInt(a[u],10);n>=f&&delete this._combined[n]}}else this._data=new Uint32Array(0),this._combined={};this.length=f}},T.prototype.fill=function(f){this._combined={},this._extendedAttrs={};for(var p=0;p<this.length;++p)this.setCell(p,f)},T.prototype.copyFrom=function(f){for(var p in this.length!==f.length?this._data=new Uint32Array(f._data):this._data.set(f._data),this.length=f.length,this._combined={},f._combined)this._combined[p]=f._combined[p];for(var p in this._extendedAttrs={},f._extendedAttrs)this._extendedAttrs[p]=f._extendedAttrs[p];this.isWrapped=f.isWrapped},T.prototype.clone=function(){var f=new T(0);for(var p in f._data=new Uint32Array(this._data),f.length=this.length,this._combined)f._combined[p]=this._combined[p];for(var p in this._extendedAttrs)f._extendedAttrs[p]=this._extendedAttrs[p];return f.isWrapped=this.isWrapped,f},T.prototype.getTrimmedLength=function(){for(var f=this.length-1;f>=0;--f)if(4194303&this._data[3*f+0])return f+(this._data[3*f+0]>>22);return 0},T.prototype.copyCellsFrom=function(f,p,E,u,a){var n=f._data;if(a)for(var s=u-1;s>=0;s--)for(var l=0;l<3;l++)this._data[3*(E+s)+l]=n[3*(p+s)+l];else for(s=0;s<u;s++)for(l=0;l<3;l++)this._data[3*(E+s)+l]=n[3*(p+s)+l];var d=Object.keys(f._combined);for(l=0;l<d.length;l++){var A=parseInt(d[l],10);A>=p&&(this._combined[A-p+E]=f._combined[A])}},T.prototype.translateToString=function(f,p,E){f===void 0&&(f=!1),p===void 0&&(p=0),E===void 0&&(E=this.length),f&&(E=Math.min(E,this.getTrimmedLength()));for(var u="";p<E;){var a=this._data[3*p+0],n=2097151&a;u+=2097152&a?this._combined[p]:n?(0,O.stringFromCodePoint)(n):D.WHITESPACE_CELL_CHAR,p+=a>>22||1}return u},T}();v.BufferLine=b},4841:(N,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.getRangeLength=void 0,v.getRangeLength=function(L,O){if(L.start.y>L.end.y)throw new Error("Buffer range end ("+L.end.x+", "+L.end.y+") cannot be before start ("+L.start.x+", "+L.start.y+")");return O*(L.end.y-L.start.y)+(L.end.x-L.start.x+1)}},4634:(N,v)=>{function L(O,D,w){if(D===O.length-1)return O[D].getTrimmedLength();var g=!O[D].hasContent(w-1)&&O[D].getWidth(w-1)===1,b=O[D+1].getWidth(0)===2;return g&&b?w-1:w}Object.defineProperty(v,"__esModule",{value:!0}),v.getWrappedLineTrimmedLength=v.reflowSmallerGetNewLineLengths=v.reflowLargerApplyNewLayout=v.reflowLargerCreateNewLayout=v.reflowLargerGetLinesToRemove=void 0,v.reflowLargerGetLinesToRemove=function(O,D,w,g,b){for(var T=[],f=0;f<O.length-1;f++){var p=f,E=O.get(++p);if(E.isWrapped){for(var u=[O.get(f)];p<O.length&&E.isWrapped;)u.push(E),E=O.get(++p);if(g>=f&&g<p)f+=u.length-1;else{for(var a=0,n=L(u,a,D),s=1,l=0;s<u.length;){var d=L(u,s,D),A=d-l,S=w-n,R=Math.min(A,S);u[a].copyCellsFrom(u[s],l,n,R,!1),(n+=R)===w&&(a++,n=0),(l+=R)===d&&(s++,l=0),n===0&&a!==0&&u[a-1].getWidth(w-1)===2&&(u[a].copyCellsFrom(u[a-1],w-1,n++,1,!1),u[a-1].setCell(w-1,b))}u[a].replaceCells(n,w,b);for(var y=0,_=u.length-1;_>0&&(_>a||u[_].getTrimmedLength()===0);_--)y++;y>0&&(T.push(f+u.length-y),T.push(y)),f+=u.length-1}}}return T},v.reflowLargerCreateNewLayout=function(O,D){for(var w=[],g=0,b=D[g],T=0,f=0;f<O.length;f++)if(b===f){var p=D[++g];O.onDeleteEmitter.fire({index:f-T,amount:p}),f+=p-1,T+=p,b=D[++g]}else w.push(f);return{layout:w,countRemoved:T}},v.reflowLargerApplyNewLayout=function(O,D){for(var w=[],g=0;g<D.length;g++)w.push(O.get(D[g]));for(g=0;g<w.length;g++)O.set(g,w[g]);O.length=D.length},v.reflowSmallerGetNewLineLengths=function(O,D,w){for(var g=[],b=O.map(function(n,s){return L(O,s,D)}).reduce(function(n,s){return n+s}),T=0,f=0,p=0;p<b;){if(b-p<w){g.push(b-p);break}T+=w;var E=L(O,f,D);T>E&&(T-=E,f++);var u=O[f].getWidth(T-1)===2;u&&T--;var a=u?w-1:w;g.push(a),p+=a}return g},v.getWrappedLineTrimmedLength=L},5295:function(N,v,L){var O,D=this&&this.__extends||(O=function(T,f){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,E){p.__proto__=E}||function(p,E){for(var u in E)Object.prototype.hasOwnProperty.call(E,u)&&(p[u]=E[u])},O(T,f)},function(T,f){if(typeof f!="function"&&f!==null)throw new TypeError("Class extends value "+String(f)+" is not a constructor or null");function p(){this.constructor=T}O(T,f),T.prototype=f===null?Object.create(f):(p.prototype=f.prototype,new p)});Object.defineProperty(v,"__esModule",{value:!0}),v.BufferSet=void 0;var w=L(9092),g=L(8460),b=function(T){function f(p,E){var u=T.call(this)||this;return u._optionsService=p,u._bufferService=E,u._onBufferActivate=u.register(new g.EventEmitter),u.reset(),u}return D(f,T),Object.defineProperty(f.prototype,"onBufferActivate",{get:function(){return this._onBufferActivate.event},enumerable:!1,configurable:!0}),f.prototype.reset=function(){this._normal=new w.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new w.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()},Object.defineProperty(f.prototype,"alt",{get:function(){return this._alt},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"active",{get:function(){return this._activeBuffer},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"normal",{get:function(){return this._normal},enumerable:!1,configurable:!0}),f.prototype.activateNormalBuffer=function(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))},f.prototype.activateAltBuffer=function(p){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(p),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))},f.prototype.resize=function(p,E){this._normal.resize(p,E),this._alt.resize(p,E)},f.prototype.setupTabStops=function(p){this._normal.setupTabStops(p),this._alt.setupTabStops(p)},f}(L(844).Disposable);v.BufferSet=b},511:function(N,v,L){var O,D=this&&this.__extends||(O=function(f,p){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,u){E.__proto__=u}||function(E,u){for(var a in u)Object.prototype.hasOwnProperty.call(u,a)&&(E[a]=u[a])},O(f,p)},function(f,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");function E(){this.constructor=f}O(f,p),f.prototype=p===null?Object.create(p):(E.prototype=p.prototype,new E)});Object.defineProperty(v,"__esModule",{value:!0}),v.CellData=void 0;var w=L(482),g=L(643),b=L(3734),T=function(f){function p(){var E=f!==null&&f.apply(this,arguments)||this;return E.content=0,E.fg=0,E.bg=0,E.extended=new b.ExtendedAttrs,E.combinedData="",E}return D(p,f),p.fromCharData=function(E){var u=new p;return u.setFromCharData(E),u},p.prototype.isCombined=function(){return 2097152&this.content},p.prototype.getWidth=function(){return this.content>>22},p.prototype.getChars=function(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,w.stringFromCodePoint)(2097151&this.content):""},p.prototype.getCode=function(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content},p.prototype.setFromCharData=function(E){this.fg=E[g.CHAR_DATA_ATTR_INDEX],this.bg=0;var u=!1;if(E[g.CHAR_DATA_CHAR_INDEX].length>2)u=!0;else if(E[g.CHAR_DATA_CHAR_INDEX].length===2){var a=E[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=a&&a<=56319){var n=E[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=n&&n<=57343?this.content=1024*(a-55296)+n-56320+65536|E[g.CHAR_DATA_WIDTH_INDEX]<<22:u=!0}else u=!0}else this.content=E[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|E[g.CHAR_DATA_WIDTH_INDEX]<<22;u&&(this.combinedData=E[g.CHAR_DATA_CHAR_INDEX],this.content=2097152|E[g.CHAR_DATA_WIDTH_INDEX]<<22)},p.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},p}(b.AttributeData);v.CellData=T},643:(N,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.WHITESPACE_CELL_CODE=v.WHITESPACE_CELL_WIDTH=v.WHITESPACE_CELL_CHAR=v.NULL_CELL_CODE=v.NULL_CELL_WIDTH=v.NULL_CELL_CHAR=v.CHAR_DATA_CODE_INDEX=v.CHAR_DATA_WIDTH_INDEX=v.CHAR_DATA_CHAR_INDEX=v.CHAR_DATA_ATTR_INDEX=v.DEFAULT_ATTR=v.DEFAULT_COLOR=void 0,v.DEFAULT_COLOR=256,v.DEFAULT_ATTR=256|v.DEFAULT_COLOR<<9,v.CHAR_DATA_ATTR_INDEX=0,v.CHAR_DATA_CHAR_INDEX=1,v.CHAR_DATA_WIDTH_INDEX=2,v.CHAR_DATA_CODE_INDEX=3,v.NULL_CELL_CHAR="",v.NULL_CELL_WIDTH=1,v.NULL_CELL_CODE=0,v.WHITESPACE_CELL_CHAR=" ",v.WHITESPACE_CELL_WIDTH=1,v.WHITESPACE_CELL_CODE=32},4863:function(N,v,L){var O,D=this&&this.__extends||(O=function(b,T){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,p){f.__proto__=p}||function(f,p){for(var E in p)Object.prototype.hasOwnProperty.call(p,E)&&(f[E]=p[E])},O(b,T)},function(b,T){if(typeof T!="function"&&T!==null)throw new TypeError("Class extends value "+String(T)+" is not a constructor or null");function f(){this.constructor=b}O(b,T),b.prototype=T===null?Object.create(T):(f.prototype=T.prototype,new f)});Object.defineProperty(v,"__esModule",{value:!0}),v.Marker=void 0;var w=L(8460),g=function(b){function T(f){var p=b.call(this)||this;return p.line=f,p._id=T._nextId++,p.isDisposed=!1,p._onDispose=new w.EventEmitter,p}return D(T,b),Object.defineProperty(T.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"onDispose",{get:function(){return this._onDispose.event},enumerable:!1,configurable:!0}),T.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),b.prototype.dispose.call(this))},T._nextId=1,T}(L(844).Disposable);v.Marker=g},7116:(N,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.DEFAULT_CHARSET=v.CHARSETS=void 0,v.CHARSETS={},v.DEFAULT_CHARSET=v.CHARSETS.B,v.CHARSETS[0]={"`":"\u25C6",a:"\u2592",b:"\u2409",c:"\u240C",d:"\u240D",e:"\u240A",f:"\xB0",g:"\xB1",h:"\u2424",i:"\u240B",j:"\u2518",k:"\u2510",l:"\u250C",m:"\u2514",n:"\u253C",o:"\u23BA",p:"\u23BB",q:"\u2500",r:"\u23BC",s:"\u23BD",t:"\u251C",u:"\u2524",v:"\u2534",w:"\u252C",x:"\u2502",y:"\u2264",z:"\u2265","{":"\u03C0","|":"\u2260","}":"\xA3","~":"\xB7"},v.CHARSETS.A={"#":"\xA3"},v.CHARSETS.B=void 0,v.CHARSETS[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"},v.CHARSETS.C=v.CHARSETS[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},v.CHARSETS.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"},v.CHARSETS.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"},v.CHARSETS.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"},v.CHARSETS.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"},v.CHARSETS.E=v.CHARSETS[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"},v.CHARSETS.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"},v.CHARSETS.H=v.CHARSETS[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},v.CHARSETS["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"}},2584:(N,v)=>{var L,O;Object.defineProperty(v,"__esModule",{value:!0}),v.C1=v.C0=void 0,(O=v.C0||(v.C0={})).NUL="\0",O.SOH="",O.STX="",O.ETX="",O.EOT="",O.ENQ="",O.ACK="",O.BEL="\x07",O.BS="\b",O.HT=" ",O.LF=`
|
|
170
|
+
`,O.VT="\v",O.FF="\f",O.CR="\r",O.SO="",O.SI="",O.DLE="",O.DC1="",O.DC2="",O.DC3="",O.DC4="",O.NAK="",O.SYN="",O.ETB="",O.CAN="",O.EM="",O.SUB="",O.ESC="",O.FS="",O.GS="",O.RS="",O.US="",O.SP=" ",O.DEL="\x7F",(L=v.C1||(v.C1={})).PAD="\x80",L.HOP="\x81",L.BPH="\x82",L.NBH="\x83",L.IND="\x84",L.NEL="\x85",L.SSA="\x86",L.ESA="\x87",L.HTS="\x88",L.HTJ="\x89",L.VTS="\x8A",L.PLD="\x8B",L.PLU="\x8C",L.RI="\x8D",L.SS2="\x8E",L.SS3="\x8F",L.DCS="\x90",L.PU1="\x91",L.PU2="\x92",L.STS="\x93",L.CCH="\x94",L.MW="\x95",L.SPA="\x96",L.EPA="\x97",L.SOS="\x98",L.SGCI="\x99",L.SCI="\x9A",L.CSI="\x9B",L.ST="\x9C",L.OSC="\x9D",L.PM="\x9E",L.APC="\x9F"},7399:(N,v,L)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.evaluateKeyboardEvent=void 0;var O=L(2584),D={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};v.evaluateKeyboardEvent=function(w,g,b,T){var f={type:0,cancel:!1,key:void 0},p=(w.shiftKey?1:0)|(w.altKey?2:0)|(w.ctrlKey?4:0)|(w.metaKey?8:0);switch(w.keyCode){case 0:w.key==="UIKeyInputUpArrow"?f.key=g?O.C0.ESC+"OA":O.C0.ESC+"[A":w.key==="UIKeyInputLeftArrow"?f.key=g?O.C0.ESC+"OD":O.C0.ESC+"[D":w.key==="UIKeyInputRightArrow"?f.key=g?O.C0.ESC+"OC":O.C0.ESC+"[C":w.key==="UIKeyInputDownArrow"&&(f.key=g?O.C0.ESC+"OB":O.C0.ESC+"[B");break;case 8:if(w.shiftKey){f.key=O.C0.BS;break}if(w.altKey){f.key=O.C0.ESC+O.C0.DEL;break}f.key=O.C0.DEL;break;case 9:if(w.shiftKey){f.key=O.C0.ESC+"[Z";break}f.key=O.C0.HT,f.cancel=!0;break;case 13:f.key=w.altKey?O.C0.ESC+O.C0.CR:O.C0.CR,f.cancel=!0;break;case 27:f.key=O.C0.ESC,w.altKey&&(f.key=O.C0.ESC+O.C0.ESC),f.cancel=!0;break;case 37:if(w.metaKey)break;p?(f.key=O.C0.ESC+"[1;"+(p+1)+"D",f.key===O.C0.ESC+"[1;3D"&&(f.key=O.C0.ESC+(b?"b":"[1;5D"))):f.key=g?O.C0.ESC+"OD":O.C0.ESC+"[D";break;case 39:if(w.metaKey)break;p?(f.key=O.C0.ESC+"[1;"+(p+1)+"C",f.key===O.C0.ESC+"[1;3C"&&(f.key=O.C0.ESC+(b?"f":"[1;5C"))):f.key=g?O.C0.ESC+"OC":O.C0.ESC+"[C";break;case 38:if(w.metaKey)break;p?(f.key=O.C0.ESC+"[1;"+(p+1)+"A",b||f.key!==O.C0.ESC+"[1;3A"||(f.key=O.C0.ESC+"[1;5A")):f.key=g?O.C0.ESC+"OA":O.C0.ESC+"[A";break;case 40:if(w.metaKey)break;p?(f.key=O.C0.ESC+"[1;"+(p+1)+"B",b||f.key!==O.C0.ESC+"[1;3B"||(f.key=O.C0.ESC+"[1;5B")):f.key=g?O.C0.ESC+"OB":O.C0.ESC+"[B";break;case 45:w.shiftKey||w.ctrlKey||(f.key=O.C0.ESC+"[2~");break;case 46:f.key=p?O.C0.ESC+"[3;"+(p+1)+"~":O.C0.ESC+"[3~";break;case 36:f.key=p?O.C0.ESC+"[1;"+(p+1)+"H":g?O.C0.ESC+"OH":O.C0.ESC+"[H";break;case 35:f.key=p?O.C0.ESC+"[1;"+(p+1)+"F":g?O.C0.ESC+"OF":O.C0.ESC+"[F";break;case 33:w.shiftKey?f.type=2:f.key=O.C0.ESC+"[5~";break;case 34:w.shiftKey?f.type=3:f.key=O.C0.ESC+"[6~";break;case 112:f.key=p?O.C0.ESC+"[1;"+(p+1)+"P":O.C0.ESC+"OP";break;case 113:f.key=p?O.C0.ESC+"[1;"+(p+1)+"Q":O.C0.ESC+"OQ";break;case 114:f.key=p?O.C0.ESC+"[1;"+(p+1)+"R":O.C0.ESC+"OR";break;case 115:f.key=p?O.C0.ESC+"[1;"+(p+1)+"S":O.C0.ESC+"OS";break;case 116:f.key=p?O.C0.ESC+"[15;"+(p+1)+"~":O.C0.ESC+"[15~";break;case 117:f.key=p?O.C0.ESC+"[17;"+(p+1)+"~":O.C0.ESC+"[17~";break;case 118:f.key=p?O.C0.ESC+"[18;"+(p+1)+"~":O.C0.ESC+"[18~";break;case 119:f.key=p?O.C0.ESC+"[19;"+(p+1)+"~":O.C0.ESC+"[19~";break;case 120:f.key=p?O.C0.ESC+"[20;"+(p+1)+"~":O.C0.ESC+"[20~";break;case 121:f.key=p?O.C0.ESC+"[21;"+(p+1)+"~":O.C0.ESC+"[21~";break;case 122:f.key=p?O.C0.ESC+"[23;"+(p+1)+"~":O.C0.ESC+"[23~";break;case 123:f.key=p?O.C0.ESC+"[24;"+(p+1)+"~":O.C0.ESC+"[24~";break;default:if(!w.ctrlKey||w.shiftKey||w.altKey||w.metaKey)if(b&&!T||!w.altKey||w.metaKey)!b||w.altKey||w.ctrlKey||w.shiftKey||!w.metaKey?w.key&&!w.ctrlKey&&!w.altKey&&!w.metaKey&&w.keyCode>=48&&w.key.length===1?f.key=w.key:w.key&&w.ctrlKey&&w.key==="_"&&(f.key=O.C0.US):w.keyCode===65&&(f.type=1);else{var E=D[w.keyCode],u=E&&E[w.shiftKey?1:0];if(u)f.key=O.C0.ESC+u;else if(w.keyCode>=65&&w.keyCode<=90){var a=w.ctrlKey?w.keyCode-64:w.keyCode+32;f.key=O.C0.ESC+String.fromCharCode(a)}}else w.keyCode>=65&&w.keyCode<=90?f.key=String.fromCharCode(w.keyCode-64):w.keyCode===32?f.key=O.C0.NUL:w.keyCode>=51&&w.keyCode<=55?f.key=String.fromCharCode(w.keyCode-51+27):w.keyCode===56?f.key=O.C0.DEL:w.keyCode===219?f.key=O.C0.ESC:w.keyCode===220?f.key=O.C0.FS:w.keyCode===221&&(f.key=O.C0.GS)}return f}},482:(N,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.Utf8ToUtf32=v.StringToUtf32=v.utf32ToString=v.stringFromCodePoint=void 0,v.stringFromCodePoint=function(D){return D>65535?(D-=65536,String.fromCharCode(55296+(D>>10))+String.fromCharCode(D%1024+56320)):String.fromCharCode(D)},v.utf32ToString=function(D,w,g){w===void 0&&(w=0),g===void 0&&(g=D.length);for(var b="",T=w;T<g;++T){var f=D[T];f>65535?(f-=65536,b+=String.fromCharCode(55296+(f>>10))+String.fromCharCode(f%1024+56320)):b+=String.fromCharCode(f)}return b};var L=function(){function D(){this._interim=0}return D.prototype.clear=function(){this._interim=0},D.prototype.decode=function(w,g){var b=w.length;if(!b)return 0;var T=0,f=0;this._interim&&(56320<=(u=w.charCodeAt(f++))&&u<=57343?g[T++]=1024*(this._interim-55296)+u-56320+65536:(g[T++]=this._interim,g[T++]=u),this._interim=0);for(var p=f;p<b;++p){var E=w.charCodeAt(p);if(55296<=E&&E<=56319){if(++p>=b)return this._interim=E,T;var u;56320<=(u=w.charCodeAt(p))&&u<=57343?g[T++]=1024*(E-55296)+u-56320+65536:(g[T++]=E,g[T++]=u)}else E!==65279&&(g[T++]=E)}return T},D}();v.StringToUtf32=L;var O=function(){function D(){this.interim=new Uint8Array(3)}return D.prototype.clear=function(){this.interim.fill(0)},D.prototype.decode=function(w,g){var b=w.length;if(!b)return 0;var T,f,p,E,u=0,a=0,n=0;if(this.interim[0]){var s=!1,l=this.interim[0];l&=(224&l)==192?31:(240&l)==224?15:7;for(var d=0,A=void 0;(A=63&this.interim[++d])&&d<4;)l<<=6,l|=A;for(var S=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,R=S-d;n<R;){if(n>=b)return 0;if((192&(A=w[n++]))!=128){n--,s=!0;break}this.interim[d++]=A,l<<=6,l|=63&A}s||(S===2?l<128?n--:g[u++]=l:S===3?l<2048||l>=55296&&l<=57343||l===65279||(g[u++]=l):l<65536||l>1114111||(g[u++]=l)),this.interim.fill(0)}for(var y=b-4,_=n;_<b;){for(;!(!(_<y)||128&(T=w[_])||128&(f=w[_+1])||128&(p=w[_+2])||128&(E=w[_+3]));)g[u++]=T,g[u++]=f,g[u++]=p,g[u++]=E,_+=4;if((T=w[_++])<128)g[u++]=T;else if((224&T)==192){if(_>=b)return this.interim[0]=T,u;if((192&(f=w[_++]))!=128){_--;continue}if((a=(31&T)<<6|63&f)<128){_--;continue}g[u++]=a}else if((240&T)==224){if(_>=b)return this.interim[0]=T,u;if((192&(f=w[_++]))!=128){_--;continue}if(_>=b)return this.interim[0]=T,this.interim[1]=f,u;if((192&(p=w[_++]))!=128){_--;continue}if((a=(15&T)<<12|(63&f)<<6|63&p)<2048||a>=55296&&a<=57343||a===65279)continue;g[u++]=a}else if((248&T)==240){if(_>=b)return this.interim[0]=T,u;if((192&(f=w[_++]))!=128){_--;continue}if(_>=b)return this.interim[0]=T,this.interim[1]=f,u;if((192&(p=w[_++]))!=128){_--;continue}if(_>=b)return this.interim[0]=T,this.interim[1]=f,this.interim[2]=p,u;if((192&(E=w[_++]))!=128){_--;continue}if((a=(7&T)<<18|(63&f)<<12|(63&p)<<6|63&E)<65536||a>1114111)continue;g[u++]=a}}return u},D}();v.Utf8ToUtf32=O},225:(N,v,L)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.UnicodeV6=void 0;var O,D=L(8273),w=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],g=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],b=function(){function T(){if(this.version="6",!O){O=new Uint8Array(65536),(0,D.fill)(O,1),O[0]=0,(0,D.fill)(O,0,1,32),(0,D.fill)(O,0,127,160),(0,D.fill)(O,2,4352,4448),O[9001]=2,O[9002]=2,(0,D.fill)(O,2,11904,42192),O[12351]=1,(0,D.fill)(O,2,44032,55204),(0,D.fill)(O,2,63744,64256),(0,D.fill)(O,2,65040,65050),(0,D.fill)(O,2,65072,65136),(0,D.fill)(O,2,65280,65377),(0,D.fill)(O,2,65504,65511);for(var f=0;f<w.length;++f)(0,D.fill)(O,0,w[f][0],w[f][1]+1)}}return T.prototype.wcwidth=function(f){return f<32?0:f<127?1:f<65536?O[f]:function(p,E){var u,a=0,n=E.length-1;if(p<E[0][0]||p>E[n][1])return!1;for(;n>=a;)if(p>E[u=a+n>>1][1])a=u+1;else{if(!(p<E[u][0]))return!0;n=u-1}return!1}(f,g)?0:f>=131072&&f<=196605||f>=196608&&f<=262141?2:1},T}();v.UnicodeV6=b},5981:(N,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.WriteBuffer=void 0;var L=typeof queueMicrotask=="undefined"?function(D){Promise.resolve().then(D)}:queueMicrotask,O=function(){function D(w){this._action=w,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0}return D.prototype.writeSync=function(w,g){if(g!==void 0&&this._syncCalls>g)this._syncCalls=0;else if(this._pendingData+=w.length,this._writeBuffer.push(w),this._callbacks.push(void 0),this._syncCalls++,!this._isSyncWriting){var b;for(this._isSyncWriting=!0;b=this._writeBuffer.shift();){this._action(b);var T=this._callbacks.shift();T&&T()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}},D.prototype.write=function(w,g){var b=this;if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");this._writeBuffer.length||(this._bufferOffset=0,setTimeout(function(){return b._innerWrite()})),this._pendingData+=w.length,this._writeBuffer.push(w),this._callbacks.push(g)},D.prototype._innerWrite=function(w,g){var b=this;w===void 0&&(w=0),g===void 0&&(g=!0);for(var T=w||Date.now();this._writeBuffer.length>this._bufferOffset;){var f=this._writeBuffer[this._bufferOffset],p=this._action(f,g);if(p)return void p.catch(function(u){return L(function(){throw u}),Promise.resolve(!1)}).then(function(u){return Date.now()-T>=12?setTimeout(function(){return b._innerWrite(0,u)}):b._innerWrite(T,u)});var E=this._callbacks[this._bufferOffset];if(E&&E(),this._bufferOffset++,this._pendingData-=f.length,Date.now()-T>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(function(){return b._innerWrite()})):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0)},D}();v.WriteBuffer=O},5770:(N,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.PAYLOAD_LIMIT=void 0,v.PAYLOAD_LIMIT=1e7},6351:(N,v,L)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.DcsHandler=v.DcsParser=void 0;var O=L(482),D=L(8742),w=L(5770),g=[],b=function(){function p(){this._handlers=Object.create(null),this._active=g,this._ident=0,this._handlerFb=function(){},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}return p.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){},this._active=g},p.prototype.registerHandler=function(E,u){this._handlers[E]===void 0&&(this._handlers[E]=[]);var a=this._handlers[E];return a.push(u),{dispose:function(){var n=a.indexOf(u);n!==-1&&a.splice(n,1)}}},p.prototype.clearHandler=function(E){this._handlers[E]&&delete this._handlers[E]},p.prototype.setHandlerFallback=function(E){this._handlerFb=E},p.prototype.reset=function(){if(this._active.length)for(var E=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;E>=0;--E)this._active[E].unhook(!1);this._stack.paused=!1,this._active=g,this._ident=0},p.prototype.hook=function(E,u){if(this.reset(),this._ident=E,this._active=this._handlers[E]||g,this._active.length)for(var a=this._active.length-1;a>=0;a--)this._active[a].hook(u);else this._handlerFb(this._ident,"HOOK",u)},p.prototype.put=function(E,u,a){if(this._active.length)for(var n=this._active.length-1;n>=0;n--)this._active[n].put(E,u,a);else this._handlerFb(this._ident,"PUT",(0,O.utf32ToString)(E,u,a))},p.prototype.unhook=function(E,u){if(u===void 0&&(u=!0),this._active.length){var a=!1,n=this._active.length-1,s=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,a=u,s=this._stack.fallThrough,this._stack.paused=!1),!s&&a===!1){for(;n>=0&&(a=this._active[n].unhook(E))!==!0;n--)if(a instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,a;n--}for(;n>=0;n--)if((a=this._active[n].unhook(!1))instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,a}else this._handlerFb(this._ident,"UNHOOK",E);this._active=g,this._ident=0},p}();v.DcsParser=b;var T=new D.Params;T.addParam(0);var f=function(){function p(E){this._handler=E,this._data="",this._params=T,this._hitLimit=!1}return p.prototype.hook=function(E){this._params=E.length>1||E.params[0]?E.clone():T,this._data="",this._hitLimit=!1},p.prototype.put=function(E,u,a){this._hitLimit||(this._data+=(0,O.utf32ToString)(E,u,a),this._data.length>w.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},p.prototype.unhook=function(E){var u=this,a=!1;if(this._hitLimit)a=!1;else if(E&&(a=this._handler(this._data,this._params))instanceof Promise)return a.then(function(n){return u._params=T,u._data="",u._hitLimit=!1,n});return this._params=T,this._data="",this._hitLimit=!1,a},p}();v.DcsHandler=f},2015:function(N,v,L){var O,D=this&&this.__extends||(O=function(a,n){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,l){s.__proto__=l}||function(s,l){for(var d in l)Object.prototype.hasOwnProperty.call(l,d)&&(s[d]=l[d])},O(a,n)},function(a,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function s(){this.constructor=a}O(a,n),a.prototype=n===null?Object.create(n):(s.prototype=n.prototype,new s)});Object.defineProperty(v,"__esModule",{value:!0}),v.EscapeSequenceParser=v.VT500_TRANSITION_TABLE=v.TransitionTable=void 0;var w=L(844),g=L(8273),b=L(8742),T=L(6242),f=L(6351),p=function(){function a(n){this.table=new Uint8Array(n)}return a.prototype.setDefault=function(n,s){(0,g.fill)(this.table,n<<4|s)},a.prototype.add=function(n,s,l,d){this.table[s<<8|n]=l<<4|d},a.prototype.addMany=function(n,s,l,d){for(var A=0;A<n.length;A++)this.table[s<<8|n[A]]=l<<4|d},a}();v.TransitionTable=p;var E=160;v.VT500_TRANSITION_TABLE=function(){var a=new p(4095),n=Array.apply(null,Array(256)).map(function(R,y){return y}),s=function(R,y){return n.slice(R,y)},l=s(32,127),d=s(0,24);d.push(25),d.push.apply(d,s(28,32));var A,S=s(0,14);for(A in a.setDefault(1,0),a.addMany(l,0,2,0),S)a.addMany([24,26,153,154],A,3,0),a.addMany(s(128,144),A,3,0),a.addMany(s(144,152),A,3,0),a.add(156,A,0,0),a.add(27,A,11,1),a.add(157,A,4,8),a.addMany([152,158,159],A,0,7),a.add(155,A,11,3),a.add(144,A,11,9);return a.addMany(d,0,3,0),a.addMany(d,1,3,1),a.add(127,1,0,1),a.addMany(d,8,0,8),a.addMany(d,3,3,3),a.add(127,3,0,3),a.addMany(d,4,3,4),a.add(127,4,0,4),a.addMany(d,6,3,6),a.addMany(d,5,3,5),a.add(127,5,0,5),a.addMany(d,2,3,2),a.add(127,2,0,2),a.add(93,1,4,8),a.addMany(l,8,5,8),a.add(127,8,5,8),a.addMany([156,27,24,26,7],8,6,0),a.addMany(s(28,32),8,0,8),a.addMany([88,94,95],1,0,7),a.addMany(l,7,0,7),a.addMany(d,7,0,7),a.add(156,7,0,0),a.add(127,7,0,7),a.add(91,1,11,3),a.addMany(s(64,127),3,7,0),a.addMany(s(48,60),3,8,4),a.addMany([60,61,62,63],3,9,4),a.addMany(s(48,60),4,8,4),a.addMany(s(64,127),4,7,0),a.addMany([60,61,62,63],4,0,6),a.addMany(s(32,64),6,0,6),a.add(127,6,0,6),a.addMany(s(64,127),6,0,0),a.addMany(s(32,48),3,9,5),a.addMany(s(32,48),5,9,5),a.addMany(s(48,64),5,0,6),a.addMany(s(64,127),5,7,0),a.addMany(s(32,48),4,9,5),a.addMany(s(32,48),1,9,2),a.addMany(s(32,48),2,9,2),a.addMany(s(48,127),2,10,0),a.addMany(s(48,80),1,10,0),a.addMany(s(81,88),1,10,0),a.addMany([89,90,92],1,10,0),a.addMany(s(96,127),1,10,0),a.add(80,1,11,9),a.addMany(d,9,0,9),a.add(127,9,0,9),a.addMany(s(28,32),9,0,9),a.addMany(s(32,48),9,9,12),a.addMany(s(48,60),9,8,10),a.addMany([60,61,62,63],9,9,10),a.addMany(d,11,0,11),a.addMany(s(32,128),11,0,11),a.addMany(s(28,32),11,0,11),a.addMany(d,10,0,10),a.add(127,10,0,10),a.addMany(s(28,32),10,0,10),a.addMany(s(48,60),10,8,10),a.addMany([60,61,62,63],10,0,11),a.addMany(s(32,48),10,9,12),a.addMany(d,12,0,12),a.add(127,12,0,12),a.addMany(s(28,32),12,0,12),a.addMany(s(32,48),12,9,12),a.addMany(s(48,64),12,0,11),a.addMany(s(64,127),12,12,13),a.addMany(s(64,127),10,12,13),a.addMany(s(64,127),9,12,13),a.addMany(d,13,13,13),a.addMany(l,13,13,13),a.add(127,13,0,13),a.addMany([27,156,24,26],13,14,0),a.add(E,0,2,0),a.add(E,8,5,8),a.add(E,6,0,6),a.add(E,11,0,11),a.add(E,13,13,13),a}();var u=function(a){function n(s){s===void 0&&(s=v.VT500_TRANSITION_TABLE);var l=a.call(this)||this;return l._transitions=s,l._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},l.initialState=0,l.currentState=l.initialState,l._params=new b.Params,l._params.addParam(0),l._collect=0,l.precedingCodepoint=0,l._printHandlerFb=function(d,A,S){},l._executeHandlerFb=function(d){},l._csiHandlerFb=function(d,A){},l._escHandlerFb=function(d){},l._errorHandlerFb=function(d){return d},l._printHandler=l._printHandlerFb,l._executeHandlers=Object.create(null),l._csiHandlers=Object.create(null),l._escHandlers=Object.create(null),l._oscParser=new T.OscParser,l._dcsParser=new f.DcsParser,l._errorHandler=l._errorHandlerFb,l.registerEscHandler({final:"\\"},function(){return!0}),l}return D(n,a),n.prototype._identifier=function(s,l){l===void 0&&(l=[64,126]);var d=0;if(s.prefix){if(s.prefix.length>1)throw new Error("only one byte as prefix supported");if((d=s.prefix.charCodeAt(0))&&60>d||d>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(s.intermediates){if(s.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(var A=0;A<s.intermediates.length;++A){var S=s.intermediates.charCodeAt(A);if(32>S||S>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");d<<=8,d|=S}}if(s.final.length!==1)throw new Error("final must be a single byte");var R=s.final.charCodeAt(0);if(l[0]>R||R>l[1])throw new Error("final must be in range "+l[0]+" .. "+l[1]);return(d<<=8)|R},n.prototype.identToString=function(s){for(var l=[];s;)l.push(String.fromCharCode(255&s)),s>>=8;return l.reverse().join("")},n.prototype.dispose=function(){this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null),this._oscParser.dispose(),this._dcsParser.dispose()},n.prototype.setPrintHandler=function(s){this._printHandler=s},n.prototype.clearPrintHandler=function(){this._printHandler=this._printHandlerFb},n.prototype.registerEscHandler=function(s,l){var d=this._identifier(s,[48,126]);this._escHandlers[d]===void 0&&(this._escHandlers[d]=[]);var A=this._escHandlers[d];return A.push(l),{dispose:function(){var S=A.indexOf(l);S!==-1&&A.splice(S,1)}}},n.prototype.clearEscHandler=function(s){this._escHandlers[this._identifier(s,[48,126])]&&delete this._escHandlers[this._identifier(s,[48,126])]},n.prototype.setEscHandlerFallback=function(s){this._escHandlerFb=s},n.prototype.setExecuteHandler=function(s,l){this._executeHandlers[s.charCodeAt(0)]=l},n.prototype.clearExecuteHandler=function(s){this._executeHandlers[s.charCodeAt(0)]&&delete this._executeHandlers[s.charCodeAt(0)]},n.prototype.setExecuteHandlerFallback=function(s){this._executeHandlerFb=s},n.prototype.registerCsiHandler=function(s,l){var d=this._identifier(s);this._csiHandlers[d]===void 0&&(this._csiHandlers[d]=[]);var A=this._csiHandlers[d];return A.push(l),{dispose:function(){var S=A.indexOf(l);S!==-1&&A.splice(S,1)}}},n.prototype.clearCsiHandler=function(s){this._csiHandlers[this._identifier(s)]&&delete this._csiHandlers[this._identifier(s)]},n.prototype.setCsiHandlerFallback=function(s){this._csiHandlerFb=s},n.prototype.registerDcsHandler=function(s,l){return this._dcsParser.registerHandler(this._identifier(s),l)},n.prototype.clearDcsHandler=function(s){this._dcsParser.clearHandler(this._identifier(s))},n.prototype.setDcsHandlerFallback=function(s){this._dcsParser.setHandlerFallback(s)},n.prototype.registerOscHandler=function(s,l){return this._oscParser.registerHandler(s,l)},n.prototype.clearOscHandler=function(s){this._oscParser.clearHandler(s)},n.prototype.setOscHandlerFallback=function(s){this._oscParser.setHandlerFallback(s)},n.prototype.setErrorHandler=function(s){this._errorHandler=s},n.prototype.clearErrorHandler=function(){this._errorHandler=this._errorHandlerFb},n.prototype.reset=function(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])},n.prototype._preserveStack=function(s,l,d,A,S){this._parseStack.state=s,this._parseStack.handlers=l,this._parseStack.handlerPos=d,this._parseStack.transition=A,this._parseStack.chunkPos=S},n.prototype.parse=function(s,l,d){var A,S=0,R=0,y=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,y=this._parseStack.chunkPos+1;else{if(d===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");var _=this._parseStack.handlers,m=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(d===!1&&m>-1){for(;m>=0&&(A=_[m](this._params))!==!0;m--)if(A instanceof Promise)return this._parseStack.handlerPos=m,A}this._parseStack.handlers=[];break;case 4:if(d===!1&&m>-1){for(;m>=0&&(A=_[m]())!==!0;m--)if(A instanceof Promise)return this._parseStack.handlerPos=m,A}this._parseStack.handlers=[];break;case 6:if(S=s[this._parseStack.chunkPos],A=this._dcsParser.unhook(S!==24&&S!==26,d))return A;S===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(S=s[this._parseStack.chunkPos],A=this._oscParser.end(S!==24&&S!==26,d))return A;S===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,y=this._parseStack.chunkPos+1,this.precedingCodepoint=0,this.currentState=15&this._parseStack.transition}for(var I=y;I<l;++I){switch(S=s[I],(R=this._transitions.table[this.currentState<<8|(S<160?S:E)])>>4){case 2:for(var B=I+1;;++B){if(B>=l||(S=s[B])<32||S>126&&S<E){this._printHandler(s,I,B),I=B-1;break}if(++B>=l||(S=s[B])<32||S>126&&S<E){this._printHandler(s,I,B),I=B-1;break}if(++B>=l||(S=s[B])<32||S>126&&S<E){this._printHandler(s,I,B),I=B-1;break}if(++B>=l||(S=s[B])<32||S>126&&S<E){this._printHandler(s,I,B),I=B-1;break}}break;case 3:this._executeHandlers[S]?this._executeHandlers[S]():this._executeHandlerFb(S),this.precedingCodepoint=0;break;case 0:break;case 1:if(this._errorHandler({position:I,code:S,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:for(var P=(_=this._csiHandlers[this._collect<<8|S])?_.length-1:-1;P>=0&&(A=_[P](this._params))!==!0;P--)if(A instanceof Promise)return this._preserveStack(3,_,P,R,I),A;P<0&&this._csiHandlerFb(this._collect<<8|S,this._params),this.precedingCodepoint=0;break;case 8:do switch(S){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(S-48)}while(++I<l&&(S=s[I])>47&&S<60);I--;break;case 9:this._collect<<=8,this._collect|=S;break;case 10:for(var M=this._escHandlers[this._collect<<8|S],U=M?M.length-1:-1;U>=0&&(A=M[U]())!==!0;U--)if(A instanceof Promise)return this._preserveStack(4,M,U,R,I),A;U<0&&this._escHandlerFb(this._collect<<8|S),this.precedingCodepoint=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|S,this._params);break;case 13:for(var K=I+1;;++K)if(K>=l||(S=s[K])===24||S===26||S===27||S>127&&S<E){this._dcsParser.put(s,I,K),I=K-1;break}break;case 14:if(A=this._dcsParser.unhook(S!==24&&S!==26))return this._preserveStack(6,[],0,R,I),A;S===27&&(R|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0;break;case 4:this._oscParser.start();break;case 5:for(var W=I+1;;W++)if(W>=l||(S=s[W])<32||S>127&&S<E){this._oscParser.put(s,I,W),I=W-1;break}break;case 6:if(A=this._oscParser.end(S!==24&&S!==26))return this._preserveStack(5,[],0,R,I),A;S===27&&(R|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0}this.currentState=15&R}},n}(w.Disposable);v.EscapeSequenceParser=u},6242:(N,v,L)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.OscHandler=v.OscParser=void 0;var O=L(5770),D=L(482),w=[],g=function(){function T(){this._state=0,this._active=w,this._id=-1,this._handlers=Object.create(null),this._handlerFb=function(){},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}return T.prototype.registerHandler=function(f,p){this._handlers[f]===void 0&&(this._handlers[f]=[]);var E=this._handlers[f];return E.push(p),{dispose:function(){var u=E.indexOf(p);u!==-1&&E.splice(u,1)}}},T.prototype.clearHandler=function(f){this._handlers[f]&&delete this._handlers[f]},T.prototype.setHandlerFallback=function(f){this._handlerFb=f},T.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){},this._active=w},T.prototype.reset=function(){if(this._state===2)for(var f=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;f>=0;--f)this._active[f].end(!1);this._stack.paused=!1,this._active=w,this._id=-1,this._state=0},T.prototype._start=function(){if(this._active=this._handlers[this._id]||w,this._active.length)for(var f=this._active.length-1;f>=0;f--)this._active[f].start();else this._handlerFb(this._id,"START")},T.prototype._put=function(f,p,E){if(this._active.length)for(var u=this._active.length-1;u>=0;u--)this._active[u].put(f,p,E);else this._handlerFb(this._id,"PUT",(0,D.utf32ToString)(f,p,E))},T.prototype.start=function(){this.reset(),this._state=1},T.prototype.put=function(f,p,E){if(this._state!==3){if(this._state===1)for(;p<E;){var u=f[p++];if(u===59){this._state=2,this._start();break}if(u<48||57<u)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+u-48}this._state===2&&E-p>0&&this._put(f,p,E)}},T.prototype.end=function(f,p){if(p===void 0&&(p=!0),this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){var E=!1,u=this._active.length-1,a=!1;if(this._stack.paused&&(u=this._stack.loopPosition-1,E=p,a=this._stack.fallThrough,this._stack.paused=!1),!a&&E===!1){for(;u>=0&&(E=this._active[u].end(f))!==!0;u--)if(E instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!1,E;u--}for(;u>=0;u--)if((E=this._active[u].end(!1))instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!0,E}else this._handlerFb(this._id,"END",f);this._active=w,this._id=-1,this._state=0}},T}();v.OscParser=g;var b=function(){function T(f){this._handler=f,this._data="",this._hitLimit=!1}return T.prototype.start=function(){this._data="",this._hitLimit=!1},T.prototype.put=function(f,p,E){this._hitLimit||(this._data+=(0,D.utf32ToString)(f,p,E),this._data.length>O.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},T.prototype.end=function(f){var p=this,E=!1;if(this._hitLimit)E=!1;else if(f&&(E=this._handler(this._data))instanceof Promise)return E.then(function(u){return p._data="",p._hitLimit=!1,u});return this._data="",this._hitLimit=!1,E},T}();v.OscHandler=b},8742:(N,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.Params=void 0;var L=2147483647,O=function(){function D(w,g){if(w===void 0&&(w=32),g===void 0&&(g=32),this.maxLength=w,this.maxSubParamsLength=g,g>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(w),this.length=0,this._subParams=new Int32Array(g),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(w),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}return D.fromArray=function(w){var g=new D;if(!w.length)return g;for(var b=w[0]instanceof Array?1:0;b<w.length;++b){var T=w[b];if(T instanceof Array)for(var f=0;f<T.length;++f)g.addSubParam(T[f]);else g.addParam(T)}return g},D.prototype.clone=function(){var w=new D(this.maxLength,this.maxSubParamsLength);return w.params.set(this.params),w.length=this.length,w._subParams.set(this._subParams),w._subParamsLength=this._subParamsLength,w._subParamsIdx.set(this._subParamsIdx),w._rejectDigits=this._rejectDigits,w._rejectSubDigits=this._rejectSubDigits,w._digitIsSub=this._digitIsSub,w},D.prototype.toArray=function(){for(var w=[],g=0;g<this.length;++g){w.push(this.params[g]);var b=this._subParamsIdx[g]>>8,T=255&this._subParamsIdx[g];T-b>0&&w.push(Array.prototype.slice.call(this._subParams,b,T))}return w},D.prototype.reset=function(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1},D.prototype.addParam=function(w){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(w<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=w>L?L:w}},D.prototype.addSubParam=function(w){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(w<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=w>L?L:w,this._subParamsIdx[this.length-1]++}},D.prototype.hasSubParams=function(w){return(255&this._subParamsIdx[w])-(this._subParamsIdx[w]>>8)>0},D.prototype.getSubParams=function(w){var g=this._subParamsIdx[w]>>8,b=255&this._subParamsIdx[w];return b-g>0?this._subParams.subarray(g,b):null},D.prototype.getSubParamsAll=function(){for(var w={},g=0;g<this.length;++g){var b=this._subParamsIdx[g]>>8,T=255&this._subParamsIdx[g];T-b>0&&(w[g]=this._subParams.slice(b,T))}return w},D.prototype.addDigit=function(w){var g;if(!(this._rejectDigits||!(g=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)){var b=this._digitIsSub?this._subParams:this.params,T=b[g-1];b[g-1]=~T?Math.min(10*T+w,L):w}},D}();v.Params=O},5741:(N,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.AddonManager=void 0;var L=function(){function O(){this._addons=[]}return O.prototype.dispose=function(){for(var D=this._addons.length-1;D>=0;D--)this._addons[D].instance.dispose()},O.prototype.loadAddon=function(D,w){var g=this,b={instance:w,dispose:w.dispose,isDisposed:!1};this._addons.push(b),w.dispose=function(){return g._wrappedAddonDispose(b)},w.activate(D)},O.prototype._wrappedAddonDispose=function(D){if(!D.isDisposed){for(var w=-1,g=0;g<this._addons.length;g++)if(this._addons[g]===D){w=g;break}if(w===-1)throw new Error("Could not dispose an addon that has not been loaded");D.isDisposed=!0,D.dispose.apply(D.instance),this._addons.splice(w,1)}},O}();v.AddonManager=L},8771:(N,v,L)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.BufferApiView=void 0;var O=L(3785),D=L(511),w=function(){function g(b,T){this._buffer=b,this.type=T}return g.prototype.init=function(b){return this._buffer=b,this},Object.defineProperty(g.prototype,"cursorY",{get:function(){return this._buffer.y},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"cursorX",{get:function(){return this._buffer.x},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"viewportY",{get:function(){return this._buffer.ydisp},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"baseY",{get:function(){return this._buffer.ybase},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"length",{get:function(){return this._buffer.lines.length},enumerable:!1,configurable:!0}),g.prototype.getLine=function(b){var T=this._buffer.lines.get(b);if(T)return new O.BufferLineApiView(T)},g.prototype.getNullCell=function(){return new D.CellData},g}();v.BufferApiView=w},3785:(N,v,L)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.BufferLineApiView=void 0;var O=L(511),D=function(){function w(g){this._line=g}return Object.defineProperty(w.prototype,"isWrapped",{get:function(){return this._line.isWrapped},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"length",{get:function(){return this._line.length},enumerable:!1,configurable:!0}),w.prototype.getCell=function(g,b){if(!(g<0||g>=this._line.length))return b?(this._line.loadCell(g,b),b):this._line.loadCell(g,new O.CellData)},w.prototype.translateToString=function(g,b,T){return this._line.translateToString(g,b,T)},w}();v.BufferLineApiView=D},8285:(N,v,L)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.BufferNamespaceApi=void 0;var O=L(8771),D=L(8460),w=function(){function g(b){var T=this;this._core=b,this._onBufferChange=new D.EventEmitter,this._normal=new O.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new O.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(function(){return T._onBufferChange.fire(T.active)})}return Object.defineProperty(g.prototype,"onBufferChange",{get:function(){return this._onBufferChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"active",{get:function(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"normal",{get:function(){return this._normal.init(this._core.buffers.normal)},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"alternate",{get:function(){return this._alternate.init(this._core.buffers.alt)},enumerable:!1,configurable:!0}),g}();v.BufferNamespaceApi=w},7975:(N,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.ParserApi=void 0;var L=function(){function O(D){this._core=D}return O.prototype.registerCsiHandler=function(D,w){return this._core.registerCsiHandler(D,function(g){return w(g.toArray())})},O.prototype.addCsiHandler=function(D,w){return this.registerCsiHandler(D,w)},O.prototype.registerDcsHandler=function(D,w){return this._core.registerDcsHandler(D,function(g,b){return w(g,b.toArray())})},O.prototype.addDcsHandler=function(D,w){return this.registerDcsHandler(D,w)},O.prototype.registerEscHandler=function(D,w){return this._core.registerEscHandler(D,w)},O.prototype.addEscHandler=function(D,w){return this.registerEscHandler(D,w)},O.prototype.registerOscHandler=function(D,w){return this._core.registerOscHandler(D,w)},O.prototype.addOscHandler=function(D,w){return this.registerOscHandler(D,w)},O}();v.ParserApi=L},7090:(N,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.UnicodeApi=void 0;var L=function(){function O(D){this._core=D}return O.prototype.register=function(D){this._core.unicodeService.register(D)},Object.defineProperty(O.prototype,"versions",{get:function(){return this._core.unicodeService.versions},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"activeVersion",{get:function(){return this._core.unicodeService.activeVersion},set:function(D){this._core.unicodeService.activeVersion=D},enumerable:!1,configurable:!0}),O}();v.UnicodeApi=L},744:function(N,v,L){var O,D=this&&this.__extends||(O=function(u,a){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var l in s)Object.prototype.hasOwnProperty.call(s,l)&&(n[l]=s[l])},O(u,a)},function(u,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");function n(){this.constructor=u}O(u,a),u.prototype=a===null?Object.create(a):(n.prototype=a.prototype,new n)}),w=this&&this.__decorate||function(u,a,n,s){var l,d=arguments.length,A=d<3?a:s===null?s=Object.getOwnPropertyDescriptor(a,n):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(u,a,n,s);else for(var S=u.length-1;S>=0;S--)(l=u[S])&&(A=(d<3?l(A):d>3?l(a,n,A):l(a,n))||A);return d>3&&A&&Object.defineProperty(a,n,A),A},g=this&&this.__param||function(u,a){return function(n,s){a(n,s,u)}};Object.defineProperty(v,"__esModule",{value:!0}),v.BufferService=v.MINIMUM_ROWS=v.MINIMUM_COLS=void 0;var b=L(2585),T=L(5295),f=L(8460),p=L(844);v.MINIMUM_COLS=2,v.MINIMUM_ROWS=1;var E=function(u){function a(n){var s=u.call(this)||this;return s._optionsService=n,s.isUserScrolling=!1,s._onResize=new f.EventEmitter,s._onScroll=new f.EventEmitter,s.cols=Math.max(n.options.cols||0,v.MINIMUM_COLS),s.rows=Math.max(n.options.rows||0,v.MINIMUM_ROWS),s.buffers=new T.BufferSet(n,s),s}return D(a,u),Object.defineProperty(a.prototype,"onResize",{get:function(){return this._onResize.event},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"onScroll",{get:function(){return this._onScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!1,configurable:!0}),a.prototype.dispose=function(){u.prototype.dispose.call(this),this.buffers.dispose()},a.prototype.resize=function(n,s){this.cols=n,this.rows=s,this.buffers.resize(n,s),this.buffers.setupTabStops(this.cols),this._onResize.fire({cols:n,rows:s})},a.prototype.reset=function(){this.buffers.reset(),this.isUserScrolling=!1},a.prototype.scroll=function(n,s){s===void 0&&(s=!1);var l,d=this.buffer;(l=this._cachedBlankLine)&&l.length===this.cols&&l.getFg(0)===n.fg&&l.getBg(0)===n.bg||(l=d.getBlankLine(n,s),this._cachedBlankLine=l),l.isWrapped=s;var A=d.ybase+d.scrollTop,S=d.ybase+d.scrollBottom;if(d.scrollTop===0){var R=d.lines.isFull;S===d.lines.length-1?R?d.lines.recycle().copyFrom(l):d.lines.push(l.clone()):d.lines.splice(S+1,0,l.clone()),R?this.isUserScrolling&&(d.ydisp=Math.max(d.ydisp-1,0)):(d.ybase++,this.isUserScrolling||d.ydisp++)}else{var y=S-A+1;d.lines.shiftElements(A+1,y-1,-1),d.lines.set(S,l.clone())}this.isUserScrolling||(d.ydisp=d.ybase),this._onScroll.fire(d.ydisp)},a.prototype.scrollLines=function(n,s,l){var d=this.buffer;if(n<0){if(d.ydisp===0)return;this.isUserScrolling=!0}else n+d.ydisp>=d.ybase&&(this.isUserScrolling=!1);var A=d.ydisp;d.ydisp=Math.max(Math.min(d.ydisp+n,d.ybase),0),A!==d.ydisp&&(s||this._onScroll.fire(d.ydisp))},a.prototype.scrollPages=function(n){this.scrollLines(n*(this.rows-1))},a.prototype.scrollToTop=function(){this.scrollLines(-this.buffer.ydisp)},a.prototype.scrollToBottom=function(){this.scrollLines(this.buffer.ybase-this.buffer.ydisp)},a.prototype.scrollToLine=function(n){var s=n-this.buffer.ydisp;s!==0&&this.scrollLines(s)},w([g(0,b.IOptionsService)],a)}(p.Disposable);v.BufferService=E},7994:(N,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.CharsetService=void 0;var L=function(){function O(){this.glevel=0,this._charsets=[]}return O.prototype.reset=function(){this.charset=void 0,this._charsets=[],this.glevel=0},O.prototype.setgLevel=function(D){this.glevel=D,this.charset=this._charsets[D]},O.prototype.setgCharset=function(D,w){this._charsets[D]=w,this.glevel===D&&(this.charset=w)},O}();v.CharsetService=L},1753:function(N,v,L){var O=this&&this.__decorate||function(u,a,n,s){var l,d=arguments.length,A=d<3?a:s===null?s=Object.getOwnPropertyDescriptor(a,n):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(u,a,n,s);else for(var S=u.length-1;S>=0;S--)(l=u[S])&&(A=(d<3?l(A):d>3?l(a,n,A):l(a,n))||A);return d>3&&A&&Object.defineProperty(a,n,A),A},D=this&&this.__param||function(u,a){return function(n,s){a(n,s,u)}};Object.defineProperty(v,"__esModule",{value:!0}),v.CoreMouseService=void 0;var w=L(2585),g=L(8460),b={NONE:{events:0,restrict:function(){return!1}},X10:{events:1,restrict:function(u){return u.button!==4&&u.action===1&&(u.ctrl=!1,u.alt=!1,u.shift=!1,!0)}},VT200:{events:19,restrict:function(u){return u.action!==32}},DRAG:{events:23,restrict:function(u){return u.action!==32||u.button!==3}},ANY:{events:31,restrict:function(u){return!0}}};function T(u,a){var n=(u.ctrl?16:0)|(u.shift?4:0)|(u.alt?8:0);return u.button===4?(n|=64,n|=u.action):(n|=3&u.button,4&u.button&&(n|=64),8&u.button&&(n|=128),u.action===32?n|=32:u.action!==0||a||(n|=3)),n}var f=String.fromCharCode,p={DEFAULT:function(u){var a=[T(u,!1)+32,u.col+32,u.row+32];return a[0]>255||a[1]>255||a[2]>255?"":"[M"+f(a[0])+f(a[1])+f(a[2])},SGR:function(u){var a=u.action===0&&u.button!==4?"m":"M";return"[<"+T(u,!0)+";"+u.col+";"+u.row+a}},E=function(){function u(a,n){this._bufferService=a,this._coreService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._onProtocolChange=new g.EventEmitter,this._lastEvent=null;for(var s=0,l=Object.keys(b);s<l.length;s++){var d=l[s];this.addProtocol(d,b[d])}for(var A=0,S=Object.keys(p);A<S.length;A++){var R=S[A];this.addEncoding(R,p[R])}this.reset()}return u.prototype.addProtocol=function(a,n){this._protocols[a]=n},u.prototype.addEncoding=function(a,n){this._encodings[a]=n},Object.defineProperty(u.prototype,"activeProtocol",{get:function(){return this._activeProtocol},set:function(a){if(!this._protocols[a])throw new Error('unknown protocol "'+a+'"');this._activeProtocol=a,this._onProtocolChange.fire(this._protocols[a].events)},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"areMouseEventsActive",{get:function(){return this._protocols[this._activeProtocol].events!==0},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"activeEncoding",{get:function(){return this._activeEncoding},set:function(a){if(!this._encodings[a])throw new Error('unknown encoding "'+a+'"');this._activeEncoding=a},enumerable:!1,configurable:!0}),u.prototype.reset=function(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null},Object.defineProperty(u.prototype,"onProtocolChange",{get:function(){return this._onProtocolChange.event},enumerable:!1,configurable:!0}),u.prototype.triggerMouseEvent=function(a){if(a.col<0||a.col>=this._bufferService.cols||a.row<0||a.row>=this._bufferService.rows||a.button===4&&a.action===32||a.button===3&&a.action!==32||a.button!==4&&(a.action===2||a.action===3)||(a.col++,a.row++,a.action===32&&this._lastEvent&&this._compareEvents(this._lastEvent,a))||!this._protocols[this._activeProtocol].restrict(a))return!1;var n=this._encodings[this._activeEncoding](a);return n&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(n):this._coreService.triggerDataEvent(n,!0)),this._lastEvent=a,!0},u.prototype.explainEvents=function(a){return{down:!!(1&a),up:!!(2&a),drag:!!(4&a),move:!!(8&a),wheel:!!(16&a)}},u.prototype._compareEvents=function(a,n){return a.col===n.col&&a.row===n.row&&a.button===n.button&&a.action===n.action&&a.ctrl===n.ctrl&&a.alt===n.alt&&a.shift===n.shift},O([D(0,w.IBufferService),D(1,w.ICoreService)],u)}();v.CoreMouseService=E},6975:function(N,v,L){var O,D=this&&this.__extends||(O=function(n,s){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,d){l.__proto__=d}||function(l,d){for(var A in d)Object.prototype.hasOwnProperty.call(d,A)&&(l[A]=d[A])},O(n,s)},function(n,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");function l(){this.constructor=n}O(n,s),n.prototype=s===null?Object.create(s):(l.prototype=s.prototype,new l)}),w=this&&this.__decorate||function(n,s,l,d){var A,S=arguments.length,R=S<3?s:d===null?d=Object.getOwnPropertyDescriptor(s,l):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(n,s,l,d);else for(var y=n.length-1;y>=0;y--)(A=n[y])&&(R=(S<3?A(R):S>3?A(s,l,R):A(s,l))||R);return S>3&&R&&Object.defineProperty(s,l,R),R},g=this&&this.__param||function(n,s){return function(l,d){s(l,d,n)}};Object.defineProperty(v,"__esModule",{value:!0}),v.CoreService=void 0;var b=L(2585),T=L(8460),f=L(1439),p=L(844),E=Object.freeze({insertMode:!1}),u=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),a=function(n){function s(l,d,A,S){var R=n.call(this)||this;return R._bufferService=d,R._logService=A,R._optionsService=S,R.isCursorInitialized=!1,R.isCursorHidden=!1,R._onData=R.register(new T.EventEmitter),R._onUserInput=R.register(new T.EventEmitter),R._onBinary=R.register(new T.EventEmitter),R._scrollToBottom=l,R.register({dispose:function(){return R._scrollToBottom=void 0}}),R.modes=(0,f.clone)(E),R.decPrivateModes=(0,f.clone)(u),R}return D(s,n),Object.defineProperty(s.prototype,"onData",{get:function(){return this._onData.event},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"onUserInput",{get:function(){return this._onUserInput.event},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!1,configurable:!0}),s.prototype.reset=function(){this.modes=(0,f.clone)(E),this.decPrivateModes=(0,f.clone)(u)},s.prototype.triggerDataEvent=function(l,d){if(d===void 0&&(d=!1),!this._optionsService.options.disableStdin){var A=this._bufferService.buffer;A.ybase!==A.ydisp&&this._scrollToBottom(),d&&this._onUserInput.fire(),this._logService.debug('sending data "'+l+'"',function(){return l.split("").map(function(S){return S.charCodeAt(0)})}),this._onData.fire(l)}},s.prototype.triggerBinaryEvent=function(l){this._optionsService.options.disableStdin||(this._logService.debug('sending binary "'+l+'"',function(){return l.split("").map(function(d){return d.charCodeAt(0)})}),this._onBinary.fire(l))},w([g(1,b.IBufferService),g(2,b.ILogService),g(3,b.IOptionsService)],s)}(p.Disposable);v.CoreService=a},3730:function(N,v,L){var O=this&&this.__decorate||function(b,T,f,p){var E,u=arguments.length,a=u<3?T:p===null?p=Object.getOwnPropertyDescriptor(T,f):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(b,T,f,p);else for(var n=b.length-1;n>=0;n--)(E=b[n])&&(a=(u<3?E(a):u>3?E(T,f,a):E(T,f))||a);return u>3&&a&&Object.defineProperty(T,f,a),a},D=this&&this.__param||function(b,T){return function(f,p){T(f,p,b)}};Object.defineProperty(v,"__esModule",{value:!0}),v.DirtyRowService=void 0;var w=L(2585),g=function(){function b(T){this._bufferService=T,this.clearRange()}return Object.defineProperty(b.prototype,"start",{get:function(){return this._start},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"end",{get:function(){return this._end},enumerable:!1,configurable:!0}),b.prototype.clearRange=function(){this._start=this._bufferService.buffer.y,this._end=this._bufferService.buffer.y},b.prototype.markDirty=function(T){T<this._start?this._start=T:T>this._end&&(this._end=T)},b.prototype.markRangeDirty=function(T,f){if(T>f){var p=T;T=f,f=p}T<this._start&&(this._start=T),f>this._end&&(this._end=f)},b.prototype.markAllDirty=function(){this.markRangeDirty(0,this._bufferService.rows-1)},O([D(0,w.IBufferService)],b)}();v.DirtyRowService=g},4348:function(N,v,L){var O=this&&this.__spreadArray||function(T,f,p){if(p||arguments.length===2)for(var E,u=0,a=f.length;u<a;u++)!E&&u in f||(E||(E=Array.prototype.slice.call(f,0,u)),E[u]=f[u]);return T.concat(E||Array.prototype.slice.call(f))};Object.defineProperty(v,"__esModule",{value:!0}),v.InstantiationService=v.ServiceCollection=void 0;var D=L(2585),w=L(8343),g=function(){function T(){for(var f=[],p=0;p<arguments.length;p++)f[p]=arguments[p];this._entries=new Map;for(var E=0,u=f;E<u.length;E++){var a=u[E],n=a[0],s=a[1];this.set(n,s)}}return T.prototype.set=function(f,p){var E=this._entries.get(f);return this._entries.set(f,p),E},T.prototype.forEach=function(f){this._entries.forEach(function(p,E){return f(E,p)})},T.prototype.has=function(f){return this._entries.has(f)},T.prototype.get=function(f){return this._entries.get(f)},T}();v.ServiceCollection=g;var b=function(){function T(){this._services=new g,this._services.set(D.IInstantiationService,this)}return T.prototype.setService=function(f,p){this._services.set(f,p)},T.prototype.getService=function(f){return this._services.get(f)},T.prototype.createInstance=function(f){for(var p=[],E=1;E<arguments.length;E++)p[E-1]=arguments[E];for(var u=(0,w.getServiceDependencies)(f).sort(function(S,R){return S.index-R.index}),a=[],n=0,s=u;n<s.length;n++){var l=s[n],d=this._services.get(l.id);if(!d)throw new Error("[createInstance] "+f.name+" depends on UNKNOWN service "+l.id+".");a.push(d)}var A=u.length>0?u[0].index:p.length;if(p.length!==A)throw new Error("[createInstance] First service dependency of "+f.name+" at position "+(A+1)+" conflicts with "+p.length+" static arguments");return new(f.bind.apply(f,O([void 0],O(O([],p,!0),a,!0),!1)))},T}();v.InstantiationService=b},7866:function(N,v,L){var O=this&&this.__decorate||function(f,p,E,u){var a,n=arguments.length,s=n<3?p:u===null?u=Object.getOwnPropertyDescriptor(p,E):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(f,p,E,u);else for(var l=f.length-1;l>=0;l--)(a=f[l])&&(s=(n<3?a(s):n>3?a(p,E,s):a(p,E))||s);return n>3&&s&&Object.defineProperty(p,E,s),s},D=this&&this.__param||function(f,p){return function(E,u){p(E,u,f)}},w=this&&this.__spreadArray||function(f,p,E){if(E||arguments.length===2)for(var u,a=0,n=p.length;a<n;a++)!u&&a in p||(u||(u=Array.prototype.slice.call(p,0,a)),u[a]=p[a]);return f.concat(u||Array.prototype.slice.call(p))};Object.defineProperty(v,"__esModule",{value:!0}),v.LogService=void 0;var g=L(2585),b={debug:g.LogLevelEnum.DEBUG,info:g.LogLevelEnum.INFO,warn:g.LogLevelEnum.WARN,error:g.LogLevelEnum.ERROR,off:g.LogLevelEnum.OFF},T=function(){function f(p){var E=this;this._optionsService=p,this.logLevel=g.LogLevelEnum.OFF,this._updateLogLevel(),this._optionsService.onOptionChange(function(u){u==="logLevel"&&E._updateLogLevel()})}return f.prototype._updateLogLevel=function(){this.logLevel=b[this._optionsService.options.logLevel]},f.prototype._evalLazyOptionalParams=function(p){for(var E=0;E<p.length;E++)typeof p[E]=="function"&&(p[E]=p[E]())},f.prototype._log=function(p,E,u){this._evalLazyOptionalParams(u),p.call.apply(p,w([console,"xterm.js: "+E],u,!1))},f.prototype.debug=function(p){for(var E=[],u=1;u<arguments.length;u++)E[u-1]=arguments[u];this.logLevel<=g.LogLevelEnum.DEBUG&&this._log(console.log,p,E)},f.prototype.info=function(p){for(var E=[],u=1;u<arguments.length;u++)E[u-1]=arguments[u];this.logLevel<=g.LogLevelEnum.INFO&&this._log(console.info,p,E)},f.prototype.warn=function(p){for(var E=[],u=1;u<arguments.length;u++)E[u-1]=arguments[u];this.logLevel<=g.LogLevelEnum.WARN&&this._log(console.warn,p,E)},f.prototype.error=function(p){for(var E=[],u=1;u<arguments.length;u++)E[u-1]=arguments[u];this.logLevel<=g.LogLevelEnum.ERROR&&this._log(console.error,p,E)},O([D(0,g.IOptionsService)],f)}();v.LogService=T},7302:function(N,v,L){var O=this&&this.__assign||function(){return O=Object.assign||function(f){for(var p,E=1,u=arguments.length;E<u;E++)for(var a in p=arguments[E])Object.prototype.hasOwnProperty.call(p,a)&&(f[a]=p[a]);return f},O.apply(this,arguments)};Object.defineProperty(v,"__esModule",{value:!0}),v.OptionsService=v.DEFAULT_OPTIONS=v.DEFAULT_BELL_SOUND=void 0;var D=L(8460),w=L(6114);v.DEFAULT_BELL_SOUND="data:audio/mp3;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjMyLjEwNAAAAAAAAAAAAAAA//tQxAADB8AhSmxhIIEVCSiJrDCQBTcu3UrAIwUdkRgQbFAZC1CQEwTJ9mjRvBA4UOLD8nKVOWfh+UlK3z/177OXrfOdKl7pyn3Xf//WreyTRUoAWgBgkOAGbZHBgG1OF6zM82DWbZaUmMBptgQhGjsyYqc9ae9XFz280948NMBWInljyzsNRFLPWdnZGWrddDsjK1unuSrVN9jJsK8KuQtQCtMBjCEtImISdNKJOopIpBFpNSMbIHCSRpRR5iakjTiyzLhchUUBwCgyKiweBv/7UsQbg8isVNoMPMjAAAA0gAAABEVFGmgqK////9bP/6XCykxBTUUzLjEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq",v.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,customGlyphs:!0,bellSound:v.DEFAULT_BELL_SOUND,bellStyle:"none",drawBoldTextInBrightColors:!0,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",lineHeight:1,linkTooltipHoverDuration:500,letterSpacing:0,logLevel:"info",scrollback:1e3,scrollSensitivity:1,screenReaderMode:!1,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!0,allowTransparency:!1,tabStopWidth:8,theme:{},rightClickSelectsWord:w.isMac,rendererType:"canvas",windowOptions:{},windowsMode:!1,wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1};var g=["normal","bold","100","200","300","400","500","600","700","800","900"],b=["cols","rows"],T=function(){function f(p){for(var E in this._onOptionChange=new D.EventEmitter,this._options=O({},v.DEFAULT_OPTIONS),p)if(E in this._options)try{var u=p[E];this._options[E]=this._sanitizeAndValidateOption(E,u)}catch(a){console.error(a)}this.options=this._setupOptions(this._options,!1),this.publicOptions=this._setupOptions(this._options,!0)}return Object.defineProperty(f.prototype,"onOptionChange",{get:function(){return this._onOptionChange.event},enumerable:!1,configurable:!0}),f.prototype._setupOptions=function(p,E){var u=this,a=O({},p),n=function(l){Object.defineProperty(a,l,{get:function(){if(!(l in v.DEFAULT_OPTIONS))throw new Error('No option with key "'+l+'"');return u._options[l]},set:function(d){if(!(l in v.DEFAULT_OPTIONS))throw new Error('No option with key "'+l+'"');if(E&&b.includes(l))throw new Error('Option "'+l+'" can only be set in the constructor');d=u._sanitizeAndValidateOption(l,d),u._options[l]!==d&&(u._options[l]=d,u._onOptionChange.fire(l))}})};for(var s in a)n(s);return a},f.prototype.setOption=function(p,E){this.publicOptions[p]=E},f.prototype._sanitizeAndValidateOption=function(p,E){switch(p){case"bellStyle":case"cursorStyle":case"rendererType":case"wordSeparator":E||(E=v.DEFAULT_OPTIONS[p]);break;case"fontWeight":case"fontWeightBold":if(typeof E=="number"&&1<=E&&E<=1e3)break;E=g.includes(E)?E:v.DEFAULT_OPTIONS[p];break;case"cursorWidth":E=Math.floor(E);case"lineHeight":case"tabStopWidth":if(E<1)throw new Error(p+" cannot be less than 1, value: "+E);break;case"minimumContrastRatio":E=Math.max(1,Math.min(21,Math.round(10*E)/10));break;case"scrollback":if((E=Math.min(E,4294967295))<0)throw new Error(p+" cannot be less than 0, value: "+E);break;case"fastScrollSensitivity":case"scrollSensitivity":if(E<=0)throw new Error(p+" cannot be less than or equal to 0, value: "+E);case"rows":case"cols":if(!E&&E!==0)throw new Error(p+" must be numeric, value: "+E)}return E},f.prototype.getOption=function(p){return this.publicOptions[p]},f}();v.OptionsService=T},8343:(N,v)=>{function L(O,D,w){D.di$target===D?D.di$dependencies.push({id:O,index:w}):(D.di$dependencies=[{id:O,index:w}],D.di$target=D)}Object.defineProperty(v,"__esModule",{value:!0}),v.createDecorator=v.getServiceDependencies=v.serviceRegistry=void 0,v.serviceRegistry=new Map,v.getServiceDependencies=function(O){return O.di$dependencies||[]},v.createDecorator=function(O){if(v.serviceRegistry.has(O))return v.serviceRegistry.get(O);var D=function(w,g,b){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");L(D,w,b)};return D.toString=function(){return O},v.serviceRegistry.set(O,D),D}},2585:(N,v,L)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.IUnicodeService=v.LogLevelEnum=v.IOptionsService=v.ILogService=v.IInstantiationService=v.IDirtyRowService=v.ICharsetService=v.ICoreService=v.ICoreMouseService=v.IBufferService=void 0;var O,D=L(8343);v.IBufferService=(0,D.createDecorator)("BufferService"),v.ICoreMouseService=(0,D.createDecorator)("CoreMouseService"),v.ICoreService=(0,D.createDecorator)("CoreService"),v.ICharsetService=(0,D.createDecorator)("CharsetService"),v.IDirtyRowService=(0,D.createDecorator)("DirtyRowService"),v.IInstantiationService=(0,D.createDecorator)("InstantiationService"),v.ILogService=(0,D.createDecorator)("LogService"),v.IOptionsService=(0,D.createDecorator)("OptionsService"),(O=v.LogLevelEnum||(v.LogLevelEnum={}))[O.DEBUG=0]="DEBUG",O[O.INFO=1]="INFO",O[O.WARN=2]="WARN",O[O.ERROR=3]="ERROR",O[O.OFF=4]="OFF",v.IUnicodeService=(0,D.createDecorator)("UnicodeService")},1480:(N,v,L)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.UnicodeService=void 0;var O=L(8460),D=L(225),w=function(){function g(){this._providers=Object.create(null),this._active="",this._onChange=new O.EventEmitter;var b=new D.UnicodeV6;this.register(b),this._active=b.version,this._activeProvider=b}return Object.defineProperty(g.prototype,"onChange",{get:function(){return this._onChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"versions",{get:function(){return Object.keys(this._providers)},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"activeVersion",{get:function(){return this._active},set:function(b){if(!this._providers[b])throw new Error('unknown Unicode version "'+b+'"');this._active=b,this._activeProvider=this._providers[b],this._onChange.fire(b)},enumerable:!1,configurable:!0}),g.prototype.register=function(b){this._providers[b.version]=b},g.prototype.wcwidth=function(b){return this._activeProvider.wcwidth(b)},g.prototype.getStringCellWidth=function(b){for(var T=0,f=b.length,p=0;p<f;++p){var E=b.charCodeAt(p);if(55296<=E&&E<=56319){if(++p>=f)return T+this.wcwidth(E);var u=b.charCodeAt(p);56320<=u&&u<=57343?E=1024*(E-55296)+u-56320+65536:T+=this.wcwidth(u)}T+=this.wcwidth(E)}return T},g}();v.UnicodeService=w}},H={};function k(N){var v=H[N];if(v!==void 0)return v.exports;var L=H[N]={exports:{}};return de[N].call(L.exports,L,L.exports,k),L.exports}var j={};return(()=>{var N=j;Object.defineProperty(N,"__esModule",{value:!0}),N.Terminal=void 0;var v=k(3236),L=k(9042),O=k(7975),D=k(7090),w=k(5741),g=k(8285),b=function(){function T(f){this._core=new v.Terminal(f),this._addonManager=new w.AddonManager}return T.prototype._checkProposedApi=function(){if(!this._core.optionsService.options.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")},Object.defineProperty(T.prototype,"onBell",{get:function(){return this._core.onBell},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"onBinary",{get:function(){return this._core.onBinary},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"onCursorMove",{get:function(){return this._core.onCursorMove},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"onData",{get:function(){return this._core.onData},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"onKey",{get:function(){return this._core.onKey},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"onLineFeed",{get:function(){return this._core.onLineFeed},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"onRender",{get:function(){return this._core.onRender},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"onResize",{get:function(){return this._core.onResize},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"onScroll",{get:function(){return this._core.onScroll},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"onSelectionChange",{get:function(){return this._core.onSelectionChange},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"onTitleChange",{get:function(){return this._core.onTitleChange},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"element",{get:function(){return this._core.element},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"parser",{get:function(){return this._checkProposedApi(),this._parser||(this._parser=new O.ParserApi(this._core)),this._parser},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"unicode",{get:function(){return this._checkProposedApi(),new D.UnicodeApi(this._core)},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"textarea",{get:function(){return this._core.textarea},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"rows",{get:function(){return this._core.rows},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"cols",{get:function(){return this._core.cols},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"buffer",{get:function(){return this._checkProposedApi(),this._buffer||(this._buffer=new g.BufferNamespaceApi(this._core)),this._buffer},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"markers",{get:function(){return this._checkProposedApi(),this._core.markers},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"modes",{get:function(){var f=this._core.coreService.decPrivateModes,p="none";switch(this._core.coreMouseService.activeProtocol){case"X10":p="x10";break;case"VT200":p="vt200";break;case"DRAG":p="drag";break;case"ANY":p="any"}return{applicationCursorKeysMode:f.applicationCursorKeys,applicationKeypadMode:f.applicationKeypad,bracketedPasteMode:f.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:p,originMode:f.origin,reverseWraparoundMode:f.reverseWraparound,sendFocusMode:f.sendFocus,wraparoundMode:f.wraparound}},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"options",{get:function(){return this._core.options},enumerable:!1,configurable:!0}),T.prototype.blur=function(){this._core.blur()},T.prototype.focus=function(){this._core.focus()},T.prototype.resize=function(f,p){this._verifyIntegers(f,p),this._core.resize(f,p)},T.prototype.open=function(f){this._core.open(f)},T.prototype.attachCustomKeyEventHandler=function(f){this._core.attachCustomKeyEventHandler(f)},T.prototype.registerLinkMatcher=function(f,p,E){return this._checkProposedApi(),this._core.registerLinkMatcher(f,p,E)},T.prototype.deregisterLinkMatcher=function(f){this._checkProposedApi(),this._core.deregisterLinkMatcher(f)},T.prototype.registerLinkProvider=function(f){return this._checkProposedApi(),this._core.registerLinkProvider(f)},T.prototype.registerCharacterJoiner=function(f){return this._checkProposedApi(),this._core.registerCharacterJoiner(f)},T.prototype.deregisterCharacterJoiner=function(f){this._checkProposedApi(),this._core.deregisterCharacterJoiner(f)},T.prototype.registerMarker=function(f){return this._checkProposedApi(),this._verifyIntegers(f),this._core.addMarker(f)},T.prototype.addMarker=function(f){return this.registerMarker(f)},T.prototype.hasSelection=function(){return this._core.hasSelection()},T.prototype.select=function(f,p,E){this._verifyIntegers(f,p,E),this._core.select(f,p,E)},T.prototype.getSelection=function(){return this._core.getSelection()},T.prototype.getSelectionPosition=function(){return this._core.getSelectionPosition()},T.prototype.clearSelection=function(){this._core.clearSelection()},T.prototype.selectAll=function(){this._core.selectAll()},T.prototype.selectLines=function(f,p){this._verifyIntegers(f,p),this._core.selectLines(f,p)},T.prototype.dispose=function(){this._addonManager.dispose(),this._core.dispose()},T.prototype.scrollLines=function(f){this._verifyIntegers(f),this._core.scrollLines(f)},T.prototype.scrollPages=function(f){this._verifyIntegers(f),this._core.scrollPages(f)},T.prototype.scrollToTop=function(){this._core.scrollToTop()},T.prototype.scrollToBottom=function(){this._core.scrollToBottom()},T.prototype.scrollToLine=function(f){this._verifyIntegers(f),this._core.scrollToLine(f)},T.prototype.clear=function(){this._core.clear()},T.prototype.write=function(f,p){this._core.write(f,p)},T.prototype.writeUtf8=function(f,p){this._core.write(f,p)},T.prototype.writeln=function(f,p){this._core.write(f),this._core.write(`\r
|
|
171
|
+
`,p)},T.prototype.paste=function(f){this._core.paste(f)},T.prototype.getOption=function(f){return this._core.optionsService.getOption(f)},T.prototype.setOption=function(f,p){this._core.optionsService.setOption(f,p)},T.prototype.refresh=function(f,p){this._verifyIntegers(f,p),this._core.refresh(f,p)},T.prototype.reset=function(){this._core.reset()},T.prototype.clearTextureAtlas=function(){this._core.clearTextureAtlas()},T.prototype.loadAddon=function(f){return this._addonManager.loadAddon(this,f)},Object.defineProperty(T,"strings",{get:function(){return L},enumerable:!1,configurable:!0}),T.prototype._verifyIntegers=function(){for(var f=[],p=0;p<arguments.length;p++)f[p]=arguments[p];for(var E=0,u=f;E<u.length;E++){var a=u[E];if(a===1/0||isNaN(a)||a%1!=0)throw new Error("This API only accepts integers")}},T}();N.Terminal=b})(),j})()})},15263:(Ne,de,H)=>{"use strict";H.d(de,{Z:()=>O});var k=H(8081),j=H.n(k),N=H(23645),v=H.n(N),L=v()(j());L.push([Ne.id,'@-webkit-keyframes react-loading-skeleton{to{-webkit-transform:translate(100%);transform:translate(100%)}}@keyframes react-loading-skeleton{to{-webkit-transform:translate(100%);transform:translate(100%)}}.react-loading-skeleton{--base-color:#ebebeb;--highlight-color:#f5f5f5;--animation-duration:1.5s;--animation-direction:normal;--pseudo-element-display:block;background-color:var(--base-color);border-radius:.25rem;display:inline-flex;line-height:1;overflow:hidden;position:relative;width:100%;z-index:1}.react-loading-skeleton:after{-webkit-animation-direction:var(--animation-direction);animation-direction:var(--animation-direction);-webkit-animation-duration:var(--animation-duration);animation-duration:var(--animation-duration);-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-name:react-loading-skeleton;animation-name:react-loading-skeleton;-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out;background-image:linear-gradient(90deg,var(--base-color),var(--highlight-color),var(--base-color));background-repeat:no-repeat;content:" ";display:var(--pseudo-element-display);height:100%;left:0;position:absolute;right:0;-webkit-transform:translate(-100%);transform:translate(-100%)}',""]);const O=L},84282:(Ne,de,H)=>{"use strict";var k=H(93379),j=H.n(k),N=H(7795),v=H.n(N),L=H(90569),O=H.n(L),D=H(3565),w=H.n(D),g=H(19216),b=H.n(g),T=H(44589),f=H.n(T),p=H(15263),E={};E.styleTagTransform=f(),E.setAttributes=w(),E.insert=O().bind(null,"head"),E.domAPI=v(),E.insertStyleElement=b();var u=j()(p.Z,E),a=p.Z&&p.Z.locals?p.Z.locals:void 0},14080:(Ne,de,H)=>{"use strict";H.d(de,{y:()=>N,Z:()=>O});var k=H(2784);const j=k.createContext({});function N(g){var b=g,{children:D}=b,w=rh(b,["children"]);return k.createElement(j.Provider,{value:w},D)}const v=!0;function L({baseColor:D,highlightColor:w,width:g,height:b,borderRadius:T,circle:f,direction:p,duration:E,enableAnimation:u=v}){const a={};return p==="rtl"&&(a["--animation-direction"]="reverse"),typeof E=="number"&&(a["--animation-duration"]=`${E}s`),u||(a["--pseudo-element-display"]="none"),(typeof g=="string"||typeof g=="number")&&(a.width=g),(typeof b=="string"||typeof b=="number")&&(a.height=b),(typeof T=="string"||typeof T=="number")&&(a.borderRadius=T),f&&(a.borderRadius="50%"),typeof D!="undefined"&&(a["--base-color"]=D),typeof w!="undefined"&&(a["--highlight-color"]=w),a}function O(u){var a=u,{count:D=1,wrapper:w,className:g,containerClassName:b,containerTestId:T,circle:f=!1,style:p}=a,E=rh(a,["count","wrapper","className","containerClassName","containerTestId","circle","style"]);var n,s;const l=k.useContext(j),d=kg(al(al({},l),E),{circle:f}),A=al(al({},p),L(d));let S="react-loading-skeleton";g&&(S+=` ${g}`);const R=(n=d.inline)!==null&&n!==void 0?n:!1,y=[];for(let _=0;_<D;_++){const m=k.createElement("span",{className:S,style:A,key:_},"\u200C");R?y.push(m):y.push(k.createElement(k.Fragment,{key:_},m,k.createElement("br",null)))}return k.createElement("span",{className:b,"data-testid":T,"aria-live":"polite","aria-busy":(s=d.enableAnimation)!==null&&s!==void 0?s:v},w?y.map((_,m)=>k.createElement(w,{key:m},_)):y)}}};
|